KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > mapping > ecore2ecore > impl > Ecore2EcorePackageImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2004-2005 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: Ecore2EcorePackageImpl.java,v 1.8 2005/06/08 06:21:24 nickb Exp $
16  */

17 package org.eclipse.emf.mapping.ecore2ecore.impl;
18
19
20 import org.eclipse.emf.ecore.EClass;
21 import org.eclipse.emf.ecore.EPackage;
22
23 import org.eclipse.emf.ecore.impl.EPackageImpl;
24 import org.eclipse.emf.ecore.impl.EcorePackageImpl;
25
26 import org.eclipse.emf.mapping.MappingPackage;
27
28 import org.eclipse.emf.mapping.ecore2ecore.Ecore2EcoreFactory;
29 import org.eclipse.emf.mapping.ecore2ecore.Ecore2EcoreMappingRoot;
30 import org.eclipse.emf.mapping.ecore2ecore.Ecore2EcorePackage;
31
32 import org.eclipse.emf.mapping.impl.MappingPackageImpl;
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 Ecore2EcorePackageImpl extends EPackageImpl implements Ecore2EcorePackage
42 {
43   /**
44    * <!-- begin-user-doc -->
45    * <!-- end-user-doc -->
46    * @generated
47    */

48   private EClass ecore2EcoreMappingRootEClass = null;
49
50   /**
51    * Creates an instance of the model <b>Package</b>, registered with
52    * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
53    * package URI value.
54    * <p>Note: the correct way to create the package is via the static
55    * factory method {@link #init init()}, which also performs
56    * initialization of the package, or returns the registered package,
57    * if one already exists.
58    * <!-- begin-user-doc -->
59    * <!-- end-user-doc -->
60    * @see org.eclipse.emf.ecore.EPackage.Registry
61    * @see org.eclipse.emf.mapping.ecore2ecore.Ecore2EcorePackage#eNS_URI
62    * @see #init()
63    * @generated
64    */

65   private Ecore2EcorePackageImpl()
66   {
67     super(eNS_URI, Ecore2EcoreFactory.eINSTANCE);
68   }
69
70   /**
71    * <!-- begin-user-doc -->
72    * <!-- end-user-doc -->
73    * @generated
74    */

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

99   public static Ecore2EcorePackage init()
100   {
101     if (isInited) return (Ecore2EcorePackage)EPackage.Registry.INSTANCE.getEPackage(Ecore2EcorePackage.eNS_URI);
102
103     // Obtain or create and register package
104
Ecore2EcorePackageImpl theEcore2EcorePackage = (Ecore2EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Ecore2EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new Ecore2EcorePackageImpl());
105
106     isInited = true;
107
108     // Initialize simple dependencies
109
MappingPackageImpl.init();
110     EcorePackageImpl.init();
111
112     // Create package meta-data objects
113
theEcore2EcorePackage.createPackageContents();
114
115     // Initialize created meta-data
116
theEcore2EcorePackage.initializePackageContents();
117
118     // Mark meta-data to indicate it can't be changed
119
theEcore2EcorePackage.freeze();
120
121     return theEcore2EcorePackage;
122   }
123
124   /**
125    * <!-- begin-user-doc -->
126    * <!-- end-user-doc -->
127    * @generated
128    */

129   public EClass getEcore2EcoreMappingRoot()
130   {
131     return ecore2EcoreMappingRootEClass;
132   }
133
134   /**
135    * <!-- begin-user-doc -->
136    * <!-- end-user-doc -->
137    * @generated
138    */

139   public Ecore2EcoreFactory getEcore2EcoreFactory()
140   {
141     return (Ecore2EcoreFactory)getEFactoryInstance();
142   }
143
144   /**
145    * <!-- begin-user-doc -->
146    * <!-- end-user-doc -->
147    * @generated
148    */

149   private boolean isCreated = false;
150
151   /**
152    * Creates the meta-model objects for the package. This method is
153    * guarded to have no affect on any invocation but its first.
154    * <!-- begin-user-doc -->
155    * <!-- end-user-doc -->
156    * @generated
157    */

158   public void createPackageContents()
159   {
160     if (isCreated) return;
161     isCreated = true;
162
163     // Create classes and their features
164
ecore2EcoreMappingRootEClass = createEClass(ECORE2_ECORE_MAPPING_ROOT);
165   }
166
167   /**
168    * <!-- begin-user-doc -->
169    * <!-- end-user-doc -->
170    * @generated
171    */

172   private boolean isInitialized = false;
173
174   /**
175    * Complete the initialization of the package and its meta-model. This
176    * method is guarded to have no affect on any invocation but its first.
177    * <!-- begin-user-doc -->
178    * <!-- end-user-doc -->
179    * @generated
180    */

181   public void initializePackageContents()
182   {
183     if (isInitialized) return;
184     isInitialized = true;
185
186     // Initialize package
187
setName(eNAME);
188     setNsPrefix(eNS_PREFIX);
189     setNsURI(eNS_URI);
190
191     // Obtain other dependent packages
192
MappingPackageImpl theMappingPackage = (MappingPackageImpl)EPackage.Registry.INSTANCE.getEPackage(MappingPackage.eNS_URI);
193
194     // Add supertypes to classes
195
ecore2EcoreMappingRootEClass.getESuperTypes().add(theMappingPackage.getMappingRoot());
196
197     // Initialize classes and features; add operations and parameters
198
initEClass(ecore2EcoreMappingRootEClass, Ecore2EcoreMappingRoot.class, "Ecore2EcoreMappingRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
199
200     // Create resource
201
createResource(eNS_URI);
202   }
203
204 } //Ecore2EcorePackageImpl
205
Popular Tags