微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.osgi.framework.ServiceObjects的实例源码

项目:aries-jax-rs-whiteboard    文件Utils.java   
public static <T> ResourceProvider getResourceProvider(
    ServiceObjects<T> serviceObjects) {

    CachingServiceReference<T> serviceReference =
        new CachingServiceReference<>(
            serviceObjects.getServiceReference());

    return new ServiceReferenceResourceProvider(
        serviceReference,serviceObjects);
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
public static <T> Osgi<ServiceTuple<T>> onlyGettables(
    Osgi<CachingServiceReference<T>> program,Consumer<CachingServiceReference<T>> whenAddednotGettable,Consumer<CachingServiceReference<T>> whenLeavingNotGettable) {

    return bundleContext().flatMap(bundleContext ->
        program.recoverWith(
            (serviceReference,e) ->
                notGettableResult(
                    whenAddednotGettable,whenLeavingNotGettable,serviceReference)
        ).flatMap(serviceReference -> {
            ServiceObjects<T> serviceObjects =
                bundleContext.getServiceObjects(
                    serviceReference.getServiceReference());
            T service = serviceObjects.getService();

            if (service == null) {
                return notGettableResult(
                    whenAddednotGettable,serviceReference);
            }

            return
                onClose(
                    () -> serviceObjects.ungetService(service)
                ).then(
                    just(new ServiceTuple<>(
                        serviceReference,serviceObjects,service))
                );
        }));
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
public static <T> Osgi<ServiceObjects<T>> serviceObjects(
    CachingServiceReference<T> immutableServiceReference) {

    return
        bundleContext().flatMap(bundleContext ->
        just(bundleContext.getServiceObjects(
            immutableServiceReference.getServiceReference()))
    );
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
ServiceReferenceResourceProvider(
    CachingServiceReference<?> serviceReference,ServiceObjects<?> serviceObjects) {
    _serviceReference = serviceReference;

    _serviceObjects = serviceObjects;
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
@SuppressWarnings({ "rawtypes","unchecked" })
@Override
public Class<?> getResourceClass() {
    Object service = _serviceObjects.getService();

    try {
        return service.getClass();
    }
    finally {
        ((ServiceObjects)_serviceObjects).ungetService(service);
    }
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
ServiceTuple(
    CachingServiceReference<T> a,ServiceObjects<T> serviceObjects,T service) {

    _serviceReference = a;

    _serviceObjects = serviceObjects;
    _service = service;
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
@Override
@SuppressWarnings({ "unchecked","rawtypes" })
public void releaseInstance(Message m,Object o) {
    ((ServiceObjects)_serviceObjects).ungetService(o);
}
项目:aries-jax-rs-whiteboard    文件Utils.java   
public ServiceObjects<T> getServiceObjects() {
    return _serviceObjects;
}
项目:musicTreePrograms    文件MyBundleContext.java   
@Override
public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) {
  return null;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。