You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2006/08/02 11:01:57 UTC

svn commit: r427934 [1/3] - in /incubator/tuscany/java/sca/bindings/binding.servicemix: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/servicemix/ src/main/java/org/apache/servicemix/sca/ src/main...

Author: antelder
Date: Wed Aug  2 02:01:53 2006
New Revision: 427934

URL: http://svn.apache.org/viewvc?rev=427934&view=rev
Log:
Copy as-is the servicemix sca binding code to our repos. Its based on real old SCA code so don't even think about trying to compile it just yet

Added:
    incubator/tuscany/java/sca/bindings/binding.servicemix/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/pom.xml
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaComponent.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaDeployer.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/LICENSE
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/NOTICE
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/DISCLAIMER
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/LICENSE
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/NOTICE
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/system.fragment
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataService.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/AccountDataServiceImpl.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/CheckingAccount.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/SavingsAccount.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/StockAccount.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteRequest.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteResponse.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/stockquote/StockQuoteService.java
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/log4j-tests.properties
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/log4j.properties
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/servicemix/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/servicemix/sca/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/servicemix/sca/bigbank/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/servicemix/sca/bigbank/account/   (with props)
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/servicemix/sca/bigbank/account/AccountService.wsdl
    incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/resources/org/apache/servicemix/sca/bigbank/sca.module

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/pom.xml?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/pom.xml (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/pom.xml Wed Aug  2 02:01:53 2006
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<!-- $Rev: 359503 $ $Date: 2005-12-28 13:56:03 +0100 (mer., 28 déc. 2005) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>servicemix</artifactId>
+    <version>3.0-incubating-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>servicemix-sca</artifactId>
+  <packaging>jbi-component</packaging>
+  <name>ServiceMix :: SCA Service Engine</name>
+  <description>SCA service engine</description>
+
+  <properties>
+    <tuscany_version>20060317</tuscany_version>
+    <eclipse_xsd_version>2.2.0-I200602160000</eclipse_xsd_version>
+    <eclipse_emf_version>2.2.0-I200602160000</eclipse_emf_version>
+  </properties>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>servicemix-common</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>commonj</groupId>
+      <artifactId>sdo-api</artifactId>
+      <version>20060317</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osoa</groupId>
+      <artifactId>sca-api</artifactId>
+      <version>${tuscany_version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.tuscany</groupId>
+      <artifactId>tuscany-common</artifactId>
+      <version>${tuscany_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tuscany</groupId>
+      <artifactId>tuscany-container-java</artifactId>
+      <version>${tuscany_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tuscany</groupId>
+      <artifactId>tuscany-core</artifactId>
+      <version>${tuscany_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tuscany</groupId>
+      <artifactId>tuscany-model</artifactId>
+      <version>${tuscany_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tuscany</groupId>
+      <artifactId>tuscany-sdo-impl</artifactId>
+      <version>${tuscany_version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.eclipse.emf</groupId>
+      <artifactId>common</artifactId>
+      <version>${eclipse_emf_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.emf</groupId>
+      <artifactId>ecore</artifactId>
+      <version>${eclipse_emf_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.emf</groupId>
+      <artifactId>ecore-change</artifactId>
+      <version>${eclipse_emf_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.emf</groupId>
+      <artifactId>ecore-xmi</artifactId>
+      <version>${eclipse_emf_version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.xsd</groupId>
+      <artifactId>xsd</artifactId>
+      <version>${eclipse_xsd_version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>com.sun.xml</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <version>2.0EA3</version>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>jbi-maven-plugin</artifactId>
+        <configuration>
+          <type>service-engine</type>
+          <bootstrap>org.apache.servicemix.sca.ScaBootstrap</bootstrap>
+          <component>org.apache.servicemix.sca.ScaComponent</component>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaBootstrap.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.Bootstrap;
+import javax.jbi.component.InstallationContext;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ * Base class for components bootstrap.
+ * 
+ * @author Guillaume Nodet
+ * @version $Revision: 369856 $
+ * @since 3.0
+ */
+public class ScaBootstrap implements Bootstrap {
+
+    protected final transient Log logger = LogFactory.getLog(getClass());
+    
+    protected InstallationContext context;
+    protected ObjectName mbeanName;
+    
+    public ScaBootstrap() {
+    }
+    
+    public ObjectName getExtensionMBeanName() {
+        return mbeanName;
+    }
+
+    protected Object getExtensionMBean() throws Exception {
+        return null;
+    }
+    
+    protected ObjectName createExtensionMBeanName() throws Exception {
+        return this.context.getContext().getMBeanNames().createCustomComponentMBeanName("bootstrap");
+    }
+
+    /* (non-Javadoc)
+     * @see javax.jbi.component.Bootstrap#init(javax.jbi.component.InstallationContext)
+     */
+    public void init(InstallationContext installContext) throws JBIException {
+        try {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Initializing bootstrap");
+            }
+            this.context = installContext;
+            doInit();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Bootstrap initialized");
+            }
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling init", e);
+        }
+    }
+
+    protected void doInit() throws Exception {
+        Object mbean = getExtensionMBean();
+        if (mbean != null) {
+            this.mbeanName = createExtensionMBeanName();
+            MBeanServer server = this.context.getContext().getMBeanServer();
+            if (server == null) {
+                throw new JBIException("null mBeanServer");
+            }
+            if (server.isRegistered(this.mbeanName)) {
+                server.unregisterMBean(this.mbeanName);
+            }
+            server.registerMBean(mbean, this.mbeanName);
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see javax.jbi.component.Bootstrap#cleanUp()
+     */
+    public void cleanUp() throws JBIException {
+        try {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Cleaning up bootstrap");
+            }
+            doCleanUp();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Bootstrap cleaned up");
+            }
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling cleanUp", e);
+        }
+    }
+
+    protected void doCleanUp() throws Exception {
+        if (this.mbeanName != null) {
+            MBeanServer server = this.context.getContext().getMBeanServer();
+            if (server == null) {
+                throw new JBIException("null mBeanServer");
+            }
+            if (server.isRegistered(this.mbeanName)) {
+                server.unregisterMBean(this.mbeanName);
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see javax.jbi.component.Bootstrap#onInstall()
+     */
+    public void onInstall() throws JBIException {
+        try {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Bootstrap onInstall");
+            }
+            doOnInstall();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Bootstrap onInstall done");
+            }
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling onInstall", e);
+        }
+    }
+
+    protected void doOnInstall() throws Exception {
+    }
+    
+    /* (non-Javadoc)
+     * @see javax.jbi.component.Bootstrap#onUninstall()
+     */
+    public void onUninstall() throws JBIException {
+        try {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Bootstrap onUninstall");
+            }
+            doOnUninstall();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Bootstrap onUninstall done");
+            }
+        } catch (JBIException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new JBIException("Error calling onUninstall", e);
+        }
+    }
+
+    protected void doOnUninstall() throws Exception {
+    }
+    
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaComponent.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaComponent.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaComponent.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.BaseLifeCycle;
+import org.apache.servicemix.common.BaseServiceUnitManager;
+import org.apache.servicemix.common.Deployer;
+
+public class ScaComponent extends BaseComponent {
+
+    /* (non-Javadoc)
+     * @see org.servicemix.common.BaseComponent#createLifeCycle()
+     */
+    protected BaseLifeCycle createLifeCycle() {
+        return new ScaLifeCycle(this);
+    }
+
+    /* (non-Javadoc)
+     * @see org.servicemix.common.BaseComponent#createServiceUnitManager()
+     */
+    public BaseServiceUnitManager createServiceUnitManager() {
+        Deployer[] deployers = new Deployer[] { new ScaDeployer(this) };
+        return new BaseServiceUnitManager(this, deployers);
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaDeployer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaDeployer.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaDeployer.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaDeployer.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca;
+
+import java.io.File;
+
+import javax.jbi.management.DeploymentException;
+
+import org.apache.servicemix.common.AbstractDeployer;
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.ServiceUnit;
+
+public class ScaDeployer extends AbstractDeployer {
+
+	public static final String SCA_MODULE_FILE = "sca.module";
+	
+	public ScaDeployer(BaseComponent component) {
+		super(component);
+	}
+
+	public boolean canDeploy(String serviceUnitName, String serviceUnitRootPath) {
+		File module = new File(serviceUnitRootPath, SCA_MODULE_FILE);
+		return module.exists() && module.isFile();
+	}
+
+	public ServiceUnit deploy(String serviceUnitName, String serviceUnitRootPath)
+			throws DeploymentException {
+		File module = new File(serviceUnitRootPath, SCA_MODULE_FILE);
+		if (!module.exists() || !module.isFile()) {
+            throw failure("deploy", "No sca.module found", null);
+		}
+		try {
+			ScaServiceUnit su = new ScaServiceUnit();
+	        su.setComponent(component);
+	        su.setName(serviceUnitName);
+	        su.setRootPath(serviceUnitRootPath);
+	        su.init();
+	        return su;
+		} catch (Exception e) {
+			throw failure("deploy", "Error loading sca module", e);
+		}
+	}
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca;
+
+import java.io.StringWriter;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.tuscany.core.context.EntryPointContext;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+
+/**
+ * 
+ * @author gnodet
+ * @version $Revision: 366467 $
+ * @org.apache.xbean.XBean element="endpoint" description="A sca endpoint"
+ * 
+ */
+public class ScaEndpoint extends Endpoint implements ExchangeProcessor {
+
+    protected ServiceEndpoint activated;
+
+    protected EntryPoint entryPoint;
+
+    protected Map<Class, Method> methodMap;
+
+    protected JAXBContext jaxbContext;
+
+    protected DeliveryChannel channel;
+
+    public ScaEndpoint(EntryPoint entryPoint) {
+        this.entryPoint = entryPoint;
+    }
+
+    public Role getRole() {
+        return Role.PROVIDER;
+    }
+
+    public void activate() throws Exception {
+        logger = this.serviceUnit.getComponent().getLogger();
+        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+        activated = ctx.activateEndpoint(service, endpoint);
+        channel = ctx.getDeliveryChannel();
+        // Get the target service
+        ConfiguredReference referenceValue = entryPoint.getConfiguredReference();
+        ConfiguredService targetServiceEndpoint = referenceValue.getTargetConfiguredServices().get(0);
+        // Get the business interface
+        Class serviceInterface = targetServiceEndpoint.getService().getServiceContract().getInterface();
+        List<Class> classes = new ArrayList<Class>();
+        methodMap = new HashMap<Class, Method>();
+        for (Method mth : serviceInterface.getMethods()) {
+            Class[] params = mth.getParameterTypes();
+            if (params.length != 1) {
+                throw new IllegalStateException("Supports only methods with one parameter");
+            }
+            methodMap.put(params[0], mth);
+            classes.add(mth.getReturnType());
+            classes.add(params[0]);
+        }
+        jaxbContext = JAXBContext.newInstance(classes.toArray(new Class[0]));
+    }
+
+    public void deactivate() throws Exception {
+        ServiceEndpoint ep = activated;
+        activated = null;
+        ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+        ctx.deactivateEndpoint(ep);
+    }
+
+    public ExchangeProcessor getProcessor() {
+        return this;
+    }
+
+    public void process(MessageExchange exchange) throws Exception {
+        if (exchange.getStatus() == ExchangeStatus.DONE) {
+            return;
+        } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+            return;
+        }
+        Object input = jaxbContext.createUnmarshaller().unmarshal(exchange.getMessage("in").getContent());
+        Method method = methodMap.get(input.getClass());
+        if (method == null) {
+            throw new IllegalStateException("Could not determine invoked web method");
+        }
+        boolean oneWay = method.getReturnType() == null;
+        Object output;
+        try {
+            EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
+                    .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
+            InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
+            output = handler.invoke(null, method, new Object[] { input });
+        } catch (UndeclaredThrowableException e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Error e) {
+            throw e;
+        } catch (Exception e) {
+            throw e;
+        } catch (Throwable e) {
+            throw new RuntimeException(e);
+        }
+        if (oneWay) {
+            exchange.setStatus(ExchangeStatus.DONE);
+            channel.send(exchange);
+        } else {
+            NormalizedMessage msg = exchange.createMessage();
+            exchange.setMessage(msg, "out");
+            StringWriter writer = new StringWriter();
+            jaxbContext.createMarshaller().marshal(output, writer);
+            msg.setContent(new StringSource(writer.toString()));
+            channel.send(exchange);
+        }
+    }
+
+    public void start() throws Exception {
+    }
+
+    public void stop() throws Exception {
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.BaseLifeCycle;
+
+public class ScaLifeCycle extends BaseLifeCycle {
+
+	public ScaLifeCycle(BaseComponent component) {
+		super(component);
+	}
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.tuscany.CommonsLoggingMonitorFactory;
+import org.apache.servicemix.sca.tuscany.TuscanyRuntime;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+
+public class ScaServiceUnit extends ServiceUnit {
+
+	protected static final ThreadLocal<ScaServiceUnit> SERVICE_UNIT = new ThreadLocal<ScaServiceUnit>();
+	
+	public static ScaServiceUnit getCurrentScaServiceUnit() {
+		return SERVICE_UNIT.get();
+	}
+	
+	protected TuscanyRuntime tuscanyRuntime;
+	protected ClassLoader classLoader;
+	
+	public void init() throws Exception {
+        SERVICE_UNIT.set(this);
+		createScaRuntime();
+		createEndpoints();
+        SERVICE_UNIT.set(null);
+	}
+	
+	protected void createScaRuntime() throws Exception {
+		File root = new File(getRootPath());
+		File[] files = root.listFiles(new JarFileFilter());
+		URL[] urls = new URL[files.length + 1];
+		for (int i = 0; i < files.length; i++) {
+			urls[i] = files[i].toURL();
+		}
+		urls[urls.length - 1] = root.toURL();
+		classLoader = new URLClassLoader(urls, getClass().getClassLoader());
+		
+        tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
+	}
+	
+	protected void createEndpoints() throws Exception {
+        Module module = tuscanyRuntime.getModuleComponent().getModuleImplementation();
+        for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
+            EntryPoint entryPoint = (EntryPoint) i.next();
+            Binding binding = (Binding) entryPoint.getBindings().get(0);
+            if (binding instanceof JbiBinding) {
+                JbiBinding jbiBinding = (JbiBinding) binding;
+                ScaEndpoint endpoint = new ScaEndpoint(entryPoint);
+                endpoint.setServiceUnit(this);
+                endpoint.setService(jbiBinding.getServiceName());
+                endpoint.setEndpoint(jbiBinding.getEndpointName());
+                endpoint.setInterfaceName(jbiBinding.getInterfaceName());
+                Definition definition = jbiBinding.getDefinition();
+                if (definition != null) {
+                    endpoint.setDefinition(definition);
+                    endpoint.setDescription(WSDLFactory.newInstance().newWSDLWriter().getDocument(definition));
+                }
+                addEndpoint(endpoint);
+            }
+        }
+	}
+	
+	private static class JarFileFilter implements FilenameFilter {
+        public boolean accept(File dir, String name) {
+            return name.endsWith(".jar");
+        }
+	}
+
+	public TuscanyRuntime getTuscanyRuntime() {
+		return tuscanyRuntime;
+	}
+
+	@Override
+	public void start() throws Exception {
+	    tuscanyRuntime.start();
+		super.start();
+	}
+
+	@Override
+	public void stop() throws Exception {
+		super.stop();
+		tuscanyRuntime.stop();
+	}
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.assembly;
+
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+
+/**
+ * The <b>Factory</b> for the model.
+ */
+public interface JbiAssemblyFactory extends AssemblyFactory {
+
+    /**
+     * Returns a new JbiBinding
+     */
+    JbiBinding createJbiBinding();
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.assembly;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.model.assembly.Binding;
+
+public interface JbiBinding extends Binding {
+
+    /**
+     * Returns the URI of the WSDL port for this binding.
+     * @return the URI of the WSDL port for this binding
+     */
+    String getPortURI();
+
+    /**
+     * Set the URI of the WSDL port for this binding.
+     * @param portURI the URI of the WSDL port
+     */
+    void setPortURI(String portURI);
+    
+    /**
+     * Returns the service name. 
+     * @return the service name
+     */
+    QName getServiceName();
+    
+    /**
+     * Returns the endpoint name.
+     * @return the endpoint name
+     */
+    String getEndpointName();
+    
+    /**
+     * Returns the interface name.
+     * @returnthe interface name
+     */
+    QName getInterfaceName();
+    
+    /**
+     * Returns the WSDL definition containing the WSDL port.
+     * @return the WSDL definition containing the WSDL port
+     */
+    Definition getDefinition();
+
+    /**
+     * Returns the the WSDL service.
+     * @return the WSDL service
+     */
+    Service getService();
+    
+    /**
+     * Returns the WSDL port defining this binding.
+     * @return the WSDL port defining this binding
+     */
+    Port getPort();
+    
+    /**
+     * Returns the WSDL port type.
+     * @return the WSDL port type
+     */
+    PortType getPortType();
+    
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.assembly.impl;
+
+import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+
+/**
+ * An implementation of the model <b>Factory</b>.
+ */
+public class JbiAssemblyFactoryImpl extends AssemblyFactoryImpl implements JbiAssemblyFactory {
+
+    /**
+     * Creates an instance of the factory.
+     */
+    public JbiAssemblyFactoryImpl() {
+        super();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiAssemblyFactory#createJbiBinding()
+     */
+    public JbiBinding createJbiBinding() {
+        return new JbiBindingImpl();
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.assembly.impl;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.impl.BindingImpl;
+
+/**
+ * An implementation of the model object '<em><b>Web Service Binding</b></em>'.
+ */
+public class JbiBindingImpl extends BindingImpl implements JbiBinding {
+
+    private String portURI;
+    private QName serviceName;
+    private String endpointName;
+    private QName interfaceName;
+    private Definition definition;
+    private Service service;
+    private PortType portType;
+    private Port port;
+
+
+    /**
+     * Constructor
+     */
+    protected JbiBindingImpl() {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortURI()
+     */
+    public String getPortURI() {
+        return portURI;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#setPortURI(java.lang.String)
+     */
+    public void setPortURI(String portURI) {
+        this.portURI = portURI;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getServiceName()
+     */
+    public QName getServiceName() {
+        return serviceName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getEndpointName()
+     */
+    public String getEndpointName() {
+        return endpointName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getInterfaceName()
+     */
+    public QName getInterfaceName() {
+        return interfaceName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getDefinition()
+     */
+    public Definition getDefinition() {
+        return definition;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getService()
+     */
+    public Service getService() {
+        return service;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getPort()
+     */
+    public Port getPort() {
+        return port;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortType()
+     */
+    public PortType getPortType() {
+        return portType;
+    }
+
+    /**
+     * @see org.apache.tuscany.model.assembly.impl.BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+     */
+    public void initialize(AssemblyModelContext modelContext) {
+        if (isInitialized())
+            return;
+        super.initialize(modelContext);
+
+        // Get the service name and endpoint name
+        String[] parts = split(portURI);
+        serviceName = new QName(parts[0], parts[1]);
+        endpointName = parts[2];
+        
+        // Load the WSDL definitions for the given namespace
+        List<Definition> definitions = modelContext.getAssemblyLoader().loadDefinitions(parts[0]);
+        if (definitions != null) {
+            for (Definition definition : definitions) {
+                Service service = definition.getService(serviceName);
+                if (service != null) {
+                    Port port = service.getPort(endpointName);
+                    if (port != null) {
+                        this.service = service;
+                        this.port = port;
+                        this.portType = port.getBinding().getPortType();
+                        this.interfaceName = portType.getQName();
+                        this.definition = definition;
+                        return;
+                    }
+                }
+            }
+        }
+    }
+
+    protected String[] split(String uri) {
+        char sep;
+        uri = uri.trim();
+        if (uri.indexOf('/') > 0) {
+            sep = '/';
+        } else {
+            sep = ':';
+        }
+        int idx1 = uri.lastIndexOf(sep);
+        int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+        String epName = uri.substring(idx1 + 1);
+        String svcName = uri.substring(idx2 + 1, idx1);
+        String nsUri   = uri.substring(0, idx2);
+        return new String[] { nsUri, svcName, epName };
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.builder;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
+import org.apache.servicemix.sca.handler.ExternalJbiServiceClient;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.MethodHashMap;
+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.ConfiguredService;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.scdl.WebServiceBinding;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Creates a <code>RuntimeConfigurationBuilder</code> for an external service configured with the {@link WebServiceBinding}
+ */
+@Scope("MODULE")
+public class ExternalJbiServiceBuilder implements ContextFactoryBuilder {
+
+    private RuntimeContext runtimeContext;
+
+    private ProxyFactoryFactory proxyFactoryFactory;
+
+    private MessageFactory messageFactory;
+
+    private ContextFactoryBuilder policyBuilder;
+
+    public ExternalJbiServiceBuilder() {
+    }
+
+    @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 setPolicyBuilder(ContextFactoryBuilder builder) {
+        policyBuilder = builder;
+    }
+
+    public void build(AssemblyModelObject object) throws BuilderException {
+        if (!(object instanceof ExternalService)) {
+            return;
+        }
+        ExternalService externalService = (ExternalService) object;
+        if (externalService.getBindings().size() < 1 || !(externalService.getBindings().get(0) instanceof JbiBinding)) {
+            return;
+        }
+
+        ExternalJbiServiceClient externalJbiServiceClient = new ExternalJbiServiceClient(externalService);
+        ExternalJbiServiceContextFactory config = new ExternalJbiServiceContextFactory(externalService.getName(), new SingletonObjectFactory<ExternalJbiServiceClient>(externalJbiServiceClient));
+
+        ConfiguredService configuredService = externalService.getConfiguredService();
+        Service service = configuredService.getService();
+        ServiceContract serviceContract = service.getServiceContract();
+        Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap();
+        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(externalService.getName() + "/" + service.getName());
+        ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
+        proxyFactory.setBusinessInterface(serviceContract.getInterface());
+        proxyFactory.setProxyConfiguration(pConfiguration);
+        config.addTargetProxyFactory(service.getName(), proxyFactory);
+        configuredService.setProxyFactory(proxyFactory);
+        if (policyBuilder != null) {
+            // invoke the reference builder to handle additional policy metadata
+            policyBuilder.build(configuredService);
+        }
+        // add tail interceptor
+        for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+            iConfig.addTargetInterceptor(new InvokerInterceptor());
+        }
+
+        externalService.getConfiguredService().setContextFactory(config);
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.builder;
+
+import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
+import org.apache.servicemix.sca.handler.ExternalJbiServiceTargetInvoker;
+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.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class ExternalJbiServiceWireBuilder implements WireBuilder {
+
+    private RuntimeContext runtimeContext;
+
+    /**
+     * Constructs a new ExternalWebServiceWireBuilder.
+     */
+    public ExternalJbiServiceWireBuilder() {
+        super();
+    }
+
+    @Autowire
+    public void setRuntimeContext(RuntimeContext context) {
+        runtimeContext = context;
+    }
+
+    @Init(eager=true)
+    public void init() {
+        runtimeContext.addBuilder(this);
+    }
+
+    public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException {
+        if (!(ExternalJbiServiceContextFactory.class.isAssignableFrom(targetType))) {
+            return;
+        }
+        for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations().values()) {
+            ExternalJbiServiceTargetInvoker invoker = new ExternalJbiServiceTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext);
+            sourceInvocationConfig.setTargetInvoker(invoker);
+        }
+    }
+
+    public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext)
+            throws BuilderConfigException {
+        //TODO implement
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.builder;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.config.JbiServiceEntryPointContextFactory;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+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.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.InvocationRuntimeException;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
+import org.apache.tuscany.core.message.Message;
+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.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class JbiServiceEntryPointBuilder implements ContextFactoryBuilder<AggregateContext> {
+
+    private RuntimeContext runtimeContext;
+
+    private ProxyFactoryFactory proxyFactoryFactory;
+
+    private MessageFactory messageFactory;
+
+    private ContextFactoryBuilder policyBuilder;
+
+    public JbiServiceEntryPointBuilder() {
+    }
+
+    @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 setPolicyBuilder(ContextFactoryBuilder builder) {
+        policyBuilder = builder;
+    }
+
+    public void build(AssemblyModelObject object) throws BuilderException {
+        if (!(object instanceof EntryPoint)) {
+            return;
+        }
+        EntryPoint entryPoint = (EntryPoint) object;
+        if (entryPoint.getBindings().size() < 1 || !(entryPoint.getBindings().get(0) instanceof JbiBinding)) {
+            return;
+        }
+
+        EntryPointContextFactory config = new JbiServiceEntryPointContextFactory(entryPoint.getName(), entryPoint.getConfiguredService().getService().getName(), messageFactory);
+
+        ConfiguredService configuredService = entryPoint.getConfiguredService();
+        Service service = configuredService.getService();
+        ServiceContract serviceContract = service.getServiceContract();
+        Map<Method, InvocationConfiguration> iConfigMap = new HashMap<Method, InvocationConfiguration>();
+        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(entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0).getAggregatePart().getName() + "/" + service.getName());
+        ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
+        proxyFactory.setBusinessInterface(serviceContract.getInterface());
+        proxyFactory.setProxyConfiguration(pConfiguration);
+        config.addSourceProxyFactory(service.getName(), proxyFactory);
+        configuredService.setProxyFactory(proxyFactory);
+        if (policyBuilder != null) {
+            // invoke the reference builder to handle additional policy metadata
+            policyBuilder.build(configuredService);
+        }
+        // add tail interceptor
+        for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+            iConfig.addTargetInterceptor(new EntryPointInvokerInterceptor());
+        }
+        entryPoint.getConfiguredReference().setContextFactory(config);
+    }
+    
+    //FIXME same as the InvokerInterceptor except that it doesn't throw an exception in setNext
+    // For some reason another InvokerInterceptor is added after this one, need Jim to look into it
+    // and figure out why.
+    public class EntryPointInvokerInterceptor implements Interceptor {
+        
+        public EntryPointInvokerInterceptor() {
+        }
+
+        public Message invoke(Message msg) throws InvocationRuntimeException {
+            TargetInvoker invoker = msg.getTargetInvoker();
+            if (invoker == null) {
+                throw new InvocationRuntimeException("No target invoker specified on message");
+            }
+            return invoker.invoke(msg);
+        }
+
+        public void setNext(Interceptor next) {
+        }
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.config;
+
+import org.apache.tuscany.core.builder.ObjectFactory;
+import org.apache.tuscany.core.builder.impl.BaseExternalServiceContextFactory;
+
+public class ExternalJbiServiceContextFactory extends BaseExternalServiceContextFactory {
+
+    public ExternalJbiServiceContextFactory(String name, ObjectFactory objectFactory) {
+        super(name, objectFactory);
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.config;
+
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+
+public class JbiServiceEntryPointContextFactory extends EntryPointContextFactory {
+
+    public JbiServiceEntryPointContextFactory(String name, String referenceName, MessageFactory msgFactory) {
+        super(name, referenceName, msgFactory);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  2 02:01:53 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servicemix.sca.handler;
+
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Method;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.sca.ScaServiceUnit;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.ExternalService;
+
+public class ExternalJbiServiceClient {
+
+    private ExternalService externalService;
+    
+    private JbiBinding jbiBinding;
+
+    private ScaServiceUnit serviceUnit;
+
+    /**
+     * Constructs a new ExternalWebServiceClient.
+     * 
+     * @param externalService
+     * @param wsBinding
+     */
+    public ExternalJbiServiceClient(ExternalService externalService) {
+        this.serviceUnit = ScaServiceUnit.getCurrentScaServiceUnit();
+        this.externalService = externalService;
+        this.jbiBinding = (JbiBinding) this.externalService.getBindings().get(0);
+    }
+
+    /**
+     * Invoke an operation on the external Web service.
+     * 
+     * @param method
+     * @param args
+     * @return
+     */
+    public Object invoke(Method method, Object[] args) {
+        if (args == null || args.length != 1) {
+            throw new IllegalStateException("args should have exactly one object");
+        }
+        try {
+            Object payload = args[0];
+            Class inputClass = method.getParameterTypes()[0];
+            Class outputClass = method.getReturnType();
+            JAXBContext context = JAXBContext.newInstance(inputClass, outputClass);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            context.createMarshaller().marshal(payload, baos);
+            
+            DeliveryChannel channel = serviceUnit.getComponent().getComponentContext().getDeliveryChannel();
+            // TODO: in-only case ?
+            // TODO: interface based routing ?
+            // TODO: explicit endpoint selection ?
+            InOut inout = channel.createExchangeFactory().createInOutExchange();
+            inout.setService(jbiBinding.getServiceName());
+            NormalizedMessage in = inout.createMessage();
+            inout.setInMessage(in);
+            in.setContent(new StringSource(baos.toString()));
+            boolean sent = channel.sendSync(inout);
+            // TODO: check for error ?
+            NormalizedMessage out = inout.getOutMessage();
+            Object response = context.createUnmarshaller().unmarshal(out.getContent());
+            inout.setStatus(ExchangeStatus.DONE);
+            channel.send(inout);
+            return response;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org