org.apache.felix.http.base.internal.service
Class HttpServiceFactory

java.lang.Object
  extended by org.apache.felix.http.base.internal.service.HttpServiceFactory
All Implemented Interfaces:
ServiceFactory

public final class HttpServiceFactory
extends Object
implements ServiceFactory


Constructor Summary
HttpServiceFactory(ServletContext context, HandlerRegistry handlerRegistry, javax.servlet.ServletContextAttributeListener attributeListener, boolean sharedContextAttributes)
           
 
Method Summary
 Object getService(Bundle bundle, ServiceRegistration reg)
          Creates a new service object.
 void ungetService(Bundle bundle, ServiceRegistration reg, Object service)
          Releases a service object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServiceFactory

public HttpServiceFactory(ServletContext context,
                          HandlerRegistry handlerRegistry,
                          javax.servlet.ServletContextAttributeListener attributeListener,
                          boolean sharedContextAttributes)
Method Detail

getService

public Object getService(Bundle bundle,
                         ServiceRegistration reg)
Description copied from interface: ServiceFactory
Creates a new service object.

The Framework invokes this method the first time the specified bundle requests a service object using the BundleContext.getService(ServiceReference) method. The service factory can then return a specific service object for each bundle.

The Framework caches the value returned (unless it is null), and will return the same service object on any future call to BundleContext.getService for the same bundle. This means the Framework must not allow this method to be concurrently called for the same bundle.

The Framework will check if the returned service object is an instance of all the classes named when the service was registered. If not, then null is returned to the bundle.

Specified by:
getService in interface ServiceFactory
Parameters:
bundle - The bundle using the service.
reg - The ServiceRegistration object for the service.
Returns:
A service object that must be an instance of all the classes named when the service was registered.
See Also:
BundleContext.getService(org.osgi.framework.ServiceReference)

ungetService

public void ungetService(Bundle bundle,
                         ServiceRegistration reg,
                         Object service)
Description copied from interface: ServiceFactory
Releases a service object.

The Framework invokes this method when a service has been released by a bundle. The service object may then be destroyed.

Specified by:
ungetService in interface ServiceFactory
Parameters:
bundle - The bundle releasing the service.
reg - The ServiceRegistration object for the service.
service - The service object returned by a previous call to the ServiceFactory.getService method.
See Also:
BundleContext.ungetService(org.osgi.framework.ServiceReference)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.