Search in sources :

Example 1 with ApplicationFactory

use of org.opennms.vaadin.extender.ApplicationFactory in project opennms by OpenNMS.

the class ApplicationFactoryServiceTracker method removedService.

@Override
public void removedService(ServiceReference reference, Object service) {
    ApplicationFactory factory = (ApplicationFactory) context.getService(reference);
    final ServiceRegistration servletRegistration = m_serviceRegistration.remove(factory);
    if (servletRegistration != null) {
        servletRegistration.unregister();
    }
    super.removedService(reference, service);
}
Also used : ApplicationFactory(org.opennms.vaadin.extender.ApplicationFactory) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 2 with ApplicationFactory

use of org.opennms.vaadin.extender.ApplicationFactory in project opennms by OpenNMS.

the class ApplicationFactoryServiceTracker method addingService.

@SuppressWarnings({ "unchecked" })
@Override
public Object addingService(ServiceReference reference) {
    ApplicationFactory factory = (ApplicationFactory) super.addingService(reference);
    if (factory == null)
        return null;
    FactoryServlet servlet = new FactoryServlet(factory, reference.getBundle().getBundleContext());
    Dictionary props = new Properties();
    for (String key : reference.getPropertyKeys()) {
        props.put(key, reference.getProperty(key));
    }
    if (props.get(Constants.ALIAS) == null) {
        logger.warn("You have not set the alias property for ApplicationFactory: " + factory);
    }
    m_serviceRegistration.put(factory, context.registerService(Servlet.class.getName(), servlet, props));
    return factory;
}
Also used : Dictionary(java.util.Dictionary) ApplicationFactory(org.opennms.vaadin.extender.ApplicationFactory) Properties(java.util.Properties)

Aggregations

ApplicationFactory (org.opennms.vaadin.extender.ApplicationFactory)2 Dictionary (java.util.Dictionary)1 Properties (java.util.Properties)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1