Search in sources :

Example 1 with ResourceChangeListener

use of org.apache.sling.installer.api.ResourceChangeListener in project sling by apache.

the class ServicesListener method notifyChange.

public synchronized void notifyChange() {
    // check if all services are available
    final ResourceChangeListener listener = (ResourceChangeListener) this.changeHandlerListener.getService();
    final ConfigurationAdmin configAdmin = (ConfigurationAdmin) this.configAdminListener.getService();
    if (configAdmin != null && listener != null) {
        if (configTaskCreator == null) {
            final Hashtable<String, String> props = new Hashtable<String, String>();
            props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Configuration Install Task Factory");
            props.put(Constants.SERVICE_VENDOR, VENDOR);
            props.put(InstallTaskFactory.NAME, "org.osgi.service.cm");
            props.put(ResourceTransformer.NAME, "org.osgi.service.cm");
            this.configTaskCreator = new ConfigTaskCreator(listener, configAdmin);
            // start and register osgi installer service
            final String[] serviceInterfaces = { InstallTaskFactory.class.getName(), ConfigurationListener.class.getName(), ResourceTransformer.class.getName() };
            configTaskCreatorRegistration = this.bundleContext.registerService(serviceInterfaces, configTaskCreator, props);
        }
    } else {
        this.stop();
    }
}
Also used : ConfigurationListener(org.osgi.service.cm.ConfigurationListener) InstallTaskFactory(org.apache.sling.installer.api.tasks.InstallTaskFactory) Hashtable(java.util.Hashtable) ResourceChangeListener(org.apache.sling.installer.api.ResourceChangeListener) ResourceTransformer(org.apache.sling.installer.api.tasks.ResourceTransformer) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin)

Aggregations

Hashtable (java.util.Hashtable)1 ResourceChangeListener (org.apache.sling.installer.api.ResourceChangeListener)1 InstallTaskFactory (org.apache.sling.installer.api.tasks.InstallTaskFactory)1 ResourceTransformer (org.apache.sling.installer.api.tasks.ResourceTransformer)1 ConfigurationAdmin (org.osgi.service.cm.ConfigurationAdmin)1 ConfigurationListener (org.osgi.service.cm.ConfigurationListener)1