org.apache.tuscany.sca.cpp.tools.services
Class XMLFileActor

java.lang.Object
  extended byorg.apache.tuscany.sca.cpp.tools.services.XMLFileActor
All Implemented Interfaces:
FileActor
Direct Known Subclasses:
ComponentTypeFileHandler, ModuleOrFragmentFileHandler

public abstract class XMLFileActor
extends java.lang.Object
implements FileActor

The purpose of this abstract class is to provide a home for the standard processing that is involved in turning a XML file into an internal DOM.


Field Summary
 boolean failed
           
protected static java.util.Map handlers
           
protected static java.util.Map parameters
           
protected static javax.xml.transform.TransformerFactory transformerFactory
           
 
Constructor Summary
XMLFileActor()
           
 
Method Summary
 void actOnFile(java.io.File moduleXML, java.io.File target, int depth)
          This method is the main FileActor method
protected  org.w3c.dom.Document createDomFromXMLFile(java.io.File xmlSourceFile)
          This method builds an in memory DOM from an XML file
 int getFilesActedOn()
           
 java.lang.Object getParameter(java.lang.String name, java.lang.Object value)
          Get a parameter
 void setParameter(java.lang.String name, java.lang.Object value)
          Set a parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handlers

protected static java.util.Map handlers

parameters

protected static java.util.Map parameters

failed

public boolean failed

transformerFactory

protected static javax.xml.transform.TransformerFactory transformerFactory
Constructor Detail

XMLFileActor

public XMLFileActor()
Method Detail

actOnFile

public void actOnFile(java.io.File moduleXML,
                      java.io.File target,
                      int depth)
               throws java.lang.Exception
This method is the main FileActor method

Specified by:
actOnFile in interface FileActor
Parameters:
moduleXML - the sca.module or fragment file
target - the target directory
depth - not uesed here but in the
Throws:
java.lang.Exception
See Also:
Here we create an initial DOM and kick off the processing (using the handler map that has been set up by the concrete subclass)., interface to allow for recursive diving into a directory structure.

createDomFromXMLFile

protected org.w3c.dom.Document createDomFromXMLFile(java.io.File xmlSourceFile)
This method builds an in memory DOM from an XML file

Parameters:
xmlSourceFile - the XML file we are handling
Returns:
the resulting document

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
Set a parameter

Parameters:
name -
value -

getParameter

public java.lang.Object getParameter(java.lang.String name,
                                     java.lang.Object value)
Get a parameter

Parameters:
name -
value -
Returns:
the value of the parameter

getFilesActedOn

public int getFilesActedOn()
Returns:
Returns the filesActedOn.


Copyright 2005 The Apache Software Foundation and Copyright IBM Corp. 2005 All Rights Reserved