SIP Servlet Engine© Documentations
 
  Top >   SIP Servlet Programming >   SPI (Service Provider Interface) >   Overview of SPI Operation
 
 

Overview of SPI Operation

SPI is deployed in the following sequence:

  • Read a definition file.
  • Load a class.
  • Instantiate the class.
  • Associate it with the interface.

com.oki.sip.provider.ProviderContainer is used to get the instantiated class.

The following APIs are used to create your application:

getDefaultProviderContainer()
Gets the default ProviderContainer on JavaVM.
getComponent(String componennt)
Gets an instance of the specified SPI. If SPI is not specified, it returns null.

Example:

ProviderContainer provider = ProviderContainer.getDefaultProviderContainer();
com.oki.sip.spi.Authenticator authenticator =
    (com.oki.sip.spi.Authenticator)provider.getComponent("com.oki.sip.spi.Authenticator");

SPI Definition File

The DTD of the SPI definition file is shown below:

<!--
    The "sse-spi" element defines SPI.
-->
<!ELEMENT level (param*)>

<!--
    The "spi" element defines the implementation class of each SPI.
    The Implements attribute describes SPI to be implemented.
    The ClassName attribute describes the class that implements the specified interface.
    The Version attribute describes the version of the implemented class (option).

    param specifies the parameter passed in the constructor.
    param-type specifies a primitive type (boolean, int, long)
    or java.lang.String.
    param-value specifies a value corresponding to the type specified in param-type.
    If param-type=boolean, param-value=true or false.
    If param-type=int, param-value=Integer.MIN_VALUE - Integer.MAX_VALUE.
    If param-type=long, param-value=Long.MIN_VALUE - Long.MAX_VALUE.
    If param-type=java.lang.String, param-value=<string>.
-->
<!ELEMENT spi (param*)>
<!ATTLIST spi
          Implements           NMTOKEN       #REQUIRED
          ClassName            CDATA         #REQUIRED
          Version              CDATA         #IMPLIED>

<!ELEMENT param (param-type, param-value)>
<!ELEMENT param-type (#PCDATA)>
<!ELEMENT param-value (#PCDATA)>

Example:

<sse-spi>
  <spi Implements="com.oki.sip.spi.Authenticator"
       ClassName ="com.oki.sip.provider.impl.SubscriberEditorImpl"
       Version   ="1.0">
    <param>
      <param-type>String<param-type>
      </param-value>SubscriberEditorBean</param-value>
    </param>
    <param>
      <param-type>String<param-type>
      </param-value>oki.co.jp</param-value>
    </param>
  </spi>
  ...
</sse-spi>

SPI Class Loader

The implementation class of SPI must be included in the class path to use from SIP Servlet Engine.

If you start the system using the startup script provided by SIP Servlet Engine, you can include this class in the class path by placing the jar file under ${BEA_HOME}/sip/lib.

Last Modified:Wed Jan 12 10:15:48 AM JST 2005