org.jgroups.stack
Class Configurator

java.lang.Object
  extended by org.jgroups.stack.Configurator
All Implemented Interfaces:
ProtocolStack.ProtocolStackFactory

public class Configurator
extends java.lang.Object
implements ProtocolStack.ProtocolStackFactory

The task if this class is to setup and configure the protocol stack. A string describing the desired setup, which is both the layering and the configuration of each layer, is given to the configurator which creates and configures the protocol stack and returns a reference to the top layer (Protocol).

Future functionality will include the capability to dynamically modify the layering of the protocol stack and the properties of each layer.

Version:
$Id: Configurator.java,v 1.59 2008/12/05 09:22:00 belaban Exp $
Author:
Bela Ban

Nested Class Summary
static class Configurator.ProtocolConfiguration
          Parses and encapsulates the specification for 1 protocol of the protocol stack, e.g.
 
Field Summary
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
Configurator()
           
Configurator(ProtocolStack protocolStack)
           
 
Method Summary
static Protocol createProtocol(java.lang.String prot_spec, ProtocolStack stack)
          Creates a new protocol given the protocol specification.
static java.lang.Object getField(java.lang.reflect.Field field, java.lang.Object target)
           
static boolean isSetPropertyMethod(java.lang.reflect.Method method)
           
 java.util.Vector<Configurator.ProtocolConfiguration> parseConfigurations(java.lang.String configuration)
          Return a number of ProtocolConfigurations in a vector
static void removeDeprecatedProperties(java.lang.Object obj, java.util.Properties props)
           
static java.lang.String renameFromJavaCodingConvention(java.lang.String fieldName)
           
static void resolveAndAssignFields(java.lang.Object obj, java.util.Properties props)
           
static void resolveAndInvokePropertyMethods(java.lang.Object obj, java.util.Properties props)
           
static void sanityCheck(java.util.Vector<Protocol> protocols)
          Throws an exception if sanity check fails.
static void setField(java.lang.reflect.Field field, java.lang.Object target, java.lang.Object value)
           
 Protocol setupProtocolStack()
           
 Protocol setupProtocolStack(ProtocolStack copySource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Constructor Detail

Configurator

public Configurator()

Configurator

public Configurator(ProtocolStack protocolStack)
Method Detail

setupProtocolStack

public Protocol setupProtocolStack()
                            throws java.lang.Exception
Specified by:
setupProtocolStack in interface ProtocolStack.ProtocolStackFactory
Throws:
java.lang.Exception

setupProtocolStack

public Protocol setupProtocolStack(ProtocolStack copySource)
                            throws java.lang.Exception
Specified by:
setupProtocolStack in interface ProtocolStack.ProtocolStackFactory
Throws:
java.lang.Exception

createProtocol

public static Protocol createProtocol(java.lang.String prot_spec,
                                      ProtocolStack stack)
                               throws java.lang.Exception
Creates a new protocol given the protocol specification. Initializes the properties and starts the up and down handler threads.

Parameters:
prot_spec - The specification of the protocol. Same convention as for specifying a protocol stack. An exception will be thrown if the class cannot be created. Example:
"VERIFY_SUSPECT(timeout=1500)"
Note that no colons (:) have to be specified
stack - The protocol stack
Returns:
Protocol The newly created protocol
Throws:
java.lang.Exception - Will be thrown when the new protocol cannot be created

parseConfigurations

public java.util.Vector<Configurator.ProtocolConfiguration> parseConfigurations(java.lang.String configuration)
                                                                         throws java.lang.Exception
Return a number of ProtocolConfigurations in a vector

Parameters:
configuration - protocol-stack configuration string
Returns:
Vector of ProtocolConfigurations
Throws:
java.lang.Exception

sanityCheck

public static void sanityCheck(java.util.Vector<Protocol> protocols)
                        throws java.lang.Exception
Throws an exception if sanity check fails. Possible sanity check is uniqueness of all protocol names

Throws:
java.lang.Exception

resolveAndInvokePropertyMethods

public static void resolveAndInvokePropertyMethods(java.lang.Object obj,
                                                   java.util.Properties props)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

isSetPropertyMethod

public static boolean isSetPropertyMethod(java.lang.reflect.Method method)

resolveAndAssignFields

public static void resolveAndAssignFields(java.lang.Object obj,
                                          java.util.Properties props)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

removeDeprecatedProperties

public static void removeDeprecatedProperties(java.lang.Object obj,
                                              java.util.Properties props)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

setField

public static void setField(java.lang.reflect.Field field,
                            java.lang.Object target,
                            java.lang.Object value)

getField

public static java.lang.Object getField(java.lang.reflect.Field field,
                                        java.lang.Object target)

renameFromJavaCodingConvention

public static java.lang.String renameFromJavaCodingConvention(java.lang.String fieldName)


Copyright © 1998-2008 Bela Ban. All Rights Reserved.