From f260a66414dfc98523b3fa88d5b6d21ea59bb00e Mon Sep 17 00:00:00 2001 From: Javier Montalvo Orus Date: Thu, 7 Sep 2006 10:56:00 +0000 Subject: [PATCH] Initial commit of org.eclipse.tm.discovery.model --- .../org.eclipse.tm.discovery.model/.classpath | 7 + .../org.eclipse.tm.discovery.model/.project | 28 + .../META-INF/MANIFEST.MF | 15 + .../org.eclipse.tm.discovery.model/about.html | 29 + .../build.properties | 6 + .../ecore/discoveryModel.genmodel | 30 ++ .../ecore/discoveryModel.xsd | 49 ++ .../ecore/model.ecore | 101 ++++ .../plugin.properties | 26 + .../org.eclipse.tm.discovery.model/plugin.xml | 28 + .../eclipse/tm/discovery/model/Activator.java | 60 +++ .../eclipse/tm/discovery/model/Device.java | 89 +++ .../tm/discovery/model/ModelFactory.java | 79 +++ .../tm/discovery/model/ModelPackage.java | 510 ++++++++++++++++++ .../eclipse/tm/discovery/model/Network.java | 46 ++ .../org/eclipse/tm/discovery/model/Pair.java | 75 +++ .../eclipse/tm/discovery/model/Service.java | 68 +++ .../tm/discovery/model/ServiceType.java | 68 +++ .../tm/discovery/model/impl/DeviceImpl.java | 258 +++++++++ .../model/impl/ModelFactoryImpl.java | 135 +++++ .../model/impl/ModelPackageImpl.java | 470 ++++++++++++++++ .../tm/discovery/model/impl/NetworkImpl.java | 144 +++++ .../tm/discovery/model/impl/PairImpl.java | 204 +++++++ .../tm/discovery/model/impl/ServiceImpl.java | 208 +++++++ .../discovery/model/impl/ServiceTypeImpl.java | 208 +++++++ .../model/util/ModelAdapterFactory.java | 188 +++++++ .../model/util/ModelResourceFactoryImpl.java | 57 ++ .../model/util/ModelResourceImpl.java | 35 ++ .../tm/discovery/model/util/ModelSwitch.java | 213 ++++++++ .../model/util/ModelXMLProcessor.java | 51 ++ 30 files changed, 3485 insertions(+) create mode 100644 discovery/org.eclipse.tm.discovery.model/.classpath create mode 100644 discovery/org.eclipse.tm.discovery.model/.project create mode 100644 discovery/org.eclipse.tm.discovery.model/META-INF/MANIFEST.MF create mode 100644 discovery/org.eclipse.tm.discovery.model/about.html create mode 100644 discovery/org.eclipse.tm.discovery.model/build.properties create mode 100644 discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.genmodel create mode 100644 discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.xsd create mode 100644 discovery/org.eclipse.tm.discovery.model/ecore/model.ecore create mode 100644 discovery/org.eclipse.tm.discovery.model/plugin.properties create mode 100644 discovery/org.eclipse.tm.discovery.model/plugin.xml create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Activator.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Device.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelFactory.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelPackage.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Network.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Pair.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Service.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ServiceType.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/DeviceImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelFactoryImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelPackageImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/NetworkImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/PairImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceTypeImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelAdapterFactory.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceFactoryImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceImpl.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelSwitch.java create mode 100644 discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelXMLProcessor.java diff --git a/discovery/org.eclipse.tm.discovery.model/.classpath b/discovery/org.eclipse.tm.discovery.model/.classpath new file mode 100644 index 00000000000..065ac06e197 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/discovery/org.eclipse.tm.discovery.model/.project b/discovery/org.eclipse.tm.discovery.model/.project new file mode 100644 index 00000000000..e8666856896 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/.project @@ -0,0 +1,28 @@ + + + org.eclipse.tm.discovery.model + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/discovery/org.eclipse.tm.discovery.model/META-INF/MANIFEST.MF b/discovery/org.eclipse.tm.discovery.model/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..5246907c275 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tm.discovery.model;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.eclipse.tm.discovery.model.Activator +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf.ecore;bundle-version="2.2.0", + org.eclipse.emf.ecore.xmi;bundle-version="2.2.0" +Eclipse-LazyStart: true +Export-Package: org.eclipse.tm.discovery.model, + org.eclipse.tm.discovery.model.impl, + org.eclipse.tm.discovery.model.util diff --git a/discovery/org.eclipse.tm.discovery.model/about.html b/discovery/org.eclipse.tm.discovery.model/about.html new file mode 100644 index 00000000000..928af38d499 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/about.html @@ -0,0 +1,29 @@ + +About + + + + +

About This Content

+ +

