org.apache.ws.jaxme.js.pattern
Class ChainGenerator

java.lang.Object
  extended by org.apache.ws.jaxme.js.pattern.ChainGenerator

public class ChainGenerator
extends java.lang.Object

This class generates so-called event chains. A chain is an interface and an object implementing the interface. Internally the implementation is using a list of chained objects, which you can assume to implement the same interface.

Any event is passed to the first object in the list. The object may decide to resolve the event immediately and return. It may also call pass the event to the next object, take the returned value, possibly modify it and return the result. Finally, the chained object may decide to emit another event (which is passed along the same chain), and use the returned value.

Author:
Jochen Wiedmann

Constructor Summary
ChainGenerator()
           
 
Method Summary
 void finish()
          Validates the input data.
 JavaSource[] generate(JavaSourceFactory pFactory)
          Performs the actual work by generating classes using the given pFactory.
 JavaQName getChainInterface()
          Returns the interface being generated for the chain objects.
 JavaSource getControllerInterface()
          Returns the controller interface.
 JavaQName getImplementationClass()
          Returns the chain implementation classes name.
 JavaQName getProxyClass()
          Returns the class being generated for the chain objects.
protected  JavaSource[] initControllerInterface()
          Initializes the controller interface.
static void main(java.lang.String[] args)
           
 void setChainInterface(JavaQName pInterface)
          Sets the interface being generated for the chain objects.
 void setChainInterfaceName(java.lang.String pInterfaceName)
          Sets the interface name being generated for the chain objects.
 void setControllerInterfaceName(java.lang.String pInterfaceName)
          Sets the controller interface name.
 void setImplementationClass(JavaQName pClassName)
          Sets the chain implementation class.
 void setImplementationClassName(java.lang.String pClassName)
          Sets the name of the chain implementation class.
 void setProxyClass(JavaQName pClassName)
          Sets the class being generated for the chain objects.
 void setProxyClassName(java.lang.String pClassName)
          Sets the class name being generated for the chain objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainGenerator

public ChainGenerator()
Method Detail

setControllerInterfaceName

public void setControllerInterfaceName(java.lang.String pInterfaceName)
                                throws java.lang.ClassNotFoundException

Sets the controller interface name.

Throws:
java.lang.ClassNotFoundException

getControllerInterface

public JavaSource getControllerInterface()
Returns the controller interface.


initControllerInterface

protected JavaSource[] initControllerInterface()
                                        throws java.lang.ClassNotFoundException,
                                               antlr.RecognitionException,
                                               antlr.TokenStreamException,
                                               java.io.IOException

Initializes the controller interface.

Throws:
java.lang.ClassNotFoundException
java.io.IOException
antlr.TokenStreamException
antlr.RecognitionException

setChainInterfaceName

public void setChainInterfaceName(java.lang.String pInterfaceName)

Sets the interface name being generated for the chain objects.


setChainInterface

public void setChainInterface(JavaQName pInterface)

Sets the interface being generated for the chain objects.


getChainInterface

public JavaQName getChainInterface()

Returns the interface being generated for the chain objects.


setProxyClassName

public void setProxyClassName(java.lang.String pClassName)

Sets the class name being generated for the chain objects.


setProxyClass

public void setProxyClass(JavaQName pClassName)

Sets the class being generated for the chain objects.


getProxyClass

public JavaQName getProxyClass()

Returns the class being generated for the chain objects. Defaults to getChainInterface() + "Impl".


setImplementationClassName

public void setImplementationClassName(java.lang.String pClassName)

Sets the name of the chain implementation class.


setImplementationClass

public void setImplementationClass(JavaQName pClassName)

Sets the chain implementation class.


getImplementationClass

public JavaQName getImplementationClass()

Returns the chain implementation classes name. Defaults to getControllerInterface() + "Impl".


finish

public void finish()
Validates the input data.


generate

public JavaSource[] generate(JavaSourceFactory pFactory)
                      throws java.lang.Exception
Performs the actual work by generating classes using the given pFactory.

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception