Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jbossmx.cluster.watchdog.util
Class RegisterActivatableObjects  view RegisterActivatableObjects download RegisterActivatableObjects.java

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.jbossmx.cluster.watchdog.util.RegisterActivatableObjects
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class RegisterActivatableObjects
extends org.xml.sax.helpers.DefaultHandler

Class for registering general RMI Activatable Objects via XML.


Field Summary
static java.lang.String ACTIVATABLE_OBJECT
          String used in XML Config
static java.lang.String ACTIVATION_GROUP
          String used in XML Config
static java.lang.String CONSTRUCTOR_PARAM
          String used in XML Config
private  java.lang.StringBuffer m_accumulator
          Buffer for accumulating the XML read
private  java.util.Properties m_activatableObjectProperties
          ActivatatableObject Properties
private  java.util.Properties m_activationGroupProperties
          ActivationGroup Properties
private  java.util.Properties m_constructorParameterProperties
          Constructor Parameter Properties
private  java.rmi.activation.ActivationGroupID m_currentActivationGroupID
          The current java.rmi.activation.ActivationGroupID
private  java.rmi.MarshalledObject m_currentMarshalledObject
          The current MarshalledObject
private  java.util.List m_marshalledObjectConstructorParameters
          The parameters that will be used to construct the marshalled object
private  java.util.List m_marshalledObjectConstructorSignature
          The signature of the marshalled object
private  java.util.Properties m_marshalledObjectProperties
          MarshalledObject Properties
private  java.util.Properties m_translationTable
          The translation table
static java.lang.String MARSHALLED_OBJECT
          String used in XML Config
 
Constructor Summary
RegisterActivatableObjects(java.util.Properties translationTable)
          Default Constructor for RegisterActivatableObjects
 
Method Summary
private  void addActivatableObject(java.lang.String text)
          XML Routine for adding an ActivatableObject
private  void addConstructorParam(java.lang.String text)
          XML Routine for adding constructor parameters
private  void addIndividualAttributeToProperties(java.util.Properties properties, org.xml.sax.Attributes attributes, java.lang.String attributeName)
          Obtains an Attribute from attributes with the name attributeName and stores it in properties
private  void addMarshalledObjectConstructorParameter(java.lang.Object parameter, java.lang.String className)
          Adds a marshalled object constructor parameter
 void characters(char[] buffer, int start, int length)
          When the parser encounters plain text (not XML elements), it calls this method, which accumulates them in a string buffer.
private  void createActivationGroup()
          Sets the current ActivationGroupID to a new ActivationGroupID based on the current ActivationGroup Properties.
private static java.rmi.activation.ActivationGroupID createGroup(java.lang.String groupName, java.lang.String groupClassPath, java.lang.String groupPolicy, java.lang.String script)
          Creates an ActivationGroupID
private  void createMarshalledObject(java.lang.String text)
          XML Routine for creating a MarshalledObject
 void endDocument()
          Called at the end of parsing.
 void endElement(java.lang.String namespaceURL, java.lang.String localName, java.lang.String qname)
          Take special action when we reach the end of selected elements.
 void error(org.xml.sax.SAXParseException exception)
          Report a parsing error
 void fatalError(org.xml.sax.SAXParseException exception)
          Report a non-recoverable error and exit
private  java.util.Properties getActivatableObjectProperties()
          Gets the ActivatableObject properties
private  java.util.Properties getActivationGroupProperties()
          Gets the ActivationGroup properties
private static java.lang.Class[] getClassArrayFromStringArray(java.lang.String[] classNameArray)
          Utility method for obtaining an array of Classes from an array of class names.
private  java.util.Properties getConstructorParameterProperties()
          Gets the Constructor Parameters properties
private  java.rmi.activation.ActivationGroupID getCurrentActivationGroupID()
          Gets the current ActivationGroupID
private  java.rmi.MarshalledObject getCurrentMarshalledObject()
          Gets the current MarshalledObject
private  java.util.List getMarshalledObjectConstructorParameters()
          Gets the constructor parameters of the marshalled object
private  java.util.List getMarshalledObjectConstructorSignature()
          Gets the constructor signature of the marshalled object
private  java.util.Properties getMarshalledObjectProperties()
          Gets the MarshalledObject properties
private  void initialiseMarshalledObjectConstructorParameters()
          Initialises the marshalled object constructor parameters
private  void initialiseMarshalledObjectConstructorSignature()
          Initialises the marshalled object constructor signature
private  java.lang.String[] listToStringArray(java.util.List toConvert)
          Converts a list of Strings to an array of Strings.
static void main(java.lang.String[] args)
          Registers all the RMI Activatable Objects specified in an XML config file
private static java.lang.String replace(java.lang.String source, java.lang.String before, java.lang.String after)
          Replaces all occurences of 'before' with 'after' in 'source'
