com.objectwave.appArch.admin
Class CallbackService

java.lang.Object
  |
  +--com.objectwave.appArch.admin.CallbackService

public class CallbackService
extends java.lang.Object

Use this service register command callbacks and properties.

Version:
3.1
Author:
dhoag

Nested Class Summary
static class CallbackService.Test
           
 
Constructor Summary
CallbackService()
           
 
Method Summary
protected  Command createCommand(CallbackHolder aCallbackHolder)
           
 boolean executeCommand(Command command)
          Execute the provided command object.
 java.util.Enumeration getCallbackNames()
           
 Command getCommand(java.lang.String aName)
          Convert a registered Callback object to aCommand
static CallbackService getInstance()
           
protected  CallbackHolder getPropertyCallbackHolder(java.lang.String propertyName, boolean setMethod)
          A utility method used by this implementation to obtain the callback holder object.
 Command getPropertyCommand(java.lang.String propertyName, boolean setMethod)
          Get the Command Object that will allow you to get the property or set the property value.
 java.util.Enumeration getPropertyNames()
          Usefull for determining the property names.
protected  CallbackHolder getRegisteredCallbackHolder(java.lang.String aName)
          Return the CallbackHolder for a given name
protected  java.util.Hashtable getRegisteredCallbacks()
           
protected  java.util.Hashtable getRegisteredProperties()
           
 void registerForCommandCallback(java.lang.Object callbackObject, java.lang.String externalCallName, java.lang.String methodName, java.lang.String methodDescription, java.lang.String[] arguments, java.lang.String[] argumentDescriptions)
          Initialize the CommandCallback Service and return a true value if successful.
 boolean registerProperty(java.lang.Object target, java.lang.String propertyName, java.lang.String setMethodName, java.lang.String getMethodName)
          Return true if registration of a property is sucessful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallbackService

public CallbackService()
Method Detail

getInstance

public static CallbackService getInstance()
Returns:
The singleton instance of the CallbackService.

getPropertyCommand

public Command getPropertyCommand(java.lang.String propertyName,
                                  boolean setMethod)
                           throws UnsupportedCommand
Get the Command Object that will allow you to get the property or set the property value.

Parameters:
setMethod - true if you want the set method.
propertyName -
Returns:
The PropertyCommand value
Throws:
UnsupportedCommand

getCommand

public Command getCommand(java.lang.String aName)
                   throws UnsupportedCommand
Convert a registered Callback object to aCommand

Parameters:
aName - A registered command name.
Returns:
The command registered with the provided name.
Throws:
UnsupportedCommand
See Also:
registerForCommandCallback(java.lang.Object, java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String[])

getCallbackNames

public java.util.Enumeration getCallbackNames()
Returns:
All of the names of the currently registered callbacks.

getPropertyNames

public java.util.Enumeration getPropertyNames()
Usefull for determining the property names.

Returns:
All of the names of the currently registered callbacks.

getRegisteredCallbackHolder

protected CallbackHolder getRegisteredCallbackHolder(java.lang.String aName)
Return the CallbackHolder for a given name

Parameters:
aName - Name of a uniquely identified command.
Returns:
The RegisteredCallbackHolder value

getRegisteredCallbacks

protected java.util.Hashtable getRegisteredCallbacks()
Returns:
a Hashtable containing all of the registered callbacks.

getRegisteredProperties

protected java.util.Hashtable getRegisteredProperties()
Returns:
a Hashtable containing the registered properties

getPropertyCallbackHolder

protected CallbackHolder getPropertyCallbackHolder(java.lang.String propertyName,
                                                   boolean setMethod)
A utility method used by this implementation to obtain the callback holder object.

Parameters:
propertyName - String
setMethod -
Returns:
The PropertyCallbackHolder value

createCommand

protected Command createCommand(CallbackHolder aCallbackHolder)
Parameters:
aCallbackHolder -
Returns:

executeCommand

public boolean executeCommand(Command command)
                       throws java.lang.NoSuchMethodException
Execute the provided command object. Values for the arguments should be set in the DataItems in the command object.

Parameters:
command - The command object obtained via the getCommand method.
Returns:
Throws:
java.lang.NoSuchMethodException
See Also:
getCommand(java.lang.String)

registerForCommandCallback

public void registerForCommandCallback(java.lang.Object callbackObject,
                                       java.lang.String externalCallName,
                                       java.lang.String methodName,
                                       java.lang.String methodDescription,
                                       java.lang.String[] arguments,
                                       java.lang.String[] argumentDescriptions)
                                throws java.lang.IllegalArgumentException
Initialize the CommandCallback Service and return a true value if successful. The initialize() method uses the specification for the CommandCallback service from the ApplicationConfigurationService.

Parameters:
callbackObject - The object on which to invoke the command.
externalCallName -
methodName -
methodDescription -
arguments -
argumentDescriptions -
Throws:
java.lang.IllegalArgumentException

registerProperty

public boolean registerProperty(java.lang.Object target,
                                java.lang.String propertyName,
                                java.lang.String setMethodName,
                                java.lang.String getMethodName)
Return true if registration of a property is sucessful. This method stores the property into the list of registered properties.

Parameters:
target - The object containing the property.
propertyName - A unique property name.
setMethodName - The name of a method to call to set the property.
getMethodName - The name of a method to call to get the property value.
Returns: