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); }
public static ManagedService registerFactory( BundleContext context, ServiceFactory fact, Properties props){ if(context == null || fact == null){ throw new NullPointerException(); } if(props == null){ props = new Properties(); } props.put(Constants.SERVICE_VERSION, fact.getServiceVersion().toString()); props.put(Constants.SERVICE_CLASS, fact.getServiceClass().getName()); props.put(Constants.CONFIG_CLASS, fact.getConfigurationClass().getName()); ManagedService ms = new OSGiComponent(context, new SimpleLifecycle(fact, ServiceFactory.class), props); ms.start(); return ms; }
public static ManagedService registerConfigLoader( BundleContext context, ConfigurationLoader loader, Properties props){ if(context == null || loader == null){ throw new NullPointerException(); } if(props == null){ props = new Properties(); } props.put(Constants.CONFIG_FORMAT_VERSION, loader.getConfigurationFormat().toString()); props.put(Constants.CONFIG_CLASS, loader.getConfigurationClass().getName()); props.put(Constants.CONFIG_PARAM_CLASS, loader.getParameterClass().getName()); ManagedService ms = new OSGiComponent(context, new SimpleLifecycle(loader, ConfigurationLoader.class), props); ms.start(); return ms; }
public static ManagedService registerConfigWriter( BundleContext context, ConfigurationWriter writer, Properties props){ if(context == null || writer == null){ throw new NullPointerException(); } if(props == null){ props = new Properties(); } props.put(Constants.CONFIG_FORMAT_VERSION, writer.getConfigurationFormat().toString()); props.put(Constants.CONFIG_CLASS, writer.getConfigurationClass().getName()); props.put(Constants.CONFIG_PARAM_CLASS, writer.getParameterClass().getName()); ManagedService ms = new OSGiComponent(context, new SimpleLifecycle(writer, ConfigurationWriter.class), props); ms.start(); return ms; }
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); }
myServiceFactory.createService(lifecycle, props); myServoControllerServices.add(service); service.start();
@Override protected void handleFrameworkStartedEvent(BundleContext context) { com.hp.hpl.jena.rdf.model.Model jenaServiceModel = RDFDataMgr.loadModel(SERVICE_MODEL_PATH); Model model2go = new org.ontoware.rdf2go.impl.jena.ModelImplJena(jenaServiceModel); model2go.open(); MessageWiring2Go msg = new MessageWiring2Go(getInfModel(MSG_MODEL_PATH, SVC_MSG_ONTOLOGY_MODEL_PATH)); msg.loadMsgServices(context); Test2Go test = new Test2Go(); Properties props = new Properties(); props.put("bundleContext", "http://www.w3.org/2002/07/owl#bundleContextSpec"); ManagedService ms = new OSGiComponent(context, new SimpleLifecycle(context, BundleContext.class), props); ms.start(); test.registerServiceManagerEntites(model2go); test.startSpecExtender(context, null, model2go); }
myConnectionService.start(); ConnectionUtils.ensureSession(context, "remoteAnimConnection", con, null); registerEventFactory(context); ManagedService mySenderService = new OSGiComponent(context, senderLife); mySenderService.start(); ConnectionUtils.ensureSession(context, "remoteSignalConnection", con, null); "remoteSignalConnection", "remoteAnimationSignal"); ManagedService myReceiverService = new OSGiComponent(context, receiverLife); myReceiverService.start(); AnimationPlayerClientLifecycle myLifecycle = new AnimationPlayerClientLifecycle( "remoteSignalReceiver", context); ManagedService myPlayerService = new OSGiComponent(context, myLifecycle); myPlayerService.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){
private void launchRemotePlayer(BundleContext context, String playerId, String receiverId, String senderId, String conId, String destId){ JMSAvroMessageSenderLifecycle signalLife = new JMSAvroMessageSenderLifecycle( new PortableAnimationSignal.MessageRecordAdapter(), AnimationSignal.class, AnimationSignallingRecord.class, senderId, CONNECTION_ID, SIGNAL_DEST_ID); ManagedService myAnimationSenderService = new OSGiComponent(context, signalLife); myAnimationSenderService.start(); theLogger.info("Launching Dynamic RemoteAnimationPlayerHost Service."); new OSGiComponent(context, new AnimationPlayerHostLifecycle(playerId, receiverId, senderId) ).start(); JMSAvroAsyncReceiverLifecycle reqRecLifecycle = new JMSAvroAsyncReceiverLifecycle( new PortableAnimationEvent.RecordMessageAdapter(), AnimationEvent.class, AnimationEventRecord.class, AnimationEventRecord.SCHEMA$, ANIM_RECEIVER_ID, conId, destId); OSGiComponent reqRec = new OSGiComponent(context, reqRecLifecycle); reqRec.start(); theLogger.info("Dynamic RemoteAnimationPlayerHost Service Launched."); }
private void launchRemotePlayer(BundleContext context, String playerId, String receiverId, String senderId, String conId, String destId){ JMSAvroMessageSenderLifecycle signalLife = new JMSAvroMessageSenderLifecycle( new PortableAnimationSignal.MessageRecordAdapter(), AnimationSignal.class, AnimationSignallingRecord.class, senderId, CONNECTION_ID, SIGNAL_DEST_ID); ManagedService myAnimationSenderService = new OSGiComponent(context, signalLife); myAnimationSenderService.start(); theLogger.info("Launching Dynamic RemoteAnimationPlayerHost Service."); new OSGiComponent(context, new AnimationPlayerHostLifecycle(playerId, receiverId, senderId) ).start(); JMSAvroAsyncReceiverLifecycle reqRecLifecycle = new JMSAvroAsyncReceiverLifecycle( new PortableAnimationEvent.RecordMessageAdapter(), AnimationEvent.class, AnimationEventRecord.class, AnimationEventRecord.SCHEMA$, ANIM_RECEIVER_ID, conId, destId); OSGiComponent reqRec = new OSGiComponent(context, reqRecLifecycle); reqRec.start(); theLogger.info("Dynamic RemoteAnimationPlayerHost Service Launched."); }