Search in sources :

Example 1 with ILookupService

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());
}
Also used : ILookupService(org.apache.asterix.event.service.ILookupService)

Example 2 with ILookupService

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);
}
Also used : AsterixConfiguration(org.apache.asterix.common.configuration.AsterixConfiguration) AsterixInstance(org.apache.asterix.event.model.AsterixInstance) Date(java.util.Date) ILookupService(org.apache.asterix.event.service.ILookupService)

Example 3 with ILookupService

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);
}
Also used : AsterixEventServiceClient(org.apache.asterix.event.management.AsterixEventServiceClient) PatternCreator(org.apache.asterix.event.util.PatternCreator) AsterixInstance(org.apache.asterix.event.model.AsterixInstance) Patterns(org.apache.asterix.event.schema.pattern.Patterns) ILookupService(org.apache.asterix.event.service.ILookupService)

Example 4 with ILookupService

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);
        }
    }
}
Also used : Configuration(org.apache.asterix.installer.schema.conf.Configuration) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) File(java.io.File) ILookupService(org.apache.asterix.event.service.ILookupService)

Aggregations

ILookupService (org.apache.asterix.event.service.ILookupService)4 AsterixInstance (org.apache.asterix.event.model.AsterixInstance)2 File (java.io.File)1 Date (java.util.Date)1 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 AsterixConfiguration (org.apache.asterix.common.configuration.AsterixConfiguration)1 AsterixEventServiceClient (org.apache.asterix.event.management.AsterixEventServiceClient)1 Patterns (org.apache.asterix.event.schema.pattern.Patterns)1 PatternCreator (org.apache.asterix.event.util.PatternCreator)1 Configuration (org.apache.asterix.installer.schema.conf.Configuration)1