Class XMLBean

  • All Implemented Interfaces:
    java.lang.Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

    public class XMLBean
    extends org.apache.tools.ant.taskdefs.MatchingTask
    Modeled after Ant's javac and zip tasks. Schema files to process, or directories of schema files, are set with the 'schema' attribute, and can be filtered with 'includes' and 'excludes'. Alternatively, one or more nested <fileset> elements can specify the files and directories to be used to generate this XMLBean. The include set can also define .java files that should be built as well. See the FileSet documentation at http://jakarta.apache.org/ant/manual/index.html for instructions on FileSets if you are unfamiliar with their usage.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  XMLBean.ErrorLogger  
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLBean()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFileset​(org.apache.tools.ant.types.FileSet fileset)  
      org.apache.tools.ant.types.Path createClasspath()
      Adds a path to the classpath.
      Extension createExtension()
      One or more SchemaCompiler extensions can be passed in via the <extension> subelement.
      void execute()  
      java.lang.String getCatalog()
      Gets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver.
      java.io.File getClassgendir()  
      org.apache.tools.ant.types.Path getClasspath()  
      java.lang.String getDebugLevel()
      Get the value of debugLevel.
      java.io.File getDestfile()  
      java.lang.String getExecutable()  
      java.lang.String getIgnoreDuplicatesInNamespaces()  
      java.lang.String getJavaSource()  
      java.lang.String getMemoryInitialSize()
      Set the initial memory size of the underlying javac process.
      java.lang.String getMemoryMaximumSize()
      Set the maximum memory size of the underlying javac process.
      boolean getOptimize()
      Gets the optimize flag.
      java.io.File getSchema()  
      java.io.File getSrcgendir()  
      java.lang.String getTypesystemname()  
      boolean isDebug()  
      boolean isDownload()  
      boolean isFailonerror()  
      boolean isIncludeAntRuntime()  
      boolean isIncludeJavaRuntime()  
      boolean isNoAnnotations()  
      boolean isNoExt()  
      boolean isNoPvr()  
      boolean isNoSrcRegen()  
      boolean isNoUpa()  
      boolean isNoValidateDoc()  
      boolean isNowarn()  
      boolean isQuiet()  
      boolean isSrconly()  
      boolean isVerbose()  
      void setCatalog​(java.lang.String catalog)
      Sets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver.
      void setClassgendir​(java.io.File classgendir)
      Set a location to generate .class files into.
      void setClasspath​(org.apache.tools.ant.types.Path classpath)
      The classpath to use if schemas in the fileset import definitions that are supplied by other compiled xml beans JAR files, or if .java files are in the schema fileset.
      void setClasspathRef​(org.apache.tools.ant.types.Reference classpathref)
      Adds a reference to a classpath defined elsewhere.
      void setCompiler​(java.lang.String compiler)
      Choose the implementation for this particular task.
      void setDebug​(boolean debug)
      Generate debugging symbols.
      void setDebugLevel​(java.lang.String v)
      Keyword list to be appended to the -g command-line switch.
      void setDestfile​(java.io.File destfile)
      Define the name of the jar file created.
      void setDownload​(boolean download)
      Set to true to permit the compiler to download URLs for imports and includes.
      void setExecutable​(java.lang.String forkExec)
      Sets the the name of the javac executable.
      void setFailonerror​(boolean failonerror)
      Determines whether or not the ant target will continue if the XMLBean creation encounters a build error.
      void setFork​(boolean f)
      If true, forks the javac compiler.
      void setIgnoreDuplicatesInNamespaces​(java.lang.String namespaces)
      One or more namespaces in which duplicate definitions are to be ignored can be passed in via the <ignoreDuplicatesInNamespaces> subelement.
      void setIncludeAntRuntime​(boolean includeAntRuntime)  
      void setIncludeJavaRuntime​(boolean includeJavaRuntime)  
      void setJavaSource​(java.lang.String javasource)
      Generate java source compatible with the given version.
      void setMemoryInitialSize​(java.lang.String memoryInitialSize)  
      void setMemoryMaximumSize​(java.lang.String memoryMaximumSize)  
      void setNoAnnotations​(boolean noann)
      Skip over schema <annotation%gt; elements.
      void setNoExt​(boolean noext)
      Ignore extensions found in .xsdconfig files
      void setNoPvr​(boolean nopvr)
      Do not enforce the particle valid (restriction) rule.
      void setNoSrcRegen​(boolean noSrcRegen)  
      void setNoUpa​(boolean noupa)
      Do not enforce the unique particle attribution rule.
      void setNoValidateDoc​(boolean novdoc)
      Do not validate the contents of schema <documentation> elements.
      void setNowarn​(boolean nowarn)  
      void setOptimize​(boolean optimize)
      If true, compiles with optimization enabled.
      void setQuiet​(boolean quiet)
      Controls the amount of output.
      void setSchema​(java.io.File schema)
      A file that points to either an individual schema file or a directory of files.
      void setSource​(java.lang.String s)  
      void setSrcgendir​(java.io.File srcgendir)
      Set a location to generate .java files into.
      void setSrconly​(boolean srconly)
      A value of true means that only source will be generated.
      void setTypesystemname​(java.lang.String typesystemname)
      The name of the package that the TypeSystemHolder class should be generated in.
      void setVerbose​(boolean verbose)
      Controls the amount of output.
      • Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask

        add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
      • Methods inherited from class org.apache.tools.ant.Task

        bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, setDescription, setLocation
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMLBean

        public XMLBean()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException
      • addFileset

        public void addFileset​(org.apache.tools.ant.types.FileSet fileset)
      • getSchema

        public java.io.File getSchema()
      • setSchema

        public void setSchema​(java.io.File schema)
        A file that points to either an individual schema file or a directory of files. It is optional only if one or more <fileset> elements are nested in this task.
        Parameters:
        schema - Required, unless a fileset element is nested.
      • setClasspath

        public void setClasspath​(org.apache.tools.ant.types.Path classpath)
        The classpath to use if schemas in the fileset import definitions that are supplied by other compiled xml beans JAR files, or if .java files are in the schema fileset.
        Parameters:
        classpath - Optional.
      • createClasspath

        public org.apache.tools.ant.types.Path createClasspath()
        Adds a path to the classpath.
      • setClasspathRef

        public void setClasspathRef​(org.apache.tools.ant.types.Reference classpathref)
        Adds a reference to a classpath defined elsewhere.
        Parameters:
        classpathref - Optional.
      • getClasspath

        public org.apache.tools.ant.types.Path getClasspath()
      • getDestfile

        public java.io.File getDestfile()
      • setDestfile

        public void setDestfile​(java.io.File destfile)
        Define the name of the jar file created. For instance, "myXMLBean.jar" will output the results of this task into a jar with the same name. Optional, defaults to "xmltypes.jar".
        Parameters:
        destfile - Optional.
      • getSrcgendir

        public java.io.File getSrcgendir()
      • setSrcgendir

        public void setSrcgendir​(java.io.File srcgendir)
        Set a location to generate .java files into. Optional, defaults to a temp dir.
        Parameters:
        srcgendir - Optional.
      • getClassgendir

        public java.io.File getClassgendir()
      • setClassgendir

        public void setClassgendir​(java.io.File classgendir)
        Set a location to generate .class files into. Optional, defaults to a temp dir.
        Parameters:
        classgendir - Optional.
      • setCompiler

        public void setCompiler​(java.lang.String compiler)
        Choose the implementation for this particular task.
        Since:
        Ant 1.5
      • isDownload

        public boolean isDownload()
      • setDownload

        public void setDownload​(boolean download)
        Set to true to permit the compiler to download URLs for imports and includes. Defaults to false, meaning all imports and includes must be copied locally.
        Parameters:
        download - Optional.
      • setOptimize

        public void setOptimize​(boolean optimize)
        If true, compiles with optimization enabled.
      • getOptimize

        public boolean getOptimize()
        Gets the optimize flag.
      • isVerbose

        public boolean isVerbose()
      • setVerbose

        public void setVerbose​(boolean verbose)
        Controls the amount of output. Defaults to true.
        Parameters:
        verbose - Optional.
      • isQuiet

        public boolean isQuiet()
      • setQuiet

        public void setQuiet​(boolean quiet)
        Controls the amount of output. Defaults to false.
        Parameters:
        quiet - Optional.
      • isDebug

        public boolean isDebug()
      • getDebugLevel

        public java.lang.String getDebugLevel()
        Get the value of debugLevel.
        Returns:
        value of debugLevel.
      • setDebugLevel

        public void setDebugLevel​(java.lang.String v)
        Keyword list to be appended to the -g command-line switch. This will be ignored by all implementations except modern and classic(ver >= 1.2). Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debuglevel is not specified, by default, :none will be appended to -g. If debug is not turned on, this attribute will be ignored.
        Parameters:
        v - Value to assign to debugLevel.
      • setDebug

        public void setDebug​(boolean debug)
        Generate debugging symbols.
        Parameters:
        debug - Optional.
      • setFork

        public void setFork​(boolean f)
        If true, forks the javac compiler.
        Parameters:
        f - "true|false|on|off|yes|no"
      • setExecutable

        public void setExecutable​(java.lang.String forkExec)
        Sets the the name of the javac executable.

        Ignored unless fork is true or extJavac has been specified as the compiler.

      • getExecutable

        public java.lang.String getExecutable()
      • isSrconly

        public boolean isSrconly()
      • setSrconly

        public void setSrconly​(boolean srconly)
        A value of true means that only source will be generated. Optional, default is false.
        Parameters:
        srconly - Optional.
      • getTypesystemname

        public java.lang.String getTypesystemname()
      • createExtension

        public Extension createExtension()
        One or more SchemaCompiler extensions can be passed in via the <extension> subelement. Schema Compiler extensions must implement the interface com.xbean.too.SchemaCompilerExtension
      • setIgnoreDuplicatesInNamespaces

        public void setIgnoreDuplicatesInNamespaces​(java.lang.String namespaces)
        One or more namespaces in which duplicate definitions are to be ignored can be passed in via the <ignoreDuplicatesInNamespaces> subelement.
      • getIgnoreDuplicatesInNamespaces

        public java.lang.String getIgnoreDuplicatesInNamespaces()
      • setTypesystemname

        public void setTypesystemname​(java.lang.String typesystemname)
        The name of the package that the TypeSystemHolder class should be generated in. Normally this should be left unspecified. None of the xml beans are generated in this package.

        Use .xsdconfig files to modify xml bean package or class names.
        Parameters:
        typesystemname - Optional.
      • isFailonerror

        public boolean isFailonerror()
      • setFailonerror

        public void setFailonerror​(boolean failonerror)
        Determines whether or not the ant target will continue if the XMLBean creation encounters a build error. Defaults to true. Optional.
        Parameters:
        failonerror - Optional.
      • isIncludeAntRuntime

        public boolean isIncludeAntRuntime()
      • setIncludeAntRuntime

        public void setIncludeAntRuntime​(boolean includeAntRuntime)
      • isIncludeJavaRuntime

        public boolean isIncludeJavaRuntime()
      • setIncludeJavaRuntime

        public void setIncludeJavaRuntime​(boolean includeJavaRuntime)
      • isNowarn

        public boolean isNowarn()
      • setNowarn

        public void setNowarn​(boolean nowarn)
      • isNoSrcRegen

        public boolean isNoSrcRegen()
      • setNoSrcRegen

        public void setNoSrcRegen​(boolean noSrcRegen)
      • getMemoryInitialSize

        public java.lang.String getMemoryInitialSize()
        Set the initial memory size of the underlying javac process.
      • setMemoryInitialSize

        public void setMemoryInitialSize​(java.lang.String memoryInitialSize)
      • getMemoryMaximumSize

        public java.lang.String getMemoryMaximumSize()
        Set the maximum memory size of the underlying javac process.
      • setMemoryMaximumSize

        public void setMemoryMaximumSize​(java.lang.String memoryMaximumSize)
      • setNoUpa

        public void setNoUpa​(boolean noupa)
        Do not enforce the unique particle attribution rule.
      • isNoUpa

        public boolean isNoUpa()
      • setNoPvr

        public void setNoPvr​(boolean nopvr)
        Do not enforce the particle valid (restriction) rule.
      • isNoPvr

        public boolean isNoPvr()
      • setNoAnnotations

        public void setNoAnnotations​(boolean noann)
        Skip over schema <annotation%gt; elements.
      • isNoAnnotations

        public boolean isNoAnnotations()
      • setNoValidateDoc

        public void setNoValidateDoc​(boolean novdoc)
        Do not validate the contents of schema <documentation> elements.
      • isNoValidateDoc

        public boolean isNoValidateDoc()
      • setNoExt

        public void setNoExt​(boolean noext)
        Ignore extensions found in .xsdconfig files
        Parameters:
        novdoc -
      • isNoExt

        public boolean isNoExt()
      • setJavaSource

        public void setJavaSource​(java.lang.String javasource)
        Generate java source compatible with the given version. Currently, only "1.4" or "1.5" are supported and "1.4" is the default.
      • getJavaSource

        public java.lang.String getJavaSource()
      • setSource

        public void setSource​(java.lang.String s)
      • getCatalog

        public java.lang.String getCatalog()
        Gets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver. (Note: needs resolver.jar from http://xml.apache.org/commons/components/resolver/index.html)
      • setCatalog

        public void setCatalog​(java.lang.String catalog)
        Sets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver. (Note: needs resolver.jar from http://xml.apache.org/commons/components/resolver/index.html)