use of org.apache.asterix.installer.schema.conf.Configuration in project asterixdb by apache.
the class AsterixInstallerIntegrationUtil method initZookeeperTestConfiguration.
private static void initZookeeperTestConfiguration(int port) throws JAXBException, FileNotFoundException {
String installerConfPath = InstallerDriver.getManagixHome() + File.separator + InstallerDriver.MANAGIX_CONF_XML;
JAXBContext ctx = JAXBContext.newInstance(Configuration.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
Configuration configuration = (Configuration) unmarshaller.unmarshal(new File(installerConfPath));
configuration.getZookeeper().setClientPort(new BigInteger("" + port));
Marshaller marshaller = ctx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(configuration, new FileOutputStream(installerConfPath));
}
use of org.apache.asterix.installer.schema.conf.Configuration in project asterixdb by apache.
the class ConfigureConfig method execCommand.
@Override
protected void execCommand() throws Exception {
configureCluster("local", "local.xml");
configureCluster("local", "local_chained_declustering_rep.xml");
configureCluster("local", "local_metadata_only_rep.xml");
configureCluster("demo", "demo.xml");
String installerConfPath = InstallerDriver.getManagixHome() + File.separator + InstallerDriver.MANAGIX_CONF_XML;
JAXBContext ctx = JAXBContext.newInstance(Configuration.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
Configuration configuration = (Configuration) unmarshaller.unmarshal(new File(installerConfPath));
configuration.setConfigured(true);
configuration.getBackup().setBackupDir(InstallerDriver.getManagixHome() + File.separator + "backup");
configuration.getZookeeper().setHomeDir(InstallerDriver.getManagixHome() + File.separator + InstallerDriver.MANAGIX_INTERNAL_DIR + File.separator + "zookeeper_home");
configuration.getZookeeper().getServers().setJavaHome(System.getProperty("java.home"));
Marshaller marshaller = ctx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(configuration, new FileOutputStream(installerConfPath));
}
use of org.apache.asterix.installer.schema.conf.Configuration in project asterixdb by apache.
the class ValidateConfig method validateConfiguration.
public boolean validateConfiguration() throws Exception {
String managixHome = System.getenv(InstallerDriver.ENV_MANAGIX_HOME);
File configFile = new File(managixHome + File.separator + InstallerDriver.MANAGIX_CONF_XML);
JAXBContext configCtx = JAXBContext.newInstance(Configuration.class);
Unmarshaller unmarshaller = configCtx.createUnmarshaller();
Configuration conf = (Configuration) unmarshaller.unmarshal(configFile);
return validateZookeeperConfiguration(conf);
}
use of org.apache.asterix.installer.schema.conf.Configuration in project asterixdb by apache.
the class InstallerDriver method initConfig.
public static void initConfig(boolean ensureLookupServiceIsRunning) throws Exception {
File configFile = new File(managixHome + File.separator + MANAGIX_CONF_XML);
JAXBContext configCtx = JAXBContext.newInstance(Configuration.class);
Unmarshaller unmarshaller = configCtx.createUnmarshaller();
Configuration conf = (Configuration) unmarshaller.unmarshal(configFile);
String asterixDir = managixHome + File.separator + ASTERIX_DIR;
String eventHome = managixHome + File.separator + MANAGIX_INTERNAL_DIR;
AsterixEventService.initialize(conf, asterixDir, eventHome);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
if (ensureLookupServiceIsRunning) {
if (!conf.isConfigured()) {
try {
configure();
/* read back the configuration file updated as part of configure command*/
conf = (Configuration) unmarshaller.unmarshal(configFile);
} catch (Exception e) {
e.printStackTrace();
}
}
if (!lookupService.isRunning(conf)) {
lookupService.startService(conf);
}
}
}
Aggregations