private  void setActivatableObjectAttributes(org.xml.sax.Attributes attributes)
          Sets the Activatable object attributes
private  RegisterActivatableObjects setActivatableObjectProperties(java.util.Properties activatableObjectProperties)
          Sets the ActivatableObject properties
private  void setActivationGroupAttributes(org.xml.sax.Attributes attributes)
          Sets the ActivationGroup attributes
private  RegisterActivatableObjects setActivationGroupProperties(java.util.Properties activationGroupProperties)
          Sets the ActivationGroup properties
private  void setConstructorParameterAttributes(org.xml.sax.Attributes attributes)
          Sets the constructor parameter attributes
private  RegisterActivatableObjects setConstructorParameterProperties(java.util.Properties constructorParameterProperties)
          Sets the Constructor Parameters properties
private  RegisterActivatableObjects setCurrentActivationGroupID(java.rmi.activation.ActivationGroupID currentActivationGroupID)
          Sets the current ActivationGroupID
private  RegisterActivatableObjects setCurrentMarshalledObject(java.rmi.MarshalledObject currentMarshalledObject)
          Sets the current MarshalledObject
private  void setMarshalledObjectAttributes(org.xml.sax.Attributes attributes)
          Sets the marshalled object attributes
private  RegisterActivatableObjects setMarshalledObjectProperties(java.util.Properties marshalledObjectProperties)
          Sets the MarshalledObject properties
 void startDocument()
          Called at the beginning of parsing.
 void startElement(java.lang.String namespaceURL, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes attributes)
          At the beginning of each new element, erase any accumulated text.
private  java.lang.String translateString(java.lang.String string)
           
 void warning(org.xml.sax.SAXParseException exception)
          Issue a warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_accumulator

private java.lang.StringBuffer m_accumulator
Buffer for accumulating the XML read


m_activationGroupProperties

private java.util.Properties m_activationGroupProperties
ActivationGroup Properties


m_activatableObjectProperties

private java.util.Properties m_activatableObjectProperties
ActivatatableObject Properties


m_marshalledObjectProperties

private java.util.Properties m_marshalledObjectProperties
MarshalledObject Properties


m_constructorParameterProperties

private java.util.Properties m_constructorParameterProperties
Constructor Parameter Properties


m_currentActivationGroupID

private java.rmi.activation.ActivationGroupID m_currentActivationGroupID
The current java.rmi.activation.ActivationGroupID


m_marshalledObjectConstructorParameters

private java.util.List m_marshalledObjectConstructorParameters
The parameters that will be used to construct the marshalled object


m_marshalledObjectConstructorSignature

private java.util.List m_marshalledObjectConstructorSignature
The signature of the marshalled object


m_currentMarshalledObject

private java.rmi.MarshalledObject m_currentMarshalledObject
The current MarshalledObject


m_translationTable

private java.util.Properties m_translationTable
The translation table


ACTIVATION_GROUP

public static java.lang.String ACTIVATION_GROUP
String used in XML Config


ACTIVATABLE_OBJECT

public static java.lang.String ACTIVATABLE_OBJECT
String used in XML Config


MARSHALLED_OBJECT

public static java.lang.String MARSHALLED_OBJECT
String used in XML Config


CONSTRUCTOR_PARAM

public static java.lang.String CONSTRUCTOR_PARAM
String used in XML Config

Constructor Detail

RegisterActivatableObjects

public RegisterActivatableObjects(java.util.Properties translationTable)
Default Constructor for RegisterActivatableObjects

Method Detail

main

public static void main(java.lang.String[] args)
                 throws org.xml.sax.SAXException,
                        java.io.IOException
Registers all the RMI Activatable Objects specified in an XML config file


startDocument

public void startDocument()
Called at the beginning of parsing.


endDocument

public void endDocument()
Called at the end of parsing.


characters

public void characters(char[] buffer,
                       int start,
                       int length)
When the parser encounters plain text (not XML elements), it calls this method, which accumulates them in a string buffer. Note that this method may be called multiple times, even with no intervening elements.


startElement

public void startElement(java.lang.String namespaceURL,
                         java.lang.String localName,
                         java.lang.String qname,
                         org.xml.sax.Attributes attributes)
At the beginning of each new element, erase any accumulated text.


endElement

public void endElement(java.lang.String namespaceURL,
                       java.lang.String localName,
                       java.lang.String qname)
Take special action when we reach the end of selected elements. Although we don't use a validating parser, this method does assume that the web.xml file we're parsing is valid.


warning

public void warning(org.xml.sax.SAXParseException exception)
Issue a warning


error

public void error(org.xml.sax.SAXParseException exception)
Report a parsing error


fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
Report a non-recoverable error and exit


createActivationGroup

private void createActivationGroup()
Sets the current ActivationGroupID to a new ActivationGroupID based on the current ActivationGroup Properties.


