Search in sources :

Example 31 with Activate

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

the class OpenshiftContainerProvider method activate.

@Activate
void activate(Map<String, ?> configuration) throws Exception {
    updateConfiguration(configuration);
    configurer.configure(configuration, this);
    activateComponent();
    if (mbeanServer != null) {
        objectName = new ObjectName("io.fabric8:type=OpenShift");
        mbean = new OpenShiftFacade(this);
        if (!mbeanServer.isRegistered(objectName)) {
            mbeanServer.registerMBean(mbean, objectName);
        }
    }
}
Also used : ObjectName(javax.management.ObjectName) Activate(org.apache.felix.scr.annotations.Activate)

Example 32 with Activate

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

the class OpenShiftDeployAgent method activate.

@Activate
void activate(Map<String, ?> configuration) {
    // this.realm =  properties != null && properties.containsKey(REALM_PROPERTY_NAME) ? properties.get(REALM_PROPERTY_NAME) : DEFAULT_REALM;
    // this.role =  properties != null && properties.containsKey(ROLE_PROPERTY_NAME) ? properties.get(ROLE_PROPERTY_NAME) : DEFAULT_ROLE;
    group = new ZooKeeperGroup(curator.get(), ZkPath.OPENSHIFT.getPath(), ControllerNode.class);
    group.add(this);
    group.update(createState());
    group.start();
    activateComponent();
}
Also used : ZooKeeperGroup(io.fabric8.groups.internal.ZooKeeperGroup) Activate(org.apache.felix.scr.annotations.Activate)

Example 33 with Activate

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

the class MQCreate method activate.

@Activate
void activate() {
    bindOptionalCompleter("--kind", new BrokerKindCompleter());
    activateComponent();
}
Also used : BrokerKindCompleter(io.fabric8.commands.support.BrokerKindCompleter) Activate(org.apache.felix.scr.annotations.Activate)

Example 34 with Activate

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

the class MavenProxyRegistrationHandler method init.

@Activate
void init(Map<String, ?> configuration) throws Exception {
    configurer.get().configure(configuration, this);
    if (uploadRepository == null) {
        uploadRepository = runtimeProperties.get().getProperty("runtime.data") + "/maven/upload";
    }
    int timeout = -1;
    if (configAdmin.getOptional() != null) {
        ConfigurationAdmin ca = configAdmin.get();
        Configuration c = ca.getConfiguration("io.fabric8.agent", null);
        if (c != null && c.getProperties() != null) {
            String t = (String) c.getProperties().get("org.ops4j.pax.url.mvn.socket.readTimeout");
            if (t == null) {
                t = (String) c.getProperties().get("org.ops4j.pax.url.mvn.timeout");
            }
            if (t != null) {
                try {
                    timeout = Integer.parseInt(t);
                } catch (NumberFormatException ignored) {
                }
            }
        }
    }
    this.mavenDownloadProxyServlet = new MavenDownloadProxyServlet(mavenResolver.get(), runtimeProperties.get(), projectDeployer.get(), threadMaximumPoolSize, timeout);
    this.mavenDownloadProxyServlet.start();
    this.mavenUploadProxyServlet = new MavenUploadProxyServlet(mavenResolver.get(), runtimeProperties.get(), projectDeployer.get(), new File(uploadRepository), timeout);
    this.mavenUploadProxyServlet.start();
    try {
        HttpContext base = httpService.get().createDefaultHttpContext();
        HttpContext secure = new MavenSecureHttpContext(base, realm, role);
        httpService.get().registerServlet("/maven/download", mavenDownloadProxyServlet, createParams("maven-download"), base);
        httpService.get().registerServlet("/maven/upload", mavenUploadProxyServlet, createParams("maven-upload"), secure);
    } catch (Throwable t) {
        LOGGER.warn("Failed to register fabric maven proxy servlets, due to:" + t.getMessage());
    }
    activateComponent();
}
Also used : Configuration(org.osgi.service.cm.Configuration) HttpContext(org.osgi.service.http.HttpContext) ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin) File(java.io.File) Activate(org.apache.felix.scr.annotations.Activate)

Example 35 with Activate

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

the class FabricGitServiceImpl method activate.

@Activate
@VisibleForTesting
public void activate() throws IOException {
    RuntimeProperties sysprops = runtimeProperties.get();
    localRepo = sysprops.getDataPath().resolve(DEFAULT_GIT_PATH).toFile();
    if (!localRepo.exists() && !localRepo.mkdirs()) {
        throw new IOException("Failed to create local repository at:" + localRepo.getAbsolutePath());
    }
    git = openOrInit(localRepo);
    activateComponent();
}
Also used : IOException(java.io.IOException) RuntimeProperties(io.fabric8.api.RuntimeProperties) VisibleForTesting(io.fabric8.api.visibility.VisibleForTesting) 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