org.apache.ws.jaxme.generator.impl
Class GeneratorImpl

java.lang.Object
  extended by org.apache.ws.jaxme.generator.impl.GeneratorImpl
All Implemented Interfaces:
Generator, PropertySource

public class GeneratorImpl
extends java.lang.Object
implements Generator

The Generator is reading an input schema. The schema is converted into a DOM tree. Finally one or more source writers are executed.


Constructor Summary
GeneratorImpl()
          Creates a new GeneratorImpl
 
Method Summary
 void addBindings(org.xml.sax.InputSource pSource)
          Sets the external schema bindings.
 SchemaSG generate(java.io.File pFile)
          Opens the given file, calls the specified SchemaReaders () method and SourceWriters write() method.
 SchemaSG generate(org.xml.sax.InputSource pSource)
           Generates java source from the given URL.
 SchemaSG generate(java.net.URL pURL)
          Opens the given URL, calls the specified SchemaReaders () method and SourceWriters write() method.
 org.w3c.dom.Document[] getBindings()
          Returns the external schema bindings, if any, or null.
 org.xml.sax.EntityResolver getEntityResolver()
          Returns the EntityResolver being used to import external schemata.
 java.lang.String getKey()
          Returns a key for getting and setting custom data.
 java.lang.String getProperty(java.lang.String pName)
          Returns the given property value or null, if the property is not set.
 java.lang.String getProperty(java.lang.String pName, java.lang.String pDefault)
          Returns the given property value.
 java.io.File getResourceTargetDirectory()
          Sets the directory where resource files are being created.
 SchemaReader getSchemaReader()
          Returns the SchemaReader.
 java.io.File getTargetDirectory()
          Returns the directory where Java source files are being created.
 boolean isForcingOverwrite()
          Returns whether the generator is forcing an overwrite of files.
 boolean isSettingReadOnly()
          Returns whether the generator will create files in read-only mode.
 boolean isValidating()
          Returns whether the generator is using a validating XML schema parser.
 void setEntityResolver(org.xml.sax.EntityResolver pEntityResolver)
          Sets the EntityResolver being used to import external schemata.
 void setForcingOverwrite(boolean pIsForcingOverwrite)
          Sets whether the generator is forcing an overwrite of files.
 void setProperty(java.lang.String pName, java.lang.String pValue)
          Sets the given property value.
 void setResourceTargetDirectory(java.io.File pDirectory)
          Sets the directory where resource files are being created.
 void setSchemaReader(SchemaReader pReader)
          Sets the SchemaReader.
 void setSettingReadOnly(boolean pIsSettingReadOnly)
          Sets whether the generator will create files in read-only mode.
 void setTargetDirectory(java.io.File pDirectory)
          Sets the directory where Java source files are being created.
 void setValidating(boolean pIsValidating)
          Sets whether the generator is using a validating XML schema parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratorImpl

public GeneratorImpl()
Creates a new GeneratorImpl

Method Detail

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver pEntityResolver)

Sets the EntityResolver being used to import external schemata.

Specified by:
setEntityResolver in interface Generator

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()

Returns the EntityResolver being used to import external schemata.

Specified by:
getEntityResolver in interface Generator

isForcingOverwrite

public boolean isForcingOverwrite()

Returns whether the generator is forcing an overwrite of files.

Specified by:
isForcingOverwrite in interface Generator

setForcingOverwrite

public void setForcingOverwrite(boolean pIsForcingOverwrite)

Sets whether the generator is forcing an overwrite of files.

Specified by:
setForcingOverwrite in interface Generator

isSettingReadOnly

public boolean isSettingReadOnly()

Returns whether the generator will create files in read-only mode.

Specified by:
isSettingReadOnly in interface Generator

setSettingReadOnly

public void setSettingReadOnly(boolean pIsSettingReadOnly)

Sets whether the generator will create files in read-only mode.

Specified by:
setSettingReadOnly in interface Generator

isValidating

public boolean isValidating()
Description copied from interface: Generator

