001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.xml.schema;
017:
018: import java.net.URI;
019:
020: import org.geotools.factory.Factory;
021:
022: /**
023: * <p>
024: * This Interface is intended to represent the public portion of an XML Schema.
025: * By public portion, I mean the portion of the Schema which can be included
026: * in an instance document, or imported into another Schema.
027: * </p>
028: *
029: * <p>
030: * The distinction between the public portion of a XML Schema and the entire
031: * XML Schema is or particular important when comparing, or printing two XML
032: * Schemas. This interface does is intended to provide enough information to
033: * re-create the original Schema (note the lack or annotations as an example).
034: * This interface is however intended to provide functional semantic
035: * equivalence. By this is mean that two XML Schemas represented using this
036: * interface should have the same SET of declarations. There is no guarantee
037: * that the Schema represented matches the original document with respect to
038: * orderwithin the sets, except where order is explicitly defined (Sequence,
039: * Choice).
040: * </p>
041: *
042: * <p>
043: * This method must be inplemented within extensions: public static Schema
044: * getInstance();. It will be used by the Schema factory to load the required
045: * extensions into memory.
046: * </p>
047: *
048: * @author dzwiers www.refractions.net
049: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/schema/Schema.java $
050: */
051: public interface Schema extends Factory {
052: /**
053: * Used to denote byte masks representing either XML block attributes or
054: * XML final attributes.
055: */
056: public static final int NONE = 0;
057:
058: /**
059: * Used to denote byte masks representing either XML block attributes or
060: * XML final attributes.
061: */
062: public static final int EXTENSION = 1;
063:
064: /**
065: * Used to denote byte masks representing either XML block attributes or
066: * XML final attributes.
067: */
068: public static final int RESTRICTION = 2;
069:
070: /**
071: * Used to denote byte masks representing either XML block attributes or
072: * XML final attributes.
073: */
074: public static final int ALL = 4;
075:
076: /**
077: * <p>
078: * This method is intended to provide a list of public AttributeGroups
079: * defined by this Schema. The definition of 'public AttributeGroups'
080: * should be interpreted as the set of AttributeGroups availiable when
081: * creating an instance document, extending the schema, or importing the
082: * schema.
083: * </p>
084: *
085: * @return AttributeGroup[]
086: *
087: * @see AttributeGroup
088: */
089: public AttributeGroup[] getAttributeGroups();
090:
091: /**
092: * <p>
093: * This method is intended to provide a list of public Attributes defined
094: * by this Schema. The definition of 'public Attributes' should be
095: * interpreted as the set of Attributes availiable when creating an
096: * instance document, extending the schema, or importing the schema.
097: * </p>
098: *
099: *
100: * @see Attribute
101: */
102: public Attribute[] getAttributes();
103:
104: /**
105: * <p>
106: * This method returns the default block value associated with this schema
107: * as a mask. The keys for the mask are represented as constants at the
108: * head of this file. As defined in the XML Schema specification, element
109: * and type blocks should only be extended to include this block if one is
110: * not specified.
111: * </p>
112: *
113: * @return Block Mask
114: */
115: public int getBlockDefault();
116:
117: /**
118: * <p>
119: * This method is intended to provide a list of public ComplexTypes defined
120: * by this Schema. The definition of 'public ComplexTypes' should be
121: * interpreted as the set of ComplexTypes availiable when creating an
122: * instance document, extending the schema, or importing the schema.
123: * </p>
124: *
125: *
126: * @see ComplexType
127: */
128: public ComplexType[] getComplexTypes();
129:
130: /**
131: * <p>
132: * This method is intended to provide a list of public Elements defined by
133: * this Schema. The definition of 'public Elements' should be interpreted
134: * as the set of Elements availiable when creating an instance document,
135: * extending the schema, or importing the schema.
136: * </p>
137: *
138: *
139: * @see Element
140: */
141: public Element[] getElements();
142:
143: /**
144: * <p>
145: * This method returns the default final value associated with this schema
146: * as a mask. The keys for the mask are represented as constants at the
147: * head of this file. As defined in the XML Schema specification, element
148: * and type final values should only be extended to include this final
149: * value if one is not specified.
150: * </p>
151: *
152: * @return Final Mask
153: */
154: public int getFinalDefault();
155:
156: /**
157: * <p>
158: * This method is intended to provide a list of public Groups defined by
159: * this Schema. The definition of 'public Groups' should be interpreted as
160: * the set of Groups availiable when creating an instance document,
161: * extending the schema, or importing the schema.
162: * </p>
163: *
164: *
165: * @see Group
166: */
167: public Group[] getGroups();
168:
169: /**
170: * <p>
171: * This method is intended to provide the ID of this Schema.
172: * </p>
173: *
174: */
175: public String getId();
176:
177: /**
178: * <p>
179: * This method is intended to provide a list of public Imports defined by
180: * this Schema. The definition of 'public Imports' should be interpreted
181: * as the set of Imports availiable when creating an instance document,
182: * extending the schema, or importing the schema.
183: * </p>
184: *
185: *
186: * @see Schema
187: */
188: public Schema[] getImports();
189:
190: /**
191: * <p>
192: * Gets the recommended prefix for this schema.
193: * </p>
194: *
195: */
196: public String getPrefix();
197:
198: /**
199: * <p>
200: * This method is intended to provide a list of public SimpleTypes defined
201: * by this Schema. The definition of 'public SimpleTypes' should be
202: * interpreted as the set of SimpleTypes availiable when creating an
203: * instance document, extending the schema, or importing the schema.
204: * </p>
205: *
206: *
207: * @see SimpleType
208: */
209: public SimpleType[] getSimpleTypes();
210:
211: /**
212: * <p>
213: * This returns the intended use name of the Schema (kinda like an ID, for
214: * a better definition see the XML Schema Specification).
215: * </p>
216: *
217: */
218: public URI getTargetNamespace();
219:
220: // may be different than targNS
221: public URI getURI();
222:
223: /**
224: * <p>
225: * This returns the Schema version ...
226: * </p>
227: *
228: */
229:
230: //TODO Use the Version in the merge + parsing portion for comparisons
231: public String getVersion();
232:
233: /**
234: * <p>
235: * This looks to see if the URI passed in is represented by this Schema.
236: * Often this method uses some heuritics on the list of included URIs.
237: * This allows one Schema to represent one targetNamespace, but be
238: * potentially represented in more than one file.
239: * </p>
240: *
241: * <p>
242: * Used to determine if the uri should provided should be included in an
243: * instance document.
244: * </p>
245: *
246: * @param uri
247: *
248: *
249: * @see #getUris()
250: */
251: public boolean includesURI(URI uri);
252:
253: /**
254: * <p>
255: * Returns true when the Default Attribute Form is qualified, false
256: * otherwise.
257: * </p>
258: *
259: */
260: public boolean isAttributeFormDefault();
261:
262: /**
263: * <p>
264: * Returns true when the Default Element Form is qualified, false
265: * otherwise.
266: * </p>
267: *
268: */
269: public boolean isElementFormDefault();
270: }
|