/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ public void removedService(ServiceReference<ContentHandler> reference, ServiceReference<ContentHandler> service) { //check to see if our URLStreamHandler was unregistered. if (reference != contentHandlerServiceReference) return; // If so, look for a lower ranking URLHandler // this should get us the highest ranking service left, if available ServiceReference<ContentHandler> newReference = contentHandlerServiceTracker.getServiceReference(); // if newReference == null then we will use the DefaultContentHandler here setNewHandler(newReference, getRank(newReference)); }
for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); proxy = new ContentHandlerProxy(contentType, null, context); proxies.put(contentType, proxy); return (proxy);
for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); proxy = new ContentHandlerProxy(contentType, null, context); proxies.put(contentType, proxy); return (proxy);
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ public void removedService(ServiceReference<ContentHandler> reference, ServiceReference<ContentHandler> service) { //check to see if our URLStreamHandler was unregistered. if (reference != contentHandlerServiceReference) return; // If so, look for a lower ranking URLHandler // this should get us the highest ranking service left, if available ServiceReference<ContentHandler> newReference = contentHandlerServiceTracker.getServiceReference(); // if newReference == null then we will use the DefaultContentHandler here setNewHandler(newReference, getRank(newReference)); }
for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); proxy = new ContentHandlerProxy(contentType, null, context); proxies.put(contentType, proxy); return (proxy);
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ public void removedService(ServiceReference<ContentHandler> reference, ServiceReference<ContentHandler> service) { //check to see if our URLStreamHandler was unregistered. if (reference != contentHandlerServiceReference) return; // If so, look for a lower ranking URLHandler // this should get us the highest ranking service left, if available ServiceReference<ContentHandler> newReference = contentHandlerServiceTracker.getServiceReference(); // if newReference == null then we will use the DefaultContentHandler here setNewHandler(newReference, getRank(newReference)); }
for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); proxy = new ContentHandlerProxy(contentType, null, context); proxies.put(contentType, proxy); return (proxy);
public ContentHandlerProxy(String contentType, ServiceReference<ContentHandler> reference, BundleContext context) { this.context = context; this.contentType = contentType; // In case the reference == null, the proxy is constructed with DefaultContentHandler for a Content Handler // until a real ContentHandler for this mime-type is registered setNewHandler(reference, getRank(reference)); contentHandlerServiceTracker = new ServiceTracker<ContentHandler, ServiceReference<ContentHandler>>(context, ContentHandler.class.getName(), this); URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker); }
for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); proxy = new ContentHandlerProxy(contentType, null, context); proxies.put(contentType, proxy); return (proxy);
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ public void removedService(ServiceReference<ContentHandler> reference, ServiceReference<ContentHandler> service) { //check to see if our URLStreamHandler was unregistered. if (reference != contentHandlerServiceReference) return; // If so, look for a lower ranking URLHandler // this should get us the highest ranking service left, if available ServiceReference<ContentHandler> newReference = contentHandlerServiceTracker.getServiceReference(); // if newReference == null then we will use the DefaultContentHandler here setNewHandler(newReference, getRank(newReference)); }
for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); proxy = new ContentHandlerProxy(contentType, null, context); proxies.put(contentType, proxy); return (proxy);
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ public void removedService(ServiceReference<ContentHandler> reference, ServiceReference<ContentHandler> service) { //check to see if our URLStreamHandler was unregistered. if (reference != contentHandlerServiceReference) return; // If so, look for a lower ranking URLHandler // this should get us the highest ranking service left, if available ServiceReference<ContentHandler> newReference = contentHandlerServiceTracker.getServiceReference(); // if newReference == null then we will use the DefaultContentHandler here setNewHandler(newReference, getRank(newReference)); }
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ public void removedService(ServiceReference<ContentHandler> reference, ServiceReference<ContentHandler> service) { //check to see if our URLStreamHandler was unregistered. if (reference != contentHandlerServiceReference) return; // If so, look for a lower ranking URLHandler // this should get us the highest ranking service left, if available ServiceReference<ContentHandler> newReference = contentHandlerServiceTracker.getServiceReference(); // if newReference == null then we will use the DefaultContentHandler here setNewHandler(newReference, getRank(newReference)); }
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(ServiceReference) */ public ServiceReference<ContentHandler> addingService(ServiceReference<ContentHandler> reference) { //check to see if our contentType is being registered by another service Object prop = reference.getProperty(URLConstants.URL_CONTENT_MIMETYPE); if (prop instanceof String) { prop = new String[] {(String) prop}; } if (!(prop instanceof String[])) { return null; } String[] contentTypes = (String[]) prop; for (int i = 0; i < contentTypes.length; i++) { if (contentTypes[i].equals(contentType)) { //If our contentType is registered by another service, check the service ranking and switch URLStreamHandlers if nessecary. int newServiceRanking = getRank(reference); if (newServiceRanking > ranking || contentHandlerServiceReference == null) setNewHandler(reference, newServiceRanking); return (reference); } } //we don't want to continue hearing events about a ContentHandler service not registered under our contentType return (null); }
public ContentHandlerProxy(String contentType, ServiceReference<ContentHandler> reference, BundleContext context) { this.context = context; this.contentType = contentType; // In case the reference == null, the proxy is constructed with DefaultContentHandler for a Content Handler // until a real ContentHandler for this mime-type is registered setNewHandler(reference, getRank(reference)); contentHandlerServiceTracker = new ServiceTracker<ContentHandler, ServiceReference<ContentHandler>>(context, ContentHandler.class.getName(), this); URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker); }
public ContentHandlerProxy(String contentType, ServiceReference<ContentHandler> reference, BundleContext context) { this.context = context; this.contentType = contentType; // In case the reference == null, the proxy is constructed with DefaultContentHandler for a Content Handler // until a real ContentHandler for this mime-type is registered setNewHandler(reference, getRank(reference)); contentHandlerServiceTracker = new ServiceTracker<ContentHandler, ServiceReference<ContentHandler>>(context, ContentHandler.class.getName(), this); URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker); }
public ContentHandlerProxy(String contentType, ServiceReference<ContentHandler> reference, BundleContext context) { this.context = context; this.contentType = contentType; // In case the reference == null, the proxy is constructed with DefaultContentHandler for a Content Handler // until a real ContentHandler for this mime-type is registered setNewHandler(reference, getRank(reference)); contentHandlerServiceTracker = new ServiceTracker<>(context, ContentHandler.class.getName(), this); URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker); }
public ContentHandlerProxy(String contentType, ServiceReference<ContentHandler> reference, BundleContext context) { this.context = context; this.contentType = contentType; // In case the reference == null, the proxy is constructed with DefaultContentHandler for a Content Handler // until a real ContentHandler for this mime-type is registered setNewHandler(reference, getRank(reference)); contentHandlerServiceTracker = new ServiceTracker<>(context, ContentHandler.class.getName(), this); URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker); }
/** * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(ServiceReference) */ public ServiceReference<ContentHandler> addingService(ServiceReference<ContentHandler> reference) { //check to see if our contentType is being registered by another service Object prop = reference.getProperty(URLConstants.URL_CONTENT_MIMETYPE); if (!(prop instanceof String[])) return null; String[] contentTypes = (String[]) prop; for (int i = 0; i < contentTypes.length; i++) { if (contentTypes[i].equals(contentType)) { //If our contentType is registered by another service, check the service ranking and switch URLStreamHandlers if nessecary. int newServiceRanking = getRank(reference); if (newServiceRanking > ranking || contentHandlerServiceReference == null) setNewHandler(reference, newServiceRanking); return (reference); } } //we don't want to continue hearing events about a ContentHandler service not registered under our contentType return (null); }
public ContentHandlerProxy(String contentType, ServiceReference<ContentHandler> reference, BundleContext context) { this.context = context; this.contentType = contentType; // In case the reference == null, the proxy is constructed with DefaultContentHandler for a Content Handler // until a real ContentHandler for this mime-type is registered setNewHandler(reference, getRank(reference)); contentHandlerServiceTracker = new ServiceTracker<ContentHandler, ServiceReference<ContentHandler>>(context, ContentHandler.class.getName(), this); URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker); }