001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.xml.schema.model;
043:
044: import java.util.Collection;
045: import java.util.Map;
046: import java.util.Set;
047: import org.netbeans.modules.xml.schema.model.Derivation.Type;
048: import org.netbeans.modules.xml.xam.EmbeddableRoot;
049:
050: /**
051: * This interface represents the schema element.
052: * @author Chris Webster
053: */
054: public interface Schema extends SchemaComponent, EmbeddableRoot {
055: public static final String TARGET_NAMESPACE_PROPERTY = "targetNamespace";
056: public static final String BLOCK_DEFAULT_PROPERTY = "blockDefault";
057: public static final String ATTRIBUTE_FORM_DEFAULT_PROPERTY = "attributeFormDefault";
058: public static final String FINAL_DEFAULT_PROPERTY = "finalDefault";
059: public static final String LANGUAGE_PROPERTY = "language";
060: public static final String ELEMENT_FORM_DEFAULT_PROPERTY = "elementFormDefault";
061: public static final String VERSION_PROPERTY = "version";
062: public static final String SCHEMA_REFERENCES_PROPERTY = "schemaReferences";
063: public static final String ATTRIBUTES_PROPERTY = "attributes";
064: public static final String ELEMENTS_PROPERTY = "elements";
065: public static final String ATTRIBUTE_GROUPS_PROPERTY = "attributeGroups";
066: public static final String SIMPLE_TYPES_PROPERTY = "simpleTypes";
067: public static final String COMPLEX_TYPES_PROPERTY = "complexTypes";
068: public static final String GROUPS_PROPERTY = "groups";
069: public static final String NOTATIONS_PROPERTY = "notations";
070:
071: Form getAttributeFormDefault();
072:
073: void setAttributeFormDefault(Form form);
074:
075: /**
076: * @return default for schema global default value for 'form' property on attributes.
077: */
078: Form getAttributeFormDefaultDefault();
079:
080: Form getAttributeFormDefaultEffective();
081:
082: public enum Block implements Derivation {
083: ALL(Type.ALL), RESTRICTION(Type.RESTRICTION), EXTENSION(
084: Type.EXTENSION), SUBSTITUTION(Type.SUBSTITUTION), EMPTY(
085: Type.EMPTY);
086: private Derivation.Type value;
087:
088: Block(Derivation.Type v) {
089: value = v;
090: }
091:
092: public String toString() {
093: return value.toString();
094: }
095: }
096:
097: Set<Block> getBlockDefault();
098:
099: void setBlockDefault(Set<Block> blockDefault);
100:
101: /**
102: * @return default for schema global default value for 'block' property.
103: */
104: Set<Block> getBlockDefaultDefault();
105:
106: Set<Block> getBlockDefaultEffective();
107:
108: Form getElementFormDefault();
109:
110: void setElementFormDefault(Form form);
111:
112: /**
113: * @return default for schema global default value for 'form' property on elements.
114: */
115: Form getElementFormDefaultDefault();
116:
117: Form getElementFormDefaultEffective();
118:
119: public enum Final implements Derivation {
120: ALL(Type.ALL), RESTRICTION(Type.RESTRICTION), EXTENSION(
121: Type.EXTENSION), LIST(Type.LIST), UNION(Type.UNION), EMPTY(
122: Type.EMPTY);
123: private Derivation.Type value;
124:
125: Final(Derivation.Type v) {
126: value = v;
127: }
128:
129: public String toString() {
130: return value.toString();
131: }
132: }
133:
134: Set<Final> getFinalDefault();
135:
136: void setFinalDefault(Set<Final> finalDefault);
137:
138: /**
139: * @return default for schema global default value for 'final' property.
140: */
141: Set<Final> getFinalDefaultDefault();
142:
143: Set<Final> getFinalDefaultEffective();
144:
145: String getTargetNamespace();
146:
147: void setTargetNamespace(String uri);
148:
149: String getVersion();
150:
151: void setVersion(String ver);
152:
153: String getLanguage();
154:
155: void setLanguage(String language);
156:
157: // Content
158: // import, include, redefine
159: Collection<SchemaModelReference> getSchemaReferences();
160:
161: Collection<Import> getImports();
162:
163: Collection<Include> getIncludes();
164:
165: Collection<Redefine> getRedefines();
166:
167: void addExternalReference(SchemaModelReference ref);
168:
169: void removeExternalReference(SchemaModelReference ref);
170:
171: Collection<GlobalAttribute> getAttributes();
172:
173: void addAttribute(GlobalAttribute attr);
174:
175: void removeAttribute(GlobalAttribute attr);
176:
177: Collection<GlobalElement> getElements();
178:
179: void addElement(GlobalElement element);
180:
181: void removeElement(GlobalElement element);
182:
183: Collection<GlobalElement> findAllGlobalElements();
184:
185: Collection<GlobalAttributeGroup> getAttributeGroups();
186:
187: void addAttributeGroup(GlobalAttributeGroup group);
188:
189: void removeAttributeGroup(GlobalAttributeGroup group);
190:
191: Collection<GlobalSimpleType> getSimpleTypes();
192:
193: void addSimpleType(GlobalSimpleType type);
194:
195: void removeSimpleType(GlobalSimpleType type);
196:
197: Collection<GlobalComplexType> getComplexTypes();
198:
199: void addComplexType(GlobalComplexType type);
200:
201: void removeComplexType(GlobalComplexType type);
202:
203: Collection<GlobalType> findAllGlobalTypes();
204:
205: Collection<GlobalGroup> getGroups();
206:
207: void addGroup(GlobalGroup group);
208:
209: void removeGroup(GlobalGroup group);
210:
211: Collection<Notation> getNotations();
212:
213: void addNotation(Notation notation);
214:
215: void removeNotation(Notation notation);
216:
217: Map<String, String> getPrefixes();
218:
219: void addPrefix(String prefix, String namespace);
220:
221: void removePrefix(String prefix);
222: }
|