/** * <copyright> * </copyright> * * $Id: MetadataPackageImpl.java,v 1.9 2011/04/04 22:22:38 gkessler Exp $ */ package org.eclipse.jst.jsf.common.metadata.internal.impl; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; import org.eclipse.jst.jsf.common.metadata.Entity; import org.eclipse.jst.jsf.common.metadata.EntityGroup; import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; import org.eclipse.jst.jsf.common.metadata.MetadataFactory; import org.eclipse.jst.jsf.common.metadata.MetadataPackage; import org.eclipse.jst.jsf.common.metadata.Model; import org.eclipse.jst.jsf.common.metadata.Trait; import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; /** * <!-- begin-user-doc --> * An implementation of the model <b>Package</b>. * <!-- end-user-doc --> * @generated */ @SuppressWarnings("nls") public class MetadataPackageImpl extends EPackageImpl implements MetadataPackage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass traitEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass includeEntityGroupEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass modelEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass entityEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass entityGroupEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EDataType iTraitVisitorEDataType = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EDataType iEntityVisitorEDataType = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EDataType iMetaDataSourceModelProviderEDataType = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EDataType modelContextEDataType = null; /** * Creates an instance of the model <b>Package</b>, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package * package URI value. * <p>Note: the correct way to create the package is via the static * factory method {@link #init init()}, which also performs * initialization of the package, or returns the registered package, * if one already exists. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.eclipse.emf.ecore.EPackage.Registry * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#eNS_URI * @see #init() * @generated */ private MetadataPackageImpl() { super(eNS_URI, MetadataFactory.eINSTANCE); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static boolean isInited = false; /** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. * * <p>This method is used to initialize {@link MetadataPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static MetadataPackage init() { if (isInited) return (MetadataPackage)EPackage.Registry.INSTANCE.getEPackage(MetadataPackage.eNS_URI); // Obtain or create and register package MetadataPackageImpl theMetadataPackage = (MetadataPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MetadataPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MetadataPackageImpl()); isInited = true; // Create package meta-data objects theMetadataPackage.createPackageContents(); // Initialize created meta-data theMetadataPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed theMetadataPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(MetadataPackage.eNS_URI, theMetadataPackage); return theMetadataPackage; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getTrait() { return traitEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getTrait_Value() { return (EReference)traitEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getTrait_SourceModelProvider() { return (EAttribute)traitEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getIncludeEntityGroup() { return includeEntityGroupEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getIncludeEntityGroup_Id() { return (EAttribute)includeEntityGroupEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getIncludeEntityGroup_ModelUri() { return (EAttribute)includeEntityGroupEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getTrait_Id() { return (EAttribute)traitEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getModel() { return modelEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getModel_SourceModelProvider() { return (EAttribute)modelEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getModel_CurrentModelContext() { return (EAttribute)modelEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getModel_EntityGroups() { return (EReference)modelEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEntity() { return entityEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEntity_ChildEntities() { return (EReference)entityEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEntity_Traits() { return (EReference)entityEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getEntity_Id() { return (EAttribute)entityEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getEntity_Type() { return (EAttribute)entityEClass.getEStructuralFeatures().get(3); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEntity_IncludeGroups() { return (EReference)entityEClass.getEStructuralFeatures().get(4); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEntityGroup() { return entityGroupEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDataType getITraitVisitor() { return iTraitVisitorEDataType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDataType getIEntityVisitor() { return iEntityVisitorEDataType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDataType getIMetaDataSourceModelProvider() { return iMetaDataSourceModelProviderEDataType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDataType getModelContext() { return modelContextEDataType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MetadataFactory getMetadataFactory() { return (MetadataFactory)getEFactoryInstance(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private boolean isCreated = false; /** * Creates the meta-model objects for the package. This method is * guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void createPackageContents() { if (isCreated) return; isCreated = true; // Create classes and their features modelEClass = createEClass(MODEL); createEReference(modelEClass, MODEL__ENTITY_GROUPS); createEAttribute(modelEClass, MODEL__SOURCE_MODEL_PROVIDER); createEAttribute(modelEClass, MODEL__CURRENT_MODEL_CONTEXT); entityGroupEClass = createEClass(ENTITY_GROUP); entityEClass = createEClass(ENTITY); createEReference(entityEClass, ENTITY__CHILD_ENTITIES); createEReference(entityEClass, ENTITY__TRAITS); createEAttribute(entityEClass, ENTITY__ID); createEAttribute(entityEClass, ENTITY__TYPE); createEReference(entityEClass, ENTITY__INCLUDE_GROUPS); includeEntityGroupEClass = createEClass(INCLUDE_ENTITY_GROUP); createEAttribute(includeEntityGroupEClass, INCLUDE_ENTITY_GROUP__ID); createEAttribute(includeEntityGroupEClass, INCLUDE_ENTITY_GROUP__MODEL_URI); traitEClass = createEClass(TRAIT); createEAttribute(traitEClass, TRAIT__ID); createEReference(traitEClass, TRAIT__VALUE); createEAttribute(traitEClass, TRAIT__SOURCE_MODEL_PROVIDER); // Create data types iTraitVisitorEDataType = createEDataType(ITRAIT_VISITOR); iEntityVisitorEDataType = createEDataType(IENTITY_VISITOR); iMetaDataSourceModelProviderEDataType = createEDataType(IMETA_DATA_SOURCE_MODEL_PROVIDER); modelContextEDataType = createEDataType(MODEL_CONTEXT); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private boolean isInitialized = false; /** * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void initializePackageContents() { if (isInitialized) return; isInitialized = true; // Initialize package setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); // Create type parameters // Set bounds for type parameters // Add supertypes to classes modelEClass.getESuperTypes().add(this.getEntity()); entityGroupEClass.getESuperTypes().add(this.getEntity()); // Initialize classes and features; add operations and parameters initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference(getModel_EntityGroups(), this.getEntityGroup(), null, "entityGroups", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ getModel_EntityGroups().getEKeys().add(this.getEntity_Id()); getModel_EntityGroups().getEKeys().add(this.getEntity_Type()); initEAttribute(getModel_SourceModelProvider(), this.getIMetaDataSourceModelProvider(), "sourceModelProvider", null, 0, 1, Model.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getModel_CurrentModelContext(), this.getModelContext(), "currentModelContext", null, 0, 1, Model.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ EOperation op = addEOperation(modelEClass, this.getEntityGroup(), "findIncludeGroup", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, ecorePackage.getEString(), "groupId", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ op = addEOperation(modelEClass, null, "accept", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, this.getIEntityVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ initEClass(entityGroupEClass, EntityGroup.class, "EntityGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEClass(entityEClass, Entity.class, "Entity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference(getEntity_ChildEntities(), this.getEntity(), null, "childEntities", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ getEntity_ChildEntities().getEKeys().add(this.getEntity_Id()); getEntity_ChildEntities().getEKeys().add(this.getEntity_Type()); initEReference(getEntity_Traits(), this.getTrait(), null, "traits", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ getEntity_Traits().getEKeys().add(this.getTrait_Id()); initEAttribute(getEntity_Id(), ecorePackage.getEString(), "id", null, 1, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getEntity_Type(), ecorePackage.getEString(), "type", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getEntity_IncludeGroups(), this.getIncludeEntityGroup(), null, "includeGroups", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ op = addEOperation(entityEClass, null, "accept", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, this.getIEntityVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEOperation(entityEClass, this.getModel(), "getModel", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ initEClass(includeEntityGroupEClass, IncludeEntityGroup.class, "IncludeEntityGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute(getIncludeEntityGroup_Id(), ecorePackage.getEString(), "id", null, 1, 1, IncludeEntityGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getIncludeEntityGroup_ModelUri(), ecorePackage.getEString(), "modelUri", null, 0, 1, IncludeEntityGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEClass(traitEClass, Trait.class, "Trait", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute(getTrait_Id(), ecorePackage.getEString(), "id", null, 1, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getTrait_Value(), ecorePackage.getEObject(), null, "value", null, 1, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEAttribute(getTrait_SourceModelProvider(), this.getIMetaDataSourceModelProvider(), "sourceModelProvider", null, 0, 1, Trait.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ op = addEOperation(traitEClass, null, "accept", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ addEParameter(op, this.getITraitVisitor(), "visitor", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ // Initialize data types initEDataType(iTraitVisitorEDataType, ITraitVisitor.class, "ITraitVisitor", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEDataType(iEntityVisitorEDataType, IEntityVisitor.class, "IEntityVisitor", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEDataType(iMetaDataSourceModelProviderEDataType, IMetaDataSourceModelProvider.class, "IMetaDataSourceModelProvider", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEDataType(modelContextEDataType, ModelKeyDescriptor.class, "ModelContext", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ // Create resource createResource(eNS_URI); // Create annotations // http:///org/eclipse/emf/ecore/util/ExtendedMetaData createExtendedMetaDataAnnotations(); } /** * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createExtendedMetaDataAnnotations() { String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ addAnnotation (modelEClass, source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "metadatamodel" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getModel_EntityGroups(), source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "entityGroup" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (entityEClass, source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "entity" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getEntity_ChildEntities(), source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "entity" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getEntity_Traits(), source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "trait" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getEntity_IncludeGroups(), source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "include-entity-group" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getIncludeEntityGroup_ModelUri(), source, new String[] { "name", "uri" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (traitEClass, source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "trait" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getTrait_Value(), source, new String[] { "kind", "element" //$NON-NLS-1$ //$NON-NLS-2$ }); } } //MetadataPackageImpl