/******************************************************************************* * Copyright (c) 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jst.javaee.webapp.internal.impl; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; import org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage; import org.eclipse.jst.j2ee.core.internal.plugin.J2EECorePlugin; import org.eclipse.jst.j2ee.internal.J2EEInit; import org.eclipse.jst.javaee.web.internal.metadata.WebPackage; import org.eclipse.jst.javaee.webapp.WebAppDeploymentDescriptor; import org.eclipse.jst.javaee.webapp.WebappFactory; import org.eclipse.jst.javaee.webapp.internal.metadata.WebappPackage; /** * <!-- begin-user-doc --> * An implementation of the model <b>Package</b>. * <!-- end-user-doc --> * @generated */ public class WebappPackageImpl extends EPackageImpl implements WebappPackage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass webAppDeploymentDescriptorEClass = 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.javaee.webapp.internal.metadata.WebappPackage#eNS_URI * @see #init() * @generated */ private WebappPackageImpl() { super(eNS_URI, WebappFactory.eINSTANCE); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private volatile 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 WebappPackage#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 WebappPackage init() { if (isInited) return (WebappPackage)EPackage.Registry.INSTANCE.getEPackage(WebappPackage.eNS_URI); // Obtain or create and register package WebappPackageImpl theWebappPackage = (WebappPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof WebappPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new WebappPackageImpl()); isInited = true; // Initialize simple dependencies XMLNamespacePackage.eINSTANCE.eClass(); // Create package meta-data objects theWebappPackage.createPackageContents(); // Initialize created meta-data theWebappPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed theWebappPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(WebappPackage.eNS_URI, theWebappPackage); EPackage.Registry.INSTANCE.put(WebappPackage.eNS_URI2, theWebappPackage); return theWebappPackage; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getWebAppDeploymentDescriptor() { return webAppDeploymentDescriptorEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getWebAppDeploymentDescriptor_Mixed() { return (EAttribute)webAppDeploymentDescriptorEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getWebAppDeploymentDescriptor_XMLNSPrefixMap() { return (EReference)webAppDeploymentDescriptorEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getWebAppDeploymentDescriptor_XSISchemaLocation() { return (EReference)webAppDeploymentDescriptorEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getWebAppDeploymentDescriptor_WebApp() { return (EReference)webAppDeploymentDescriptorEClass.getEStructuralFeatures().get(3); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public WebappFactory getWebappFactory() { return (WebappFactory)getEFactoryInstance(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private volatile 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 webAppDeploymentDescriptorEClass = createEClass(WEB_APP_DEPLOYMENT_DESCRIPTOR); createEAttribute(webAppDeploymentDescriptorEClass, WEB_APP_DEPLOYMENT_DESCRIPTOR__MIXED); createEReference(webAppDeploymentDescriptorEClass, WEB_APP_DEPLOYMENT_DESCRIPTOR__XMLNS_PREFIX_MAP); createEReference(webAppDeploymentDescriptorEClass, WEB_APP_DEPLOYMENT_DESCRIPTOR__XSI_SCHEMA_LOCATION); createEReference(webAppDeploymentDescriptorEClass, WEB_APP_DEPLOYMENT_DESCRIPTOR__WEB_APP); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private volatile 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); // Obtain other dependent packages WebPackage theWebPackage = (WebPackage)(EPackage.Registry.INSTANCE.getEPackage(WebPackage.eNS_URI) instanceof WebPackage ? EPackage.Registry.INSTANCE.getEPackage(WebPackage.eNS_URI) : WebPackage.eINSTANCE); // Create type parameters // Set bounds for type parameters boolean hasLock = false; try { hasLock = J2EEInit.aquireInitializePackageContentsLock(); } catch (InterruptedException e) { J2EECorePlugin.logError(e); } try{ // Add supertypes to classes // Initialize classes and features; add operations and parameters initEClass(webAppDeploymentDescriptorEClass, WebAppDeploymentDescriptor.class, "WebAppDeploymentDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute(getWebAppDeploymentDescriptor_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getWebAppDeploymentDescriptor_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); //$NON-NLS-1$ initEReference(getWebAppDeploymentDescriptor_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); //$NON-NLS-1$ initEReference(getWebAppDeploymentDescriptor_WebApp(), theWebPackage.getWebApp(), null, "webApp", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ // Create resource createResource(eNS_URI); // Create annotations // http:///org/eclipse/emf/ecore/util/ExtendedMetaData createExtendedMetaDataAnnotations(); }finally{ if( hasLock ) J2EEInit.releaseInitializePackageContentsLock(); } } /** * 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 (webAppDeploymentDescriptorEClass, source, new String[] { "name", "", //$NON-NLS-1$ //$NON-NLS-2$ "kind", "mixed" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getWebAppDeploymentDescriptor_Mixed(), source, new String[] { "kind", "elementWildcard", //$NON-NLS-1$ //$NON-NLS-2$ "name", ":mixed" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getWebAppDeploymentDescriptor_XMLNSPrefixMap(), source, new String[] { "kind", "attribute", //$NON-NLS-1$ //$NON-NLS-2$ "name", "xmlns:prefix" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getWebAppDeploymentDescriptor_XSISchemaLocation(), source, new String[] { "kind", "attribute", //$NON-NLS-1$ //$NON-NLS-2$ "name", "xsi:schemaLocation" //$NON-NLS-1$ //$NON-NLS-2$ }); addAnnotation (getWebAppDeploymentDescriptor_WebApp(), source, new String[] { "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ "name", "web-app", //$NON-NLS-1$ //$NON-NLS-2$ "namespace", "##targetNamespace" //$NON-NLS-1$ //$NON-NLS-2$ }); } @Override public void freeze() { // since EClassImpl.freeze() does a clear() on all of the subClasses, we need to protect initializePackageContents() against it. boolean hasLock = false; try { hasLock = J2EEInit.aquireInitializePackageContentsLock(); } catch (InterruptedException e) { J2EECorePlugin.logError(e); } finally { super.freeze(); if( hasLock ) J2EEInit.releaseInitializePackageContentsLock(); } } } //WebappPackageImpl