use of org.apache.asterix.event.service.ILookupService in project asterixdb by apache.
the class ShutdownConfig method execCommand.
@Override
protected void execCommand() throws Exception {
InstallerDriver.initConfig(false);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
lookupService.stopService(AsterixEventService.getConfiguration());
}
use of org.apache.asterix.event.service.ILookupService in project asterixdb by apache.
the class AlterConfig method execCommand.
@Override
protected void execCommand() throws Exception {
InstallerDriver.initConfig(true);
String instanceName = ((AlterConfig) config).name;
AsterixEventServiceUtil.validateAsterixInstanceExists(instanceName, State.INACTIVE);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
AsterixInstance instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(instanceName);
AsterixEventServiceUtil.createClusterProperties(instance.getCluster(), instance.getAsterixConfiguration());
AsterixConfiguration asterixConfiguration = InstallerUtil.getAsterixConfiguration(((AlterConfig) config).confPath);
instance.setAsterixConfiguration(asterixConfiguration);
instance.setModifiedTimestamp(new Date());
lookupService.updateAsterixInstance(instance);
LOGGER.info("Altered configuration settings for Asterix instance: " + instanceName);
}
use of org.apache.asterix.event.service.ILookupService in project asterixdb by apache.
the class UninstallConfig method execCommand.
@Override
protected void execCommand() throws Exception {
InstallerDriver.initConfig(true);
UninstallConfig uninstallConfig = ((UninstallConfig) config);
String instanceName = uninstallConfig.name;
AsterixEventServiceUtil.validateAsterixInstanceExists(instanceName, State.INACTIVE);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
AsterixInstance instance = lookupService.getAsterixInstance(instanceName);
PatternCreator pc = PatternCreator.INSTANCE;
Patterns patterns = pc.getLibraryUninstallPattern(instance, uninstallConfig.dataverseName, uninstallConfig.libraryName);
AsterixEventServiceClient client = AsterixEventService.getAsterixEventServiceClient(instance.getCluster());
client.submit(patterns);
LOGGER.info("Uninstalled library " + uninstallConfig.libraryName);
}
use of org.apache.asterix.event.service.ILookupService 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