QJCC homepage

biz.chitec.quarterback.gjsa
Class Str2ObjParser

java.lang.Object
  extended bybiz.chitec.quarterback.gjsa.Str2ObjParser

public final class Str2ObjParser
extends java.lang.Object

Parser for a string representated object into its internal object representation. The parser knows about parsing the built-in object types and is extendable through additional parsers in external objects (kind of a plug-in mechanism).

The class consists only of static methods and is non-instaniable (only constructor is private).

String representation of objects follows a certain scheme: <Object-ID> "(" <internal values> ")". The GJSA-classes ServerReply, ServerRequest and ServerEnvelope can be handled differently offering a more convenient syntax through some special methods of this class.

Str2ObjParser works recursively through a tree of objects. It uses a special helper class "Str2ObjParamParser" which handles the parsing of one object and calls a new instance of itself on objects contained in its "own" object.

Version:
$Id: 6455542deacf1d74d8dcbc17c80ee78a6ec57de1 $
Author:
Dirk Hillbrecht 1997-2000, chitec/Dirk Hillbrecht 2000,2002. Distributed under the terms of the GNU LGPL.
See Also:
ClassParser, Str2ObjParamParser, Obj2StrParser

Field Summary
static java.util.List classparserID
          Description of the Field
static java.util.List classparsers
          Description of the Field
private static Logger mess
           
 
Constructor Summary
private Str2ObjParser()
          This object is static-only and is not instanciable.
 
Method Summary
static void addClassParser(ClassParser cp)
          Add an external ClassParser class which may parse objects of one or more classes.
static java.lang.Object createObject(java.lang.String il)
          Caller method for parsing an object through a Str2ObjParamParser
static ServerEnvelope createReplyEnvelope(java.lang.String il)
          Parses a complete reply in special syntax.
static ServerEnvelope createRequestEnvelope(java.lang.String il)
          Parse a complete request in special syntax.
protected static int findNextSemicolon(java.lang.String line, int i)
          Find next semicolon from position i on.
protected static ServerReply getReply(java.lang.String line)
          Parse a single reply in special syntax
protected static ServerRequest getRequest(java.lang.String line)
          Returns a single ServerRequest in special syntax: <command> <parameter>...
static void setLogger(Logger m)
          Set a Logger so that the Parser may log things.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mess

private static Logger mess

classparserID

public static java.util.List classparserID
Description of the Field


classparsers

public static java.util.List classparsers
Description of the Field

Constructor Detail

Str2ObjParser

private Str2ObjParser()
This object is static-only and is not instanciable.

Method Detail

setLogger

public static void setLogger(Logger m)
Set a Logger so that the Parser may log things.

Parameters:
m - The new logger value
See Also:
Logger

addClassParser

public static void addClassParser(ClassParser cp)
Add an external ClassParser class which may parse objects of one or more classes.

Parameters:
cp - The feature to be added to the ClassParser attribute
See Also:
ClassParser

findNextSemicolon

protected static int findNextSemicolon(java.lang.String line,
                                       int i)
Find next semicolon from position i on. May be on position i also. Returns index of next semicolon or line.length() if no further semicolon is found. Strings and parenthensis are overread correctly.

Parameters:
line - Description of the Parameter
i - Description of the Parameter
Returns:
Description of the Return Value

getRequest

protected static ServerRequest getRequest(java.lang.String line)
Returns a single ServerRequest in special syntax: <command> <parameter>...

Parameters:
line - Description of the Parameter
Returns:
The request value

getReply

protected static ServerReply getReply(java.lang.String line)
Parse a single reply in special syntax

Parameters:
line - Description of the Parameter
Returns:
The reply value

createObject

public static java.lang.Object createObject(java.lang.String il)
Caller method for parsing an object through a Str2ObjParamParser

Parameters:
il - Description of the Parameter
Returns:
Description of the Return Value
See Also:
Str2ObjParamParser

createRequestEnvelope

public static ServerEnvelope createRequestEnvelope(java.lang.String il)
Parse a complete request in special syntax.

Parameters:
il - Description of the Parameter
Returns:
Description of the Return Value

createReplyEnvelope

public static ServerEnvelope createReplyEnvelope(java.lang.String il)
Parses a complete reply in special syntax.

Parameters:
il - Description of the Parameter
Returns:
Description of the Return Value

QJCC homepage