/** * Method called from our superclass, when we need to create a service. */ @SuppressWarnings("unchecked") public Component createService(Object[] properties) throws Exception { Dictionary<String, ?> settings = (Dictionary<String, ?>) properties[0]; Component newService = m_manager.createComponent(); // Merge adapter service properties, with CM settings Dictionary<String, Object> serviceProperties = getServiceProperties(settings); newService.setInterface(m_serviceInterfaces, serviceProperties); newService.setImplementation(m_serviceImpl); newService.setFactory(m_factory, m_factoryCreateMethod); // if not set, no effect newService.setComposition(m_compositionInstance, m_compositionMethod); // if not set, no effect newService.setCallbacks(m_callbackObject, m_init, m_start, m_stop, m_destroy); // if not set, no effect newService.setScope(m_scope); configureAutoConfigState(newService, m_component); copyDependencies(m_component.getDependencies(), newService); for (int i = 0; i < m_stateListeners.size(); i ++) { newService.add(m_stateListeners.get(i)); } // Instantiate the component, because we need to invoke the updated callback synchronously, in the CM calling thread. ((ComponentContext) newService).instantiateComponent(); CallbackTypeDef callbackInfo = createCallbackType(m_logger, newService, m_configTypes, settings); invokeUpdated(newService, callbackInfo); return newService; }