KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > xml > namespace > impl > XMLNamespacePackageImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2003-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: XMLNamespacePackageImpl.java,v 1.9 2005/06/08 06:20:10 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.xml.namespace.impl;
18
19
20 import org.eclipse.emf.ecore.EAttribute;
21 import org.eclipse.emf.ecore.EClass;
22 import org.eclipse.emf.ecore.EDataType;
23 import org.eclipse.emf.ecore.EEnum;
24 import org.eclipse.emf.ecore.EPackage;
25 import org.eclipse.emf.ecore.EReference;
26 import org.eclipse.emf.ecore.impl.EPackageImpl;
27 import org.eclipse.emf.ecore.xml.namespace.SpaceType;
28 import org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot;
29 import org.eclipse.emf.ecore.xml.namespace.XMLNamespaceFactory;
30 import org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage;
31 import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
32 import org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl;
33
34
35 /**
36  * <!-- begin-user-doc -->
37  * An implementation of the model <b>Package</b>.
38  * <!-- end-user-doc -->
39  * @generated
40  */

41 public class XMLNamespacePackageImpl extends EPackageImpl implements XMLNamespacePackage
42 {
43   /**
44    * <!-- begin-user-doc -->
45    * <!-- end-user-doc -->
46    * @generated
47    */

48   private EClass xmlNamespaceDocumentRootEClass = null;
49
50   /**
51    * <!-- begin-user-doc -->
52    * <!-- end-user-doc -->
53    * @generated
54    */

55   private EEnum spaceTypeEEnum = null;
56
57   /**
58    * <!-- begin-user-doc -->
59    * <!-- end-user-doc -->
60    * @generated
61    */

62   private EDataType spaceTypeObjectEDataType = null;
63
64   /**
65    * Creates an instance of the model <b>Package</b>, registered with
66    * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
67    * package URI value.
68    * <p>Note: the correct way to create the package is via the static
69    * factory method {@link #init init()}, which also performs
70    * initialization of the package, or returns the registered package,
71    * if one already exists.
72    * <!-- begin-user-doc -->
73    * <!-- end-user-doc -->
74    * @see org.eclipse.emf.ecore.EPackage.Registry
75    * @see org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage#eNS_URI
76    * @see #init()
77    * @generated
78    */

79   private XMLNamespacePackageImpl()
80   {
81     super(eNS_URI, XMLNamespaceFactory.eINSTANCE);
82   }
83
84   /**
85    * <!-- begin-user-doc -->
86    * <!-- end-user-doc -->
87    * @generated
88    */

89   private static boolean isInited = false;
90
91   /**
92    * Creates, registers, and initializes the <b>Package</b> for this
93    * model, and for any others upon which it depends. Simple
94    * dependencies are satisfied by calling this method on all
95    * dependent packages before doing anything else. This method drives
96    * initialization for interdependent packages directly, in parallel
97    * with this package, itself.
98    * <p>Of this package and its interdependencies, all packages which
99    * have not yet been registered by their URI values are first created
100    * and registered. The packages are then initialized in two steps:
101    * meta-model objects for all of the packages are created before any
102    * are initialized, since one package's meta-model objects may refer to
103    * those of another.
104    * <p>Invocation of this method will not affect any packages that have
105    * already been initialized.
106    * <!-- begin-user-doc -->
107    * <!-- end-user-doc -->
108    * @see #eNS_URI
109    * @see #createPackageContents()
110    * @see #initializePackageContents()
111    * @generated
112    */

113   public static XMLNamespacePackage init()
114   {
115     if (isInited) return (XMLNamespacePackage)EPackage.Registry.INSTANCE.getEPackage(XMLNamespacePackage.eNS_URI);
116
117     // Obtain or create and register package
118
XMLNamespacePackageImpl theXMLNamespacePackage = (XMLNamespacePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLNamespacePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLNamespacePackageImpl());
119
120     isInited = true;
121
122     // Initialize simple dependencies
123
XMLTypePackageImpl.init();
124
125     // Create package meta-data objects
126
theXMLNamespacePackage.createPackageContents();
127
128     // Initialize created meta-data
129
theXMLNamespacePackage.initializePackageContents();
130
131     // Mark meta-data to indicate it can't be changed
132
theXMLNamespacePackage.freeze();
133
134     return theXMLNamespacePackage;
135   }
136
137   /**
138    * <!-- begin-user-doc -->
139    * <!-- end-user-doc -->
140    * @generated
141    */

142   public EClass getXMLNamespaceDocumentRoot()
143   {
144     return xmlNamespaceDocumentRootEClass;
145   }
146
147   /**
148    * <!-- begin-user-doc -->
149    * <!-- end-user-doc -->
150    * @generated
151    */

152   public EAttribute getXMLNamespaceDocumentRoot_Mixed()
153   {
154     return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(0);
155   }
156
157   /**
158    * <!-- begin-user-doc -->
159    * <!-- end-user-doc -->
160    * @generated
161    */

162   public EReference getXMLNamespaceDocumentRoot_XMLNSPrefixMap()
163   {
164     return (EReference)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(1);
165   }
166
167   /**
168    * <!-- begin-user-doc -->
169    * <!-- end-user-doc -->
170    * @generated
171    */

172   public EReference getXMLNamespaceDocumentRoot_XSISchemaLocation()
173   {
174     return (EReference)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(2);
175   }
176
177   /**
178    * <!-- begin-user-doc -->
179    * <!-- end-user-doc -->
180    * @generated
181    */

182   public EAttribute getXMLNamespaceDocumentRoot_Base()
183   {
184     return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(3);
185   }
186
187   /**
188    * <!-- begin-user-doc -->
189    * <!-- end-user-doc -->
190    * @generated
191    */

192   public EAttribute getXMLNamespaceDocumentRoot_Id()
193   {
194     return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(4);
195   }
196
197   /**
198    * <!-- begin-user-doc -->
199    * <!-- end-user-doc -->
200    * @generated
201    */

202   public EAttribute getXMLNamespaceDocumentRoot_Lang()
203   {
204     return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(5);
205   }
206
207   /**
208    * <!-- begin-user-doc -->
209    * <!-- end-user-doc -->
210    * @generated
211    */

212   public EAttribute getXMLNamespaceDocumentRoot_Space()
213   {
214     return (EAttribute)xmlNamespaceDocumentRootEClass.getEStructuralFeatures().get(6);
215   }
216
217   /**
218    * <!-- begin-user-doc -->
219    * <!-- end-user-doc -->
220    * @generated
221    */

222   public EEnum getSpaceType()
223   {
224     return spaceTypeEEnum;
225   }
226
227   /**
228    * <!-- begin-user-doc -->
229    * <!-- end-user-doc -->
230    * @generated
231    */

232   public EDataType getSpaceTypeObject()
233   {
234     return spaceTypeObjectEDataType;
235   }
236
237   /**
238    * <!-- begin-user-doc -->
239    * <!-- end-user-doc -->
240    * @generated
241    */

242   public XMLNamespaceFactory getXMLNamespaceFactory()
243   {
244     return (XMLNamespaceFactory)getEFactoryInstance();
245   }
246
247   /**
248    * <!-- begin-user-doc -->
249    * <!-- end-user-doc -->
250    * @generated
251    */

252   private boolean isCreated = false;
253
254   /**
255    * Creates the meta-model objects for the package. This method is
256    * guarded to have no affect on any invocation but its first.
257    * <!-- begin-user-doc -->
258    * <!-- end-user-doc -->
259    * @generated
260    */

261   public void createPackageContents()
262   {
263     if (isCreated) return;
264     isCreated = true;
265
266     // Create classes and their features
267
xmlNamespaceDocumentRootEClass = createEClass(XML_NAMESPACE_DOCUMENT_ROOT);
268     createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__MIXED);
269     createEReference(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP);
270     createEReference(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION);
271     createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__BASE);
272     createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__ID);
273     createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__LANG);
274     createEAttribute(xmlNamespaceDocumentRootEClass, XML_NAMESPACE_DOCUMENT_ROOT__SPACE);
275
276     // Create enums
277
spaceTypeEEnum = createEEnum(SPACE_TYPE);
278
279     // Create data types
280
spaceTypeObjectEDataType = createEDataType(SPACE_TYPE_OBJECT);
281   }
282
283   /**
284    * <!-- begin-user-doc -->
285    * <!-- end-user-doc -->
286    * @generated
287    */

