Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 149767 Details for
Bug 255469
Investigate support for dynamic EOperation call API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
streamlined patch
255469.patch (text/plain), 35.65 KB, created by
Kenn Hussey
on 2009-10-16 11:44:35 EDT
(
hide
)
Description:
streamlined patch
Filename:
MIME Type:
Creator:
Kenn Hussey
Created:
2009-10-16 11:44:35 EDT
Size:
35.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.ecore >Index: src/org/eclipse/emf/ecore/EObject.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EObject.java,v >retrieving revision 1.11 >diff -u -r1.11 EObject.java >--- src/org/eclipse/emf/ecore/EObject.java 14 Jun 2007 18:32:46 -0000 1.11 >+++ src/org/eclipse/emf/ecore/EObject.java 16 Oct 2009 15:42:07 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2002-2006 IBM Corporation and others. >+ * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -17,6 +18,8 @@ > package org.eclipse.emf.ecore; > > >+import java.lang.reflect.InvocationTargetException; >+ > import org.eclipse.emf.common.notify.Notifier; > import org.eclipse.emf.common.util.EList; > import org.eclipse.emf.common.util.TreeIterator; >@@ -427,4 +430,28 @@ > */ > void eUnset(EStructuralFeature feature); > >+ /** >+ * <!-- begin-user-doc --> >+ * <p> >+ * Calls the specified operation of the object. If the operation has >+ * parameters, then corresponding arguments must be supplied. There are no >+ * optional parameters in Ecore operations. >+ * </p><p> >+ * If the operation is a void operation, then on successful execution, the >+ * result of this call is <code>null</code>. Otherwise, if the operation is >+ * {@linkplain ETypedElement#isMany() nulti-valued}, then an {@link EList} >+ * is returned (possibly empty). If single-valued, then an instance of the >+ * operation's {@linkplain ETypedElement#getEType() type} is returned, or >+ * possibly <code>null</code>. >+ * </p><p> >+ * If the called operation fails with an >+ * {@linkplain EOperation#getEExceptions() exception}, then it is re-thrown, >+ * wrapped in an {@link InvocationTargetException}. >+ * </p> >+ * <!-- end-user-doc --> >+ * @model exceptions="org.eclipse.emf.ecore.EInvocationTargetException" argumentsMany="false" >+ * @generated >+ */ >+ Object eCall(EOperation operation, EList<?> arguments) throws InvocationTargetException; >+ > } >Index: src/org/eclipse/emf/ecore/EcorePackage.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EcorePackage.java,v >retrieving revision 1.16 >diff -u -r1.16 EcorePackage.java >--- src/org/eclipse/emf/ecore/EcorePackage.java 27 Apr 2008 20:26:15 -0000 1.16 >+++ src/org/eclipse/emf/ecore/EcorePackage.java 16 Oct 2009 15:42:10 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2002-2006 IBM Corporation and others. >+ * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -2389,6 +2390,16 @@ > > > /** >+ * The meta object id for the '<em>EInvocation Target Exception</em>' data type. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see java.lang.reflect.InvocationTargetException >+ * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEInvocationTargetException() >+ * @generated >+ */ >+ int EINVOCATION_TARGET_EXCEPTION = 52; >+ >+ /** > * The meta object id for the '<em>EFeature Map Entry</em>' data type. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -3877,6 +3888,17 @@ > EDataType getETreeIterator(); > > /** >+ * Returns the meta object for data type '{@link java.lang.reflect.InvocationTargetException <em>EInvocation Target Exception</em>}'. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @return the meta object for data type '<em>EInvocation Target Exception</em>'. >+ * @see java.lang.reflect.InvocationTargetException >+ * @model instanceClass="java.lang.reflect.InvocationTargetException" >+ * @generated >+ */ >+ EDataType getEInvocationTargetException(); >+ >+ /** > * Returns the meta object for data type '{@link org.eclipse.emf.ecore.util.FeatureMap.Entry <em>EFeature Map Entry</em>}'. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -5103,6 +5125,16 @@ > */ > EDataType ETREE_ITERATOR = eINSTANCE.getETreeIterator(); > >+ /** >+ * The meta object literal for the '<em>EInvocation Target Exception</em>' data type. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see java.lang.reflect.InvocationTargetException >+ * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEInvocationTargetException() >+ * @generated >+ */ >+ EDataType EINVOCATION_TARGET_EXCEPTION = eINSTANCE.getEInvocationTargetException(); >+ > } > > // Internal bootstrap uses Literals constants, so we must force initialization this inner interface first. >Index: src/org/eclipse/emf/ecore/EOperation.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/EOperation.java,v >retrieving revision 1.8 >diff -u -r1.8 EOperation.java >--- src/org/eclipse/emf/ecore/EOperation.java 12 Jun 2007 15:07:48 -0000 1.8 >+++ src/org/eclipse/emf/ecore/EOperation.java 16 Oct 2009 15:42:07 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2002-2006 IBM Corporation and others. >+ * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -17,6 +18,9 @@ > package org.eclipse.emf.ecore; > > >+import java.lang.reflect.InvocationTargetException; >+import java.util.HashMap; >+ > import org.eclipse.emf.common.util.EList; > > >@@ -126,4 +130,95 @@ > */ > EList<ETypeParameter> getETypeParameters(); > >+ /** >+ * Internal API implemented by all operations. >+ * >+ * @since 2.5 >+ */ >+ interface Internal extends EOperation, InternalEObject >+ { >+ /** >+ * A pluggable, dynamic implementation of operation behaviour. >+ */ >+ interface CallDelegate >+ { >+ /** >+ * A factory for creating call delegates. >+ */ >+ interface Factory >+ { >+ /** >+ * Creates the call delegate for the specified <tt>operation</tt>. >+ * >+ * @param operation the operation >+ * @return its call delegate >+ */ >+ CallDelegate createCallDelegate(EOperation operation); >+ >+ /** >+ * A registry of call-delegate factories. >+ */ >+ interface Registry >+ { >+ Registry INSTANCE = new Impl(); >+ >+ Factory getFactory(String key); >+ >+ void registerFactory(String key, Factory factory); >+ >+ void deregisterFactory(String key); >+ >+ class Impl extends HashMap<String, Factory> implements Registry >+ { >+ private static final long serialVersionUID = 1L; >+ >+ public Factory getFactory(String key) >+ { >+ return get(key); >+ } >+ >+ public void registerFactory(String key, Factory factory) >+ { >+ put(key, factory); >+ } >+ >+ public void deregisterFactory(String key) >+ { >+ remove(key); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Invokes the operation behaviour for the specified <tt>target</tt> >+ * object. >+ * >+ * @param target the object on which to call the operation >+ * @param arguments the arguments for the operation parameters (an >+ * empty list if the operation has no parameters) >+ * @return the operation's return result, or <code>null</code> if it is >+ * a void operation >+ * @throws InvocationTargetException in case of failure to execute the >+ * operation behaviour, usually because of an exception >+ */ >+ Object dynamicCall(InternalEObject target, EList<?> arguments) throws InvocationTargetException; >+ } >+ >+ /** >+ * Obtains the delegate for this operation. >+ * A default delegate is always available, so this should not return >+ * <code>null</code>. >+ * >+ * @return the operation delegate >+ */ >+ CallDelegate getCallDelegate(); >+ >+ /** >+ * Assigns a delegate to this operation. >+ * >+ * @param callDelegate the new operation delegate >+ */ >+ void setCallDelegate(CallDelegate callDelegate); >+ } > } //EOperation >Index: src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java,v >retrieving revision 1.16 >diff -u -r1.16 EcoreFactoryImpl.java >--- src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java 22 Dec 2008 14:24:54 -0000 1.16 >+++ src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java 16 Oct 2009 15:42:12 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2002-2006 IBM Corporation and others. >+ * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -17,6 +18,7 @@ > package org.eclipse.emf.ecore.impl; > > >+import java.lang.reflect.InvocationTargetException; > import java.math.BigDecimal; > import java.math.BigInteger; > import java.text.ParseException; >@@ -161,6 +163,8 @@ > return createEShortObjectFromString(eDataType, initialValue); > case EcorePackage.ESTRING: > return createEStringFromString(eDataType, initialValue); >+ case EcorePackage.EINVOCATION_TARGET_EXCEPTION: >+ return createEInvocationTargetExceptionFromString(eDataType, initialValue); > default: > throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); > } >@@ -222,6 +226,8 @@ > return convertEShortObjectToString(eDataType, instanceValue); > case EcorePackage.ESTRING: > return convertEStringToString(eDataType, instanceValue); >+ case EcorePackage.EINVOCATION_TARGET_EXCEPTION: >+ return convertEInvocationTargetExceptionToString(eDataType, instanceValue); > default: > throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); > } >@@ -654,6 +660,26 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated >+ */ >+ public InvocationTargetException createEInvocationTargetExceptionFromString(EDataType eDataType, String initialValue) >+ { >+ return (InvocationTargetException)super.createFromString(eDataType, initialValue); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public String convertEInvocationTargetExceptionToString(EDataType eDataType, Object instanceValue) >+ { >+ return super.convertToString(eDataType, instanceValue); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated NOT > */ > public Integer createEIntFromString(EDataType metaObject, String initialValue) >Index: src/org/eclipse/emf/ecore/impl/EOperationImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EOperationImpl.java,v >retrieving revision 1.23 >diff -u -r1.23 EOperationImpl.java >--- src/org/eclipse/emf/ecore/impl/EOperationImpl.java 16 Jan 2009 12:55:11 -0000 1.23 >+++ src/org/eclipse/emf/ecore/impl/EOperationImpl.java 16 Oct 2009 15:42:11 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2002-2007 IBM Corporation and others. >+ * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -28,6 +29,7 @@ > import org.eclipse.emf.common.notify.NotificationChain; > import org.eclipse.emf.common.notify.impl.NotificationImpl; > import org.eclipse.emf.common.util.EList; >+import org.eclipse.emf.common.util.URI; > import org.eclipse.emf.ecore.EAnnotation; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.EClassifier; >@@ -38,9 +40,11 @@ > import org.eclipse.emf.ecore.EcoreFactory; > import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.ecore.InternalEObject; >+import org.eclipse.emf.ecore.util.BasicCallDelegate; > import org.eclipse.emf.ecore.util.DelegatingEcoreEList; > import org.eclipse.emf.ecore.util.EObjectContainmentEList; > import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; >+import org.eclipse.emf.ecore.util.EcoreUtil; > // import org.eclipse.emf.ecore.util.EObjectResolvingEList; > import org.eclipse.emf.ecore.util.InternalEList; > >@@ -48,6 +52,7 @@ > /** > * <!-- begin-user-doc --> > * An implementation of the model object '<em><b>EOperation</b></em>'. >+ * @extends EOperation.Internal > * <!-- end-user-doc --> > * <p> > * The following features are implemented: >@@ -62,7 +67,7 @@ > * > * @generated > */ >-public class EOperationImpl extends ETypedElementImpl implements EOperation >+public class EOperationImpl extends ETypedElementImpl implements EOperation, EOperation.Internal > { > /** > * The cached value of the '{@link #getETypeParameters() <em>EType Parameters</em>}' containment reference list. >@@ -1007,4 +1012,36 @@ > return eDynamicIsSet(featureID); > } > >+ protected EOperation.Internal.CallDelegate callDelegate; >+ >+ public CallDelegate getCallDelegate() >+ { >+ if (callDelegate == null) >+ { >+ CallDelegate.Factory factory = null; >+ String callDelegateKey = EcoreUtil.getAnnotation(this, EcorePackage.eNS_URI, >+ "callDelegate"); >+ if (callDelegateKey != null) >+ { >+ factory = CallDelegate.Factory.Registry.INSTANCE.getFactory( >+ URI.createURI(callDelegateKey).trimFragment().trimQuery().toString()); >+ } >+ if (factory != null) >+ { >+ callDelegate = factory.createCallDelegate(this); >+ } >+ if (callDelegate == null) >+ { >+ callDelegate = new BasicCallDelegate(this); >+ } >+ } >+ >+ return callDelegate; >+ } >+ >+ public void setCallDelegate(CallDelegate callDelegate) >+ { >+ this.callDelegate = callDelegate; >+ } >+ > } >Index: src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java,v >retrieving revision 1.29 >diff -u -r1.29 EcorePackageImpl.java >--- src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java 12 May 2009 15:54:45 -0000 1.29 >+++ src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java 16 Oct 2009 15:42:13 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2002-2007 IBM Corporation and others. >+ * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -17,6 +18,7 @@ > package org.eclipse.emf.ecore.impl; > > >+import java.lang.reflect.InvocationTargetException; > import java.math.BigDecimal; > import java.math.BigInteger; > import java.util.ArrayList; >@@ -410,6 +412,13 @@ > * <!-- end-user-doc --> > * @generated > */ >+ private EDataType eInvocationTargetExceptionEDataType = null; >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > private EDataType eFeatureMapEntryEDataType = null; > > /** >@@ -1828,6 +1837,16 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public EDataType getEInvocationTargetException() >+ { >+ return eInvocationTargetExceptionEDataType; >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public EDataType getEFeatureMapEntry() > { > return eFeatureMapEntryEDataType; >@@ -2067,6 +2086,7 @@ > eShortObjectEDataType = createEDataType(ESHORT_OBJECT); > eStringEDataType = createEDataType(ESTRING); > eTreeIteratorEDataType = createEDataType(ETREE_ITERATOR); >+ eInvocationTargetExceptionEDataType = createEDataType(EINVOCATION_TARGET_EXCEPTION); > } > > /** >@@ -2275,6 +2295,14 @@ > op = addEOperation(eObjectEClass, null, "eUnset", 0, 1, IS_UNIQUE, IS_ORDERED); > addEParameter(op, this.getEStructuralFeature(), "feature", 0, 1, IS_UNIQUE, IS_ORDERED); > >+ op = addEOperation(eObjectEClass, this.getEJavaObject(), "eCall", 0, 1, IS_UNIQUE, IS_ORDERED); >+ addEParameter(op, this.getEOperation(), "operation", 0, 1, IS_UNIQUE, IS_ORDERED); >+ g1 = createEGenericType(ecorePackage.getEEList()); >+ g2 = createEGenericType(); >+ g1.getETypeArguments().add(g2); >+ addEParameter(op, g1, "arguments", 0, 1, IS_UNIQUE, IS_ORDERED); >+ addEException(op, this.getEInvocationTargetException()); >+ > initEClass(eOperationEClass, EOperation.class, "EOperation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); > initEReference(getEOperation_EContainingClass(), this.getEClass(), this.getEClass_EOperations(), "eContainingClass", null, 0, 1, EOperation.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEReference(getEOperation_ETypeParameters(), this.getETypeParameter(), null, "eTypeParameters", null, 0, -1, EOperation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >@@ -2380,6 +2408,7 @@ > initEDataType(eShortObjectEDataType, Short.class, "EShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); > initEDataType(eStringEDataType, String.class, "EString", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); > initEDataType(eTreeIteratorEDataType, TreeIterator.class, "ETreeIterator", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); >+ initEDataType(eInvocationTargetExceptionEDataType, InvocationTargetException.class, "EInvocationTargetException", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); > > // Create resource > createResource(eNS_URI); >Index: src/org/eclipse/emf/ecore/impl/BasicEObjectImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/BasicEObjectImpl.java,v >retrieving revision 1.39 >diff -u -r1.39 BasicEObjectImpl.java >--- src/org/eclipse/emf/ecore/impl/BasicEObjectImpl.java 16 Jan 2009 12:55:11 -0000 1.39 >+++ src/org/eclipse/emf/ecore/impl/BasicEObjectImpl.java 16 Oct 2009 15:42:11 -0000 >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -17,6 +18,7 @@ > package org.eclipse.emf.ecore.impl; > > >+import java.lang.reflect.InvocationTargetException; > import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; >@@ -36,6 +38,7 @@ > import org.eclipse.emf.ecore.EDataType; > import org.eclipse.emf.ecore.EFactory; > import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EOperation; > import org.eclipse.emf.ecore.EReference; > import org.eclipse.emf.ecore.EStructuralFeature; > import org.eclipse.emf.ecore.ETypedElement; >@@ -1995,6 +1998,12 @@ > } > } > >+ public Object eCall(EOperation operation, EList<?> arguments) throws InvocationTargetException >+ { >+ return ((EOperation.Internal) operation).getCallDelegate().dynamicCall(this, >+ arguments); >+ } >+ > @Override > public String toString() > { >Index: model/Ecore.ecore >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/model/Ecore.ecore,v >retrieving revision 1.16 >diff -u -r1.16 Ecore.ecore >--- model/Ecore.ecore 22 Dec 2008 19:51:05 -0000 1.16 >+++ model/Ecore.ecore 16 Oct 2009 15:42:06 -0000 >@@ -221,6 +221,14 @@ > <eOperations name="eUnset"> > <eParameters name="feature" eType="#//EStructuralFeature"/> > </eOperations> >+ <eOperations name="eCall" eType="#//EJavaObject" eExceptions="#//EInvocationTargetException"> >+ <eParameters name="operation" eType="#//EOperation"/> >+ <eParameters name="arguments"> >+ <eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList"> >+ <eTypeArguments/> >+ </eGenericType> >+ </eParameters> >+ </eOperations> > </eClassifiers> > <eClassifiers xsi:type="ecore:EClass" name="EOperation" eSuperTypes="#//ETypedElement"> > <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> >@@ -495,4 +503,5 @@ > <eStructuralFeatures xsi:type="ecore:EReference" name="eBounds" upperBound="-1" > eType="#//EGenericType" containment="true" resolveProxies="false"/> > </eClassifiers> >+ <eClassifiers xsi:type="ecore:EDataType" name="EInvocationTargetException" instanceClassName="java.lang.reflect.InvocationTargetException"/> > </ecore:EPackage> >Index: model/EcoreAnnotations.ecorediag >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/model/EcoreAnnotations.ecorediag,v >retrieving revision 1.2 >diff -u -r1.2 EcoreAnnotations.ecorediag >--- model/EcoreAnnotations.ecorediag 14 Dec 2008 16:44:30 -0000 1.2 >+++ model/EcoreAnnotations.ecorediag 16 Oct 2009 15:42:07 -0000 >@@ -14,7 +14,7 @@ > </children> > <styles xmi:type="notation:ShapeStyle" xmi:id="_sFlvLT-OEd2DT6rVsxRmdQ" fontName="Microsoft Sans Serif" fontHeight="10" fillColor="13761016" lineColor="0"/> > <element xmi:type="ecore:EClass" href="Ecore.ecore#//EAnnotation"/> >- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sFlvLj-OEd2DT6rVsxRmdQ" x="114" y="312"/> >+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sFlvLj-OEd2DT6rVsxRmdQ" x="108" y="333"/> > </children> > <children xmi:type="notation:Node" xmi:id="_sFlvLz-OEd2DT6rVsxRmdQ" type="1001"> > <children xmi:type="notation:Node" xmi:id="_sFlvMD-OEd2DT6rVsxRmdQ" type="4001"/> >@@ -40,6 +40,66 @@ > <styles xmi:type="notation:FilteringStyle" xmi:id="_sFlvRD-OEd2DT6rVsxRmdQ"/> > </children> > <children xmi:type="notation:Node" xmi:id="_sFlvRT-OEd2DT6rVsxRmdQ" type="5002"> >+ <children xmi:type="notation:Node" xmi:id="_qywyMLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eClass"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qywyMbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyxZQLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eIsProxy"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZQbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyxZQrP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eResource"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZQ7P2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyxZRLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContainer"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZRbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyxZRrP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContainingFeature"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZR7P2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyyAULP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContainmentFeature"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAUbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyyAUrP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContents"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAU7P2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyyAVLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eAllContents"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAVbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyyAVrP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eCrossReferences"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAV7P2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyynYLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eGet"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyynYbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyynYrP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eGet.1"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyynY7P2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyzOcLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eSet"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyzOcbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyzOcrP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eIsSet"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyzOc7P2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_qyzOdLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eUnset"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_qyzOdbP2Ed2JrdFLh2Y_ww"/> >+ </children> >+ <children xmi:type="notation:Node" xmi:id="_xxmzoLP2Ed2JrdFLh2Y_ww" type="2002"> >+ <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eCall"/> >+ <layoutConstraint xmi:type="notation:Location" xmi:id="_xxmzobP2Ed2JrdFLh2Y_ww"/> >+ </children> > <styles xmi:type="notation:DrawerStyle" xmi:id="_sFlvRj-OEd2DT6rVsxRmdQ"/> > <styles xmi:type="notation:SortingStyle" xmi:id="_sFlvRz-OEd2DT6rVsxRmdQ"/> > <styles xmi:type="notation:FilteringStyle" xmi:id="_sFlvSD-OEd2DT6rVsxRmdQ"/> >Index: model/EcoreDataTypes.ecorediag >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/model/EcoreDataTypes.ecorediag,v >retrieving revision 1.1 >diff -u -r1.1 EcoreDataTypes.ecorediag >--- model/EcoreDataTypes.ecorediag 2 Aug 2008 15:22:20 -0000 1.1 >+++ model/EcoreDataTypes.ecorediag 16 Oct 2009 15:42:07 -0000 >@@ -224,6 +224,13 @@ > <element xmi:type="ecore:EDataType" href="Ecore.ecore#//ETreeIterator"/> > <layoutConstraint xmi:type="notation:Bounds" xmi:id="_n9W90D-IEd2DT6rVsxRmdQ" x="408" y="228"/> > </children> >+ <children xmi:type="notation:Node" xmi:id="_z-RYILP5Ed2JrdFLh2Y_ww" type="1004"> >+ <children xmi:type="notation:Node" xmi:id="_z-VpkLP5Ed2JrdFLh2Y_ww" type="4008"/> >+ <children xmi:type="notation:Node" xmi:id="_z-VpkbP5Ed2JrdFLh2Y_ww" type="4009"/> >+ <styles xmi:type="notation:ShapeStyle" xmi:id="_z-RYIbP5Ed2JrdFLh2Y_ww" fontName="Lucida Grande" fontHeight="10" fillColor="13420443" lineColor="8421504"/> >+ <element xmi:type="ecore:EDataType" href="Ecore.ecore#//EInvocationTargetException"/> >+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_z-RYIrP5Ed2JrdFLh2Y_ww" x="-216" y="585"/> >+ </children> > <styles xmi:type="notation:DiagramStyle" xmi:id="_n9W90T-IEd2DT6rVsxRmdQ"/> > <element xmi:type="ecore:EPackage" href="Ecore.ecore#/"/> > </notation:Diagram> >Index: src/org/eclipse/emf/ecore/util/EcoreValidator.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreValidator.java,v >retrieving revision 1.38 >diff -u -r1.38 EcoreValidator.java >--- src/org/eclipse/emf/ecore/util/EcoreValidator.java 9 Aug 2009 09:49:54 -0000 1.38 >+++ src/org/eclipse/emf/ecore/util/EcoreValidator.java 16 Oct 2009 15:42:16 -0000 >@@ -1,7 +1,7 @@ > /** > * <copyright> > * >- * Copyright (c) 2006-2007 IBM Corporation and others. >+ * Copyright (c) 2006-2008 IBM Corporation, Zeligsoft Inc., and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -9,6 +9,7 @@ > * > * Contributors: > * IBM - Initial API and implementation >+ * Zeligsoft - 255469 Implement basic eCall support > * > * </copyright> > * >@@ -16,6 +17,7 @@ > */ > package org.eclipse.emf.ecore.util; > >+import java.lang.reflect.InvocationTargetException; > import java.math.BigDecimal; > import java.math.BigInteger; > >@@ -501,6 +503,8 @@ > return validateEString((String)value, diagnostics, context); > case EcorePackage.ETREE_ITERATOR: > return validateETreeIterator((TreeIterator<?>)value, diagnostics, context); >+ case EcorePackage.EINVOCATION_TARGET_EXCEPTION: >+ return validateEInvocationTargetException((InvocationTargetException)value, diagnostics, context); > default: > return true; > } >@@ -4087,6 +4091,16 @@ > } > > /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public boolean validateEInvocationTargetException(InvocationTargetException eInvocationTargetException, DiagnosticChain diagnostics, Map<Object, Object> context) >+ { >+ return true; >+ } >+ >+ /** > * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >Index: src/org/eclipse/emf/ecore/util/BasicCallDelegate.java >=================================================================== >RCS file: src/org/eclipse/emf/ecore/util/BasicCallDelegate.java >diff -N src/org/eclipse/emf/ecore/util/BasicCallDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/ecore/util/BasicCallDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,99 @@ >+/** >+ * <copyright> >+ * >+ * Copyright (c) 2008 Zeligsoft Inc. and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Zeligsoft - Initial API and implementation >+ * >+ * </copyright> >+ * >+ * $Id$ >+ */ >+ >+package org.eclipse.emf.ecore.util; >+ >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.emf.common.util.EList; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.ecore.EcorePackage; >+import org.eclipse.emf.ecore.InternalEObject; >+import org.eclipse.emf.ecore.EOperation; >+ >+ >+/** >+ * A basic implementation of the dynamic operation-call delegate API. In fact, >+ * it is so basic that it isn't much an implementation at all, but merely >+ * throws {@link UnsupportedOperationException} on every invocation, except for >+ * the operations define for the {@link EObject} class. >+ * Subclasses should override the {@link #dynamicCall(InternalEObject, EList)} >+ * method to not do that. >+ */ >+public class BasicCallDelegate implements EOperation.Internal.CallDelegate >+{ >+ protected EOperation eOperation; >+ >+ /** >+ * Initializes me with the operation that delegates calls to me. >+ * >+ * @param operation my operation >+ */ >+ public BasicCallDelegate(EOperation operation) >+ { >+ this.eOperation = operation; >+ } >+ >+ public Object dynamicCall(InternalEObject target, EList<?> arguments) throws InvocationTargetException >+ { >+ if (eOperation.getEContainingClass() == EcorePackage.Literals.EOBJECT) >+ { >+ //TODO: EOperations should have IDs, like structural features. >+ // These IDs should be listed in the generated package interface >+ int id = eOperation.getEContainingClass().getEAllOperations().indexOf(eOperation); >+ >+ switch (id) { >+ case 0: // EcorePackage.EOBJECT___ECLASS >+ return target.eClass(); >+ case 1: // EcorePackage.EOBJECT___EIS_PROXY >+ return target.eIsProxy(); >+ case 2: // EcorePackage.EOBJECT___ERESOURCE >+ return target.eResource(); >+ case 3: // EcorePackage.EOBJECT___ECONTAINER >+ return target.eContainer(); >+ case 4: // EcorePackage.EOBJECT___ECONTAINING_FEATURE >+ return target.eContainingFeature(); >+ case 5: // EcorePackage.EOBJECT___ECONTAINMENT_FEATURE >+ return target.eContainmentFeature(); >+ case 6: // EcorePackage.EOBJECT___ECONTENTS >+ return target.eContents(); >+ case 7: // EcorePackage.EOBJECT___EALL_CONTENTS >+ return target.eAllContents(); >+ case 8: // EcorePackage.EOBJECT___ECROSS_REFERENCES >+ return target.eCrossReferences(); >+ case 9: // EcorePackage.EOBJECT___EGET__FEATURE >+ return target.eGet((EStructuralFeature) arguments.get(0)); >+ case 10: // EcorePackage.EOBJECT___EGET__FEATURE__RESOLVE >+ return target.eGet((EStructuralFeature) arguments.get(0), (Boolean) arguments.get(1)); >+ case 11: // EcorePackage.EOBJECT___ESET__FEATURE__NEW_VALUE >+ target.eSet((EStructuralFeature) arguments.get(0), arguments.get(1)); >+ return null; >+ case 12: // EcorePackage.EOBJECT___EIS_SET__FEATURE >+ return target.eIsSet((EStructuralFeature) arguments.get(0)); >+ case 13: // EcorePackage.EOBJECT___EUNSET__FEATURE >+ target.eUnset((EStructuralFeature) arguments.get(0)); >+ return null; >+ case 14: // EcorePackage.EOBJECT___ECALL__OPERATION__ARGUMENTS >+ return target.eCall((EOperation) arguments.get(0), (EList<?>) arguments.get(1)); >+ } >+ } >+ >+ throw new UnsupportedOperationException("eCall not implemented for " + eOperation.getName()); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
Kenn.Hussey
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 255469
:
118008
|
118009
|
148791
| 149767 |
150408
|
150693
|
151088
|
155103