Skip navigation links


javax.servlet.sip.ar.spi
Class SipApplicationRouterProvider

java.lang.Object
  extended by javax.servlet.sip.ar.spi.SipApplicationRouterProvider


public abstract class SipApplicationRouterProvider
extends java.lang.Object

This class is used by the SIP Servlet container to load and instanciate the application router.
The application router must be packaged in accordance with the rules specified in the Service Provider document. Specifically, the jar file containing the application router implementation must include META-INF/services/javax.servlet.sip.ar.spi.SipApplicationRouterProvider file. The contents of the file indicate the name of the concrete public subclass of the SipApplicationRouterProvider class. The concrete subclass must have a no-arg public constructor.
As specified by the Service Provider framework, the providers may be installed by :

  1. Including the provider jar in the system classpath
  2. Including the provider jar in the extension class path
  3. Container-specific means


The example below shows an app router provider implementation installed in the system classpath (i.e. the first approach from the three options discussed above).

 public class AcmeAppRouter implements SipApplicationRouter {
  [...]
 }

 public class AcmeAppRouterProvider extends SipApplicationRouterProvider {
   private final AcmeAppRouter appRouter = new AcmeAppRouter();
   public AcmeAppRouterProvider() {
   }
   public SipApplicationRouter getSipApplicationRouter() {
     return appRouter;
   }
 }
 

The AcmeAppRouter is then packaged in a jar file and prepended to the system class path. The SIP servlet container can look up the application router in a manner outlined below.

 SipApplicationRouter getSipApplicationRouter() {
   Iterator ps = Service.providers(SipApplicationRouterProvider.class);
     while (ps.hasNext()) {
       SipApplicationRouterProvider p = (SipApplicationRouterProvider)ps.next();
       return p.getSipApplicationRouter();
     }
   return null;
 }

Since the SIP servlet specification allows for only one application router to be active at any given time, the container selects the first provider available in the system classpath.
Instead of relying on classpath order, the specification also defines a system property which instructs the container to load a given provider. The javax.servlet.sip.ar.spi.SipApplicationRouterProvider system property can be used to override loading behavior and force a specific provider implementation to be used. For portability reasons, containers that provide their own deployment mechanism for the application router SHOULD obey the system property, if specified by the deployer.

Since:
1.1

Constructor Summary
SipApplicationRouterProvider()
           

 

Method Summary
abstract  SipApplicationRouter getSipApplicationRouter()
          Retrieve an instance of the application router created by this provider

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

SipApplicationRouterProvider

public SipApplicationRouterProvider()

Method Detail

getSipApplicationRouter

public abstract SipApplicationRouter getSipApplicationRouter()
Retrieve an instance of the application router created by this provider
Returns:
application router instance

Skip navigation links

Copyright 1996, 2010, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Java SIP Servlet API 1.1 Reference

Part Number E17883-01