public static String createIdFilter( String idPropertyName, String idString, String filter){ String idFilter = OSGiUtils.createServiceFilter(idPropertyName, idString); if(filter == null || filter.isEmpty()){ filter = idFilter; }else{ filter = "(&" + idFilter + filter + ")"; } return filter; }
public static <C> ClassTracker<C> build(Class<C> clazz, Properties props){ String filter = OSGiUtils.createServiceFilter(props); return build(clazz, filter); }
/** * Returns an OSGi filter String for matching the given Robot.Id. * @param robotId the Robot.Id to match * @return OSGi filter String for matching the given Robot.Id */ public static String getRobotFilter(Robot.Id robotId){ if(robotId == null){ throw new NullPointerException(); } return OSGiUtils.createServiceFilter(Robot.PROP_ID, robotId.toString()); } /**
public static Boolean serviceExists( BundleContext context, String clazz, Properties props){ String filter = createServiceFilter(props); return serviceExists(context, clazz, filter); }
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 <Conf,Param> SingleServiceListener<ConfigurationWriter<Conf,Param>> createWriterServiceListener(BundleContext context, Class<Conf> configClass, Class<Param> paramClass, VersionProperty configFormat, String serviceFilter){ Properties props = new Properties(); props.put(Constants.CONFIG_FORMAT_VERSION, configFormat.toString()); props.put(Constants.CONFIG_CLASS, configClass.getName()); props.put(Constants.CONFIG_PARAM_CLASS, paramClass.getName()); String writerFilter = OSGiUtils.createServiceFilter(props); if(serviceFilter != null && !serviceFilter.isEmpty()){ writerFilter = "(&"+writerFilter+"("+serviceFilter+"))"; } return new SingleServiceListener( ConfigurationWriter.class, context, serviceFilter); } }
public void updateDisplay(Boolean status){ updateStatus(status); if(myDependency == null){ lblName.setText("--"); lblFilter.setText("--"); lblType.setText("--"); return; } String name = myDependency.getDependencyName(); Descriptor desc = myDependency.getDescriptor(); String type = desc.getClassName(); Properties props = new Properties(); for(String key: desc.getPropertyKeys()){ props.put(key, desc.getProperty(key)); } String filter = OSGiUtils.createServiceFilter(props); name = name == null ? "--" : name; type = type == null ? "--" : type; filter = filter == null ? "--" : filter; lblName.setText(name); lblFilter.setText(filter); lblType.setText(type); }
props.put(Constants.CONFIG_FORMAT_VERSION, configFormat.toString()); String filter = OSGiUtils.createServiceFilter(props); ServiceReference[] refs; try{
public void updateDisplay(Boolean status){ updateStatus(status, null); if(myDependency == null){ lblName.setText("--"); lblFilter.setText("--"); lblType.setText("--"); return; } String name = myDependency.getDependencyName(); Descriptor desc = myDependency.getDescriptor(); String type = desc.getClassName(); Properties props = new Properties(); for(String key: desc.getPropertyKeys()){ props.put(key, desc.getProperty(key)); } String filter = OSGiUtils.createServiceFilter(props); name = name == null ? "--" : name; type = type == null ? "--" : type; filter = filter == null ? "--" : filter; lblName.setText(name); lblFilter.setText(filter); lblType.setText(type); }
public static DependencyDescriptor buildDescriptor(Configuration<String> a) { if(a == null){ throw new NullPointerException(); } String name = a.getPropertyValue( String.class, CONF_DEPENDENCY_NAME); Class clazz = a.getPropertyValue( Class.class, CONF_DEPENDENCY_CLASS); Properties props = a.getPropertyValue( Properties.class, CONF_DEPENDENCY_PROPERTIES); String filter = OSGiUtils.createServiceFilter(props); return new DependencyDescriptor(name, clazz, filter); }
props.put(key, desc.getProperty(key)); String filter = OSGiUtils.createServiceFilter(props); if(sb.getDependencyName() != null && p.matcher(sb.getDependencyName()).matches()){
props.put(key, desc.getProperty(key)); String filter = OSGiUtils.createServiceFilter(props); if(sb.getDependencyName() != null && p.matcher(sb.getDependencyName()).matches()){