org.ow2.jonas.web.tomcat6.versioning
Class AbsVirtualContext

java.lang.Object
  extended by org.ow2.jonas.web.tomcat6.versioning.AbsVirtualContext
All Implemented Interfaces:
VirtualContextJMXInterface, VirtualContextMBean, WebModuleContext
Direct Known Subclasses:
VirtualContext

public abstract class AbsVirtualContext
extends Object
implements VirtualContextMBean

Virtual Context implementation that only handles operations with the default context.

Author:
Frederic Germaneau, S. Ali Tokmen

Field Summary
protected  org.apache.catalina.Context defaultContext
          Default context.
protected  String userURI
          The user (virtual) URI of this context.
 
Constructor Summary
AbsVirtualContext(JmxService jmxService, String userURI, org.apache.catalina.Context contextInstance)
          Creates and registers a virtual context.
 
Method Summary
 void addContext(org.apache.catalina.Context contextInstance, String policy)
          Adds a context instance to this virtual context using a policy.
protected abstract  void addContextInternal(org.apache.catalina.Context contextInstance, String policy)
          Internal call for adding non-default context instances.
protected  org.apache.catalina.Context findContextObject(String versionedPath)
          Finds the context object corresponding to a path.
 org.apache.catalina.Context findMappingObject()
          Dummy definition to keep Tomcat happy.
 DirContext findStaticResources()
          Dummy definition to keep Tomcat happy.
 URL getwarURL()
          Dummy definition to keep Tomcat happy.
 String[] getwelcomeFiles()
          Dummy definition to keep Tomcat happy.
 boolean hasContext(String versionedPath)
          Checks whether a given context has been registered.
 boolean removeContext(String versionedPath)
          Removes a context.
 boolean removeVirtualContext()
          Completely removes this virtual context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ow2.jonas.versioning.VirtualContextJMXInterface
getContexts, rebindContext
 

Field Detail

defaultContext

protected org.apache.catalina.Context defaultContext
Default context.


userURI

protected String userURI
The user (virtual) URI of this context.

Constructor Detail

AbsVirtualContext

public AbsVirtualContext(JmxService jmxService,
                         String userURI,
                         org.apache.catalina.Context contextInstance)
Creates and registers a virtual context.

Parameters:
jmxService - JMX server.
userURI - User (virtual) URI of this context.
contextInstance - The first context instance, will be mapped as default context.
Method Detail

addContextInternal

protected abstract void addContextInternal(org.apache.catalina.Context contextInstance,
                                           String policy)
                                    throws IllegalArgumentException
Internal call for adding non-default context instances.

Parameters:
contextInstance - Context instance (versioned path).
policy - Policy (extensible).
Throws:
IllegalArgumentException - If policy not recognized.

findContextObject

protected org.apache.catalina.Context findContextObject(String versionedPath)
Finds the context object corresponding to a path. This implementation only checks against the default context.

Parameters:
versionedPath - Path to check against.
Returns:
Context object corresponding to versionedPath, null if none.

addContext

public void addContext(org.apache.catalina.Context contextInstance,
                       String policy)
                throws IllegalArgumentException
Adds a context instance to this virtual context using a policy. This implementation will check against the default context and if nothing found call

Parameters:
contextInstance - Context instance to add.
policy - Context policy.
Throws:
IllegalArgumentException - Policy is invalid.

removeVirtualContext

public boolean removeVirtualContext()
Completely removes this virtual context. Will automatically unregister management beans and unbind the context.

Specified by:
removeVirtualContext in interface VirtualContextJMXInterface
Returns:
ContextFinder.unbindVirtualContext(String).

removeContext

public boolean removeContext(String versionedPath)
Removes a context. This implementation will only check against the default context.

Parameters:
versionedPath - Versioned path of the context.
Returns:
true if succeeded, false otherwise.

hasContext

public boolean hasContext(String versionedPath)
Checks whether a given context has been registered.

Specified by:
hasContext in interface VirtualContextJMXInterface
Parameters:
versionedPath - Versioned path of the context.
Returns:
true if found, false otherwise.

findMappingObject

public org.apache.catalina.Context findMappingObject()
Dummy definition to keep Tomcat happy.

Specified by:
findMappingObject in interface WebModuleContext
Returns:
null.

findStaticResources

public DirContext findStaticResources()
Dummy definition to keep Tomcat happy.

Specified by:
findStaticResources in interface WebModuleContext
Returns:
null.

getwelcomeFiles

public String[] getwelcomeFiles()
Dummy definition to keep Tomcat happy.

Specified by:
getwelcomeFiles in interface WebModuleContext
Returns:
new String[0].

getwarURL

public URL getwarURL()
Dummy definition to keep Tomcat happy.

Specified by:
getwarURL in interface WebModuleContext
Returns:
Unique URL for this context.


Copyright © 2010 OW2 Consortium. All Rights Reserved.