Returns whether the generator is using a validating XML schema parser. Defaults to false.

Specified by:
isValidating in interface Generator

setValidating

public void setValidating(boolean pIsValidating)
Description copied from interface: Generator

Sets whether the generator is using a validating XML schema parser. Defaults to false.

Specified by:
setValidating in interface Generator

setSchemaReader

public void setSchemaReader(SchemaReader pReader)

Sets the SchemaReader.

Specified by:
setSchemaReader in interface Generator

getSchemaReader

public SchemaReader getSchemaReader()

Returns the SchemaReader.

Specified by:
getSchemaReader in interface Generator

setTargetDirectory

public void setTargetDirectory(java.io.File pDirectory)
Description copied from interface: Generator
Sets the directory where Java source files are being created.

Specified by:
setTargetDirectory in interface Generator

getTargetDirectory

public java.io.File getTargetDirectory()
Description copied from interface: Generator
Returns the directory where Java source files are being created.

Specified by:
getTargetDirectory in interface Generator

setResourceTargetDirectory

public void setResourceTargetDirectory(java.io.File pDirectory)
Description copied from interface: Generator
Sets the directory where resource files are being created. By default, this is the Java source directory.

Specified by:
setResourceTargetDirectory in interface Generator

getResourceTargetDirectory

public java.io.File getResourceTargetDirectory()
Description copied from interface: Generator
Sets the directory where resource files are being created. By default, this is the Java source directory.

Specified by:
getResourceTargetDirectory in interface Generator

generate

public SchemaSG generate(org.xml.sax.InputSource pSource)
                  throws java.lang.Exception
Description copied from interface: Generator

Generates java source from the given URL.

Specified by:
generate in interface Generator
Parameters:
pSource - reads the schema (from which the source is to be generated) from the SAX Input Source. The System ID should be (if possible) set.
Returns:
SchemaSG describing the source generated
Throws:
java.lang.Exception

generate

public SchemaSG generate(java.io.File pFile)
                  throws java.lang.Exception

Opens the given file, calls the specified SchemaReaders () method and SourceWriters write() method.

Specified by:
generate in interface Generator
Parameters:
pFile - reads the schema (from which the source is to be generated) from the given file.
Returns:
SchemaSG describing the source generated
Throws:
java.lang.Exception

generate

public SchemaSG generate(java.net.URL pURL)
                  throws java.lang.Exception

Opens the given URL, calls the specified SchemaReaders () method and SourceWriters write() method.

Specified by:
generate in interface Generator
Parameters:
pURL - reads the schema (from which the source is to be generated) from the given URL.
Returns:
SchemaSG describing the source generated
Throws:
java.lang.Exception

getProperty

public java.lang.String getProperty(java.lang.String pName)
Description copied from interface: PropertySource

Returns the given property value or null, if the property is not set.

Specified by:
getProperty in interface PropertySource

getProperty

public java.lang.String getProperty(java.lang.String pName,
                                    java.lang.String pDefault)
Description copied from interface: PropertySource

Returns the given property value. If the property is not set, returns the given default value.

Specified by:
getProperty in interface PropertySource

setProperty

public void setProperty(java.lang.String pName,
                        java.lang.String pValue)
Description copied from interface: PropertySource

Sets the given property value.

Specified by:
setProperty in interface PropertySource

getKey

public java.lang.String getKey()
Description copied from interface: Generator

Returns a key for getting and setting custom data.

Specified by:
getKey in interface Generator

addBindings

public void addBindings(org.xml.sax.InputSource pSource)
                 throws javax.xml.parsers.ParserConfigurationException,
                        org.xml.sax.SAXException,
                        java.io.IOException
Description copied from interface: Generator
Sets the external schema bindings.

Specified by:
addBindings in interface Generator
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

getBindings

public org.w3c.dom.Document[] getBindings()
Description copied from interface: Generator
Returns the external schema bindings, if any, or null.

Specified by:
getBindings in interface Generator