All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class SE.kth.speech.broker.BrokerClass

SE.kth.speech.broker.BrokerClass

public class BrokerClass
implements BrokerObject
A class representing classes of objects stored in a Broker component, and accessed over the network.

See Also:
BrokerObject

Constructor Index

 o BrokerClass(String, Class)
 o BrokerClass(String, String)

Method Index

 o addInstance(BrokerObject)
 o addPackage(String)
Specify a java package which will be searched when an unknown class is requested.
 o classDoCommand(BrokerClient, String)
Parses incoming broker calls and dispatches them to the appropriate class.
 o classDoCommand(BrokerClient, String, BrokerTokenizer, BrokerTokenizer, Vector)
Dispatch a call to the proper BrokerClass or BrokerObject.
 o classDoCommand(BrokerClient, Vector)
Parses incoming broker multiline calls and dispatches them to the appropriate class.
 o count()
 o delete(BrokerObject)
 o doCommand(BrokerClient, BrokerTokenizer, BrokerTokenizer, Vector)
 o getAllLock()
 o getBrokerClass()
 o getBrokerObjectId()
 o getBrokerObjectId()
Return an identifier for this object, which is unique within the BrokerClass.
 o getByName(String)
 o getClassByName(String)
Return the BrokerClass with the specified name.
 o getInstanceClass()
 o getInstances()
 o getName()
 o instanceDoCommand(BrokerObject, BrokerClient, BrokerTokenizer, BrokerTokenizer, Vector)
 o instanceToString(BrokerObject)
Returns a string of the form : for a given Broker Object.
 o parseBrokerObject(String)
Returns the specified BrokerObject if it exists.

Constructors

 o BrokerClass
 public BrokerClass(String nm,
                    String className)
 o BrokerClass
 public BrokerClass(String nm,
                    Class instanceC)

Methods

 o addPackage
 public static void addPackage(String name)
Specify a java package which will be searched when an unknown class is requested. A problem with the BrokerClass/BrokerObject magic is that a class will not be loaded into the Java interpreter until it is explicitly used. Classes which are only accessed from Broker calls may never explicitly referred to in the actual server, only through reflection calls. This documentation needs to be finished***

Parameters:
name - The package name, for instance "SE.kth.speech.broker.modules.registry"
 o getClassByName
 public static BrokerClass getClassByName(String name)
Return the BrokerClass with the specified name. This method attempts to load a java-class with the same name in each of the packages in the package-path if no class with the specified name is found.

Parameters:
name - the name of the BrokerClass (not neccessarily the name of the java class)
Returns:
s the BrokerClass of the named class
 o parseBrokerObject
 public static BrokerObject parseBrokerObject(String str) throws BrokerException
Returns the specified BrokerObject if it exists. The input is of the form class:instance Throws a BrokerException if the input is of the wrong form or if the class doesn't exist. Returns null if the class exists, but the given instance doesn't.

Parameters:
str - A string of the form 'class:instance' where class is a BrokerClass, and instance the id of an instance of that class.
Returns:
The BrokerObject specified by the string.
Throws: BrokerException
if the input is of the wrong form, or the class doesn't exist.
 o instanceToString
 public static String instanceToString(BrokerObject o)
Returns a string of the form : for a given Broker Object.

Parameters:
o - The object
 o classDoCommand
 public static Object classDoCommand(BrokerClient broker,
                                     String message) throws BrokerException
Parses incoming broker calls and dispatches them to the appropriate class. Intended to be called from the brokerCall functions of the ServiceProvider

 o classDoCommand
 public static Object classDoCommand(BrokerClient broker,
                                     Vector message) throws BrokerException
Parses incoming broker multiline calls and dispatches them to the appropriate class. Intended to be called from the brokerCall functions of the ServiceProvider. This method expects the vector to have at least one element. The first element of the vector is expected to be a line of one of the following forms: : :.

Throws: BrokerException
if the call resulted in an error
See Also:
classDoCommand, brokerCall
 o classDoCommand
 public static Object classDoCommand(BrokerClient broker,
                                     String objName,
                                     BrokerTokenizer identifierTok,
                                     BrokerTokenizer commandTok,
                                     Vector hector) throws BrokerException
Dispatch a call to the proper BrokerClass or BrokerObject.

Parameters:
broker - The broker connection that the call came in on
objName - a String of the form or :
identifierTok - a BrokerTokenizer on the part of the object identifier that follows the '.', that is, the attribute part of the description :.
commandTok - a BrokerTokenizer on the part of the message which follows the object identifier, that is, in a message of the form :. the commandTok will be on the and
hector - The rest of the lines in a multiline call, or null if it was an INLINE call.
Returns:
s The result of the call, which must be an object of the type that the brokerCall of a ServiceProvider may return (normally a String or a Vector of Strings)
Throws: BrokerException
if the call results in an error, or is of the wrong form.
See Also:
ServiceProvider
 o getBrokerObjectId
 public String getBrokerObjectId()
 o getBrokerClass
 public BrokerClass getBrokerClass()
 o delete
 public void delete(BrokerObject o)
 o addInstance
 public void addInstance(BrokerObject bo)
 o getAllLock
 public Object getAllLock()
 o getByName
 public BrokerObject getByName(String name)
 o getName
 public String getName()
 o getInstanceClass
 public Class getInstanceClass()
 o getInstances
 public CollectionPublication getInstances()
 o count
 public int count()
 o doCommand
 public Object doCommand(BrokerClient broker,
                         BrokerTokenizer identifierTok,
                         BrokerTokenizer commandTok,
                         Vector hector) throws BrokerException
 o instanceDoCommand
 public Object instanceDoCommand(BrokerObject instance,
                                 BrokerClient broker,
                                 BrokerTokenizer identifierTok,
                                 BrokerTokenizer commandTok,
                                 Vector hector) throws BrokerException

All Packages  Class Hierarchy  This Package  Previous  Next  Index