SOAj Core v. 1.3


info.soaj.core.util
Class SjGeneralStore

java.lang.Object
  extended by info.soaj.core.util.SjGeneralStore

public class SjGeneralStore
extends java.lang.Object

This utility class provides static methods for creating an instance of a plugin declared as active.

In addition, there are two distinct strategies for managing (launching) the initialization of the SOAj Core Framework and activation of plugins. The first option is to invoke one of the static activateSOAj() methods contained in this class:

 // Use the default descriptor document name.
 SjGeneralStore.activateSOAj();
 
 // Else, use the specified descriptor document name.
 SjGeneralStore.activateSOAj("soaj-mypluginproject.xml");
 
The second option is to use the ServletContextListener and declare similarly to the following web.xml document elements:
   <listener>
     <listener-class>info.soaj.core.listener.SjFrameworkActivationManager</listener-class>
   </listener>
 
The decision to use the static method or the listener approach is guided by the type of JVM being launched.
     Java Applet      - Static Method
     Java Application - Static Method
     JUnit-style Test - Static Method (Typically outside-the-container approach.)
     Web Application  - Servlet Context Listener
 
In either case, the activation methods take on a controller role for the six phases of the plugin Activation Sequence.
     Phase One - Retrieve Properties
     Phase Two - Create Active
     Phase Three - Initialize Active
     Phase Four - Verify Active
     Phase Five - Report Status
     Phase Six - Log Context
 

Copyright (c) 2006 - 2009 by Global Technology Consulting Group, Inc. at gtcGroup.com .

Since:
v. 1.0
Author:
MarvinToll@gtcGroup.com

Field Summary
private static SjCacher cache
          Reference to caching singleton.
static java.lang.String CLASS_NAME
          Class name.
private static java.lang.String DELIMITER
          Cosmetic delimiter string for logging.
 
Constructor Summary
private SjGeneralStore()
          Private Constructor
 
Method Summary
static boolean activateSOAj()
          This synchronized method executes the phases of the SOAj core framework Activation Sequence using the default name for the descriptor document.
static boolean activateSOAj(java.lang.String documentName)
          This synchronized method executes the phases of the SOAj core framework Activation Sequence using a client supplied descriptor document name.
static boolean containsActivePlugin(java.lang.String pluginKey)
          This method determines whether an active plugin is declared and available for creation.
static boolean containsInactivePlugin(java.lang.String pluginKey)
          This method determines whether plugin key is declared inactive.
static
<PLUGIN extends SjBasePlugin>
PLUGIN
createPlugin(java.lang.Class<PLUGIN> pluginAbstractClass, java.lang.String pluginKey)
          This method returns a plugin instance.
static
<PLUGIN extends SjBasePlugin>
PLUGIN
createPlugin(java.lang.Class<PLUGIN> pluginAbstractClass, java.lang.String pluginKey, boolean suppressException)
          This overloaded method returns a plugin instance.
static SjAbstractPluginLogging createPluginForLogging()
          This convenience method returns a logging plugin instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final java.lang.String CLASS_NAME
Class name.


cache

private static final SjCacher cache
Reference to caching singleton.


DELIMITER

private static final java.lang.String DELIMITER
Cosmetic delimiter string for logging.

See Also:
Constant Field Values
Constructor Detail

SjGeneralStore

private SjGeneralStore()
Private Constructor

Method Detail

containsActivePlugin

public static boolean containsActivePlugin(java.lang.String pluginKey)
This method determines whether an active plugin is declared and available for creation.

Parameters:
pluginKey - The 'Key' defined in the descriptor document.
Returns:
boolean - 'True' indicates an active plugin is available for creation.

containsInactivePlugin

public static boolean containsInactivePlugin(java.lang.String pluginKey)
This method determines whether plugin key is declared inactive.

Parameters:
pluginKey - The 'Key' defined in the descriptor document.
Returns:
boolean - 'True' indicates an active plugin is available for creation.

createPlugin

public static <PLUGIN extends SjBasePlugin> PLUGIN createPlugin(java.lang.Class<PLUGIN> pluginAbstractClass,
                                                                java.lang.String pluginKey)
This method returns a plugin instance. This version defaults to throwing an exception if the plugin cannot be created.

Type Parameters:
PLUGIN - Generic bounded type parameter.
Parameters:
pluginAbstractClass - Typically the plugin's abstract super class.
pluginKey - The 'Key' defined in the descriptor document.
Returns:
PLUGIN

createPlugin

public static <PLUGIN extends SjBasePlugin> PLUGIN createPlugin(java.lang.Class<PLUGIN> pluginAbstractClass,
                                                                java.lang.String pluginKey,
                                                                boolean suppressException)
This overloaded method returns a plugin instance. If the plugin cannot be created an exception is thrown or null returned (as specified by the client).

Type Parameters:
PLUGIN -
Parameters:
pluginAbstractClass - Typically the plugin's abstract super class.
pluginKey - The 'Key' defined in the descriptor document.
suppressException - Indicates whether an exception is thrown if the plugin cannot be created.
Returns:
PLUGIN or null.

createPluginForLogging

public static SjAbstractPluginLogging createPluginForLogging()
This convenience method returns a logging plugin instance. If a plugin has not been declared active this method silently returns a SjPluginLoggingSystemOut instance.

Returns:
SjAbstractPluginLogging

activateSOAj

public static boolean activateSOAj()
                            throws SjCoreExceptionActivationSequence
This synchronized method executes the phases of the SOAj core framework Activation Sequence using the default name for the descriptor document. All exceptions are logged and caught; a returned boolean indicates whether activation was completed successfully. THIS METHOD IS EXPLICITLY INVOKED IF THE SjFrameworkActivationManager CLASS IS *NOT* BEING USED AS A LISTENER.

Returns:
boolean - 'True' indicates successful completion of the plugin Activation Sequence.
Throws:
SjCoreExceptionActivationSequence

activateSOAj

public static boolean activateSOAj(java.lang.String documentName)
                            throws SjCoreExceptionActivationSequence
This synchronized method executes the phases of the SOAj core framework Activation Sequence using a client supplied descriptor document name. All exceptions are logged and caught; a returned boolean indicates whether activation was completed successfully. THIS METHOD IS EXPLICITLY INVOKED IF THE SjFrameworkActivationManager CLASS IS *NOT* BEING USED AS A LISTENER.

Parameters:
documentName - Descriptor document available on class path.
Returns:
boolean - 'True' indicates successful completion of the plugin Activation Sequence.
Throws:
SjCoreExceptionActivationSequence

SOAj Core v. 1.3


Copyright (c) 2006 - 2009 by Global Technology Consulting Group, Inc. at gtcGroup.com.
Use is authorized, provided the source is acknowledged by inclusion of this copyright notice.