org.priha.j2ee
Class JNDIRegistrationServlet

java.lang.Object
  extended by HttpServlet
      extended by org.priha.j2ee.JNDIRegistrationServlet

public class JNDIRegistrationServlet
extends HttpServlet

This is a small helper class which can be used to register Priha to JNDI. To use this, just initialize it in any web.xml file, like thus:

    <servlet>
      <servlet-name>PrihaServlet</servlet-name>
      <servlet-class>org.priha.j2ee.JNDIRegistrationServlet</servlet-class>
      <load-on-startup>100</load-on-startup>
      
      <!-- The following is optional.  If there is no propertyfile parameter
           stated, will attempt to find "priha.properties" from the classpath. -->
              
      <init-param>
         <param-name>propertyfile<param-name>
         <param-value>/foo/bar/priha.properties<param-value>
      </init-param>
    </servlet>
 

Any servlet parameters which start with "java.naming." are added to the InitialContext environment.

In order then to fetch it in your web application, you would use something like this:

    Repository repository;
    Properties environment = new Properties();
    String lookupName = "priha.repository";
    
    InitialContext initial = new InitialContext(environment);
    Object obj = initial.lookup(lookupName);

    repository = (Repository)PortableRemoteObject.narrow(obj, Repository.class);
 


Field Summary
static java.lang.String JNDI_NAME
          Value under which the Repository object is bound by default.
static java.lang.String PARAM_PROPERTYFILE
          Servlet initialization parameter name for stating the name of the property file.
 
Constructor Summary
JNDIRegistrationServlet()
           
 
Method Summary
 void init()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNDI_NAME

public static final java.lang.String JNDI_NAME
Value under which the Repository object is bound by default. Value is "priha.repository".

See Also:
Constant Field Values

PARAM_PROPERTYFILE

public static final java.lang.String PARAM_PROPERTYFILE
Servlet initialization parameter name for stating the name of the property file. Value is "propertyfile".

See Also:
Constant Field Values
Constructor Detail

JNDIRegistrationServlet

public JNDIRegistrationServlet()
Method Detail

init

public void init()
          throws ServletException
Throws:
ServletException