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 [2/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...

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,108 @@
+/*
+ * 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.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.context.ExternalServiceContext;
+import org.apache.tuscany.core.context.InstanceContext;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.context.TargetException;
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.message.Message;
+
+public class ExternalJbiServiceTargetInvoker implements TargetInvoker {
+
+    private QualifiedName serviceName;
+    private String esName;
+    private Method method;
+    private ScopeContext container;
+
+    private ExternalServiceContext context;
+
+    /**
+     * Constructs a new ExternalJbiServiceTargetInvoker.
+     * @param esName
+     * @param container
+     */
+    public ExternalJbiServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) {
+        assert (serviceName != null) : "No service name specified";
+        assert (method != null) : "No method specified";
+        assert (container != null) : "No scope container specified";
+        this.serviceName = serviceName;
+        this.esName = serviceName.getPartName();
+        this.method = method;
+        this.container = container;
+    }
+
+    public Object invokeTarget(Object payload) throws InvocationTargetException {
+        if (context == null) {
+            InstanceContext iContext = container.getContext(esName);
+            if (!(iContext instanceof ExternalServiceContext)) {
+                TargetException te = new TargetException("Unexpected target context type");
+                te.setIdentifier(iContext.getClass().getName());
+                te.addContextName(iContext.getName());
+                throw te;
+            }
+            context = (ExternalServiceContext) iContext;
+        }
+        ExternalJbiServiceClient client = (ExternalJbiServiceClient) context.getImplementationInstance(true);
+        if (payload != null) {
+            return client.invoke(method, (Object[])payload);
+        } else {
+            return client.invoke(method, null);
+        }
+    }
+
+    public boolean isCacheable() {
+        return false;
+    }
+
+    public Message invoke(Message msg) {
+        try {
+            Object resp = invokeTarget(msg.getBody());
+            msg.setBody(resp);
+        } catch (InvocationTargetException e) {
+            msg.setBody(e.getCause());
+        } catch (Throwable e) {
+            msg.setBody(e);
+        }
+        return msg;
+    }
+
+    public void setNext(Interceptor next) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Object clone() {
+        try {
+            ExternalJbiServiceTargetInvoker invoker = (ExternalJbiServiceTargetInvoker) super.clone();
+            invoker.container = container;
+            invoker.context = this.context;
+            invoker.esName = this.esName;
+            invoker.method = this.method;
+            invoker.serviceName = this.serviceName;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }  
+    
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/
------------------------------------------------------------------------------
--- 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/loader/JbiBindingLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,73 @@
+/*
+ * 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.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.assembly.impl.JbiAssemblyFactoryImpl;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.loader.StAXElementLoader;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class JbiBindingLoader implements StAXElementLoader<JbiBinding>{
+
+    public static final QName BINDING_JBI = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.jbi");
+
+    private static final JbiAssemblyFactory jbiFactory = new JbiAssemblyFactoryImpl();
+
+    private StAXLoaderRegistry registry;
+
+    @Autowire
+    public void setRegistry(StAXLoaderRegistry registry) {
+        this.registry = registry;
+    }
+
+    @Init(eager = true)
+    public void start() {
+        registry.registerLoader(this);
+    }
+
+    @Destroy
+    public void stop() {
+        registry.unregisterLoader(this);
+    }
+
+    public QName getXMLType() {
+        return BINDING_JBI;
+    }
+
+    public Class<JbiBinding> getModelType() {
+        return JbiBinding.class;
+    }
+
+    public JbiBinding load(XMLStreamReader reader, ResourceLoader resourceLoader) throws XMLStreamException, ConfigurationLoadException {
+        JbiBinding binding = jbiFactory.createJbiBinding();
+        binding.setURI(reader.getAttributeValue(null, "uri"));
+        binding.setPortURI(reader.getAttributeValue(null, "port"));
+        return binding;
+    }
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/
------------------------------------------------------------------------------
--- 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/tuscany/BootstrapHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,123 @@
+/*
+ * 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.tuscany;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
+import org.apache.tuscany.core.config.impl.ModuleComponentConfigurationLoaderImpl;
+import org.apache.tuscany.core.config.impl.StAXModuleComponentConfigurationLoaderImpl;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.SystemAggregateContext;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.loader.StAXUtil;
+import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
+import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder;
+import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder;
+import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder;
+import org.apache.tuscany.core.system.loader.SystemSCDLModelLoader;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl;
+
+public class BootstrapHelper {
+    
+    /**
+     * Returns a default AssemblyModelContext.
+     *
+     * @param classLoader the classloader to use for application artifacts
+     * @return a default AssemblyModelContext
+     */
+    public static AssemblyModelContext getModelContext(ClassLoader classLoader) {
+        // Create an assembly model factory
+        AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();
+
+        // Create a default assembly model loader
+        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
+        scdlLoaders.add(new SystemSCDLModelLoader());
+        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);
+
+        // Create a resource loader from the supplied classloader
+        ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);
+
+        // Create an assembly model context
+        return new AssemblyModelContextImpl(modelFactory, modelLoader, resourceLoader);
+    }
+
+    /**
+     * Returns a default list of configuration builders.
+     *
+     * @return a default list of configuration builders
+     */
+    public static List<ContextFactoryBuilder> getBuilders() {
+        List<ContextFactoryBuilder> configBuilders = new ArrayList<ContextFactoryBuilder>();
+        configBuilders.add((new SystemContextFactoryBuilder()));
+        configBuilders.add(new SystemEntryPointBuilder());
+        configBuilders.add(new SystemExternalServiceBuilder());
+        return configBuilders;
+    }
+
+    private static final boolean useStax = true;
+    private static final String SYSTEM_LOADER_COMPONENT = "tuscany.loader";
+
+    /**
+     * Returns the default module configuration loader.
+     *
+     * @param systemContext the runtime's system context
+     * @param modelContext  the model context the loader will use
+     * @return the default module configuration loader
+     */
+    public static ModuleComponentConfigurationLoader getConfigurationLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
+        if (useStax) {
+            // Bootstrap the StAX loader module
+            bootstrapStaxLoader(systemContext, modelContext);
+            return new StAXModuleComponentConfigurationLoaderImpl(modelContext, XMLInputFactory.newInstance(), systemContext.resolveInstance(StAXLoaderRegistry.class));
+        } else {
+            return new ModuleComponentConfigurationLoaderImpl(modelContext);
+        }
+    }
+
+    private static AggregateContext bootstrapStaxLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
+        AggregateContext loaderContext = (AggregateContext) systemContext.getContext(SYSTEM_LOADER_COMPONENT);
+        if (loaderContext == null) {
+            ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext);
+            loaderContext = registerModule(systemContext, loaderComponent);
+            loaderContext.fireEvent(EventContext.MODULE_START, null);
+        }
+        return loaderContext;
+    }
+
+    public static AggregateContext registerModule(AggregateContext parent, ModuleComponent component) throws ConfigurationException {
+        // register the component
+        parent.registerModelObject(component);
+
+        // Get the aggregate context representing the component
+        return (AggregateContext) parent.getContext(component.getName());
+    }
+}
\ No newline at end of file

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,88 @@
+/*
+ * 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.tuscany;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+
+public class CommonsLoggingMonitorFactory implements MonitorFactory {
+
+    private final Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>();
+    
+    public CommonsLoggingMonitorFactory() {
+    }
+
+    public <T> T getMonitor(Class<T> monitorInterface) {
+        T proxy = getCachedMonitor(monitorInterface);
+        if (proxy == null) {
+            proxy = createMonitor(monitorInterface);
+            proxies.put(monitorInterface, new WeakReference<T>(proxy));
+        }
+        return proxy;
+    }
+
+    private <T>T getCachedMonitor(Class<T> monitorInterface) {
+        WeakReference<T> ref = (WeakReference<T>) proxies.get(monitorInterface);
+        return (ref != null) ? ref.get() : null;
+    }
+
+    private <T>T createMonitor(Class<T> monitorInterface) {
+        String className = monitorInterface.getName();
+        Log logger = LogFactory.getLog(className);
+        InvocationHandler handler = new LoggingHandler(logger);
+        return (T) Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, handler);
+    }
+
+    private static final class LoggingHandler implements InvocationHandler {
+        private final Log logger;
+
+        public LoggingHandler(Log logger) {
+            this.logger = logger;
+        }
+
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            String sourceMethod = method.getName();
+            if (logger.isDebugEnabled()) {
+                // if the only argument is a Throwable use the special logger for it
+                if (args != null && args.length == 1 && args[0] instanceof Throwable) {
+                    logger.debug(sourceMethod, (Throwable) args[0]);
+                } else {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(sourceMethod);
+                    sb.append("(");
+                    for (int i = 0; i < args.length; i++) {
+                        if (i > 0) {
+                            sb.append(", ");
+                        }
+                        sb.append(args[i]);
+                    }
+                    sb.append(")");
+                    logger.debug(sb.toString());
+                }
+            }
+            return null;
+        }
+    }
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,172 @@
+/*
+ * 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.tuscany;
+
+import java.util.List;
+
+import org.apache.tuscany.common.monitor.MonitorFactory;
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.impl.DefaultWireBuilder;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.CoreRuntimeException;
+import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.SystemAggregateContext;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.runtime.RuntimeContextImpl;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.osoa.sca.ModuleContext;
+import org.osoa.sca.SCA;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class TuscanyRuntime extends SCA {
+    private final TuscanyRuntime.Monitor monitor;
+    private final Object sessionKey = new Object();
+
+    private final RuntimeContext runtime;
+    private final AggregateContext moduleContext;
+    
+    private final ModuleComponent moduleComponent;
+
+    private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system";
+
+    /**
+     * Construct a runtime using a null MonitorFactory.
+     *
+     * @param name the name of the module component
+     * @param uri  the URI to assign to the module component
+     * @throws ConfigurationException if there was a problem loading the SCA configuration
+     * @see TuscanyRuntime#TuscanyRuntime(String, String, org.apache.tuscany.common.monitor.MonitorFactory)
+     */
+    public TuscanyRuntime(String name, String uri) throws ConfigurationException {
+        this(name, uri, 
+             Thread.currentThread().getContextClassLoader(), 
+             new NullMonitorFactory());
+    }
+
+    /**
+     * Construct a runtime containing a single module component with the
+     * specified name. The module definition is loaded from a "/sca.module"
+     * resource found on the classpath of the current Thread context classloader.
+     *
+     * @param name           the name of the module component
+     * @param uri            the URI to assign to the module component
+     * @param classLoader    the class loader to use for the assembly
+     * @param monitorFactory the MonitorFactory for this runtime
+     * @throws ConfigurationException if there was a problem loading the SCA configuration
+     */
+    public TuscanyRuntime(String name, String uri, ClassLoader classLoader, MonitorFactory monitorFactory) throws ConfigurationException {
+        this.monitor = monitorFactory.getMonitor(TuscanyRuntime.Monitor.class);
+
+        // Create an assembly model context
+        AssemblyModelContext modelContext = BootstrapHelper.getModelContext(classLoader);
+
+        // Create a runtime context and start it
+        List<SCDLModelLoader> loaders = modelContext.getAssemblyLoader().getLoaders();
+        List<ContextFactoryBuilder> configBuilders = BootstrapHelper.getBuilders();
+        runtime = new RuntimeContextImpl(monitorFactory, loaders, configBuilders, new DefaultWireBuilder());
+        runtime.start();
+        monitor.started(runtime);
+
+        // Load and start the system configuration
+        SystemAggregateContext systemContext = runtime.getSystemContext();
+        ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
+        ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
+        AggregateContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
+        context.fireEvent(EventContext.MODULE_START, null);
+
+        // Load the SCDL configuration of the application module
+        AggregateContext rootContext = runtime.getRootContext();
+        moduleComponent = loader.loadModuleComponent(name, uri);
+        moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent);
+    }
+
+    public ModuleComponent getModuleComponent() {
+        return moduleComponent;
+    }
+    
+    public AggregateContext getModuleContext() {
+        return moduleContext;
+    }
+    
+    /**
+     * Start the runtime and associate the module context with the calling thread.
+     */
+    @Override
+    public void start() {
+        setModuleContext((ModuleContext) moduleContext);
+        try {
+            //moduleContext.start();
+            moduleContext.fireEvent(EventContext.MODULE_START, null);
+            moduleContext.fireEvent(EventContext.REQUEST_START, null);
+            moduleContext.fireEvent(EventContext.SESSION_NOTIFY, sessionKey);
+            monitor.started(moduleContext);
+        } catch (CoreRuntimeException e) {
+            setModuleContext(null);
+            monitor.startFailed(moduleContext, e);
+            //FIXME throw a better exception
+            throw new ServiceRuntimeException(e);
+        }
+    }
+
+    /**
+     * Disassociate the module context from the current thread and shut down the runtime.
+     */
+    @Override
+    public void stop() {
+        setModuleContext(null);
+        moduleContext.fireEvent(EventContext.REQUEST_END, null);
+        moduleContext.fireEvent(EventContext.SESSION_END, sessionKey);
+        moduleContext.fireEvent(EventContext.MODULE_STOP, null);
+        moduleContext.stop();
+        monitor.stopped(moduleContext);
+        runtime.stop();
+        monitor.stopped(runtime);
+    }
+
+    /**
+     * Monitor interface for a TuscanyRuntime.
+     */
+    public static interface Monitor {
+        /**
+         * Event emitted after the runtime has been started.
+         *
+         * @param ctx the runtime's module component context
+         */
+        void started(AggregateContext ctx);
+
+        /**
+         * Event emitted when an attempt to start the runtime failed.
+         *
+         * @param ctx the runtime's module component context
+         * @param e   the exception that caused the failure
+         */
+        void startFailed(AggregateContext ctx, CoreRuntimeException e);
+
+        /**
+         * Event emitted after the runtime has been stopped.
+         *
+         * @param ctx the runtime's module component context
+         */
+        void stopped(AggregateContext ctx);
+    }
+
+}
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/
------------------------------------------------------------------------------
--- 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/jbi/META-INF/
------------------------------------------------------------------------------
--- 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/jbi/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER Wed Aug  2 02:01:53 2006
@@ -0,0 +1,6 @@
+Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo PMC. 
+Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, 
+communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. 
+
+While incubation status is not necessarily a reflection of the completeness or stability of the code, it does 
+indicate that the project has yet to be fully endorsed by the ASF.

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/LICENSE?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/LICENSE (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/LICENSE Wed Aug  2 02:01:53 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/NOTICE?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/NOTICE (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/NOTICE Wed Aug  2 02:01:53 2006
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache ServiceMix distribution.               ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Additional copyright notices and license terms applicable are
+   present in the licenses directory of this distribution.

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/
------------------------------------------------------------------------------
--- 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/resources/META-INF/
------------------------------------------------------------------------------
--- 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/resources/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/DISCLAIMER?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/DISCLAIMER (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/DISCLAIMER Wed Aug  2 02:01:53 2006
@@ -0,0 +1,6 @@
+Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo PMC. 
+Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, 
+communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. 
+
+While incubation status is not necessarily a reflection of the completeness or stability of the code, it does 
+indicate that the project has yet to be fully endorsed by the ASF.

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/LICENSE?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/LICENSE (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/LICENSE Wed Aug  2 02:01:53 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/NOTICE?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/NOTICE (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/META-INF/NOTICE Wed Aug  2 02:01:53 2006
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache ServiceMix distribution.               ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Additional copyright notices and license terms applicable are
+   present in the licenses directory of this distribution.

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/system.fragment
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/system.fragment?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/system.fragment (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/resources/system.fragment Wed Aug  2 02:01:53 2006
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+    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.
+ -->
+<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+        xmlns:system="http://org.apache.tuscany/xmlns/system/0.9"
+		name="org.apache.servicemix.sca">
+
+    <component name="org.apache.servicemix.sca.builder.ExternalJbiServiceBuilder">
+        <system:implementation.system class="org.apache.servicemix.sca.builder.ExternalJbiServiceBuilder"/>
+    </component>
+
+    <component name="org.apache.servicemix.sca.builder.ExternalJbiServiceWireBuilder">
+        <system:implementation.system class="org.apache.servicemix.sca.builder.ExternalJbiServiceWireBuilder"/>
+    </component>
+
+    <component name="org.apache.servicemix.sca.builder.JbiServiceEntryPointBuilder">
+        <system:implementation.system class="org.apache.servicemix.sca.builder.JbiServiceEntryPointBuilder"/>
+    </component>
+
+    <component name="org.apache.servicemix.sca.loader.JbiBindingLoader">
+        <system:implementation.system class="org.apache.servicemix.sca.loader.JbiBindingLoader"/>
+    </component>
+
+</moduleFragment>

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/
------------------------------------------------------------------------------
--- 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/test/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/test/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/test/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/test/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/test/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/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/AssemblyLoaderTest.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,72 @@
+/*
+ * 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.net.URL;
+import java.net.URLClassLoader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.tuscany.TuscanyRuntime;
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Module;
+
+/**
+ * @author delfinoj
+ */
+public class AssemblyLoaderTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+    }
+
+    public void testLoader() throws Exception {
+        String name = "bigbank";
+        String uri  = getClass().getResource("bigbank/sca.module").toString();
+        
+        URL url = getClass().getResource("bigbank/sca.module");
+        URL parentUrl = new File(url.toURI()).getParentFile().toURL();
+        ClassLoader cl = new URLClassLoader(new URL[] { parentUrl }, getClass().getClassLoader());
+        
+        TuscanyRuntime rt = new TuscanyRuntime(name, uri, cl, new NullMonitorFactory());
+        assertNotNull(rt);
+        
+        Module module = rt.getModuleComponent().getModuleImplementation();
+
+        Assert.assertTrue(module.getName().equals("org.apache.servicemix.sca.bigbank"));
+
+        Component component = module.getComponent("AccountServiceComponent");
+        Assert.assertTrue(component != null);
+
+        EntryPoint entryPoint = module.getEntryPoint("AccountService");
+        Assert.assertTrue(entryPoint != null);
+
+        ExternalService externalService = module.getExternalService("StockQuoteService");
+        Assert.assertTrue(externalService != null);
+
+        Binding binding = externalService.getBindings().get(0);
+        Assert.assertTrue(binding instanceof JbiBinding);
+    }
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/ScaComponentTest.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,108 @@
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.File;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.components.util.MockServiceComponent;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteResponse;
+import org.w3c.dom.Node;
+
+public class ScaComponentTest extends TestCase {
+
+    private static Log log =  LogFactory.getLog(ScaComponentTest.class);
+    
+    protected JBIContainer container;
+    
+    protected void setUp() throws Exception {
+        container = new JBIContainer();
+        container.setUseMBeanServer(false);
+        container.setCreateMBeanServer(false);
+        container.setMonitorInstallationDirectory(false);
+        container.setNamingContext(new InitialContext());
+        container.setEmbedded(true);
+        container.init();
+    }
+    
+    protected void tearDown() throws Exception {
+        if (container != null) {
+            container.shutDown();
+        }
+    }
+    
+    public void testDeploy() throws Exception {
+        ScaComponent component = new ScaComponent();
+        container.activateComponent(component, "JSR181Component");
+
+        MockServiceComponent mock = new MockServiceComponent();
+        mock.setService(new QName("http://www.quickstockquote.com", "StockQuoteService"));
+        mock.setEndpoint("StockQuoteServiceJBI");
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        StockQuoteResponse r = new StockQuoteResponse();
+        r.setResult(8.23f);
+        JAXBContext.newInstance(StockQuoteResponse.class).createMarshaller().marshal(r, baos);
+        mock.setResponseXml(baos.toString());
+        ActivationSpec as = new ActivationSpec();
+        as.setComponent(mock);
+        container.activateComponent(as);
+        
+        // Start container
+        container.start();
+        
+        // Deploy SU
+        component.getServiceUnitManager().deploy("su", getServiceUnitPath("org/apache/servicemix/sca/bigbank"));
+        component.getServiceUnitManager().init("su", getServiceUnitPath("org/apache/servicemix/sca/bigbank"));
+        component.getServiceUnitManager().start("su");
+        
+        ServiceMixClient client = new DefaultServiceMixClient(container);
+        Source req = new StringSource("<AccountReportRequest><CustomerID>id</CustomerID></AccountReportRequest>");
+        Object rep = client.request(new ServiceNameEndpointResolver(
+        										new QName("http://sca.servicemix.apache.org/Bigbank/Account", "AccountService")),
+        			   						 null, null, req);
+        if (rep instanceof Node) {
+            rep = new DOMSource((Node) rep);
+        }
+        log.info(new SourceTransformer().toString((Source) rep));
+    }
+     
+    protected String getServiceUnitPath(String name) {
+        URL url = getClass().getClassLoader().getResource(name + "/sca.module");
+        File path = new File(url.getFile());
+        path = path.getParentFile();
+        return path.getAbsolutePath();
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/
------------------------------------------------------------------------------
--- 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/test/java/org/apache/servicemix/sca/bigbank/account/
------------------------------------------------------------------------------
--- 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/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportRequest.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.bigbank.account;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "customerID" })
+@XmlRootElement(name = "AccountReportRequest")
+public class AccountReportRequest {
+
+	@XmlElement(name = "CustomerID")
+	private String customerID;
+
+	public String getCustomerID() {
+		return customerID;
+	}
+
+	public void setCustomerID(String customerID) {
+		this.customerID = customerID;
+	}
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountReportResponse.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,43 @@
+/*
+ * 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.bigbank.account;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "accountSummaries" })
+@XmlRootElement(name = "AccountReportResponse")
+public class AccountReportResponse {
+
+	@XmlElement(name = "AccountSummaries")
+	private List<AccountSummary> accountSummaries;
+
+	public List<AccountSummary> getAccountSummaries() {
+		return accountSummaries;
+	}
+
+	public void setAccountSummaries(List<AccountSummary> accountSummaries) {
+		this.accountSummaries = accountSummaries;
+	}
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountService.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,25 @@
+/*
+ * 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.bigbank.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AccountService {
+
+    public AccountReportResponse getAccountReport(AccountReportRequest request);
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountServiceImpl.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,91 @@
+/*
+ * 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.bigbank.account;
+
+import java.util.ArrayList;
+
+import org.apache.servicemix.sca.bigbank.accountdata.AccountDataService;
+import org.apache.servicemix.sca.bigbank.accountdata.CheckingAccount;
+import org.apache.servicemix.sca.bigbank.accountdata.SavingsAccount;
+import org.apache.servicemix.sca.bigbank.accountdata.StockAccount;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteRequest;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteResponse;
+import org.apache.servicemix.sca.bigbank.stockquote.StockQuoteService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces=AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+    @Property
+    public String currency = "USD";
+
+    @Reference
+    public AccountDataService accountDataService;
+    @Reference
+    public StockQuoteService stockQuoteService;
+
+    public AccountServiceImpl() {
+    }
+
+    public AccountReportResponse getAccountReport(AccountReportRequest request) {
+    	AccountReportResponse report = new AccountReportResponse();
+    	String customerID = request.getCustomerID();
+    	report.setAccountSummaries(new ArrayList<AccountSummary>());
+    	report.getAccountSummaries().add(getCheckAccountSummary(customerID));
+    	report.getAccountSummaries().add(getSavingsAccountSummary(customerID));
+    	report.getAccountSummaries().add(getStockAccountSummary(customerID));
+        return report;
+    }
+    
+    private AccountSummary getCheckAccountSummary(String customerID) {
+    	CheckingAccount checking = accountDataService.getCheckingAccount(customerID);
+    	AccountSummary summary = new AccountSummary();
+    	summary.setAccountNumber(checking.getAccountNumber());
+    	summary.setAccountType("Checking");
+    	summary.setBalance(checking.getBalance());
+    	return summary;
+    }
+
+    private AccountSummary getSavingsAccountSummary(String customerID) {
+    	SavingsAccount savings = accountDataService.getSavingsAccount(customerID);
+    	AccountSummary summary = new AccountSummary();
+    	summary.setAccountNumber(savings.getAccountNumber());
+    	summary.setAccountType("Savings");
+    	summary.setBalance(savings.getBalance());
+    	return summary;
+    }
+
+    private AccountSummary getStockAccountSummary(String customerID) {
+    	StockAccount stock = accountDataService.getStockAccount(customerID);
+    	AccountSummary summary = new AccountSummary();
+    	summary.setAccountNumber(stock.getAccountNumber());
+    	summary.setAccountType("Stock");
+    	float quote = getQuote(stock.getSymbol());
+    	summary.setBalance(quote * stock.getQuantity());
+    	return summary;
+    }
+    
+    private float getQuote(String symbol) {
+    	StockQuoteRequest req = new StockQuoteRequest();
+    	req.setSymbol(symbol);
+    	StockQuoteResponse rep = stockQuoteService.getQuote(req);
+    	return rep.getResult();
+    }
+
+}

Added: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java?rev=427934&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/account/AccountSummary.java Wed Aug  2 02:01:53 2006
@@ -0,0 +1,66 @@
+/*
+ * 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.bigbank.account;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = { "accountNumber", "accountType", "balance" })
+@XmlRootElement(name = "AccountSummary")
+public class AccountSummary {
+
+	@XmlElement(name = "AccountNumber")
+	private String accountNumber;
+
+	@XmlElement(name = "AccountType")
+	private String accountType;
+
+	@XmlElement(name = "Balance")
+	private float balance;
+
+	public AccountSummary() {
+	}
+
+	public String getAccountNumber() {
+		return accountNumber;
+	}
+
+	public void setAccountNumber(String accountNumber) {
+		this.accountNumber = accountNumber;
+	}
+
+	public String getAccountType() {
+		return accountType;
+	}
+
+	public void setAccountType(String accountType) {
+		this.accountType = accountType;
+	}
+
+	public float getBalance() {
+		return balance;
+	}
+
+	public void setBalance(float balance) {
+		this.balance = balance;
+	}
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/test/java/org/apache/servicemix/sca/bigbank/accountdata/
------------------------------------------------------------------------------
--- 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
+



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