July 27, 2006

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in +("Content"). Unless otherwise indicated below, the Content is provided +to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is +available at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse +Foundation, the Content is being redistributed by another party +("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the +Redistributor's license that was provided with the Content. If no such +license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any +source code in the Content and such source code may be obtained at http://www.eclipse.org.

+ + + \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/build.properties b/discovery/org.eclipse.tm.discovery.model/build.properties new file mode 100644 index 00000000000..d601194980a --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +bin.includes = META-INF/,\ + .,\ + src/,\ + about.html +src.includes = about.html diff --git a/discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.genmodel b/discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.genmodel new file mode 100644 index 00000000000..f163d637594 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.genmodel @@ -0,0 +1,30 @@ + + + discoveryModel.xsd + + + + + + + + + + + + + + + + + + + + + + + diff --git a/discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.xsd b/discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.xsd new file mode 100644 index 00000000000..0ef4b84fb72 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/ecore/discoveryModel.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/ecore/model.ecore b/discovery/org.eclipse.tm.discovery.model/ecore/model.ecore new file mode 100644 index 00000000000..0c7608fc81c --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/ecore/model.ecore @@ -0,0 +1,101 @@ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + diff --git a/discovery/org.eclipse.tm.discovery.model/plugin.properties b/discovery/org.eclipse.tm.discovery.model/plugin.properties new file mode 100644 index 00000000000..fb100bbc7b8 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/plugin.properties @@ -0,0 +1,26 @@ +################################################################################## +# Copyright (c) 2006 Symbian Software Ltd. 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: +# Javier Montalvo Orús (Symbian) - initial API and implementation +################################################################################## + + +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ==================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ==================================================================== + +pluginName = Service Discovery Model +providerName = Symbian + diff --git a/discovery/org.eclipse.tm.discovery.model/plugin.xml b/discovery/org.eclipse.tm.discovery.model/plugin.xml new file mode 100644 index 00000000000..f24284752e2 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/plugin.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Activator.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Activator.java new file mode 100644 index 00000000000..0101d08699a --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Activator.java @@ -0,0 +1,60 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.tm.discovery"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Device.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Device.java new file mode 100644 index 00000000000..9b99138ec8e --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Device.java @@ -0,0 +1,89 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Device'. + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.tm.discovery.model.Device#getServiceType Service Type}
  • + *
  • {@link org.eclipse.tm.discovery.model.Device#getAddress Address}
  • + *
  • {@link org.eclipse.tm.discovery.model.Device#getName Name}
  • + *
+ *

+ * + * @see org.eclipse.tm.discovery.model.ModelPackage#getDevice() + * @model extendedMetaData="name='Device' kind='elementOnly'" + * @generated + */ +public interface Device extends EObject { + /** + * Returns the value of the 'Service Type' containment reference list. + * The list contents are of type {@link org.eclipse.tm.discovery.model.ServiceType}. + * + * @return the value of the 'Service Type' containment reference list. + * @see org.eclipse.tm.discovery.model.ModelPackage#getDevice_ServiceType() + * @model type="org.eclipse.tm.discovery.model.ServiceType" containment="true" required="true" + * extendedMetaData="kind='element' name='ServiceType'" + * @generated + */ + EList getServiceType(); + + /** + * Returns the value of the 'Address' attribute. + * + * @return the value of the 'Address' attribute. + * @see #setAddress(String) + * @see org.eclipse.tm.discovery.model.ModelPackage#getDevice_Address() + * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" + * extendedMetaData="kind='attribute' name='address'" + * @generated + */ + String getAddress(); + + /** + * Sets the value of the '{@link org.eclipse.tm.discovery.model.Device#getAddress Address}' attribute. + * + * @param value the new value of the 'Address' attribute. + * @see #getAddress() + * @generated + */ + void setAddress(String value); + + /** + * Returns the value of the 'Name' attribute. + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.tm.discovery.model.ModelPackage#getDevice_Name() + * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" + * extendedMetaData="kind='attribute' name='name'" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.tm.discovery.model.Device#getName Name}' attribute. + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // Device \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelFactory.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelFactory.java new file mode 100644 index 00000000000..6236c44fe4c --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelFactory.java @@ -0,0 +1,79 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.eclipse.tm.discovery.model.ModelPackage + * @generated + */ +public interface ModelFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * @generated + */ + ModelFactory eINSTANCE = org.eclipse.tm.discovery.model.impl.ModelFactoryImpl.init(); + + /** + * Returns a new object of class 'Device'. + * + * @return a new object of class 'Device'. + * @generated + */ + Device createDevice(); + + /** + * Returns a new object of class 'Network'. + * + * @return a new object of class 'Network'. + * @generated + */ + Network createNetwork(); + + /** + * Returns a new object of class 'Pair'. + * + * @return a new object of class 'Pair'. + * @generated + */ + Pair createPair(); + + /** + * Returns a new object of class 'Service'. + * + * @return a new object of class 'Service'. + * @generated + */ + Service createService(); + + /** + * Returns a new object of class 'Service Type'. + * + * @return a new object of class 'Service Type'. + * @generated + */ + ServiceType createServiceType(); + + /** + * Returns the package supported by this factory. + * + * @return the package supported by this factory. + * @generated + */ + ModelPackage getModelPackage(); + +} //ModelFactory diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelPackage.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelPackage.java new file mode 100644 index 00000000000..0e695b52702 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ModelPackage.java @@ -0,0 +1,510 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.eclipse.tm.discovery.model.ModelFactory + * @model kind="package" + * @generated + */ +public interface ModelPackage extends EPackage { + /** + * The package name. + * + * @generated + */ + String eNAME = "model"; + + /** + * The package namespace URI. + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/tm/discovery/model"; + + /** + * The package namespace name. + * + * @generated + */ + String eNS_PREFIX = "model"; + + /** + * The singleton instance of the package. + * + * @generated + */ + ModelPackage eINSTANCE = org.eclipse.tm.discovery.model.impl.ModelPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.tm.discovery.model.impl.DeviceImpl Device}' class. + * + * @see org.eclipse.tm.discovery.model.impl.DeviceImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getDevice() + * @generated + */ + int DEVICE = 0; + + /** + * The feature id for the 'Service Type' containment reference list. + * + * @generated + * @ordered + */ + int DEVICE__SERVICE_TYPE = 0; + + /** + * The feature id for the 'Address' attribute. + * + * @generated + * @ordered + */ + int DEVICE__ADDRESS = 1; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int DEVICE__NAME = 2; + + /** + * The number of structural features of the 'Device' class. + * + * @generated + * @ordered + */ + int DEVICE_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.eclipse.tm.discovery.model.impl.NetworkImpl Network}' class. + * + * @see org.eclipse.tm.discovery.model.impl.NetworkImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getNetwork() + * @generated + */ + int NETWORK = 1; + + /** + * The feature id for the 'Device' containment reference list. + * + * @generated + * @ordered + */ + int NETWORK__DEVICE = 0; + + /** + * The number of structural features of the 'Network' class. + * + * @generated + * @ordered + */ + int NETWORK_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.tm.discovery.model.impl.PairImpl Pair}' class. + * + * @see org.eclipse.tm.discovery.model.impl.PairImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getPair() + * @generated + */ + int PAIR = 2; + + /** + * The feature id for the 'Key' attribute. + * + * @generated + * @ordered + */ + int PAIR__KEY = 0; + + /** + * The feature id for the 'Value' attribute. + * + * @generated + * @ordered + */ + int PAIR__VALUE = 1; + + /** + * The number of structural features of the 'Pair' class. + * + * @generated + * @ordered + */ + int PAIR_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.tm.discovery.model.impl.ServiceImpl Service}' class. + * + * @see org.eclipse.tm.discovery.model.impl.ServiceImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getService() + * @generated + */ + int SERVICE = 3; + + /** + * The feature id for the 'Pair' containment reference list. + * + * @generated + * @ordered + */ + int SERVICE__PAIR = 0; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int SERVICE__NAME = 1; + + /** + * The number of structural features of the 'Service' class. + * + * @generated + * @ordered + */ + int SERVICE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.tm.discovery.model.impl.ServiceTypeImpl Service Type}' class. + * + * @see org.eclipse.tm.discovery.model.impl.ServiceTypeImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getServiceType() + * @generated + */ + int SERVICE_TYPE = 4; + + /** + * The feature id for the 'Service' containment reference list. + * + * @generated + * @ordered + */ + int SERVICE_TYPE__SERVICE = 0; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int SERVICE_TYPE__NAME = 1; + + /** + * The number of structural features of the 'Service Type' class. + * + * @generated + * @ordered + */ + int SERVICE_TYPE_FEATURE_COUNT = 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.tm.discovery.model.Device Device}'. + * + * @return the meta object for class 'Device'. + * @see org.eclipse.tm.discovery.model.Device + * @generated + */ + EClass getDevice(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.tm.discovery.model.Device#getServiceType Service Type}'. + * + * @return the meta object for the containment reference list 'Service Type'. + * @see org.eclipse.tm.discovery.model.Device#getServiceType() + * @see #getDevice() + * @generated + */ + EReference getDevice_ServiceType(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.tm.discovery.model.Device#getAddress Address}'. + * + * @return the meta object for the attribute 'Address'. + * @see org.eclipse.tm.discovery.model.Device#getAddress() + * @see #getDevice() + * @generated + */ + EAttribute getDevice_Address(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.tm.discovery.model.Device#getName Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.tm.discovery.model.Device#getName() + * @see #getDevice() + * @generated + */ + EAttribute getDevice_Name(); + + /** + * Returns the meta object for class '{@link org.eclipse.tm.discovery.model.Network Network}'. + * + * @return the meta object for class 'Network'. + * @see org.eclipse.tm.discovery.model.Network + * @generated + */ + EClass getNetwork(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.tm.discovery.model.Network#getDevice Device}'. + * + * @return the meta object for the containment reference list 'Device'. + * @see org.eclipse.tm.discovery.model.Network#getDevice() + * @see #getNetwork() + * @generated + */ + EReference getNetwork_Device(); + + /** + * Returns the meta object for class '{@link org.eclipse.tm.discovery.model.Pair Pair}'. + * + * @return the meta object for class 'Pair'. + * @see org.eclipse.tm.discovery.model.Pair + * @generated + */ + EClass getPair(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.tm.discovery.model.Pair#getKey Key}'. + * + * @return the meta object for the attribute 'Key'. + * @see org.eclipse.tm.discovery.model.Pair#getKey() + * @see #getPair() + * @generated + */ + EAttribute getPair_Key(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.tm.discovery.model.Pair#getValue Value}'. + * + * @return the meta object for the attribute 'Value'. + * @see org.eclipse.tm.discovery.model.Pair#getValue() + * @see #getPair() + * @generated + */ + EAttribute getPair_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.tm.discovery.model.Service Service}'. + * + * @return the meta object for class 'Service'. + * @see org.eclipse.tm.discovery.model.Service + * @generated + */ + EClass getService(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.tm.discovery.model.Service#getPair Pair}'. + * + * @return the meta object for the containment reference list 'Pair'. + * @see org.eclipse.tm.discovery.model.Service#getPair() + * @see #getService() + * @generated + */ + EReference getService_Pair(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.tm.discovery.model.Service#getName Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.tm.discovery.model.Service#getName() + * @see #getService() + * @generated + */ + EAttribute getService_Name(); + + /** + * Returns the meta object for class '{@link org.eclipse.tm.discovery.model.ServiceType Service Type}'. + * + * @return the meta object for class 'Service Type'. + * @see org.eclipse.tm.discovery.model.ServiceType + * @generated + */ + EClass getServiceType(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.tm.discovery.model.ServiceType#getService Service}'. + * + * @return the meta object for the containment reference list 'Service'. + * @see org.eclipse.tm.discovery.model.ServiceType#getService() + * @see #getServiceType() + * @generated + */ + EReference getServiceType_Service(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.tm.discovery.model.ServiceType#getName Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.tm.discovery.model.ServiceType#getName() + * @see #getServiceType() + * @generated + */ + EAttribute getServiceType_Name(); + + /** + * Returns the factory that creates the instances of the model. + * + * @return the factory that creates the instances of the model. + * @generated + */ + ModelFactory getModelFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.tm.discovery.model.impl.DeviceImpl Device}' class. + * + * @see org.eclipse.tm.discovery.model.impl.DeviceImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getDevice() + * @generated + */ + EClass DEVICE = eINSTANCE.getDevice(); + + /** + * The meta object literal for the 'Service Type' containment reference list feature. + * + * @generated + */ + EReference DEVICE__SERVICE_TYPE = eINSTANCE.getDevice_ServiceType(); + + /** + * The meta object literal for the 'Address' attribute feature. + * + * @generated + */ + EAttribute DEVICE__ADDRESS = eINSTANCE.getDevice_Address(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute DEVICE__NAME = eINSTANCE.getDevice_Name(); + + /** + * The meta object literal for the '{@link org.eclipse.tm.discovery.model.impl.NetworkImpl Network}' class. + * + * @see org.eclipse.tm.discovery.model.impl.NetworkImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getNetwork() + * @generated + */ + EClass NETWORK = eINSTANCE.getNetwork(); + + /** + * The meta object literal for the 'Device' containment reference list feature. + * + * @generated + */ + EReference NETWORK__DEVICE = eINSTANCE.getNetwork_Device(); + + /** + * The meta object literal for the '{@link org.eclipse.tm.discovery.model.impl.PairImpl Pair}' class. + * + * @see org.eclipse.tm.discovery.model.impl.PairImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getPair() + * @generated + */ + EClass PAIR = eINSTANCE.getPair(); + + /** + * The meta object literal for the 'Key' attribute feature. + * + * @generated + */ + EAttribute PAIR__KEY = eINSTANCE.getPair_Key(); + + /** + * The meta object literal for the 'Value' attribute feature. + * + * @generated + */ + EAttribute PAIR__VALUE = eINSTANCE.getPair_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.tm.discovery.model.impl.ServiceImpl Service}' class. + * + * @see org.eclipse.tm.discovery.model.impl.ServiceImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getService() + * @generated + */ + EClass SERVICE = eINSTANCE.getService(); + + /** + * The meta object literal for the 'Pair' containment reference list feature. + * + * @generated + */ + EReference SERVICE__PAIR = eINSTANCE.getService_Pair(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute SERVICE__NAME = eINSTANCE.getService_Name(); + + /** + * The meta object literal for the '{@link org.eclipse.tm.discovery.model.impl.ServiceTypeImpl Service Type}' class. + * + * @see org.eclipse.tm.discovery.model.impl.ServiceTypeImpl + * @see org.eclipse.tm.discovery.model.impl.ModelPackageImpl#getServiceType() + * @generated + */ + EClass SERVICE_TYPE = eINSTANCE.getServiceType(); + + /** + * The meta object literal for the 'Service' containment reference list feature. + * + * @generated + */ + EReference SERVICE_TYPE__SERVICE = eINSTANCE.getServiceType_Service(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute SERVICE_TYPE__NAME = eINSTANCE.getServiceType_Name(); + + } + +} //ModelPackage diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Network.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Network.java new file mode 100644 index 00000000000..e241066a546 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Network.java @@ -0,0 +1,46 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Network'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.tm.discovery.model.Network#getDevice Device}
  • + *
+ *

+ * + * @see org.eclipse.tm.discovery.model.ModelPackage#getNetwork() + * @model extendedMetaData="name='Network' kind='elementOnly'" + * @generated + */ +public interface Network extends EObject { + /** + * Returns the value of the 'Device' containment reference list. + * The list contents are of type {@link org.eclipse.tm.discovery.model.Device}. + * + * @return the value of the 'Device' containment reference list. + * @see org.eclipse.tm.discovery.model.ModelPackage#getNetwork_Device() + * @model type="org.eclipse.tm.discovery.model.Device" containment="true" required="true" + * extendedMetaData="kind='element' name='Device'" + * @generated + */ + EList getDevice(); + +} // Network \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Pair.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Pair.java new file mode 100644 index 00000000000..281e67b16c3 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Pair.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Pair'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.tm.discovery.model.Pair#getKey Key}
  • + *
  • {@link org.eclipse.tm.discovery.model.Pair#getValue Value}
  • + *
+ *

+ * + * @see org.eclipse.tm.discovery.model.ModelPackage#getPair() + * @model extendedMetaData="name='Pair' kind='empty'" + * @generated + */ +public interface Pair extends EObject { + /** + * Returns the value of the 'Key' attribute. + * + * @return the value of the 'Key' attribute. + * @see #setKey(String) + * @see org.eclipse.tm.discovery.model.ModelPackage#getPair_Key() + * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" + * extendedMetaData="kind='attribute' name='key'" + * @generated + */ + String getKey(); + + /** + * Sets the value of the '{@link org.eclipse.tm.discovery.model.Pair#getKey Key}' attribute. + * + * @param value the new value of the 'Key' attribute. + * @see #getKey() + * @generated + */ + void setKey(String value); + + /** + * Returns the value of the 'Value' attribute. + * + * @return the value of the 'Value' attribute. + * @see #setValue(String) + * @see org.eclipse.tm.discovery.model.ModelPackage#getPair_Value() + * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" + * extendedMetaData="kind='attribute' name='value'" + * @generated + */ + String getValue(); + + /** + * Sets the value of the '{@link org.eclipse.tm.discovery.model.Pair#getValue Value}' attribute. + * + * @param value the new value of the 'Value' attribute. + * @see #getValue() + * @generated + */ + void setValue(String value); + +} // Pair \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Service.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Service.java new file mode 100644 index 00000000000..6f195488b18 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/Service.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Service'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.tm.discovery.model.Service#getPair Pair}
  • + *
  • {@link org.eclipse.tm.discovery.model.Service#getName Name}
  • + *
+ *

+ * + * @see org.eclipse.tm.discovery.model.ModelPackage#getService() + * @model extendedMetaData="name='Service' kind='elementOnly'" + * @generated + */ +public interface Service extends EObject { + /** + * Returns the value of the 'Pair' containment reference list. + * The list contents are of type {@link org.eclipse.tm.discovery.model.Pair}. + * + * @return the value of the 'Pair' containment reference list. + * @see org.eclipse.tm.discovery.model.ModelPackage#getService_Pair() + * @model type="org.eclipse.tm.discovery.model.Pair" containment="true" + * extendedMetaData="kind='element' name='Pair'" + * @generated + */ + EList getPair(); + + /** + * Returns the value of the 'Name' attribute. + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.tm.discovery.model.ModelPackage#getService_Name() + * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" + * extendedMetaData="kind='attribute' name='name'" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.tm.discovery.model.Service#getName Name}' attribute. + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // Service \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ServiceType.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ServiceType.java new file mode 100644 index 00000000000..dd32a908c49 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/ServiceType.java @@ -0,0 +1,68 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Service Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.eclipse.tm.discovery.model.ServiceType#getService Service}
  • + *
  • {@link org.eclipse.tm.discovery.model.ServiceType#getName Name}
  • + *
+ *

+ * + * @see org.eclipse.tm.discovery.model.ModelPackage#getServiceType() + * @model extendedMetaData="name='ServiceType' kind='elementOnly'" + * @generated + */ +public interface ServiceType extends EObject { + /** + * Returns the value of the 'Service' containment reference list. + * The list contents are of type {@link org.eclipse.tm.discovery.model.Service}. + * + * @return the value of the 'Service' containment reference list. + * @see org.eclipse.tm.discovery.model.ModelPackage#getServiceType_Service() + * @model type="org.eclipse.tm.discovery.model.Service" containment="true" required="true" + * extendedMetaData="kind='element' name='Service'" + * @generated + */ + EList getService(); + + /** + * Returns the value of the 'Name' attribute. + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.tm.discovery.model.ModelPackage#getServiceType_Name() + * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" + * extendedMetaData="kind='attribute' name='name'" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.tm.discovery.model.ServiceType#getName Name}' attribute. + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // ServiceType \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/DeviceImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/DeviceImpl.java new file mode 100644 index 00000000000..12fd1a7a213 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/DeviceImpl.java @@ -0,0 +1,258 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.tm.discovery.model.Device; +import org.eclipse.tm.discovery.model.ModelPackage; +import org.eclipse.tm.discovery.model.ServiceType; + +/** + * + * An implementation of the model object 'Device'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.tm.discovery.model.impl.DeviceImpl#getServiceType Service Type}
  • + *
  • {@link org.eclipse.tm.discovery.model.impl.DeviceImpl#getAddress Address}
  • + *
  • {@link org.eclipse.tm.discovery.model.impl.DeviceImpl#getName Name}
  • + *
+ *

+ * + * @generated + */ +public class DeviceImpl extends EObjectImpl implements Device { + /** + * The cached value of the '{@link #getServiceType() Service Type}' containment reference list. + * + * @see #getServiceType() + * @generated + * @ordered + */ + protected EList serviceType = null; + + /** + * The default value of the '{@link #getAddress() Address}' attribute. + * + * @see #getAddress() + * @generated + * @ordered + */ + protected static final String ADDRESS_EDEFAULT = null; + + /** + * The cached value of the '{@link #getAddress() Address}' attribute. + * + * @see #getAddress() + * @generated + * @ordered + */ + protected String address = ADDRESS_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * @generated + */ + protected DeviceImpl() { + super(); + } + + /** + * + * @generated + */ + protected EClass eStaticClass() { + return ModelPackage.Literals.DEVICE; + } + + /** + * + * @generated + */ + public EList getServiceType() { + if (serviceType == null) { + serviceType = new EObjectContainmentEList(ServiceType.class, this, ModelPackage.DEVICE__SERVICE_TYPE); + } + return serviceType; + } + + /** + * + * @generated + */ + public String getAddress() { + return address; + } + + /** + * + * @generated + */ + public void setAddress(String newAddress) { + String oldAddress = address; + address = newAddress; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DEVICE__ADDRESS, oldAddress, address)); + } + + /** + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DEVICE__NAME, oldName, name)); + } + + /** + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ModelPackage.DEVICE__SERVICE_TYPE: + return ((InternalEList)getServiceType()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ModelPackage.DEVICE__SERVICE_TYPE: + return getServiceType(); + case ModelPackage.DEVICE__ADDRESS: + return getAddress(); + case ModelPackage.DEVICE__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * @generated + */ + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ModelPackage.DEVICE__SERVICE_TYPE: + getServiceType().clear(); + getServiceType().addAll((Collection)newValue); + return; + case ModelPackage.DEVICE__ADDRESS: + setAddress((String)newValue); + return; + case ModelPackage.DEVICE__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * @generated + */ + public void eUnset(int featureID) { + switch (featureID) { + case ModelPackage.DEVICE__SERVICE_TYPE: + getServiceType().clear(); + return; + case ModelPackage.DEVICE__ADDRESS: + setAddress(ADDRESS_EDEFAULT); + return; + case ModelPackage.DEVICE__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * @generated + */ + public boolean eIsSet(int featureID) { + switch (featureID) { + case ModelPackage.DEVICE__SERVICE_TYPE: + return serviceType != null && !serviceType.isEmpty(); + case ModelPackage.DEVICE__ADDRESS: + return ADDRESS_EDEFAULT == null ? address != null : !ADDRESS_EDEFAULT.equals(address); + case ModelPackage.DEVICE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * @generated + */ + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (address: "); + result.append(address); + result.append(", name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //DeviceImpl \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelFactoryImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelFactoryImpl.java new file mode 100644 index 00000000000..9771bd7f670 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelFactoryImpl.java @@ -0,0 +1,135 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.tm.discovery.model.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class ModelFactoryImpl extends EFactoryImpl implements ModelFactory { + /** + * Creates the default factory implementation. + * + * @generated + */ + public static ModelFactory init() { + try { + ModelFactory theModelFactory = (ModelFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/tm/discovery/model"); + if (theModelFactory != null) { + return theModelFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new ModelFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * @generated + */ + public ModelFactoryImpl() { + super(); + } + + /** + * + * @generated + */ + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case ModelPackage.DEVICE: return createDevice(); + case ModelPackage.NETWORK: return createNetwork(); + case ModelPackage.PAIR: return createPair(); + case ModelPackage.SERVICE: return createService(); + case ModelPackage.SERVICE_TYPE: return createServiceType(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * @generated + */ + public Device createDevice() { + DeviceImpl device = new DeviceImpl(); + return device; + } + + /** + * + * @generated + */ + public Network createNetwork() { + NetworkImpl network = new NetworkImpl(); + return network; + } + + /** + * + * @generated + */ + public Pair createPair() { + PairImpl pair = new PairImpl(); + return pair; + } + + /** + * + * @generated + */ + public Service createService() { + ServiceImpl service = new ServiceImpl(); + return service; + } + + /** + * + * @generated + */ + public ServiceType createServiceType() { + ServiceTypeImpl serviceType = new ServiceTypeImpl(); + return serviceType; + } + + /** + * + * @generated + */ + public ModelPackage getModelPackage() { + return (ModelPackage)getEPackage(); + } + + /** + * + * @deprecated + * @generated + */ + public static ModelPackage getPackage() { + return ModelPackage.eINSTANCE; + } + +} //ModelFactoryImpl diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelPackageImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelPackageImpl.java new file mode 100644 index 00000000000..18fe3efad77 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ModelPackageImpl.java @@ -0,0 +1,470 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.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.type.XMLTypePackage; + +import org.eclipse.tm.discovery.model.Device; +import org.eclipse.tm.discovery.model.ModelFactory; +import org.eclipse.tm.discovery.model.ModelPackage; +import org.eclipse.tm.discovery.model.Network; +import org.eclipse.tm.discovery.model.Pair; +import org.eclipse.tm.discovery.model.Service; +import org.eclipse.tm.discovery.model.ServiceType; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class ModelPackageImpl extends EPackageImpl implements ModelPackage { + /** + * + * @generated + */ + private EClass deviceEClass = null; + + /** + * + * @generated + */ + private EClass networkEClass = null; + + /** + * + * @generated + */ + private EClass pairEClass = null; + + /** + * + * @generated + */ + private EClass serviceEClass = null; + + /** + * + * @generated + */ + private EClass serviceTypeEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

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. + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.tm.discovery.model.ModelPackage#eNS_URI + * @see #init() + * @generated + */ + private ModelPackageImpl() { + super(eNS_URI, ModelFactory.eINSTANCE); + } + + /** + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ModelPackage init() { + if (isInited) return (ModelPackage)EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI); + + // Obtain or create and register package + ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ModelPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + XMLTypePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theModelPackage.createPackageContents(); + + // Initialize created meta-data + theModelPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theModelPackage.freeze(); + + return theModelPackage; + } + + /** + * + * @generated + */ + public EClass getDevice() { + return deviceEClass; + } + + /** + * + * @generated + */ + public EReference getDevice_ServiceType() { + return (EReference)deviceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * @generated + */ + public EAttribute getDevice_Address() { + return (EAttribute)deviceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * @generated + */ + public EAttribute getDevice_Name() { + return (EAttribute)deviceEClass.getEStructuralFeatures().get(2); + } + + /** + * + * @generated + */ + public EClass getNetwork() { + return networkEClass; + } + + /** + * + * @generated + */ + public EReference getNetwork_Device() { + return (EReference)networkEClass.getEStructuralFeatures().get(0); + } + + /** + * + * @generated + */ + public EClass getPair() { + return pairEClass; + } + + /** + * + * @generated + */ + public EAttribute getPair_Key() { + return (EAttribute)pairEClass.getEStructuralFeatures().get(0); + } + + /** + * + * @generated + */ + public EAttribute getPair_Value() { + return (EAttribute)pairEClass.getEStructuralFeatures().get(1); + } + + /** + * + * @generated + */ + public EClass getService() { + return serviceEClass; + } + + /** + * + * @generated + */ + public EReference getService_Pair() { + return (EReference)serviceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * @generated + */ + public EAttribute getService_Name() { + return (EAttribute)serviceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * @generated + */ + public EClass getServiceType() { + return serviceTypeEClass; + } + + /** + * + * @generated + */ + public EReference getServiceType_Service() { + return (EReference)serviceTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * @generated + */ + public EAttribute getServiceType_Name() { + return (EAttribute)serviceTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * @generated + */ + public ModelFactory getModelFactory() { + return (ModelFactory)getEFactoryInstance(); + } + + /** + * + * @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. + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + deviceEClass = createEClass(DEVICE); + createEReference(deviceEClass, DEVICE__SERVICE_TYPE); + createEAttribute(deviceEClass, DEVICE__ADDRESS); + createEAttribute(deviceEClass, DEVICE__NAME); + + networkEClass = createEClass(NETWORK); + createEReference(networkEClass, NETWORK__DEVICE); + + pairEClass = createEClass(PAIR); + createEAttribute(pairEClass, PAIR__KEY); + createEAttribute(pairEClass, PAIR__VALUE); + + serviceEClass = createEClass(SERVICE); + createEReference(serviceEClass, SERVICE__PAIR); + createEAttribute(serviceEClass, SERVICE__NAME); + + serviceTypeEClass = createEClass(SERVICE_TYPE); + createEReference(serviceTypeEClass, SERVICE_TYPE__SERVICE); + createEAttribute(serviceTypeEClass, SERVICE_TYPE__NAME); + } + + /** + * + * @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. + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(deviceEClass, Device.class, "Device", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getDevice_ServiceType(), this.getServiceType(), null, "serviceType", null, 1, -1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDevice_Address(), theXMLTypePackage.getString(), "address", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDevice_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(networkEClass, Network.class, "Network", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getNetwork_Device(), this.getDevice(), null, "device", null, 1, -1, Network.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(pairEClass, Pair.class, "Pair", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPair_Key(), theXMLTypePackage.getString(), "key", null, 0, 1, Pair.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPair_Value(), theXMLTypePackage.getString(), "value", null, 0, 1, Pair.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(serviceEClass, Service.class, "Service", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getService_Pair(), this.getPair(), null, "pair", null, 0, -1, Service.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getService_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, Service.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(serviceTypeEClass, ServiceType.class, "ServiceType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getServiceType_Service(), this.getService(), null, "service", null, 1, -1, ServiceType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getServiceType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, ServiceType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (deviceEClass, + source, + new String[] { + "name", "Device", + "kind", "elementOnly" + }); + addAnnotation + (getDevice_ServiceType(), + source, + new String[] { + "kind", "element", + "name", "ServiceType" + }); + addAnnotation + (getDevice_Address(), + source, + new String[] { + "kind", "attribute", + "name", "address" + }); + addAnnotation + (getDevice_Name(), + source, + new String[] { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (networkEClass, + source, + new String[] { + "name", "Network", + "kind", "elementOnly" + }); + addAnnotation + (getNetwork_Device(), + source, + new String[] { + "kind", "element", + "name", "Device" + }); + addAnnotation + (pairEClass, + source, + new String[] { + "name", "Pair", + "kind", "empty" + }); + addAnnotation + (getPair_Key(), + source, + new String[] { + "kind", "attribute", + "name", "key" + }); + addAnnotation + (getPair_Value(), + source, + new String[] { + "kind", "attribute", + "name", "value" + }); + addAnnotation + (serviceEClass, + source, + new String[] { + "name", "Service", + "kind", "elementOnly" + }); + addAnnotation + (getService_Pair(), + source, + new String[] { + "kind", "element", + "name", "Pair" + }); + addAnnotation + (getService_Name(), + source, + new String[] { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (serviceTypeEClass, + source, + new String[] { + "name", "ServiceType", + "kind", "elementOnly" + }); + addAnnotation + (getServiceType_Service(), + source, + new String[] { + "kind", "element", + "name", "Service" + }); + addAnnotation + (getServiceType_Name(), + source, + new String[] { + "kind", "attribute", + "name", "name" + }); + } + +} //ModelPackageImpl diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/NetworkImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/NetworkImpl.java new file mode 100644 index 00000000000..259faf3a568 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/NetworkImpl.java @@ -0,0 +1,144 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.tm.discovery.model.Device; +import org.eclipse.tm.discovery.model.ModelPackage; +import org.eclipse.tm.discovery.model.Network; + +/** + * + * An implementation of the model object 'Network'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.tm.discovery.model.impl.NetworkImpl#getDevice Device}
  • + *
+ *

+ * + * @generated + */ +public class NetworkImpl extends EObjectImpl implements Network { + /** + * The cached value of the '{@link #getDevice() Device}' containment reference list. + * + * @see #getDevice() + * @generated + * @ordered + */ + protected EList device = null; + + /** + * + * @generated + */ + protected NetworkImpl() { + super(); + } + + /** + * + * @generated + */ + protected EClass eStaticClass() { + return ModelPackage.Literals.NETWORK; + } + + /** + * + * @generated + */ + public EList getDevice() { + if (device == null) { + device = new EObjectContainmentEList(Device.class, this, ModelPackage.NETWORK__DEVICE); + } + return device; + } + + /** + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ModelPackage.NETWORK__DEVICE: + return ((InternalEList)getDevice()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ModelPackage.NETWORK__DEVICE: + return getDevice(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * @generated + */ + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ModelPackage.NETWORK__DEVICE: + getDevice().clear(); + getDevice().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * @generated + */ + public void eUnset(int featureID) { + switch (featureID) { + case ModelPackage.NETWORK__DEVICE: + getDevice().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * @generated + */ + public boolean eIsSet(int featureID) { + switch (featureID) { + case ModelPackage.NETWORK__DEVICE: + return device != null && !device.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //NetworkImpl \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/PairImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/PairImpl.java new file mode 100644 index 00000000000..cc0e6e323dd --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/PairImpl.java @@ -0,0 +1,204 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.tm.discovery.model.ModelPackage; +import org.eclipse.tm.discovery.model.Pair; + +/** + * + * An implementation of the model object 'Pair'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.tm.discovery.model.impl.PairImpl#getKey Key}
  • + *
  • {@link org.eclipse.tm.discovery.model.impl.PairImpl#getValue Value}
  • + *
+ *

+ * + * @generated + */ +public class PairImpl extends EObjectImpl implements Pair { + /** + * The default value of the '{@link #getKey() Key}' attribute. + * + * @see #getKey() + * @generated + * @ordered + */ + protected static final String KEY_EDEFAULT = null; + + /** + * The cached value of the '{@link #getKey() Key}' attribute. + * + * @see #getKey() + * @generated + * @ordered + */ + protected String key = KEY_EDEFAULT; + + /** + * The default value of the '{@link #getValue() Value}' attribute. + * + * @see #getValue() + * @generated + * @ordered + */ + protected static final String VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getValue() Value}' attribute. + * + * @see #getValue() + * @generated + * @ordered + */ + protected String value = VALUE_EDEFAULT; + + /** + * + * @generated + */ + protected PairImpl() { + super(); + } + + /** + * + * @generated + */ + protected EClass eStaticClass() { + return ModelPackage.Literals.PAIR; + } + + /** + * + * @generated + */ + public String getKey() { + return key; + } + + /** + * + * @generated + */ + public void setKey(String newKey) { + String oldKey = key; + key = newKey; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PAIR__KEY, oldKey, key)); + } + + /** + * + * @generated + */ + public String getValue() { + return value; + } + + /** + * + * @generated + */ + public void setValue(String newValue) { + String oldValue = value; + value = newValue; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PAIR__VALUE, oldValue, value)); + } + + /** + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ModelPackage.PAIR__KEY: + return getKey(); + case ModelPackage.PAIR__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * @generated + */ + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ModelPackage.PAIR__KEY: + setKey((String)newValue); + return; + case ModelPackage.PAIR__VALUE: + setValue((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * @generated + */ + public void eUnset(int featureID) { + switch (featureID) { + case ModelPackage.PAIR__KEY: + setKey(KEY_EDEFAULT); + return; + case ModelPackage.PAIR__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * @generated + */ + public boolean eIsSet(int featureID) { + switch (featureID) { + case ModelPackage.PAIR__KEY: + return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key); + case ModelPackage.PAIR__VALUE: + return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); + } + return super.eIsSet(featureID); + } + + /** + * + * @generated + */ + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (key: "); + result.append(key); + result.append(", value: "); + result.append(value); + result.append(')'); + return result.toString(); + } + +} //PairImpl \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceImpl.java new file mode 100644 index 00000000000..b75b43ddf21 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceImpl.java @@ -0,0 +1,208 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.tm.discovery.model.ModelPackage; +import org.eclipse.tm.discovery.model.Pair; +import org.eclipse.tm.discovery.model.Service; + +/** + * + * An implementation of the model object 'Service'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.tm.discovery.model.impl.ServiceImpl#getPair Pair}
  • + *
  • {@link org.eclipse.tm.discovery.model.impl.ServiceImpl#getName Name}
  • + *
+ *

+ * + * @generated + */ +public class ServiceImpl extends EObjectImpl implements Service { + /** + * The cached value of the '{@link #getPair() Pair}' containment reference list. + * + * @see #getPair() + * @generated + * @ordered + */ + protected EList pair = null; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * @generated + */ + protected ServiceImpl() { + super(); + } + + /** + * + * @generated + */ + protected EClass eStaticClass() { + return ModelPackage.Literals.SERVICE; + } + + /** + * + * @generated + */ + public EList getPair() { + if (pair == null) { + pair = new EObjectContainmentEList(Pair.class, this, ModelPackage.SERVICE__PAIR); + } + return pair; + } + + /** + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.SERVICE__NAME, oldName, name)); + } + + /** + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ModelPackage.SERVICE__PAIR: + return ((InternalEList)getPair()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ModelPackage.SERVICE__PAIR: + return getPair(); + case ModelPackage.SERVICE__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * @generated + */ + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ModelPackage.SERVICE__PAIR: + getPair().clear(); + getPair().addAll((Collection)newValue); + return; + case ModelPackage.SERVICE__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * @generated + */ + public void eUnset(int featureID) { + switch (featureID) { + case ModelPackage.SERVICE__PAIR: + getPair().clear(); + return; + case ModelPackage.SERVICE__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * @generated + */ + public boolean eIsSet(int featureID) { + switch (featureID) { + case ModelPackage.SERVICE__PAIR: + return pair != null && !pair.isEmpty(); + case ModelPackage.SERVICE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * @generated + */ + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //ServiceImpl \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceTypeImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceTypeImpl.java new file mode 100644 index 00000000000..de6068df36a --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/impl/ServiceTypeImpl.java @@ -0,0 +1,208 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.tm.discovery.model.ModelPackage; +import org.eclipse.tm.discovery.model.Service; +import org.eclipse.tm.discovery.model.ServiceType; + +/** + * + * An implementation of the model object 'Service Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.eclipse.tm.discovery.model.impl.ServiceTypeImpl#getService Service}
  • + *
  • {@link org.eclipse.tm.discovery.model.impl.ServiceTypeImpl#getName Name}
  • + *
+ *

+ * + * @generated + */ +public class ServiceTypeImpl extends EObjectImpl implements ServiceType { + /** + * The cached value of the '{@link #getService() Service}' containment reference list. + * + * @see #getService() + * @generated + * @ordered + */ + protected EList service = null; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * @generated + */ + protected ServiceTypeImpl() { + super(); + } + + /** + * + * @generated + */ + protected EClass eStaticClass() { + return ModelPackage.Literals.SERVICE_TYPE; + } + + /** + * + * @generated + */ + public EList getService() { + if (service == null) { + service = new EObjectContainmentEList(Service.class, this, ModelPackage.SERVICE_TYPE__SERVICE); + } + return service; + } + + /** + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.SERVICE_TYPE__NAME, oldName, name)); + } + + /** + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ModelPackage.SERVICE_TYPE__SERVICE: + return ((InternalEList)getService()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ModelPackage.SERVICE_TYPE__SERVICE: + return getService(); + case ModelPackage.SERVICE_TYPE__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * @generated + */ + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ModelPackage.SERVICE_TYPE__SERVICE: + getService().clear(); + getService().addAll((Collection)newValue); + return; + case ModelPackage.SERVICE_TYPE__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * @generated + */ + public void eUnset(int featureID) { + switch (featureID) { + case ModelPackage.SERVICE_TYPE__SERVICE: + getService().clear(); + return; + case ModelPackage.SERVICE_TYPE__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * @generated + */ + public boolean eIsSet(int featureID) { + switch (featureID) { + case ModelPackage.SERVICE_TYPE__SERVICE: + return service != null && !service.isEmpty(); + case ModelPackage.SERVICE_TYPE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * @generated + */ + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //ServiceTypeImpl \ No newline at end of file diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelAdapterFactory.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelAdapterFactory.java new file mode 100644 index 00000000000..f8d10864cf7 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelAdapterFactory.java @@ -0,0 +1,188 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.tm.discovery.model.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.eclipse.tm.discovery.model.ModelPackage + * @generated + */ +public class ModelAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * @generated + */ + protected static ModelPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * @generated + */ + public ModelAdapterFactory() { + if (modelPackage == null) { + modelPackage = ModelPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch the delegates to the createXXX methods. + * + * @generated + */ + protected ModelSwitch modelSwitch = + new ModelSwitch() { + public Object caseDevice(Device object) { + return createDeviceAdapter(); + } + public Object caseNetwork(Network object) { + return createNetworkAdapter(); + } + public Object casePair(Pair object) { + return createPairAdapter(); + } + public Object caseService(Service object) { + return createServiceAdapter(); + } + public Object caseServiceType(ServiceType object) { + return createServiceTypeAdapter(); + } + public Object defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + public Adapter createAdapter(Notifier target) { + return (Adapter)modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.tm.discovery.model.Device Device}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.tm.discovery.model.Device + * @generated + */ + public Adapter createDeviceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.tm.discovery.model.Network Network}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.tm.discovery.model.Network + * @generated + */ + public Adapter createNetworkAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.tm.discovery.model.Pair Pair}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.tm.discovery.model.Pair + * @generated + */ + public Adapter createPairAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.tm.discovery.model.Service Service}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.tm.discovery.model.Service + * @generated + */ + public Adapter createServiceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.tm.discovery.model.ServiceType Service Type}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.tm.discovery.model.ServiceType + * @generated + */ + public Adapter createServiceTypeAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //ModelAdapterFactory diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceFactoryImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceFactoryImpl.java new file mode 100644 index 00000000000..5cb9f7d278c --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceFactoryImpl.java @@ -0,0 +1,57 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.util; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.resource.Resource; + +import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; + +import org.eclipse.emf.ecore.xmi.XMLResource; + +/** + * + * The Resource Factory associated with the package. + * + * @see org.eclipse.tm.discovery.model.util.ModelResourceImpl + * @generated + */ +public class ModelResourceFactoryImpl extends ResourceFactoryImpl { + /** + * Creates an instance of the resource factory. + * + * @generated + */ + public ModelResourceFactoryImpl() { + super(); + } + + /** + * Creates an instance of the resource. + * + * @generated + */ + public Resource createResource(URI uri) { + XMLResource result = new ModelResourceImpl(uri); + result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); + result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); + + result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); + result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); + return result; + } + +} //ModelResourceFactoryImpl diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceImpl.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceImpl.java new file mode 100644 index 00000000000..24f133cd61b --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelResourceImpl.java @@ -0,0 +1,35 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.util; + +import org.eclipse.emf.common.util.URI; + +import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; + +/** + * + * The Resource associated with the package. + * + * @see org.eclipse.tm.discovery.model.util.ModelResourceFactoryImpl + * @generated + */ +public class ModelResourceImpl extends XMLResourceImpl { + /** + * Creates an instance of the resource. + * + * @param uri the URI of the new resource. + * @generated + */ + public ModelResourceImpl(URI uri) { + super(uri); + } + +} //ModelResourceImpl diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelSwitch.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelSwitch.java new file mode 100644 index 00000000000..378f3420239 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelSwitch.java @@ -0,0 +1,213 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.tm.discovery.model.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.eclipse.tm.discovery.model.ModelPackage + * @generated + */ +public class ModelSwitch { + /** + * The cached model package + * + * @generated + */ + protected static ModelPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * @generated + */ + public ModelSwitch() { + if (modelPackage == null) { + modelPackage = ModelPackage.eINSTANCE; + } + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + public Object doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + protected Object doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch((EClass)eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + protected Object doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case ModelPackage.DEVICE: { + Device device = (Device)theEObject; + Object result = caseDevice(device); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ModelPackage.NETWORK: { + Network network = (Network)theEObject; + Object result = caseNetwork(network); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ModelPackage.PAIR: { + Pair pair = (Pair)theEObject; + Object result = casePair(pair); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ModelPackage.SERVICE: { + Service service = (Service)theEObject; + Object result = caseService(service); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ModelPackage.SERVICE_TYPE: { + ServiceType serviceType = (ServiceType)theEObject; + Object result = caseServiceType(serviceType); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpretting the object as an instance of 'Device'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Device'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseDevice(Device object) { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Network'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Network'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseNetwork(Network object) { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Pair'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Pair'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object casePair(Pair object) { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Service'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Service'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseService(Service object) { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'Service Type'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'Service Type'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseServiceType(ServiceType object) { + return null; + } + + /** + * Returns the result of interpretting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public Object defaultCase(EObject object) { + return null; + } + +} //ModelSwitch diff --git a/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelXMLProcessor.java b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelXMLProcessor.java new file mode 100644 index 00000000000..4202e9883b5 --- /dev/null +++ b/discovery/org.eclipse.tm.discovery.model/src/org/eclipse/tm/discovery/model/util/ModelXMLProcessor.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * Copyright (c) 2006 Symbian Software Ltd. 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: + * Javier Montalvo Orús (Symbian) - initial API and implementation + ********************************************************************************/ + +package org.eclipse.tm.discovery.model.util; + +import java.util.Map; + +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.xmi.util.XMLProcessor; + +import org.eclipse.tm.discovery.model.ModelPackage; + +/** + * This class contains helper methods to serialize and deserialize XML documents + * + * @generated + */ +public class ModelXMLProcessor extends XMLProcessor { + /** + * Public constructor to instantiate the helper. + * + * @generated + */ + public ModelXMLProcessor() { + super((EPackage.Registry.INSTANCE)); + ModelPackage.eINSTANCE.eClass(); + } + + /** + * Register for "*" and "xml" file extensions the ModelResourceFactoryImpl factory. + * + * @generated + */ + protected Map getRegistrations() { + if (registrations == null) { + super.getRegistrations(); + registrations.put(XML_EXTENSION, new ModelResourceFactoryImpl()); + registrations.put(STAR_EXTENSION, new ModelResourceFactoryImpl()); + } + return registrations; + } + +} //ModelXMLProcessor