Search in sources :

Example 16 with Dictionary

use of java.util.Dictionary in project opennms by OpenNMS.

the class SyslogdReceiverCamelNettyBlueprintIT method addServicesOnStartup.

@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
    // Register any mock OSGi services here
    final MessageDispatcherFactory messageProducerFactory = mock(MessageDispatcherFactory.class);
    final MinionIdentity minionIdentity = mock(MinionIdentity.class);
    services.put(MessageDispatcherFactory.class.getName(), new KeyValueHolder<Object, Dictionary>(messageProducerFactory, new Properties()));
    services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(minionIdentity, new Properties()));
}
Also used : Dictionary(java.util.Dictionary) MinionIdentity(org.opennms.minion.core.api.MinionIdentity) Properties(java.util.Properties) MessageDispatcherFactory(org.opennms.core.ipc.sink.api.MessageDispatcherFactory)

Example 17 with Dictionary

use of java.util.Dictionary in project opennms by OpenNMS.

the class LocationAwareDetectorClientIT method addServicesOnStartup.

@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
    services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(new MinionIdentity() {

        @Override
        public String getId() {
            return "0";
        }

        @Override
        public String getLocation() {
            return REMOTE_LOCATION_NAME;
        }
    }, new Properties()));
    Properties props = new Properties();
    props.setProperty("alias", "opennms.broker");
    services.put(Component.class.getName(), new KeyValueHolder<Object, Dictionary>(queuingservice, props));
    services.put(ServiceDetectorRegistry.class.getName(), new KeyValueHolder<Object, Dictionary>(serviceDetectorRegistry, new Properties()));
}
Also used : Dictionary(java.util.Dictionary) ServiceDetectorRegistry(org.opennms.netmgt.provision.detector.registry.api.ServiceDetectorRegistry) MinionIdentity(org.opennms.minion.core.api.MinionIdentity) Properties(java.util.Properties) Component(org.apache.camel.Component)

Example 18 with Dictionary

use of java.util.Dictionary in project opennms by OpenNMS.

the class SyslogdReceiverJavaNetBlueprintIT method addServicesOnStartup.

@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
    // Register any mock OSGi services here
    final MessageDispatcherFactory messageProducerFactory = mock(MessageDispatcherFactory.class);
    final MinionIdentity minionIdentity = mock(MinionIdentity.class);
    services.put(MessageDispatcherFactory.class.getName(), new KeyValueHolder<Object, Dictionary>(messageProducerFactory, new Properties()));
    services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(minionIdentity, new Properties()));
}
Also used : Dictionary(java.util.Dictionary) MinionIdentity(org.opennms.minion.core.api.MinionIdentity) Properties(java.util.Properties) MessageDispatcherFactory(org.opennms.core.ipc.sink.api.MessageDispatcherFactory)

Example 19 with Dictionary

use of java.util.Dictionary in project jetty.project by eclipse.

the class Activator method start.

/**
     * 
     * @param context
     */
public void start(BundleContext context) throws Exception {
    //Create webappA as a Service and target it at the default server
    WebAppContext webapp = new WebAppContext();
    webapp.addServlet(new ServletHolder(new TestServlet()), "/mime");
    Dictionary props = new Hashtable();
    props.put("war", "webappA");
    props.put("contextPath", "/acme");
    props.put("managedServerName", "defaultJettyServer");
    _srA = context.registerService(WebAppContext.class.getName(), webapp, props);
    //Create a second webappB as a Service and target it at a custom Server
    //deployed by another bundle
    WebAppContext webappB = new WebAppContext();
    Dictionary propsB = new Hashtable();
    propsB.put("war", "webappB");
    propsB.put("contextPath", "/acme");
    propsB.put("managedServerName", "fooServer");
    _srB = context.registerService(WebAppContext.class.getName(), webappB, propsB);
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) Dictionary(java.util.Dictionary) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) Hashtable(java.util.Hashtable)

Example 20 with Dictionary

use of java.util.Dictionary in project aries by apache.

the class BaseManagedServiceFactory method internalDelete.

private void internalDelete(String pid, int code) {
    Pair<T, ServiceRegistration> pair = services.remove(pid);
    if (pair != null) {
        registrations.remove(pair.getSecond());
        Dictionary properties = JavaUtils.getProperties(pair.getSecond().getReference());
        try {
            preUnregister(pair.getFirst(), properties, pair.getSecond());
            pair.getSecond().unregister();
        } catch (Throwable t) {
            LOGGER.info("Error unregistering service", t);
        }
        try {
            doDestroy(pair.getFirst(), properties, code);
        } catch (Throwable t) {
            LOGGER.info("Error destroying service", t);
        }
    }
}
Also used : Dictionary(java.util.Dictionary) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Aggregations

Dictionary (java.util.Dictionary)161 Hashtable (java.util.Hashtable)61 Test (org.junit.Test)48 Configuration (org.osgi.service.cm.Configuration)33 Enumeration (java.util.Enumeration)27 Properties (java.util.Properties)24 BundleContext (org.osgi.framework.BundleContext)21 ServiceReference (org.osgi.framework.ServiceReference)21 HashMap (java.util.HashMap)19 ServiceRegistration (org.osgi.framework.ServiceRegistration)19 Map (java.util.Map)17 ArrayList (java.util.ArrayList)15 Bundle (org.osgi.framework.Bundle)15 IOException (java.io.IOException)13 LinkedHashMap (java.util.LinkedHashMap)12 Matchers.anyString (org.mockito.Matchers.anyString)11 ConfigurationAdmin (org.osgi.service.cm.ConfigurationAdmin)10 ComponentContext (org.osgi.service.component.ComponentContext)10 TreeMap (java.util.TreeMap)9 MinionIdentity (org.opennms.minion.core.api.MinionIdentity)9