org.apache.jackrabbit.j2ee
Class RepositoryAccessServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.jackrabbit.j2ee.RepositoryAccessServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class RepositoryAccessServlet
extends javax.servlet.http.HttpServlet

This Class implements a servlet that is used as unified mechanism to retrieve a jcr repository either through JNDI or RMI.

See Also:
Serialized Form

Nested Class Summary
protected static class RepositoryAccessServlet.ClientFactoryDelegater
          optional class for RMI, will only be used, if RMI client is present
protected static class RepositoryAccessServlet.RMIClientFactoryDelegater
          optional class for RMI, will only be used, if RMI server is present
 
Field Summary
static String INIT_PARAM_BOOTSTRAP_CONFIG
          initial param name for the bootstrap config location
 
Constructor Summary
RepositoryAccessServlet()
           
 
Method Summary
 BootstrapConfig getBootstrapConfig()
          Returns the config that was used to bootstrap this servlet.
static RepositoryAccessServlet getInstance(javax.servlet.ServletContext ctx)
          Returns the instance of this servlet
 Repository getRepository()
          Returns the JCR repository
static Repository getRepository(javax.servlet.ServletContext ctx)
          Returns the JCR repository
protected  Repository getRepositoryByContextAttribute()
          If our config said so, try to retrieve a Repository from the ServletContext
protected  String getServerFactoryDelegaterClass()
          Return the fully qualified name of the class providing the client repository.
 void init()
          Initializes the servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_PARAM_BOOTSTRAP_CONFIG

public static final String INIT_PARAM_BOOTSTRAP_CONFIG
initial param name for the bootstrap config location

See Also:
Constant Field Values
Constructor Detail

RepositoryAccessServlet

public RepositoryAccessServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initializes the servlet.
Please note that only one repository startup servlet may exist per webapp. it registers itself as context attribute and acts as singleton.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if a same servlet is already registered or of another initialization error occurs.

getInstance

public static RepositoryAccessServlet getInstance(javax.servlet.ServletContext ctx)
Returns the instance of this servlet

Parameters:
ctx - the servlet context
Returns:
this servlet

getRepositoryByContextAttribute

protected Repository getRepositoryByContextAttribute()
If our config said so, try to retrieve a Repository from the ServletContext


getServerFactoryDelegaterClass

protected String getServerFactoryDelegaterClass()
Return the fully qualified name of the class providing the client repository. The class whose name is returned must implement the RepositoryAccessServlet.ClientFactoryDelegater interface.

Returns:
the qfn of the factory class.

getRepository

public Repository getRepository()
Returns the JCR repository

Returns:
a JCR repository
Throws:
IllegalStateException - if the repository is not available in the context.

getRepository

public static Repository getRepository(javax.servlet.ServletContext ctx)
Returns the JCR repository

Parameters:
ctx - the servlet context
Returns:
a JCR repository
Throws:
IllegalStateException - if the repository is not available in the context.

getBootstrapConfig

public BootstrapConfig getBootstrapConfig()
Returns the config that was used to bootstrap this servlet.

Returns:
the bootstrap config or null.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.