private List<Command> getCommands(AppConfig config) { List<Command> commands = new ArrayList<Command>(); // Security List<Command> securityCommands = new ArrayList<Command>(); securityCommands.add(new DeployRolesCommand()); securityCommands.add(new DeployUsersCommand()); commands.addAll(securityCommands); // Databases List<Command> dbCommands = new ArrayList<Command>(); DeployContentDatabasesCommand dcdc = new DeployContentDatabasesCommand(); dcdc.setForestsPerHost(FORESTS_PER_HOST); dbCommands.add(dcdc); dbCommands.add(new DeployTriggersDatabaseCommand()); dbCommands.add(new DeploySchemasDatabaseCommand()); commands.addAll(dbCommands); // REST API instance creation commands.add(new DeployRestApiServersCommand()); // App servers List<Command> serverCommands = new ArrayList<Command>(); serverCommands.add(new UpdateRestApiServersCommand()); commands.addAll(serverCommands); // Modules LoadModulesCommand lmc = new LoadModulesCommand(); DefaultModulesLoader dml = new DefaultModulesLoader(config.newXccAssetLoader()); dml.setModulesManager(null); lmc.setModulesLoader(dml); commands.add(lmc); return commands; }
// idempotent public void install() { AdminManager manager = new AdminManager(); AppConfig config = new AppConfig(); config.setHost(host); config.setRestPort(8010); config.setName(HUB_NAME); config.setRestAdminUsername(username); config.setRestAdminPassword(password); List<String> paths = new ArrayList<String>(); paths.add(new File("src/hub-in-a-box").getAbsolutePath()); config.setModulePaths(paths); SimpleAppDeployer deployer = new SimpleAppDeployer(client, manager); deployer.setCommands(getCommands(config)); deployer.deploy(config); }