From a40e527938d76ba71f211da7e327adb50384ba69 Mon Sep 17 00:00:00 2001
From: lresende
Date: Wed, 11 Nov 2009 23:26:33 +0000
Subject: Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835157 13f79535-47bb-0310-9956-ffa450edef68
---
.../tags/1.0-incubator-M2/kernel/spi/.checkstyle | 24 +
sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.pmd | 20 +
.../tags/1.0-incubator-M2/kernel/spi/.ruleset | 190 +++++
.../tags/1.0-incubator-M2/kernel/spi/LICENSE.txt | 202 +++++
.../tags/1.0-incubator-M2/kernel/spi/NOTICE.txt | 14 +
.../tags/1.0-incubator-M2/kernel/spi/pom.xml | 68 ++
.../kernel/spi/src/doc/Context Model.emx | 673 +++++++++++++++
.../org/apache/tuscany/spi/AbstractLifecycle.java | 77 ++
.../apache/tuscany/spi/CoreRuntimeException.java | 45 +
.../apache/tuscany/spi/InvalidNameException.java | 45 +
.../java/org/apache/tuscany/spi/Lifecycle.java | 69 ++
.../tuscany/spi/ObjectCreationException.java | 48 ++
.../java/org/apache/tuscany/spi/ObjectFactory.java | 35 +
.../java/org/apache/tuscany/spi/QualifiedName.java | 84 ++
.../apache/tuscany/spi/annotation/Autowire.java | 46 +
.../tuscany/spi/bootstrap/ComponentNames.java | 50 ++
.../tuscany/spi/bootstrap/RuntimeComponent.java | 53 ++
.../apache/tuscany/spi/builder/BindingBuilder.java | 44 +
.../tuscany/spi/builder/BindlessBuilder.java | 44 +
.../org/apache/tuscany/spi/builder/Builder.java | 82 ++
.../spi/builder/BuilderConfigException.java | 44 +
.../tuscany/spi/builder/BuilderException.java | 46 +
.../tuscany/spi/builder/BuilderRegistry.java | 62 ++
.../tuscany/spi/builder/ComponentBuilder.java | 36 +
.../org/apache/tuscany/spi/builder/Connector.java | 51 ++
.../builder/InvalidServiceInterfaceException.java | 35 +
.../spi/builder/PostProcessingException.java | 41 +
.../tuscany/spi/builder/WirePostProcessor.java | 43 +
.../spi/builder/WirePostProcessorExtension.java | 43 +
.../spi/builder/WirePostProcessorRegistry.java | 44 +
.../tuscany/spi/component/AbstractSCAObject.java | 122 +++
.../tuscany/spi/component/AtomicComponent.java | 66 ++
.../spi/component/AutowireResolutionException.java | 45 +
.../apache/tuscany/spi/component/Component.java | 98 +++
.../spi/component/ComponentNotFoundException.java | 41 +
.../spi/component/ComponentRuntimeException.java | 46 +
.../tuscany/spi/component/CompositeComponent.java | 184 ++++
.../spi/component/DuplicateNameException.java | 44 +
.../spi/component/IllegalTargetException.java | 41 +
.../component/InvalidComponentTypeException.java | 41 +
.../spi/component/ObjectRegistrationException.java | 41 +
.../apache/tuscany/spi/component/Reference.java | 104 +++
.../spi/component/ReferenceNotFoundException.java | 45 +
.../apache/tuscany/spi/component/SCAObject.java | 76 ++
.../tuscany/spi/component/ScopeContainer.java | 56 ++
.../spi/component/ScopeNotFoundException.java | 41 +
.../tuscany/spi/component/ScopeRegistry.java | 37 +
.../spi/component/ScopeRuntimeException.java | 47 ++
.../org/apache/tuscany/spi/component/Service.java | 97 +++
.../spi/component/SystemAtomicComponent.java | 37 +
.../tuscany/spi/component/TargetException.java | 46 +
.../spi/component/TargetNotFoundException.java | 41 +
.../apache/tuscany/spi/component/WorkContext.java | 66 ++
.../tuscany/spi/databinding/DataBinding.java | 56 ++
.../spi/databinding/DataBindingRegistry.java | 67 ++
.../apache/tuscany/spi/databinding/DataPipe.java | 44 +
.../apache/tuscany/spi/databinding/Mediator.java | 56 ++
.../tuscany/spi/databinding/PullTransformer.java | 36 +
.../tuscany/spi/databinding/PushTransformer.java | 34 +
.../tuscany/spi/databinding/SimpleTypeMapper.java | 44 +
.../spi/databinding/TransformationContext.java | 72 ++
.../spi/databinding/TransformationException.java | 46 +
.../tuscany/spi/databinding/Transformer.java | 49 ++
.../spi/databinding/TransformerRegistry.java | 75 ++
.../tuscany/spi/databinding/WrapperHandler.java | 56 ++
.../spi/databinding/extension/DOMHelper.java | 69 ++
.../extension/DataBindingExtension.java | 104 +++
.../extension/Java2SimpleTypeTransformer.java | 61 ++
.../extension/SimpleType2JavaTransformer.java | 69 ++
.../extension/SimpleTypeMapperExtension.java | 391 +++++++++
.../extension/TransformerExtension.java | 66 ++
.../extension/XSDDataTypeConverter.java | 940 +++++++++++++++++++++
.../tuscany/spi/deployer/CompositeClassLoader.java | 52 ++
.../org/apache/tuscany/spi/deployer/Deployer.java | 46 +
.../tuscany/spi/deployer/DeploymentContext.java | 84 ++
.../java/org/apache/tuscany/spi/event/Event.java | 33 +
.../org/apache/tuscany/spi/event/EventFilter.java | 33 +
.../apache/tuscany/spi/event/EventPublisher.java | 50 ++
.../tuscany/spi/event/RuntimeEventListener.java | 31 +
.../org/apache/tuscany/spi/event/TrueFilter.java | 31 +
.../spi/extension/AtomicComponentExtension.java | 149 ++++
.../spi/extension/BindingBuilderExtension.java | 76 ++
.../spi/extension/ComponentBuilderExtension.java | 93 ++
.../extension/ComponentTypeLoaderExtension.java | 61 ++
.../spi/extension/CompositeComponentExtension.java | 524 ++++++++++++
.../tuscany/spi/extension/LoaderExtension.java | 77 ++
.../tuscany/spi/extension/ReferenceExtension.java | 104 +++
.../tuscany/spi/extension/ServiceExtension.java | 98 +++
.../extension/SystemAtomicComponentExtension.java | 72 ++
.../spi/extension/TargetInvokerExtension.java | 68 ++
.../org/apache/tuscany/spi/host/ServletHost.java | 48 ++
.../org/apache/tuscany/spi/idl/ElementInfo.java | 54 ++
.../spi/idl/InvalidServiceContractException.java | 41 +
.../spi/idl/OverloadedOperationException.java | 43 +
.../java/org/apache/tuscany/spi/idl/TypeInfo.java | 66 ++
.../org/apache/tuscany/spi/idl/WrapperInfo.java | 117 +++
.../spi/idl/java/InterfaceJavaIntrospector.java | 46 +
.../apache/tuscany/spi/idl/java/JavaIDLUtils.java | 96 +++
.../spi/idl/java/JavaInterfaceProcessor.java | 34 +
.../idl/java/JavaInterfaceProcessorExtension.java | 45 +
.../idl/java/JavaInterfaceProcessorRegistry.java | 39 +
.../tuscany/spi/idl/java/JavaServiceContract.java | 39 +
.../java/AbstractPropertyProcessor.java | 163 ++++
.../implementation/java/ConstructorDefinition.java | 51 ++
.../java/DuplicatePropertyException.java | 41 +
.../java/IllegalPropertyException.java | 41 +
.../java/ImplementationProcessor.java | 128 +++
.../java/ImplementationProcessorExtension.java | 91 ++
.../java/ImplementationProcessorService.java | 90 ++
.../implementation/java/IntrospectionRegistry.java | 38 +
.../spi/implementation/java/Introspector.java | 47 ++
.../java/JavaMappedComponentType.java | 61 ++
.../implementation/java/JavaMappedProperty.java | 64 ++
.../implementation/java/JavaMappedReference.java | 60 ++
.../spi/implementation/java/JavaMappedService.java | 91 ++
.../spi/implementation/java/PojoComponentType.java | 98 +++
.../implementation/java/ProcessingException.java | 43 +
.../tuscany/spi/loader/ComponentTypeLoader.java | 45 +
.../spi/loader/InvalidReferenceException.java | 41 +
.../tuscany/spi/loader/InvalidValueException.java | 43 +
.../java/org/apache/tuscany/spi/loader/Loader.java | 81 ++
.../apache/tuscany/spi/loader/LoaderException.java | 66 ++
.../apache/tuscany/spi/loader/LoaderRegistry.java | 69 ++
.../org/apache/tuscany/spi/loader/LoaderUtil.java | 78 ++
.../spi/loader/MissingImplementationException.java | 35 +
.../spi/loader/MissingIncludeException.java | 35 +
.../MissingMustOverridePropertyException.java | 28 +
.../spi/loader/MissingResourceException.java | 49 ++
.../loader/NotOverridablePropertyException.java | 30 +
.../tuscany/spi/loader/PropertyObjectFactory.java | 44 +
.../tuscany/spi/loader/StAXElementLoader.java | 45 +
.../spi/loader/UndefinedPropertyException.java | 28 +
.../spi/loader/UnexpectedElementException.java | 34 +
.../spi/loader/UnrecognizedElementException.java | 47 ++
.../tuscany/spi/model/AtomicImplementation.java | 33 +
.../java/org/apache/tuscany/spi/model/Binding.java | 27 +
.../spi/model/BindlessServiceDefinition.java | 47 ++
.../spi/model/BoundReferenceDefinition.java | 36 +
.../tuscany/spi/model/BoundServiceDefinition.java | 57 ++
.../tuscany/spi/model/ComponentDefinition.java | 154 ++++
.../apache/tuscany/spi/model/ComponentType.java | 143 ++++
.../tuscany/spi/model/CompositeComponentType.java | 146 ++++
.../tuscany/spi/model/CompositeImplementation.java | 56 ++
.../org/apache/tuscany/spi/model/DataType.java | 223 +++++
.../apache/tuscany/spi/model/Implementation.java | 43 +
.../java/org/apache/tuscany/spi/model/Include.java | 80 ++
.../apache/tuscany/spi/model/InteractionScope.java | 29 +
.../org/apache/tuscany/spi/model/ModelObject.java | 38 +
.../org/apache/tuscany/spi/model/Multiplicity.java | 47 ++
.../org/apache/tuscany/spi/model/Operation.java | 351 ++++++++
.../apache/tuscany/spi/model/OverrideOptions.java | 34 +
.../org/apache/tuscany/spi/model/Property.java | 105 +++
.../apache/tuscany/spi/model/PropertyValue.java | 128 +++
.../tuscany/spi/model/ReferenceDefinition.java | 80 ++
.../apache/tuscany/spi/model/ReferenceTarget.java | 50 ++
.../java/org/apache/tuscany/spi/model/Scope.java | 57 ++
.../apache/tuscany/spi/model/ServiceContract.java | 246 ++++++
.../tuscany/spi/model/ServiceDefinition.java | 83 ++
.../apache/tuscany/spi/model/WireDefinition.java | 47 ++
.../tuscany/spi/policy/PolicyBuilderRegistry.java | 70 ++
.../tuscany/spi/policy/SourcePolicyBuilder.java | 40 +
.../tuscany/spi/policy/TargetPolicyBuilder.java | 40 +
.../apache/tuscany/spi/services/VoidService.java | 33 +
.../tuscany/spi/services/artifact/Artifact.java | 197 +++++
.../spi/services/artifact/ArtifactRepository.java | 45 +
.../spi/services/work/NotificationListener.java | 66 ++
.../tuscany/spi/services/work/WorkScheduler.java | 52 ++
.../spi/services/work/WorkSchedulerException.java | 36 +
.../spi/wire/AbstractInboundInvocationHandler.java | 72 ++
.../wire/AbstractOutboundInvocationHandler.java | 74 ++
.../tuscany/spi/wire/InboundInvocationChain.java | 34 +
.../org/apache/tuscany/spi/wire/InboundWire.java | 106 +++
.../wire/IncompatibleServiceContractException.java | 54 ++
.../org/apache/tuscany/spi/wire/Interceptor.java | 50 ++
.../apache/tuscany/spi/wire/InvocationChain.java | 95 +++
.../spi/wire/InvocationRuntimeException.java | 46 +
.../java/org/apache/tuscany/spi/wire/Message.java | 88 ++
.../org/apache/tuscany/spi/wire/MessageId.java | 40 +
.../org/apache/tuscany/spi/wire/MessageImpl.java | 87 ++
.../tuscany/spi/wire/OutboundInvocationChain.java | 28 +
.../org/apache/tuscany/spi/wire/OutboundWire.java | 102 +++
.../tuscany/spi/wire/ProxyCreationException.java | 43 +
.../org/apache/tuscany/spi/wire/RuntimeWire.java | 70 ++
.../org/apache/tuscany/spi/wire/TargetInvoker.java | 67 ++
.../org/apache/tuscany/spi/wire/WireException.java | 45 +
.../tuscany/spi/wire/WireInvocationHandler.java | 32 +
.../org/apache/tuscany/spi/wire/WireService.java | 156 ++++
.../tuscany/spi/wire/WireServiceExtension.java | 109 +++
.../org/apache/tuscany/spi/AssertionTestCase.java | 38 +
.../apache/tuscany/spi/QualifiedNameTestCase.java | 67 ++
.../tuscany/spi/TuscanyExceptionTestCase.java | 65 ++
.../spi/TuscanyRuntimeExceptionTestCase.java | 65 ++
.../spi/annotation/ConstructorAnnotationTest.java | 60 ++
.../spi/component/AbstractSCAObjectTestCase.java | 124 +++
.../databinding/extension/DOMHelperTestCase.java | 55 ++
.../extension/DataBindingExtensionTestCase.java | 80 ++
.../SimpleTypeMapperExtensionTestCase.java | 114 +++
.../extension/TransformerExtensionTestCase.java | 74 ++
.../extension/XSDDataTypeConverterTestCase.java | 60 ++
.../AtomicComponentExtensionTestCase.java | 86 ++
.../ComponentTypeLoaderExtensionTestCase.java | 60 ++
.../spi/extension/LoaderExtensionTestCase.java | 71 ++
.../tuscany/spi/extension/ReferenceTestCase.java | 93 ++
.../spi/extension/ServiceExtensionTestCase.java | 56 ++
.../tuscany/spi/idl/java/JavaIDLUtilsTestCase.java | 177 ++++
.../java/AbstractPropertyProcessorTestCase.java | 176 ++++
.../spi/loader/LoaderExceptionTestCase.java | 33 +
.../apache/tuscany/spi/model/ScopeTestCase.java | 59 ++
.../tuscany/spi/model/ServiceContractTestCase.java | 56 ++
.../AbstractInboundInvocationHandlerTestCase.java | 80 ++
.../AbstractOutboundInvocationHandlerTestCase.java | 126 +++
.../spi/wire/ContractCompatibilityTestCase.java | 384 +++++++++
212 files changed, 16986 insertions(+)
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.checkstyle
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.pmd
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.ruleset
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/LICENSE.txt
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/NOTICE.txt
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/pom.xml
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/doc/Context Model.emx
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindlessBuilder.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PostProcessingException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessor.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AutowireResolutionException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentNotFoundException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/IllegalTargetException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidComponentTypeException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ObjectRegistrationException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceNotFoundException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainer.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeNotFoundException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRuntimeException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SystemAtomicComponent.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetNotFoundException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/WorkContext.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBinding.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBindingRegistry.java
create mode 100755 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataPipe.java
create mode 100755 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Mediator.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PullTransformer.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PushTransformer.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/SimpleTypeMapper.java
create mode 100755 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationContext.java
create mode 100755 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationException.java
create mode 100755 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Transformer.java
create mode 100755 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformerRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/WrapperHandler.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DOMHelper.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/Java2SimpleTypeTransformer.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleType2JavaTransformer.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/TransformerExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/WrapperInfo.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/InterfaceJavaIntrospector.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaServiceContract.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/DuplicatePropertyException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IllegalPropertyException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IntrospectionRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Introspector.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedProperty.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ProcessingException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ComponentTypeLoader.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidValueException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/Loader.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderUtil.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingImplementationException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingIncludeException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingMustOverridePropertyException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingResourceException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/NotOverridablePropertyException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/PropertyObjectFactory.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/StAXElementLoader.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedPropertyException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnexpectedElementException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedElementException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AtomicImplementation.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Binding.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindlessServiceDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BoundReferenceDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BoundServiceDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeImplementation.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Implementation.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Include.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/InteractionScope.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ModelObject.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Multiplicity.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/OverrideOptions.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PropertyValue.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Scope.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WireDefinition.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilder.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/services/VoidService.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/ArtifactRepository.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/NotificationListener.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkScheduler.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkSchedulerException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundInvocationChain.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Interceptor.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationRuntimeException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageId.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/RuntimeWire.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/TargetInvoker.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireException.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireInvocationHandler.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireServiceExtension.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/AssertionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/QualifiedNameTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyExceptionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/annotation/ConstructorAnnotationTest.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DOMHelperTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/TransformerExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverterTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceExtensionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessorTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ScopeTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandlerTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java
create mode 100644 sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/ContractCompatibilityTestCase.java
(limited to 'sca-java-1.x/tags/1.0-incubator-M2/kernel/spi')
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.checkstyle b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.checkstyle
new file mode 100644
index 0000000000..3e57539570
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.checkstyle
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.pmd b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.pmd
new file mode 100644
index 0000000000..ffc4fe2bbb
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.pmd
@@ -0,0 +1,20 @@
+
+
+true
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.ruleset b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/.ruleset
@@ -0,0 +1,190 @@
+
+
+
+ PMD Plugin preferences rule set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/LICENSE.txt b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/NOTICE.txt b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/pom.xml b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/pom.xml
new file mode 100644
index 0000000000..00bb56afb4
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/pom.xml
@@ -0,0 +1,68 @@
+
+
+
+
+ org.apache.tuscany.sca.kernel
+ parent
+ 1.0-incubator-M2
+
+ 4.0.0
+ tuscany-spi
+ jar
+ Apache Tuscany SCA SPI
+ Tuscany Service Provider Interfaces.
+
+
+
+ org.apache.tuscany.sca.kernel
+ tuscany-host-api
+ ${pom.version}
+ compile
+
+
+
+ stax
+ stax-api
+
+
+ javax.servlet
+ servlet-api
+
+
+
+ junit
+ junit
+
+
+ org.easymock
+ easymock
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/doc/Context Model.emx b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/doc/Context Model.emx
new file mode 100644
index 0000000000..0445ea5a6b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/doc/Context Model.emx
@@ -0,0 +1,673 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java
new file mode 100644
index 0000000000..e8597a55fc
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java
@@ -0,0 +1,77 @@
+/*
+ * 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.spi;
+
+/**
+ * Base class providing a simple implementation of Lifecycle.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractLifecycle implements Lifecycle {
+ protected volatile int lifecycleState = UNINITIALIZED;
+
+ public int getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Set the current state of the Lifecycle.
+ *
+ * @param lifecycleState the new state
+ */
+ protected void setLifecycleState(int lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ public void start() {
+ setLifecycleState(RUNNING);
+ }
+
+ public void stop() {
+ setLifecycleState(STOPPED);
+ }
+
+ /**
+ * Returns the current lifecycle as a String (for example, "RUNNING").
+ *
+ * @return the current lifecycle as a String
+ */
+ public String toString() {
+ switch (lifecycleState) {
+ case Lifecycle.CONFIG_ERROR:
+ return "CONFIG_ERROR";
+ case Lifecycle.ERROR:
+ return "ERROR";
+ case Lifecycle.INITIALIZING:
+ return "INITIALIZING";
+ case Lifecycle.INITIALIZED:
+ return "INITIALIZED";
+ case Lifecycle.RUNNING:
+ return "RUNNING";
+ case Lifecycle.STOPPING:
+ return "STOPPING";
+ case Lifecycle.STOPPED:
+ return "STOPPED";
+ case Lifecycle.UNINITIALIZED:
+ return "UNINITIALIZED";
+ default:
+ return "UNKNOWN";
+ }
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java
new file mode 100644
index 0000000000..74a076778e
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.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.spi;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * The root exception for the runtime package. Exceptions occurring in the runtime are generally non-recoverable
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class CoreRuntimeException extends TuscanyRuntimeException {
+
+ public CoreRuntimeException() {
+ super();
+ }
+
+ public CoreRuntimeException(String message) {
+ super(message);
+ }
+
+ public CoreRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CoreRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java
new file mode 100644
index 0000000000..28bc8652b2
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.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.spi;
+
+/**
+ * Denotes an invalid name
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidNameException extends CoreRuntimeException {
+
+ public InvalidNameException() {
+ super();
+ }
+
+ public InvalidNameException(String message) {
+ super(message);
+ }
+
+ public InvalidNameException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidNameException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java
new file mode 100644
index 0000000000..94e7d2027f
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.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.spi;
+
+/**
+ * Implementations adhere to runtime lifecycle semantics
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Lifecycle {
+ /* A configuration error state */
+ int CONFIG_ERROR = -1;
+ /* Has not been initialized */
+ int UNINITIALIZED = 0;
+ /* In the process of being configured and initialized */
+ int INITIALIZING = 1;
+ /* Instantiated and configured */
+ int INITIALIZED = 2;
+ /* Configured and initialized */
+ int RUNNING = 4;
+ /* In the process of being shutdown */
+ int STOPPING = 5;
+ /* Has been shutdown and removed from the module */
+ int STOPPED = 6;
+ /* In an error state */
+ int ERROR = 7;
+
+ /**
+ * Returns the lifecycle state
+ *
+ * @see #UNINITIALIZED
+ * @see #INITIALIZING
+ * @see #INITIALIZED
+ * @see #RUNNING
+ * @see #STOPPING
+ * @see #STOPPED
+ */
+ int getLifecycleState();
+
+ /**
+ * Starts the Lifecycle.
+ *
+ * @throws CoreRuntimeException
+ */
+ void start() throws CoreRuntimeException;
+
+ /**
+ * Stops the Lifecycle.
+ *
+ * @throws CoreRuntimeException
+ */
+ void stop() throws CoreRuntimeException;
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java
new file mode 100644
index 0000000000..635a5f9090
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java
@@ -0,0 +1,48 @@
+/*
+ * 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.spi;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Denotes an error creating a new object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class ObjectCreationException extends TuscanyRuntimeException {
+ private static final long serialVersionUID = -6423113430265944499L;
+
+ public ObjectCreationException() {
+ super();
+ }
+
+ public ObjectCreationException(String message) {
+ super(message);
+ }
+
+ public ObjectCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectCreationException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java
new file mode 100644
index 0000000000..d505e14f61
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.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.spi;
+
+/**
+ * Implementations create new instances of a particular type
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ObjectFactory {
+
+ /**
+ * Return a instance of the type that this factory creates.
+ *
+ * @return a instance from this factory
+ */
+ T getInstance() throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java
new file mode 100644
index 0000000000..ec1c181afc
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java
@@ -0,0 +1,84 @@
+/*
+ * 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.spi;
+
+/**
+ * An evaluated name consisting of a part/port pair. In the runtime, a part generally 'contains' or 'provides' ports
+ * such as a component/service point or a component/reference pair.
+ *
+ * @version $Rev$ $Date$
+ */
+public class QualifiedName {
+ public static final String NAME_SEPARATOR = "/";
+
+ private String qName;
+ private String partName;
+ private String portName;
+
+ /**
+ * Constructs a new qualified name in the form of part/port where part is the parent context and port represents a
+ * child, which is either a service in the case of an atomic context or a contained context in the case of a
+ * composite.
+ *
+ * @throws InvalidNameException if the name is in an invalid format
+ */
+ public QualifiedName(String qualifiedName) throws InvalidNameException {
+ if (qualifiedName == null) {
+ return;
+ }
+ int pos = qualifiedName.indexOf(QualifiedName.NAME_SEPARATOR);
+ switch (pos) {
+ case -1:
+ partName = qualifiedName;
+ break;
+ case 0:
+ throw new InvalidNameException(qualifiedName);
+ default:
+ partName = qualifiedName.substring(0, pos);
+ portName = qualifiedName.substring(pos + 1);
+ break;
+ }
+ qName = qualifiedName;
+ }
+
+ /**
+ * Returns the parsed part name
+ */
+ public String getPartName() {
+ return partName;
+ }
+
+ /**
+ * Returns the parsed port name if the original is of the compound for part/port
+ */
+ public String getPortName() {
+ return portName;
+ }
+
+ /**
+ * Returns the full part/port name pair
+ */
+ public String getQualifiedName() {
+ return qName;
+ }
+
+ public String toString() {
+ return qName;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java
new file mode 100644
index 0000000000..0e48f1bc1b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.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.spi.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * A system annotation to inject an autowired instance
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Autowire {
+ /**
+ * The name of the autowire. If not specified then the name will be derived from the annotated field.
+ */
+ String name() default "";
+
+ /**
+ * Indicates if a reference must be specified.
+ */
+ boolean required() default true;
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
new file mode 100644
index 0000000000..5fd9be89b6
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.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.spi.bootstrap;
+
+/**
+ * Class that defines the names of well known component
+ *
+ * @version $Rev$ $Date$
+ */
+public final class ComponentNames {
+ /**
+ * The name of the component that forms the root of the runtime tree.
+ */
+ public static final String TUSCANY_RUNTIME = "tuscany.runtime";
+
+ /**
+ * The name of the component that forms the root of the application context tree.
+ */
+ public static final String TUSCANY_ROOT = "tuscany.root";
+
+ /**
+ * The name of the component that form the root of the system context tree.
+ */
+ public static final String TUSCANY_SYSTEM = "tuscany.system";
+
+ /**
+ * The name of the component that contains the deployer.
+ */
+ public static final String TUSCANY_DEPLOYER = "tuscany.deployer";
+
+ private ComponentNames() {
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java
new file mode 100644
index 0000000000..380abb474b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.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.spi.bootstrap;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.Deployer;
+
+/**
+ * Interface that represents the Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponent extends CompositeComponent {
+ /**
+ * Returns the component that forms the root of the user component tree. All user components will be managed by
+ * composites that are children of this root.
+ *
+ * @return the root of the user component tree
+ */
+ CompositeComponent getRootComponent();
+
+ /**
+ * Returns the component that forms the root of the system component tree. All system components, components that
+ * provide system services needed by the Tuscany runtime itself, will be managed by composites that are children of
+ * this root.
+ *
+ * @return the root of the system component tree
+ */
+ CompositeComponent getSystemComponent();
+
+ /**
+ * Returns the deployer for this runtime. This interface can be used to deploy new SCA bundles to the runtime.
+ *
+ * @return the deployer for this runtime
+ */
+ Deployer getDeployer();
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java
new file mode 100644
index 0000000000..9586cdb6fd
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java
@@ -0,0 +1,44 @@
+/*
+ * 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.spi.builder;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.Binding;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+
+/**
+ * Responsible for processing a service or reference in an assembly configured with a particular binding. The builder
+ * will create and return corresponding {@link org.apache.tuscany.spi.component.Service} or {@link
+ * org.apache.tuscany.spi.component.Reference}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingBuilder {
+ Service build(CompositeComponent parent,
+ BoundServiceDefinition boundServiceDefinition,
+ DeploymentContext deploymentContext);
+
+ Reference build(CompositeComponent parent,
+ BoundReferenceDefinition boundReferenceDefinition,
+ DeploymentContext deploymentContext);
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindlessBuilder.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindlessBuilder.java
new file mode 100644
index 0000000000..94ddb39a59
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindlessBuilder.java
@@ -0,0 +1,44 @@
+/*
+ * 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.spi.builder;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.BindlessServiceDefinition;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+
+/**
+ * Responsible for processing a service or reference in an assembly configured without any binding. The builder
+ * will create and return corresponding {@link org.apache.tuscany.spi.component.Service} or {@link
+ * org.apache.tuscany.spi.component.Reference}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindlessBuilder {
+
+ Service build(CompositeComponent parent,
+ BindlessServiceDefinition serviceDefinition,
+ DeploymentContext deploymentContext);
+
+ Reference build(CompositeComponent parent,
+ ReferenceDefinition referenceDefinition,
+ DeploymentContext deploymentContext);
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java
new file mode 100644
index 0000000000..c1d314297e
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java
@@ -0,0 +1,82 @@
+/*
+ * 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.spi.builder;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.Binding;
+import org.apache.tuscany.spi.model.BindlessServiceDefinition;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+
+/**
+ * Implementations build SCAObject types from model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Builder {
+ /**
+ * Builds a Component context from a ComponentDefinition
+ *
+ * @param parent the composite that will be the parent of the newly built component
+ * @param componentDefinition the component definition as parsed from an SCA assembly
+ * @param deploymentContext the current deployment context
+ * @return a newly created component
+ */
+ > Component build(CompositeComponent parent,
+ ComponentDefinition componentDefinition,
+ DeploymentContext deploymentContext);
+
+ /**
+ * TODO: JavaDoc this when we know if we will still register Services as contexts
+ */
+ SCAObject build(CompositeComponent parent,
+ BoundServiceDefinition boundServiceDefinition,
+ DeploymentContext deploymentContext);
+
+ /**
+ * TODO: JavaDoc this when we know if we will still register References as contexts
+ */
+ SCAObject build(CompositeComponent parent,
+ BoundReferenceDefinition boundReferenceDefinition,
+ DeploymentContext deploymentContext);
+
+ /**
+ * TODO: Make sure that this method belongs here
+ * Allow a builder registry to provide building of bindless services via
+ * appropriate registered builder
+ */
+ SCAObject build(CompositeComponent parent,
+ BindlessServiceDefinition serviceDefinition,
+ DeploymentContext deploymentContext);
+
+ /**
+ * TODO: Make sure that this method belongs here
+ * Allow a builder registry to provide building of targetless references via
+ * appropriate registered builder
+ */
+ SCAObject build(CompositeComponent parent,
+ ReferenceDefinition referenceDefinition,
+ DeploymentContext deploymentContext);
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java
new file mode 100644
index 0000000000..e4c07e53f9
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.spi.builder;
+
+/**
+ * Represents an error processing an assembly model
+ *
+ * @version $Rev$ $Date$
+ */
+public class BuilderConfigException extends BuilderException {
+
+ public BuilderConfigException() {
+ super();
+ }
+
+ public BuilderConfigException(String message) {
+ super(message);
+ }
+
+ public BuilderConfigException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BuilderConfigException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java
new file mode 100644
index 0000000000..6e5e6ab124
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.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.spi.builder;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * The root exception for the builder package. Builder exceptions denote a non-recoverable failure.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BuilderException extends CoreRuntimeException {
+
+ public BuilderException() {
+ super();
+ }
+
+ public BuilderException(String message) {
+ super(message);
+ }
+
+ public BuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BuilderException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java
new file mode 100644
index 0000000000..9d75f360d4
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java
@@ -0,0 +1,62 @@
+/*
+ * 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.spi.builder;
+
+import org.apache.tuscany.spi.model.Binding;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Maintains a registry of builders in the runtime, dispatching to the appropriate one as an assembly model is processed
+ * into runtime artifacts
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BuilderRegistry extends Builder {
+
+ /**
+ * Register a builder for an implementation type.
+ *
+ * @param implClass the type of implementation that this builder can handle
+ * @param builder the builder to be registered
+ */
+ > void register(Class implClass, ComponentBuilder builder);
+
+ /**
+ * Unregister a builder for an implementation type.
+ *
+ * @param implClass the implementation whose builder should be unregistered
+ */
+ > void unregister(Class implClass);
+
+ /**
+ * TODO: JavaDoc this once we know if we will be building contexts for bindings
+ */
+ void register(BindingBuilder builder);
+
+ /**
+ * TODO: JavaDoc this once we know if we will be building contexts for bindings
+ */
+ void register(Class implClass, BindingBuilder builder);
+
+ /**
+ * TODO: Make sure this belongs here
+ */
+ void register(BindlessBuilder builder);
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java
new file mode 100644
index 0000000000..ca1e25e8b1
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.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.spi.builder;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Responsible for building a {@link Component} from an atomic or composite component configured in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentBuilder> {
+ Component build(CompositeComponent parent,
+ ComponentDefinition componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderConfigException;
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java
new file mode 100644
index 0000000000..07ea5352ff
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java
@@ -0,0 +1,51 @@
+/*
+ * 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.spi.builder;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Implementations are responsible for bridging invocation chains as an assembly is converted to runtime artifacts
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Connector {
+
+ /**
+ * Connects the given source's wires to corresponding wires to a target. Wires are connected by bridging invocation
+ * chains.
+ *
+ * @param source the source, i.e. a Service, Component, or Reference
+ */
+ void connect(SCAObject source);
+
+ /**
+ * Bridges the invocation chains associated with an inbound and outbound wire.
+ *
+ * @param inbound the wire to bridge from
+ * @param outbound the target wire
+ * @param optimizable if the bridge may be optimized
+ * @throws BuilderConfigException
+ */
+ void connect(InboundWire inbound, OutboundWire outbound, boolean optimizable)
+ throws BuilderConfigException;
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java
new file mode 100644
index 0000000000..78bb5a5cc8
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.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.spi.builder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidServiceInterfaceException extends BuilderConfigException {
+ private final Class> interfaceClass;
+
+ public InvalidServiceInterfaceException(String message, Class> interfaceClass) {
+ super(message);
+ this.interfaceClass = interfaceClass;
+ }
+
+ public Class> getInterfaceClass() {
+ return interfaceClass;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PostProcessingException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PostProcessingException.java
new file mode 100644
index 0000000000..6868a7b2d5
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/PostProcessingException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+/**
+ * Denotes an error during post-processing of a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class PostProcessingException extends BuilderException {
+ public PostProcessingException() {
+ }
+
+ public PostProcessingException(String message) {
+ super(message);
+ }
+
+ public PostProcessingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PostProcessingException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessor.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessor.java
new file mode 100644
index 0000000000..26de89a9f1
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Implementations are called after inbound and outbound wires are decorated with policy and before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WirePostProcessor {
+
+ /**
+ * @param source
+ * @param target
+ */
+ void process(OutboundWire source, InboundWire target);
+
+ /**
+ * @param source
+ * @param target
+ */
+ void process(InboundWire source, OutboundWire target);
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorExtension.java
new file mode 100644
index 0000000000..0795c5783a
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorExtension.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+
+@Scope("MODULE")
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class WirePostProcessorExtension implements WirePostProcessor {
+
+ protected WirePostProcessorRegistry registry;
+
+ @Autowire
+ public void setRegistry(WirePostProcessorRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init(eager = true)
+ public void init() {
+ registry.register(this);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java
new file mode 100644
index 0000000000..a1750943eb
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java
@@ -0,0 +1,44 @@
+/*
+ * 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.spi.builder;
+
+/**
+ * Acts as a delegating WirePostProcessor, delegating post-processing of wires after policies have been
+ * applied and source an targets have been matched but before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WirePostProcessorRegistry extends WirePostProcessor {
+
+
+ /**
+ * Registers a post-processor in the runtime
+ *
+ * @param processor the processor to register
+ */
+ void register(WirePostProcessor processor);
+
+ /**
+ * De-registers a post-processor in the runtime
+ *
+ * @param processor the processor to de-register
+ */
+ void unregister(WirePostProcessor processor);
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java
new file mode 100644
index 0000000000..d7de7c0d6b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java
@@ -0,0 +1,122 @@
+/*
+ * 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.spi.component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.spi.AbstractLifecycle;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.event.EventFilter;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.event.TrueFilter;
+
+/**
+ * Functionality common to all SCAObject implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractSCAObject extends AbstractLifecycle implements SCAObject {
+ protected static final EventFilter TRUE_FILTER = new TrueFilter();
+
+ protected Map> listeners;
+ protected final CompositeComponent parent;
+ private final String name;
+ private final Map
+ */
+ public static final class HexBinary {
+ private HexBinary() {
+ }
+
+ /**
+ * Converts the string pValue into an array of hex bytes.
+ */
+ public static byte[] decode(String pValue) {
+ if ((pValue.length() % 2) != 0) {
+ throw new IllegalArgumentException("A HexBinary string must have even length.");
+ }
+ byte[] result = new byte[pValue.length() / 2];
+ int j = 0;
+ int i = 0;
+ while (i < pValue.length()) {
+ byte b;
+ char c = pValue.charAt(i++);
+ char d = pValue.charAt(i++);
+ if (c >= '0' && c <= '9') {
+ b = (byte) ((c - '0') << 4);
+ } else if (c >= 'A' && c <= 'F') {
+ b = (byte) ((c - 'A' + 10) << 4);
+ } else if (c >= 'a' && c <= 'f') {
+ b = (byte) ((c - 'a' + 10) << 4);
+ } else {
+ throw new IllegalArgumentException("Invalid hex digit: " + c);
+ }
+ if (d >= '0' && d <= '9') {
+ b += (byte) (d - '0');
+ } else if (d >= 'A' && d <= 'F') {
+ b += (byte) (d - 'A' + 10);
+ } else if (d >= 'a' && d <= 'f') {
+ b += (byte) (d - 'a' + 10);
+ } else {
+ throw new IllegalArgumentException("Invalid hex digit: " + d);
+ }
+ result[j++] = b;
+ }
+ return result;
+ }
+
+ /**
+ * Converts the byte array pHexBinary into a string.
+ */
+ public static String encode(byte[] pHexBinary) {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < pHexBinary.length; i++) {
+ byte b = pHexBinary[i];
+ byte c = (byte) ((b & 0xf0) >> 4);
+ if (c <= 9) {
+ result.append((char) ('0' + c));
+ } else {
+ result.append((char) ('A' + c - 10));
+ }
+ c = (byte) (b & 0x0f);
+ if (c <= 9) {
+ result.append((char) ('0' + c));
+ } else {
+ result.append((char) ('A' + c - 10));
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Creates a clone of the given byte array.
+ */
+ public static byte[] getClone(byte[] pHexBinary) {
+ byte[] result = new byte[pHexBinary.length];
+ System.arraycopy(pHexBinary, 0, result, 0, pHexBinary.length);
+ return result;
+ }
+ }
+
+ public class XSDDateFormat extends XSDDateTimeFormat {
+ private static final long serialVersionUID = -1629412916827246627L;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDDateFormat() {
+ super(true, false);
+ }
+ }
+
+ /**
+ *
+ * An instance of {@link java.text.Format}, which may be used to parse and format xs:dateTime values.
+ *
+ */
+ public static class XSDDateTimeFormat extends Format {
+ private static final long serialVersionUID = -1148332471737068969L;
+
+ final boolean parseDate;
+
+ final boolean parseTime;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDDateTimeFormat() {
+ this(true, true);
+ }
+
+ XSDDateTimeFormat(boolean pParseDate, boolean pParseTime) {
+ parseDate = pParseDate;
+ parseTime = pParseTime;
+ }
+
+ private void append(StringBuffer pBuffer, int pNum, int pMinLen) {
+ String s = Integer.toString(pNum);
+ for (int i = s.length(); i < pMinLen; i++) {
+ pBuffer.append('0');
+ }
+ pBuffer.append(s);
+ }
+
+ public StringBuffer format(Object pCalendar, StringBuffer pBuffer, FieldPosition pPos) {
+ assert pCalendar != null : "The Calendar argument must not be null.";
+ assert pBuffer != null : "The StringBuffer argument must not be null.";
+ assert pPos != null : "The FieldPosition argument must not be null.";
+
+ Calendar cal = (Calendar) pCalendar;
+ if (parseDate) {
+ int year = cal.get(Calendar.YEAR);
+ if (year < 0) {
+ pBuffer.append('-');
+ year = -year;
+ }
+ append(pBuffer, year, 4);
+ pBuffer.append('-');
+ append(pBuffer, cal.get(Calendar.MONTH) + 1, 2);
+ pBuffer.append('-');
+ append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2);
+ if (parseTime) {
+ pBuffer.append('T');
+ }
+ }
+ if (parseTime) {
+ append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2);
+ pBuffer.append(':');
+ append(pBuffer, cal.get(Calendar.MINUTE), 2);
+ pBuffer.append(':');
+ append(pBuffer, cal.get(Calendar.SECOND), 2);
+ int millis = cal.get(Calendar.MILLISECOND);
+ if (millis > 0) {
+ pBuffer.append('.');
+ append(pBuffer, millis, 3);
+ }
+ }
+ TimeZone tz = cal.getTimeZone();
+ // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
+ int offset = cal.get(Calendar.ZONE_OFFSET);
+ if (tz.inDaylightTime(cal.getTime())) {
+ offset += cal.get(Calendar.DST_OFFSET);
+ }
+ if (offset == 0) {
+ pBuffer.append('Z');
+ } else {
+ if (offset < 0) {
+ pBuffer.append('-');
+ offset = -offset;
+ } else {
+ pBuffer.append('+');
+ }
+ int minutes = offset / (60 * 1000);
+ int hours = minutes / 60;
+ minutes -= hours * 60;
+ append(pBuffer, hours, 2);
+ pBuffer.append(':');
+ append(pBuffer, minutes, 2);
+ }
+ return pBuffer;
+ }
+
+ private int parseInt(String pString, int offset, StringBuffer pDigits) {
+ int length = pString.length();
+ int pOffset = offset;
+ pDigits.setLength(0);
+ while (pOffset < length) {
+ char c = pString.charAt(pOffset);
+ if (Character.isDigit(c)) {
+ pDigits.append(c);
+ ++pOffset;
+ } else {
+ break;
+ }
+ }
+ return pOffset;
+ }
+
+ public Object parseObject(String pString, ParsePosition pParsePosition) {
+ assert pString != null : "The String argument must not be null.";
+ assert pParsePosition != null : "The ParsePosition argument must not be null.";
+ int offset = pParsePosition.getIndex();
+ int length = pString.length();
+
+ boolean isMinus = false;
+ StringBuffer digits = new StringBuffer();
+ int year = 0;
+ int month = 0;
+ int mday = 0;
+ if (parseDate) {
+ // Sign
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == '+') {
+ ++offset;
+ } else if (c == '-') {
+ ++offset;
+ isMinus = true;
+ }
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() < 4) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ year = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '-') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ month = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '-') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ mday = Integer.parseInt(digits.toString());
+
+ if (parseTime) {
+ if (offset < length && pString.charAt(offset) == 'T') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ }
+ } else {
+ year = month = mday = 0;
+ }
+
+ int hour = 0;
+ int minute = 0;
+ int second = 0;
+ int millis = 0;
+ if (parseTime) {
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ hour = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == ':') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ minute = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == ':') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ second = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '.') {
+ ++offset;
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() > 0) {
+ millis = Integer.parseInt(digits.toString());
+ } else {
+ millis = 0;
+ }
+ } else {
+ millis = 0;
+ }
+ } else {
+ hour = minute = second = millis = 0;
+ }
+
+ digits.setLength(0);
+ digits.append("GMT");
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == 'Z') {
+ // Ignore UTC, it is the default
+ ++offset;
+ } else if (c == '+' || c == '-') {
+ digits.append(c);
+ ++offset;
+ for (int i = 0; i < 5; i++) {
+ if (offset >= length) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ c = pString.charAt(offset);
+ if ((i != 2 && Character.isDigit(c)) || (i == 2 && c == ':')) {
+ digits.append(c);
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ ++offset;
+ }
+ }
+ }
+
+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(digits.toString()));
+ cal.set(isMinus ? -year : year, parseDate ? month - 1 : month, mday, hour, minute, second);
+ cal.set(Calendar.MILLISECOND, millis);
+ pParsePosition.setIndex(offset);
+ return cal;
+ }
+ }
+
+ public static class XSDTimeFormat extends XSDDateTimeFormat {
+ private static final long serialVersionUID = 1346506860724640517L;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDTimeFormat() {
+ super(false, true);
+ }
+ }
+
+ private static final long MAX_UNSIGNED_INT = (((long) Integer.MAX_VALUE) * 2) + 1;
+
+ private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
+
+ public String parseAnySimpleType(String value) {
+ return value;
+ }
+
+ public byte[] parseBase64Binary(String value) {
+ return Base64Binary.decode(value);
+ }
+
+ public boolean parseBoolean(String value) {
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ public byte parseByte(String value) {
+ return Byte.parseByte(value);
+ }
+
+ public Calendar parseDate(String value) {
+ XSDDateFormat format = new XSDDateFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse date " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public Calendar parseDateTime(String value) {
+ XSDDateTimeFormat format = new XSDDateTimeFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse dateTime " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public BigDecimal parseDecimal(String value) {
+ return new BigDecimal(value);
+ }
+
+ public double parseDouble(String value) {
+ if ("INF".equals(value)) {
+ return Double.POSITIVE_INFINITY;
+ } else if ("-INF".equals(value)) {
+ return Double.NEGATIVE_INFINITY;
+ } else if ("NaN".equals(value)) {
+ return Double.NaN;
+ } else {
+ return Double.parseDouble(value);
+ }
+ }
+
+ public Duration parseDuration(String pDuration) {
+ try {
+ return DatatypeFactory.newInstance().newDuration(pDuration);
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public float parseFloat(String value) {
+ if ("INF".equals(value)) {
+ return Float.POSITIVE_INFINITY;
+ } else if ("-INF".equals(value)) {
+ return Float.NEGATIVE_INFINITY;
+ } else if ("NaN".equals(value)) {
+ return Float.NaN;
+ } else {
+ return Float.parseFloat(value);
+ }
+ }
+
+ public byte[] parseHexBinary(String value) {
+ return HexBinary.decode(value);
+ }
+
+ public int parseInt(String value) {
+ return Integer.parseInt(value);
+ }
+
+ public BigInteger parseInteger(String value) {
+ return new BigInteger(value);
+ }
+
+ public long parseLong(String value) {
+ return Long.parseLong(value);
+ }
+
+ public QName parseQName(String value, NamespaceContext context) {
+ int offset = value.indexOf(':');
+ String uri;
+ String localName;
+ switch (offset) {
+ case -1:
+ localName = value;
+ uri = context.getNamespaceURI("");
+ if (uri == null) {
+ // Should not happen, indicates an error in the
+ // NamespaceContext
+ // implementation
+ throw new IllegalArgumentException("The default prefix is not bound.");
+ }
+ break;
+ case 0:
+ throw new IllegalArgumentException("Default prefix must be indicated by not using a colon: "
+ + value);
+ default:
+ String prefix = value.substring(0, offset);
+ localName = value.substring(offset + 1);
+ uri = context.getNamespaceURI(prefix);
+ if (uri == null) {
+ throw new IllegalArgumentException("The prefix " + prefix + " is not bound.");
+ }
+ }
+ return new QName(uri, localName);
+ }
+
+ public short parseShort(String value) {
+ return Short.parseShort(value);
+ }
+
+ public String parseString(String value) {
+ return value;
+ }
+
+ public Calendar parseTime(String value) {
+ XSDTimeFormat format = new XSDTimeFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse time " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public long parseUnsignedInt(String value) {
+ long l = Long.parseLong(value);
+ if (l < 0) {
+ throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
+ + ": result is negative");
+ }
+ if (l > MAX_UNSIGNED_INT) {
+ throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
+ + ": result exceeds maximum value " + MAX_UNSIGNED_INT);
+ }
+ return l;
+ }
+
+ public int parseUnsignedShort(String value) {
+ int i = Integer.parseInt(value);
+ if (i < 0) {
+ throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
+ + ": result is negative");
+ }
+ if (i > MAX_UNSIGNED_SHORT) {
+ throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
+ + ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
+ }
+ return i;
+ }
+
+ public String printAnySimpleType(String value) {
+ return value;
+ }
+
+ public String printBase64Binary(byte[] value) {
+ return Base64Binary.encode(value);
+ }
+
+ public String printBoolean(boolean value) {
+ return (value ? Boolean.TRUE : Boolean.FALSE).toString();
+ }
+
+ public String printByte(byte value) {
+ return Byte.toString(value);
+ }
+
+ public String printDate(Calendar value) {
+ return new XSDDateFormat().format(value);
+ }
+
+ public String printDateTime(Calendar value) {
+ return new XSDDateTimeFormat().format(value);
+ }
+
+ public String printDecimal(BigDecimal value) {
+ return value.toString();
+ }
+
+ public String printDouble(double value) {
+ return Double.toString(value);
+ }
+
+ public String printDuration(Duration pDuration) {
+ return pDuration.toString();
+ }
+
+ public String printFloat(float value) {
+ return Float.toString(value);
+ }
+
+ public String printHexBinary(byte[] value) {
+ return HexBinary.encode(value);
+ }
+
+ public String printInt(int value) {
+ return Integer.toString(value);
+ }
+
+ public String printInteger(BigInteger value) {
+ return value.toString();
+ }
+
+ public String printLong(long value) {
+ return Long.toString(value);
+ }
+
+ public String printQName(QName value, NamespaceContext context) {
+ String prefix = context.getPrefix(value.getNamespaceURI());
+ if (prefix == null) {
+ throw new IllegalArgumentException("The namespace URI " + value.getNamespaceURI()
+ + " is not bound.");
+ } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
+ return value.getLocalPart();
+ } else {
+ return prefix + ":" + value.getLocalPart();
+ }
+ }
+
+ public String printShort(short value) {
+ return Short.toString(value);
+ }
+
+ public String printString(String value) {
+ return value;
+ }
+
+ public String printTime(Calendar value) {
+ return new XSDTimeFormat().format(value);
+ }
+
+ public String printUnsignedInt(long value) {
+ return Long.toString(value);
+ }
+
+ public String printUnsignedShort(int value) {
+ return Integer.toString(value);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java
new file mode 100644
index 0000000000..63db5b9e24
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.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.spi.deployer;
+
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.URLStreamHandlerFactory;
+
+/**
+ * ClassLoader associated with a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeClassLoader extends URLClassLoader {
+ private static final URL[] NOURLS = {};
+
+ public CompositeClassLoader(ClassLoader classLoader) {
+ super(NOURLS, classLoader);
+ }
+
+ public CompositeClassLoader(URL[] urls, ClassLoader classLoader) {
+ super(urls, classLoader);
+ }
+
+ public CompositeClassLoader(URL[] urls) {
+ super(urls);
+ }
+
+ public CompositeClassLoader(URL[] urls, ClassLoader classLoader, URLStreamHandlerFactory urlStreamHandlerFactory) {
+ super(urls, classLoader, urlStreamHandlerFactory);
+ }
+
+ public void addURL(URL url) {
+ super.addURL(url);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
new file mode 100644
index 0000000000..4e53a5d0ea
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.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.spi.deployer;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Interface that can be used to deploy SCA bundles to a runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Deployer {
+ /**
+ * Deploy a component as a child of the supplied parent. This operation creates a new component in the runtime to
+ * represent the supplied component definition. The type of component created will depend on the component
+ * definition implementation; for example, if the implementation of the component definition is a composite then
+ * typically a CompositeComponent would be returned.
+ *
+ * @param parent the parent context
+ * @param componentDefinition the component definition as parsed from an assembly
+ * @return the newly deployed component
+ */
+ > Component deploy(CompositeComponent parent,
+ ComponentDefinition componentDefinition)
+ throws LoaderException;
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
new file mode 100644
index 0000000000..1a3a2ffb75
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
@@ -0,0 +1,84 @@
+/*
+ * 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.spi.deployer;
+
+import java.net.URL;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+/**
+ * A holder that can be used during the load process to store information that is not part of the logical assembly
+ * model. This should be regarded as transient and references to this context should not be stored inside the model.
+ *
+ * $Rev$ $Date$
+ */
+public interface DeploymentContext {
+ /**
+ * Returns the parent of this deployment context.
+ * Will be null for the context created at the root of a deployment.
+ *
+ * @return the parent of this deployment context; may be null
+ */
+ DeploymentContext getParent();
+
+ /**
+ * Returns a class loader that can be used to load application resources.
+ *
+ * @return a class loader that can be used to load application resources
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Returns a factory that can be used to obtain an StAX XMLStreamReader.
+ *
+ * @return a factory that can be used to obtain an StAX XMLStreamReader
+ */
+ XMLInputFactory getXmlFactory();
+
+ /**
+ * Returns the ScopeContainer for the MODULE scope that will be associated with this deployment unit.
+ *
+ * @return the ScopeContainer for the MODULE scope that will be associated with this deployment unit
+ */
+ ScopeContainer getModuleScope();
+
+ /**
+ * Returns the location of the SCDL definition being deployed.
+ *
+ * @return the location of the SCDL definition being deployed
+ */
+ URL getScdlLocation();
+
+ /**
+ * Return the extension property with the supplied name.
+ *
+ * @param name the name of the property
+ * @return the property value; if null indicates that no property is present
+ */
+ Object getExtension(String name);
+
+ /**
+ * Set the value of an extension property.
+ *
+ * @param name the name of the property
+ * @param value the property value; if null then the extension property is removed
+ */
+ void putExtension(String name, Object value);
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java
new file mode 100644
index 0000000000..b874ca43c9
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/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.spi.event;
+
+/**
+ * Represents an event that is 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/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java
new file mode 100644
index 0000000000..d61d04cdc8
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.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.spi.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
+ */
+ boolean match(Event event);
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java
new file mode 100644
index 0000000000..35df22fb9c
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.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.spi.event;
+
+/**
+ * Publishes events in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventPublisher {
+
+ /**
+ * Publish an event
+ */
+ void publish(Event object);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ */
+ void addListener(RuntimeEventListener listener);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ */
+ void addListener(EventFilter filter, RuntimeEventListener listener);
+
+
+ /**
+ * Removes a previously registered listener
+ */
+ void removeListener(RuntimeEventListener listener);
+
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java
new file mode 100644
index 0000000000..5146559098
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.event;
+
+import java.util.EventListener;
+
+/**
+ * Listeners observe events fired in the SCA runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeEventListener extends EventListener {
+
+ void onEvent(Event event);
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java
new file mode 100644
index 0000000000..81382b86ac
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.event;
+
+/**
+ * An event filter that always returns a true condition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TrueFilter implements EventFilter {
+
+ public boolean match(Event event) {
+ return true;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java
new file mode 100644
index 0000000000..2a74409088
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * An extension point for atomic component type, which new implementation types may extend
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public abstract class AtomicComponentExtension extends AbstractSCAObject implements AtomicComponent {
+
+ protected ScopeContainer scopeContainer;
+ protected Scope scope;
+ protected Map serviceWires = new HashMap();
+ protected Map> referenceWires = new HashMap>();
+ protected WireService wireService;
+ protected WorkContext workContext;
+ protected WorkScheduler workScheduler;
+ private final int initLevel;
+
+ protected AtomicComponentExtension(String name,
+ CompositeComponent parent,
+ ScopeContainer scopeContainer,
+ WireService wireService,
+ WorkContext workContext,
+ WorkScheduler workScheduler,
+ int initLevel) {
+ super(name, parent);
+ this.scopeContainer = scopeContainer;
+ this.wireService = wireService;
+ this.workContext = workContext;
+ this.workScheduler = workScheduler;
+ this.initLevel = initLevel;
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+ public int getInitLevel() {
+ return initLevel;
+ }
+
+ public boolean isEagerInit() {
+ return initLevel > 0;
+ }
+
+ public void start() throws CoreRuntimeException {
+ super.start();
+ scopeContainer.register(this);
+ }
+
+ public void init(Object instance) throws TargetException {
+
+ }
+
+ public void destroy(Object instance) throws TargetException {
+
+ }
+
+ public void addInboundWire(InboundWire wire) {
+ serviceWires.put(wire.getServiceName(), wire);
+ onServiceWire(wire);
+ }
+
+ public InboundWire getInboundWire(String serviceName) {
+ if (serviceName == null) {
+ if (serviceWires.size() < 1) {
+ return null;
+ }
+ return serviceWires.values().iterator().next();
+ } else {
+ return serviceWires.get(serviceName);
+ }
+ }
+
+ public Map getInboundWires() {
+ return Collections.unmodifiableMap(serviceWires);
+ }
+
+ public void addOutboundWire(OutboundWire wire) {
+ List list = new ArrayList();
+ list.add(wire);
+ referenceWires.put(wire.getReferenceName(), list);
+ onReferenceWire(wire);
+ }
+
+ public Map> getOutboundWires() {
+ return Collections.unmodifiableMap(referenceWires);
+ }
+
+ public void addOutboundWires(Class> multiplicityClass, List wires) {
+ assert wires != null && wires.size() > 0;
+ referenceWires.put(wires.get(0).getReferenceName(), wires);
+ onReferenceWires(multiplicityClass, wires);
+ }
+
+ public TargetInvoker createAsyncTargetInvoker(InboundWire wire, Operation operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void onReferenceWire(OutboundWire wire) {
+ }
+
+ protected void onReferenceWires(Class> multiplicityClass, List wires) {
+ }
+
+ protected void onServiceWire(InboundWire wire) {
+ }
+
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java
new file mode 100644
index 0000000000..170840ac32
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.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.spi.extension;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BindingBuilder;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.Binding;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * An extension point for binding builders. When adding support for new bindings, implementations may extend this class
+ * as a convenience.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+@Scope("MODULE")
+public abstract class BindingBuilderExtension implements BindingBuilder {
+
+ protected BuilderRegistry builderRegistry;
+ protected WireService wireService;
+
+ @Autowire
+ public void setBuilderRegistry(BuilderRegistry registry) {
+ this.builderRegistry = registry;
+ }
+
+ @Autowire
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ @Init(eager = true)
+ public void init() {
+ builderRegistry.register(getBindingType(), this);
+ }
+
+ public Service build(CompositeComponent parent,
+ BoundServiceDefinition boundServiceDefinition,
+ DeploymentContext deploymentContext) {
+ return null;
+ }
+
+ public Reference build(CompositeComponent parent,
+ BoundReferenceDefinition boundReferenceDefinition,
+ DeploymentContext deploymentContext) {
+ return null;
+ }
+
+ protected abstract Class getBindingType();
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java
new file mode 100644
index 0000000000..1f5466dfcd
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java
@@ -0,0 +1,93 @@
+/*
+ * 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.spi.extension;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.builder.ComponentBuilder;
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.wire.WireService;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
+
+/**
+ * An extension point for component builders. When adding support for new component types, implementations may extend
+ * this class as a convenience.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+@Scope("MODULE")
+public abstract class ComponentBuilderExtension> implements ComponentBuilder {
+
+ protected BuilderRegistry builderRegistry;
+ protected ScopeRegistry scopeRegistry;
+ protected WireService wireService;
+ protected WorkScheduler workScheduler;
+ protected WorkContext workContext;
+ protected PolicyBuilderRegistry policyBuilderRegistry;
+ protected Connector connector;
+
+ @Autowire
+ public void setBuilderRegistry(BuilderRegistry registry) {
+ this.builderRegistry = registry;
+ }
+
+ @Autowire
+ public void setScopeRegistry(ScopeRegistry scopeRegistry) {
+ this.scopeRegistry = scopeRegistry;
+ }
+
+ @Autowire
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ @Autowire
+ public void setWorkScheduler(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ @Autowire
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ @Autowire
+ public void setPolicyBuilderRegistry(PolicyBuilderRegistry registry) {
+ policyBuilderRegistry = registry;
+ }
+
+ @Autowire
+ public void setConnector(Connector connector) {
+ this.connector = connector;
+ }
+
+ @Init(eager = true)
+ public void init() {
+ builderRegistry.register(getImplementationType(), this);
+ }
+
+ protected abstract Class getImplementationType();
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java
new file mode 100644
index 0000000000..6c5086aec4
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java
@@ -0,0 +1,61 @@
+/*
+ * 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.spi.extension;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.loader.ComponentTypeLoader;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("MODULE")
+public abstract class ComponentTypeLoaderExtension implements ComponentTypeLoader {
+ protected LoaderRegistry loaderRegistry;
+
+ protected ComponentTypeLoaderExtension() {
+ }
+
+ protected ComponentTypeLoaderExtension(LoaderRegistry loaderRegistry) {
+ this.loaderRegistry = loaderRegistry;
+ }
+
+ @Autowire
+ public void setLoaderRegistry(LoaderRegistry loaderRegistry) {
+ this.loaderRegistry = loaderRegistry;
+ }
+
+ @Init(eager = true)
+ public void start() {
+ loaderRegistry.registerLoader(getImplementationClass(), this);
+ }
+
+ @Destroy
+ public void stop() {
+ loaderRegistry.unregisterLoader(getImplementationClass());
+ }
+
+ protected abstract Class getImplementationClass();
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
new file mode 100644
index 0000000000..93aec79bfd
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
@@ -0,0 +1,524 @@
+/*
+ * 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.spi.extension;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.AutowireResolutionException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentNotFoundException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.DuplicateNameException;
+import org.apache.tuscany.spi.component.IllegalTargetException;
+import org.apache.tuscany.spi.component.ObjectRegistrationException;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * An extension point for composite components, which new types may extend
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public abstract class CompositeComponentExtension extends AbstractSCAObject implements CompositeComponent {
+
+ protected final Map children = new ConcurrentHashMap();
+ protected final List services = new ArrayList();
+ protected final List references = new ArrayList();
+
+ protected final Map propertyValues;
+ protected final Connector connector;
+
+ protected final Map systemChildren = new ConcurrentHashMap();
+ protected final List systemServices = new ArrayList();
+ protected final List systemReferences = new ArrayList();
+
+ // autowire mappings
+ protected final Map autowireInternal = new ConcurrentHashMap();
+ protected final Map autowireExternal = new ConcurrentHashMap();
+ protected final Map systemAutowireInternal = new ConcurrentHashMap();
+ protected final Map systemAutowireExternal = new ConcurrentHashMap();
+
+ protected CompositeComponentExtension(String name,
+ CompositeComponent parent,
+ Connector connector,
+ Map propertyValues) {
+ super(name, parent);
+ this.propertyValues = propertyValues;
+ this.connector = connector;
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+ public void onEvent(Event event) {
+ publish(event);
+ }
+
+ public void registerJavaObject(String name, Class service, I instance)
+ throws ObjectRegistrationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Document getPropertyValue(String name) {
+ return propertyValues.get(name);
+ }
+
+ public SCAObject getChild(String name) {
+ assert name != null : "Name was null";
+ return children.get(name);
+ }
+
+ public SCAObject getSystemChild(String name) {
+ assert name != null : "Name was null";
+ return systemChildren.get(name);
+ }
+
+ public List getSystemChildren() {
+ return Collections.unmodifiableList(new ArrayList(systemChildren.values()));
+ }
+
+ public List getSystemServices() {
+ return Collections.unmodifiableList(systemServices);
+ }
+
+ public List getSystemReferences() {
+ return Collections.unmodifiableList(systemReferences);
+ }
+
+ public List getChildren() {
+ return Collections.unmodifiableList(new ArrayList(children.values()));
+ }
+
+ public List getServices() {
+ return Collections.unmodifiableList(services);
+ }
+
+ public List getReferences() {
+ return Collections.unmodifiableList(references);
+ }
+
+ public void register(SCAObject child) {
+ if (child.isSystem()) {
+ if (systemChildren.get(child.getName()) != null) {
+ DuplicateNameException e =
+ new DuplicateNameException("A system child is already registered with the name");
+ e.setIdentifier(child.getName());
+ e.addContextName(getName());
+ throw e;
+ }
+ systemChildren.put(child.getName(), child);
+ } else {
+ if (children.get(child.getName()) != null) {
+ DuplicateNameException e = new DuplicateNameException("A child is already registered with the name");
+ e.setIdentifier(child.getName());
+ e.addContextName(getName());
+ throw e;
+ }
+ children.put(child.getName(), child);
+ }
+ if (child instanceof Service) {
+ Service service = (Service) child;
+ synchronized (services) {
+ if (service.isSystem()) {
+ systemServices.add(service);
+ } else {
+ services.add(service);
+ }
+ }
+ registerAutowire(service);
+ } else if (child instanceof Reference) {
+ Reference reference = (Reference) child;
+ synchronized (references) {
+ if (reference.isSystem()) {
+ systemReferences.add(reference);
+ } else {
+ references.add(reference);
+ }
+ }
+ registerAutowire(reference);
+ } else if (child instanceof AtomicComponent) {
+ AtomicComponent atomic = (AtomicComponent) child;
+ registerAutowire(atomic);
+ } else if (child instanceof CompositeComponent) {
+ CompositeComponent component = (CompositeComponent) child;
+ if (lifecycleState == RUNNING && component.getLifecycleState() == UNINITIALIZED) {
+ component.start();
+ }
+ registerAutowire(component);
+ addListener(component);
+ }
+ }
+
+
+ public void addOutboundWire(OutboundWire wire) {
+
+ }
+
+ public void addOutboundWires(Class> multiplicityClass, List wires) {
+
+ }
+
+ public Map> getOutboundWires() {
+ return null;
+ }
+
+ public void addInboundWire(InboundWire wire) {
+ //TODO implement
+ }
+
+ public InboundWire getInboundWire(String serviceName) {
+ SCAObject object = children.get(serviceName);
+ if (!(object instanceof Service)) {
+ throw new ComponentNotFoundException(serviceName);
+ }
+ return ((Service) object).getInboundWire();
+ }
+
+ public Map getInboundWires() {
+ synchronized (services) {
+ Map map = new HashMap();
+ for (Service service : services) {
+ map.put(service.getName(), service.getInboundWire());
+ }
+ return map;
+ }
+ }
+
+ public TargetInvoker createAsyncTargetInvoker(InboundWire wire, Operation operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Service getService(String name) {
+ SCAObject ctx = children.get(name);
+ if (ctx == null) {
+ ComponentNotFoundException e = new ComponentNotFoundException("Service not found");
+ e.setIdentifier(name);
+ e.addContextName(getName());
+ throw e;
+ } else if (!(ctx instanceof Service)) {
+ ComponentNotFoundException e = new ComponentNotFoundException("SCAObject not a service");
+ e.setIdentifier(name);
+ e.addContextName(getName());
+ throw e;
+ }
+ return (Service) ctx;
+ }
+
+ public Object getServiceInstance() throws TargetException {
+ Service service = services.get(0);
+ if (service == null) {
+ throw new TargetException("Component has no services");
+ }
+ return service.getServiceInstance();
+ }
+
+ public Service getSystemService(String name) {
+ SCAObject ctx = systemChildren.get(name);
+ if (ctx == null) {
+ ComponentNotFoundException e = new ComponentNotFoundException("Service not found");
+ e.setIdentifier(name);
+ e.addContextName(getName());
+ throw e;
+ } else if (!(ctx instanceof Service)) {
+ ComponentNotFoundException e = new ComponentNotFoundException("SCAObject not a service");
+ e.setIdentifier(name);
+ e.addContextName(getName());
+ throw e;
+ }
+ return (Service) ctx;
+ }
+
+ public T locateService(Class serviceInterface, String name) {
+ SCAObject target = children.get(name);
+ if (target == null) {
+ TargetNotFoundException e = new TargetNotFoundException(name);
+ e.addContextName(getName());
+ throw e;
+ }
+ return serviceInterface.cast(target.getServiceInstance());
+ }
+
+ public T locateSystemService(Class serviceInterface, String name) {
+ SCAObject object = systemChildren.get(name);
+ if (object == null) {
+ TargetNotFoundException e = new TargetNotFoundException(name);
+ e.addContextName(getName());
+ throw e;
+ }
+ return serviceInterface.cast(object.getServiceInstance());
+ }
+
+ public Object getServiceInstance(String name) throws TargetException {
+ SCAObject context = children.get(name);
+ if (context == null) {
+ TargetNotFoundException e = new TargetNotFoundException(name);
+ e.addContextName(getName());
+ throw e;
+ } else if (context instanceof Service) {
+ return context.getServiceInstance();
+ } else {
+ IllegalTargetException e = new IllegalTargetException("Target must be a service");
+ e.setIdentifier(name);
+ e.addContextName(getName());
+ throw e;
+ }
+ }
+
+ public Object getSystemServiceInstance(String name) throws TargetException {
+ SCAObject target = systemChildren.get(name);
+ if (target == null) {
+ TargetNotFoundException e = new TargetNotFoundException(name);
+ e.addContextName(getName());
+ throw e;
+ } else if (target instanceof Service) {
+ return target.getServiceInstance();
+ } else {
+ IllegalTargetException e = new IllegalTargetException("Target must be a service");
+ e.setIdentifier(name);
+ e.addContextName(getName());
+ throw e;
+ }
+ }
+
+ public List> getServiceInterfaces() {
+ List> serviceInterfaces = new ArrayList>(services.size());
+ synchronized (services) {
+ for (Service service : services) {
+ serviceInterfaces.add(service.getInterface());
+ }
+ }
+ return serviceInterfaces;
+ }
+
+ public T resolveInstance(Class instanceInterface) throws AutowireResolutionException {
+ if (CompositeComponent.class.equals(instanceInterface)) {
+ return instanceInterface.cast(this);
+ }
+ SCAObject context = autowireInternal.get(instanceInterface);
+ if (context != null) {
+ try {
+ if (context instanceof AtomicComponent || context instanceof Reference || context instanceof Service) {
+ return instanceInterface.cast(context.getServiceInstance());
+ } else {
+ IllegalTargetException e = new IllegalTargetException("Autowire target must be a system "
+ + "service, atomic component, or reference");
+ e.setIdentifier(instanceInterface.getName());
+ e.addContextName(getName());
+ throw e;
+ }
+ } catch (CoreRuntimeException e) {
+ e.addContextName(getName());
+ throw e;
+ }
+ } else {
+ try {
+ if (CompositeComponent.class.isAssignableFrom(instanceInterface)) {
+ return instanceInterface.cast(this);
+ }
+ // resolve to parent
+ if (getParent() == null) {
+ return null;
+ }
+ return getParent().resolveInstance(instanceInterface);
+ } catch (AutowireResolutionException e) {
+ e.addContextName(getName());
+ throw e;
+ }
+ }
+ }
+
+ public T resolveSystemInstance(Class instanceInterface) throws AutowireResolutionException {
+ if (CompositeComponent.class.equals(instanceInterface)) {
+ return instanceInterface.cast(this);
+ }
+ SCAObject context = systemAutowireInternal.get(instanceInterface);
+ if (context != null) {
+ try {
+ if (context instanceof AtomicComponent || context instanceof Reference || context instanceof Service) {
+ return instanceInterface.cast(context.getServiceInstance());
+ } else {
+ IllegalTargetException e = new IllegalTargetException("Autowire target must be a system "
+ + "service, atomic component, or reference");
+ e.setIdentifier(instanceInterface.getName());
+ e.addContextName(getName());
+ throw e;
+ }
+ } catch (CoreRuntimeException e) {
+ e.addContextName(getName());
+ throw e;
+ }
+ } else {
+ try {
+ // resolve to parent
+ if (getParent() != null) {
+ return getParent().resolveSystemInstance(instanceInterface);
+ } else {
+ return null;
+ }
+ } catch (AutowireResolutionException e) {
+ e.addContextName(getName());
+ throw e;
+ }
+ }
+ }
+
+ public T resolveExternalInstance(Class instanceInterface) throws AutowireResolutionException {
+ Service service = autowireExternal.get(instanceInterface);
+ if (service != null) {
+ try {
+ return instanceInterface.cast(service.getServiceInstance());
+ } catch (CoreRuntimeException e) {
+ e.addContextName(getName());
+ throw e;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ public T resolveSystemExternalInstance(Class instanceInterface) throws AutowireResolutionException {
+ Service service = systemAutowireExternal.get(instanceInterface);
+ if (service != null) {
+ try {
+ return instanceInterface.cast(service.getServiceInstance());
+ } catch (CoreRuntimeException e) {
+ e.addContextName(getName());
+ throw e;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ public void prepare() {
+ // Connect services and references first so that their wires are linked first
+ List childList = new ArrayList();
+ for (SCAObject child : systemChildren.values()) {
+ if (child instanceof Component) {
+ childList.add(child);
+ } else {
+ childList.add(0, child);
+ }
+ }
+ // connect system artifacts
+ for (SCAObject child : childList) {
+ // connect all children
+ // TODO for composite wires, should delegate down
+ connector.connect(child);
+ child.prepare();
+ }
+
+ // connect application artifacts
+ childList.clear();
+ for (SCAObject child : children.values()) {
+ if (child instanceof Component) {
+ childList.add(child);
+ } else {
+ childList.add(0, child);
+ }
+ }
+ for (SCAObject child : childList) {
+ // connect all children
+ // TODO for composite wires, should delegate down
+ connector.connect(child);
+ child.prepare();
+ }
+ }
+
+ protected void registerAutowireExternal(Class> interfaze, Service service) {
+ if (interfaze == null) {
+ // The ServiceContract is not from Java
+ return;
+ }
+ if (service.isSystem()) {
+ if (systemAutowireExternal.containsKey(interfaze)) {
+ return;
+ }
+ systemAutowireExternal.put(interfaze, service);
+ } else {
+ if (autowireExternal.containsKey(interfaze)) {
+ return;
+ }
+ autowireExternal.put(interfaze, service);
+ }
+ }
+
+ protected void registerAutowireInternal(Class> interfaze, SCAObject object) {
+ if (interfaze == null) {
+ // The ServiceContract is not from Java
+ return;
+ }
+ if (object.isSystem()) {
+ if (systemAutowireInternal.containsKey(interfaze)) {
+ return;
+ }
+ systemAutowireInternal.put(interfaze, object);
+ } else {
+ if (autowireInternal.containsKey(interfaze)) {
+ return;
+ }
+ autowireInternal.put(interfaze, object);
+ }
+ }
+
+ protected void registerAutowire(CompositeComponent component) {
+ List services = component.getServices();
+ for (Service service : services) {
+ registerAutowireInternal(service.getInterface(), service);
+ }
+ }
+
+ protected void registerAutowire(AtomicComponent component) {
+ List> services = component.getServiceInterfaces();
+ for (Class> service : services) {
+ registerAutowireInternal(service, component);
+ }
+ }
+
+ protected void registerAutowire(Reference reference) {
+ registerAutowireInternal(reference.getInterface(), reference);
+ }
+
+ protected void registerAutowire(Service service) {
+ registerAutowireExternal(service.getInterface(), service);
+ }
+
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java
new file mode 100644
index 0000000000..cc42247c33
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java
@@ -0,0 +1,77 @@
+/*
+ * 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.spi.extension;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.StAXElementLoader;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Support class for extending the Loader mechanism.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class LoaderExtension implements StAXElementLoader {
+ /**
+ * The LoaderRegistry that this loader should register with; usually set by injection. This registry may also be
+ * used to load sub-elements.
+ */
+ protected LoaderRegistry registry;
+
+ /**
+ * Constructor specifies the registry to register with.
+ *
+ * @param registry the LoaderRegistry this loader should register with
+ */
+ protected LoaderExtension(@Autowire LoaderRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Initialize the loader. The base implementation registers this loader with the registry as a handler for the XML
+ * type returned by {@link #getXMLType()}. Implementations may override this to register the loader as a handler for
+ * multiple XML types.
+ */
+ @Init(eager = true)
+ public void start() {
+ registry.registerLoader(getXMLType(), this);
+ }
+
+ /**
+ * Destroy the loader. The base implementation unregisters the loader from the regsitry based on the type returned
+ * by {@link #getXMLType()}.
+ */
+ @Destroy
+ public void stop() {
+ registry.unregisterLoader(getXMLType(), this);
+ }
+
+ /**
+ * Returns the QName of the element that this implementation handles.
+ *
+ * @return the QName of the element that this implementation handles
+ */
+ public abstract QName getXMLType();
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
new file mode 100644
index 0000000000..d6c3222c38
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
@@ -0,0 +1,104 @@
+/*
+ * 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.spi.extension;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * The default implementation of an SCA reference
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ReferenceExtension extends AbstractSCAObject implements Reference {
+
+ protected InboundWire inboundWire;
+ protected OutboundWire outboundWire;
+ protected Class> referenceInterface;
+ protected WireService wireService;
+ protected ServiceContract> bindingServiceContract;
+
+ protected ReferenceExtension(String name,
+ Class> referenceInterface,
+ CompositeComponent parent,
+ WireService wireService) {
+ super(name, parent);
+ this.referenceInterface = referenceInterface;
+ this.wireService = wireService;
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+ public void setInboundWire(InboundWire wire) {
+ this.inboundWire = wire;
+ }
+
+ public InboundWire getInboundWire() {
+ return inboundWire;
+ }
+
+ public OutboundWire getOutboundWire() {
+ return outboundWire;
+ }
+
+ public void setOutboundWire(OutboundWire outboundWire) {
+ this.outboundWire = outboundWire;
+ }
+
+ public Class> getInterface() {
+ return referenceInterface;
+ }
+
+ public Object getServiceInstance() throws TargetException {
+ return wireService.createProxy(inboundWire);
+ }
+
+ public WireInvocationHandler getHandler() throws TargetException {
+ return wireService.createHandler(inboundWire);
+ }
+
+ public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TargetInvoker createAsyncTargetInvoker(OutboundWire wire, Operation operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceContract> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ public void setBindingServiceContract(ServiceContract> serviceContract) {
+ this.bindingServiceContract = serviceContract;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
new file mode 100644
index 0000000000..2eeddf7727
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
@@ -0,0 +1,98 @@
+/*
+ * 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.spi.extension;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * The default implementation of an SCA service
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceExtension extends AbstractSCAObject implements Service {
+
+ protected Class> interfaze;
+ protected InboundWire inboundWire;
+ protected OutboundWire outboundWire;
+ protected WireService wireService;
+ protected ServiceContract> bindingServiceContract;
+
+ public ServiceExtension(String name, Class> interfaze, CompositeComponent parent, WireService wireService)
+ throws CoreRuntimeException {
+ super(name, parent);
+ this.interfaze = interfaze;
+ this.wireService = wireService;
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+ public InboundWire getInboundWire() {
+ return inboundWire;
+ }
+
+ public void setInboundWire(InboundWire wire) {
+ inboundWire = wire;
+ }
+
+ public OutboundWire getOutboundWire() {
+ return outboundWire;
+ }
+
+ public void setOutboundWire(OutboundWire outboundWire) {
+ this.outboundWire = outboundWire;
+ }
+
+ public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getServiceInstance() throws TargetException {
+ return wireService.createProxy(inboundWire);
+ }
+
+ public WireInvocationHandler getHandler() {
+ return wireService.createHandler(inboundWire);
+ }
+
+ public Class> getInterface() {
+ return interfaze;
+ }
+
+ public ServiceContract> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ public void setBindingServiceContract(ServiceContract> serviceContract) {
+ this.bindingServiceContract = serviceContract;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java
new file mode 100644
index 0000000000..8a65a91f3a
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.SystemAtomicComponent;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class SystemAtomicComponentExtension extends AtomicComponentExtension implements SystemAtomicComponent {
+ protected List> interfazes;
+
+ public SystemAtomicComponentExtension(String name,
+ CompositeComponent parent,
+ ScopeContainer scopeContainer,
+ int initLevel) {
+ this(name, null, parent, scopeContainer, initLevel);
+ }
+
+ public SystemAtomicComponentExtension(String name,
+ List> serviceInterfaces,
+ CompositeComponent parent,
+ ScopeContainer scopeContainer,
+ int initLevel) {
+ super(name, parent, scopeContainer, null, null, null, initLevel);
+ this.interfazes = serviceInterfaces;
+ }
+
+ public Object getServiceInstance() throws TargetException {
+ return getTargetInstance();
+ }
+
+ public Object getServiceInstance(String name) throws TargetException {
+ throw new UnsupportedOperationException();
+ }
+
+ public List> getServiceInterfaces() {
+ return interfazes;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSystem() {
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
new file mode 100644
index 0000000000..faa13360c7
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.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.spi.extension;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * The default implementation of a TargetInvoker
+ */
+public abstract class TargetInvokerExtension implements TargetInvoker {
+
+ private boolean cacheable;
+
+ public TargetInvokerExtension() {
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBodyWithFault(e.getCause());
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return isCacheable();
+ }
+
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ // TargetInvoker extends Cloneable so this should not have been thrown
+ throw new AssertionError(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java
new file mode 100644
index 0000000000..0e7922f0f1
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java
@@ -0,0 +1,48 @@
+/*
+ * 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.spi.host;
+
+import javax.servlet.Servlet;
+
+/**
+ * ServiceDefinition interface implemented by host environments that allow Servlets to be registered.
+ *
+ * This interface allows an SCA system component to register a servlet to handle inbound requests.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHost {
+ /**
+ * Register a mapping for an instance of a Servlet. This requests that the servlet container direct all requests to
+ * the designated mapping to the supplied Servlet instance.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ * @param servlet the Servlet that should be invoked
+ */
+ void registerMapping(String mapping, Servlet servlet);
+
+ /**
+ * Unregister a servlet mapping. This directs the servlet contain not to direct any more requests to a previously
+ * registered Servlet.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ */
+ void unregisterMapping(String mapping);
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java
new file mode 100644
index 0000000000..5a0bd3bb5f
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.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.spi.idl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema elements
+ */
+public class ElementInfo {
+ private QName name;
+ private TypeInfo type;
+
+ /**
+ * @param name
+ * @param type
+ */
+ public ElementInfo(QName name, TypeInfo type) {
+ super();
+ this.name = name;
+ this.type = type;
+ }
+
+ /**
+ * @return the name
+ */
+ public QName getQName() {
+ return name;
+ }
+
+ /**
+ * @return the type
+ */
+ public TypeInfo getType() {
+ return type;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java
new file mode 100644
index 0000000000..5709524573
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.idl;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class InvalidServiceContractException extends TuscanyException {
+ public InvalidServiceContractException() {
+ }
+
+ public InvalidServiceContractException(String message) {
+ super(message);
+ }
+
+ public InvalidServiceContractException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidServiceContractException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java
new file mode 100644
index 0000000000..0b435e9eb9
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.idl;
+
+/**
+ * Exception thrown to indicate that a service contract specification contains an overloaded method.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OverloadedOperationException extends InvalidServiceContractException {
+ private static final long serialVersionUID = -4658711318608885638L;
+
+ public OverloadedOperationException() {
+ }
+
+ public OverloadedOperationException(String message) {
+ super(message);
+ }
+
+ public OverloadedOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public OverloadedOperationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java
new file mode 100644
index 0000000000..9bb107812c
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.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.spi.idl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema types
+ */
+public class TypeInfo {
+ private QName name;
+
+ private boolean isSimpleType;
+
+ private TypeInfo baseType;
+
+ /**
+ * @param name
+ * @param isSimpleType
+ */
+ public TypeInfo(QName name, boolean isSimpleType, TypeInfo baseType) {
+ super();
+ this.name = name;
+ this.isSimpleType = isSimpleType;
+ this.baseType = baseType;
+ }
+
+ /**
+ * @return the isSimpleType
+ */
+ public boolean isSimpleType() {
+ return isSimpleType;
+ }
+
+ /**
+ * @return the name
+ */
+ public QName getQName() {
+ return name;
+ }
+
+ /**
+ * @return the baseType
+ */
+ public TypeInfo getBaseType() {
+ return baseType;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/WrapperInfo.java b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/WrapperInfo.java
new file mode 100644
index 0000000000..1125da744c
--- /dev/null
+++ b/sca-java-1.x/tags/1.0-incubator-M2/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/WrapperInfo.java
@@ -0,0 +1,117 @@
+/*
+ * 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.spi.idl;
+
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based Web Services (JAX-WS) 2.0 specification,
+ * section 2.3.1.2 Wrapper Style.
+ *
+ * A WSDL operation qualifies for wrapper style mapping only if the following criteria are met:
(i) The
+ * operation’s input and output messages (if present) each contain only a single part
(ii) The input message part
+ * refers to a global element declaration whose localname is equal to the operation name
(iii) The output message
+ * part refers to a global element declaration
(iv) The elements referred to by the input and output message parts
+ * (henceforth referred to as wrapper elements) are both complex types defined using the xsd:sequence compositor
(v)
+ * The wrapper elements only contain child elements, they must not contain other structures such as wildcards (element
+ * or attribute), xsd:choice, substitution groups (element references are not permitted) or attributes; furthermore,
+ * they must not be nillable.