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);
}
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;
}
Aggregations