this.filter = context.createFilter(listenerFilter); } catch (InvalidSyntaxException e) {
this.listenerFilter = "(" + Constants.SERVICE_ID + "=" + reference.getProperty(Constants.SERVICE_ID).toString() + ")"; try { this.filter = context.createFilter(listenerFilter); } catch (InvalidSyntaxException e) {
private Filter buildHttpServiceFilter(BundleContext pBundleContext) { String customFilter = getConfiguration(ConfigKey.HTTP_SERVICE_FILTER); String filter = customFilter != null && customFilter.trim().length() > 0 ? "(&" + HTTP_SERVICE_FILTER_BASE + customFilter + ")" : HTTP_SERVICE_FILTER_BASE; try { return pBundleContext.createFilter(filter); } catch (InvalidSyntaxException e) { throw new IllegalArgumentException("Unable to parse filter " + filter,e); } }
private void openOSGiTrackers() { Filter filter = null; try { filter = context.createFilter(Location.INSTANCE_FILTER); } catch (InvalidSyntaxException e) { filter = context.createFilter(Location.USER_FILTER); } catch (InvalidSyntaxException e) { filter = context.createFilter(Location.CONFIGURATION_FILTER); } catch (InvalidSyntaxException e) { filter = context.createFilter(Location.INSTALL_FILTER); } catch (InvalidSyntaxException e) { filter = context.createFilter("(objectClass=" + IBundleGroupProvider.class.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (InvalidSyntaxException e) {
+ clazz.toString() + ")"; try { this.filter = context.createFilter(listenerFilter);
+ reference.getProperty(Constants.SERVICE_ID).toString() + ")"; try { this.filter = context.createFilter(listenerFilter);
/** * Creates a LDAP filter. * @param arg0 the String-form of the filter * @return the created filter object * @throws InvalidSyntaxException if the given argument is not a valid against the LDAP grammar. * @see org.osgi.framework.BundleContext#createFilter(java.lang.String) */ public Filter createFilter(String arg0) throws InvalidSyntaxException { return m_global.createFilter(arg0); }
public ManagedServiceTracker( BundleContext bundleContext, MetaTypeServiceImpl mts ) throws InvalidSyntaxException { super( bundleContext, bundleContext.createFilter( FILTER ), null ); this.mts = mts; }
/** * Creates a filter objects. * This method always uses the bundle context. * @param filter the string form of the LDAP filter to create * @return the filter object. * @throws InvalidSyntaxException if the given filter is malformed * @see org.osgi.framework.BundleContext#createFilter(java.lang.String) */ public Filter createFilter(String filter) throws InvalidSyntaxException { return m_bundleContext.createFilter(filter); }
public SingleServiceTracker(BundleContext context, String className, String filterString, BiConsumer<T, T> sl) throws InvalidSyntaxException { this.ctx = context; this.className = className; this.serviceListener = sl; if (filterString == null || filterString.isEmpty()) { this.filterString = null; this.filter = null; } else { this.filterString = filterString; this.filter = context.createFilter(filterString); } }
private Filter createFilter(String filterSt, BundleContext context) { try { return context.createFilter(filterSt); } catch (InvalidSyntaxException e) { throw new IllegalArgumentException("Invalid filter " + filterSt, e); } }
public void init() throws Exception { Filter filter = context.createFilter(String.format("(&(%s=*)(%s=*)(|(%s=%s)(%s=%s)))", CommandProcessor.COMMAND_SCOPE, CommandProcessor.COMMAND_FUNCTION, Constants.OBJECTCLASS, CommandWithAction.class.getName(), Constants.OBJECTCLASS, org.apache.felix.gogo.commands.CommandWithAction.class.getName())); this.tracker = new ServiceTracker<>(context, filter, this); this.tracker.open(); }
public void waitForService(String filter, long timeout) throws InvalidSyntaxException, InterruptedException { ServiceTracker<Object, Object> st = new ServiceTracker<>(bundleContext, bundleContext.createFilter(filter), null); try { st.open(); st.waitForService(timeout); } finally { st.close(); } }
public static <S, T> ServiceTracker<S, T> create( BundleContext bundleContext, String filterString) { try { return new ServiceTracker<>( bundleContext, bundleContext.createFilter(filterString), null); } catch (InvalidSyntaxException ise) { throwException(ise); return null; } }
private LicenseObject getDistribution(String name) { try { List<LicenseObject> list = m_distributionRepository.get(m_context.createFilter("(" + LicenseObject.KEY_NAME + "=" + name + ")")); if (list.size() == 1) { return list.get(0); } } catch (InvalidSyntaxException e) { } return null; }
EclipseScheduledApplication(BundleContext context, String id, String appPid, Map args, String topic, String eventFilter, boolean recurring) throws InvalidSyntaxException { this.id = id; this.appPid = appPid; this.args = args; this.topic = topic == null || topic.trim().equals("") || topic.trim().equals("*") ? null : topic; //$NON-NLS-1$ //$NON-NLS-2$ this.eventFilter = eventFilter; this.recurring = recurring; appTracker = new ServiceTracker(context, context.createFilter(FILTER_PREFIX + appPid + FILTER_POSTFIX), null); Activator.openTracker(appTracker, false); }
private static void initConfiguration() { closeConfiguration(); // just incase Filter filter = null; try { filter = context.createFilter(FILTER_PREFIX + PROP_CONFIG_AREA + "))"); //$NON-NLS-1$ } catch (InvalidSyntaxException e) { // ignore this. It should never happen as we have tested the above format. } configTracker = new ServiceTracker(context, filter, new AppPersistence()); configTracker.open(); }
private Filter createAndCheckFilter(String filter) throws ConfigurationException { Filter fil = null; if (filter != null) { try { fil = getInstanceManager().getContext().createFilter(filter); } catch (InvalidSyntaxException e) { throw new ConfigurationException("A requirement filter is invalid : " + filter, e); } } return fil; }
private boolean registerGateways() throws InvalidSyntaxException { boolean changed = false; String filter = "(&" + getConfigValue( ConfigItem.REGISTER_GW_FILTER) + "(" + StatefulGatewayObject.KEY_REGISTRATION_STATE + "=" + StatefulGatewayObject.RegistrationState.Unregistered + "))"; List<StatefulGatewayObject> sgos = m_statefulGatewayRepos.get(m_bundleContext.createFilter(filter)); for (StatefulGatewayObject sgo : sgos) { sgo.register(); changed = true; } return changed; }
private boolean setAutoApprove() throws InvalidSyntaxException { boolean changed = false; String filter = "(&" + getConfigValue( ConfigItem.AUTO_APPROVE_GW_FILTER) + "(" + StatefulGatewayObject.KEY_REGISTRATION_STATE + "=" + StatefulGatewayObject.RegistrationState.Registered + ")" + "(!(" + GatewayObject.KEY_AUTO_APPROVE + "=true)))"; List<StatefulGatewayObject> sgos = m_statefulGatewayRepos.get(m_bundleContext.createFilter(filter)); for (StatefulGatewayObject sgo : sgos) { sgo.setAutoApprove(true); changed = true; } return changed; }