1 <?xml version="1.0"?>
   2 <!--
   3  Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 
   6  This code is free software; you can redistribute it and/or modify it
   7  under the terms of the GNU General Public License version 2 only, as
   8  published by the Free Software Foundation.  Oracle designates this
   9  particular file as subject to the "Classpath" exception as provided
  10  by Oracle in the LICENSE file that accompanied this code.
  11 
  12  This code is distributed in the hope that it will be useful, but WITHOUT
  13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  version 2 for more details (a copy is included in the LICENSE file that
  16  accompanied this code).
  17 
  18  You should have received a copy of the GNU General Public License version
  19  2 along with this work; if not, write to the Free Software Foundation,
  20  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21 
  22  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  or visit www.oracle.com if you need additional information or have any
  24  questions.
  25 -->
  26 
  27 <grammar
  28  xmlns="http://relaxng.org/ns/structure/1.0"
  29  xmlns:r="http://relaxng.org/ns/structure/1.0"
  30  xmlns:a="http://relaxng.org/ns/annotation/1.0"
  31  xmlns:ref="urn:crossreference"
  32  xmlns:c="http://www.xml.gr.jp/xmlns/relaxngcc"
  33  c:runtime-type="com.sun.tools.internal.jxc.NGCCRuntimeEx"
  34  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
  35  c:package="com.sun.tools.internal.jxc.gen.config">
  36 
  37 
  38 <start c:class="Config" c:access="public">
  39 
  40  <c:java-import>
  41     import java.util.List;
  42     import java.util.ArrayList;
  43     import java.io.File;
  44  </c:java-import>
  45 
  46 <c:java-body>
  47    private File baseDir;
  48    private Classes classes;
  49    private List schema = new ArrayList();
  50    public Classes getClasses() { return this.classes;}
  51    public File getBaseDir() { return baseDir;}
  52    public List getSchema() { return this.schema;}
  53 </c:java-body>
  54 
  55   <element name="config">
  56      <attribute name="baseDir">
  57         bd = <data type="string"/>
  58         baseDir = $runtime.getBaseDir(bd);
  59      </attribute>
  60      <ref name="Classes" c:alias="classes"/>
  61      <zeroOrMore>
  62         <ref name="Schema" c:alias="_schema" />(baseDir);
  63         this.schema.add (_schema);
  64      </zeroOrMore>
  65      </element>
  66   </start>
  67 
  68 
  69    <define name="Classes" c:access="public">
  70    <c:java-import>
  71     import java.util.List;
  72     import java.util.ArrayList;
  73     </c:java-import>
  74      <c:java-body>
  75        private List includes = new ArrayList();
  76        public List getIncludes() { return $runtime.getIncludePatterns(this.includes);}
  77        private List excludes = new ArrayList();
  78        public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);}
  79        </c:java-body>
  80      <element name="classes">
  81 
  82         <element name="includes">
  83             <list>
  84                <oneOrMore>
  85                 <data type="string" c:alias="include_content"/>
  86                 <c:java> this.includes.add(include_content); </c:java>
  87                </oneOrMore>
  88             </list>
  89 
  90          </element>
  91         <optional>
  92         <element name="excludes">
  93             <list>
  94                <zeroOrMore>
  95                 <data type="string" c:alias="exclude_content"/>
  96                 <c:java> this.excludes.add(exclude_content); </c:java>
  97                </zeroOrMore>
  98             </list>
  99 
 100          </element>
 101         </optional>
 102      </element>
 103     </define>
 104 
 105 
 106    <define name="Schema" c:access="public" c:params="File baseDir">
 107      <c:java-import>
 108        import java.io.File;
 109      </c:java-import>
 110      <c:java-body>
 111        private File location;
 112        private String namespace;
 113        public String getNamespace() { return this.namespace;}
 114        public File getLocation() { return this.location;}
 115      </c:java-body>
 116      <element name="schema">
 117        <optional>
 118          <attribute name="namespace">
 119            namespace = <data type="string" />
 120          </attribute>
 121        </optional>
 122 
 123        <optional>
 124          <attribute name="location">
 125            loc = <data type="string" />
 126            location = new File(baseDir,loc);
 127          </attribute>
 128        </optional>
 129      </element>
 130   </define>
 131 </grammar>