Search in sources :

Example 46 with Activate

use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.

the class ServletRegistrationHandler method activate.

@Activate
void activate(ComponentContext context, Map<String, ?> properties) {
    try {
        FabricDiscoveryServlet discoveryServlet = new FabricDiscoveryServlet();
        discoveryServlet.setCurator(curator.get());
        HttpContext base = httpService.get().createDefaultHttpContext();
        httpService.get().registerServlet("/mq-discovery", discoveryServlet, createParams("mq-discovery"), base);
    } catch (Throwable t) {
        LOGGER.warn("Failed to register fabric maven proxy servlets, due to:" + t.getMessage());
    }
    activateComponent();
}
Also used : HttpContext(org.osgi.service.http.HttpContext) Activate(org.apache.felix.scr.annotations.Activate)

Example 47 with Activate

use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.

the class KarafPropertiesService method activate.

@Activate
void activate(BundleContext bundleContext) {
    propsProvider = new OSGiPropertiesProvider(bundleContext);
    activateInternal();
    activateComponent();
}
Also used : OSGiPropertiesProvider(io.fabric8.api.gravia.OSGiPropertiesProvider) Activate(org.apache.felix.scr.annotations.Activate)

Example 48 with Activate

use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.

the class ArchetypeServiceImpl method activate.

@Activate
void activate(Map<String, ?> configuration, ComponentContext componentContext) throws Exception {
    if (mbeanServer != null) {
        JMXUtils.registerMBean(this, mbeanServer, OBJECT_NAME);
    }
    activateComponent();
    URL catalog = componentContext.getBundleContext().getBundle().getResource("archetype-catalog.xml");
    Archetypes archetypes = (Archetypes) Archetypes.newUnmarshaller().unmarshal(new StreamSource(catalog.openStream()));
    for (Archetype arch : archetypes.getArchetypes()) {
        this.archetypes.put(String.format("%s:%s:%s", arch.groupId, arch.artifactId, arch.version), arch);
    }
}
Also used : Archetype(io.fabric8.tooling.archetype.catalog.Archetype) StreamSource(javax.xml.transform.stream.StreamSource) Archetypes(io.fabric8.tooling.archetype.catalog.Archetypes) URL(java.net.URL) Activate(org.apache.felix.scr.annotations.Activate)

Example 49 with Activate

use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.

the class ArchetypeWorkspace method activate.

@Activate
void activate() {
    activateComponent();
    bindCompleter(new FileCompleter(null));
}
Also used : FileCompleter(org.apache.karaf.shell.console.completer.FileCompleter) Activate(org.apache.felix.scr.annotations.Activate)

Example 50 with Activate

use of org.apache.felix.scr.annotations.Activate in project fabric8 by jboss-fuse.

the class ArchetypeGenerate method activate.

@Activate
void activate() {
    bindOptionalCompleter("-d", new FileCompleter(null));
    activateComponent();
}
Also used : FileCompleter(org.apache.karaf.shell.console.completer.FileCompleter) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

Activate (org.apache.felix.scr.annotations.Activate)153 ConfigurationException (org.osgi.service.cm.ConfigurationException)31 ServiceTracker (org.osgi.util.tracker.ServiceTracker)20 BundleContext (org.osgi.framework.BundleContext)19 File (java.io.File)15 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)12 URL (java.net.URL)11 Hashtable (java.util.Hashtable)11 ServiceReference (org.osgi.framework.ServiceReference)11 ServiceTrackerCustomizer (org.osgi.util.tracker.ServiceTrackerCustomizer)9 HashSet (java.util.HashSet)8 IOException (java.io.IOException)7 HashMap (java.util.HashMap)7 Map (java.util.Map)6 Session (javax.jcr.Session)5 StandardMBean (javax.management.StandardMBean)5 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)5 Filter (org.osgi.framework.Filter)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4