summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:42 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:42 +0000
commitf860c2f35b2f94e379d2ff7d5c13f54cd4a3132a (patch)
tree5808b087a5eb9f5d251932d6828565f6c5d4ed9e /sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany
parent587877fcbd358e233f653e01c4b3ed3354203626 (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835119 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany')
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java132
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java96
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java47
43 files changed, 2454 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
new file mode 100644
index 0000000000..7a42300098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
@@ -0,0 +1,69 @@
+/*
+ * 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.tuscany.sca.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Default implementation of a registry to hold all the Tuscany core extension
+ * points. As the point of contact for all extension artifacts this registry
+ * allows loaded extensions to find all other parts of the system and
+ * register themselves appropriately.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultExtensionPointRegistry implements ExtensionPointRegistry {
+ private Map<Class<?>, Object> extensionPoints = new HashMap<Class<?>, Object>();
+
+ /**
+ * Add an extension point to the registry. This default implementation
+ * stores extensions against the interfaces that they implement.
+ * @param extensionPoint The instance of the extension point
+ */
+ public void addExtensionPoint(Object extensionPoint) {
+ Class[] interfaces = extensionPoint.getClass().getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ extensionPoints.put(interfaces[i], extensionPoint);
+ }
+ }
+
+ /**
+ * Get the extension point by the interface that it implements
+ * @param extensionPointType The lookup key (extension point interface)
+ * @return The instance of the extension point
+ */
+ public <T> T getExtensionPoint(Class<T> extensionPointType) {
+ return extensionPointType.cast(extensionPoints.get(extensionPointType));
+ }
+
+ /**
+ * Remove an extension point based on the interface that it implements
+ * @param extensionPoint The extension point to remove
+ */
+ public void removeExtensionPoint(Object extensionPoint) {
+ Class[] interfaces = extensionPoint.getClass().getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ extensionPoints.remove(interfaces[i]);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..6765a6c8f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java
@@ -0,0 +1,67 @@
+/*
+ * 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.tuscany.sca.core;
+
+import java.util.HashMap;
+
+/**
+ * Default implementation of a model factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint {
+
+ private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ public void addFactory(Object factory) {
+ Class[] interfaces = factory.getClass().getInterfaces();
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.put(interfaces[i], factory);
+ }
+ }
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ public void removeFactory(Object factory) {
+ Class[] interfaces = factory.getClass().getInterfaces();
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.remove(interfaces[i]);
+ }
+ }
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface The lookup key (factory interface)
+ * @return The factory
+ */
+ public <T> T getFactory(Class<T> factoryInterface) {
+ Object factory = factories.get(factoryInterface);
+ return factoryInterface.cast(factory);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java
new file mode 100644
index 0000000000..9609487080
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java
@@ -0,0 +1,50 @@
+/*
+ * 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.tuscany.sca.core;
+
+
+/**
+ * The registry for the Tuscany core extension points. As the point of contact
+ * for all extension artifacts this registry allows loaded extensions to find
+ * all other parts of the system and register themselves appropriately.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExtensionPointRegistry {
+
+ /**
+ * Add an extension point to the registry
+ * @param extensionPoint The instance of the extension point
+ */
+ void addExtensionPoint(Object extensionPoint);
+
+ /**
+ * Get the extension point by the interface
+ * @param extensionPointType The lookup key (extension point interface)
+ * @return The instance of the extension point
+ */
+ <T> T getExtensionPoint(Class<T> extensionPointType);
+
+ /**
+ * Remove an extension point
+ * @param extensionPoint The extension point to remove
+ */
+ void removeExtensionPoint(Object extensionPoint);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..64706c6efc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java
@@ -0,0 +1,54 @@
+/*
+ * 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.tuscany.sca.core;
+
+/**
+ * An extension point for model factories. Model factories are provided to
+ * abstract the classes that represent artifacts in the assembly model away
+ * from their creation mechanism. When the runtime needs to extend the model
+ * as it reads in contributed artifacts it looks up the factory for the
+ * artifact required in this registry
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelFactoryExtensionPoint {
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ void addFactory(Object factory);
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ void removeFactory(Object factory);
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface the lookup key (factory interface)
+ * @return The factory
+ */
+ <T> T getFactory(Class<T> factoryInterface);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
new file mode 100644
index 0000000000..0244862309
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
@@ -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.tuscany.sca.core;
+
+
+/**
+ * ModuleActivator represents a module that plugs into the Tuscany system. Each
+ * module should provide an implementation of this interface and register the
+ * ModuleActivator implementation class by defining a file named
+ *
+ * "META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator"
+ *
+ * The content of the file is the class name of the ModuleActivator implementation.
+ * The implementation class must have a no-arg constructor. The same instance
+ * will be used to invoke all the methods during different phases of the module
+ * activation. Note that the start and stop methods defined by this interface
+ * take a reference to the Tuscany SCA runtime ExtensionPointRegistry. This
+ * gives the ModuleActivator the oppotunity to add extension points to the
+ * registry as it is requested to start up and remove them when it is requested
+ * to shut down.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModuleActivator {
+ /**
+ * Get a map of the extension points defined by this module. The key is the
+ * java interface to represent the extension point and the the value is the
+ * instance of the implementation of the interface.
+ *
+ * @return All the extension points defined by this module
+ */
+ Object[] getExtensionPoints();
+
+ /**
+ * This method is invoked when the module is started by the Tuscany system.
+ * It can be used by this module to registr extensions against extension
+ * points.
+ *
+ * @param registry The extension point registry
+ */
+ void start(ExtensionPointRegistry registry);
+
+ /**
+ * This method is invoked when the module is stopped by the Tuscany system.
+ * It can be used by this module to unregister extensions against the
+ * extension points.
+ *
+ * @param registry The extension point registry
+ */
+ void stop(ExtensionPointRegistry registry);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
new file mode 100644
index 0000000000..6a0c44a404
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.sca.event;
+
+/**
+ * The base interface for events that are propagated in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Event {
+
+ /**
+ * Returns the source of the event
+ */
+ Object getSource();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
new file mode 100644
index 0000000000..c116be921c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.event;
+
+/**
+ * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventFilter {
+
+ /**
+ * Performs the actual evaluation on an event
+ * @param event Returns true if the event matches implemented criteria
+ * @return Match result
+ */
+ boolean match(Event event);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
new file mode 100644
index 0000000000..b0debc36c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
@@ -0,0 +1,55 @@
+/*
+ * 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.tuscany.sca.event;
+
+/**
+ * Publishes events in the runtime by accepting {@link Event} objects and
+ * forwarding them to all registered {@link RuntimeEventListener} objects.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventPublisher {
+
+ /**
+ * Publish an event to all regisitered listeners
+ * @param object The event to publich
+ */
+ void publish(Event object);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ * @param listener The listener to add
+ */
+ void addListener(RuntimeEventListener listener);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ * @param filter The filter that will be applied before the lister is called
+ * @param listener The lister to add
+ */
+ void addListener(EventFilter filter, RuntimeEventListener listener);
+
+
+ /**
+ * Removes a previously registered listener
+ * @param listener The listener to remove
+ */
+ void removeListener(RuntimeEventListener listener);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
new file mode 100644
index 0000000000..b34dceee62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.event;
+
+import java.util.EventListener;
+
+/**
+ * Listeners observe events fired in the SCA runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeEventListener extends EventListener {
+
+ /**
+ * Accepts and event and acts on it
+ * @param event The event to act on
+ */
+ void onEvent(Event event);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
new file mode 100644
index 0000000000..ca0f4889a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
@@ -0,0 +1,37 @@
+/*
+ * 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.tuscany.sca.event;
+
+/**
+ * An event filter that always returns a true condition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TrueFilter implements EventFilter {
+
+ /**
+ * Performs the actual evaluation on an event. Always returns true
+ * in this case
+ * @param event The incoming event which is ignored
+ * @return true
+ */
+ public boolean match(Event event) {
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java
new file mode 100644
index 0000000000..a5f221fc11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java
@@ -0,0 +1,40 @@
+/*
+ * 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.tuscany.sca.invocation;
+
+/**
+ * Synchronous mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Interceptor extends Invoker {
+
+ /**
+ * Sets the next invoker
+ * @param next The next invoker
+ */
+ void setNext(Invoker next);
+
+ /**
+ * Returns the next invoker or null
+ * @return The next Invoker
+ */
+ Invoker getNext();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
new file mode 100644
index 0000000000..cd75d06ab3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
@@ -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.tuscany.sca.invocation;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * A wire consists of 1..n invocation chains associated with the operations of its source service contract.
+ * <p/>
+ * Invocation chains may contain </code>Interceptors</code> that process invocations.
+ * <p/>
+ * A <code>Message</code> is used to pass data associated with an invocation through the chain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InvocationChain {
+ /**
+ * Returns the target operation for this invocation chain.
+ *
+ * @return The target operation for this invocation chain
+ */
+ Operation getTargetOperation();
+
+ /**
+ * Returns the source operation for this invocation chain.
+ *
+ * @return The source operation for this invocation chain
+ */
+ Operation getSourceOperation();
+
+ /**
+ * Adds an interceptor to the chain
+ *
+ * @param interceptor The interceptor to add
+ */
+ void addInterceptor(Interceptor interceptor);
+
+ /**
+ * Adds an invoker to the chain
+ *
+ * @param invoker The invoker to add
+ */
+ void addInvoker(Invoker invoker);
+
+ /**
+ * Returns the first invoker in the chain.
+ *
+ * @return The first invoker in the chain
+ */
+ Invoker getHeadInvoker();
+
+ /**
+ * Returns the last invoker in the chain.
+ *
+ * @return The last invoker in the chain
+ */
+ Invoker getTailInvoker();
+
+ /**
+ * Adds an interceptor at the given position in the interceptor stack
+ *
+ * @param index The position in the interceptor stack to add the interceptor
+ * @param interceptor The interceptor to add
+ */
+ void addInterceptor(int index, Interceptor interceptor);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java
new file mode 100644
index 0000000000..2748bbed9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java
@@ -0,0 +1,36 @@
+/*
+ * 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.tuscany.sca.invocation;
+
+/**
+ * Synchronous mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Invoker {
+
+ /**
+ * Process a synchronous wire
+ *
+ * @param msg The request Message for the wire
+ * @return The response Message from the wire
+ */
+ Message invoke(Message msg);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
new file mode 100644
index 0000000000..ef23118e78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
@@ -0,0 +1,132 @@
+/*
+ * 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.tuscany.sca.invocation;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+
+/**
+ * Represents a request, response, or exception flowing through a wire
+ *
+ * @version $Rev $Date
+ */
+public interface Message {
+
+ /**
+ * Returns the body of the message, which will be the payload or parameters associated with the wire
+ * @return The body of the message
+ */
+ <T> T getBody();
+
+ /**
+ * Sets the body of the message.
+ * @param body The body of the message
+ */
+ <T> void setBody(T body);
+
+ /**
+ * Get the conversation id
+ * @return The conversation ID
+ */
+ String getConversationID();
+
+ /**
+ * Set the conversation id
+ * @param conversationId The conversation ID
+ */
+ void setConversationID(String conversationId);
+
+ /**
+ * Get the end point reference of the source reference
+ * @return The end point reference of the reference originating the message
+ */
+ EndpointReference getFrom();
+
+ /**
+ * Set the end point reference of the reference originating the message
+ * @param from The end point reference of the reference originating the message
+ */
+ void setFrom(EndpointReference from);
+
+ /**
+ * Get the end point reference of target service
+ * @return The end point reference of the service that the message targets
+ */
+ EndpointReference getTo();
+
+ /**
+ * Set the end point reference of target service
+ * @param to The end point reference of the service that the message targets
+ */
+ void setTo(EndpointReference to);
+
+ /**
+ * Returns the id of the message
+ * @return The message Id
+ */
+ Object getMessageID();
+
+ /**
+ * Sets the id of the message
+ * @param messageId The message ID
+ */
+ void setMessageID(Object messageId);
+
+ /**
+ * Returns the correlation id of the message or null if one is not available. Correlation ids are used by transports
+ * for message routing.
+ * @return The correlation Id
+ */
+ Object getCorrelationID();
+
+ /**
+ * Sets the correlation id of the message. Correlation ids are used by transports for message routing.
+ * @param correlationId The correlation Id
+ */
+ void setCorrelationID(Object correlationId);
+
+ /**
+ * Determines if the message represents a fault/exception
+ *
+ * @return true If the message body is a fault object, false if the body is a normal payload
+ */
+ boolean isFault();
+
+ /**
+ * Set the message body with a fault object. After this method is called, isFault() returns true.
+ *
+ * @param fault The fault object represents an exception
+ */
+ <T> void setFaultBody(T fault);
+
+ /**
+ * Returns the conversational sequence the message is associated with, NONE, START, CONTINUE, or END on TargetInvoker}
+ *
+ * @return The conversational sequence the message is associated with
+ */
+ ConversationSequence getConversationSequence();
+
+ /**
+ * Returns the conversational sequence the message is associated with, NONE, START, CONTINUE, or END
+ *
+ * @param sequence The conversational sequence
+ */
+ void setConversationSequence(ConversationSequence sequence);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java
new file mode 100644
index 0000000000..c2a9c488b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java
@@ -0,0 +1,36 @@
+/*
+ * 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.tuscany.sca.invocation;
+
+
+/**
+ * A factory for messages
+ *
+ * @version $Rev $Date
+ */
+public interface MessageFactory {
+
+ /**
+ * Creates a new message.
+ *
+ * @return The new message
+ */
+ Message createMessage();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
new file mode 100644
index 0000000000..3626e16425
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
@@ -0,0 +1,39 @@
+/*
+ * 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.tuscany.sca.management;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Interface for the management service abstraction. The implementaion
+ * could be based on a variety of technologies including JMX, WSDM,
+ * SNMP etc.
+ *
+ * @version $Revision$ $Date$
+ */
+public interface ManagementService {
+
+ /**
+ * Registers a component for management.
+ *
+ * @param name Name of the component.
+ * @param component Component to be registered.
+ */
+ void registerComponent(String name, RuntimeComponent component);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
new file mode 100644
index 0000000000..0f6a932c51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
@@ -0,0 +1,60 @@
+/*
+ * 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.tuscany.sca.provider;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A factory for creating the runtime artifacts that represent bindings.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingProviderFactory<M extends Binding> extends ProviderFactory<M> {
+
+ /**
+ * Creates a new reference binding provider for the given component and
+ * reference.
+ *
+ * @param component The runtime component
+ * @param reference The reference on the runtime component
+ * @param binding The binding assembly model object
+ * @return The binding provider
+ */
+ ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ M binding);
+
+ /**
+ * Creates a new service binding provider for the given component and
+ * service.
+ *
+ * @param component The runtime component
+ * @param service The service on the runtime component
+ * @param binding The binding assembly model object
+ * @return The binding provider
+ */
+ ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ M binding);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..1adb9287f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
@@ -0,0 +1,76 @@
+/*
+ * 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.tuscany.sca.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExtensionPoint {
+
+ protected final Map<Class<?>, ProviderFactory> providerFactories =
+ new HashMap<Class<?>, ProviderFactory>();
+
+ /**
+ * The default constructor. Does nothing.
+ *
+ */
+ public DefaultProviderFactoryExtensionPoint() {
+ }
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void addProviderFactory(ProviderFactory providerFactory) {
+ providerFactories.put(providerFactory.getModelType(), providerFactory);
+ }
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void removeProviderFactory(ProviderFactory providerFactory) {
+ providerFactories.remove(providerFactory.getModelType());
+ }
+
+ /**
+ * Returns the provider factory associated with the given model type.
+ * @param modelType A model type
+ * @return The provider factory associated with the given model type
+ */
+ public ProviderFactory getProviderFactory(Class<?> modelType) {
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ ProviderFactory factory = providerFactories.get(c);
+ if (factory != null) {
+ return factory;
+ }
+ }
+ return providerFactories.get(modelType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java
new file mode 100644
index 0000000000..a680277b99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java
@@ -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.tuscany.sca.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A component implementation can implement this interface in order to tie
+ * into the Tuscany runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProvider {
+
+ /**
+ * This method will be invoked when the component implementation
+ * is activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component implementation
+ * is deactivated.
+ */
+ void stop();
+
+ /**
+ * Create an invoker for the component implementation in the invocation
+ * chain. The invoker will be responsible for calling the implementation
+ * logic for the given component.
+ *
+ * @param service The component service
+ * @param operation The operation that the interceptor will handle
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(RuntimeComponentService service, Operation operation);
+
+ /**
+ * Create an invoker to call back to the given component
+ * @param operation The operation
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createCallbackInvoker(Operation operation);
+
+ // InterfaceContract getImplementationInterfaceContract(RuntimeComponentService service);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java
new file mode 100644
index 0000000000..6a37d1e951
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java
@@ -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.tuscany.sca.provider;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * An interface for factories that create implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProviderFactory<M extends Implementation> extends ProviderFactory<M> {
+
+ /**
+ * Creates a new implementation provider for the given
+ * component.
+ *
+ * @param component The runtime component
+ * @param Implementation The implementation type
+ * @return The implementation provider
+ */
+ ImplementationProvider createImplementationProvider(RuntimeComponent component, M Implementation);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java
new file mode 100644
index 0000000000..2102806881
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java
@@ -0,0 +1,36 @@
+/*
+ * 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.tuscany.sca.provider;
+
+/**
+ * A factory for runtime providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProviderFactory<M> {
+
+ /**
+ * The model type that this factory creates providers for.
+ *
+ * @return the model type
+ */
+ Class<M> getModelType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..5e781dd5b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java
@@ -0,0 +1,55 @@
+/*
+ * 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.tuscany.sca.provider;
+
+
+/**
+ * An extension point for provider factories. Holds all of the provider
+ * factories from loaded extension points. Allows a provider factory
+ * to be located based on a given model type. Hence the runtime can
+ * generate runtime artifacts from the in memory assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProviderFactoryExtensionPoint {
+
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ void addProviderFactory(ProviderFactory providerFactory);
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ void removeProviderFactory(ProviderFactory providerFactory);
+
+ /**
+ * Returns the provider factory associated with the given model type.
+ * @param modelType A model type
+ * @return The provider factory associated with the given model type
+ */
+ ProviderFactory getProviderFactory(Class<?> modelType);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
new file mode 100644
index 0000000000..4da4108168
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
@@ -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.tuscany.sca.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+
+/**
+ * A reference binding implementation can options implement this
+ * interface to tie into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceBindingProvider {
+
+ /**
+ * This method will be invoked when the component reference binding is
+ * activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component reference binding is
+ * deactivated.
+ */
+ void stop();
+
+ /**
+ * Create an invoker for the reference binding in the invocation chain. The
+ * invoker is responsible for making the outbound invocation over the
+ * binding protocol.
+ *
+ * @param operation The operation that the interceptor will handle
+ * @param isCallback A flag to tell if the operation is for the callback
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(Operation operation, boolean isCallback);
+
+ /**
+ * Get the effective interface contract imposed by the binding. For example,
+ * it will be interface contract introspected from the WSDL portType used by
+ * the endpoint for a WebService binding.
+ *
+ * @return The effective interface contract, if null is returned, the
+ * interface contract for the component reference will be used
+ */
+ InterfaceContract getBindingInterfaceContract();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java
new file mode 100644
index 0000000000..d2646d8d00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java
@@ -0,0 +1,52 @@
+/*
+ * 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.tuscany.sca.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * A service binding can optionally implement this interface to tie
+ * into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServiceBindingProvider {
+ /**
+ * This method will be invoked when the component service binding is
+ * activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component service binding is
+ * deactivated.
+ */
+ void stop();
+
+ /**
+ * Get the effective interface contract imposed by the binding. For example,
+ * it will be interface contract introspected from the WSDL portType used by
+ * the endpoint for a WebService binding.
+ *
+ * @return The effective interface contract, if null is returned, the
+ * interface contract for the component service will be used
+ */
+ InterfaceContract getBindingInterfaceContract();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java
new file mode 100644
index 0000000000..851afee3c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java
@@ -0,0 +1,63 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * The default implementation of a <code>WireProcessorExtensionPoint</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWireProcessorExtensionPoint implements RuntimeWireProcessorExtensionPoint {
+
+ /**
+ * The list of WireProcessors available to the runtime
+ */
+ private final List<RuntimeWireProcessor> processors = new ArrayList<RuntimeWireProcessor>();
+
+ /**
+ * Registers a wire-processor in the runtime
+ *
+ * @param processor The processor to register
+ */
+ public void addWireProcessor(RuntimeWireProcessor processor) {
+ processors.add(processor);
+ }
+
+ /**
+ * De-registers a wire-processor in the runtime
+ *
+ * @param processor The processor to de-register
+ */
+ public void removeWireProcessor(RuntimeWireProcessor processor) {
+ processors.remove(processor);
+ }
+
+ /**
+ * Returns a list of registered wire-processors.
+ *
+ * @return The list of wire processors
+ */
+ public List<RuntimeWireProcessor> getWireProcessors() {
+ return processors;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
new file mode 100644
index 0000000000..627180b2d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
@@ -0,0 +1,64 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * The endpoint reference for a component service or reference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointReference {
+ /**
+ * Get the component for the endpoint
+ * @return The component, null of the EPR is for a non-SCA service
+ */
+ RuntimeComponent getComponent();
+
+ /**
+ * Get the component service or reference for the endpoint
+ * @return The component service or reference, null if the EPR is for a non-SCA service
+ */
+ Contract getContract();
+
+ /**
+ * Get the binding for the endpoint
+ * @return The binding
+ */
+ Binding getBinding();
+
+ //FIXME Why do we need this? isn't the interface contract already on the Contract?
+
+ /**
+ * Get the interface contract for the endpoint
+ * @return The interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Get the URI for this endpoint
+ * @return The URI of the endpoint
+ */
+ String getURI();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
new file mode 100644
index 0000000000..ddb5ae746c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
@@ -0,0 +1,45 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * The runtime component interface. Provides the bridge between the
+ * assembly model representation of a component and its runtime
+ * realization.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponent extends Component, ComponentContext {
+ /**
+ * Set the implementation-specific configuration for this component
+ * @param implementationProvider The object that manages the component implementation
+ */
+ void setImplementationProvider(ImplementationProvider implementationProvider);
+
+ /**
+ * Get the implementation-specific configuation for this component
+ * @return The implementation provider for this component
+ */
+ ImplementationProvider getImplementationProvider();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
new file mode 100644
index 0000000000..18166d8c1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
@@ -0,0 +1,80 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+
+/**
+ * The runtime component reference. Provides the bridge between the
+ * assembly model representation of a component reference and its runtime
+ * realization
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentReference extends ComponentReference {
+
+ /**
+ * Get a list of runtime wires to the reference
+ *
+ * @return The list of wires
+ */
+ List<RuntimeWire> getRuntimeWires();
+
+ /**
+ * Get the runtime wire for the given binding
+ * @param binding The assembly model binding
+ * @return The runtime wire
+ */
+ RuntimeWire getRuntimeWire(Binding binding);
+
+ /**
+ * Returns the reference binding provider associated with this
+ * component reference and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @return The runtime reference binding provider
+ */
+ ReferenceBindingProvider getBindingProvider(Binding binding);
+
+ /**
+ * Sets the reference binding provider associated with this
+ * component reference and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime reference binding provider
+ */
+ void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
+
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime Invoker
+ */
+ Invoker getInvoker(Binding binding, Operation operation);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
new file mode 100644
index 0000000000..19327321a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
@@ -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.tuscany.sca.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+
+/**
+ * The runtime component service. Provides the bridge between the
+ * assembly model representation of a component service and its runtime
+ * realization
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentService extends ComponentService {
+
+ /**
+ * Get a list of runtime wires to the service
+ *
+ * @return The list of wires
+ */
+ List<RuntimeWire> getRuntimeWires();
+ /**
+ * Get the runtime wire for the given binding
+ * @param binding The assembly model binding
+ * @return The runtime wire
+ */
+ RuntimeWire getRuntimeWire(Binding binding);
+
+ /**
+ * Get the callback wires assoicated with this service
+ *
+ * @return The list of runtime callback wires
+ */
+ List<RuntimeWire> getCallbackWires();
+
+ /**
+ * Returns the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @return The runtime service binding provider
+ */
+ ServiceBindingProvider getBindingProvider(Binding binding);
+
+ /**
+ * Sets the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime service binding provider
+ */
+ void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider);
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime invoker
+ */
+ Invoker getInvoker(Binding binding, Operation operation);
+
+ /**
+ * Get the callback invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime callback invoker
+ */
+ Invoker getCallbackInvoker(Binding binding, Operation operation);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
new file mode 100644
index 0000000000..d6b56d822e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
@@ -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.tuscany.sca.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.invocation.InvocationChain;
+
+/**
+ * The runtime wire interface that connects a component reference to a
+ * component service (or an external service) over the selected binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWire {
+
+ /**
+ * Get the source of the wire
+ *
+ * @return The end point reference of the source
+ */
+ EndpointReference getSource();
+
+ /**
+ * Get the target of the wire
+ *
+ * @return The end point reference of the target
+ */
+ EndpointReference getTarget();
+
+ /**
+ * Returns the invocation chains for service operations associated with the
+ * wire
+ *
+ * @return the invocation chains for service operations associated with the
+ * wire
+ */
+ List<InvocationChain> getInvocationChains();
+
+ /**
+ * Returns the invocation chains for callback service operations associated
+ * with the wire
+ *
+ * @return the invocation chains for callback service operations associated
+ * with the wire
+ */
+ List<InvocationChain> getCallbackInvocationChains();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
new file mode 100644
index 0000000000..fbb7aae467
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+/**
+ * Implementations are called after wires are decorated with policy and before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWireProcessor {
+
+ /**
+ * Process the runtime wire to add interceptors
+ *
+ * @param wire
+ */
+ void process(RuntimeWire wire);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java
new file mode 100644
index 0000000000..4b2c71b397
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java
@@ -0,0 +1,53 @@
+/*
+ * 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.tuscany.sca.runtime;
+
+import java.util.List;
+
+/**
+ * Acts as a delegating <code>WireProcessorExtensionPoint</code>, delegating
+ * processing of wires after policies have been applied and source and targets
+ * have been connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWireProcessorExtensionPoint {
+
+ /**
+ * Registers a wire-processor in the runtime
+ *
+ * @param processor The processor to register
+ */
+ void addWireProcessor(RuntimeWireProcessor processor);
+
+ /**
+ * De-registers a wire-processor in the runtime
+ *
+ * @param processor The processor to de-register
+ */
+ void removeWireProcessor(RuntimeWireProcessor processor);
+
+ /**
+ * Returns a list of registered wire-processors.
+ *
+ * @return The list of wire processors
+ */
+ List<RuntimeWireProcessor> getWireProcessors();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
new file mode 100644
index 0000000000..3cf82982dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.tuscany.sca.store;
+
+/**
+ * thrown when a record already exists during an insert operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateRecordException extends StoreWriteException {
+ private static final long serialVersionUID = 3116253222569378447L;
+
+ public DuplicateRecordException() {
+ super();
+ }
+
+ public DuplicateRecordException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DuplicateRecordException(String message) {
+ super(message);
+ }
+
+ public DuplicateRecordException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
new file mode 100644
index 0000000000..9d965a3369
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tuscany.sca.store;
+
+import java.util.UUID;
+
+/**
+ * Implementations receive callback events during a store recovery operation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RecoveryListener {
+
+ /**
+ * Signals the start of a recovery
+ */
+ void onBegin();
+
+ /**
+ * Received when a record is recovered
+ *
+ * @param id
+ */
+ void onRecord(UUID id);
+
+ /**
+ * Signals the end of recovery
+ */
+ void onEnd();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
new file mode 100644
index 0000000000..b15cde066a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
@@ -0,0 +1,96 @@
+/*
+ * 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.tuscany.sca.store;
+
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Implementations provide a persistent store for runtime data such as conversational state. A persistent store could be
+ * implemented in a durable fashion using JDBC or a journaling system, or using a non-durable mechanism such as an
+ * in-memory map.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Store extends EventPublisher {
+
+ /* Used to indicate an the default expiration offset for records for the store */
+ long DEFAULT_EXPIRATION_OFFSET = -1;
+
+ /* Used to indicate an entry should not expire */
+ long NEVER = -2;
+
+ /**
+ * Adds the given record to the store. Implementations may choose different strategies for writing data such as
+ * write-through or write-behind.
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @param object the object representing the data to write
+ * @param expiration the time in milliseconds when the entry expires
+ * @throws StoreWriteException if an error occurs during the write operation
+ */
+ void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
+
+ /**
+ * Updates a given record in the store, overwriting previous information.
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @param object the object representing the data to write
+ * @param expiration the time in milliseconds when the entry expires
+ * @throws StoreWriteException
+ */
+ void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
+
+ /**
+ * Returns the deserialized object in the store corresponding to the given id
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @return the deserialized object or null if one is not found
+ * @throws StoreReadException
+ */
+ Object readRecord(RuntimeComponent owner, String id) throws StoreReadException;
+
+ /**
+ * Removes a record from the store
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @throws StoreWriteException
+ */
+ void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException;
+
+ /**
+ * Removes all records from the store
+ *
+ * @throws StoreWriteException
+ */
+ void removeRecords() throws StoreWriteException;
+
+ /**
+ * Initiates a recovery operation, for example during restart after a crash
+ *
+ * @param listener the listener to receive recovery callback events
+ * @throws StoreReadException
+ */
+ void recover(RecoveryListener listener) throws StoreReadException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
new file mode 100644
index 0000000000..647eba33aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tuscany.sca.store;
+
+
+/**
+ * Represents a generic exception thrown by a <code>Store</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreException extends Exception {
+ private static final long serialVersionUID = -319152147419962709L;
+
+ public StoreException() {
+ super();
+ }
+
+ public StoreException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreException(String message) {
+ super(message);
+ }
+
+ public StoreException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
new file mode 100644
index 0000000000..5c1a3ca79d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
@@ -0,0 +1,71 @@
+/*
+ * 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.tuscany.sca.store;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Fired when a store implementation expires a resource
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreExpirationEvent implements Event {
+ private Object source;
+ private RuntimeComponent owner;
+ private Object instance;
+
+ /**
+ * Constructor.
+ *
+ * @param source the source of the event
+ * @param owner the owner of the expiring object
+ * @param instance the expiring object
+ */
+ public StoreExpirationEvent(Object source, RuntimeComponent owner, Object instance) {
+ assert source != null;
+ assert owner != null;
+ assert instance != null;
+ this.source = source;
+ this.owner = owner;
+ this.instance = instance;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ /**
+ * Returns the owner of the expiring object.
+ *
+ * @return the owner of the expiring object.
+ */
+ public RuntimeComponent getOwner() {
+ return owner;
+ }
+
+ /**
+ * Returns the expiring object.
+ *
+ * @return the expiring object.
+ */
+ public Object getInstance() {
+ return instance;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
new file mode 100644
index 0000000000..66bbae684d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
@@ -0,0 +1,71 @@
+/*
+ * 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.tuscany.sca.store;
+
+
+/**
+ * A generic monintor interface for services to log events
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StoreMonitor {
+
+ /**
+ * Signals the service has started
+ *
+ * @param msg
+ */
+ void start(String msg);
+
+ /**
+ * Signals the service has been shutdown
+ *
+ * @param msg
+ */
+ void stop(String msg);
+
+ /**
+ * Fired when recovery is started
+ */
+
+ void beginRecover();
+
+ /**
+ * Fired when recovery is completed
+ */
+
+ void endRecover();
+
+ /**
+ * Fired when a record is processed during recovery
+ *
+ * @param recordId the id of the record being recovered
+ */
+
+ void recover(Object recordId);
+
+ /**
+ * Signals an error event
+ *
+ * @param e the error
+ */
+
+ void error(Throwable e);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
new file mode 100644
index 0000000000..3a563b9fb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.tuscany.sca.store;
+
+/**
+ * Thrown when an error occurs reading from persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreReadException extends StoreException {
+ private static final long serialVersionUID = -8624542082121467271L;
+
+ public StoreReadException() {
+ super();
+ }
+
+ public StoreReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreReadException(String message) {
+ super(message);
+ }
+
+ public StoreReadException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
new file mode 100644
index 0000000000..ad55ce386b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.tuscany.sca.store;
+
+/**
+ * Thrown when an error occurs writing to persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreWriteException extends StoreException {
+ private static final long serialVersionUID = 5539070473942048555L;
+
+ public StoreWriteException() {
+ super();
+ }
+
+ public StoreWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreWriteException(String message) {
+ super(message);
+ }
+
+ public StoreWriteException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java
new file mode 100644
index 0000000000..5701a04ed1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java
@@ -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.tuscany.sca.work;
+
+/**
+ * A callback inyterface that can be optionally used for registering
+ * interest in status of asynchronously scheduled unit of work.
+ *
+ */
+public interface NotificationListener<T extends Runnable> {
+
+ /**
+ * Callback method when the unit of work is accepted.
+ *
+ * @param work Work that was accepted.
+ */
+ void workAccepted(T work);
+
+ /**
+ * Callback method when the unit of work is successfully completed.
+ *
+ * @param work Work that was succesfully completed.
+ */
+ void workCompleted(T work);
+
+ /**
+ * Callback when the unit of work is started.
+ *
+ * @param work Unit of work that was started.
+ */
+ void workStarted(T work);
+
+ /**
+ * Callback when the unit of work is rejected.
+ *
+ * @param work Unit of work that was rejected.
+ */
+ void workRejected(T work);
+
+ /**
+ * Callnack when the unit of work fails to complete.
+ *
+ * @param work Unit of work that failed to complete.
+ * @param error Error that caused the unit of work to fail.
+ */
+ void workFailed(T work, Throwable error);
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
new file mode 100644
index 0000000000..99cb601107
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
@@ -0,0 +1,52 @@
+/*
+ * 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.tuscany.sca.work;
+
+/**
+ * Defines the contract for scheduling asychronous units of work.
+ *
+ * <p>
+ * Units of work can be scheduled with an optional <code>NotificationListener</code>.
+ * If a notification listener is specified, the caller will be notified regarding the
+ * status of the work. The unit of work can either be completed, rejected or completed
+ * with an error. If the work completed with an error, the caller is notfied with the
+ * error details.
+ * </p>
+ *
+ */
+public interface WorkScheduler {
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener
+ * is used to register interest in callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ * @param listener Notification listener for callbacks.
+ */
+ <T extends Runnable>void scheduleWork(T work, NotificationListener<T> listener);
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener
+ * is used to register interest in callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ */
+ <T extends Runnable>void scheduleWork(T work);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java
new file mode 100644
index 0000000000..f3d32e376b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java
@@ -0,0 +1,47 @@
+/*
+ * 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.tuscany.sca.work;
+
+
+/**
+ * Exception thrown by the work scheduler in case of unexpected exceptions.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class WorkSchedulerException extends RuntimeException {
+
+ public WorkSchedulerException() {
+ super();
+ }
+
+ public WorkSchedulerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WorkSchedulerException(String message) {
+ super(message);
+ }
+
+ public WorkSchedulerException(Throwable cause) {
+ super(cause);
+ }
+
+}