/** * Copyright (c) 2015-2016 Obeo, Inria * 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: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> */ package org.occiware.clouddesigner.occi.platform.impl; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EPackageImpl; import org.occiware.clouddesigner.occi.OCCIPackage; import org.occiware.clouddesigner.occi.platform.Application; import org.occiware.clouddesigner.occi.platform.Component; import org.occiware.clouddesigner.occi.platform.Componentlink; import org.occiware.clouddesigner.occi.platform.PlatformFactory; import org.occiware.clouddesigner.occi.platform.PlatformPackage; import org.occiware.clouddesigner.occi.platform.Status; /** * <!-- begin-user-doc --> * An implementation of the model <b>Package</b>. * <!-- end-user-doc --> * @generated */ public class PlatformPackageImpl extends EPackageImpl implements PlatformPackage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass applicationEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass componentEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass componentlinkEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EEnum statusEEnum = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EDataType urlEDataType = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EDataType uriEDataType = 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.occiware.clouddesigner.occi.platform.PlatformPackage#eNS_URI * @see #init() * @generated */ private PlatformPackageImpl() { super(eNS_URI, PlatformFactory.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 PlatformPackage#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 PlatformPackage init() { if (isInited) return (PlatformPackage)EPackage.Registry.INSTANCE.getEPackage(PlatformPackage.eNS_URI); // Obtain or create and register package PlatformPackageImpl thePlatformPackage = (PlatformPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PlatformPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PlatformPackageImpl()); isInited = true; // Initialize simple dependencies OCCIPackage.eINSTANCE.eClass(); // Create package meta-data objects thePlatformPackage.createPackageContents(); // Initialize created meta-data thePlatformPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed thePlatformPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(PlatformPackage.eNS_URI, thePlatformPackage); return thePlatformPackage; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getApplication() { return applicationEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getApplication_Name() { return (EAttribute)applicationEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getApplication_Context() { return (EAttribute)applicationEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getApplication_Url() { return (EAttribute)applicationEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getApplication_State() { return (EAttribute)applicationEClass.getEStructuralFeatures().get(3); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getApplication_Message() { return (EAttribute)applicationEClass.getEStructuralFeatures().get(4); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EOperation getApplication__Start() { return applicationEClass.getEOperations().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EOperation getApplication__Stop() { return applicationEClass.getEOperations().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getComponent() { return componentEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getComponent_State() { return (EAttribute)componentEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getComponent_Message() { return (EAttribute)componentEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EOperation getComponent__Start() { return componentEClass.getEOperations().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EOperation getComponent__Stop() { return componentEClass.getEOperations().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getComponentlink() { return componentlinkEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EEnum getStatus() { return statusEEnum; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDataType getURL() { return urlEDataType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDataType getURI() { return uriEDataType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public PlatformFactory getPlatformFactory() { return (PlatformFactory)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 applicationEClass = createEClass(APPLICATION); createEAttribute(applicationEClass, APPLICATION__NAME); createEAttribute(applicationEClass, APPLICATION__CONTEXT); createEAttribute(applicationEClass, APPLICATION__URL); createEAttribute(applicationEClass, APPLICATION__STATE); createEAttribute(applicationEClass, APPLICATION__MESSAGE); createEOperation(applicationEClass, APPLICATION___START); createEOperation(applicationEClass, APPLICATION___STOP); componentEClass = createEClass(COMPONENT); createEAttribute(componentEClass, COMPONENT__STATE); createEAttribute(componentEClass, COMPONENT__MESSAGE); createEOperation(componentEClass, COMPONENT___START); createEOperation(componentEClass, COMPONENT___STOP); componentlinkEClass = createEClass(COMPONENTLINK); // Create enums statusEEnum = createEEnum(STATUS); // Create data types urlEDataType = createEDataType(URL); uriEDataType = createEDataType(URI); } /** * <!-- 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); // Obtain other dependent packages OCCIPackage theOCCIPackage = (OCCIPackage)EPackage.Registry.INSTANCE.getEPackage(OCCIPackage.eNS_URI); // Create type parameters // Set bounds for type parameters // Add supertypes to classes applicationEClass.getESuperTypes().add(theOCCIPackage.getResource()); componentEClass.getESuperTypes().add(theOCCIPackage.getResource()); componentlinkEClass.getESuperTypes().add(theOCCIPackage.getLink()); // Initialize classes, features, and operations; add parameters initEClass(applicationEClass, Application.class, "Application", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getApplication_Name(), theOCCIPackage.getString(), "name", null, 1, 1, Application.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getApplication_Context(), this.getURL(), "context", null, 1, 1, Application.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getApplication_Url(), this.getURL(), "url", null, 1, 1, Application.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getApplication_State(), this.getStatus(), "state", null, 1, 1, Application.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getApplication_Message(), theOCCIPackage.getString(), "message", null, 0, 1, Application.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEOperation(getApplication__Start(), null, "start", 0, 1, IS_UNIQUE, IS_ORDERED); initEOperation(getApplication__Stop(), null, "stop", 0, 1, IS_UNIQUE, IS_ORDERED); initEClass(componentEClass, Component.class, "Component", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getComponent_State(), this.getStatus(), "state", null, 1, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getComponent_Message(), theOCCIPackage.getString(), "message", null, 0, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEOperation(getComponent__Start(), null, "start", 0, 1, IS_UNIQUE, IS_ORDERED); initEOperation(getComponent__Stop(), null, "stop", 0, 1, IS_UNIQUE, IS_ORDERED); initEClass(componentlinkEClass, Componentlink.class, "Componentlink", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); // Initialize enums and add enum literals initEEnum(statusEEnum, Status.class, "Status"); addEEnumLiteral(statusEEnum, Status.ACTIVE); addEEnumLiteral(statusEEnum, Status.INACTIVE); addEEnumLiteral(statusEEnum, Status.ERROR); // Initialize data types initEDataType(urlEDataType, java.net.URL.class, "URL", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); initEDataType(uriEDataType, java.net.URI.class, "URI", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); // Create resource createResource(eNS_URI); // Create annotations // OCCIE2Ecore createOCCIE2EcoreAnnotations(); } /** * Initializes the annotations for <b>OCCIE2Ecore</b>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createOCCIE2EcoreAnnotations() { String source = "OCCIE2Ecore"; addAnnotation (applicationEClass, source, new String[] { "title", "Application" }); addAnnotation (getApplication__Start(), source, new String[] { "title", "Start the application." }); addAnnotation (getApplication__Stop(), source, new String[] { "title", "Stop the application." }); addAnnotation (getApplication_Name(), source, new String[] { "description", "Name of the application." }); addAnnotation (getApplication_Context(), source, new String[] { "description", "URL for contextualizing the app." }); addAnnotation (getApplication_Url(), source, new String[] { "description", "DNS entry." }); addAnnotation (getApplication_State(), source, new String[] { "description", "State of the application." }); addAnnotation (getApplication_Message(), source, new String[] { "description", "Human-readable explanation of the current instance state." }); addAnnotation (componentEClass, source, new String[] { "title", "Component" }); addAnnotation (getComponent__Start(), source, new String[] { "title", "Start the application." }); addAnnotation (getComponent__Stop(), source, new String[] { "title", "Stop the application." }); addAnnotation (getComponent_State(), source, new String[] { "description", "State of the component." }); addAnnotation (getComponent_Message(), source, new String[] { "description", "Human-readable explanation of the current instance state." }); addAnnotation (componentlinkEClass, source, new String[] { "title", "ComponentLink" }); } } //PlatformPackageImpl