addActivatableObject

private void addActivatableObject(java.lang.String text)
XML Routine for adding an ActivatableObject


createMarshalledObject

private void createMarshalledObject(java.lang.String text)
XML Routine for creating a MarshalledObject


addConstructorParam

private void addConstructorParam(java.lang.String text)
XML Routine for adding constructor parameters


createGroup

private static java.rmi.activation.ActivationGroupID createGroup(java.lang.String groupName,
                                                                 java.lang.String groupClassPath,
                                                                 java.lang.String groupPolicy,
                                                                 java.lang.String script)
                                                          throws java.lang.Exception
Creates an ActivationGroupID


listToStringArray

private java.lang.String[] listToStringArray(java.util.List toConvert)
Converts a list of Strings to an array of Strings.


getClassArrayFromStringArray

private static java.lang.Class[] getClassArrayFromStringArray(java.lang.String[] classNameArray)
                                                       throws java.lang.ClassNotFoundException,
                                                              java.lang.NoSuchMethodException
Utility method for obtaining an array of Classes from an array of class names.


setActivationGroupAttributes

private void setActivationGroupAttributes(org.xml.sax.Attributes attributes)
Sets the ActivationGroup attributes


setActivatableObjectAttributes

private void setActivatableObjectAttributes(org.xml.sax.Attributes attributes)
Sets the Activatable object attributes


setMarshalledObjectAttributes

private void setMarshalledObjectAttributes(org.xml.sax.Attributes attributes)
Sets the marshalled object attributes


setConstructorParameterAttributes

private void setConstructorParameterAttributes(org.xml.sax.Attributes attributes)
Sets the constructor parameter attributes


addIndividualAttributeToProperties

private void addIndividualAttributeToProperties(java.util.Properties properties,
                                                org.xml.sax.Attributes attributes,
                                                java.lang.String attributeName)
Obtains an Attribute from attributes with the name attributeName and stores it in properties


initialiseMarshalledObjectConstructorParameters

private void initialiseMarshalledObjectConstructorParameters()
Initialises the marshalled object constructor parameters


initialiseMarshalledObjectConstructorSignature

private void initialiseMarshalledObjectConstructorSignature()
Initialises the marshalled object constructor signature


addMarshalledObjectConstructorParameter

private void addMarshalledObjectConstructorParameter(java.lang.Object parameter,
                                                     java.lang.String className)
Adds a marshalled object constructor parameter


translateString

private java.lang.String translateString(java.lang.String string)

replace

private static java.lang.String replace(java.lang.String source,
                                        java.lang.String before,
                                        java.lang.String after)
Replaces all occurences of 'before' with 'after' in 'source'


setActivationGroupProperties

private RegisterActivatableObjects setActivationGroupProperties(java.util.Properties activationGroupProperties)
Sets the ActivationGroup properties


getActivationGroupProperties

private java.util.Properties getActivationGroupProperties()
Gets the ActivationGroup properties


setActivatableObjectProperties

private RegisterActivatableObjects setActivatableObjectProperties(java.util.Properties activatableObjectProperties)
Sets the ActivatableObject properties


getActivatableObjectProperties

private java.util.Properties getActivatableObjectProperties()
Gets the ActivatableObject properties


setMarshalledObjectProperties

private RegisterActivatableObjects setMarshalledObjectProperties(java.util.Properties marshalledObjectProperties)
Sets the MarshalledObject properties


getMarshalledObjectProperties

private java.util.Properties getMarshalledObjectProperties()
Gets the MarshalledObject properties


setConstructorParameterProperties

private RegisterActivatableObjects setConstructorParameterProperties(java.util.Properties constructorParameterProperties)
Sets the Constructor Parameters properties


getConstructorParameterProperties

private java.util.Properties getConstructorParameterProperties()
Gets the Constructor Parameters properties


setCurrentActivationGroupID

private RegisterActivatableObjects setCurrentActivationGroupID(java.rmi.activation.ActivationGroupID currentActivationGroupID)
Sets the current ActivationGroupID


getCurrentActivationGroupID

private java.rmi.activation.ActivationGroupID getCurrentActivationGroupID()
Gets the current ActivationGroupID


getMarshalledObjectConstructorParameters

private java.util.List getMarshalledObjectConstructorParameters()
Gets the constructor parameters of the marshalled object


getMarshalledObjectConstructorSignature

private java.util.List getMarshalledObjectConstructorSignature()
Gets the constructor signature of the marshalled object


setCurrentMarshalledObject

private RegisterActivatableObjects setCurrentMarshalledObject(java.rmi.MarshalledObject currentMarshalledObject)
Sets the current MarshalledObject


getCurrentMarshalledObject

private java.rmi.MarshalledObject getCurrentMarshalledObject()
Gets the current MarshalledObject