Author: dennyxu
Date: 2009-07-20 03:08:24 -0400 (Mon, 20 Jul 2009)
New Revision: 16670
Added:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdePlugin.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/BPELResourceSet.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Activator.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Extension.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionMap.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelFactory.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelPackage.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectAdapter.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectUserAdapter.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectAdapterImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectUserAdapterImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionAdapterImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionMapAdapterImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionMapImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelFactoryImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelPackageImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/ExtensionModelNotification.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/impl/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/impl/ExtensionModelNotificationImpl.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelAdapterFactory.java
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelSwitch.java
Log:
add all missing java files of src folders
Added:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdeBPELPublisher.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,239 @@
+package org.eclipse.bpel.apache.ode.runtime;
+
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation, University of Stuttgart (IAAS) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation, University of Stuttgart (IAAS) - initial API and implementation
+ *******************************************************************************/
+
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.runtimes.publishers.GenericBPELPublisher;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.IRuntime;
+
+/**
+ * BPEL publisher for Apache ODE.
+ *
+ * @author Tammo van Lessen (IAAS)
+ * @author Simon Moser (IBM)
+ */
+public class OdeBPELPublisher extends GenericBPELPublisher {
+
+ public OdeBPELPublisher()
+ {
+ super();
+ }
+
+ @Override
+ public IStatus[] publish(IModuleArtifact[] artifacts, IProgressMonitor monitor) {
+ // resources will always be null for some weird reason :(
+ // therefore we generate a BPELModuleArtifact
+ // the module id value enables us to get BPEL file path relative to its project
+ IModule[] modules = super.getModule();
+ IStatus[] result = new Status[modules.length];
+
+ try {
+ for (int i = 0; i < modules.length; i++) {
+
+ IModule module = modules[i];
+
+ List<IFile> files = getArtifacts(module.getProject());
+
+ if (doesDeploymentDescriptorExist(files)){
+
+ String currentDeployDir = createDeploymentDestination(module);
+
+ for (IFile file : files) {
+
+ if (isFileOfInterest(file)) {
+ copyFileToDeploymentDestination(file, currentDeployDir);
+ }
+ }
+
+ //remove <project>.deployed to kick the redeployment
+ new File(new File(currentDeployDir).getParent(), new
File(currentDeployDir).getName() + ".deployed").delete();
+
+ result[i] = new Status(IStatus.OK, OdePlugin.PLUGIN_ID, 1,
+ "Deployment successful", null);
+ }
+ else {
+ result[i] = new Status(IStatus.ERROR, OdePlugin.PLUGIN_ID, 1,
+ "Deployment Descriptor does not exist. Create a ODE Deployment Descriptor and
try again", null);
+ }
+ }
+ } catch (Exception e) {
+ result[0] = new Status(IStatus.ERROR, OdePlugin.PLUGIN_ID, 0,
+ "Error during deployment: " + e.getMessage(), e);
+
+ }
+
+ return result;
+ }
+
+ @Override
+ public IStatus[] unpublish(IProgressMonitor monitor) {
+ IModule[] modules = super.getModule();
+ IStatus[] result = new Status[modules.length];
+
+ try {
+ for (int i = 0; i < modules.length; i++) {
+
+ IModule module = modules[i];
+ String currentDeployDir = createDeploymentDestination(module);
+
+ //remove <project>.deployed to kick the redeployment
+ deleteDir(new File(currentDeployDir));
+
+ result[i] = new Status(IStatus.OK, OdePlugin.PLUGIN_ID, 1,
+ "Undeployment successful", null);
+ }
+ } catch (Exception e) {
+ result[0] = new Status(IStatus.ERROR, OdePlugin.PLUGIN_ID, 0,
+ "Error during undeployment: " + e.getMessage(), e);
+ }
+
+ return result;
+ }
+
+ protected boolean doesDeploymentDescriptorExist(List<IFile> files){
+
+ for (IFile file : files) {
+
+ if ( file.getName().equalsIgnoreCase("deploy.xml")) { //NON-NLS-1
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected List<IFile> getArtifacts(IProject project) {
+ final List<IFile> files = new ArrayList<IFile>();
+ IResourceVisitor visitor = new IResourceVisitor() {
+ public boolean visit(org.eclipse.core.resources.IResource resource) throws
org.eclipse.core.runtime.CoreException {
+ if (resource.getType() == IResource.FILE) {
+ files.add((IFile)resource);
+ }
+ return true;
+ }
+ };
+ try {
+ project.accept(visitor);
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return files;
+ }
+
+ protected boolean isFileOfInterest(IFile file) {
+
+ String fileExtension = file.getFileExtension();
+
+ if (fileExtension.equalsIgnoreCase("bpel"))
+ return true;
+ if (fileExtension.equalsIgnoreCase("wsdl"))
+ return true;
+ if (fileExtension.equalsIgnoreCase("xsd"))
+ return true;
+ if (fileExtension.equalsIgnoreCase("soap"))
+ return true;
+ if (fileExtension.equalsIgnoreCase("xml"))
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * This method will create a folder inside the WEB-INF\processes subfolder of the ODE
installation
+ */
+ protected String createDeploymentDestination(IModule module)
+ {
+ String moduleName = module.getName().substring(0,
module.getName().indexOf('/'));
+ String deployAppName = moduleName;
+
+ //get TOMCAT_HOME
+ IRuntime serverDef = getServerRuntime().getRuntime();
+ String tomcatHome = serverDef.getLocation().toOSString();
+
+ //append ODE's Process target Dir tomcatHome
+ String deployTarget = tomcatHome.concat(System.getProperty("file.separator")
+ "webapps" + System.getProperty("file.separator") + "ode" +
System.getProperty("file.separator") + "WEB-INF" +
System.getProperty("file.separator") + "processes" +
System.getProperty("file.separator") + deployAppName );
+
+ File f = new File(deployTarget);
+ if (!f.exists()) {
+ f.mkdir();
+ }
+
+ return deployTarget;
+ }
+
+ private boolean deleteDir(File dir) {
+ if (dir.exists()) {
+ File[] files = dir.listFiles();
+ for (File f : files) {
+ if (f.isDirectory()) {
+ deleteDir(f);
+ } else {
+ f.delete();
+ }
+ }
+ }
+ return dir.delete();
+ }
+
+ private void copyFileToDeploymentDestination(IFile ifile, String toDeployDir) {
+
+ String from = ifile.getFullPath().toOSString();
+ String fileName = ifile.getName();
+ String wspath = ifile.getWorkspace().getRoot().getLocation().toOSString();
+
+ File srcFile = new File(wspath + from);
+ File targetFile = new File(toDeployDir + System.getProperty("file.separator")
+ fileName);
+
+ if (srcFile != null && srcFile.exists()) {
+
+ try {
+
+ BufferedInputStream inStream = new BufferedInputStream(new
FileInputStream(srcFile));
+ BufferedOutputStream outStream = new BufferedOutputStream(new
FileOutputStream(targetFile));
+
+ byte[] bytes = new byte[1024];
+
+ int count;
+
+ while ((count = inStream.read(bytes)) != -1) {
+ outStream.write(bytes, 0, count);
+ }
+
+ outStream.close();
+ inStream.close();
+ }
+ catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+ }
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdePlugin.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdePlugin.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.runtime/src/org/eclipse/bpel/apache/ode/runtime/OdePlugin.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,41 @@
+package org.eclipse.bpel.apache.ode.runtime;
+
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation, University of Stuttgart (IAAS) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation, University of Stuttgart (IAAS) - initial API and implementation
+ *******************************************************************************/
+
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Runtime contributor for Apache ODE.
+ *
+ * @author Tammo van Lessen (IAAS)
+ * @author Simon Moser (IBM)
+ */
+public class OdePlugin extends AbstractUIPlugin {
+ public static final String PLUGIN_ID = "org.eclipse.bpel.apache.ode.runtime";
+ private static OdePlugin plugin;
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+ public static OdePlugin getDefault() {
+ return plugin;
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/BPELResourceSet.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/BPELResourceSet.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/BPELResourceSet.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+/**
+ * @author Michal Chmielewski (michal.chmielewski(a)oracle.com)
+ * @date Aug 3, 2007
+ *
+ */
+@SuppressWarnings("nls")
+public class BPELResourceSet extends ResourceSetImpl {
+
+ /**
+ * Used to force loading using the right resource loaders.
+ */
+ static public final String SLIGHTLY_HACKED_KEY =
"slightly.hacked.resource.set";
+
+
+
+ /**
+ * Load the resource from the resource set, assuming that it is the kind
+ * indicated by the last argument. The "kind" parameter is the extension
+ * without the . of the resource.
+ *
+ * This forces the right resource to be loaded even if the URI of the resource
+ * is "wrong".
+ *
+ * @param uri the URI of the resource.
+ * @param loadOnDemand load on demand
+ * @param kind the resource kind. It has to be of the form "*.wsdl", or
"*.xsd", or "*.bpel"
+ * @return the loaded resource.
+ */
+
+ @SuppressWarnings("nls")
+ public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
+
+ Map<URI, Resource> map = getURIResourceMap();
+
+ if (map != null) {
+ Resource resource = map.get(uri);
+ if (resource != null) {
+ if (loadOnDemand && !resource.isLoaded()) {
+ demandLoadHelper(resource);
+ }
+
+ return resource;
+ }
+ }
+
+ URIConverter theURIConverter = getURIConverter();
+ URI normalizedURI = theURIConverter.normalize(uri);
+
+ Iterator<Resource> it = getResources().iterator();
+ while (it.hasNext()) {
+ Resource resource = it.next();
+ if (theURIConverter.normalize(resource.getURI()).equals(
+ normalizedURI)) {
+ if (loadOnDemand && !resource.isLoaded()) {
+ demandLoadHelper(resource);
+ }
+
+ if (map != null) {
+ map.put(uri, resource);
+ }
+ return resource;
+ }
+ }
+
+ if (loadOnDemand) {
+ Resource resource = demandCreateResource(uri,kind);
+ if (resource == null) {
+ throw new RuntimeException("Cannot create a resource for '"
+ + uri + "'; a registered resource factory is needed");
+ }
+
+ demandLoadHelper(resource);
+
+ if (map != null) {
+ map.put(uri, resource);
+ }
+ return resource;
+ }
+
+ return null;
+ }
+
+
+ protected Resource demandCreateResource ( URI uri, String kind ) {
+ return createResource ( uri, kind );
+ }
+
+
+ /**
+ * Create the resource based on the kind.
+ * @param uri
+ * @param kind
+ * @return the created resource
+ */
+
+ @SuppressWarnings("nls")
+ public Resource createResource ( URI uri, String kind ) {
+
+ if (kind == null) {
+ return super.createResource(uri, null);
+ }
+
+ Resource resource = createResource(URI.createURI("*." + kind));
+ if (resource != null) {
+ resource.setURI(uri);
+ }
+ return resource;
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Activator.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Activator.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Activator.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.bpel.common.BPELResourceSet;
+import org.eclipse.bpel.fnmeta.FunctionLibrary;
+import org.eclipse.bpel.fnmeta.FunctionRegistry;
+import org.eclipse.bpel.fnmeta.IFunctionRegistryLoader;
+import org.eclipse.bpel.fnmeta.model.Function;
+import org.eclipse.bpel.fnmeta.model.Registry;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+
+@SuppressWarnings({"boxing","nls"})
+
+public class Activator extends Plugin implements IFunctionRegistryLoader {
+
+ /**
+ * The plugin id.
+ */
+
+ public static final String PLUGIN_ID = "org.eclipse.bpel.common.model";
//$NON-NLS-1$
+
+ /** The shared instance. */
+ static public Activator INSTANCE;
+
+ static String FUNCTION_REGISTRY = "functionRegistry";
+ static String AT_REGISTRY_NAME_SPACE = "namespace";
+ static String AT_URI = "uri";
+
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ INSTANCE = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ FunctionLibrary.INSTANCE.registerLoader( this );
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ FunctionLibrary.INSTANCE.unregisterLoader( this );
+ INSTANCE = null;
+ }
+
+
+ /**
+ * Utility methods for logging exceptions.
+ * @param message
+ * @param e
+ * @param severity
+ */
+
+
+
+ public static void log (String message, Throwable e, int severity) {
+
+ IStatus status = null;
+
+ if (e instanceof CoreException) {
+ status = ((CoreException)e).getStatus();
+ } else {
+ String m = e != null ? e.getMessage() : null;
+
+ if (message == null) {
+ if (m == null) {
+ m = "<no message>";
+ }
+ } else {
+ if (m == null) {
+ m = message;
+ } else {
+ m = message + "[" + m + "]";
+ }
+ }
+
+ status = new Status(severity, PLUGIN_ID, 0, m, e); //$NON-NLS-1$
+ }
+
+ if (Platform.isRunning()) {
+ INSTANCE.getLog().log(status);
+ } else {
+ String msg = java.text.MessageFormat.format(
+ "{1,choice,0#msg|1#Info|2#Warning|4#Error}@{0}: {3}",
+ status.getPlugin(),
+ status.getSeverity(),
+ status.getCode(),
+ status.getMessage() );
+
+ System.err.println(msg);
+
+ if (status.getException() != null) {
+ status.getException().printStackTrace(System.err);
+ }
+ }
+ }
+
+
+ /**
+ * The configuration elements for our extension points
+ *
+ * @param extensionPointId our extension points
+ *
+ * @return the configuration elements.
+ *
+ */
+
+ public IConfigurationElement[] getConfigurationElements (String extensionPointId) {
+ String id = getBundle().getSymbolicName();
+
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(id,
extensionPointId);
+ if (extensionPoint == null) {
+ return new IConfigurationElement[] {} ;
+ }
+ return extensionPoint.getConfigurationElements();
+ }
+
+
+ /**
+ * @see
org.eclipse.bpel.fnmeta.IFunctionRegistryLoader#load(org.eclipse.bpel.fnmeta.FunctionRegistry)
+ */
+ public void load (FunctionRegistry registry) {
+
+ for (IConfigurationElement elm : getConfigurationElements( FUNCTION_REGISTRY )) {
+ String ns = registry.getLanguageNS();
+ if (ns == null || ns.equals(elm.getAttribute(AT_REGISTRY_NAME_SPACE)) == false) {
+ continue;
+ }
+
+ String location = elm.getAttribute(AT_URI);
+ URI uri = URI.createURI( location ) ;
+
+ BPELResourceSet rs = new BPELResourceSet();
+ Resource resource = rs.getResource(uri, true, "fnmeta");
+
+ if (resource.getContents().size() > 0) {
+ Registry r = (Registry) resource.getContents().get(0);
+ registry.add( r.getFunctions() );
+ }
+ }
+ }
+
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Extension.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Extension.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/Extension.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object
'<em><b>Extension</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpel.common.extension.model.Extension#getExtendedObject
<em>Extended Object</em>}</li>
+ * <li>{@link
org.eclipse.bpel.common.extension.model.Extension#getExtensionObject <em>Extension
Object</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#getExtension()
+ * @model
+ * @generated
+ */
+public interface Extension extends EObject {
+ /**
+ * Returns the value of the '<em><b>Extended
Object</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Extended Object</em>' reference
isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Extended Object</em>' reference.
+ * @see #setExtendedObject(EObject)
+ * @see
org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#getExtension_ExtendedObject()
+ * @model required="true"
+ * @generated
+ */
+ EObject getExtendedObject();
+
+ /**
+ * Sets the value of the '{@link
org.eclipse.bpel.common.extension.model.Extension#getExtendedObject <em>Extended
Object</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Extended Object</em>'
reference.
+ * @see #getExtendedObject()
+ * @generated
+ */
+ void setExtendedObject(EObject value);
+
+ /**
+ * Returns the value of the '<em><b>Extension
Object</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Extension Object</em>' containment
reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Extension Object</em>' containment
reference.
+ * @see #setExtensionObject(EObject)
+ * @see
org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#getExtension_ExtensionObject()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ EObject getExtensionObject();
+
+ /**
+ * Sets the value of the '{@link
org.eclipse.bpel.common.extension.model.Extension#getExtensionObject <em>Extension
Object</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Extension Object</em>'
containment reference.
+ * @see #getExtensionObject()
+ * @generated
+ */
+ void setExtensionObject(EObject value);
+
+} // Extension
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionMap.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionMap.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionMap.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Extension
Set</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpel.common.extension.model.ExtensionMap#getNamespace
<em>Namespace</em>}</li>
+ * <li>{@link org.eclipse.bpel.common.extension.model.ExtensionMap#getExtensions
<em>Extensions</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#getExtensionSet()
+ * @model
+ * @customized
+ */
+public interface ExtensionMap extends EObject,Map<EObject,EObject> {
+ /**
+ * Returns the value of the '<em><b>Namespace</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Namespace</em>' attribute isn't
clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Namespace</em>' attribute.
+ * @see #setNamespace(String)
+ * @see
org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#getExtensionMap_Namespace()
+ * @model
+ * @generated
+ */
+ String getNamespace();
+
+ /**
+ * Sets the value of the '{@link
org.eclipse.bpel.common.extension.model.ExtensionMap#getNamespace
<em>Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Namespace</em>'
attribute.
+ * @see #getNamespace()
+ * @generated
+ */
+ void setNamespace(String value);
+
+ /**
+ * Returns the value of the '<em><b>Extensions</b></em>'
containment reference list.
+ * The list contents are of type {@link
org.eclipse.bpel.common.extension.model.Extension}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Extensions</em>' containment reference
list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Extensions</em>' containment
reference list.
+ * @see
org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#getExtensionMap_Extensions()
+ * @model type="org.eclipse.bpel.common.extension.model.Extension"
containment="true"
+ * @generated
+ */
+ EList getExtensions();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model
+ * @generated
+ */
+ void initializeAdapter();
+
+} // ExtensionMap
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelFactory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelFactory.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelFactory.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelPackage
+ * @generated
+ */
+public interface ExtensionmodelFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ ExtensionmodelFactory eINSTANCE = new
org.eclipse.bpel.common.extension.model.impl.ExtensionmodelFactoryImpl();
+
+ /**
+ * Returns a new object of class '<em>Extension Map</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Extension Map</em>'.
+ * @generated
+ */
+ ExtensionMap createExtensionMap();
+
+ /**
+ * Returns a new object of class '<em>Extension</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Extension</em>'.
+ * @generated
+ */
+ Extension createExtension();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ ExtensionmodelPackage getExtensionmodelPackage();
+
+ /**
+ * Method findExtensionSet.
+ * Given a namespace and the contents of a Resource (as an EList), this
+ * method will find the first instance of an ExtensionMap object for the
+ * given namespace. <code>null</code> is returned if one doesn't
exists
+ * @param namespace - ExtensionMap namespace
+ * @param contents - Resource contents
+ * @return ExtensionMap
+ * @customized
+ */
+ ExtensionMap findExtensionMap(String namespace, EList contents);
+
+ /**
+ * Method findExtensionSets. Given a namespace and the contents of a
+ * Resource (as an EList), this method will find all ExtensionMap objects
+ * that for the given namespace. An empty list is returned if one no
+ * ExtensionMap objects meeting the criteria exists
+ * @param namespace - ExtensionMap namespace
+ * @param contents - Resource contents
+ * @return ExtensionMap
+ * @customized
+ */
+ EList findExtensionMaps(String namespace, EList contents);
+
+ /**
+ * Method createExtensionSet.
+ * Creates an ExtensionMap object for the given namespace.
+ * @param namespace
+ * @return ExtensionMap
+ * @customized
+ */
+ ExtensionMap createExtensionMap(String namespace);
+
+ /**
+ * Method adaptEObject.
+ * This method associates an adapter to a model object.
+ * @param target - object to which the adaptor is to be associated
+ * @param adapter - adapter to asociate to target
+ * @customized
+ */
+ void adaptEObject(EObject target, Adapter adapter);
+
+ /**
+ * Method getExtensionEdapter.
+ * This method returns an extension adapter associated with the
+ * given EObject.
+ * @param extendedObject - adapter object
+ * @param namesapce - adapter's namesapce
+ * @return adapter object
+ * @customized
+ */
+ Adapter getExtensionAdapter(EObject extendedObject, String namesapce);
+
+
+} //ExtensionmodelFactory
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelPackage.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelPackage.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/ExtensionmodelPackage.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.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;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface ExtensionmodelPackage extends EPackage{
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "model";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http:///extensionmodel.ecore";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "extensionmodel";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ ExtensionmodelPackage eINSTANCE =
org.eclipse.bpel.common.extension.model.impl.ExtensionmodelPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link
org.eclipse.bpel.common.extension.model.impl.ExtensionMapImpl <em>Extension
Map</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpel.common.extension.model.impl.ExtensionMapImpl
+ * @see
org.eclipse.bpel.common.extension.model.impl.ExtensionmodelPackageImpl#getExtensionMap()
+ * @generated
+ */
+ int EXTENSION_MAP = 0;
+
+ /**
+ * The feature id for the '<em><b>Namespace</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXTENSION_MAP__NAMESPACE = 0;
+
+ /**
+ * The feature id for the '<em><b>Extensions</b></em>'
containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXTENSION_MAP__EXTENSIONS = 1;
+
+ /**
+ * The number of structural features of the '<em>Extension Map</em>'
class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXTENSION_MAP_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link
org.eclipse.bpel.common.extension.model.impl.ExtensionImpl
<em>Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpel.common.extension.model.impl.ExtensionImpl
+ * @see
org.eclipse.bpel.common.extension.model.impl.ExtensionmodelPackageImpl#getExtension()
+ * @generated
+ */
+ int EXTENSION = 1;
+
+ /**
+ * The feature id for the '<em><b>Extended
Object</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXTENSION__EXTENDED_OBJECT = 0;
+
+ /**
+ * The feature id for the '<em><b>Extension
Object</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXTENSION__EXTENSION_OBJECT = 1;
+
+ /**
+ * The number of structural features of the '<em>Extension</em>'
class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int EXTENSION_FEATURE_COUNT = 2;
+
+ /**
+ * Returns the meta object for class '{@link
org.eclipse.bpel.common.extension.model.ExtensionMap <em>Extension
Map</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Extension Map</em>'.
+ * @see org.eclipse.bpel.common.extension.model.ExtensionMap
+ * @generated
+ */
+ EClass getExtensionMap();
+
+ /**
+ * Returns the meta object for the attribute '{@link
org.eclipse.bpel.common.extension.model.ExtensionMap#getNamespace
<em>Namespace</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Namespace</em>'.
+ * @see org.eclipse.bpel.common.extension.model.ExtensionMap#getNamespace()
+ * @see #getExtensionMap()
+ * @generated
+ */
+ EAttribute getExtensionMap_Namespace();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link
org.eclipse.bpel.common.extension.model.ExtensionMap#getExtensions
<em>Extensions</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list
'<em>Extensions</em>'.
+ * @see org.eclipse.bpel.common.extension.model.ExtensionMap#getExtensions()
+ * @see #getExtensionMap()
+ * @generated
+ */
+ EReference getExtensionMap_Extensions();
+
+ /**
+ * Returns the meta object for class '{@link
org.eclipse.bpel.common.extension.model.Extension <em>Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Extension</em>'.
+ * @see org.eclipse.bpel.common.extension.model.Extension
+ * @generated
+ */
+ EClass getExtension();
+
+ /**
+ * Returns the meta object for the reference '{@link
org.eclipse.bpel.common.extension.model.Extension#getExtendedObject <em>Extended
Object</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Extended
Object</em>'.
+ * @see org.eclipse.bpel.common.extension.model.Extension#getExtendedObject()
+ * @see #getExtension()
+ * @generated
+ */
+ EReference getExtension_ExtendedObject();
+
+ /**
+ * Returns the meta object for the containment reference '{@link
org.eclipse.bpel.common.extension.model.Extension#getExtensionObject <em>Extension
Object</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Extension
Object</em>'.
+ * @see org.eclipse.bpel.common.extension.model.Extension#getExtensionObject()
+ * @see #getExtension()
+ * @generated
+ */
+ EReference getExtension_ExtensionObject();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ ExtensionmodelFactory getExtensionmodelFactory();
+
+} //ExtensionmodelPackage
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectAdapter.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectAdapter.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectAdapter.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.adapters;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * This adapter provides an easy way to get to an Extension object. It is
+ * created when an EObject is extended or its Extension is retrieved from the
+ * ExtensionMap.
+ * @custom
+ */
+public interface ExtendedObjectAdapter extends Adapter {
+
+ /**
+ * Returns the compExtension.
+ * Gets the Extension object extending the adapted EObject.
+ * @return ComponentExtension
+ */
+ Extension getExtension();
+
+ /**
+ * Returns the extension object.
+ * @return ComponentExtension
+ */
+ EObject getExtensionObject();
+
+ /**
+ * Sets the compExtension.
+ * Sets the Extension object extending the adapted EObject.
+ * @param compExtension The compExtension to set
+ */
+ void setExtension(Extension extension);
+
+ /**
+ * Method getNamespace
+ * Returns the namesapce of the ExtensionMap that associated this adapter.
+ * @return String
+ */
+ String getNamespace();
+
+ /**
+ * Method setNamespace.
+ * Sets the namescpase for this adapter (which should correspond to the
+ * namespace of the ExtensionMap that associated this adapter).
+ * @param namespace
+ */
+ void setNamespace(String namespace);
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectUserAdapter.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectUserAdapter.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/ExtendedObjectUserAdapter.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.adapters;
+
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.emf.common.notify.Adapter;
+
+
+/**
+ * This adapter provides an easy way to get to an Extension object. It is
+ * created when an EObject is extended or its Extension is retrieved from the
+ * ExtensionMap.
+ * @custom
+ */
+public interface ExtendedObjectUserAdapter extends Adapter {
+
+ /**
+ * Method getNamespace
+ * Returns the namesapce of the ExtensionMap that associated this adapter.
+ * @return String
+ */
+ String getNamespace();
+
+ /**
+ * Sets the ExtensionMap.
+ * @param extensionMap
+ */
+ void setExtensionMap(ExtensionMap extensionMap);
+
+ /**
+ * Gets the extension object extending the extendedObject.
+ * @return extensionObject
+ */
+ Object get(Object extendedObject);
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectAdapterImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectAdapterImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectAdapterImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.adapters.impl;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectAdapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+
+/**
+ * @custom
+ */
+public class ExtendedObjectAdapterImpl extends AdapterImpl implements
ExtendedObjectAdapter {
+
+ private Extension extension = null;
+ private String namespace = null;
+
+ /**
+ * Constructor for ComponentExtensionAdapter.
+ */
+ public ExtendedObjectAdapterImpl() {
+ super();
+ }
+
+ /**
+ * Returns the compExtension.
+ * @return ComponentExtension
+ */
+ public Extension getExtension() {
+ return extension;
+ }
+
+ /**
+ * Returns the extension object.
+ * @return ComponentExtension
+ */
+ public EObject getExtensionObject() {
+ if(extension== null)
+ return null;
+ else
+ return extension.getExtensionObject();
+ }
+
+ /**
+ * Sets the compExtension.
+ * @param compExtension The compExtension to set
+ */
+ public void setExtension(Extension extension) {
+ this.extension = extension;
+ }
+
+ /**
+ * @see
org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * @see
org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectAdapter#getNamespace()
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * @see
org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectAdapter#setNamespace()
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return EObjectImpl.class.equals(type);
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectUserAdapterImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectUserAdapterImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtendedObjectUserAdapterImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.adapters.impl;
+
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectUserAdapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+
+/**
+ * This adapter is associated to an ExtensionMap and it's responsible for
+ * cleaning up once an Extension is removed from the ExtensionMap's list.
+ */
+public class ExtendedObjectUserAdapterImpl extends AdapterImpl implements
ExtendedObjectUserAdapter {
+
+ private ExtensionMap extensionMap = null;
+
+ /**
+ * Constructor for ExtensionAdapterImpl.
+ */
+ public ExtendedObjectUserAdapterImpl() {
+ super();
+ }
+
+ /**
+ * @see
org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {}
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return EObjectImpl.class.equals(type);
+ }
+
+ public void setExtensionMap(ExtensionMap extensionMap) {
+ this.extensionMap = extensionMap;
+ }
+
+ public Object get(Object extendedObject) {
+ try{
+ return extensionMap.get(extendedObject);
+ } catch (NullPointerException npe){
+ return null;
+ }
+ }
+
+ public String getNamespace() {
+ return extensionMap.getNamespace();
+ }
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionAdapterImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionAdapterImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionAdapterImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.adapters.impl;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.impl.ExtensionImpl;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+
+
+/**
+ * This adapter is associated to Extension objects. It's job is to perform the
+ * appropriate clean up if any of the the adapted Extension object features are
+ * changed. It is a stateless adapter.
+ */
+public class ExtensionAdapterImpl extends AdapterImpl {
+
+ /**
+ * Constructor for ExtensionAdapterImpl.
+ */
+ public ExtensionAdapterImpl() {
+ super();
+ }
+
+ /**
+ * @see
org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+
+ switch (notification.getEventType()) {
+ case Notification.SET : // either the extendedObject or extensionObject was changed.
+
+ // need to eliminate this extension object from the ExtensionMap. If, both the
extendedObject
+ // and extensionObjects are null and the Extension is cointained by the ExtensionMap
then
+ // remove it form the list.
+ Extension extension = (Extension) notification.getNotifier();
+
+ if(extension.getExtendedObject() == null && extension.getExtensionObject() ==
null &&
+ extension.eContainer() != null){
+
+ ExtensionMap extensionSet = (ExtensionMap)extension.eContainer();
+
+ if(extensionSet != null &&
extensionSet.getExtensions().contains(extension))
+ extensionSet.getExtensions().remove(extension);
+ }
+
+ // If the extendedObject is not null set it to null now
+ if (extension.getExtendedObject() != null)
+ extension.setExtendedObject(null);
+
+ // If the extensionObject is not null set it to null now
+ if (extension.getExtensionObject() != null)
+ extension.setExtensionObject(null);
+
+ break;
+
+ default :
+ break;
+ }
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return ExtensionImpl.class.equals(type);
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionMapAdapterImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionMapAdapterImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/adapters/impl/ExtensionMapAdapterImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.adapters.impl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectAdapter;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectUserAdapter;
+import org.eclipse.bpel.common.extension.model.impl.ExtensionMapImpl;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * This adapter is associated to an ExtensionMap and it's responsible for
+ * cleaning up once an Extension is removed from the ExtensionMap's list.
+ */
+public class ExtensionMapAdapterImpl extends AdapterImpl {
+
+ /**
+ * Constructor for ExtensionAdapterImpl.
+ */
+ public ExtensionMapAdapterImpl() {
+ super();
+ }
+
+ /**
+ * @see
org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+
+ if(notification.getFeatureID(null) ==
ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS){
+ switch (notification.getEventType()) {
+
+ case Notification.REMOVE : // an Extension has been removed
+ case Notification.REMOVE_MANY : // an Extension has been removed
+
+ List<Extension> extensionList = null;
+ if(notification.getEventType() == Notification.REMOVE_MANY)
+ extensionList = (List<Extension>) notification.getOldValue();
+ else{
+ extensionList = new BasicEList();
+ extensionList.add((Extension)notification.getOldValue());
+ }
+
+ for (Iterator<Extension> iter = extensionList.iterator(); iter.hasNext();) {
+ Extension extension = iter.next();
+
+ EObject extendedObject = extension.getExtendedObject();
+
+ // if the exended EObject had an adapter, remove it.
+ if(extendedObject != null){
+ EList<Adapter> adapters = extendedObject.eAdapters();
+ EList<Adapter> removeAdapterList = new BasicEList<Adapter>();
+ for (Iterator<Adapter> iter2 = adapters.iterator();iter2.hasNext();) {
+ Adapter adapter = iter2.next();
+
+ if((adapter instanceof ExtendedObjectUserAdapter &&
((ExtendedObjectUserAdapter)adapter).getNamespace().equals(((ExtensionMap)getTarget()).getNamespace()))||
+ adapter instanceof ExtendedObjectAdapter &&
((ExtendedObjectAdapter)adapter).getNamespace().equals(((ExtensionMap)getTarget()).getNamespace())){
+ removeAdapterList.add(adapter);
+ }
+ }
+
+ for (Iterator<Adapter> iter2 = removeAdapterList.iterator();
iter2.hasNext();) {
+ Adapter adapter = iter2.next();
+ try{
+ ((ExtendedObjectAdapter)adapter).setExtension(null);
+ }catch(ClassCastException e){}
+ extendedObject.eAdapters().remove(adapter);
+ }
+ }
+
+ // Set the Extension attributes to null.
+ if (!(notification.getNotifier() instanceof Extension)){
+ if(extension.getExtendedObject() != null)
+ extension.setExtendedObject(null);
+
+ if(extension.getExtensionObject() != null)
+ extension.setExtensionObject(null);
+ }
+
+ }
+ break;
+
+ case Notification.REMOVING_ADAPTER :
+
+ ExtensionMap map = (ExtensionMap) notification.getNotifier();
+ Set extendedObjects = map.keySet();
+
+ for (Iterator<EObject> iter = extendedObjects.iterator(); iter.hasNext();) {
+ EObject element = iter.next();
+
+ List<Adapter> remove = new BasicEList<Adapter>();
+ for (Iterator<Adapter> iterator = element.eAdapters().iterator();
iterator.hasNext();) {
+ Adapter adapter = iterator.next();
+ if(adapter instanceof ExtendedObjectUserAdapter ||
+ adapter instanceof ExtendedObjectAdapter)
+ remove.add(adapter);
+ }
+ element.eAdapters().removeAll(remove);
+ }
+
+ break;
+
+ default :
+ break;
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ */
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return ExtensionMapImpl.class.equals(type);
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.impl;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object
'<em><b>Extension</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link
org.eclipse.bpel.common.extension.model.impl.ExtensionImpl#getExtendedObject
<em>Extended Object</em>}</li>
+ * <li>{@link
org.eclipse.bpel.common.extension.model.impl.ExtensionImpl#getExtensionObject
<em>Extension Object</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ExtensionImpl extends EObjectImpl implements Extension {
+ /**
+ * The cached value of the '{@link #getExtendedObject() <em>Extended
Object</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getExtendedObject()
+ * @generated
+ * @ordered
+ */
+ protected EObject extendedObject = null;
+
+ /**
+ * The cached value of the '{@link #getExtensionObject() <em>Extension
Object</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getExtensionObject()
+ * @generated
+ * @ordered
+ */
+ protected EObject extensionObject = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ExtensionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return ExtensionmodelPackage.eINSTANCE.getExtension();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getExtendedObject() {
+ if (extendedObject != null && extendedObject.eIsProxy()) {
+ EObject oldExtendedObject = extendedObject;
+ extendedObject = eResolveProxy((InternalEObject)extendedObject);
+ if (extendedObject != oldExtendedObject) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE,
ExtensionmodelPackage.EXTENSION__EXTENDED_OBJECT, oldExtendedObject, extendedObject));
+ }
+ }
+ return extendedObject;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetExtendedObject() {
+ return extendedObject;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setExtendedObject(EObject newExtendedObject) {
+ EObject oldExtendedObject = extendedObject;
+ extendedObject = newExtendedObject;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET,
ExtensionmodelPackage.EXTENSION__EXTENDED_OBJECT, oldExtendedObject, extendedObject));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getExtensionObject() {
+ return extensionObject;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetExtensionObject(EObject newExtensionObject,
NotificationChain msgs) {
+ EObject oldExtensionObject = extensionObject;
+ extensionObject = newExtensionObject;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT, oldExtensionObject,
newExtensionObject);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setExtensionObject(EObject newExtensionObject) {
+ if (newExtensionObject != extensionObject) {
+ NotificationChain msgs = null;
+ if (extensionObject != null)
+ msgs = ((InternalEObject)extensionObject).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT, null, msgs);
+ if (newExtensionObject != null)
+ msgs = ((InternalEObject)newExtensionObject).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
- ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT, null, msgs);
+ msgs = basicSetExtensionObject(newExtensionObject, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET,
ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT, newExtensionObject,
newExtensionObject));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class
baseClass, NotificationChain msgs) {
+ if (featureID >= 0) {
+ switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
+ case ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT:
+ return basicSetExtensionObject(null, msgs);
+ default:
+ return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
+ }
+ }
+ return eBasicSetContainer(null, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(EStructuralFeature eFeature, boolean resolve) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION__EXTENDED_OBJECT:
+ if (resolve) return getExtendedObject();
+ return basicGetExtendedObject();
+ case ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT:
+ return getExtensionObject();
+ }
+ return eDynamicGet(eFeature, resolve);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(EStructuralFeature eFeature, Object newValue) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION__EXTENDED_OBJECT:
+ setExtendedObject((EObject)newValue);
+ return;
+ case ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT:
+ setExtensionObject((EObject)newValue);
+ return;
+ }
+ eDynamicSet(eFeature, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(EStructuralFeature eFeature) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION__EXTENDED_OBJECT:
+ setExtendedObject((EObject)null);
+ return;
+ case ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT:
+ setExtensionObject((EObject)null);
+ return;
+ }
+ eDynamicUnset(eFeature);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(EStructuralFeature eFeature) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION__EXTENDED_OBJECT:
+ return extendedObject != null;
+ case ExtensionmodelPackage.EXTENSION__EXTENSION_OBJECT:
+ return extensionObject != null;
+ }
+ return eDynamicIsSet(eFeature);
+ }
+
+} //ExtensionImpl
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionMapImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionMapImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionMapImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,861 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.impl;
+
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelFactory;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectAdapter;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectUserAdapter;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtendedObjectAdapterImpl;
+import
org.eclipse.bpel.common.extension.model.adapters.impl.ExtendedObjectUserAdapterImpl;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtensionAdapterImpl;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtensionMapAdapterImpl;
+import org.eclipse.bpel.common.extension.model.notify.ExtensionModelNotification;
+import
org.eclipse.bpel.common.extension.model.notify.impl.ExtensionModelNotificationImpl;
+import org.eclipse.bpel.common.extension.model.util.ExtensionmodelAdapterFactory;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Extension
Set</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link
org.eclipse.bpel.common.extension.model.impl.ExtensionMapImpl#getNamespace
<em>Namespace</em>}</li>
+ * <li>{@link
org.eclipse.bpel.common.extension.model.impl.ExtensionMapImpl#getExtensions
<em>Extensions</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ExtensionMapImpl extends EObjectImpl implements ExtensionMap {
+ /**
+ * The default value of the '{@link #getNamespace()
<em>Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNamespace()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAMESPACE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getNamespace()
<em>Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNamespace()
+ * @generated
+ * @ordered
+ */
+ protected String namespace = NAMESPACE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getExtensions()
<em>Extensions</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getExtensions()
+ * @generated
+ * @ordered
+ */
+ protected EList<Extension> extensions = null;
+
+ /**
+ * The value of the user adapter if one has been instantiated via the
initializeAdapter()
+ * method. This attribute is not modeled as it is not required to
+ * serialize its value.
+ * @customized
+ */
+ private ExtendedObjectUserAdapter userAdapter = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ExtensionMapImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return ExtensionmodelPackage.eINSTANCE.getExtensionMap();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setNamespace(String newNamespace) {
+ String oldNamespace = namespace;
+ namespace = newNamespace;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET,
ExtensionmodelPackage.EXTENSION_MAP__NAMESPACE, oldNamespace, namespace));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Extension> getExtensions() {
+ if (extensions == null) {
+ extensions = new EObjectContainmentEList<Extension>(Extension.class, this,
ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS);
+ }
+ return extensions;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @customized
+ */
+ public void initializeAdapter() {
+ ExtensionmodelAdapterFactory factory = new ExtensionmodelAdapterFactory();
+ if (userAdapter == null)
+ userAdapter = (ExtendedObjectUserAdapter)factory.createEObjectAdapter();
+
+ userAdapter.setExtensionMap(this);
+
+ Set<EObject> extendedObjects = this.keySet();
+
+ for (Iterator<EObject> iter = extendedObjects.iterator(); iter.hasNext();) {
+ EObject element = iter.next();
+ adaptEObject(element,userAdapter);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class
baseClass, NotificationChain msgs) {
+ if (featureID >= 0) {
+ switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
+ case ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS:
+ return ((InternalEList)getExtensions()).basicRemove(otherEnd, msgs);
+ default:
+ return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
+ }
+ }
+ return eBasicSetContainer(null, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(EStructuralFeature eFeature, boolean resolve) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION_MAP__NAMESPACE:
+ return getNamespace();
+ case ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS:
+ return getExtensions();
+ }
+ return eDynamicGet(eFeature, resolve);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(EStructuralFeature eFeature, Object newValue) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION_MAP__NAMESPACE:
+ setNamespace((String)newValue);
+ return;
+ case ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS:
+ getExtensions().clear();
+ getExtensions().addAll((Collection)newValue);
+ return;
+ }
+ eDynamicSet(eFeature, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(EStructuralFeature eFeature) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION_MAP__NAMESPACE:
+ setNamespace(NAMESPACE_EDEFAULT);
+ return;
+ case ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS:
+ getExtensions().clear();
+ return;
+ }
+ eDynamicUnset(eFeature);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(EStructuralFeature eFeature) {
+ switch (eDerivedStructuralFeatureID(eFeature)) {
+ case ExtensionmodelPackage.EXTENSION_MAP__NAMESPACE:
+ return NAMESPACE_EDEFAULT == null ? namespace != null :
!NAMESPACE_EDEFAULT.equals(namespace);
+ case ExtensionmodelPackage.EXTENSION_MAP__EXTENSIONS:
+ return extensions != null && !extensions.isEmpty();
+ }
+ return eDynamicIsSet(eFeature);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (namespace: ");
+ result.append(namespace);
+ result.append(')');
+ return result.toString();
+ }
+
+
+
+ /**
+ * This is the Map entrySet.
+ * @param <K>
+ * @param <V>
+ */
+
+ public class EntrySet<K,V> extends
java.util.AbstractSet<Map.Entry<K,V>> {
+ /**
+ * ESet constructor comment.
+ */
+ protected EntrySet() {
+ super();
+ }
+
+ /**
+ * @see java.util.AbstractCollection#iterator()
+ */
+ @Override
+ public java.util.Iterator<Map.Entry<K,V>> iterator () {
+ return new EIterator<Map.Entry<K,V>> () {
+
+ @Override
+ protected Map.Entry<K,V> next(Extension extension) {
+ return new Entry (extension.getExtendedObject(), extension.getExtensionObject());
+ }
+ };
+ }
+
+ /**
+ * @see java.util.AbstractCollection#size()
+ */
+ @Override
+ public int size() {
+ int n=0;
+ for (Iterator<?> i=iterator(); i.hasNext(); ) {
+ i.next();
+ n++;
+ }
+ return n;
+ }
+ }
+
+ /**
+ * This is the Map entrySet.
+ */
+ public class KeySet extends java.util.AbstractSet<EObject> {
+
+ /**
+ * ESet constructor comment.
+ */
+ protected KeySet() {
+ super();
+ }
+
+
+ /**
+ * @see java.util.AbstractCollection#iterator()
+ */
+ @Override
+ public java.util.Iterator<EObject> iterator() {
+ return new EIterator<EObject>() {
+ @Override
+ protected EObject next (Extension extension) {
+ return extension.getExtendedObject();
+ }
+ };
+ }
+
+ /**
+ * @see java.util.AbstractCollection#size()
+ */
+ @Override
+ public int size() {
+ int n=0;
+ for (Iterator<?> i=iterator(); i.hasNext(); ) {
+ i.next();
+ n++;
+ }
+ return n;
+ }
+ }
+
+
+ /**
+ * This is the Map entrySet.
+ */
+
+ public class Values extends AbstractCollection<EObject> {
+ /**
+ * ESet constructor comment.
+ */
+ protected Values() {
+ super();
+ }
+
+ /**
+ * @see java.util.AbstractCollection#iterator()
+ */
+ @Override
+ public java.util.Iterator<EObject> iterator() {
+
+ return new EIterator<EObject>() {
+ @Override
+ protected EObject next (Extension extension) {
+ return extension.getExtensionObject() ;
+ }
+ };
+
+ }
+
+ /**
+ * @see java.util.AbstractCollection#size()
+ */
+ @Override
+ public int size() {
+ int n=0;
+ for (Iterator<?> i=iterator(); i.hasNext(); ) {
+ i.next();
+ n++;
+ }
+ return n;
+ }
+ }
+
+ /**
+ * This is the map entry iterator.
+ * @param <T>
+ */
+ public abstract class EIterator<T> implements java.util.Iterator<T> {
+ Iterator<Extension> fieldListIterator;
+ /**
+ * EIterator constructor comment.
+ */
+ public EIterator() {
+ super();
+ fieldListIterator = getExtensions().iterator();
+ }
+ /**
+ * Returns <tt>true</tt> if the iteration has more elements. (In other
+ * words, returns <tt>true</tt> if <tt>next</tt> would return
an element
+ * rather than throwing an exception.)
+ *
+ * @return <tt>true</tt> if the iterator has more elements.
+ */
+ public boolean hasNext() {
+ return fieldListIterator.hasNext();
+ }
+ /**
+ * Returns the next element in the iteration.
+ * @return the next element in the iteration.
+ * @exception NoSuchElementException iteration has no more elements.
+ */
+ public T next() {
+ Extension object = fieldListIterator.next();
+ if (object == null) {
+ return null;
+ }
+ return next (object);
+ }
+
+ protected abstract T next (Extension extension) ;
+
+ /**
+ *
+ * Removes from the underlying collection the last element returned by the
+ * iterator (optional operation). This method can be called only once per
+ * call to <tt>next</tt>. The behavior of an iterator is unspecified if
+ * the underlying collection is modified while the iteration is in
+ * progress in any way other than by calling this method.
+ *
+ * @exception UnsupportedOperationException if the <tt>remove</tt>
+ * operation is not supported by this Iterator.
+
+ * @exception IllegalStateException if the <tt>next</tt> method has not
+ * yet been called, or the <tt>remove</tt> method has already
+ * been called after the last call to the <tt>next</tt>
+ * method.
+ */
+ public void remove() {
+ fieldListIterator.remove();
+ }
+
+ }
+
+
+ /**
+ * Map entry.
+ * @param <K>
+ * @param <V>
+ */
+ public class Entry<K,V> implements Map.Entry<K,V> {
+ K key;
+ V value;
+
+ /**
+ * @param aKey
+ * @param aValue
+ */
+ public Entry (K aKey, V aValue) {
+ this.key = aKey;
+ this.value = aValue;
+ }
+
+ /**
+ * @see java.util.Map.Entry#getKey()
+ */
+ public K getKey() {
+ return key;
+ }
+
+ /**
+ * @see java.util.Map.Entry#getValue()
+ */
+ public V getValue() {
+ return value;
+ }
+
+ /**
+ * @see java.util.Map.Entry#setValue(java.lang.Object)
+ */
+ public V setValue(V aValue) {
+ V oldValue = this.value;
+ this.value = aValue;
+ return oldValue;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Map.Entry)) {
+ return false;
+ }
+
+ Map.Entry<?,?> e = (Map.Entry<?,?>) o;
+ return (key == null ? e.getKey() == null : key.equals(e.getKey())) && (value
== null ? e.getValue() == null : value.equals(e.getValue()));
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return key == null ? 0 : key.hashCode();
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public String toString() {
+ return key + "=" + value;
+ }
+ }
+
+ /**
+ * @see java.util.Map#size()
+ */
+ public int size() {
+ return getExtensions().size();
+ }
+
+ /** (non-Javadoc)
+ * @see java.util.Map#isEmpty()
+ */
+ public boolean isEmpty() {
+ return getExtensions().isEmpty();
+ }
+
+ /**
+ * @see java.util.Map#containsKey(java.lang.Object)
+ */
+ public boolean containsKey(Object extendedObject) {
+
+ if ( extendedObject != null ) {
+ for (Extension extension : getExtensions()) {
+ if(extension.getExtendedObject().equals(extendedObject)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see java.util.Map#containsValue(java.lang.Object)
+ */
+ public boolean containsValue (Object extensionObject) {
+
+ if (extensionObject != null) {
+ for (Extension extension : getExtensions()) {
+ if (extension.getExtensionObject().equals(extensionObject)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see java.util.Map#get(java.lang.Object)
+ * @generated NOT
+ */
+ public EObject get(Object extendedObject) {
+ EObject extension = null;
+
+ extension = getExtensionObject((EObject)extendedObject);
+ if (extension!=null) {
+ return ((Extension)extension).getExtensionObject();
+ }
+ return null;
+ }
+
+ /**
+ * @param extendedObject
+ * @param extensionObject
+ * @return the previous object
+ * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+ * @generated NOT
+ */
+ public EObject put(EObject extendedObject, EObject extensionObject) {
+
+ EObject originalObject = null;
+
+ if(extendedObject != null && extensionObject!= null){
+
+ Extension extension = getExtensionObject( extendedObject );
+
+ if(extension!= null)
+ originalObject = extension.getExtensionObject();
+ else {
+ extension = ExtensionmodelFactory.eINSTANCE.createExtension();
+ getExtensions().add(extension);
+ }
+
+ extension.setExtendedObject(extendedObject);
+ extension.setExtensionObject(extensionObject);
+
+ ExtensionmodelAdapterFactory adapterFactory = new ExtensionmodelAdapterFactory();
+
+ ExtendedObjectAdapter extAdptr = (ExtendedObjectAdapter)
adapterFactory.createExtendedObjectAdapter();
+
+ extAdptr.setExtension(extension);
+ extAdptr.setNamespace(getNamespace());
+
+ adaptEObject(extendedObject,extAdptr);
+
+ adapterFactory.adapt(extension,ExtensionAdapterImpl.class);
+
+ if(userAdapter == null)
+ initializeAdapter();
+ else
+ adaptEObject(extendedObject,userAdapter);
+
+ if (eNotificationRequired())
+ eNotify(new ExtensionModelNotificationImpl(this, Notification.ADD,
ExtensionModelNotification.EXTENSION_MAP_PUT, extendedObject, originalObject));
+
+ return originalObject;
+
+ }
+
+ return null;
+ }
+
+ /**
+ * @see java.util.Map#remove(java.lang.Object)
+ */
+ public EObject remove (Object extendedObject) {
+ if (extendedObject == null) {
+ return null;
+ }
+ Extension extensionObject = getExtensionObject((EObject)extendedObject);
+ if(getExtensions().contains(extensionObject)){
+ Object oldExtension = extensionObject.getExtensionObject();
+ getExtensions().remove(extensionObject);
+ if (eNotificationRequired())
+ eNotify(new ExtensionModelNotificationImpl(this, Notification.REMOVE,
ExtensionModelNotification.EXTENSION_MAP_REMOVE, extendedObject, oldExtension));
+ }
+
+ // Remove adapter if one exists
+ removeAdapters((EObject) extendedObject);
+
+ if(extensionObject != null) {
+ return extensionObject.getExtensionObject();
+ }
+
+ return null;
+ }
+
+ /**
+ * @see java.util.Map#putAll(java.util.Map)
+ */
+ public void putAll(Map<? extends EObject, ? extends EObject> extendedObjectMap) {
+
+ Map<EObject,EObject> originalMap = null;
+ if (eNotificationRequired()){
+ originalMap = buildMap();
+ }
+
+ if(extendedObjectMap != null && !extendedObjectMap.isEmpty()) {
+ for (Map.Entry<? extends EObject, ? extends EObject> entry :
extendedObjectMap.entrySet()) {
+ put(entry.getKey(),entry.getValue());
+ }
+ }
+
+ if (eNotificationRequired())
+ eNotify(new ExtensionModelNotificationImpl(this, Notification.ADD_MANY,
ExtensionModelNotification.EXTENSION_MAP_PUTALL, originalMap, null));
+
+ }
+
+ /**
+ * @see java.util.Map#clear()
+ */
+ public void clear() {
+ Map<EObject,EObject> originalMap = null;
+ if (eNotificationRequired() && !getExtensions().isEmpty()){
+ originalMap = buildMap();
+ }
+
+ getExtensions().clear();
+
+ if (originalMap != null){
+ int et = Notification.REMOVE_MANY;
+ if(originalMap.size() == 1)
+ et = Notification.REMOVE;
+
+ eNotify(new ExtensionModelNotificationImpl(this, et,
ExtensionModelNotification.EXTENSION_MAP_CLEAR, originalMap, null));
+ }
+ }
+
+ /**
+ * @see java.util.Map#keySet()
+ */
+ public Set<EObject> keySet() {
+ return new KeySet ();
+ }
+
+
+ /**
+ * @see java.util.Map#values()
+ */
+ public Collection<EObject> values() {
+ return new Values ();
+ }
+
+
+ /**
+ * @see java.util.Map#entrySet()
+ */
+ public Set<java.util.Map.Entry<EObject, EObject>> entrySet() {
+ return new EntrySet<EObject,EObject>();
+ }
+
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @customized
+ */
+ private Extension getExtensionObject (EObject extendedObject) {
+
+ Extension extension = null;
+
+ if (extendedObject!=null) {
+
+ // First check if the is an adapted associated with this object.
+ // If there is, the adapter points to the Extension object. Return this
+ // object.
+ for(Adapter element : extendedObject.eAdapters()) {
+ if(element instanceof ExtendedObjectAdapter &&
((ExtendedObjectAdapter)element).getNamespace().equals(getNamespace())){
+ extension = ((ExtendedObjectAdapter)element).getExtension();
+ break;
+ }
+ }
+
+ // Was the extension found though the adapter? Not if it's null.
+ // There is no adapter associated with this bject so we must search the
+ // Extension list. Once the Extension is found, associate an adapter with this
+ // object to improve performance in future queries.
+ if( extension == null){
+
+ for( Extension ext : getExtensions()) {
+ if (ext.getExtendedObject() != null &&
ext.getExtendedObject().equals(extendedObject)){
+ extension = ext;
+
+ ExtensionmodelAdapterFactory adapterFactory = new ExtensionmodelAdapterFactory();
+
+ ExtendedObjectAdapter extAdptr = (ExtendedObjectAdapter)
adapterFactory.createExtendedObjectAdapter();
+
+ extAdptr.setExtension(extension);
+ extAdptr.setNamespace(getNamespace());
+
+ ExtensionmodelFactory.eINSTANCE.adaptEObject(extendedObject,extAdptr);
+
+ adapterFactory.adapt(extension,ExtensionAdapterImpl.class);
+
+ break;
+ }
+
+ }
+ }
+ }
+
+ return extension;
+ }
+
+ /**
+ * @return ExtendedObjectUserAdapter
+ * @customized
+ */
+ public ExtendedObjectUserAdapter getUserAdapter() {
+ return userAdapter;
+ }
+
+ /**
+ * Method adaptEObject.
+ * This method associates an adapter to a model object.
+ * @param target - object to which the adaptor is to be associated
+ * @param adapter - adapter to asociate to target
+ * @customized
+ */
+ private void adaptEObject(EObject target, Adapter adapter) {
+
+ if(target != null && adapter != null){
+ for (Adapter next : target.eAdapters()) {
+ if ((adapter instanceof ExtendedObjectUserAdapter && next instanceof
ExtendedObjectUserAdapter &&
((ExtendedObjectUserAdapter)next).getNamespace().equals(getNamespace()))||
+ (adapter instanceof ExtendedObjectAdapter && next instanceof
ExtendedObjectAdapter &&
((ExtendedObjectAdapter)next).getNamespace().equals(getNamespace())))
+ return;
+ }
+
+ target.eAdapters().add(adapter);
+ }
+
+ }
+
+ /**
+ * @customized
+ */
+ private void removeAdapters(EObject target) {
+
+ if(target != null){
+ EList<Adapter> removeAdapterList = new BasicEList<Adapter>();
+ for (Adapter adapter : target.eAdapters()) {
+ if ((adapter instanceof ExtendedObjectUserAdapter &&
((ExtendedObjectUserAdapter)adapter).getNamespace().equals(getNamespace()))||
+ (adapter instanceof ExtendedObjectAdapter &&
((ExtendedObjectAdapter)adapter).getNamespace().equals(getNamespace())))
+ removeAdapterList.add(adapter);
+ }
+ for(Adapter next : removeAdapterList) {
+ target.eAdapters().remove(next);
+ }
+ }
+ }
+
+ private Map<EObject,EObject> buildMap(){
+
+ boolean buildMap = false;
+ for (Adapter element : eAdapters()) {
+ if(!(element instanceof ExtendedObjectAdapterImpl) &&
+ !(element instanceof ExtendedObjectUserAdapterImpl) &&
+ !(element instanceof ExtensionAdapterImpl) &&
+ !(element instanceof ExtensionMapAdapterImpl)){
+ buildMap = true;
+ break;
+ }
+ }
+
+ if(!buildMap)
+ return null;
+
+ Map<EObject,EObject> map = new HashMap<EObject,EObject>();
+ for (Extension element : getExtensions()) {
+ map.put(element.getExtendedObject(), element.getExtensionObject());
+ }
+ return map;
+ }
+
+
+
+
+
+} //ExtensionMapImpl
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelFactoryImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelFactoryImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelFactoryImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.impl;
+
+import java.util.Iterator;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelFactory;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+import org.eclipse.bpel.common.extension.model.adapters.ExtendedObjectUserAdapter;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtensionMapAdapterImpl;
+import org.eclipse.bpel.common.extension.model.util.ExtensionmodelAdapterFactory;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ExtensionmodelFactoryImpl extends EFactoryImpl implements
ExtensionmodelFactory {
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ExtensionmodelFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case ExtensionmodelPackage.EXTENSION_MAP: return createExtensionMap();
+ case ExtensionmodelPackage.EXTENSION: return createExtension();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() +
"' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ExtensionMap createExtensionMapGen() {
+ ExtensionMapImpl extensionMap = new ExtensionMapImpl();
+ return extensionMap;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Extension createExtension() {
+ ExtensionImpl extension = new ExtensionImpl();
+ return extension;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ExtensionmodelPackage getExtensionmodelPackage() {
+ return (ExtensionmodelPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static ExtensionmodelPackage getPackage() {
+ return ExtensionmodelPackage.eINSTANCE;
+ }
+
+ /**
+ * Method findExtensionSet.
+ * Given a namespace and the contents of a Resource (as an EList), this
+ * method will find the ExtensionMap object for the given namespace.
+ * <code>null</code> is returned if one doesn't exists
+ * @param namespace - ExtensionMap namespace
+ * @param contents - Resource contents
+ * @return ExtensionMap
+ * @customized
+ */
+ public ExtensionMap findExtensionMap(String namespace, EList contents) {
+
+ ExtensionMap extensionSet = null;
+
+ for (Iterator iter = contents.iterator(); iter.hasNext();) {
+ EObject element = (EObject) iter.next();
+
+ if(element instanceof ExtensionMap &&
((ExtensionMap)element).getNamespace().equals(namespace)){
+ extensionSet = (ExtensionMap)element;
+ }
+
+ }
+
+ if(extensionSet != null){
+ ExtensionmodelAdapterFactory adapterFactory = new ExtensionmodelAdapterFactory();
+ adapterFactory.adapt(extensionSet,ExtensionMapAdapterImpl.class);
+ }
+
+ return extensionSet;
+ }
+
+
+ /**
+ * @customized
+ */
+ public ExtensionMap createExtensionMap() {
+
+ ExtensionMap extensionMap = createExtensionMapGen();
+ ExtensionmodelAdapterFactory adapterFactory = new ExtensionmodelAdapterFactory();
+ adapterFactory.adapt(extensionMap,ExtensionMapAdapterImpl.class);
+
+ return extensionMap;
+ }
+
+ /**
+ * Method createExtensionSet.
+ * Creates an ExtensionMap object for the given namespace.
+ * @param namespace
+ * @return ExtensionMap
+ * @customized
+ */
+ public ExtensionMap createExtensionMap(String namespace) {
+
+ ExtensionMap extensionSet = ExtensionmodelFactory.eINSTANCE.createExtensionMap();
+
+ extensionSet.setNamespace(namespace);
+
+ return extensionSet;
+ }
+
+
+ /**
+ * Method adaptEObject.
+ * This method associates an adapter to a model object.
+ * @param target - object to which the adaptor is to be associated
+ * @param adapter - adapter to asociate to target
+ * @customized
+ */
+ public void adaptEObject(EObject target, Adapter adapter) {
+
+ for (Iterator adapters = target.eAdapters().iterator(); adapters.hasNext(); )
+ {
+ Adapter currAdapter = (Adapter)adapters.next();
+ if (currAdapter.equals(adapter))
+ {
+ return;
+ }
+ }
+
+ target.eAdapters().add(adapter);
+
+ }
+
+ /**
+ * @see
org.eclipse.bpel.common.extension.model.ExtensionmodelFactory#findExtensionSets(java.lang.String,
org.eclipse.emf.common.util.EList)
+ */
+ public EList findExtensionMaps(String namespace, EList contents) {
+ EList extensionSetList = new BasicEList();
+
+ for (Iterator iter = contents.iterator(); iter.hasNext();) {
+ EObject element = (EObject) iter.next();
+
+ if(element instanceof ExtensionMap &&
((ExtensionMap)element).getNamespace().equals(namespace)){
+ extensionSetList.add(element);
+ ExtensionmodelAdapterFactory adapterFactory = new ExtensionmodelAdapterFactory();
+ adapterFactory.adapt(element,ExtensionMapAdapterImpl.class);
+ }
+
+ }
+
+ return extensionSetList;
+ }
+
+ public Adapter getExtensionAdapter(EObject extendedObject, String namespace) {
+
+ EList adapterList = extendedObject.eAdapters();
+ for (Iterator iter = adapterList.iterator(); iter.hasNext();) {
+ Adapter element = (Adapter) iter.next();
+ if(element instanceof ExtendedObjectUserAdapter &&
((ExtendedObjectUserAdapter)element).getNamespace().equals(namespace)){
+ return element;
+ }
+ }
+ return null;
+ }
+
+
+
+} //ExtensionmodelFactoryImpl
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelPackageImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelPackageImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/impl/ExtensionmodelPackageImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.impl;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelFactory;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+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.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.ecore.impl.EcorePackageImpl;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ExtensionmodelPackageImpl extends EPackageImpl implements
ExtensionmodelPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass extensionMapEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass extensionEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private ExtensionmodelPackageImpl() {
+ super(eNS_URI, ExtensionmodelFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this
+ * model, and for any others upon which it depends. 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.
+ * <p>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.
+ * <p>Invocation of this method will not affect any packages that have
+ * already been initialized.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static ExtensionmodelPackage init() {
+ if (isInited) return
(ExtensionmodelPackage)EPackage.Registry.INSTANCE.get(ExtensionmodelPackage.eNS_URI);
+
+ // Obtain or create and register package.
+ ExtensionmodelPackageImpl theExtensionmodelPackage =
(ExtensionmodelPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EPackage ?
EPackage.Registry.INSTANCE.get(eNS_URI) : new ExtensionmodelPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackageImpl.init();
+
+ // Obtain or create and register interdependencies
+
+ // Step 1: create meta-model objects
+ theExtensionmodelPackage.createPackageContents();
+
+ // Step 2: complete initialization
+ theExtensionmodelPackage.initializePackageContents();
+
+ return theExtensionmodelPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getExtensionMap() {
+ return extensionMapEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getExtensionMap_Namespace() {
+ return (EAttribute)extensionMapEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getExtensionMap_Extensions() {
+ return (EReference)extensionMapEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getExtension() {
+ return extensionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getExtension_ExtendedObject() {
+ return (EReference)extensionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getExtension_ExtensionObject() {
+ return (EReference)extensionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ExtensionmodelFactory getExtensionmodelFactory() {
+ return (ExtensionmodelFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ extensionMapEClass = createEClass(EXTENSION_MAP);
+ createEAttribute(extensionMapEClass, EXTENSION_MAP__NAMESPACE);
+ createEReference(extensionMapEClass, EXTENSION_MAP__EXTENSIONS);
+
+ extensionEClass = createEClass(EXTENSION);
+ createEReference(extensionEClass, EXTENSION__EXTENDED_OBJECT);
+ createEReference(extensionEClass, EXTENSION__EXTENSION_OBJECT);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ EcorePackageImpl theEcorePackage =
(EcorePackageImpl)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(extensionMapEClass, ExtensionMap.class, "ExtensionMap",
!IS_ABSTRACT, !IS_INTERFACE);
+ initEAttribute(getExtensionMap_Namespace(), ecorePackage.getEString(),
"namespace", null, 0, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
!IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED);
+ initEReference(getExtensionMap_Extensions(), this.getExtension(), null,
"extensions", null, 0, -1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED);
+
+ addEOperation(extensionMapEClass, null, "initializeAdapter");
+
+ initEClass(extensionEClass, Extension.class, "Extension", !IS_ABSTRACT,
!IS_INTERFACE);
+ initEReference(getExtension_ExtendedObject(), theEcorePackage.getEObject(), null,
"extendedObject", null, 1, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
!IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED);
+ initEReference(getExtension_ExtensionObject(), theEcorePackage.getEObject(), null,
"extensionObject", null, 1, 1, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+} //ExtensionmodelPackageImpl
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/ExtensionModelNotification.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/ExtensionModelNotification.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/ExtensionModelNotification.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.notify;
+
+import org.eclipse.emf.common.notify.Notification;
+
+public interface ExtensionModelNotification extends Notification {
+
+ /**
+ * A fature ID indicating that the ExtensionMap.put(Object,Object) method
+ * has been called. Arg1 is set to extended object. Arg2 is set to the old
+ * extension object (if one exists).
+ */
+ int EXTENSION_MAP_PUT = 996;
+
+ /**
+ * A fature ID indicating that the ExtensionMap.putAll(Map) method has been
+ * called. Arg1 is set to the original map contents before the method is
+ * executed. Arg2 is null.
+ */
+ int EXTENSION_MAP_PUTALL = 997;
+
+ /**
+ * A fature ID indicating that the ExtensionMap.remove(Object) method has
+ * been called. Arg1 is set to the extended object being removed. Arg2 is
+ * set to the extension object corresponding to the extended object being
+ * removed.
+ */
+ int EXTENSION_MAP_REMOVE = 998;
+
+ /**
+ * A fature ID indicating that the ExtensionMap.clear() method has been
+ * called. Arg1 is set to the original map contents before the clear is
+ * executed. Arg2 is null.
+ */
+ int EXTENSION_MAP_CLEAR = 999;
+
+ /**
+ * The Object returned depends on the feature ID (see above).
+ *
+ * @return
+ */
+ Object getArg1();
+
+ /**
+ * The Object returned depends on the feature ID (see above).
+ *
+ * @return
+ */
+ Object getArg2();
+
+}
\ No newline at end of file
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/impl/ExtensionModelNotificationImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/impl/ExtensionModelNotificationImpl.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/notify/impl/ExtensionModelNotificationImpl.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 26, 2005
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.bpel.common.extension.model.notify.impl;
+
+import org.eclipse.bpel.common.extension.model.notify.ExtensionModelNotification;
+import org.eclipse.emf.common.notify.impl.NotificationImpl;
+import org.eclipse.emf.ecore.EObject;
+
+
+public class ExtensionModelNotificationImpl extends NotificationImpl implements
ExtensionModelNotification {
+
+ private EObject notifier = null;
+ private int featureID;
+ private Object arg1 = null;
+ private Object arg2 = null;
+
+ /**
+ * @param notifier - the EObject brodcasting the event
+ * @param eventType
+ * @param feature
+ * @param oldValue
+ * @param newValue
+ * @param isSetChange
+ */
+ public ExtensionModelNotificationImpl(EObject notifier, int eventType, int featureID,
Object arg1, Object arg2){
+ super(eventType,null, null);
+ this.featureID = featureID;
+ this.notifier = notifier;
+ this.arg1 = arg1;
+ this.arg2 = arg2;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.common.notify.Notification#getFeatureID(java.lang.Class)
+ */
+ @Override
+ public int getFeatureID(Class expectedClass) {
+ return featureID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.common.notify.Notification#getNotifier()
+ */
+ @Override
+ public Object getNotifier() {
+ return notifier;
+ }
+
+ public Object getArg1() {
+ return arg1;
+ }
+
+ public Object getArg2() {
+ return arg2;
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelAdapterFactory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelAdapterFactory.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelAdapterFactory.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.util;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtendedObjectAdapterImpl;
+import
org.eclipse.bpel.common.extension.model.adapters.impl.ExtendedObjectUserAdapterImpl;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtensionAdapterImpl;
+import org.eclipse.bpel.common.extension.model.adapters.impl.ExtensionMapAdapterImpl;
+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;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the
model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelPackage
+ * @generated
+ */
+public class ExtensionmodelAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static ExtensionmodelPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ExtensionmodelAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = ExtensionmodelPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the
model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ 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 <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ExtensionmodelSwitch modelSwitch =
+ new ExtensionmodelSwitch() {
+ @Override
+ public Object caseExtensionMap(ExtensionMap object) {
+ return createExtensionMapAdapter();
+ }
+ @Override
+ public Object caseExtension(Extension object) {
+ return createExtensionAdapter();
+ }
+ @Override
+ public Object defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return (Adapter)modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link
org.eclipse.bpel.common.extension.model.ExtensionMap <em>Extension
Map</em>}'.
+ * <!-- begin-user-doc -->
+ * 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.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.bpel.common.extension.model.ExtensionMap
+ * @generated
+ */
+ public Adapter createExtensionMapAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link
org.eclipse.bpel.common.extension.model.ExtensionMap <em>Extension
Set</em>}'.
+ * <!-- begin-user-doc -->
+ * 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.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.bpel.common.extension.model.ExtensionMap
+ * @customized
+ */
+ public Adapter createExtensionSetAdapter() {
+ return new ExtensionMapAdapterImpl();
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link
org.eclipse.bpel.common.extension.model.Extension <em>Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * 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.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.bpel.common.extension.model.Extension
+ * @customized
+ */
+ public Adapter createExtensionAdapter() {
+ return new ExtensionAdapterImpl();
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link
org.eclipse.bpel.common.extension.model.Extension <em>Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * 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.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.bpel.common.extension.model.Extension
+ * @customized
+ */
+ public Adapter createExtendedObjectAdapter() {
+ return new ExtendedObjectAdapterImpl();
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @customized
+ */
+ public Adapter createEObjectAdapter() {
+ return new ExtendedObjectUserAdapterImpl();
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelSwitch.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelSwitch.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.model/src/org/eclipse/bpel/common/extension/model/util/ExtensionmodelSwitch.java 2009-07-20
07:08:24 UTC (rev 16670)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpel.common.extension.model.util;
+
+import java.util.List;
+
+import org.eclipse.bpel.common.extension.model.Extension;
+import org.eclipse.bpel.common.extension.model.ExtensionMap;
+import org.eclipse.bpel.common.extension.model.ExtensionmodelPackage;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch doSwitch(object)}
+ * to invoke the <code>caseXXX</code> 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.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpel.common.extension.model.ExtensionmodelPackage
+ * @generated
+ */
+public class ExtensionmodelSwitch {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static ExtensionmodelPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ExtensionmodelSwitch() {
+ if (modelPackage == null) {
+ modelPackage = ExtensionmodelPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns
a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code>
call.
+ * @generated
+ */
+ public Object doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns
a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code>
call.
+ * @generated
+ */
+ protected Object doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns
a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code>
call.
+ * @generated
+ */
+ protected Object doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case ExtensionmodelPackage.EXTENSION_MAP: {
+ ExtensionMap extensionMap = (ExtensionMap)theEObject;
+ Object result = caseExtensionMap(extensionMap);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case ExtensionmodelPackage.EXTENSION: {
+ Extension extension = (Extension)theEObject;
+ Object result = caseExtension(extension);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpretting the object as an instance of
'<em>Extension Map</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpretting the object as an instance of
'<em>Extension Map</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public Object caseExtensionMap(ExtensionMap object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpretting the object as an instance of
'<em>Extension</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpretting the object as an instance of
'<em>Extension</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public Object caseExtension(Extension object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpretting the object as an instance of
'<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case
anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpretting the object as an instance of
'<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public Object defaultCase(EObject object) {
+ return null;
+ }
+
+}