org.dspace.app.xmlui.wing
Class AbstractWingTransformer

java.lang.Object
  extended by org.apache.cocoon.util.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.dspace.app.xmlui.wing.AbstractWingTransformer
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, WingTransformer, ContentHandler, LexicalHandler
Direct Known Subclasses:
AbstractDSpaceTransformer, IncludePageMeta

public abstract class AbstractWingTransformer
extends org.apache.cocoon.transformation.AbstractTransformer
implements WingTransformer

This class handles receiving SAX events and translating them into DRI events. These DRI events are then routed to the individual implementing components where they fill in and construct the DRI document. The document they construct is known as the feeder document, this is merged into the main document that was generated from the previous component in the Cocoon pipeline. The merge takes place in accordance with the DRI schema's rules for merging two DRI documents.

Author:
Scott Phillips

Field Summary
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
AbstractWingTransformer()
           
 
Method Summary
 void addBody(Body body)
          Abstract implementations of WingTransformer
 void addOptions(Options options)
          What to add to the options list
 void addPageMeta(PageMeta pageMeta)
          What page metadata to add to the document
 void addUserMeta(UserMeta userMeta)
          What user metadata to add to the document
protected  WingDocument createWingDocument(WingContext wingContext)
          Construct a new WingDocument.
 void dispose()
          Dispose
 void endDocument()
          Receive notification of the end of a document.
 void endElement(String namespaceURI, String localName, String qName)
          Receive notification of the end of an element.
 void endPrefixMapping(String prefix)
          End the scope of a prefix-URI mapping.
 String getComponentName()
          Return the name of this component.
static String getDefaultMessageCatalogue()
          Return the default i18n message catalogue that should be used when no others are specified.
 ObjectManager getObjectManager()
          Return the ObjectManager associated with this component.
protected  void handleException(Exception e)
          Handle exceptions that occurred during the document's creation.
static Message message(String key)
          This is a short cut method for creating a new message object, this allows them to be created with one simple method call that uses the default catalogue.
static Message message(String catalogue, String key)
          This is a short cut method for creating a new message object.
 void recycle()
          Recyle
 void setupWing()
          Set up the transformer so that it can build a feeder Wing document and merge it into the main document FIXME: Update document: - this method must be called to initialize the framework.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(String namespaceURI, String localName, String qName, Attributes attributes)
          Receive notification of the beginning of an element.
 void startPrefixMapping(String prefix, String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 
Methods inherited from interface org.apache.cocoon.sitemap.SitemapModelComponent
setup
 

Constructor Detail

AbstractWingTransformer

public AbstractWingTransformer()
Method Detail

setupWing

public void setupWing()
               throws WingException
Set up the transformer so that it can build a feeder Wing document and merge it into the main document FIXME: Update document: - this method must be called to initialize the framework. It must be called after the component's setup has been called and the implementing object setup.

Throws:
WingException

startDocument

public void startDocument()
                   throws SAXException
Receive notification of the beginning of a document.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Receive notification of the end of a document.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class org.apache.cocoon.xml.AbstractXMLPipe
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Begin the scope of a prefix-URI Namespace mapping.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
prefix - The Namespace prefix being declared.
uri - The Namespace URI the prefix is mapped to.
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
End the scope of a prefix-URI mapping.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
prefix - The prefix that was being mapping.
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Receive notification of the beginning of an element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
SAXException

handleException

protected void handleException(Exception e)
                        throws SAXException
Handle exceptions that occurred during the document's creation. When errors occur a SAX event is being processed it will be sent through this method. This allows implementing classes to override this method for specific error handling hooks.

Parameters:
e - The thrown exception
Throws:
SAXException

createWingDocument

protected WingDocument createWingDocument(WingContext wingContext)
                                   throws WingException
Construct a new WingDocument.

Parameters:
wingContext - The current wing context this transformer is operating under.
Throws:
WingException

addBody

public void addBody(Body body)
             throws Exception
Abstract implementations of WingTransformer

Specified by:
addBody in interface WingTransformer
Throws:
Exception

addOptions

public void addOptions(Options options)
                throws Exception
Description copied from interface: WingTransformer
What to add to the options list

Specified by:
addOptions in interface WingTransformer
Throws:
Exception

addUserMeta

public void addUserMeta(UserMeta userMeta)
                 throws Exception
Description copied from interface: WingTransformer
What user metadata to add to the document

Specified by:
addUserMeta in interface WingTransformer
Throws:
Exception

addPageMeta

public void addPageMeta(PageMeta pageMeta)
                 throws Exception
Description copied from interface: WingTransformer
What page metadata to add to the document

Specified by:
addPageMeta in interface WingTransformer
Throws:
Exception

getObjectManager

public ObjectManager getObjectManager()
Return the ObjectManager associated with this component. If no objectManager needed then return null.


getComponentName

public String getComponentName()
Return the name of this component. Typically the name is just the class name of the component.

Specified by:
getComponentName in interface WingTransformer

getDefaultMessageCatalogue

public static String getDefaultMessageCatalogue()
Return the default i18n message catalogue that should be used when no others are specified.


message

public static Message message(String key)
This is a short cut method for creating a new message object, this allows them to be created with one simple method call that uses the default catalogue.

Parameters:
key - The catalogue key used to look up a message.
Returns:
A new message object.

message

public static Message message(String catalogue,
                              String key)
This is a short cut method for creating a new message object. This version allows the callee to specify a particular catalogue overriding the default catalogue supplied.

Parameters:
catalogue - The catalogue where translations will be located.
key - The catalogue key used to look up a translation within the catalogue.
Returns:
A new message object.

recycle

public void recycle()
Recyle

Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class org.apache.cocoon.xml.AbstractXMLProducer

dispose

public void dispose()
Dispose



Copyright © 2012 DuraSpace. All Rights Reserved.