<?xml version="1.0"?>
<!--
 Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 This code is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License version 2 only, as
 published by the Free Software Foundation.  Oracle designates this
 particular file as subject to the "Classpath" exception as provided
 by Oracle in the LICENSE file that accompanied this code.

 This code is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 version 2 for more details (a copy is included in the LICENSE file that
 accompanied this code).

 You should have received a copy of the GNU General Public License version
 2 along with this work; if not, write to the Free Software Foundation,
 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 or visit www.oracle.com if you need additional information or have any
 questions.
-->

<grammar
 xmlns="http://relaxng.org/ns/structure/1.0"
 xmlns:r="http://relaxng.org/ns/structure/1.0"
 xmlns:a="http://relaxng.org/ns/annotation/1.0"
 xmlns:ref="urn:crossreference"
 xmlns:c="http://www.xml.gr.jp/xmlns/relaxngcc"
 c:runtime-type="com.sun.tools.internal.jxc.NGCCRuntimeEx"
 datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
 c:package="com.sun.tools.internal.jxc.gen.config">


<start c:class="Config" c:access="public">

 <c:java-import>
    import java.util.List;
    import java.util.ArrayList;
    import java.io.File;
 </c:java-import>

<c:java-body>
   private File baseDir;
   private Classes classes;
   private List schema = new ArrayList();
   public Classes getClasses() { return this.classes;}
   public File getBaseDir() { return baseDir;}
   public List getSchema() { return this.schema;}
</c:java-body>

  <element name="config">
     <attribute name="baseDir">
        bd = <data type="string"/>
        baseDir = $runtime.getBaseDir(bd);
     </attribute>
     <ref name="Classes" c:alias="classes"/>
     <zeroOrMore>
        <ref name="Schema" c:alias="_schema" />(baseDir);
        this.schema.add (_schema);
     </zeroOrMore>
     </element>
  </start>


   <define name="Classes" c:access="public">
   <c:java-import>
    import java.util.List;
    import java.util.ArrayList;
    </c:java-import>
     <c:java-body>
       private List includes = new ArrayList();
       public List getIncludes() { return $runtime.getIncludePatterns(this.includes);}
       private List excludes = new ArrayList();
       public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);}
       </c:java-body>
     <element name="classes">

        <element name="includes">
            <list>
               <oneOrMore>
                <data type="string" c:alias="include_content"/>
                <c:java> this.includes.add(include_content); </c:java>
               </oneOrMore>
            </list>

         </element>
        <optional>
        <element name="excludes">
            <list>
               <zeroOrMore>
                <data type="string" c:alias="exclude_content"/>
                <c:java> this.excludes.add(exclude_content); </c:java>
               </zeroOrMore>
            </list>

         </element>
        </optional>
     </element>
    </define>


   <define name="Schema" c:access="public" c:params="File baseDir">
     <c:java-import>
       import java.io.File;
     </c:java-import>
     <c:java-body>
       private File location;
       private String namespace;
       public String getNamespace() { return this.namespace;}
       public File getLocation() { return this.location;}
     </c:java-body>
     <element name="schema">
       <optional>
         <attribute name="namespace">
           namespace = <data type="string" />
         </attribute>
       </optional>

       <optional>
         <attribute name="location">
           loc = <data type="string" />
           location = new File(baseDir,loc);
         </attribute>
       </optional>
     </element>
  </define>
</grammar>
