m.c.m.proxyma.context
Class ProxymaContextPool

java.lang.Object
  extended by m.c.m.proxyma.context.ProxymaContextPool

public class ProxymaContextPool
extends java.lang.Object

This is Singleton class that stores an hashtable of ProxyContexts. Every record in the hashtable is referred to a single instance of Proxyma and countains the configurations for all the ProxyFolders for that instance.

NOTE: this software is released under GPL License. See the LICENSE of this distribution for more informations.

Version:
$Id: ProxymaContextPool.java 163 2010-06-28 23:03:13Z marcolinuz $
Author:
Marco Casavecchia Morganti (marcolinuz) [marcolinuz-at-gmail.com]

Constructor Summary
ProxymaContextPool()
          Constructor for this class
 
Method Summary
 ProxymaContext getContextByName(java.lang.String contextName)
          Obtain an existing context by name.
static ProxymaContextPool getInstance()
          Static method to call to obtain the singleton class that manages the contexts for all the proxyma instances in this virtual machine.
 java.util.Enumeration<java.lang.String> getRegisteredContextNames()
          Returns the name of the registered contexts.
 ProxymaContext registerNewContext(java.lang.String contextName, java.lang.String contextBaseURI, java.lang.String configurationFile, java.lang.String logsDirectory)
          Creates and register a new context into the pool.
 void unregisterContext(ProxymaContext context)
          Unregister an existing and empty context from the pool NOTE: This method requires that the context is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxymaContextPool

public ProxymaContextPool()
Constructor for this class

Method Detail

getInstance

public static ProxymaContextPool getInstance()
Static method to call to obtain the singleton class that manages the contexts for all the proxyma instances in this virtual machine.

Returns:
the only instance of the global RuleSetsPool

registerNewContext

public ProxymaContext registerNewContext(java.lang.String contextName,
                                         java.lang.String contextBaseURI,
                                         java.lang.String configurationFile,
                                         java.lang.String logsDirectory)
Creates and register a new context into the pool. if the context name already exists it returns the existing one without create it.

Parameters:
contextName - a unique string that identifies the context (use "default" if you don't understand what this means)
contextBaseURI - The base URI to reach this context
configurationFile - The configuration file for the context
Returns:
the created context or the existing context with the same name

unregisterContext

public void unregisterContext(ProxymaContext context)
                       throws org.apache.commons.lang.NullArgumentException,
                              java.lang.IllegalArgumentException,
                              java.lang.IllegalStateException
Unregister an existing and empty context from the pool NOTE: This method requires that the context is empty. In other words, it will remove the context only if it doesn't contain any ProxyFolderBean.

Parameters:
the - context to unregister
Throws:
java.lang.IllegalArgumentException - if the doesn't exists
org.apache.commons.lang.NullArgumentException - if a null argument is passed to this method
java.lang.IllegalStateException - if the context is not empty

getContextByName

public ProxymaContext getContextByName(java.lang.String contextName)
Obtain an existing context by name.

Parameters:
contextName - a unique string that identifies the wanted context (use "default" if you don't understand what this means)
Returns:
a ProxymaContext that countains the ProxyFolders configured for the requested context.

getRegisteredContextNames

public java.util.Enumeration<java.lang.String> getRegisteredContextNames()
Returns the name of the registered contexts.

Returns:
the registeres context names


Copyright © 2010. All Rights Reserved.