当前位置: 首页>>代码示例>>Java>>正文


Java Filter.toString方法代码示例

本文整理汇总了Java中org.osgi.framework.Filter.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Filter.toString方法的具体用法?Java Filter.toString怎么用?Java Filter.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.framework.Filter的用法示例。


在下文中一共展示了Filter.toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Reference

import org.osgi.framework.Filter; //导入方法依赖的package包/类
/**
 * A constructor that initializes the object and creates the necessary {@link ServiceTracker}. The {@link #open()}
 * function has to be called before using the {@link #proxyInstance}.
 * 
 * @param context
 *            The context of the bundle that needs the reference.
 * @param interfaces
 *            The interfaces that the {@link #proxyInstance} should be able to be casted.
 * @param filter
 *            The filter expression that the available services will be checked against.
 * @param timeout
 *            The timeout until the functions calls on {@link #proxyInstance} will wait if no service is available.
 */
public Reference(final BundleContext context, final Class<?>[] interfaces, final Filter filter,
        final long timeout) {
    if (filter == null) {
        throw new IllegalArgumentException("The filter parameter cannot be null");
    }
    if ((interfaces == null) || (interfaces.length == 0)) {
        throw new IllegalArgumentException("The number of required interfaces must be at least one.");
    }
    this.filter = filter;
    serviceTrackerCustomizer = new ReferenceTrackerCustomizer(context, interfaces);

    serviceTracker = new ServiceTracker<Object, Object>(context, filter, serviceTrackerCustomizer);
    referenceInvocationHandler =
            new ReferenceInvocationHandler(this, serviceTracker, filter.toString(), timeout);

    Bundle blueprintBundle = context.getBundle();
    ClassLoader classLoader = blueprintBundle.adapt(BundleWiring.class).getClassLoader();
    // TODO check if classloader is null and handle it. It could be null in case of special security circumstances.

    proxyInstance = Proxy.newProxyInstance(classLoader, interfaces,
            referenceInvocationHandler);
}
 
开发者ID:everit-org-archive,项目名称:osgi-servicereference,代码行数:36,代码来源:Reference.java

示例2: checkForDeltaProperty

import org.osgi.framework.Filter; //导入方法依赖的package包/类
/**
 * If filter and event is for delta property, this then updates it
 *
 * @param filter
 * @param event
 * @param matchingProperties
 */
private void checkForDeltaProperty(Filter filter, GenericDeviceEvent event, Map<String, Object> matchingProperties) {
    if (filter != null) {
        String deltaProperty = filter.toString();
        Matcher matcher = DELTA_PATTERN.matcher(deltaProperty);
        if (matcher.find()) {
            deltaProperty = matcher.group(2);
            // Is this an event update for the delta property?
            if (event.properties.get(deltaProperty) != null) {
                updateDelta(matchingProperties, deltaProperty, event, matcher);
            }
        }
    }
}
 
开发者ID:Ericsson-LMF,项目名称:IoT-Gateway,代码行数:21,代码来源:EventManager.java

示例3: createServiceUnavailableException

import org.osgi.framework.Filter; //导入方法依赖的package包/类
private static RuntimeException createServiceUnavailableException(Filter filter) {
	return new ServiceUnavailableException("service matching filter=[" + filter + "] unavailable", filter
			.toString());
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:5,代码来源:BlueprintExceptionFactory.java

示例4: addServiceListener

import org.osgi.framework.Filter; //导入方法依赖的package包/类
/**
 * Adds a service listener to the given bundle context under the specified
 * filter. This method will deliver <em>synthetic</em> events of type
 * <code>REGISTERED</code> for <em>all</em> existing services (that
 * match the given filter) as if the services were registered after the
 * listener registration.
 * 
 * <p/> This might cause problems if a service is registered between the
 * listener registration and the retrieval of existing services since the
 * listener will receive two events for the same service. For most listeners
 * implementations however, this should not be a problem
 * 
 * @param context bundle context to register the listener with
 * @param listener service listener to be registered
 * @param filter OSGi filter (given as a Filter) for registering the
 * listener (can be <code>null</code>)
 * @see #addServiceListener(BundleContext, ServiceListener, String)
 */
public static void addServiceListener(BundleContext context, ServiceListener listener, Filter filter) {
	String toStringFilter = (filter == null ? null : filter.toString());
	addServiceListener(context, listener, toStringFilter);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:23,代码来源:OsgiListenerUtils.java

示例5: addSingleServiceListener

import org.osgi.framework.Filter; //导入方法依赖的package包/类
/**
 * Adds a service listener to the given bundle context, under the specified
 * filter. This method will deliver at most one <em>synthetic</em> event
 * of type <code>REGISTERED</code> for the <em>best matching</em>
 * existing service as if the services were registered after the listener
 * registration.
 * 
 * 
 * <p/> This might cause problems if a service is registered between the
 * listener registration and the retrieval of existing services since the
 * listener will receive two events for the same service. For most listeners
 * implementations however, this should not be a problem
 * 
 * 
 * @param context bundle context to register the listener with
 * @param listener service listener to be registered
 * @param filter OSGi filter (given as a Filter) for registering the
 * listener (can be <code>null</code>)
 * @see #addSingleServiceListener(BundleContext, ServiceListener, String)
 */
public static void addSingleServiceListener(BundleContext context, ServiceListener listener, Filter filter) {
	String toStringFilter = (filter == null ? null : filter.toString());
	addSingleServiceListener(context, listener, toStringFilter);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:25,代码来源:OsgiListenerUtils.java


注:本文中的org.osgi.framework.Filter.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。