tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: r379259 [2/7] - in /incubator/tuscany/sandbox/binding.axis2: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/binding/ src/main/java/org/apache/...
Date Mon, 20 Feb 2006 22:26:27 GMT
Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceAssemblyPackageImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceAssemblyPackageImpl.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceAssemblyPackageImpl.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceAssemblyPackageImpl.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,410 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.sdo.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl;
+import org.osoa.sca.model.WebServiceBinding;
+
+import org.apache.tuscany.binding.axis2.assembly.sdo.DocumentRoot;
+import org.apache.tuscany.binding.axis2.assembly.sdo.WebServiceAssemblyFactory;
+import org.apache.tuscany.binding.axis2.assembly.sdo.WebServiceAssemblyPackage;
+import org.apache.tuscany.model.assembly.sdo.AssemblyPackage;
+import org.apache.tuscany.model.assembly.sdo.impl.AssemblyPackageImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class WebServiceAssemblyPackageImpl extends EPackageImpl implements WebServiceAssemblyPackage {
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    private EClass documentRootEClass = null;
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    private EClass webServiceBindingEClass = 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 -->
+     *
+     * @generated
+     * @see org.eclipse.emf.ecore.EPackage.Registry
+     * @see org.apache.tuscany.binding.axis2.assembly.sdo.WebServiceAssemblyPackage#eNS_URI
+     * @see #init()
+     */
+    private WebServiceAssemblyPackageImpl() {
+        super(eNS_URI, WebServiceAssemblyFactory.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 -->
+     *
+     * @generated
+     * @see #eNS_URI
+     * @see #createPackageContents()
+     * @see #initializePackageContents()
+     */
+    public static WebServiceAssemblyPackage init() {
+        if (isInited) return (WebServiceAssemblyPackage) EPackage.Registry.INSTANCE.getEPackage(WebServiceAssemblyPackage.eNS_URI);
+
+        // Obtain or create and register package
+        WebServiceAssemblyPackageImpl theWebServiceAssemblyPackage = (WebServiceAssemblyPackageImpl) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof WebServiceAssemblyPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new WebServiceAssemblyPackageImpl());
+
+        isInited = true;
+
+        // Initialize simple dependencies
+        AssemblyPackageImpl.init();
+        XMLTypePackageImpl.init();
+
+        // Create package meta-data objects
+        theWebServiceAssemblyPackage.createPackageContents();
+
+        // Initialize created meta-data
+        theWebServiceAssemblyPackage.initializePackageContents();
+
+        // Mark meta-data to indicate it can't be changed
+        theWebServiceAssemblyPackage.freeze();
+
+        return theWebServiceAssemblyPackage;
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EClass getDocumentRoot() {
+        return documentRootEClass;
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EAttribute getDocumentRoot_Mixed() {
+        return (EAttribute) documentRootEClass.getEStructuralFeatures().get(0);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EReference getDocumentRoot_XMLNSPrefixMap() {
+        return (EReference) documentRootEClass.getEStructuralFeatures().get(1);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EReference getDocumentRoot_XSISchemaLocation() {
+        return (EReference) documentRootEClass.getEStructuralFeatures().get(2);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EReference getDocumentRoot_BindingWs() {
+        return (EReference) documentRootEClass.getEStructuralFeatures().get(3);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EClass getWebServiceBinding() {
+        return webServiceBindingEClass;
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EAttribute getWebServiceBinding_Any() {
+        return (EAttribute) webServiceBindingEClass.getEStructuralFeatures().get(0);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EAttribute getWebServiceBinding_Port() {
+        return (EAttribute) webServiceBindingEClass.getEStructuralFeatures().get(1);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public EAttribute getWebServiceBinding_AnyAttribute() {
+        return (EAttribute) webServiceBindingEClass.getEStructuralFeatures().get(2);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public WebServiceAssemblyFactory getWebServiceAssemblyFactory() {
+        return (WebServiceAssemblyFactory) 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
+        documentRootEClass = createEClass(DOCUMENT_ROOT);
+        createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED);
+        createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP);
+        createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION);
+        createEReference(documentRootEClass, DOCUMENT_ROOT__BINDING_WS);
+
+        webServiceBindingEClass = createEClass(WEB_SERVICE_BINDING);
+        createEAttribute(webServiceBindingEClass, WEB_SERVICE_BINDING__ANY);
+        createEAttribute(webServiceBindingEClass, WEB_SERVICE_BINDING__PORT);
+        createEAttribute(webServiceBindingEClass, WEB_SERVICE_BINDING__ANY_ATTRIBUTE);
+    }
+
+    /**
+     * <!-- 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 initializePackageContentsGen() {
+        if (isInitialized) return;
+        isInitialized = true;
+
+        // Initialize package
+        setName(eNAME);
+        setNsPrefix(eNS_PREFIX);
+        setNsURI(eNS_URI);
+
+        // Obtain other dependent packages
+        AssemblyPackageImpl theAssemblyPackage = (AssemblyPackageImpl) EPackage.Registry.INSTANCE.getEPackage(AssemblyPackage.eNS_URI);
+        XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl) EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
+
+        // Add supertypes to classes
+        webServiceBindingEClass.getESuperTypes().add(theAssemblyPackage.getBinding());
+
+        // Initialize classes and features; add operations and parameters
+        initEClass(documentRootEClass, DocumentRoot.class, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+        initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+        initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+        initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+        initEReference(getDocumentRoot_BindingWs(), this.getWebServiceBinding(), null, "bindingWs", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+
+        initEClass(webServiceBindingEClass, WebServiceBinding.class, "WebServiceBinding", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+        initEAttribute(getWebServiceBinding_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, WebServiceBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+        initEAttribute(getWebServiceBinding_Port(), theXMLTypePackage.getAnyURI(), "port", null, 1, 1, WebServiceBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+        initEAttribute(getWebServiceBinding_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, WebServiceBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+        // Create resource
+        createResource(eNS_URI);
+
+        // Create annotations
+        // http:///org/eclipse/emf/ecore/util/ExtendedMetaData
+        createExtendedMetaDataAnnotations();
+    }
+
+    /**
+     * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    protected void createExtendedMetaDataAnnotations() {
+        String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
+        addAnnotation
+                (documentRootEClass,
+                        source,
+                        new String[]{
+                                "name", "",
+                                "kind", "mixed"
+                        });
+        addAnnotation
+                (getDocumentRoot_Mixed(),
+                        source,
+                        new String[]{
+                                "kind", "elementWildcard",
+                                "name", ":mixed"
+                        });
+        addAnnotation
+                (getDocumentRoot_XMLNSPrefixMap(),
+                        source,
+                        new String[]{
+                                "kind", "attribute",
+                                "name", "xmlns:prefix"
+                        });
+        addAnnotation
+                (getDocumentRoot_XSISchemaLocation(),
+                        source,
+                        new String[]{
+                                "kind", "attribute",
+                                "name", "xsi:schemaLocation"
+                        });
+        addAnnotation
+                (getDocumentRoot_BindingWs(),
+                        source,
+                        new String[]{
+                                "kind", "element",
+                                "name", "binding.ws",
+                                "namespace", "##targetNamespace",
+                                "affiliation", "http://www.osoa.org/xmlns/sca/0.9#binding"
+                        });
+        addAnnotation
+                (webServiceBindingEClass,
+                        source,
+                        new String[]{
+                                "name", "WebServiceBinding",
+                                "kind", "elementOnly"
+                        });
+        addAnnotation
+                (getWebServiceBinding_Any(),
+                        source,
+                        new String[]{
+                                "kind", "elementWildcard",
+                                "wildcards", "##other",
+                                "name", ":1",
+                                "processing", "lax"
+                        });
+        addAnnotation
+                (getWebServiceBinding_Port(),
+                        source,
+                        new String[]{
+                                "kind", "attribute",
+                                "name", "port"
+                        });
+        addAnnotation
+                (getWebServiceBinding_AnyAttribute(),
+                        source,
+                        new String[]{
+                                "kind", "attributeWildcard",
+                                "wildcards", "##any",
+                                "name", ":3",
+                                "processing", "lax"
+                        });
+    }
+
+    /**
+     * Custom code
+     */
+
+    /**
+     * Initialize the package
+     */
+    public void initializePackageContents() {
+        initializePackageContentsGen();
+        AssemblyPackage.eINSTANCE.merge(this);
+	}
+
+} //WebServiceAssemblyPackageImpl

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceAssemblyPackageImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceAssemblyPackageImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceBindingImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceBindingImpl.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceBindingImpl.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceBindingImpl.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,295 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.sdo.impl;
+
+import java.util.Collection;
+
+import commonj.sdo.Sequence;
+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.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.sdo.util.BasicESequence;
+import org.eclipse.emf.ecore.sdo.util.ESequence;
+import org.eclipse.emf.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.osoa.sca.model.WebServiceBinding;
+
+import org.apache.tuscany.binding.axis2.assembly.sdo.WebServiceAssemblyPackage;
+import org.apache.tuscany.model.assembly.sdo.impl.BindingImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Web Service Binding</b></em>'.
+ * <!-- end-user-doc -->
+ * <p/>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link WebServiceBindingImpl#getAny <em>Any</em>}</li>
+ * <li>{@link WebServiceBindingImpl#getPort <em>Port</em>}</li>
+ * <li>{@link WebServiceBindingImpl#getAnyAttribute <em>Any Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class WebServiceBindingImpl extends BindingImpl implements WebServiceBinding {
+    /**
+     * The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     * @ordered
+     * @see #getAny()
+     */
+    protected ESequence any = null;
+
+    /**
+     * The default value of the '{@link #getPort() <em>Port</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     * @ordered
+     * @see #getPort()
+     */
+    protected static final String PORT_EDEFAULT = null;
+
+    /**
+     * The cached value of the '{@link #getPort() <em>Port</em>}' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     * @ordered
+     * @see #getPort()
+     */
+    protected String port = PORT_EDEFAULT;
+
+    /**
+     * The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     * @ordered
+     * @see #getAnyAttribute()
+     */
+    protected ESequence anyAttribute = null;
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    protected WebServiceBindingImpl() {
+        super();
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    protected EClass eStaticClass() {
+        return WebServiceAssemblyPackage.eINSTANCE.getWebServiceBinding();
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public Sequence getAny() {
+        if (any == null) {
+            any = new BasicESequence(new BasicFeatureMap(this, WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY));
+        }
+        return any;
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public String getPort() {
+        return port;
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public void setPort(String newPort) {
+        String oldPort = port;
+        port = newPort;
+        if (eNotificationRequired())
+            eNotify(new ENotificationImpl(this, Notification.SET, WebServiceAssemblyPackage.WEB_SERVICE_BINDING__PORT, oldPort, port));
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public Sequence getAnyAttribute() {
+        if (anyAttribute == null) {
+            anyAttribute = new BasicESequence(new BasicFeatureMap(this, WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY_ATTRIBUTE));
+        }
+        return anyAttribute;
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
+        if (featureID >= 0) {
+            switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
+            case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY:
+                return ((InternalEList) ((ESequence) getAny()).featureMap()).basicRemove(otherEnd, msgs);
+            case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY_ATTRIBUTE:
+                return ((InternalEList) ((ESequence) getAnyAttribute()).featureMap()).basicRemove(otherEnd, msgs);
+            default:
+                return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
+            }
+        }
+        return eBasicSetContainer(null, featureID, msgs);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public Object eGet(EStructuralFeature eFeature, boolean resolve) {
+        switch (eDerivedStructuralFeatureID(eFeature)) {
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__URI:
+            return getUri();
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY:
+            return ((ESequence) getAny()).featureMap();
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__PORT:
+            return getPort();
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY_ATTRIBUTE:
+            return ((ESequence) getAnyAttribute()).featureMap();
+        }
+        return eDynamicGet(eFeature, resolve);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public void eSet(EStructuralFeature eFeature, Object newValue) {
+        switch (eDerivedStructuralFeatureID(eFeature)) {
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__URI:
+            setUri((String) newValue);
+            return;
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY:
+            ((ESequence) getAny()).featureMap().clear();
+            ((ESequence) getAny()).featureMap().addAll((Collection) newValue);
+            return;
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__PORT:
+            setPort((String) newValue);
+            return;
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY_ATTRIBUTE:
+            ((ESequence) getAnyAttribute()).featureMap().clear();
+            ((ESequence) getAnyAttribute()).featureMap().addAll((Collection) newValue);
+            return;
+        }
+        eDynamicSet(eFeature, newValue);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public void eUnset(EStructuralFeature eFeature) {
+        switch (eDerivedStructuralFeatureID(eFeature)) {
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__URI:
+            setUri(URI_EDEFAULT);
+            return;
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY:
+            ((ESequence) getAny()).featureMap().clear();
+            return;
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__PORT:
+            setPort(PORT_EDEFAULT);
+            return;
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY_ATTRIBUTE:
+            ((ESequence) getAnyAttribute()).featureMap().clear();
+            return;
+        }
+        eDynamicUnset(eFeature);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     *
+     * @generated
+     */
+    public boolean eIsSet(EStructuralFeature eFeature) {
+        switch (eDerivedStructuralFeatureID(eFeature)) {
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__URI:
+            return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri);
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY:
+            return any != null && !any.featureMap().isEmpty();
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__PORT:
+            return PORT_EDEFAULT == null ? port != null : !PORT_EDEFAULT.equals(port);
+        case WebServiceAssemblyPackage.WEB_SERVICE_BINDING__ANY_ATTRIBUTE:
+            return anyAttribute != null && !anyAttribute.featureMap().isEmpty();
+        }
+        return eDynamicIsSet(eFeature);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public String toString() {
+        if (eIsProxy()) return super.toString();
+
+        StringBuffer result = new StringBuffer(super.toString());
+        result.append(" (any: ");
+        result.append(any);
+        result.append(", port: ");
+        result.append(port);
+        result.append(", anyAttribute: ");
+        result.append(anyAttribute);
+        result.append(')');
+        return result.toString();
+	}
+
+} //WebServiceBindingImpl

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceBindingImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/sdo/impl/WebServiceBindingImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/AxisEngineConfigurationFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/AxisEngineConfigurationFactory.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/AxisEngineConfigurationFactory.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/AxisEngineConfigurationFactory.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,228 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.entrypoint;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+import javax.servlet.ServletConfig;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.EngineConfigurationFactory;
+import org.apache.axis.configuration.FileProvider;
+import org.apache.axis.configuration.SimpleProvider;
+import org.apache.axis.constants.Style;
+import org.apache.axis.constants.Use;
+import org.apache.axis.description.JavaServiceDesc;
+import org.apache.axis.description.OperationDesc;
+import org.apache.axis.description.ParameterDesc;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.providers.java.MsgProvider;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.xsd.util.XSDConstants;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.model.Binding;
+import org.osoa.sca.model.EntryPoint;
+import org.osoa.sca.model.WebServiceBinding;
+
+import org.apache.tuscany.binding.axis2.utils.WebServiceOperationMetaData;
+import org.apache.tuscany.binding.axis2.utils.WebServicePortMetaData;
+import org.apache.tuscany.common.resource.loader.ResourceLoader;
+import org.apache.tuscany.core.context.TuscanyModuleComponentContext;
+import org.apache.tuscany.core.context.webapp.TuscanyWebAppRuntime;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.Interface;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.model.types.InterfaceType;
+import org.apache.tuscany.model.types.wsdl.WSDLTypeHelper;
+
+/**
+ */
+public class AxisEngineConfigurationFactory implements EngineConfigurationFactory {
+
+    private TuscanyWebAppRuntime tuscanyRuntime;
+
+    /**
+     * Constructor
+     *
+     */
+    public AxisEngineConfigurationFactory(TuscanyWebAppRuntime tuscanyRuntime) {
+        this.tuscanyRuntime = tuscanyRuntime;
+    }
+
+    /**
+     * Creates a new factory.
+     *
+     * @see org.apache.axis.configuration.EngineConfigurationFactoryFinder
+     */
+    public static EngineConfigurationFactory newFactory(Object param) {
+        if (param instanceof ServletConfig) {
+
+            // Only configure Tuscany apps
+            // Get the Tuscany runtime out of the servlet context
+            TuscanyWebAppRuntime tuscanyRuntime = (TuscanyWebAppRuntime) ((ServletConfig) param).getServletContext().getAttribute(TuscanyWebAppRuntime.class.getName());
+            if (tuscanyRuntime == null)
+                return null;
+
+            return new AxisEngineConfigurationFactory(tuscanyRuntime);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see org.apache.axis.EngineConfigurationFactory#getClientEngineConfig()
+     */
+    public EngineConfiguration getClientEngineConfig() {
+
+        // Used only on the server side
+        return null;
+    }
+
+    /**
+     * @see org.apache.axis.EngineConfigurationFactory#getServerEngineConfig()
+     */
+    public EngineConfiguration getServerEngineConfig() {
+
+        AssemblyFactory assemblyFactory = new AssemblyFactoryImpl();
+
+        // Get the current SCA module context
+        TuscanyModuleComponentContext moduleContext = tuscanyRuntime.getModuleComponentContext();
+        tuscanyRuntime.start();
+        try {
+
+            AssemblyModelContext modelContext = moduleContext.getAssemblyModelContext();
+            Module module = moduleContext.getModuleComponent().getModuleImplementation();
+
+            // Load the .wsdd configuration
+            ResourceLoader bundleContext = modelContext.getResourceLoader();
+            InputStream wsdd;
+            try {
+                URL url = bundleContext.getResource("org/apache/tuscany/binding/axis2/config/impl/server-config.wsdd");
+                wsdd = url.openStream();
+            } catch (IOException e1) {
+                throw new ServiceRuntimeException(e1);
+            }
+            FileProvider wsddConfigurationProvider = new FileProvider(wsdd);
+
+            // Create our dynamic configuration
+            SimpleProvider dynamicConfigurationProvider = new SimpleProvider(wsddConfigurationProvider);
+
+            // Register all the Web service entry points
+            for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
+                EntryPoint entryPoint = (EntryPoint) i.next();
+                Binding binding = (Binding) entryPoint.getBindings().get(0);
+                if (binding instanceof WebServiceBinding) {
+                    WebServiceBinding wsBinding = (WebServiceBinding) binding;
+                    QName qname = assemblyFactory.createQName(wsBinding.getPort());
+                    if (qname != null) {
+
+                        // Get the WSDL port and binding
+                        WSDLTypeHelper typeHelper = moduleContext.getAssemblyModelContext().getWSDLTypeHelper();
+
+                        Definition definition = typeHelper.getWSDLDefinition(qname.getNamespaceURI());
+                        if (definition == null) {
+                            throw new IllegalArgumentException("Unable to locate WSDL package for target namespace " + qname.getNamespaceURI());
+                        }
+
+                        WebServicePortMetaData wsdlPortInfo = new WebServicePortMetaData(typeHelper, definition, qname, null, false);
+
+                        // Create a new message SOAP service
+                        SOAPService service = new SOAPService(new MsgProvider());
+                        service.setOption(MsgProvider.OPTION_WSDL_TARGETNAMESPACE, wsdlPortInfo.getPortName().getNamespaceURI());
+                        service.setOption(MsgProvider.OPTION_WSDL_SERVICEELEMENT, wsdlPortInfo.getServiceName().getLocalPart());
+                        service.setOption(MsgProvider.OPTION_WSDL_SERVICEPORT, wsdlPortInfo.getPortName().getLocalPart());
+                        service.setOption(MsgProvider.OPTION_CLASSNAME, WebServiceEntryPointBean.class.getName());
+                        service.setOption(MsgProvider.OPTION_WSDL_PORTTYPE, wsdlPortInfo.getPortTypeName().getLocalPart());
+
+                        // Create a service description
+                        JavaServiceDesc serviceDesc = (JavaServiceDesc) service.getServiceDescription();
+                        serviceDesc.setName(entryPoint.getName());
+                        String wsdlFile = definition.getDocumentBaseURI();
+                        if (wsdlFile.startsWith("file:"))
+                            wsdlFile = wsdlFile.substring(5);
+                        serviceDesc.setWSDLFile(wsdlFile);
+                        serviceDesc.setDefaultNamespace(wsdlPortInfo.getPortName().getNamespaceURI());
+                        boolean rpcStyle = wsdlPortInfo.getStyle().equals(Style.RPC_STR);
+                        serviceDesc.setStyle(rpcStyle ? Style.RPC : Style.DOCUMENT);
+                        serviceDesc.setUse(wsdlPortInfo.getUse().equals(Use.ENCODED_STR) ? Use.ENCODED : Use.LITERAL);
+                        serviceDesc.setImplClass(WebServiceEntryPointBean.class);
+
+                        // Create operation descriptions for all the operations
+                        PortType wsdlPortType = wsdlPortInfo.getPortType();
+                        for (Iterator j = wsdlPortType.getOperations().iterator(); j.hasNext();) {
+                            Operation wsdlOperation = (Operation) j.next();
+                            String operationName = wsdlOperation.getName();
+
+                            OperationDesc operationDesc = new OperationDesc();
+                            operationDesc.setName(operationName);
+                            operationDesc.setMessageOperationStyle(OperationDesc.MSG_METHOD_SOAPENVELOPE);
+                            operationDesc.setMethod(WebServiceEntryPointBean.SERVICE_METHOD);
+                            String soapAction = wsdlPortInfo.getOperationMetaData(operationName).getSOAPAction();
+                            if (soapAction != null)
+                                operationDesc.setSoapAction(soapAction);
+
+                            if (rpcStyle) {
+                                operationDesc.setElementQName(new QName("", operationName));
+                            } else {
+                                WebServiceOperationMetaData operationMetaData = wsdlPortInfo.getOperationMetaData(operationName);
+                                operationDesc.setElementQName((QName) operationMetaData.getOperationSignature().get(0));
+                            }
+
+                            InterfaceType eClass = ((Interface) entryPoint.getInterface()).getInterfaceType();
+                            EOperation eOperation = (EOperation) eClass.getOperationType(wsdlOperation.getName());
+                            if (eOperation.getEParameters().size() != 0) {
+                                ParameterDesc parameterDesc = new ParameterDesc();
+                                QName anyQName = new QName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "any");
+                                parameterDesc.setTypeQName(anyQName);
+                                parameterDesc.setQName(anyQName);
+                                parameterDesc.setJavaType(Object.class);
+                                operationDesc.addParameter(parameterDesc);
+                            }
+
+                            if (eOperation.getEType() != null) {
+                                QName anyQName = new QName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "any");
+                                operationDesc.setReturnType(anyQName);
+                                operationDesc.setReturnQName(anyQName);
+                                operationDesc.setReturnClass(Object.class);
+                            }
+
+                            serviceDesc.addOperationDesc(operationDesc);
+                        }
+
+                        // Deploy the service
+                        dynamicConfigurationProvider.deployService(entryPoint.getName(), service);
+                    }
+
+                }
+            }
+            return dynamicConfigurationProvider;
+
+        } finally {
+            tuscanyRuntime.stop();
+        }
+
+    }
+
+}

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/AxisEngineConfigurationFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/AxisEngineConfigurationFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/EntryPointMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/EntryPointMessageReceiver.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/EntryPointMessageReceiver.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/EntryPointMessageReceiver.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,15 @@
+package org.apache.tuscany.binding.axis2.entrypoint;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.MessageReceiver;
+
+/**
+ * An Axis2 MessageReciever that dispatches requests to the Tuscany runtime
+ */
+public class EntryPointMessageReceiver implements MessageReceiver {
+
+    public void receive(MessageContext mc) throws AxisFault {
+    }
+
+}

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/EntryPointMessageReceiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/EntryPointMessageReceiver.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/MyAxisConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/MyAxisConfigurator.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/MyAxisConfigurator.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/MyAxisConfigurator.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,13 @@
+package org.apache.tuscany.binding.axis2.entrypoint;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurator;
+
+public class MyAxisConfigurator implements AxisConfigurator {
+
+    public AxisConfiguration getAxisConfiguration() throws AxisFault {
+        return new AxisConfiguration();
+    }
+
+}

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/MyAxisConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/MyAxisConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointBean.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointBean.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointBean.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointBean.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,325 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.entrypoint;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.SOAPBody;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.tuscany.binding.axis2.serialization.mediator.SOAPMediator;
+import org.apache.tuscany.binding.axis2.serialization.mediator.impl.SOAPDocumentLiteralMediatorImpl;
+import org.apache.tuscany.binding.axis2.serialization.mediator.impl.SOAPEnvelopeImpl;
+import org.apache.tuscany.binding.axis2.serialization.mediator.impl.SOAPRPCEncodedMediatorImpl;
+import org.apache.tuscany.binding.axis2.serialization.mediator.impl.SOAPRPCLiteralMediatorImpl;
+import org.apache.tuscany.binding.axis2.utils.WSDLOperationTypeHelper;
+import org.apache.tuscany.binding.axis2.utils.WebServiceOperationMetaData;
+import org.apache.tuscany.binding.axis2.utils.WebServicePortMetaData;
+import org.apache.tuscany.core.addressing.EndpointReference;
+import org.apache.tuscany.core.addressing.impl.AddressingFactoryImpl;
+import org.apache.tuscany.core.context.TuscanyModuleComponentContext;
+import org.apache.tuscany.core.deprecated.sdo.util.HelperProvider;
+import org.apache.tuscany.core.deprecated.sdo.util.impl.HelperProviderImpl;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.impl.MessageFactoryImpl;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Interface;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ServiceURI;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.model.types.InterfaceType;
+import org.apache.tuscany.model.types.wsdl.WSDLInterfaceType;
+import org.apache.tuscany.model.types.wsdl.WSDLOperationType;
+import org.apache.tuscany.model.types.wsdl.WSDLTypeHelper;
+import org.apache.tuscany.model.util.ConfiguredResourceSet;
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.model.WebServiceBinding;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+/**
+ *         <p/>
+ *         Bean implementation class for web service entry points..
+ */
+public class WebServiceEntryPointBean implements ServiceLifecycle {
+    private TuscanyModuleComponentContext moduleContext;
+    private WSDLInterfaceType interfaceType;
+    private WebServicePortMetaData portMetaData;
+    private EndpointReference toEndpointReference;
+    private EndpointReference fromEndpointReference;
+    private Object proxy;
+    private Map<String, Method> methodMap;
+
+    public final static Method SERVICE_METHOD = getServiceMethod();
+
+    private static Method getServiceMethod() {
+        try {
+            return WebServiceEntryPointBean.class.getMethod("processSOAPEnvelope", new Class[]{SOAPEnvelope.class, SOAPEnvelope.class});
+        } catch (Throwable e) {
+            return null;
+        }
+    }
+
+    /**
+     * Constructor.
+     */
+    public WebServiceEntryPointBean() {
+    }
+
+    /**
+     * @see javax.xml.rpc.server.ServiceLifecycle#init(java.lang.Object)
+     */
+    public void init(Object context) throws ServiceException {
+        if (context instanceof ServletEndpointContext) {
+
+            // Get the export name (the target service name) from the message context
+            MessageContext messageContext = (MessageContext) (((ServletEndpointContext) context).getMessageContext());
+
+            // Initialize
+            initialize(messageContext.getTargetService());
+        }
+    }
+
+    /**
+     * @see javax.xml.rpc.server.ServiceLifecycle#destroy()
+     */
+    public void destroy() {
+    }
+
+    /**
+     * Initialize.
+     */
+    protected void initialize(String entryPointName) {
+        try {
+
+            // Get the current module component, module and entry point
+            moduleContext = (TuscanyModuleComponentContext) CurrentModuleContext.getContext();
+
+            Module module = moduleContext.getModuleComponent().getModuleImplementation();
+            EntryPoint entryPoint = module.getEntryPoint(entryPointName);
+            if (entryPoint == null) {
+                throw new ServiceRuntimeException("Entry point not found: " + entryPointName);
+            }
+
+            // Get the target service
+            ConfiguredReference referenceValue = entryPoint.getConfiguredReference();
+            ConfiguredService targetServiceEndpoint = referenceValue.getConfiguredServices().get(0);
+
+            // Create a service reference for the target  service
+            AssemblyFactory assemblyFactory = new AssemblyFactoryImpl();
+            toEndpointReference = new AddressingFactoryImpl().createEndpointReference();
+            //FIXME
+            //toEndpointReference.setModuleContext(moduleContext);
+            ServiceURI serviceAddress = assemblyFactory.createServiceURI(moduleContext.getModuleComponent(), targetServiceEndpoint);
+            toEndpointReference.setAddress(serviceAddress.getAddress());
+
+            // Get the entry point interface
+            Interface serviceInterface = entryPoint.getInterfaceContract();
+            InterfaceType interfaceEClass = serviceInterface.getInterfaceType();
+            if (interfaceEClass != null)
+                toEndpointReference.setPortTypeName(serviceInterface.getInterface());
+
+            // Create the target service
+            //FIXME
+            //toEndpointReference.getService();
+
+            // Create a service reference for the entry point itself
+            fromEndpointReference = new AddressingFactoryImpl().createEndpointReference();
+            //FIXME
+            //fromEndpointReference.setModuleContext(moduleContext);
+            ServiceURI fromAddress = assemblyFactory.createServiceURI(moduleContext.getModuleComponent(), entryPoint.getConfiguredReference());
+            fromEndpointReference.setAddress(fromAddress.getAddress());
+
+            // Get the WSDL port name
+            WebServiceBinding wsBinding = (WebServiceBinding) entryPoint.getBindings().get(0);
+            QName wsdlPortName = assemblyFactory.createQName(wsBinding.getPort());
+
+            WSDLTypeHelper typeHelper = moduleContext.getAssemblyModelContext().getWSDLTypeHelper();
+
+            // Get the WSDL definition for this port
+            Definition definition = typeHelper.getWSDLDefinition(wsdlPortName.getNamespaceURI());
+            if (definition == null) {
+                throw new IllegalArgumentException("Unable to locate WSDL package for target namespace " + wsdlPortName.getNamespaceURI());
+            }
+
+            // Create a port info object to hold the WSDL port info
+            portMetaData = new WebServicePortMetaData(typeHelper, definition, wsdlPortName, null, true);
+
+            // Get the EInterface representing the WSDL portType
+            QName portTypeName = portMetaData.getPortTypeName();
+            interfaceType = typeHelper.getWSDLInterfaceType(portTypeName);
+            if (interfaceType == null) {
+                throw new ServiceRuntimeException("Unable to get metadata for WSDL portType " + portTypeName);
+            }
+
+            // Create a proxy
+            ProxyFactory proxyFactory = (ProxyFactory) targetServiceEndpoint.getProxyFactory();
+            proxy = proxyFactory.createProxy();
+            Method[] methods = proxy.getClass().getMethods();
+            methodMap = new HashMap<String, Method>();
+            for (int i = 0; i < methods.length; i++) {
+                methodMap.put(methods[i].getName(), methods[i]);
+            }
+
+        } catch (Exception e) {
+            throw new ServiceRuntimeException(e);
+        }
+    }
+
+    /**
+     * Process the SOAP envelope passed by the Axis runtime
+     *
+     * @param requestEnvelope
+     */
+    public void processSOAPEnvelope(SOAPEnvelope requestEnvelope, SOAPEnvelope responseEnvelope) {
+        try {
+
+            // Get the SOAP body
+            SOAPBody soapBody = (SOAPBody) requestEnvelope.getBody();
+
+            WebServiceOperationMetaData operationMetaData = portMetaData.getOperationMetaData(soapBody);
+            if (operationMetaData == null) {
+                throw new IllegalArgumentException("Failed to resolve operation: " + soapBody);
+            }
+            // Get the WSDL operation
+            Operation wsdlOperation = operationMetaData.getBindingOperation().getOperation();
+
+            String operationName = wsdlOperation.getName();
+            WSDLOperationType operationType = (WSDLOperationType) interfaceType.getOperationType(operationName);
+
+            // Create the appropriate mediator
+            boolean rpcEncoded = operationMetaData.getUse().equals("encoded");
+            SOAPMediator mediator;
+            if (operationMetaData.getStyle().equals("rpc")) {
+                if (rpcEncoded) {
+                    mediator = new SOAPRPCEncodedMediatorImpl(portMetaData);
+                } else {
+                    mediator = new SOAPRPCLiteralMediatorImpl(portMetaData);
+                }
+            } else {
+                mediator = new SOAPDocumentLiteralMediatorImpl(portMetaData);
+            }
+
+            // Read the SOAP envelope into an SCA message
+            Message message = new MessageFactoryImpl().createMessage();
+            mediator.readRequest(moduleContext, requestEnvelope, message, operationType);
+
+            // Set the message ID
+            message.setMessageID(new AddressingFactoryImpl().createMessageID());
+
+            // Set the action header
+            message.setAction(operationName);
+            message.setOperationName(operationName);
+
+            // Set the endpoint reference header
+            message.setEndpointReference(toEndpointReference);
+
+            // Set the callback endpoint reference
+            message.setFrom(fromEndpointReference);
+
+            Object[] args = getRequest(message, operationType);
+            Object result = methodMap.get(operationName).invoke(proxy, args);
+
+            // Send the message
+            Message responseMessage = createResponseMessage(moduleContext, operationType, result);
+
+            // Write the response message into the response SOAP envelope
+            SOAPEnvelope tempEnvelope = new SOAPEnvelopeImpl();
+            mediator.writeResponse(moduleContext, responseMessage, operationType, tempEnvelope);
+            for (Iterator i = tempEnvelope.getHeader().getChildElements(); i.hasNext();) {
+                responseEnvelope.getHeader().addChildElement((MessageElement) i.next());
+            }
+            for (Iterator i = tempEnvelope.getBody().getChildElements(); i.hasNext();) {
+                responseEnvelope.getBody().addChildElement((MessageElement) i.next());
+            }
+
+        } catch (Throwable e) {
+            if (e instanceof ServiceRuntimeException) {
+                throw (ServiceRuntimeException) e;
+            }
+
+            throw new ServiceRuntimeException(e);
+        }
+    }
+
+    private Object[] getRequest(Message requestMessage, WSDLOperationType wsdlOperationType) {
+        Object request = requestMessage.getBody();
+        if (request == null)
+            return null;
+
+        List properties = wsdlOperationType.getInputType().getProperties();
+        if (WSDLOperationTypeHelper.isWrappedStyle(wsdlOperationType)) {
+            DataObject inputPart = ((DataObject) request).getDataObject(0); // Get the single part
+            Property property = (Property) properties.get(0); // Type of the part
+            List argList = property.getType().getProperties();
+            Object[] results = new Object[argList.size()];
+            for (int i = 0; i < results.length; i++) {
+                // Each property of the part is corresponding to an argument
+                results[i] = inputPart.get(i);
+            }
+            return results;
+        } else {
+            DataObject inputMessage = (DataObject) request;
+            Object[] results = new Object[properties.size()];
+            for (int i = 0; i < results.length; i++) {
+                // Each part is a property of the request message
+                results[i] = inputMessage.get(i);
+            }
+            return results;
+        }
+    }
+
+    private Message createResponseMessage(TuscanyModuleComponentContext context, WSDLOperationType operationType, Object response) {
+        Message message = new MessageFactoryImpl().createMessage();
+        HelperProvider provider = new HelperProviderImpl((ConfiguredResourceSet) context.getAssemblyModelContext().getAssemblyLoader());
+        Type outputType = operationType.getOutputType();
+        DataObject outputBody = provider.getDataFactory().create(outputType);
+
+        DataObject outputData = null;
+        if (WSDLOperationTypeHelper.isWrappedStyle(operationType)) {
+            outputData = outputBody.createDataObject(0);
+        } else {
+            outputData = outputBody;
+        }
+
+        // FIXME: Assume only one part output
+        outputData.set(0, response);
+
+        message.setBody(outputBody);
+        return message;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,81 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.entrypoint;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.AxisFault;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.server.AxisServer;
+import org.apache.axis.transport.http.AxisServlet;
+
+import org.apache.tuscany.core.context.webapp.TuscanyWebAppRuntime;
+
+/**
+ */
+public class WebServiceEntryPointServlet extends AxisServlet {
+
+    /**
+     *
+     */
+    public WebServiceEntryPointServlet() {
+        super();
+    }
+
+    /**
+     * @see org.apache.axis.transport.http.AxisServletBase#getEngine()
+     */
+    public AxisServer getEngine() throws AxisFault {
+        AxisServer engine = null;
+        ServletContext context = getServletContext();
+        synchronized (context) {
+            engine = (AxisServer) getServletContext().getAttribute(getServletName() + ".WebServiceEntryPointAxisEngine");
+            if (engine == null) {
+                Map environment = new HashMap();
+                environment.put(AxisEngine.ENV_SERVLET_CONTEXT, context);
+                String webInfPath = context.getRealPath("/WEB-INF");
+                if (webInfPath != null)
+                    environment.put(AxisEngine.ENV_SERVLET_REALPATH, webInfPath + File.separator + "attachments");
+                TuscanyWebAppRuntime tuscanyRuntime = (TuscanyWebAppRuntime) context.getAttribute(TuscanyWebAppRuntime.class.getName());
+                EngineConfiguration config = new AxisEngineConfigurationFactory(tuscanyRuntime).getServerEngineConfig();
+                if (config != null) {
+                    environment.put(EngineConfiguration.PROPERTY_NAME, config);
+                }
+                engine = AxisServer.getServer(environment);
+                engine.setName(getServletName());
+                context.setAttribute(getServletName() + ".WebServiceEntryPointAxisEngine", engine);
+            }
+        }
+        return engine;
+    }
+
+    /**
+     * @see org.apache.axis.transport.http.AxisServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    public void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
+        super.doPost(arg0, arg1);
+    }
+
+}

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceConfigurationHandler.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceConfigurationHandler.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceConfigurationHandler.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceConfigurationHandler.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,93 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.externalservice;
+
+import java.util.Map;
+
+import org.apache.tuscany.core.addressing.EndpointReference;
+import org.apache.tuscany.core.context.TuscanyModuleComponentContext;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.handler.MessageHandler;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Interface;
+import org.apache.tuscany.model.assembly.Part;
+import org.apache.tuscany.model.types.InterfaceType;
+import org.apache.tuscany.model.types.OperationType;
+import org.apache.tuscany.model.types.wsdl.WSDLOperationType;
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.model.WebServiceBinding;
+
+/**
+ */
+public class ExternalWebServiceConfigurationHandler implements MessageHandler {
+    /**
+     * Constructor.
+     */
+    public ExternalWebServiceConfigurationHandler() {
+        super();
+    }
+
+    /**
+     * @see org.apache.tuscany.core.message.handler.MessageHandler#processMessage(org.apache.tuscany.core.message.Message)
+     */
+    public boolean processMessage(Message message) {
+        // Get the endpoint reference of the target service and the service model element
+        EndpointReference endpointReference = message.getEndpointReference();
+        Object portEndpoint = endpointReference.getConfiguredPort();
+
+        // Return immediately if the target is not an external service
+        if (!(portEndpoint instanceof ConfiguredService))
+            return false;
+        ConfiguredService serviceEndpoint = (ConfiguredService) portEndpoint;
+        Part part = serviceEndpoint.getPart();
+        if (!(part instanceof ExternalService))
+            return false;
+        ExternalService externalService = (ExternalService) part;
+
+        // Return immediately if this is not an external web service
+        Binding binding = externalService.getBindings().get(0);
+        if (!(binding instanceof WebServiceBinding))
+            return false;
+        WebServiceBinding wsBinding = (WebServiceBinding) binding;
+
+        TuscanyModuleComponentContext context = (TuscanyModuleComponentContext) CurrentModuleContext.getContext();
+
+        // Get the proxy configuration
+        ProxyConfiguration proxyConfiguration=(ProxyConfiguration)message.getBody();
+        Map<OperationType, InvocationConfiguration> invocationConfigurations=proxyConfiguration.getInvocationConfigurations();
+
+        // Get the business interface
+        Interface targetInterface = serviceEndpoint.getService().getInterfaceContract();
+        InterfaceType targetInterfaceType = targetInterface.getInterfaceType();
+
+        // Create the invocation configurations
+        for (InvocationConfiguration invocationConfiguration : invocationConfigurations.values()) {
+            OperationType targetOperationType=targetInterfaceType.getOperationType(invocationConfiguration.getOperationType().getName());
+
+            // Handle a business method invocation, get a message handler from the port
+            ExternalWebServiceHandler handler = new ExternalWebServiceHandler(context, (WSDLOperationType) targetOperationType, externalService, wsBinding, endpointReference);
+            invocationConfiguration.addRequestHandler(handler);
+        }
+
+        return false;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceConfigurationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceConfigurationHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceHandler.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceHandler.java?rev=379259&view=auto
==============================================================================
--- incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceHandler.java (added)
+++ incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceHandler.java Mon Feb 20 14:26:19 2006
@@ -0,0 +1,223 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.externalservice;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.om.OMElement;
+import org.apache.tuscany.binding.axis2.serialization.Axis2SDOHelper;
+import org.apache.tuscany.binding.axis2.utils.WebServiceOperationMetaData;
+import org.apache.tuscany.binding.axis2.utils.WebServicePortMetaData;
+import org.apache.tuscany.core.addressing.EndpointReference;
+import org.apache.tuscany.core.context.TuscanyModuleComponentContext;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.handler.MessageHandler;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.model.types.wsdl.WSDLOperationType;
+import org.apache.tuscany.model.types.wsdl.WSDLTypeHelper;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.osoa.sca.model.WebServiceBinding;
+
+import commonj.sdo.Type;
+
+/**
+ * 
+ */
+public class ExternalWebServiceHandler implements MessageHandler {
+
+    private WebServicePortMetaData portMetaData;
+    private WSDLTypeHelper typeHelper;
+    private WSDLOperationType wsdlOperationType;
+    private WebServiceOperationMetaData operationMetaData;
+    private org.apache.axis2.addressing.EndpointReference targetEPR;
+    private Axis2SDOHelper axis2SDOHelper;
+
+    public ExternalWebServiceHandler(TuscanyModuleComponentContext moduleContext, WSDLOperationType operationType, ExternalService externalService,
+            WebServiceBinding wsBinding, EndpointReference endpointReference) {
+
+        this.typeHelper = moduleContext.getAssemblyModelContext().getWSDLTypeHelper();
+        this.wsdlOperationType = operationType;
+
+        // Get the WSDL port name
+        String portName = wsBinding.getPort();
+        if (portName != null) {
+            createPortMetaDataFromWSBinding(wsBinding, portName);
+        } else {
+            createPortMetaDataFromEPR(endpointReference);
+        }
+
+        this.operationMetaData = portMetaData.getOperationMetaData(wsdlOperationType.getName());
+
+        String endpoint = portMetaData.getEndpoint();
+        if (endpoint == null) {
+            endpoint = wsBinding.getUri();
+        }
+        this.targetEPR = new org.apache.axis2.addressing.EndpointReference(endpoint);
+
+        axis2SDOHelper = new Axis2SDOHelper(moduleContext, portMetaData, wsdlOperationType, operationMetaData);
+
+    }
+
+    /**
+     * @see org.apache.tuscany.core.message.handler.MessageHandler#processMessage(org.apache.tuscany.core.message.Message)
+     */
+    public boolean processMessage(Message requestMsg) {
+
+        ServiceClient serviceClient = createServiceClient();
+
+        OMElement requestOM = axis2SDOHelper.getRequestAsOMElement(requestMsg);
+
+        OMElement responseOM;
+        try {
+            responseOM = serviceClient.sendReceive(requestOM);
+        } catch (AxisFault e) {
+            throw new RuntimeException(e);
+        }
+
+        Message responseMessage = axis2SDOHelper.getResponseAsMessage(responseOM);
+
+        responseMessage.setRelatesTo(requestMsg.getMessageID());
+        responseMessage.setMessageID(EcoreUtil.generateUUID());
+        responseMessage.setEndpointReference(requestMsg.getReplyTo());
+
+        requestMsg.getCallbackChannel().send(responseMessage);
+
+        return false;
+    }
+
+    private ServiceClient createServiceClient() throws FactoryConfigurationError {
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+
+        options.setProperty(Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+
+        // If use is encoded assume its an old style service and wont understand chunking
+        if ("encoded".equals(operationMetaData.getUse())) {
+            options.setProperty(MessageContextConstants.CHUNKED, Boolean.FALSE);
+        }
+
+        String soapAction = getSOAPAction();
+        if (soapAction != null) {
+            options.setSoapAction(soapAction);
+        }
+
+        ServiceClient serviceClient;
+        try {
+            serviceClient = new ServiceClient();
+        } catch (org.apache.axis2.AxisFault e) {
+            throw new RuntimeException(e);
+        }
+        serviceClient.setOptions(options);
+
+        return serviceClient;
+    }
+
+    private String getSOAPAction() {
+        String soapAction;
+        Port wsdlPort = portMetaData.getPort();
+        if (wsdlPort != null) {
+            WebServiceOperationMetaData operationMetaData = portMetaData.getOperationMetaData(wsdlOperationType.getName());
+            soapAction = operationMetaData.getSOAPAction();
+        } else {
+            // No WSDL binding, assume a default SOAP document literal binding from the operation type
+            // Derive the SOAP action from the input type
+            String namespace;
+            String name;
+            if (wsdlOperationType.getInputType() != null) {
+                Type type = wsdlOperationType.getInputType();
+                namespace = type.getURI();
+                name = type.getName();
+
+                // TODO: [rfeng]
+                // XSD2Ecore will create an extended metadata for anonymous complex type with key name
+                // and value <elementName>_._type or <elementName>_._<index>_._type" if there's
+                // a duplicate
+
+                if (name.indexOf("_._") != -1)
+                    name = name.substring(0, name.indexOf("_._"));
+
+            } else {
+
+                // Derive the SOAP action from the operation name
+                // FIXME:
+                namespace = "";
+                name = wsdlOperationType.getName();
+            }
+            soapAction = namespace + '/' + name;
+        }
+        return soapAction;
+    }
+
+    private void createPortMetaDataFromEPR(EndpointReference endpointReference) {
+
+        // No port is specified in the wsBinding, we are expecting the endpoint reference to specify the
+        // service name, port name and endpoint
+
+        // Get the port type name, service name, port name, and endpoint address from the
+        // endpoint reference
+        AssemblyFactory assemblyFactory = new AssemblyFactoryImpl();
+        QName wsdlServiceName = assemblyFactory.createQName(endpointReference.getServiceName());
+        String wsdlPortName = endpointReference.getPortName();
+        QName wsdlPortTypeName = assemblyFactory.createQName(endpointReference.getPortTypeName());
+        String endpoint = endpointReference.getAddress();
+
+        // If a service name and/or port name are specified then look up the port
+        if (wsdlServiceName != null && wsdlPortName != null) {
+            String nsUri = wsdlServiceName.getNamespaceURI();
+            Definition wsdlDefinition = typeHelper.getWSDLDefinition(nsUri);
+
+            // Create a port info object to hold the port information
+            portMetaData = new WebServicePortMetaData(typeHelper, wsdlDefinition, new QName(wsdlServiceName.getNamespaceURI(), wsdlPortName),
+                    endpoint, false);
+
+        } else {
+
+            // Create default service and port names
+            if (wsdlServiceName == null)
+                wsdlServiceName = new QName("http://tempuri.org", "TempService");
+            if (wsdlPortName == null)
+                wsdlPortName = "TempPort";
+
+            // Create a port info object to hold the port information
+            portMetaData = new WebServicePortMetaData(wsdlServiceName, wsdlPortName, wsdlPortTypeName, endpoint);
+        }
+    }
+
+    private void createPortMetaDataFromWSBinding(WebServiceBinding wsBinding, String portName) {
+        // A port name is specified, create a port handler for this port and cache it in the binding model
+        AssemblyFactory assemblyFactory = new AssemblyFactoryImpl();
+        QName wsdlPortName = assemblyFactory.createQName(portName);
+        Definition wsdlDefinition = typeHelper.getWSDLDefinition(wsdlPortName.getNamespaceURI());
+        if (wsdlDefinition == null) {
+            throw new IllegalArgumentException("WSDL definition cannot be found for " + wsdlPortName);
+        }
+
+        portMetaData = new WebServicePortMetaData(typeHelper, wsdlDefinition, wsdlPortName, wsBinding.getUri(), false);
+    }
+
+}
\ No newline at end of file

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/ExternalWebServiceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date



Mime
View raw message