@Override public void run() { Properties props = null; if(key != null){ props = new Properties(); props.put(key, val); } new OSGiComponent(context, new SimpleLifecycle(obj, clazz, props)).start(); } };
public SimpleLifecycle( T service, String[] serviceClassNames, String idKey, String idStr, Properties props){ this(service, serviceClassNames, getProps(idKey, idStr, props)); }
@Override public void run() { Properties props = null; if(key != null){ props = new Properties(); props.put(key, val); } new OSGiComponent(context, new SimpleLifecycle(obj, clazz, props)).start(); } };
private static ServiceLifecycleProvider getBindingConfigLifecycle( String paramId, File file){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, paramId); props.put(Constants.CONFIG_FORMAT_VERSION, VisemeBindingManagerAvroConfigLoader.VERSION.toString()); props.put("FilePath", file.getAbsolutePath()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle(file, File.class, props); return lifecycle; }
private static ServiceLifecycleProvider getBindingConfigStreamLifecycle( String paramId, InputStream stream){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, paramId); props.put(Constants.CONFIG_FORMAT_VERSION, VisemeBindingManagerConfigAvroStreamLoader.VERSION.toString()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle(stream, InputStream.class, props); return lifecycle; } }
private static ServiceLifecycleProvider<FrameCombiner> buildFrameCombinerLauncher(Robot.Id robotId){ Properties props = new Properties(); props.put(Robot.PROP_ID, robotId.getRobtIdString()); props.put(Blender.PROP_POSITION_MAP_TYPE, RobotPositionMap.class.getName()); return new SimpleLifecycle<FrameCombiner>( getFrameCombiner(), FrameCombiner.class, props); }
public static ManagedService startComponent(BundleContext context, String[] classNames, Object service, Properties serviceProperties){ if(context == null || service == null){ throw new NullPointerException(); } SimpleLifecycle lifecycle = new SimpleLifecycle(service, classNames, null); OSGiComponent comp = new OSGiComponent(context, lifecycle, serviceProperties); comp.start(); return comp; }
protected static OSGiComponent launchJointGroupConfig(BundleContext context, File jointGroupConfigXML, String configFileId){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, configFileId); props.put(Constants.CONFIG_FORMAT_VERSION, RobotJointGroupConfigXMLReader.VERSION.toString()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle( jointGroupConfigXML, File.class, props); OSGiComponent paramComp = new OSGiComponent(context, lifecycle); paramComp.start(); return paramComp; }
public static ManagedService startUniqueComponent(BundleContext context, String[] classNames, Object service, Properties uniqueProps, Properties serviceProperties){ if(context == null || service == null){ throw new NullPointerException(); } SimpleLifecycle lifecycle = new SimpleLifecycle(service, classNames, null); OSGiComponent comp = new OSGiComponent( context, lifecycle, serviceProperties, uniqueProps, true); comp.start(); return comp; }
private static OSGiComponent launchJointGroupConfig( BundleContext context, File file, String paramId){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, paramId); props.put(Constants.CONFIG_FORMAT_VERSION, RobotJointGroupConfigXMLReader.VERSION.toString()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle(file, File.class, props); OSGiComponent paramComp = new OSGiComponent(context, lifecycle); paramComp.start(); return paramComp; }
private static OSGiComponent launchRobotConfig( BundleContext context, File file, String paramId){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, paramId); props.put(Constants.CONFIG_FORMAT_VERSION, RobotConfigXMLReader.VERSION.toString()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle(file, File.class, props); OSGiComponent paramComp = new OSGiComponent(context, lifecycle); paramComp.start(); return paramComp; } }
private static ServiceLifecycleProvider<FrameSourceTracker> buildFrameSourceTrackerLauncher( BundleContext context, Robot.Id robotId){ Properties props = new Properties(); props.put(Robot.PROP_ID, robotId.getRobtIdString()); OSGiFrameSourceTracker tracker = new OSGiFrameSourceTracker(); tracker.init(context, OSGiUtils.createServiceFilter(props)); props.put(Blender.PROP_POSITION_MAP_TYPE, RobotPositionMap.class.getName()); return new SimpleLifecycle<FrameSourceTracker>( tracker, FrameSourceTracker.class, props); }
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 SimpleLifecycle buildSimpleLifecycle( Configuration<String> conf){ String[] availableClassNames = conf.getPropertyValue(String[].class, CONF_SERVICE_CLASSES); Properties props = conf.getPropertyValue(Properties.class, CONF_SERVICE_PROPERTIES); Object service = conf.getPropertyValue(CONF_SIMPLE_LIFECYCLE_SERVICE); if(availableClassNames == null || service == null){ throw new NullPointerException(); } return new SimpleLifecycle(service, availableClassNames, props); }
private static <Param> OSGiComponent launchJointGroupConfig( BundleContext context, Param jointGroupConfigParam, Class<Param> paramClass, String configParamId, Configuration<String> jgSvcConf){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, configParamId); props.put(Constants.CONFIG_FORMAT_VERSION, get(VersionProperty.class, jgSvcConf, CONF_CONFIG_READER_VERSION).toString()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle( jointGroupConfigParam, paramClass, props); OSGiComponent paramComp = new OSGiComponent(context, lifecycle); paramComp.start(); startedJointGroupConfigs.add(paramComp); return paramComp; }
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; }
private static <Param> OSGiComponent launchJointGroupConfig( BundleContext context, Param jointGroupConfigParam, Class<Param> paramClass, String configParamId, Configuration<String> jgSvcConf){ Properties props = new Properties(); props.put(Constants.CONFIG_PARAM_ID, configParamId); props.put(Constants.CONFIG_FORMAT_VERSION, get(VersionProperty.class, jgSvcConf, CONF_CONFIG_READER_VERSION).toString()); ServiceLifecycleProvider lifecycle = new SimpleLifecycle( jointGroupConfigParam, paramClass, props); OSGiComponent paramComp = new OSGiComponent(context, lifecycle); paramComp.start(); startedJointGroupConfigs.add(paramComp); return paramComp; }
context, mainRobotId, 40L)); OSGiComponent mfe = new OSGiComponent(context, new SimpleLifecycle( new PortableMotionFrameEvent.Factory(), MotionFrameEventFactory.class));
private void registerSignalFactory(BundleContext context){ if(OSGiUtils.serviceExists( context, AnimationSignal.AnimationSignalFactory.class, null)){ return; } new OSGiComponent(context, new SimpleLifecycle( new PortableAnimationSignal.Factory(), AnimationSignal.AnimationSignalFactory.class) ).start(); } }