java.lang.Object
java.net.ContentHandler
org.eclipse.osgi.framework.internal.protocol.ContentHandlerProxy
- All Implemented Interfaces:
- org.osgi.util.tracker.ServiceTrackerCustomizer
- public class ContentHandlerProxy
- extends java.net.ContentHandler
- implements org.osgi.util.tracker.ServiceTrackerCustomizer
The ContentHandlerProxy is a ContentHandler that acts as a proxy for registered ContentHandlers.
When a ContentHandler is requested from the ContentHandlerFactory and it exists in the service
registry, a ContentHandlerProxy is created which will pass all the requests from the requestor to
the real ContentHandler. We can't return the real ContentHandler from the ContentHandlerFactory
because the JVM caches ContentHandlers and therefore would not support a dynamic environment of
ContentHandlers being registered and unregistered.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
realHandler
protected java.net.ContentHandler realHandler
contentHandlerServiceTracker
protected org.osgi.util.tracker.ServiceTracker contentHandlerServiceTracker
context
protected org.osgi.framework.BundleContext context
contentHandlerServiceReference
protected org.osgi.framework.ServiceReference contentHandlerServiceReference
contentType
protected java.lang.String contentType
ranking
protected int ranking
ContentHandlerProxy
public ContentHandlerProxy(java.lang.String contentType,
org.osgi.framework.ServiceReference reference,
org.osgi.framework.BundleContext context)
setNewHandler
private void setNewHandler(org.osgi.framework.ServiceReference reference,
int rank)
addingService
public java.lang.Object addingService(org.osgi.framework.ServiceReference reference)
- Description copied from interface:
org.osgi.util.tracker.ServiceTrackerCustomizer
- A service is being added to the ServiceTracker object.
This method is called before a service which matched
the search parameters of the ServiceTracker object is
added to it. This method should return the
service object to be tracked for this ServiceReference object.
The returned service object is stored in the ServiceTracker object
and is available from the getService and getServices
methods.
- Specified by:
addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
modifiedService
public void modifiedService(org.osgi.framework.ServiceReference reference,
java.lang.Object service)
- Description copied from interface:
org.osgi.util.tracker.ServiceTrackerCustomizer
- A service tracked by the ServiceTracker object has been modified.
This method is called when a service being tracked
by the ServiceTracker object has had it properties modified.
- Specified by:
modifiedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
removedService
public void removedService(org.osgi.framework.ServiceReference reference,
java.lang.Object service)
- Description copied from interface:
org.osgi.util.tracker.ServiceTrackerCustomizer
- A service tracked by the ServiceTracker object has been removed.
This method is called after a service is no longer being tracked
by the ServiceTracker object.
- Specified by:
removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
getContent
public java.lang.Object getContent(java.net.URLConnection uConn)
throws java.io.IOException
- Description copied from class:
java.net.ContentHandler
- This method reads from the
InputStream of the passed in URL
connection and uses the data downloaded to create an Object
represening the content. For example, if the URL is pointing to a GIF
file, this method might return an Image object. This method
must be implemented by subclasses.
getRank
private int getRank(org.osgi.framework.ServiceReference reference)