Search in sources :

Example 31 with Activate

use of org.osgi.service.component.annotations.Activate in project bndtools by bndtools.

the class ReposTemplateLoader method activate.

@Activate
void activate() {
    if (promiseFactory == null) {
        localExecutor = Executors.newCachedThreadPool();
        promiseFactory = new PromiseFactory(localExecutor);
    }
}
Also used : PromiseFactory(org.osgi.util.promise.PromiseFactory) Activate(org.osgi.service.component.annotations.Activate)

Example 32 with Activate

use of org.osgi.service.component.annotations.Activate in project bndtools by bndtools.

the class ExtensionRegistryTemplateLoader method activate.

@Activate
void activate() {
    typeToExtPoint.put("project", "projectTemplates");
    typeToExtPoint.put("workspace", "workspaceTemplates");
    if (promiseFactory == null) {
        localExecutor = Executors.newCachedThreadPool();
        promiseFactory = new PromiseFactory(localExecutor);
    }
}
Also used : PromiseFactory(org.osgi.util.promise.PromiseFactory) Activate(org.osgi.service.component.annotations.Activate)

Example 33 with Activate

use of org.osgi.service.component.annotations.Activate in project bndtools by bndtools.

the class PlainGitWorkspaceTemplateLoader method activate.

@Activate
void activate(BundleContext context) {
    iconUrl = context.getBundle().getEntry("icons/git-16px.png");
    if (promiseFactory == null) {
        localExecutor = Executors.newCachedThreadPool();
        promiseFactory = new PromiseFactory(localExecutor);
    }
}
Also used : PromiseFactory(org.osgi.util.promise.PromiseFactory) Activate(org.osgi.service.component.annotations.Activate)

Example 34 with Activate

use of org.osgi.service.component.annotations.Activate in project flux by eclipse.

the class JDTComponent method activate.

@Activate
public void activate(final ComponentContext context) throws Exception {
    final boolean lazyStart = org.eclipse.flux.core.Activator.getDefault().isLazyStart();
    final ChannelSwitcher channelSwitcher = org.eclipse.flux.core.Activator.getDefault().getChannelSwitcher();
    final MessageConnector messagingConnector = org.eclipse.flux.core.Activator.getDefault().getMessageConnector();
    if (messagingConnector != null) {
        new Thread() {

            @Override
            public void run() {
                String userChannel = channelSwitcher.getChannel();
                JdtChannelListener jdtChannelListener = new JdtChannelListener();
                for (; userChannel == null; userChannel = channelSwitcher.getChannel()) {
                    try {
                        sleep(WAIT_TIME_PERIOD);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                discoveryConnector = new ServiceDiscoveryConnector(channelSwitcher, messagingConnector, JDT_SERVICE_ID, lazyStart);
                if (lazyStart) {
                    keepAliveConnector = new KeepAliveConnector(channelSwitcher, messagingConnector, JDT_SERVICE_ID);
                }
                jdtChannelListener.connected(userChannel);
                messagingConnector.addChannelListener(jdtChannelListener);
            }
        }.start();
    }
}
Also used : MessageConnector(org.eclipse.flux.client.MessageConnector) KeepAliveConnector(org.eclipse.flux.core.KeepAliveConnector) ChannelSwitcher(org.eclipse.flux.core.ChannelSwitcher) ServiceDiscoveryConnector(org.eclipse.flux.core.ServiceDiscoveryConnector) Activate(org.osgi.service.component.annotations.Activate)

Example 35 with Activate

use of org.osgi.service.component.annotations.Activate in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class FormHandlerImpl method activate.

@Activate
protected void activate(Config config) {
    int connectionTimeout = config.connectionTimeout();
    if (connectionTimeout < 0) {
        throw new IllegalArgumentException("Connection timeout value cannot be less than 0");
    }
    int socketTimeout = config.socketTimeout();
    if (socketTimeout < 0) {
        throw new IllegalArgumentException("Socket timeout value cannot be less than 0");
    }
    RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(connectionTimeout).setConnectionRequestTimeout(connectionTimeout).setSocketTimeout(socketTimeout).build();
    client = clientBuilderFactory.newBuilder().setDefaultRequestConfig(requestConfig).build();
}
Also used : RequestConfig(org.apache.http.client.config.RequestConfig) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)78 BundleContext (org.osgi.framework.BundleContext)12 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)7 IOException (java.io.IOException)6 Hashtable (java.util.Hashtable)6 File (java.io.File)5 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)5 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)3 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)3 ServiceReference (org.osgi.framework.ServiceReference)3 PromiseFactory (org.osgi.util.promise.PromiseFactory)3 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)3 JsonObject (com.google.gson.JsonObject)2 Dictionary (java.util.Dictionary)2 ObjectName (javax.management.ObjectName)2 WhiteboardExecutor (org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor)2 LoginException (org.apache.sling.api.resource.LoginException)2 ServiceListener (org.osgi.framework.ServiceListener)2 ServiceTracker (org.osgi.util.tracker.ServiceTracker)2