Restlet Framework 2.2.2
OSGi Environments

org.restlet.ext.osgi
Class BaseApplicationProvider

java.lang.Object
  extended by org.restlet.ext.osgi.BaseApplicationProvider
All Implemented Interfaces:
ApplicationProvider

public class BaseApplicationProvider
extends Object
implements ApplicationProvider

This class provides an implementation of ApplicationProvider. You register this class as an OSGi declarative service. The service declaration should look like:

 <?xml version="1.0" encoding="UTF-8"?>
 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.example.app">
   <implementation class="org.restlet.ext.osgi.BaseApplicationProvider"/>
   <property name="alias" type="String" value="/"/>
   <reference bind="bindRouterProvider" cardinality="1..1" interface="org.restlet.ext.osgi.RouterProvider" name="RouterProvider" policy="static" unbind="unbindRouterProvider"/>
   <service>
     <provide interface="org.restlet.ext.osgi.ApplicationProvider"/>
   </service>
 </scr:component>
 
 

The service properties are:

The referenced services are:

The provided services are:

Author:
Bryan Hunt

Field Summary
 
Fields inherited from interface org.restlet.ext.osgi.ApplicationProvider
SERVLET_CONFIG_ATTRIBUTE, SERVLET_CONTEXT_ATTRIBUTE
 
Constructor Summary
BaseApplicationProvider()
           
 
Method Summary
 void activate(org.osgi.service.component.ComponentContext context)
          Called by OSGi DS to activate the service after the router provider has been bound
 void bindRouterProvider(RouterProvider routerProvider)
          Called by OSGi DS to inject the router provider service
 Application createApplication(Context context)
           
protected  Application doCreateApplication(Context context)
          Called to construct the actual application instance.
 String getAlias()
          The alias is passed to HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) when the servlet is registered.
 Application getApplication()
          Accessor for the cached application instance
 org.osgi.service.http.HttpContext getContext()
          The context is passed to HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) when the servlet is registered.
 Dictionary<String,Object> getInitParms()
          The parameters are passed to HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) when the servlet is registered.
 void unbindRouterProvider(RouterProvider routerProvider)
          Called by OSGi DS to un-inject the router provider service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseApplicationProvider

public BaseApplicationProvider()
Method Detail

activate

public void activate(org.osgi.service.component.ComponentContext context)
Called by OSGi DS to activate the service after the router provider has been bound

Parameters:
context - the OSGi component context

bindRouterProvider

public void bindRouterProvider(RouterProvider routerProvider)
Called by OSGi DS to inject the router provider service

Parameters:
routerProvider - the router provider service

createApplication

public Application createApplication(Context context)
Specified by:
createApplication in interface ApplicationProvider
Returns:
the application to be register at the specified alias.

doCreateApplication

protected Application doCreateApplication(Context context)
Called to construct the actual application instance. Extenders will generally override this method.

Parameters:
context - the Restlet application context
Returns:
the newly constructed application instance

getAlias

public String getAlias()
Description copied from interface: ApplicationProvider
The alias is passed to HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) when the servlet is registered.

Specified by:
getAlias in interface ApplicationProvider
Returns:
the alias used to register with the server servlet.

getApplication

public Application getApplication()
Accessor for the cached application instance

Returns:
the application

getContext

public org.osgi.service.http.HttpContext getContext()
Description copied from interface: ApplicationProvider
The context is passed to HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) when the servlet is registered.

Specified by:
getContext in interface ApplicationProvider
Returns:
the context to use with the server servlet.

getInitParms

public Dictionary<String,Object> getInitParms()
Description copied from interface: ApplicationProvider
The parameters are passed to HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) when the servlet is registered.

Specified by:
getInitParms in interface ApplicationProvider
Returns:
the initialization parameters to use with the server servlet.

unbindRouterProvider

public void unbindRouterProvider(RouterProvider routerProvider)
Called by OSGi DS to un-inject the router provider service

Parameters:
routerProvider - the router provider service

Restlet Framework 2.2.2
OSGi Environments

Copyright © 2005-2014 Restlet.