org.ow2.jonas.web.base.osgi.httpservice
Class HttpServiceFactory<T extends BaseWebContainerService>

java.lang.Object
  extended by org.ow2.jonas.web.base.osgi.httpservice.HttpServiceFactory<T>
Type Parameters:
T - the web container service class.
All Implemented Interfaces:
org.osgi.framework.ServiceFactory

public abstract class HttpServiceFactory<T extends BaseWebContainerService>
extends Object
implements org.osgi.framework.ServiceFactory

ServiceFactory to create HttpService.

Author:
Guillaume Porcher, Florent Benoit

Constructor Summary
HttpServiceFactory(T webContainerService)
          Constructor.
 
Method Summary
protected abstract  JOnASHttpService buildHttpServiceImpl(org.osgi.framework.Bundle callerBundle, T webContainerService)
          Build an implementation of the Http service.
 Object getService(org.osgi.framework.Bundle callerBundle, org.osgi.framework.ServiceRegistration registration)
          Creates a new HttpService object.
protected  String getWorkDirectory()
           
 void setWorkDirectory(String workDir)
          Set the name of the working directory.
 void ungetService(org.osgi.framework.Bundle callerBundle, org.osgi.framework.ServiceRegistration registration, 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(T webContainerService)
Constructor.

Parameters:
webContainerService - the web container service to use.
Method Detail

getService

public Object getService(org.osgi.framework.Bundle callerBundle,
                         org.osgi.framework.ServiceRegistration registration)
Creates a new HttpService 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 from the same bundle.

Specified by:
getService in interface org.osgi.framework.ServiceFactory
Parameters:
callerBundle - The bundle using the service.
registration - The ServiceRegistration object for the service.
Returns:
An instance of HttpService.

buildHttpServiceImpl

protected abstract JOnASHttpService buildHttpServiceImpl(org.osgi.framework.Bundle callerBundle,
                                                         T webContainerService)
Build an implementation of the Http service.

Parameters:
callerBundle - The bundle using the service.
webContainerService - the web container service instance
Returns:
an implementation of the httpService

ungetService

public void ungetService(org.osgi.framework.Bundle callerBundle,
                         org.osgi.framework.ServiceRegistration registration,
                         Object service)
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 org.osgi.framework.ServiceFactory
Parameters:
callerBundle - The bundle releasing the service.
registration - The ServiceRegistration object for the service.
service - The service object returned by a previous call to the ServiceFactory.getService method.

setWorkDirectory

public void setWorkDirectory(String workDir)
Set the name of the working directory.

Parameters:
workDir - The name of the working directory.

getWorkDirectory

protected String getWorkDirectory()
Returns:
name of the working directory.


Copyright © 2013 OW2 Consortium. All Rights Reserved.