288   private boolean isInitialized = false;
289
290   /**
291    * Complete the initialization of the package and its meta-model. This
292    * method is guarded to have no affect on any invocation but its first.
293    * <!-- begin-user-doc -->
294    * <!-- end-user-doc -->
295    * @generated
296    */

297   public void initializePackageContents()
298   {
299     if (isInitialized) return;
300     isInitialized = true;
301
302     // Initialize package
303
setName(eNAME);
304     setNsPrefix(eNS_PREFIX);
305     setNsURI(eNS_URI);
306
307     // Obtain other dependent packages
308
XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
309
310     // Add supertypes to classes
311

312     // Initialize classes and features; add operations and parameters
313
initEClass(xmlNamespaceDocumentRootEClass, XMLNamespaceDocumentRoot.class, "XMLNamespaceDocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
314     initEAttribute(getXMLNamespaceDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
315     initEReference(getXMLNamespaceDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
316     initEReference(getXMLNamespaceDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
317     initEAttribute(getXMLNamespaceDocumentRoot_Base(), theXMLTypePackage.getAnyURI(), "base", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
318     initEAttribute(getXMLNamespaceDocumentRoot_Id(), theXMLTypePackage.getID(), "id", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
319     initEAttribute(getXMLNamespaceDocumentRoot_Lang(), theXMLTypePackage.getLanguage(), "lang", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
320     initEAttribute(getXMLNamespaceDocumentRoot_Space(), this.getSpaceType(), "space", "preserve", 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
321
322     // Initialize enums and add enum literals
323
initEEnum(spaceTypeEEnum, SpaceType.class, "SpaceType");
324     addEEnumLiteral(spaceTypeEEnum, SpaceType.DEFAULT_LITERAL);
325     addEEnumLiteral(spaceTypeEEnum, SpaceType.PRESERVE_LITERAL);
326
327     // Initialize data types
328
initEDataType(spaceTypeObjectEDataType, SpaceType.class, "SpaceTypeObject", IS_SERIALIZABLE, IS_GENERATED_INSTANCE_CLASS);
329
330     // Create resource
331
createResource(eNS_URI);
332
333     // Create annotations
334
// http:///org/eclipse/emf/ecore/util/ExtendedMetaData
335
createExtendedMetaDataAnnotations();
336   }
337
338   /**
339    * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
340    * <!-- begin-user-doc -->
341    * <!-- end-user-doc -->
342    * @generated
343    */

344   protected void createExtendedMetaDataAnnotations()
345   {
346     String JavaDoc source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
347     addAnnotation
348       (spaceTypeEEnum,
349        source,
350        new String JavaDoc[]
351        {
352        "name", "space_._type"
353        });
354     addAnnotation
355       (spaceTypeObjectEDataType,
356        source,
357        new String JavaDoc[]
358        {
359        "name", "space_._type:Object",
360        "baseType", "space_._type"
361        });
362     addAnnotation
363       (xmlNamespaceDocumentRootEClass,
364        source,
365        new String JavaDoc[]
366        {
367        "name", "",
368        "kind", "mixed"
369        });
370     addAnnotation
371       (getXMLNamespaceDocumentRoot_Mixed(),
372        source,
373        new String JavaDoc[]
374        {
375        "kind", "elementWildcard",
376        "name", ":mixed"
377        });
378     addAnnotation
379       (getXMLNamespaceDocumentRoot_XMLNSPrefixMap(),
380        source,
381        new String JavaDoc[]
382        {
383        "kind", "attribute",
384        "name", "xmlns:prefix"
385        });
386     addAnnotation
387       (getXMLNamespaceDocumentRoot_XSISchemaLocation(),
388        source,
389        new String JavaDoc[]
390        {
391        "kind", "attribute",
392        "name", "xsi:schemaLocation"
393        });
394     addAnnotation
395       (getXMLNamespaceDocumentRoot_Base(),
396        source,
397        new String JavaDoc[]
398        {
399        "kind", "attribute",
400        "name", "base",
401        "namespace", "##targetNamespace"
402        });
403     addAnnotation
404       (getXMLNamespaceDocumentRoot_Id(),
405        source,
406        new String JavaDoc[]
407        {
408        "kind", "attribute",
409        "name", "id",
410        "namespace", "##targetNamespace"
411        });
412     addAnnotation
413       (getXMLNamespaceDocumentRoot_Lang(),
414        source,
415        new String JavaDoc[]
416        {
417        "kind", "attribute",
418        "name", "lang",
419        "namespace", "##targetNamespace"
420        });
421     addAnnotation
422       (getXMLNamespaceDocumentRoot_Space(),
423        source,
424        new String JavaDoc[]
425        {
426        "kind", "attribute",
427        "name", "space",
428        "namespace", "##targetNamespace"
429        });
430   }
431
432 } //XMLNamespacePackageImpl
433
Popular Tags