@Override public ComponentBuilderImpl autoConfig(Class<?> clazz, boolean autoConfig) { m_component.setAutoConfig(clazz, autoConfig); return this; }
@Override public ComponentBuilderImpl autoConfig(Class<?> clazz, String instanceName) { m_component.setAutoConfig(clazz, instanceName); return this; }
private void configureAutoConfigState(Component target, ComponentContext source, Class<?> clazz) { String name = source.getAutoConfigInstance(clazz); if (name != null) { target.setAutoConfig(clazz, name); } else { target.setAutoConfig(clazz, source.getAutoConfig(clazz)); } }
private void configureAutoConfigState(Component target, ComponentContext source, Class<?> clazz) { String name = source.getAutoConfigInstance(clazz); if (name != null) { target.setAutoConfig(clazz, name); } else { target.setAutoConfig(clazz, source.getAutoConfig(clazz)); } } }
private void registerConfigurationService() { Dictionary<String, Object> properties = new Hashtable<String, Object>(); properties.put(Constants.SERVICE_PID, CONFIG_PID); Component component = createComponent() .setInterface(ManagedService.class.getName(), properties) .setImplementation(this) .setAutoConfig(BundleContext.class, false) .setAutoConfig(DependencyManager.class, false) .setAutoConfig(Component.class, false); m_configuration = component; m_manager.add(component); }
private void registerConfigurationService() { Dictionary<String, Object> properties = new Hashtable<String, Object>(); properties.put(Constants.SERVICE_PID, HttpAdminConstants.SERVICE_PID); Component component = createComponent() .setInterface(ManagedService.class.getName(), properties) .setImplementation(this) .setAutoConfig(DependencyManager.class, false) .setAutoConfig(Component.class, false); m_configurationComponent = component; m_dependencyManager.add(component); }
c.setAutoConfig(BundleContext.class, Boolean.FALSE); c.setAutoConfig(ServiceRegistration.class, Boolean.FALSE); c.setAutoConfig(DependencyManager.class, Boolean.FALSE); c.setAutoConfig(Component.class, Boolean.FALSE); c.setAutoConfig(Bundle.class, Boolean.FALSE); if (bundleContextField != null) c.setAutoConfig(BundleContext.class, bundleContextField); if (dependencyManagerField != null) c.setAutoConfig(DependencyManager.class, dependencyManagerField); if (componentField != null) c.setAutoConfig(Component.class, componentField); if (registrationField != null) c.setAutoConfig(ServiceRegistration.class, registrationField); if (bundleField != null) c.setAutoConfig(Bundle.class, bundleField);
public void commit() { m_log.log(LogService.LOG_DEBUG, "commit"); Dictionary properties = new Properties(); properties.put(EventConstants.EVENT_TOPIC, EVENTTOPIC_COMPLETE); m_component = m_dm.createComponent() .setInterface(EventHandler.class.getName(), properties) .setImplementation(this) .setCallbacks(null, null, null, null) .setAutoConfig(Component.class, false) .add(m_dm.createServiceDependency() .setService(ConfigurationAdmin.class) .setCallbacks("addConfigurationAdmin", null) .setRequired(false) ); m_dm.add(m_component); m_log.log(LogService.LOG_DEBUG, "commit done"); }
public void init(BundleContext context, DependencyManager manager) throws Exception { Dictionary properties = new Properties(); properties.put(Constants.SERVICE_PID, "org.osgi.deployment.rp.autoconf"); AutoConfResourceProcessor processor = new AutoConfResourceProcessor(); manager.add(createComponent() .setInterface(ResourceProcessor.class.getName(), properties) .setAutoConfig(Component.class, false) .setImplementation(processor) .add(createServiceDependency() .setService(MetaTypeService.class) .setRequired(false)) .add(createServiceDependency() .setService(LogService.class) .setRequired(false))); }