/** * 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 java.lang.reflect.InvocationTargetException; import java.net.URL; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.occiware.clouddesigner.occi.impl.ResourceImpl; import org.occiware.clouddesigner.occi.platform.Application; import org.occiware.clouddesigner.occi.platform.PlatformPackage; import org.occiware.clouddesigner.occi.platform.Status; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Application</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ApplicationImpl#getName <em>Name</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ApplicationImpl#getContext <em>Context</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ApplicationImpl#getUrl <em>Url</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ApplicationImpl#getState <em>State</em>}</li> * <li>{@link org.occiware.clouddesigner.occi.platform.impl.ApplicationImpl#getMessage <em>Message</em>}</li> * </ul> * * @generated */ public class ApplicationImpl extends ResourceImpl implements Application { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The default value of the '{@link #getContext() <em>Context</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getContext() * @generated * @ordered */ protected static final URL CONTEXT_EDEFAULT = null; /** * The cached value of the '{@link #getContext() <em>Context</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getContext() * @generated * @ordered */ protected URL context = CONTEXT_EDEFAULT; /** * The default value of the '{@link #getUrl() <em>Url</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUrl() * @generated * @ordered */ protected static final URL URL_EDEFAULT = null; /** * The cached value of the '{@link #getUrl() <em>Url</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUrl() * @generated * @ordered */ protected URL url = URL_EDEFAULT; /** * The default value of the '{@link #getState() <em>State</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getState() * @generated * @ordered */ protected static final Status STATE_EDEFAULT = Status.ACTIVE; /** * The cached value of the '{@link #getState() <em>State</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getState() * @generated * @ordered */ protected Status state = STATE_EDEFAULT; /** * The default value of the '{@link #getMessage() <em>Message</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMessage() * @generated * @ordered */ protected static final String MESSAGE_EDEFAULT = null; /** * The cached value of the '{@link #getMessage() <em>Message</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMessage() * @generated * @ordered */ protected String message = MESSAGE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ApplicationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return PlatformPackage.Literals.APPLICATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.APPLICATION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public URL getContext() { return context; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setContext(URL newContext) { URL oldContext = context; context = newContext; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.APPLICATION__CONTEXT, oldContext, context)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public URL getUrl() { return url; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setUrl(URL newUrl) { URL oldUrl = url; url = newUrl; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.APPLICATION__URL, oldUrl, url)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Status getState() { return state; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setState(Status newState) { Status oldState = state; state = newState == null ? STATE_EDEFAULT : newState; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.APPLICATION__STATE, oldState, state)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getMessage() { return message; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setMessage(String newMessage) { String oldMessage = message; message = newMessage; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PlatformPackage.APPLICATION__MESSAGE, oldMessage, message)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void start() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void stop() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case PlatformPackage.APPLICATION__NAME: return getName(); case PlatformPackage.APPLICATION__CONTEXT: return getContext(); case PlatformPackage.APPLICATION__URL: return getUrl(); case PlatformPackage.APPLICATION__STATE: return getState(); case PlatformPackage.APPLICATION__MESSAGE: return getMessage(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case PlatformPackage.APPLICATION__NAME: setName((String)newValue); return; case PlatformPackage.APPLICATION__CONTEXT: setContext((URL)newValue); return; case PlatformPackage.APPLICATION__URL: setUrl((URL)newValue); return; case PlatformPackage.APPLICATION__STATE: setState((Status)newValue); return; case PlatformPackage.APPLICATION__MESSAGE: setMessage((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PlatformPackage.APPLICATION__NAME: setName(NAME_EDEFAULT); return; case PlatformPackage.APPLICATION__CONTEXT: setContext(CONTEXT_EDEFAULT); return; case PlatformPackage.APPLICATION__URL: setUrl(URL_EDEFAULT); return; case PlatformPackage.APPLICATION__STATE: setState(STATE_EDEFAULT); return; case PlatformPackage.APPLICATION__MESSAGE: setMessage(MESSAGE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PlatformPackage.APPLICATION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case PlatformPackage.APPLICATION__CONTEXT: return CONTEXT_EDEFAULT == null ? context != null : !CONTEXT_EDEFAULT.equals(context); case PlatformPackage.APPLICATION__URL: return URL_EDEFAULT == null ? url != null : !URL_EDEFAULT.equals(url); case PlatformPackage.APPLICATION__STATE: return state != STATE_EDEFAULT; case PlatformPackage.APPLICATION__MESSAGE: return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case PlatformPackage.APPLICATION___START: start(); return null; case PlatformPackage.APPLICATION___STOP: stop(); return null; } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(", context: "); result.append(context); result.append(", url: "); result.append(url); result.append(", state: "); result.append(state); result.append(", message: "); result.append(message); result.append(')'); return result.toString(); } } //ApplicationImpl