public ServoControllerContext(Class<Param> paramClass, Param param, VersionProperty controllerVersion, VersionProperty configFormat){ if(paramClass == null || param == null || controllerVersion == null || configFormat == null){ throw new NullPointerException(); } myServiceParams = new ConfiguredServiceParams( ServoController.class, null, paramClass, null, param, null, controllerVersion, configFormat); } }
private static ServiceLifecycleProvider getBindingManagerStreamLifecycle( Robot.Id robotId, String speechServiceId, String configFileId){ ConfiguredServiceParams< VisemeBindingManager, VisemeBindingManagerConfig, InputStream> params = new ConfiguredServiceParams( VisemeBindingManager.class, VisemeBindingManagerConfig.class, InputStream.class, null, null, configFileId, VisemeBindingManager.VERSION, VisemeBindingManagerConfigAvroStreamLoader.VERSION); Properties registrationProps = new Properties(); registrationProps.put(Robot.PROP_ID, robotId.getRobtIdString()); registrationProps.put(SpeechService.PROP_ID, speechServiceId); ConfiguredServiceLifecycle lifecycle = new ConfiguredServiceLifecycle(params, registrationProps); return lifecycle; } public static ManagedServiceGroup startVisemeFrameSourceStreamGroup(
private static ServiceLifecycleProvider getBindingManagerLifecycle( Robot.Id robotId, String speechServiceId, String configFileId){ ConfiguredServiceParams< VisemeBindingManager, VisemeBindingManagerConfig, File> params = new ConfiguredServiceParams( VisemeBindingManager.class, VisemeBindingManagerConfig.class, File.class, null, null, configFileId, VisemeBindingManager.VERSION, VisemeBindingManagerAvroConfigLoader.VERSION); Properties registrationProps = new Properties(); registrationProps.put(Robot.PROP_ID, robotId.getRobtIdString()); registrationProps.put(SpeechService.PROP_ID, speechServiceId); ConfiguredServiceLifecycle lifecycle = new ConfiguredServiceLifecycle(params, registrationProps); return lifecycle; }
private static void startRobot(BundleContext context, String path){ theLogger.info("Opening Robot Config File."); File file = ConfigUtils.getFileSystemAdapter().openFile(path); if(file == null){ return; } ConfiguredServiceParams<Robot,Object,File> robotParams = new ConfiguredServiceParams( Robot.class, null, File.class, null, file, null, ServoRobot.VERSION, RobotConfigXMLReader.VERSION); Properties props = new Properties(); props.put(Robot.PROP_ID, ROBOT_ID); ConfiguredServiceLifecycle<Robot,?,File> robotLifecycle = new ConfiguredServiceLifecycle<Robot,Object,File>(robotParams){ @Override protected Robot create(Map dependencies){ Robot robot = super.create(dependencies); if(robot == null){ return null; } robot.connect(); return robot; } }; OSGiComponent robotComp = new OSGiComponent( context, robotLifecycle, null, props, true); robotComp.start(); }
public RobotJointGroupLifecycle(Robot.Id robotId, Class<P> paramClass, String paramId, VersionProperty configFormat){ super(new ConfiguredServiceParams( JointGroup.class, RobotJointGroupConfig.class, paramClass, null, null, paramId, RobotJointGroup.VERSION, configFormat)); getDependencyDescriptors().add( new DescriptorBuilder(theRobot, Robot.class) .with(Robot.PROP_ID, robotId.getRobtIdString()) .getDescriptor()); if(myRegistrationProperties == null){ myRegistrationProperties = new Properties(); } myRegistrationProperties.put(Robot.PROP_ID, robotId.getRobtIdString()); }
public static <S,C,P> ConfiguredServiceParams<S,C,P> buildParams( Configuration<String> conf, C configInst, P paramInst){ return new ConfiguredServiceParams<S, C, P>( get(Class.class, conf, CONF_SERVICE_CLASS), get(Class.class, conf, CONF_CONFIG_CLASS), get(Class.class, conf, CONF_PARAM_CLASS), configInst, paramInst, get(String.class, conf, CONF_PARAM_ID), get(VersionProperty.class, conf, CONF_SERVICE_VERSION), get(VersionProperty.class, conf, CONF_CONFIG_READER_VERSION)); }