public synchronized void start(){ if(myStartFlag){ return; } if(myServices == null){ myServices = new ArrayList<ManagedService>(myLifecycles.size()); } for(ServiceLifecycleProvider lifecycle : myLifecycles){ Properties props = new Properties(); props.putAll(myServiceProperties); ManagedService service = myFactory.createService(lifecycle, props); if(service != null){ myServices.add(service); service.start(); } } myStartFlag = true; }
@Override protected void addService(SceneSpec t) { if(t == null || myManagerMap.containsKey(t)){ return; } ServiceLifecycleProvider provider = new SceneLifecycle(t); ManagedService ms = myManagerFactory.createService(provider, mySceneRegistrationProperties); ms.start(); myManagerMap.put(t, ms); }
@Override protected void addService(SceneSpec t) { if(t == null || myManagerMap.containsKey(t)){ return; } ServiceLifecycleProvider provider = new SceneLifecycle(t); ManagedService ms = myManagerFactory.createService(provider, mySceneRegistrationProperties); ms.start(); myManagerMap.put(t, ms); }
@Override protected void addService(ChannelBindingConfig cbc) { //Called whenever a ChannelBindingConfig matching the OSGi filter is registered if(cbc == null || myManagerMap.containsKey(cbc)){ return; } List<DependencyDescriptor> depDescList = makeDepDescList(cbc); ServiceLifecycleProvider provider = new ChannelBindingLifecycle(depDescList, cbc); ManagedService ms = myManagerFactory.createService(provider, myBindingRegistrationProperties); ms.start(); myManagerMap.put(cbc, ms); }
@Override protected void addService(ChannelBindingConfig cbc) { //Called whenever a ChannelBindingConfig matching the OSGi filter is registered if(cbc == null || myManagerMap.containsKey(cbc)){ return; } List<DependencyDescriptor> depDescList = makeDepDescList(cbc); ServiceLifecycleProvider provider = new ChannelBindingLifecycle(depDescList, cbc); ManagedService ms = myManagerFactory.createService(provider, myBindingRegistrationProperties); ms.start(); myManagerMap.put(cbc, ms); }
private static <T> ManagedService<T> buildManagedService( ManagedServiceFactory factory, Configuration<String> config){ ServiceLifecycleProvider<T> lifecycle = getLifecycle(config); if(lifecycle == null){ throw new NullPointerException(); } Properties props = config.getPropertyValue( Properties.class, CONF_SERVICE_PROPERTIES); Properties uniqueProps = config.getPropertyValue( Properties.class, CONF_UNIQUE_SERVICE_PROPERTIES); return factory.createService(lifecycle, props, uniqueProps); }
public static void connect(ManagedServiceFactory fact, String speechGroupId, String speechPrefix, String connectionConfigId) { if(fact == null || speechGroupId == null || connectionConfigId == null){ throw new NullPointerException(); } registerDestConfigs(speechGroupId, speechPrefix, fact); launchComponents(speechGroupId, connectionConfigId, speechPrefix, null, fact); fact.createService( new VisemeEventNotifierLifecycle(speechGroupId), null).start(); launchRemoteSpeechClient(fact, speechGroupId, speechGroupId, speechPrefix + COMMAND_SENDER_ID, speechPrefix + CONFIG_SENDER_ID, speechPrefix + ERROR_RECEIVER_ID, speechPrefix + REQUEST_SENDER_ID, speechPrefix + EVENT_RECEIVER_ID); }
new SimpleLifecycle(sc, ServoController.class); ManagedService service = myServiceFactory.createService(lifecycle, props); myServoControllerServices.add(service); service.start();
private static void launchRemoteSpeechClient( ManagedServiceFactory fact, String speechClientId, String speechHostId, String commandSenderId, String configSenderId, String errorReceiverId, String speechRequestSenderId, String speechEventsReceiverId){ String idBase = speechClientId + "/" + GROUP_PREFIX; RemoteSpeechServiceClientLifecycle lifecycle = new RemoteSpeechServiceClientLifecycle( speechClientId, speechHostId, groupId(idBase, commandSenderId, NOTIFIER_COMPONENT), groupId(idBase, configSenderId, NOTIFIER_COMPONENT), groupId(idBase, errorReceiverId, LISTENER_COMPONENT), groupId(idBase, speechRequestSenderId, NOTIFIER_COMPONENT), groupId(idBase, speechEventsReceiverId, LISTENER_COMPONENT)); ManagedService speechComp = fact.createService(lifecycle, null); speechComp.start(); } private static String groupId(String groupId, String suffix, String component){