org.barracudamvc.core.event
Class DefaultApplicationAssembler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.barracudamvc.core.event.DefaultApplicationAssembler
All Implemented Interfaces:
ApplicationAssembler, ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class DefaultApplicationAssembler
extends DefaultHandler
implements ApplicationAssembler

This class assembles a Barracuda system based on one or more XML descriptor files. For a sample file look at /WEB-INF/classes/sample.event-gateway.xml. Event gateway files are specified in the 'AssemblyDescriptor' init param of the ApplicationGateway servlet in web.xml. See Barracuda's sample.web.xml for example usage.

One may specify a single file or use a pattern to load multiple files. When loading multiple files, the pattern may consist of a plain directory such as /WEB-INF/assemblyfiles/ (making sure to add the trailing '/'), a directory plus a partial file name such as /WEB-INF/event, or even a directory plus a filename with an asterisk as a wildcard such as /WEB-INF/event*way.xml. The latter case allows for specifying an alternate suffix to look for in the pattern matching (for instance if the assembly files don't end in '.xml'). The former two cases default to using '.xml' as the pattern matching suffix.

Supported elements of assembly descriptor files are (all attributes required unless otherwise specified):

<event-gateway>
- nested in the root <assemble> element and itself
- supports nesting of all elements including itself
- attributes supported:
  • class
- Example usage... <event-gateway class="o.e.b.core.event.DefaultEventGateway"> ... </event-gateway>
<event-interest>
- nested in <event-gateway> elements
- supports nesting of <set-parameter> and <constant> elements
- attributes supported:
  • factory
  • event
- Example usage... <event-interest factory="o.e.b.examples.ex4.SampleControlHandler" event="o.e.b.examples.ex4.events.Test1"> ... </event-interest>
<event-alias>
- nested in <event-gateway> elements
- no nested elements supported
- attributes supported:
  • event
- Example usage... <event-alias event="o.e.b.examples.ex4.events.Test4" />
<constant>
- nested in all elements but <event-alias> elements
- attributes supported:
  • class
  • name
  • delegateRuntimeValue - optional - if set, any provided value is ignored. Setting a "delegate runtime value" means that the value is not to be taken literally from configuration. Rather, this responsibility is delegated to the application assembler to set the current runtime value. This is a limited feature and the only delegate runtime value currently supported is the ServletContext object.
- Example usage...
       <constant class="o.e.b.core.event.ApplicationGateway" name="showDebug">1</constant>
       or
       <constant class="org.some.package.SomeClass" name="servletContext" delegateRuntimeValue="true"/>
       
<set-property>
- nested in all elements but <event-alias> elements
- attributes supported:
  • name
  • delegateRuntimeValue - optional - if set, any provided value is ignored. Setting a "delegate runtime value" means that the value is not to be taken literally from configuration. Rather, this responsibility is delegated to the application assembler to set the current runtime value. This is a limited feature and the only delegate runtime value currently supported is the ServletContext object.
- Example usage...
       <set-property name="hello">Hello World!</set-property>
       or
       <set-property name="servletContext" delegateRuntimeValue="true"/>
       


Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
DefaultApplicationAssembler()
           
 
Method Summary
 void assemble(EventGateway irootGateway, javax.servlet.ServletConfig iservletConfig, String iassemblySourceFile)
          Assemble the system, given the root EventGateway and the XML assembly decriptor name.
 void assemble(EventGateway irootGateway, javax.servlet.ServletConfig iservletConfig, String iassemblySourceFile, String iparserClass)
          Assemble the system, given the root EventGateway, an XML assembly decriptor name, and a specific SAX parser class.
static void main(String[] args)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

DefaultApplicationAssembler

public DefaultApplicationAssembler()
Method Detail

assemble

public void assemble(EventGateway irootGateway,
                     javax.servlet.ServletConfig iservletConfig,
                     String iassemblySourceFile)
Assemble the system, given the root EventGateway and the XML assembly decriptor name. The default parser will be used.

Specified by:
assemble in interface ApplicationAssembler
Parameters:
irootGateway - the root EventGateway (req)
iservletConfig - the ServletConfig object (may be null, if invoking from other than a servlet environment)
iassemblySourceFile - the XML assembly descriptor (req)

assemble

public void assemble(EventGateway irootGateway,
                     javax.servlet.ServletConfig iservletConfig,
                     String iassemblySourceFile,
                     String iparserClass)
Assemble the system, given the root EventGateway, an XML assembly decriptor name, and a specific SAX parser class.

Specified by:
assemble in interface ApplicationAssembler
Parameters:
irootGateway - the root EventGateway (req)
iservletConfig - the ServletConfig object (may be null, if invoking from other than a servlet environment)
iassemblySourceFile - the XML assembly descriptor (req)
iparserClass - the SAX parser class (if null, defaults to the parser provided by XMLReaderFactory.createXMLReader())

main

public static void main(String[] args)


Copyright © 2006 BarracudaMVC.org All Rights Reserved.