@Override public void componentOpened() { if(myServiceTracker == null){ BundleContext context = OSGiUtils.getBundleContext(ManagedService.class); if(context == null){ return; } setBundleContext(context); } }
@Override public void componentOpened() { if(myServiceListener != null){ return; } BundleContext context = OSGiUtils.getBundleContext(ServoController.class); if(context == null){ return; } dynamixelControlLoopPanel1.initialize(context); }
public static <C> ClassTracker<C> build(Class<C> clazz, String filter){ if(clazz == null){ throw new NullPointerException(); } BundleContext context = OSGiUtils.getBundleContext(clazz); if(context == null){ theLogger.log(Level.WARNING, "Could not find BundleContext for {0}", clazz); return null; } ClassTracker<C> tracker = new ClassTracker<C>( context, clazz.getName(), filter); return tracker; }
@Override public void actionPerformed(ActionEvent e) { File file = getFile(); if(file == null){ return; } BundleContext context = OSGiUtils.getBundleContext(JointGroup.class); if(context == null){ return; } launchService(context, file); }
@Override public void stopAll() { BundleContext context = OSGiUtils.getBundleContext(AnimationPlayer.class); if(context == null){ theLogger.log(Level.SEVERE, "Unable to find BundleContext for AnimationPlayer"); return; } ServiceReference ref = context.getServiceReference( RemoteAnimationPlayerClient.class.getName()); RemoteAnimationPlayerClient client = OSGiUtils.getService( RemoteAnimationPlayerClient.class, context, ref); if(client == null){ return; } client.stopAllAnimations(); } }
@Override public void play(){ BundleContext context = OSGiUtils.getBundleContext(AnimationPlayer.class); if(context == null){ theLogger.log(Level.SEVERE, "Unable to find BundleContext for AnimationPlayer"); return; } AnimationUtils.playAnimation( context, null, getValue().getEnabledAnimation()); } }
@Override public void loop(){ BundleContext context = OSGiUtils.getBundleContext(AnimationPlayer.class); if(context == null){ theLogger.log(Level.SEVERE, "Unable to find BundleContext for AnimationPlayer"); return; } ServiceReference ref = context.getServiceReference(RemoteAnimationPlayerClient.class.getName()); RemoteAnimationPlayerClient client = OSGiUtils.getService(RemoteAnimationPlayerClient.class, context, ref); if(client == null){ return; } client.loopAnimation(getValue().getEnabledAnimation()); } }
@Override public void stop(){ BundleContext context = OSGiUtils.getBundleContext(AnimationPlayer.class); if(context == null){ theLogger.log(Level.SEVERE, "Unable to find BundleContext for AnimationPlayer"); return; } ServiceReference ref = context.getServiceReference(RemoteAnimationPlayerClient.class.getName()); RemoteAnimationPlayerClient client = OSGiUtils.getService(RemoteAnimationPlayerClient.class, context, ref); if(client == null){ return; } client.stopAnimation(getValue().getEnabledAnimation()); } }
public static List<ServiceAddOn<Playable>> readAddOns(HierarchicalConfiguration config){ if(config == null){ return Collections.EMPTY_LIST; } List<HierarchicalConfiguration> nodes = (List<HierarchicalConfiguration>)config.configurationsAt(ADDON); if(nodes == null || nodes.isEmpty()){ return Collections.EMPTY_LIST; } BundleContext context = OSGiUtils.getBundleContext(ServiceAddOnDriver.class); if(context == null){ return Collections.EMPTY_LIST; } ServiceReference[] refs = AddOnUtils.getAddOnDriverReferences(context); List<ServiceAddOnDriver<Playable>> drivers = getAddOnDrivers(context, refs); List<ServiceAddOn<Playable>> addons = new ArrayList(nodes.size()); for(HierarchicalConfiguration node : nodes){ ServiceAddOn<Playable> addon = readAddOn(node, drivers); if(addon != null){ addons.add(addon); } } return addons; }
@Override public void componentOpened() { if (jointTreePanel1.isInitialized()) { return; } BundleContext context = OSGiUtils.getBundleContext(JointGroup.class); if (context != null) { jointTreePanel1.initialize(context); } jointTreePanel1.startUpdates(100); }
/** Creates new form JointTreePanel */ public RobotTreePanel() { initComponents(); BundleContext context = OSGiUtils.getBundleContext(Robot.class); if(context == null){ return; } myRobotTracker = new ServiceClassListener<Robot>(Robot.class, context, null) { @Override protected void addService(Robot t) { setRobot(); } @Override protected void removeService(Robot t) { setRobot(); } private void setRobot(){ Robot group = getTopService(); if(group == null){ return; }else if(group == myRobot){ return; } setModel(group); } }; myRobotTracker.start(); }
private void connect(String broker){ BundleContext context = OSGiUtils.getBundleContext(SpeechService.class); if(context == null){ theLogger.warning("Unable to connect speech Service. " + "Could not find BundleContext."); return; } bindSpeechPanel(context); ManagedServiceFactory fact = new OSGiComponentFactory(context); RKMessagingConfigUtils.registerConnectionConfig( CONNECTION_CONFIG_ID, broker, null, fact); RemoteSpeechUtils.connect( fact, SPEECH_SERVICE_ID, SPEECH_DEFAULT_PREFIX, CONNECTION_CONFIG_ID); }
@Override public void actionPerformed(ActionEvent e) { RobotManagerTopComponent manageComp = RobotManagerTopComponent.findInstance(); if(manageComp.isOpened()){ return; } BundleContext context = OSGiUtils.getBundleContext(Robot.class); if(context == null){ throw new NullPointerException(); } RobotManager manager = RobotUtils.getRobotManager(context); manageComp.initialize(manager); manageComp.open(); } }
return; BundleContext context = OSGiUtils.getBundleContext(Robot.class); if(context == null){ theLogger.warning(
public DynamixelTracker(final OpenServoControlLoop osLoop){ BundleContext context = OSGiUtils.getBundleContext(ServoController.class); myTracker = new SingleServiceListener<ServoController>( ServoController.class, context, OSGiUtils.createFilter(ServoController.PROP_VERSION, DynamixelController.VERSION.toString())); myTracker.addPropertyChangeListener(SingleServiceListener.PROP_SERVICE_TRACKED, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { DynamixelController controller = (DynamixelController)evt.getNewValue(); if(controller == null){ throw new IllegalArgumentException(); } DynamixelControlLoop loop = controller.getControlLoop(); if(loop == null){ throw new IllegalArgumentException(); } loop.setOpenServoLoop(osLoop); } }); myTracker.start(); }
@Override public void actionPerformed(ActionEvent e) { BundleContext context = OSGiUtils.getBundleContext(Robot.class); if(context == null){ theLogger.warning( "Unable to load Robot. Could not find BundleContext."); return; } Robot.Id robotId = new Robot.Id("myRobot"); launchRobot(context, robotId, "./resources/robot.xml"); RobotUtils.startDefaultBlender( context, robotId, theDefaultBlenderInterval); loadJointGroup(context, robotId, "./resources/jointgroup.xml"); String connectionConfigId = "remoteRobotConnectionConfig"; RKMessagingConfigUtils.registerConnectionConfig( connectionConfigId, "127.0.0.1", null, new OSGiComponentFactory(context)); new RemoteRobotHostServiceGroup( context, robotId, "host", "client", connectionConfigId, null, null, 100).start(); }
BundleContext context = OSGiUtils.getBundleContext(Robot.class); if(context == null){ theLogger.warning(