You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/02/25 18:29:12 UTC

svn commit: r380957 - in /incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis: builder/ config/ context/ engine/ engine/config/ handler/ loader/ mediator/impl/

Author: jsdelfino
Date: Sat Feb 25 09:29:07 2006
New Revision: 380957

URL: http://svn.apache.org/viewcvs?rev=380957&view=rev
Log:
some cleanup

Added:
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java   (with props)
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java   (with props)
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java   (with props)
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java   (with props)
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java   (with props)
Removed:
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/JavaComponentContextBuilder.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/JavaTargetWireBuilder.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/AxisEngineConfigurationFactory.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/mediator/impl/SOAPDocumentImpl.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/mediator/impl/SOAPEnvelopeImpl.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/mediator/impl/SOAPRPCEncodedMediatorImpl.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/mediator/impl/SOAPRPCLiteralMediatorImpl.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/mediator/impl/soap-encoding.xsd
Modified:
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointBean.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java
    incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java

Added: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java?rev=380957&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java (added)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java Sat Feb 25 09:29:07 2006
@@ -0,0 +1,220 @@
+package org.apache.tuscany.binding.axis.builder;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.binding.axis.assembly.WebServiceBinding;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder;
+import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.FieldInjector;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.MethodInjector;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+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.Scope;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * Builds runtime configurations for component implementations that map to
+ * {@link org.apache.tuscany.binding.axis.assembly.WebServiceBinding}. The logical model is then decorated with the
+ * runtime configuration.
+ * 
+ * @see org.apache.tuscany.core.builder.RuntimeConfiguration
+ * 
+ * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $
+ */
+@org.osoa.sca.annotations.Scope("MODULE")
+public class ExternalWebServiceContextBuilder implements RuntimeConfigurationBuilder<AggregateContext> {
+    
+    private RuntimeContext runtimeContext;
+    private ProxyFactoryFactory proxyFactoryFactory;
+    private MessageFactory messageFactory;
+    private RuntimeConfigurationBuilder referenceBuilder;
+
+    @Init(eager=true)
+    public void init() {
+        runtimeContext.addBuilder(this);
+    }
+
+    /**
+     * @param runtimeContext The runtimeContext to set.
+     */
+    @Autowire
+    public void setRuntimeContext(RuntimeContext runtimeContext) {
+        this.runtimeContext = runtimeContext;
+    }
+    
+    /**
+     * Sets the factory used to construct proxies implmementing the business interface required by a reference
+     */
+    @Autowire
+    public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
+        this.proxyFactoryFactory = factory;
+    }
+
+    /**
+     * Sets the factory used to construct invocation messages
+     * 
+     * @param msgFactory
+     */
+    @Autowire
+    public void setMessageFactory(MessageFactory msgFactory) {
+        this.messageFactory = msgFactory;
+    }
+
+    /**
+     * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
+     * reference builder may be hierarchical, containing other child reference builders that operate on specific
+     * metadata used to construct and invocation chain.
+     * 
+     * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
+     */
+    public void setReferenceBuilder(RuntimeConfigurationBuilder builder) {
+        this.referenceBuilder = builder;
+    }
+
+    // ----------------------------------
+    // Constructors
+    // ----------------------------------
+
+    public ExternalWebServiceContextBuilder() {
+    }
+
+    // ----------------------------------
+    // Methods
+    // ----------------------------------
+
+    public void build(AssemblyModelObject modelObject, AggregateContext parentContext) throws BuilderException {
+        if (!(modelObject instanceof ExternalService)) {
+            return;
+        }
+        ExternalService externalService = (ExternalService) modelObject;
+        List<Binding> bindings=externalService.getBindings();
+        if (!bindings.isEmpty() && bindings.get(0) instanceof WebServiceBinding) {
+            WebServiceBinding wsBinding = (WebServiceBinding) bindings.get(0);
+
+            // FIXME scope
+            Scope scope = Scope.MODULE;
+            Class implClass = null;
+            Set<Field> fields;
+            Set<Method> methods;
+            try {
+                implClass = javaImpl.getImplementationClass();
+                fields = JavaIntrospectionHelper.getAllFields(implClass);
+                methods = JavaIntrospectionHelper.getAllUniqueMethods(implClass);
+                String name = component.getName();
+                Constructor ctr = implClass.getConstructor((Class[]) null);
+
+                List<Injector> injectors = new ArrayList();
+
+                EventInvoker initInvoker = null;
+                boolean eagerInit = false;
+                EventInvoker destroyInvoker = null;
+                // FIXME this should be run as part of the LCM load
+                for (Field field : fields) {
+                    ComponentName compName = field.getAnnotation(ComponentName.class);
+                    if (compName != null) {
+                        Injector injector = new FieldInjector(field, new SingletonObjectFactory(name));
+                        injectors.add(injector);
+                    }
+                    Context context = field.getAnnotation(Context.class);
+                    if (context != null) {
+                        Injector injector = new FieldInjector(field, new SingletonObjectFactory(parentContext));
+                        injectors.add(injector);
+                    }
+                }
+                for (Method method : methods) {
+                    // FIXME Java5
+                    Init init = method.getAnnotation(Init.class);
+                    if (init != null && initInvoker == null) {
+                        initInvoker = new MethodEventInvoker(method);
+                        eagerInit = init.eager();
+                        continue;
+                    }
+                    // @spec - should we allow the same method to have @init and
+                    // @destroy?
+                    Destroy destroy = method.getAnnotation(Destroy.class);
+                    if (destroy != null && destroyInvoker == null) {
+                        destroyInvoker = new MethodEventInvoker(method);
+                        continue;
+                    }
+                    ComponentName compName = method.getAnnotation(ComponentName.class);
+                    if (compName != null) {
+                        Injector injector = new MethodInjector(method, new SingletonObjectFactory(name));
+                        injectors.add(injector);
+                    }
+                    Context context = method.getAnnotation(Context.class);
+                    if (context != null) {
+                        Injector injector = new MethodInjector(method, new SingletonObjectFactory(parentContext));
+                        injectors.add(injector);
+                    }
+                }
+                ExternalWebServiceRuntimeConfiguration config = new ExternalWebServiceRuntimeConfiguration(name, JavaIntrospectionHelper
+                        .getDefaultConstructor(implClass), eagerInit, initInvoker, destroyInvoker, scope);
+                component.getComponentImplementation().setRuntimeConfiguration(config);
+
+                // create target-side invocation chains for each service offered by the implementation
+                for (ConfiguredService configuredService : component.getConfiguredServices()) {
+                    Service service = configuredService.getService();
+                    ServiceContract serviceContract = service.getServiceContract();
+                    Map<Method, InvocationConfiguration> iConfigMap = new HashMap();
+                    ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
+                    Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
+                    for (Method method : javaMethods) {
+                        InvocationConfiguration iConfig = new InvocationConfiguration(method);
+                        iConfigMap.put(method, iConfig);
+                    }
+                    QualifiedName qName = new QualifiedName(component.getName() + "/" + service.getName());
+                    ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, null, messageFactory);
+                    proxyFactory.setBusinessInterface(serviceContract.getInterface());
+                    proxyFactory.setProxyConfiguration(pConfiguration);
+                    config.addTargetProxyFactory(service.getName(), proxyFactory);
+                    configuredService.setProxyFactory(proxyFactory);
+                    if (referenceBuilder != null) {
+                        // invoke the reference builder to handle target-side metadata
+                        referenceBuilder.build(configuredService, parentContext);
+                    }
+                    // add tail interceptor
+                    for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+                        iConfig.addTargetInterceptor(new InvokerInterceptor());
+                    }
+
+                }
+
+            } catch (BuilderException e) {
+                e.addContextName(externalService.getName());
+                e.addContextName(parentContext.getName());
+                throw e;
+            }
+        }
+    }
+
+}

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceContextBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java?rev=380957&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java (added)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java Sat Feb 25 09:29:07 2006
@@ -0,0 +1,74 @@
+/**
+ * 
+ * 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.axis.builder;
+
+import org.apache.tuscany.binding.axis.config.ExternalWebServiceRuntimeConfiguration;
+import org.apache.tuscany.core.builder.BuilderConfigException;
+import org.apache.tuscany.core.builder.WireBuilder;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Completes a wire to an external web service by adding a scoped invoker to the source chain
+ * 
+ * @version $Rev$ $Date$
+ */
+@Scope("MODULE")
+public class ExternalWebServiceTargetWireBuilder implements WireBuilder {
+
+    public ExternalWebServiceTargetWireBuilder() {
+    }
+
+    @Init(eager = true)
+    public void init() {
+    }
+
+    public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope,
+            ScopeContext targetScopeContext) throws BuilderConfigException {
+        if (!(ExternalWebServiceRuntimeConfiguration.class.isAssignableFrom(targetType))) {
+            return;
+        }
+        for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations()
+                .values()) {
+            ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(sourceFactory.getProxyConfiguration()
+                    .getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext);
+            if (downScope) {
+                // the source scope is shorter than the target, so the invoker can cache the target instance
+                invoker.setCacheable(true);
+            } else {
+                invoker.setCacheable(false);
+            }
+            sourceInvocationConfig.setTargetInvoker(invoker);
+        }
+    }
+
+    public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext)
+            throws BuilderConfigException {
+        // TODO implement.
+        // if (!(JavaComponentRuntimeConfiguration.class.isAssignableFrom(targetType))) {
+        // return;
+        // }
+        // for (InvocationConfiguration targetInvocationConfig :
+        // targetFactory.getProxyConfiguration().getInvocationConfigurations()
+        // .values()) {
+        // ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(targetFactory.getProxyConfiguration()
+        // .getTargetName(), ((JavaOperationType) targetInvocationConfig.getOperationType()).getJavaMethod(),
+        // targetScopeContext);
+        // targetInvocationConfig.setTargetInvoker(invoker);
+        // }
+    }
+}

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/builder/ExternalWebServiceTargetWireBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java?rev=380957&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java (added)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java Sat Feb 25 09:29:07 2006
@@ -0,0 +1,97 @@
+/**
+ * 
+ * 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.axis.config;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.binding.axis.context.ExternalWebServiceContext;
+import org.apache.tuscany.core.builder.ContextCreationException;
+import org.apache.tuscany.core.builder.RuntimeConfiguration;
+import org.apache.tuscany.core.context.ExternalServiceContext;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.model.assembly.Scope;
+
+/**
+ * A RuntimeConfiguration that handles External Web Services.
+ * 
+ * @version $Rev: 380065 $ $Date: 2006-02-22 23:50:11 -0800 (Wed, 22 Feb 2006) $
+ */
+public class ExternalWebServiceRuntimeConfiguration implements RuntimeConfiguration<ExternalServiceContext> {
+
+    private String name;
+
+    /**
+     * Creates the runtime configuration
+     * 
+     * @param name the SCDL name of the external service the context refers to
+     */
+    public ExternalWebServiceRuntimeConfiguration(String name) {
+        assert (name != null) : "Name was null";
+    }
+
+    // ----------------------------------
+    // Methods
+    // ----------------------------------
+
+    public String getName() {
+        return name;
+    }
+
+    public Scope getScope() {
+        return Scope.MODULE;
+    }
+
+    public ExternalServiceContext createInstanceContext() throws ContextCreationException {
+        PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters);
+        return new ExternalWebServiceContext(name, objectFactory, objectFactory);
+    }
+
+    private Map<String, ProxyFactory> targetProxyFactories = new HashMap();
+
+    public void addTargetProxyFactory(String serviceName, ProxyFactory factory) {
+        targetProxyFactories.put(serviceName, factory);
+    }
+
+    public ProxyFactory getTargetProxyFactory(String serviceName) {
+        return targetProxyFactories.get(serviceName);
+    }
+
+    public Map<String, ProxyFactory> getTargetProxyFactories() {
+        return targetProxyFactories;
+    }
+
+    private Map<String, ProxyFactory> sourceProxyFactories = new HashMap();
+
+    public void addSourceProxyFactory(String referenceName, ProxyFactory factory) {
+        sourceProxyFactories.put(referenceName, factory);
+    }
+
+    public ProxyFactory getSourceProxyFactory(String referenceName) {
+        return sourceProxyFactories.get(referenceName);
+    }
+
+    public Map<String, ProxyFactory> getSourceProxyFactories() {
+        return sourceProxyFactories;
+    }
+
+    public void prepare() {
+    }
+  
+}

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/config/ExternalWebServiceRuntimeConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java?rev=380957&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java (added)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java Sat Feb 25 09:29:07 2006
@@ -0,0 +1,39 @@
+/**
+ *
+ *  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.axis.context;
+
+import org.apache.tuscany.core.context.ExternalServiceContext;
+import org.apache.tuscany.core.context.impl.ExternalServiceImpl;
+import org.apache.tuscany.core.injection.ObjectFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+
+public class ExternalWebServiceContext extends ExternalServiceImpl implements ExternalServiceContext {
+
+    /**
+     * Creates an external service context
+     * 
+     * @param name the name of the external service
+     * @param targetProxyFactory the target proxy factory which creates proxies implementing the configured service
+     *        interface for the entry point. There is always only one proxy factory as an external service is configured
+     *        with one service
+     * @param targetInstanceFactory the object factory that creates an artifact capabile of communicating over the
+     *        binding transport configured on the external service. The object factory may implement a caching strategy.
+     */
+    public ExternalWebServiceContext(String name, ProxyFactory targetProxyFactory, ObjectFactory targetInstanceFactory) {
+        super(name, targetProxyFactory, targetInstanceFactory);
+    }
+}

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/context/ExternalWebServiceContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java?rev=380957&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java (added)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java Sat Feb 25 09:29:07 2006
@@ -0,0 +1,220 @@
+/**
+ *
+ *  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.axis.engine.config;
+
+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.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+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.apache.tuscany.binding.axis.assembly.WebServiceBinding;
+import org.apache.tuscany.binding.axis.handler.WebServiceEntryPointBean;
+import org.apache.tuscany.binding.axis.handler.WebServiceOperationMetaData;
+import org.apache.tuscany.binding.axis.handler.WebServicePortMetaData;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.context.AggregateContext;
+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.Binding;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+import org.eclipse.xsd.util.XSDConstants;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ */
+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
+        AggregateContext 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/axis/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;
+                    Definition definition=wsBinding.getWSDLDefinition();
+                    Port port=wsBinding.getWSDLPort();
+                    QName qname = new QName(definition.getTargetNamespace(), port.getName());
+                    if (qname != null) {
+                        WebServicePortMetaData wsdlPortInfo = new WebServicePortMetaData(definition, port, 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));
+                            }
+
+                            Message inputMessage=wsdlOperation.getInput()!=null? wsdlOperation.getInput().getMessage():null;
+                            if (inputMessage!=null & !inputMessage.getParts().isEmpty()) {
+                                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);
+                            }
+
+                            Message outputMessage=wsdlOperation.getOutput()!=null? wsdlOperation.getOutput().getMessage():null;
+                            if (outputMessage!=null & !outputMessage.getParts().isEmpty()) {
+                                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/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Modified: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointBean.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointBean.java?rev=380957&r1=380956&r2=380957&view=diff
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointBean.java (original)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointBean.java Sat Feb 25 09:29:07 2006
@@ -20,6 +20,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+
 import javax.wsdl.Definition;
 import javax.wsdl.Operation;
 import javax.xml.namespace.QName;
@@ -31,18 +32,11 @@
 import org.apache.axis.message.MessageElement;
 import org.apache.axis.message.SOAPBody;
 import org.apache.axis.message.SOAPEnvelope;
-import org.osoa.sca.CurrentModuleContext;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.model.WebServiceBinding;
-
+import org.apache.tuscany.binding.axis.assembly.WebServiceBinding;
 import org.apache.tuscany.binding.axis.mediator.SOAPMediator;
 import org.apache.tuscany.binding.axis.mediator.impl.SOAPDocumentLiteralMediatorImpl;
-import org.apache.tuscany.binding.axis.mediator.impl.SOAPEnvelopeImpl;
-import org.apache.tuscany.binding.axis.mediator.impl.SOAPRPCEncodedMediatorImpl;
-import org.apache.tuscany.binding.axis.mediator.impl.SOAPRPCLiteralMediatorImpl;
 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.invocation.spi.ProxyFactory;
 import org.apache.tuscany.core.message.Message;
 import org.apache.tuscany.core.message.impl.MessageFactoryImpl;
@@ -50,14 +44,13 @@
 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.ServiceContract;
 import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ServiceContract;
 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.WSDLServiceContract;
-import org.apache.tuscany.model.types.wsdl.WSDLOperationType;
-import org.apache.tuscany.model.types.wsdl.WSDLTypeHelper;
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ServiceRuntimeException;
 
 /**
  *         <p/>

Modified: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java?rev=380957&r1=380956&r2=380957&view=diff
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java (original)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointServlet.java Sat Feb 25 09:29:07 2006
@@ -31,7 +31,7 @@
 import org.apache.axis.server.AxisServer;
 import org.apache.axis.transport.http.AxisServlet;
 
-import org.apache.tuscany.binding.axis.config.AxisEngineConfigurationFactory;
+import org.apache.tuscany.binding.axis.engine.config.AxisEngineConfigurationFactory;
 import org.apache.tuscany.core.context.webapp.TuscanyWebAppRuntime;
 
 /**

Modified: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java?rev=380957&r1=380956&r2=380957&view=diff
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java (original)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServiceOperationMetaData.java Sat Feb 25 09:29:07 2006
@@ -119,11 +119,11 @@
             if (message.getQName().equals(msgName)) {
                 part = message.getPart(soapHeader.getPart());
             }
-        } else if (extensibilityElement instanceof org.eclipse.wst.wsdl.binding.soap.SOAPHeader) {
-            org.eclipse.wst.wsdl.binding.soap.SOAPHeader soapHeader = (org.eclipse.wst.wsdl.binding.soap.SOAPHeader) extensibilityElement;
-            QName msgName = soapHeader.getMessage().getQName();
+        } else if (extensibilityElement instanceof SOAPHeader) {
+            SOAPHeader soapHeader = (SOAPHeader) extensibilityElement;
+            QName msgName = soapHeader.getMessage();
             if (message.getQName().equals(msgName)) {
-                part = soapHeader.getPart();
+                part = message.getPart(soapHeader.getPart());
             }
         }
         return part;

Modified: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java?rev=380957&r1=380956&r2=380957&view=diff
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java (original)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/handler/WebServicePortMetaData.java Sat Feb 25 09:29:07 2006
@@ -34,14 +34,13 @@
 import javax.xml.soap.SOAPElement;
 
 import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
-import org.w3c.dom.Element;
 
 /**
  * Metadata for a WSDL port
  *
  */
 public class WebServicePortMetaData {
-    private final static String SOAP_ENCODING_URI = "http://schemas.xmlsoap.org/wsdl/soap/";
+    
     private Service wsdlService;
 
     private QName wsdlServiceName;
@@ -275,14 +274,6 @@
             }
         }
         return signature;
-    }
-
-    public static String getSOAPEncodingAttribute(org.eclipse.wst.wsdl.ExtensibilityElement extensibilityElement, String elementName, String attributeName) {
-        Element element = extensibilityElement.getElement();
-        if (SOAP_ENCODING_URI.equals(element.getNamespaceURI()) && elementName.equals(element.getLocalName())) {
-            return element.getAttribute(attributeName);
-        } else
-            return null;
     }
 
     public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) {

Modified: incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java?rev=380957&r1=380956&r2=380957&view=diff
==============================================================================
--- incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java (original)
+++ incubator/tuscany/java/sca/binding.axis/src/main/java/org/apache/tuscany/binding/axis/loader/WebServiceSCDLModelLoader.java Sat Feb 25 09:29:07 2006
@@ -1,12 +1,5 @@
 package org.apache.tuscany.binding.axis.loader;
 
-import java.util.Collection;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-
 import org.apache.tuscany.binding.axis.assembly.WebServiceAssemblyFactory;
 import org.apache.tuscany.binding.axis.assembly.WebServiceBinding;
 import org.apache.tuscany.binding.axis.assembly.impl.WebServiceAssemblyFactoryImpl;