summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-M2/sca/services/containers/container.spring
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:13:23 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:13:23 +0000
commit6d0e93c68d3aeaeb4bb6d96ac0460eec40ef786e (patch)
treea956ed510e14a5509b8ef49fae42cfd439629825 /branches/sca-java-M2/sca/services/containers/container.spring
parent3ac2d800d840f03618fc364090d786effde84b1f (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835143 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-M2/sca/services/containers/container.spring')
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/.ruleset190
-rwxr-xr-xbranches/sca-java-M2/sca/services/containers/container.spring/LICENSE.txt202
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/NOTICE.txt14
-rwxr-xr-xbranches/sca-java-M2/sca/services/containers/container.spring/README.txt35
-rwxr-xr-xbranches/sca-java-M2/sca/services/containers/container.spring/pom.xml81
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/SCANamespaceHandlerResolver.java59
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java68
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java109
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java88
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java252
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java196
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInterceptor.java53
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java104
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java63
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java54
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java101
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java77
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringServiceContract.java31
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java130
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java41
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java46
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java45
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java31
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java52
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java77
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java147
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java123
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java105
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java144
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java67
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java68
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java44
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java63
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java66
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java65
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/intercept/OneWayAdvisor.java82
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/AnnotationServiceMetadata.java95
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/BeanFactoryDeploymentMetadata.java55
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/DeploymentMetadata.java28
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/FieldInjection.java68
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/Injection.java76
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/MethodInjection.java65
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/NoSuchServiceException.java24
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/ServiceMetadata.java56
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/sca/spring.system.scdl40
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.handlers3
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.schemas1
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd101
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java58
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java70
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceInvocationTestCase.java68
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ServiceInvocationTestCase.java76
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java137
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java64
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java62
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/integration/BootstrapTestCase.java57
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java31
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java42
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java26
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml32
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/default.scdl37
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml32
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml35
-rw-r--r--branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/test.xml29
64 files changed, 0 insertions, 4641 deletions
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/.ruleset b/branches/sca-java-M2/sca/services/containers/container.spring/.ruleset
deleted file mode 100644
index 3886f07f2d..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/.ruleset
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<ruleset name="pmd-eclipse">
- <description>PMD Plugin preferences rule set</description>
-
-
- <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
- <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
- <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
-<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
-<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
-<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
- <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
-<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
-<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
-<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
-<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
-<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
- <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
- <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
-<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
- <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
- <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
- <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
- <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
- <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
-<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
-
-<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
-<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
-<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
-<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
-
-<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
-<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
-<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
-
-<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
-<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
-<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
-<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
-<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
-<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
-
-<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
-<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
-<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
-<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
-<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
-<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
-<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
-<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
-<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
-<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
-<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
-
-<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
-<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
-<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
-
-<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
-<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
-<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
-<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
-<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
-<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
-<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
-<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
-<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
-<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
-<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
-<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
-<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
-<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
-<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
-<rule ref="rulesets/design.xml/IdempotentOperations"/>
-<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
-<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
-<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
-<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
-<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
-<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
-<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
-<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
-<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
-<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
-<rule ref="rulesets/design.xml/SimplifyConditional"/>
-<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
-<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
-<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
-<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
-<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
-<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
-
-<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
-<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
-<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
-<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
-<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
-<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
-
-<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
-<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
-<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
-<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
-
-<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
-<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
-
-<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
-<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
-<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
-<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
-<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
-<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
-<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
-<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
-
- <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
- <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
- <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
- <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
- <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
- <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
- <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
- <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
-
- <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
- <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
- <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
- <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
- <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
- <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
- <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
- <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
- <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
- <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
- <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
- <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
- <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
- <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
- <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
- <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
-
- <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
- <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
- <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
- <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
- <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
- <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
-
- <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
- <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
- <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
- <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
- <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
- <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
-
- <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
- <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
- <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
- <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
- <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
-
- <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
- <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
-
- <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
- <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
- <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
- <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
-
-</ruleset>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/LICENSE.txt b/branches/sca-java-M2/sca/services/containers/container.spring/LICENSE.txt
deleted file mode 100755
index 0084319535..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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/branches/sca-java-M2/sca/services/containers/container.spring/NOTICE.txt b/branches/sca-java-M2/sca/services/containers/container.spring/NOTICE.txt
deleted file mode 100644
index d83ebbe236..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/NOTICE.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-${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/branches/sca-java-M2/sca/services/containers/container.spring/README.txt b/branches/sca-java-M2/sca/services/containers/container.spring/README.txt
deleted file mode 100755
index 9b26d1690a..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/README.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-Apache Tuscany M1 build (May, 2006)
-===================================
-
-http://incubator.apache.org/tuscany/
-
-Tuscany is an effort undergoing incubation at the Apache Software Foundation
-(ASF), sponsored by the 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.
-
-
-Support
--------
-
-Any problem with this release can be reported to the Tuscany mailing list
-or in the JIRA issue tracker.
-
-Mailing list subscription:
- tuscany-dev-subscribe@ws.apache.org
-
-Jira:
- http://issues.apache.org/jira/browse/Tuscany
-
-
-Thank you for using Tuscany!
-
-
-The Tuscany Team.
-
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/pom.xml b/branches/sca-java-M2/sca/services/containers/container.spring/pom.xml
deleted file mode 100755
index 057f5b7d61..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
-
- <parent>
- <groupId>org.apache.tuscany.sca.services.containers</groupId>
- <artifactId>parent</artifactId>
- <version>1.0-incubator-M2-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>spring</artifactId>
- <name>Apache Tuscany Spring Framework Container</name>
- <description>Container for managing Spring composites</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca.kernel</groupId>
- <artifactId>tuscany-spi</artifactId>
- <version>${sca.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca.runtime</groupId>
- <artifactId>webapp</artifactId>
- <version>${sca.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- <version>2.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>test</artifactId>
- <version>${sca.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- </dependency>
-
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/SCANamespaceHandlerResolver.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/SCANamespaceHandlerResolver.java
deleted file mode 100644
index 047d2b4ad1..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/SCANamespaceHandlerResolver.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.container.spring.config;
-
-import org.apache.tuscany.spi.model.CompositeComponentType;
-
-import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
-import org.springframework.beans.factory.xml.NamespaceHandler;
-import org.springframework.sca.config.ScaNamespaceHandler;
-
-/**
- * Overrides the default Spring namespace resolver to automatically register {@link SCANamespaceHandler} instead of
- * requiring a value to be supplied in a Spring configuration
- * <p/>
- * TODO: Figure out how to activate this impl
- *
- * @version $$Rev$$ $$Date$$
- */
-public class SCANamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
-
- private static final String SCA_NAMESPACE = "http://www.springframework.org/schema/sca";
-
- private ScaNamespaceHandler handler;
-
- public SCANamespaceHandlerResolver(ClassLoader classLoader, CompositeComponentType componentType) {
- super(classLoader);
- handler = new ScaNamespaceHandler(/*componentType*/);
- }
-
- public SCANamespaceHandlerResolver(String handlerMappingsLocation,
- ClassLoader classLoader,
- CompositeComponentType componentType) {
- super(classLoader, handlerMappingsLocation);
- handler = new ScaNamespaceHandler(/*componentType*/);
- }
-
- public NamespaceHandler resolve(String namespaceUri) {
- if (SCA_NAMESPACE.equals(namespaceUri)) {
- return handler;
- }
- return super.resolve(namespaceUri);
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java
deleted file mode 100644
index cdf33b0ea1..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.container.spring.config;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.core.io.Resource;
-import org.springframework.sca.ScaAdapterAware;
-import org.springframework.sca.ScaAdapterPostProcessor;
-
-import org.apache.tuscany.container.spring.impl.SpringScaAdapter;
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-
-/**
- * @author Andy Piper
- * @since 2.1
- */
-public class ScaApplicationContext extends AbstractXmlApplicationContext {
- public static final String APP_CONTEXT_PROP = "org.springframework.sca.application.context";
- private Resource appXml;
- private SpringComponentType componentType;
-
- public ScaApplicationContext(Resource appXml, SpringComponentType componentType) {
- this(null, appXml, componentType);
- }
-
- public ScaApplicationContext(ApplicationContext parent, Resource appXml, SpringComponentType componentType) {
- super(parent);
- this.appXml = appXml;
- this.componentType = componentType;
- refresh();
- }
-
- protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
- // beanDefinitionReader.setEntityResolver(null);
- beanDefinitionReader
- .setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(getClassLoader(), componentType));
- }
-
- protected Resource[] getConfigResources() {
- return new Resource[]{appXml};
- }
-
- protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
- super.postProcessBeanFactory(beanFactory);
- beanFactory.addBeanPostProcessor(new ScaAdapterPostProcessor(new SpringScaAdapter(componentType)));
- beanFactory.ignoreDependencyInterface(ScaAdapterAware.class);
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java
deleted file mode 100644
index fa815eee78..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.springframework.context.support.AbstractRefreshableApplicationContext;
-import org.springframework.core.io.Resource;
-import org.springframework.sca.ScaServiceExporter;
-
-import org.apache.tuscany.container.spring.config.ScaApplicationContext;
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.apache.tuscany.container.spring.model.SpringImplementation;
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
-import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.apache.tuscany.host.RuntimeInfo;
-
-/**
- * Loads a component type for a Spring <code>ApplicationContext</code>. The implementation creates a new instance of a
- * Spring application context which is configured with SCA namespace handlers for generating component type information
- *
- * @version $$Rev$$ $$Date$$
- */
-
-public class SpringComponentTypeLoader extends ComponentTypeLoaderExtension<SpringImplementation> {
- public static final String SERVICE_BEAN_SUFFIX = ".SCAService";
-
- private org.apache.tuscany.host.RuntimeInfo runtimeInfo;
-
- public SpringComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry, @Autowire RuntimeInfo runtimeInfo) {
- super(loaderRegistry);
- this.runtimeInfo = runtimeInfo;
- }
-
- @Override
- protected Class<SpringImplementation> getImplementationClass() {
- return SpringImplementation.class;
- }
-
- /**
- * Responsible for loading the Spring composite component type. The the application context is instantiated here as
- * it is needed to derive component type information. Since the component type is loaded per SCDL entry (i.e.
- * composite use) one application context instance will be created per Spring composite instance.
- */
- @SuppressWarnings("unchecked")
- public void load(CompositeComponent parent,
- SpringImplementation implementation,
- DeploymentContext deploymentContext) throws LoaderException {
- if (implementation.getComponentType() != null) {
- // FIXME hack since the builder registry loads the implementation type and the Spring implementation loader
- // needs to as well. The second call is done by the builder registry and we just ignore it.
- return;
- }
- Resource resource = implementation.getApplicationResource();
- SpringComponentType componentType = new SpringComponentType();
- // REVIEW andyp -- pass in deploymentContext.getClassLoader()?
- AbstractRefreshableApplicationContext ctx;
- if (runtimeInfo instanceof SpringRuntimeInfo) {
- ctx = ((SpringRuntimeInfo) runtimeInfo).getApplicationContext();
- } else {
- ctx = new ScaApplicationContext(resource, componentType);
- }
- componentType.setApplicationContext(ctx); // FIXME andyp@bea.com -- don't do this!
-
- // If there are <sca:service> elements, they define (and limit) the services exposed
- // in the componentType.
- String [] serviceBeanNames = ctx.getBeanNamesForType(ScaServiceExporter.class);
- for (String serviceBeanName : serviceBeanNames) {
- int nSuffix = serviceBeanName.indexOf(SERVICE_BEAN_SUFFIX);
- if (nSuffix == -1) {
- continue;
- }
-
- String serviceName = serviceBeanName.substring(0, nSuffix);
- ScaServiceExporter serviceBean = (ScaServiceExporter) ctx.getBean(serviceName);
- // REVIEW andyp -- use the class directly?
- String serviceTypeName = serviceBean.getServiceType().getName();
- try {
- Class serviceInterface = Class.forName(serviceTypeName, true, deploymentContext.getClassLoader());
- componentType.addServiceType(serviceName, serviceInterface);
- //ServiceDefinition service = createService(serviceInterface);
- //componentType.getServices().put(serviceName, service);
- } catch (ClassNotFoundException e) {
- throw new LoaderException(e);
- }
- }
- // if no service tags are specified, expose all beans
- componentType.setExposeAllBeans(componentType.getServiceTypes().isEmpty());
- implementation.setComponentType(componentType);
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
deleted file mode 100644
index 6ec5d8fdd7..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.apache.tuscany.spi.QualifiedName;
-import org.apache.tuscany.spi.builder.BuilderConfigException;
-import org.apache.tuscany.spi.component.Component;
-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.extension.ComponentBuilderExtension;
-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.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.CompositeComponentType;
-import org.apache.tuscany.spi.model.Property;
-import org.apache.tuscany.spi.wire.InboundInvocationChain;
-import org.apache.tuscany.spi.wire.InboundWire;
-
-import org.apache.tuscany.container.spring.model.SpringImplementation;
-import org.springframework.context.support.AbstractApplicationContext;
-
-/**
- * Creates a {@link org.apache.tuscany.container.spring.impl.SpringCompositeComponent} from an assembly model
- *
- * @version $$Rev$$ $$Date$$
- */
-public class SpringCompositeBuilder extends ComponentBuilderExtension<SpringImplementation> {
-
- public Component build(CompositeComponent parent,
- ComponentDefinition<SpringImplementation> componentDefinition,
- DeploymentContext deploymentContext) throws BuilderConfigException {
- String name = componentDefinition.getName();
- SpringImplementation implementation = componentDefinition.getImplementation();
- AbstractApplicationContext applicationContext = implementation.getComponentType().getApplicationContext();
- SpringCompositeComponent component =
- new SpringCompositeComponent(name, applicationContext, parent, connector, null);
- CompositeComponentType<BoundServiceDefinition<? extends Binding>,
- BoundReferenceDefinition<? extends Binding>,
- ? extends Property> componentType = implementation.getComponentType();
-
- // We still need to set the target invoker as opposed to having the connector do it since the
- // Spring context is "opaque" to the wiring fabric. In other words, the Spring context does not expose
- // its beans as SCA components to the connector to wire the services to
- for (BoundServiceDefinition<? extends Binding> serviceDefinition : componentType.getServices().values()) {
- // call back into builder registry to handle building of services
- Service service = (Service) builderRegistry.build(parent, serviceDefinition, deploymentContext);
- // wire serviceDefinition to bean invokers
- InboundWire wire = service.getInboundWire();
- QualifiedName targetName = new QualifiedName(serviceDefinition.getTarget().getPath());
- for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
- // FIXME this should go to the connector and get policy and be invoked from SpringComposite.prepare()
- chain.addInterceptor(new SpringInterceptor());
- chain.setTargetInvoker(component.createTargetInvoker(targetName.getPartName(), chain.getOperation()));
- }
- component.register(service);
- }
- for (BoundReferenceDefinition<?> referenceDefinition : componentType.getReferences().values()) {
- // call back into builder registry to handle building of references
- Reference reference = (Reference) builderRegistry.build(parent, referenceDefinition, deploymentContext);
- connector.connect(reference);
- component.register(reference);
- }
- return component;
- }
-
- protected Class<SpringImplementation> getImplementationType() {
- return SpringImplementation.class;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
deleted file mode 100644
index b30202cb96..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Locale;
-import java.util.Map;
-
-import org.w3c.dom.Document;
-
-import org.apache.tuscany.spi.builder.Connector;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.Reference;
-import org.apache.tuscany.spi.component.SCAObject;
-import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.extension.CompositeComponentExtension;
-import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.MessageSourceResolvable;
-import org.springframework.context.NoSuchMessageException;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.core.io.Resource;
-
-/**
- * A composite implementation responsible for managing Spring application contexts.
- *
- * @version $$Rev$$ $$Date$$
- */
-public class SpringCompositeComponent extends CompositeComponentExtension {
- private static final String[] EMPTY_ARRAY = new String[0];
- private AbstractApplicationContext springContext;
-
- /**
- * Creates a new composite
- *
- * @param name the name of the SCA composite
- * @param springContext the pre-instantiated Spring applicaiton context
- * @param parent the SCA composite parent
- * @param connector the connector to use for wiring children
- * @param propertyValues the values of this composite's Properties
- */
- public SpringCompositeComponent(String name,
- AbstractApplicationContext springContext,
- CompositeComponent parent,
- Connector connector,
- Map<String, Document> propertyValues) {
- super(name, parent, connector, propertyValues);
- SCAApplicationContext scaApplicationContext = new SCAApplicationContext();
- springContext.setParent(scaApplicationContext);
- // REVIEW we need to refresh to pick up the parent but this is not optimal
- springContext.refresh();
- this.springContext = springContext;
- }
-
- public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
- ServiceContract contract = operation.getServiceContract();
- Method[] methods = contract.getInterfaceClass().getMethods();
- Method method = findMethod(operation, methods);
- // FIXME test m == null
- // Treat the serviceName as the Spring bean name to look up
- return new SpringInvoker(targetName, method, springContext);
- }
-
- public void setScopeContainer(ScopeContainer scopeContainer) {
- // not needed
- }
-
- public ConfigurableApplicationContext getApplicationContext() {
- return springContext;
- }
-
- public void prepare() {
- // TODO handle only references with a composite binding
- }
-
- public void start() {
- super.start();
- for (SCAObject child : children.values()) {
- child.start();
- }
- springContext.start();
- }
-
- public void stop() {
- super.stop();
- springContext.stop();
- }
-
- public <T> T locateService(Class<T> serviceInterface, String name) {
- return serviceInterface.cast(springContext.getBean(name));
- }
-
- /**
- * An inner class is required to act as the Spring application context parent as opposed to implementing the
- * interface since the return types for {@link org.springframework.context.ApplicationContext#getParent()} and
- * {@link org.apache.tuscany.spi.component.CompositeComponent#getParent()} clash
- */
- private class SCAApplicationContext implements ApplicationContext {
-
- public Object getBean(String name) throws BeansException {
- return getBean(name, null);
- }
-
- public Object getBean(String name, Class requiredType) throws BeansException {
- SCAObject object = children.get(name); // keep cast due to compiler error
- if (object == null) {
- return null;
- }
- Class<?> type;
- if (object instanceof Reference) {
- type = ((Reference) object).getInterface();
- } else if (object instanceof Service) {
- type = ((Service) object).getInterface();
- } else {
- throw new AssertionError("Illegal object type [" + name + "]");
- }
- if (requiredType != null && requiredType.isAssignableFrom(type)) {
- // need null check since Spring may pass in a null
- throw new BeanNotOfRequiredTypeException(name, requiredType, type);
- }
- return object.getServiceInstance();
- }
-
- public boolean containsBean(String name) {
- return children.get(name) != null;
- }
-
- public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
- return children.get(name) != null;
- }
-
- public Class getType(String name) throws NoSuchBeanDefinitionException {
- return null;
- }
-
- public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
- return EMPTY_ARRAY;
- }
-
- public ApplicationContext getParent() {
- return null;
- }
-
- public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
- return null;
- }
-
- public String getDisplayName() {
- return getName();
- }
-
- public long getStartupDate() {
- return 0;
- }
-
- public boolean containsBeanDefinition(String beanName) {
- return false;
- }
-
- public int getBeanDefinitionCount() {
- return 0;
- }
-
- public String[] getBeanDefinitionNames() {
- return new String[0];
- }
-
- public String[] getBeanNamesForType(Class type) {
- return new String[0];
- }
-
- public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) {
- return new String[0];
- }
-
- public Map getBeansOfType(Class type) throws BeansException {
- return null;
- }
-
- public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans)
- throws BeansException {
- return null;
- }
-
- public BeanFactory getParentBeanFactory() {
- return null;
- }
-
- public boolean containsLocalBean(String name) {
- return false;
- }
-
- public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
- return null;
- }
-
- public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
- return null;
- }
-
- public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
- return null;
- }
-
- public void publishEvent(ApplicationEvent event) {
-
- }
-
- public Resource[] getResources(String locationPattern) throws IOException {
- return new Resource[0];
- }
-
- public Resource getResource(String location) {
- return null;
- }
-
- public ClassLoader getClassLoader() {
- // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's
- // resource loading mechanism is exposed right now.
- return this.getClass().getClassLoader();
- }
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java
deleted file mode 100644
index c95375cad2..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringImplementationLoader.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import javax.xml.namespace.QName;
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
-
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.LoaderExtension;
-import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.apache.tuscany.spi.loader.MissingResourceException;
-import org.apache.tuscany.spi.model.BoundReferenceDefinition;
-import org.apache.tuscany.spi.model.BoundServiceDefinition;
-
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.apache.tuscany.container.spring.model.SpringImplementation;
-import org.apache.tuscany.host.RuntimeInfo;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.UrlResource;
-
-/**
- * Loader for handling Spring <spring:implementation.spring> elements.
- */
-public class SpringImplementationLoader extends LoaderExtension<SpringImplementation> {
- private static final QName IMPLEMENTATION_SPRING = new QName("http://www.osoa.org/xmlns/sca/1.0",
- "implementation.spring");
-
- private static final String APPLICATION_CONTEXT = "application-context.xml";
-
- private static final QName SERVICE_ELEMENT = new QName(XML_NAMESPACE_1_0, "service");
- private static final QName REFERENCE_ELEMENT = new QName(XML_NAMESPACE_1_0, "reference");
-
- private final RuntimeInfo runtimeInfo;
-
- public SpringImplementationLoader(@Autowire LoaderRegistry registry, @Autowire RuntimeInfo runtimeInfo) {
- super(registry);
- this.runtimeInfo = runtimeInfo;
- }
-
- public QName getXMLType() {
- return IMPLEMENTATION_SPRING;
- }
-
- @SuppressWarnings("unchecked")
- public SpringImplementation load(CompositeComponent parent,
- XMLStreamReader reader,
- DeploymentContext deploymentContext)
- throws XMLStreamException, LoaderException {
-
- String locationAttr = reader.getAttributeValue(null, "location");
- if (locationAttr == null && !contextProvided()) {
- throw new MissingResourceException("No location supplied");
- }
-
- SpringImplementation implementation = new SpringImplementation();
- ClassLoader classLoader = deploymentContext.getClassLoader();
- if (!contextProvided()) {
- implementation.setApplicationResource(getApplicationContextResource(locationAttr, classLoader));
- }
- registry.loadComponentType(parent, implementation, deploymentContext);
- SpringComponentType type = implementation.getComponentType();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- QName qname = reader.getName();
- if (SERVICE_ELEMENT.equals(qname)) {
- BoundServiceDefinition service =
- (BoundServiceDefinition) registry.load(parent, reader, deploymentContext);
- if (!type.isExposeAllBeans()) {
- String name = service.getName();
- if (!type.getServiceTypes().containsKey(name)) {
- LoaderException e = new LoaderException("No service defined in Spring context for ");
- e.setIdentifier(name);
- throw e;
- }
- }
- type.getDeclaredServices().put(service.getName(), service);
- } else if (REFERENCE_ELEMENT.equals(qname)) {
- BoundReferenceDefinition reference =
- (BoundReferenceDefinition) registry.load(parent, reader, deploymentContext);
- type.getDeclaredReferences().put(reference.getName(), reference);
- }
- break;
- case END_ELEMENT:
- if (IMPLEMENTATION_SPRING.equals(reader.getName())) {
- return implementation;
- }
- }
- }
- }
-
- protected Resource getApplicationContextResource(String locationAttr, ClassLoader cl) throws LoaderException {
- assert runtimeInfo != null;
- File manifestFile = null;
- File appXmlFile;
- File locationFile = new File(locationAttr);
-
- if (!locationFile.isAbsolute()) {
- locationFile = new File(runtimeInfo.getApplicationRootDirectory(), locationAttr);
- }
- if (!locationFile.exists()) {
- // FIXME hack
- URL url = cl.getResource(locationAttr);
- if (url != null) {
- return new UrlResource(url);
- }
- throw new MissingResourceException(locationFile.toString());
- }
-
- if (locationFile.isDirectory()) {
- try {
- manifestFile = new File(locationFile, "META-INF/MANIFEST.MF");
- if (manifestFile.exists()) {
- Manifest mf = new Manifest(new FileInputStream(manifestFile));
- Attributes mainAttrs = mf.getMainAttributes();
- String appCtxPath = mainAttrs.getValue("Spring-Context");
- if (appCtxPath != null) {
- appXmlFile = new File(locationFile, appCtxPath);
- if (appXmlFile.exists()) {
- return new UrlResource(appXmlFile.toURL());
- }
- }
- }
- // no manifest-specified Spring context, use default
- appXmlFile = new File(locationFile, APPLICATION_CONTEXT);
- if (appXmlFile.exists()) {
- return new UrlResource(appXmlFile.toURL());
- }
- } catch (IOException e) {
- throw new LoaderException("Error reading manifest " + manifestFile);
- }
- } else {
- try {
- JarFile jf = new JarFile(locationFile);
- JarEntry je;
- Manifest mf = jf.getManifest();
- if (mf != null) {
- Attributes mainAttrs = mf.getMainAttributes();
- String appCtxPath = mainAttrs.getValue("Spring-Context");
- if (appCtxPath != null) {
- je = jf.getJarEntry(appCtxPath);
- if (je != null) {
- // TODO return a Spring specific Resouce type for jars
- return new UrlResource(new URL("jar:" + locationFile.toURL() + "!/" + appCtxPath));
- }
- }
- }
- je = jf.getJarEntry(APPLICATION_CONTEXT);
- if (je != null) {
- return new UrlResource(new URL("jar:" + locationFile.toURI().toURL() + "!" + APPLICATION_CONTEXT));
- }
- } catch (IOException e) {
- // bad archive
- // TODO: create a more appropriate exception type
- throw new MissingResourceException(locationAttr, e);
- }
- }
- throw new MissingResourceException(APPLICATION_CONTEXT);
- }
-
- private boolean contextProvided() {
- return runtimeInfo instanceof SpringRuntimeInfo;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInterceptor.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInterceptor.java
deleted file mode 100644
index fb7f0bd99c..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInterceptor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.apache.tuscany.spi.wire.Interceptor;
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
-/**
- * A temporary interceptor until the connector is updated
- *
- * @version $Rev$ $Date$
- */
-public class SpringInterceptor implements Interceptor {
-
- public Message invoke(Message msg) throws InvocationRuntimeException {
- TargetInvoker invoker = msg.getTargetInvoker();
- if (invoker == null) {
- throw new InvocationRuntimeException("No target invoker specified on message");
- }
- return invoker.invoke(msg);
- }
-
- public void setNext(Interceptor next) {
- throw new IllegalStateException("This interceptor must be the last one in an target interceptor chain");
- }
-
- public Interceptor getNext() {
- return null;
- }
-
- public boolean isOptimizable() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java
deleted file mode 100644
index 6e05c888ae..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringInvoker.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.spi.component.TargetException;
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-
-/**
- * Dispatches to an operation on a Spring bean. Since Spring manages bean lifecycle and scope through resolution in the
- * target proxy, the invoker can safely cache the target proxy.
- *
- * @version $$Rev$$ $$Date$$
- */
-public class SpringInvoker implements TargetInvoker {
- private ApplicationContext springContext;
- // default to true since Spring handles resolution
- private boolean cacheable = true;
- private String beanName;
- private Method method;
- // caching is thread-safe since Spring handles resolution
- private Object bean;
-
- public SpringInvoker(String beanName, Method method, ApplicationContext context) {
- this.beanName = beanName;
- this.method = method;
- springContext = context;
- }
-
- public Object invokeTarget(final Object object) throws InvocationTargetException {
- if (bean == null) {
- try {
- bean = springContext.getBean(beanName);
- } catch (BeansException e) {
- throw new TargetException(e);
- }
- }
- try {
- if (object != null && !object.getClass().isArray()) {
- return method.invoke(bean, object);
- } else {
- return method.invoke(bean, (Object[]) object);
- }
- } catch (IllegalAccessException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- public Message invoke(Message msg) throws InvocationRuntimeException {
- try {
- Object resp = invokeTarget(msg.getBody());
- msg.setBody(resp);
- } catch (InvocationTargetException e) {
- msg.setBodyWithFault(e.getCause());
- } catch (Throwable e) {
- msg.setBodyWithFault(e);
- }
- return msg;
- }
-
- public boolean isCacheable() {
- return cacheable;
- }
-
- public void setCacheable(boolean cacheable) {
- this.cacheable = cacheable;
- }
-
- public boolean isOptimizable() {
- return false;
- }
-
-
- public SpringInvoker clone() throws CloneNotSupportedException {
- SpringInvoker invoker = (SpringInvoker) super.clone();
- invoker.bean = null;
- return invoker;
- }
-
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java
deleted file mode 100644
index 8b4f0ac905..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringRuntimeInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import java.io.File;
-import java.net.URL;
-
-import org.apache.tuscany.host.RuntimeInfo;
-import org.springframework.context.support.AbstractRefreshableApplicationContext;
-
-/**
- * @author Andy Piper
- * @since 2.1
- */
-public class SpringRuntimeInfo implements RuntimeInfo {
- private AbstractRefreshableApplicationContext applicationContext;
- private File appRootDir;
-
- public SpringRuntimeInfo(File appRootDir, AbstractRefreshableApplicationContext applicationContext) {
- this.appRootDir = appRootDir;
- this.applicationContext = applicationContext;
- }
-
- public AbstractRefreshableApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- public void setApplicationContext(AbstractRefreshableApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- public File getInstallDirectory() {
- return null;
- }
-
- public File getApplicationRootDirectory() {
- return appRootDir;
- }
-
- public URL getBaseURL() {
- return null;
- }
-
- public boolean isOnline() {
- return true;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java
deleted file mode 100644
index ca645db823..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tuscany.container.spring.impl;
-
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.springframework.sca.ScaAdapter;
-
-/**
- * @author Andy Piper
- * @since 2.1
- */
-public class SpringScaAdapter implements ScaAdapter {
- //private final SpringComponentType componentType;
-
- public SpringScaAdapter(SpringComponentType componentType) {
- //this.componentType = componentType;
- }
-
- public Object getServiceReference(String referenceName, Class referenceType, String moduleName,
- String defaultServiceName) {
- /*
- ReferenceDefinition reference = null;
- componentType.getReferences().put(referenceName, reference);
- */
- return null;
- }
-
- public Object getPropertyReference(String propertyName, Class propertyType, String moduleName) {
- return null;
- }
-
- public void publishAsService(Object serviceImplementation, Class serviceInterface, String serviceName,
- String moduleName) {
- /*
- componentType.addServiceType(serviceName, serviceInterface);
- ServiceDefinition service = null;
- componentType.getServices().put(serviceName, service);
- */
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
deleted file mode 100644
index d8758ffdb7..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.container.spring.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.spi.model.CompositeComponentType;
-import org.apache.tuscany.spi.model.Property;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-
-import org.springframework.context.support.AbstractApplicationContext;
-
-/**
- * Component type information for a Spring composite component implementation type. A component type is associated with
- * a Spring application context
- *
- * @version $Rev$ $Date$
- */
-public class SpringComponentType<S extends ServiceDefinition,
- R extends ReferenceDefinition,
- P extends Property<?>> extends CompositeComponentType<S, R, P> {
-
- private AbstractApplicationContext applicationContext;
- private Map<String, Class<?>> serviceTypes = new HashMap<String, Class<?>>();
- private boolean exposeAllBeans;
-
- public SpringComponentType(AbstractApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- public SpringComponentType() {
- }
-
- // FIXME andyp@bea.com -- this is a component type it should NOT contain bean instances!
-
- /**
- * Returns the application context for the component type
- */
- public AbstractApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
- public void setApplicationContext(AbstractApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- /**
- * Returns a collection of service types defined by <code>sca:service</code> elements in a Spring configuration.
- * Service types define beans that can be targets of services defined in the SCDL Spring composite declaration. For
- * each service type, there must be a corresponding service definition as part of the Spring composite declaration
- * per the SCA specification.
- */
- public Map<String, Class<?>> getServiceTypes() {
- return serviceTypes;
- }
-
- /**
- * Adds a service type to the component declaration defined by <code>sca:service</code> elements in a Spring
- * configuration.
- *
- * @param name the name of the service
- * @param type the interface type of the target bean
- */
- public void addServiceType(String name, Class<?> type) {
- this.serviceTypes.put(name, type);
- }
-
- /**
- * Returns true if all beans in the Spring application context may be service targets or false if service types are
- * defined
- */
- public boolean isExposeAllBeans() {
- return exposeAllBeans;
- }
-
- /**
- * Sets if all beans in the Spring application context may be service targets or false if service types are defined
- */
- public void setExposeAllBeans(boolean exposeAllBeans) {
- this.exposeAllBeans = exposeAllBeans;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java
deleted file mode 100644
index 7780894f56..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringImplementation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.container.spring.model;
-
-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.model.Implementation;
-import org.apache.tuscany.spi.model.Property;
-
-import org.springframework.core.io.Resource;
-
-/**
- * Represents a composite whose implementation type is a Spring application context.
- *
- * @version $$Rev$$ $$Date$$
- */
-public class SpringImplementation extends Implementation<SpringComponentType<BoundServiceDefinition<? extends Binding>,
- BoundReferenceDefinition<? extends Binding>, ? extends Property>> {
-
- private String location;
- private Resource applicationResource;
-
- public SpringImplementation() {
- }
-
- public SpringImplementation(SpringComponentType<
- BoundServiceDefinition<? extends Binding>,
- BoundReferenceDefinition<? extends Binding>,
- ? extends Property> componentType) {
- super(componentType);
- }
-
- /**
- * Returns the path of the Spring application context configuration
- */
- public String getLocation() {
- return location;
- }
-
- /**
- * Sets the path of the Spring application context configuration
- */
- public void setLocation(String location) {
- this.location = location;
- }
-
- /**
- * Returns the Spring configuration resource for the application context
- */
- public Resource getApplicationResource() {
- return applicationResource;
- }
-
- /**
- * Sets the Spring configuration resource for the application context
- */
- public void setApplicationResource(Resource applicationXml) {
- this.applicationResource = applicationXml;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringServiceContract.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringServiceContract.java
deleted file mode 100644
index 3a88991e4b..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringServiceContract.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.container.spring.model;
-
-import org.apache.tuscany.spi.model.ServiceContract;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SpringServiceContract extends ServiceContract {
-
- public SpringServiceContract(String interfaceName) {
- super(interfaceName);
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java
deleted file mode 100644
index 2284d32201..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.container.spring.webapp;
-
-import java.io.File;
-import java.net.URL;
-
-import javax.servlet.ServletContext;
-
-import org.apache.tuscany.api.TuscanyRuntimeException;
-import org.apache.tuscany.container.spring.config.SCANamespaceHandlerResolver;
-import org.apache.tuscany.container.spring.impl.SpringScaAdapter;
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.apache.tuscany.runtime.webapp.WebappRuntime;
-import org.apache.tuscany.runtime.webapp.WebappUtil;
-import org.apache.tuscany.runtime.webapp.WebappUtilImpl;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.core.io.Resource;
-import org.springframework.sca.ScaAdapterAware;
-import org.springframework.sca.ScaAdapterPostProcessor;
-import org.springframework.util.Assert;
-import org.springframework.web.context.ConfigurableWebApplicationContext;
-import org.springframework.web.context.support.XmlWebApplicationContext;
-
-/**
- * WebApplicationContext implementation that understands SCA extensions.
- * This class is not very complicated, the key issue is getting hold of a reference
- * to the Tuscany runtime which the webapp is using.
- *
- * @author Andy Piper
- */
-public class ScaWebApplicationContext extends XmlWebApplicationContext
- implements ConfigurableWebApplicationContext {
- private WebappRuntime runtime;
- private SpringComponentType componentType;
-
- public ScaWebApplicationContext() {
- }
-
- protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
-// beanDefinitionReader.setEntityResolver(null);
- beanDefinitionReader
- .setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(getClassLoader(), componentType));
- }
-
- public Resource getResource(String location) {
- Assert.notNull(location, "location is required");
- return super.getResource(location);
- }
-
- /* (non-Javadoc)
- * @see org.springframework.context.support.AbstractApplicationContext#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
- */
- protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
- super.postProcessBeanFactory(beanFactory);
- beanFactory.addBeanPostProcessor(new ScaAdapterPostProcessor
- (new SpringScaAdapter(componentType)));
- beanFactory.ignoreDependencyInterface(ScaAdapterAware.class);
- }
-
- protected void onRefresh() {
- if (runtime != null) { // egregious hack to prevent recursion in refresh()
- return;
- }
- ServletContext servletContext = getServletContext();
- WebappUtil utils = getUtils(servletContext);
-
- try {
- ClassLoader webappClassLoader = Thread.currentThread().getContextClassLoader();
- ClassLoader bootClassLoader = utils.getBootClassLoader(webappClassLoader);
- runtime = utils.getRuntime(bootClassLoader);
- URL systemScdl = utils.getSystemScdl(bootClassLoader);
- URL applicationScdl = utils.getApplicationScdl(webappClassLoader);
-
- runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
- runtime.setApplicationName(utils.getApplicationName());
- runtime.setServletContext(servletContext);
- runtime.setHostClassLoader(webappClassLoader);
- runtime.setSystemScdl(systemScdl);
- runtime.setApplicationScdl(applicationScdl);
- runtime.setRuntimeInfo(new SpringWebappRuntimeInfo(getApplicationRootDirectory(), this));
- runtime.initialize();
- } catch (TuscanyRuntimeException e) {
- servletContext.log(e.getMessage(), e);
- throw e;
- }
- }
-
- protected WebappUtil getUtils(ServletContext servletContext) {
- return new WebappUtilImpl(servletContext);
- }
-
- protected void onClose() {
- if (runtime != null) {
- runtime.destroy();
- runtime = null;
- }
- }
-
- /**
- * What does this do and why to we need it?
- * @return
- */
- private File getApplicationRootDirectory() {
- String property = System.getProperty("tuscany.applicationRootDir");
- if (property != null) {
- return new File(property);
- }
-
- return new File(System.getProperty("user.dir"));
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java
deleted file mode 100644
index a860049462..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.container.spring.webapp;
-
-import java.io.File;
-import javax.servlet.ServletContext;
-
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.XmlWebApplicationContext;
-
-import org.apache.tuscany.container.spring.impl.SpringRuntimeInfo;
-import org.apache.tuscany.runtime.webapp.WebappRuntimeInfo;
-
-/**
- * @author Andy Piper
- */
-public class SpringWebappRuntimeInfo extends SpringRuntimeInfo implements WebappRuntimeInfo {
- public SpringWebappRuntimeInfo(File appRootDir, XmlWebApplicationContext applicationContext) {
- super(appRootDir, applicationContext);
- }
-
- public ServletContext getServletContext() {
- return ((WebApplicationContext) getApplicationContext()).getServletContext();
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java
deleted file mode 100644
index e2071e27c3..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 11-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca;
-
-/**
- * @author Adrian Colyer
- * @since 2.0
- */
-public class DefaultScaAdapter implements ScaAdapter {
-
- public Object getServiceReference(String referenceName,
- Class referenceType,
- String moduleName,
- String defaultServiceName) {
- // TODO
- return new Object();
- }
-
- public Object getPropertyReference(String propertyName, Class propertyType, String moduleName) {
- // TODO
- return new Object();
- }
-
- public void publishAsService(Object serviceImplementation,
- Class serviceInterface,
- String serviceName,
- String moduleName) {
- // TODO
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java
deleted file mode 100644
index e5aae6f0a2..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 11-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca;
-
-/**
- * Encapsulates interaction with an SCA runtime
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public interface ScaAdapter {
-
- Object getServiceReference(
- String referenceName,
- Class referenceType,
- String moduleName,
- String defaultServiceName);
-
- Object getPropertyReference(
- String propertyName,
- Class propertyType,
- String moduleName);
-
- void publishAsService(
- Object serviceImplementation,
- Class serviceInterface,
- String serviceName,
- String moduleName);
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java
deleted file mode 100644
index abe975c936..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.springframework.sca;
-
-/**
- * /** Interface that enables beans to find the ScaAdapter they are defined with.
- * <p/>
- * Note that in most circumstances there is no need for a bean to implement this interface.
- *
- * @author Andy Piper
- * @since 2.1
- */
-public interface ScaAdapterAware {
- void setScaAdapter(ScaAdapter adapter);
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java
deleted file mode 100644
index b07be8f452..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.springframework.sca;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-
-/**
- * @author Andy Piper
- * @since 2.1
- */
-public class ScaAdapterPostProcessor implements BeanPostProcessor {
- private ScaAdapter scaAdapter;
-
- public ScaAdapterPostProcessor(ScaAdapter adapter) {
- this.scaAdapter = adapter;
- }
-
- public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
- if (bean instanceof ScaAdapterAware) {
- if (this.scaAdapter == null) {
- throw new IllegalStateException("Cannot satisfy ScaAdapterAware for bean '"
- + beanName + "' without ScaAdapater");
- }
- ((ScaAdapterAware) bean).setScaAdapter(scaAdapter);
- }
- return bean;
- }
-
- public Object postProcessAfterInitialization(Object object, String string) throws BeansException {
- return object;
- }
-
- public ScaAdapter getScaAdapter() {
- return scaAdapter;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java
deleted file mode 100644
index e12e763d9f..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca;
-
-import org.springframework.beans.factory.InitializingBean;
-
-/**
- * Bean that represents an Sca composite component. An instance of this bean is created when the &lt;sca:composite
- * module-id="xxx"/&gt; element is declared.
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaComposite implements InitializingBean {
-
- private String component;
- private ScaAdapter scaAdapter = new DefaultScaAdapter();
-
- public String getComponent() {
- return this.component;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void setScaAdapter(ScaAdapter scaAdapter) {
- this.scaAdapter = scaAdapter;
- }
-
- public void setScaAdapterClass(Class adapterClass) {
- if (!ScaAdapter.class.isAssignableFrom(adapterClass)) {
- throw new IllegalArgumentException(
- "Adapter class '" + adapterClass + "' specified for ScaComposite bean "
- + "does not implement the ScaApapter interface"
- );
- }
- try {
- this.scaAdapter = (ScaAdapter) adapterClass.newInstance();
- } catch (Exception ex) {
- // many exceptions may be thrown by the above, we treat them all
- // the same
- throw new IllegalStateException("Unable to create instance of ScaAdapter class '"
- + adapterClass.getName() + "'", ex);
- }
- }
-
- public ScaAdapter getScaAdapter() {
- return this.scaAdapter;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
- */
- public void afterPropertiesSet() throws Exception {
- if (this.component == null) {
- throw new IllegalArgumentException("Required property moduleId was not set");
- }
- }
-
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java
deleted file mode 100644
index f96af00584..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.sca;
-
-import java.beans.PropertyDescriptor;
-
-import org.springframework.aop.framework.ProxyFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.PropertyValues;
-import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.core.task.TaskExecutor;
-import org.springframework.sca.intercept.OneWayAdvisor;
-import org.springframework.sca.metadata.DeploymentMetadata;
-import org.springframework.sca.metadata.Injection;
-import org.springframework.sca.metadata.NoSuchServiceException;
-import org.springframework.sca.metadata.ServiceMetadata;
-
-/**
- * Spring bean post processor that looks up service metadata by name for each bean definition and performs SCA
- * injection.
- * <p/>
- * Also performs proxying for OneWay.
- *
- * @author Rod Johnson
- */
-public class ScaPostProcessor implements InstantiationAwareBeanPostProcessor, ApplicationContextAware {
-
- private DeploymentMetadata deploymentMetadata;
-
- private ApplicationContext applicationContext;
-
- private TaskExecutor taskExecutor;
-
- //private ScaAdapter scaAdapter;
-
-
- /**
- * @param taskExecutor The taskExecutor to set.
- */
- public void setTaskExecutor(TaskExecutor taskExecutor) {
- this.taskExecutor = taskExecutor;
- }
-
- // TODO would process side files when container starts up
-
- public void setDeploymentMetadata(DeploymentMetadata deploymentMetadata) {
- this.deploymentMetadata = deploymentMetadata;
- }
-
- /**
- * @param scaAdapter the ScaAdapter for use to export services if necessary
- */
- public void setScaAdapter(ScaAdapter scaAdapter) {
- //this.scaAdapter = scaAdapter;
- }
-
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
- public Object postProcessBeforeInstantiation(Class beanClass,
- String beanName) throws BeansException {
- return null;
- }
-
- public boolean postProcessAfterInstantiation(Object bean, String beanName)
- throws BeansException {
- try {
- ServiceMetadata smd = deploymentMetadata.getServiceMetadata(beanName);
- doScaInjection(bean, smd);
- } catch (NoSuchServiceException ex) {
- //
- }
- return true;
- }
-
- public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
- String beanName) throws BeansException {
- return pvs;
- }
-
- public PropertyValues postProcessPropertyValues(PropertyValues propertyValues, Object object, String string)
- throws BeansException {
- return propertyValues;
- }
-
- protected void doScaInjection(Object bean, ServiceMetadata smd) {
- for (Injection injection : smd.getInjections()) {
- injection.apply(applicationContext, bean);
- }
- }
-
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- try {
- ServiceMetadata smd = deploymentMetadata.getServiceMetadata(beanName);
- return createScaProxy(bean, smd);
- } catch (NoSuchServiceException ex) {
- return bean;
- }
-
- // TODO validate required injections here or earlier
-
- // TODO publish if necessary, using adapter
- }
-
- protected Object createScaProxy(Object bean, ServiceMetadata smd) {
- ProxyFactory pf = new ProxyFactory(bean);
- for (Class intf : smd.getServiceInterfaces()) {
- pf.addInterface(intf);
- }
-
-//pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
-//pf.addAdvisor(new ExposeBeanNameAdvisor(smd.getServiceName()));
- // TODO enforce call by value
-
- if (!smd.getOneWayMethods().isEmpty()) {
- pf.addAdvisor(new OneWayAdvisor(smd, this.taskExecutor));
- }
-
- return pf.getProxy();
- }
-
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java
deleted file mode 100644
index e89072466a..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca;
-
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-
-/**
- * Factory bean that returns a reference to an SCA property obtained by asking the SCA runtime for the property with the
- * given name for the given component.
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaPropertyProxyFactoryBean implements InitializingBean, FactoryBean {
-
- /**
- * the type of the property
- */
- private Class propertyType;
-
- /**
- * the name of the property to look up
- */
- private String propertyName;
-
- /**
- * the SCA component we should present ourselves as when asking for a service reference
- */
- private ScaComposite scaComposite;
-
- private Object resolvedPropertyVal;
-
- public void setPropertyType(Class serviceType) {
- this.propertyType = serviceType;
- }
-
- public Class getPropertyType() {
- return this.propertyType;
- }
-
- public void setPropertyName(String name) {
- this.propertyName = name;
- }
-
- public String getPropertyName() {
- return this.propertyName;
- }
-
- public void setScaComposite(ScaComposite scaComposite) {
- this.scaComposite = scaComposite;
- }
-
- public ScaComposite getScaComposite() {
- return this.scaComposite;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
- */
- public void afterPropertiesSet() throws Exception {
- if (this.propertyType == null) {
- throw new IllegalArgumentException("Required property serviceType was not set");
- }
- if (this.scaComposite == null) {
- throw new IllegalArgumentException("Required property scaComposite was not set");
- }
- if (this.propertyName == null) {
- throw new IllegalArgumentException("Required property referenceName was not set");
- }
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#getObject()
- */
- public Object getObject() throws Exception {
- if (this.resolvedPropertyVal != null) {
- return this.resolvedPropertyVal;
- }
-
- String moduleName = this.scaComposite.getComponent();
- // TODO: AMC is there any merit in proxying this with a lazy target source?
- Object propertyVal =
- this.scaComposite.getScaAdapter().getPropertyReference(this.propertyName, this.propertyType, moduleName);
- if (!this.propertyType.isAssignableFrom(propertyVal.getClass())) {
- throw new IllegalStateException("Property value '" + propertyVal.toString() + "'"
- + " of type '" + propertyVal.getClass().getName() + "' "
- + " is not of expected type '" + this.propertyType.getName() + "'");
- }
- this.resolvedPropertyVal = propertyVal;
- return this.resolvedPropertyVal;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#getObjectType()
- */
- public Class getObjectType() {
- return this.propertyType;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#isSingleton()
- */
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java
deleted file mode 100644
index 0155dd9646..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanFactoryAware;
-import org.springframework.beans.factory.InitializingBean;
-
-/**
- * Exposes a bean instance to SCA to using the given service name.
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaServiceExporter implements InitializingBean, BeanFactoryAware, ScaAdapterAware {
-
- /**
- * the name of the service we want to advertise
- */
- private String serviceName;
-
- /**
- * the type the service should be published with
- */
- private Class serviceType;
-
- /**
- * the bean to be published
- */
- private Object target;
-
- /**
- * for resolving the bean name
- */
- private BeanFactory beanFactory;
- private ScaAdapter scaAdapter;
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getServiceName() {
- return this.serviceName;
- }
-
- public void setServiceType(Class serviceType) {
- this.serviceType = serviceType;
- }
-
- public Class getServiceType() {
- return this.serviceType;
- }
-
- public void setTarget(Object targetBean) {
- this.target = targetBean;
- }
-
- public Object getTarget() {
- return this.target;
- }
-
- public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
- this.beanFactory = beanFactory;
- }
-
- public void afterPropertiesSet() throws Exception {
- if (this.serviceType == null) {
- throw new IllegalArgumentException("Required property serviceType was not set");
- }
- if (this.target == null) {
- throw new IllegalArgumentException("Required property target was not set");
- }
- if (this.beanFactory == null) {
- throw new IllegalArgumentException("Required property beanFactory was not set");
- }
- if (this.serviceName == null) {
- throw new IllegalArgumentException("Required property serviceName was not set");
- }
- publishScaService();
- }
-
- private void publishScaService() {
- scaAdapter.publishAsService(target, serviceType, serviceName, null);
- }
-
- public void setScaAdapter(ScaAdapter adapter) {
- this.scaAdapter = adapter;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java
deleted file mode 100644
index 01ca5671d4..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * Factory bean that returns a reference to an SCA service obtained by asking the SCA runtime for the service with the
- * given name for the given component.
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaServiceProxyFactoryBean
- implements InitializingBean, FactoryBean, ApplicationContextAware, ScaAdapterAware {
-
- /**
- * the public interface type of the service (may be a class...)
- */
- private Class serviceType;
-
- /**
- * the name of the reference to look up
- */
- private String referenceName;
-
- /**
- * the default service name to resolve the reference too
- */
- private String defaultServiceName;
-
- private Object resolvedServiceReference;
- private ApplicationContext applicationContext;
- //private ScaAdapter scaAdapter;
-
- public void setServiceType(Class serviceType) {
- this.serviceType = serviceType;
- }
-
- public Class getServiceType() {
- return this.serviceType;
- }
-
- public void setReferenceName(String name) {
- this.referenceName = name;
- }
-
- public String getReferenceName() {
- return this.referenceName;
- }
-
- public void setDefaultServiceName(String defaultService) {
- this.defaultServiceName = defaultService;
- }
-
- public String getDefaultServiceName() {
- return this.defaultServiceName;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
- */
- public void afterPropertiesSet() throws Exception {
- if (this.serviceType == null) {
- throw new IllegalArgumentException("Required property serviceType was not set");
- }
- if (this.referenceName == null) {
- throw new IllegalArgumentException("Required property referenceName was not set");
- }
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#getObject()
- */
- public Object getObject() throws Exception {
- if (this.resolvedServiceReference != null) {
- return this.resolvedServiceReference;
- }
-
- // TODO: AMC is there any merit in proxying this with a lazy target source?
- // should the returned service ref be proxied? Only seems to add value
- // if SCA gives us any lifecycle events we can subscribe to and take
- // meaningful action on...
- // See OsgiServiceProxyFactoryBean for an example of how to do the
- // proxying if needed.
- Object scaServiceRef;
- if (this.applicationContext.getParent() == null) {
- return null;
- }
-
- if (!this.applicationContext.getParent().containsBean(this.referenceName)) {
- return new Object();
- //scaServiceRef = this.applicationContext.getParent().getBean(this.defaultServiceName);
- } else {
- scaServiceRef = this.applicationContext.getParent().getBean(this.referenceName);
- }
- if (!this.serviceType.isAssignableFrom(scaServiceRef.getClass())) {
- throw new IllegalStateException("...");
- }
- this.resolvedServiceReference = scaServiceRef;
- return this.resolvedServiceReference;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#getObjectType()
- */
- public Class getObjectType() {
- return this.serviceType;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#isSingleton()
- */
- public boolean isSingleton() {
- return false;
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
- public void setScaAdapter(ScaAdapter adapter) {
- // this.scaAdapter = adapter;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java
deleted file mode 100644
index 9c6ac633f7..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca.config;
-
-import org.w3c.dom.Element;
-
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.sca.ScaComposite;
-
-/**
- * Parser for &lt;sca:composite&gt; elements
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaCompositeBeanDefinitionParser implements BeanDefinitionParser {
-
- static final String SCA_COMPOSITE_BEAN_NAME = "scaComposite";
- private static final String MODULE_ATTRIBUTE_NAME = "component";
- private static final String MODULE_ID = "component";
- private static final String ADAPTER_ATTRIBUTE = "sca-adapter-class";
- private static final String ADAPTER_CLASS_PROPERTY = "scaAdapterClass";
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- BeanDefinitionRegistry registry = parserContext.getRegistry();
- if (registry.containsBeanDefinition(SCA_COMPOSITE_BEAN_NAME)) {
- throw new IllegalArgumentException(
- "At most one <sca:composite> element can be declared in a bean factory");
- }
- BeanDefinition beanDef = createScaCompositeBeanDefinition(element);
- registry.registerBeanDefinition(SCA_COMPOSITE_BEAN_NAME, beanDef);
- return beanDef;
- }
-
- private BeanDefinition createScaCompositeBeanDefinition(Element element) {
- RootBeanDefinition beanDefinition = new RootBeanDefinition();
- beanDefinition.setBeanClass(ScaComposite.class);
- MutablePropertyValues props = new MutablePropertyValues();
- props.addPropertyValue(MODULE_ID, element.getAttribute(MODULE_ATTRIBUTE_NAME));
- if (element.hasAttribute(ADAPTER_ATTRIBUTE)) {
- props.addPropertyValue(ADAPTER_CLASS_PROPERTY, element.getAttribute(ADAPTER_ATTRIBUTE));
- }
- beanDefinition.setPropertyValues(props);
- return beanDefinition;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java
deleted file mode 100644
index 3446aaf462..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca.config;
-
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.sca.ScaAdapter;
-import org.springframework.sca.ScaComposite;
-
-/**
- * @author Hal Hildebrand Date: Apr 11, 2006 Time: 4:33:33 PM
- */
-public class ScaContextBuilder {
- private static final String MODULE_ID = "moduleId";
-
- private static final String SCA_ADAPTER = "scaAdapter";
-
- private static final String SCA_COMPOSITE_BEAN_NAME = "scaComposite";
-
- private String moduleId;
-
- private ScaAdapter scaAdapter;
-
- public String getModuleId() {
- return this.moduleId;
- }
-
- public void setModuleId(String moduleId) {
- this.moduleId = moduleId;
- }
-
- public void setScaAdapter(ScaAdapter scaAdapter) {
- this.scaAdapter = scaAdapter;
- }
-
- public ScaAdapter getScaAdapter() {
- return this.scaAdapter;
- }
-
- public ApplicationContext construct() {
- GenericApplicationContext parent = new GenericApplicationContext();
- BeanDefinition bd = new RootBeanDefinition(ScaComposite.class, true);
-
- bd.getPropertyValues().addPropertyValue(new PropertyValue(MODULE_ID, moduleId));
- bd.getPropertyValues().addPropertyValue(new PropertyValue(SCA_ADAPTER, scaAdapter));
- parent.registerBeanDefinition(SCA_COMPOSITE_BEAN_NAME, bd);
- parent.refresh();
- return parent;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java
deleted file mode 100644
index 878267813a..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca.config;
-
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
-
-/**
- * Handler for the &lt;sca:&gt; namespace. Handles: <ul> <li>&lt;sca:composite module="xxxxx"/&gt;</li>
- * <li>&lt;sca:reference name="xxx" type="yyy" default-service="zzz"/&gt;</li> <li>&lt;sca:property name="xxx"
- * type="yyy"/&gt;</li> <li>&lt;sca:service name="xxx" type="yyyy" target="zzz"/&gt; </ul>
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaNamespaceHandler extends NamespaceHandlerSupport {
-
- public ScaNamespaceHandler() {
- // FIXME JFM
- init();
- }
-
- public final void init() {
- registerBeanDefinitionParser("composite", new ScaCompositeBeanDefinitionParser());
- registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
- registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
- registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java
deleted file mode 100644
index 55413b69da..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca.config;
-
-import org.w3c.dom.Element;
-
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.sca.ScaPropertyProxyFactoryBean;
-
-/**
- * Parser for the &lt;sca:property/&gt; element
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaPropertyBeanDefinitionParser implements BeanDefinitionParser {
-
- private static final String PROPERTY_NAME_ATTRIBUTE = "name";
- private static final String PROPERTY_NAME_PROPERTY = "propertyName";
- private static final String PROPERTY_TYPE_PROPERTY = "propertyType";
- private static final String TYPE_ATTRIBUTE = "type";
- private static final String ID_ATTRIBUTE = "id";
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- // needs service type, reference name, sca component, and optionally default service name
- BeanDefinitionRegistry registry = parserContext.getRegistry();
- String beanName = element.getAttribute(ID_ATTRIBUTE);
- BeanDefinition beanDef = createBeanDefinition(element);
- registry.registerBeanDefinition(beanName, beanDef);
- return beanDef;
- }
-
- private BeanDefinition createBeanDefinition(Element element) {
- RootBeanDefinition beanDefinition = new RootBeanDefinition();
- beanDefinition.setBeanClass(ScaPropertyProxyFactoryBean.class);
- MutablePropertyValues props = new MutablePropertyValues();
- props.addPropertyValue(PROPERTY_NAME_PROPERTY, element.getAttribute(PROPERTY_NAME_ATTRIBUTE));
- props.addPropertyValue(PROPERTY_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
- beanDefinition.setPropertyValues(props);
- return beanDefinition;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java
deleted file mode 100644
index 4f4d196571..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca.config;
-
-import org.w3c.dom.Element;
-
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.sca.ScaServiceProxyFactoryBean;
-
-/**
- * Parser for the &lt;sca:reference&gt; element
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
-
- private static final String REFERENCE_NAME_ATTRIBUTE = "name";
- private static final String REFERENCE_NAME_PROPERTY = "referenceName";
- private static final String TYPE_ATTRIBUTE = "type";
- private static final String SERVICE_TYPE_PROPERTY = "serviceType";
- private static final String DEFAULT_SERVICE_ATTRIBUTE = "default";
- private static final String DEFAULT_SERVICE_PROPERTY = "defaultServiceName";
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- // needs service type, reference name, sca component, and optionally default service name
- BeanDefinitionRegistry registry = parserContext.getRegistry();
- String referenceName = element.getAttribute(REFERENCE_NAME_ATTRIBUTE);
- BeanDefinition beanDef = createBeanDefinition(element);
- registry.registerBeanDefinition(referenceName, beanDef);
- return beanDef;
- }
-
- private BeanDefinition createBeanDefinition(Element element) {
- RootBeanDefinition beanDefinition = new RootBeanDefinition();
- beanDefinition.setBeanClass(ScaServiceProxyFactoryBean.class);
- MutablePropertyValues props = new MutablePropertyValues();
- props.addPropertyValue(REFERENCE_NAME_PROPERTY, element.getAttribute(REFERENCE_NAME_ATTRIBUTE));
- props.addPropertyValue(SERVICE_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
- if (element.hasAttribute(DEFAULT_SERVICE_ATTRIBUTE)) {
- props.addPropertyValue(DEFAULT_SERVICE_PROPERTY, element.getAttribute(DEFAULT_SERVICE_ATTRIBUTE));
- }
- beanDefinition.setPropertyValues(props);
- return beanDefinition;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java
deleted file mode 100644
index 5867236faa..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * 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.
- *
- * Created on 10-Apr-2006 by Adrian Colyer
- */
-package org.springframework.sca.config;
-
-import org.w3c.dom.Element;
-
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.sca.ScaServiceExporter;
-
-/**
- * Parser for the &lt;sca:service/&gt; element
- *
- * @author Adrian Colyer
- * @since 2.0
- */
-public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
-
- private static final String SERVICE_NAME_ATTRIBUTE = "name";
- private static final String TYPE_ATTRIBUTE = "type";
- private static final String TARGET_ATTRIBUTE = "target";
- private static final String SERVICE_NAME_PROPERTY = "serviceName";
- private static final String SERVICE_TYPE_PROPERTY = "serviceType";
- private static final String TARGET_PROPERTY = "target";
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- BeanDefinitionRegistry registry = parserContext.getRegistry();
- String serviceName = element.getAttribute(SERVICE_NAME_ATTRIBUTE);
- BeanDefinition beanDef = createBeanDefinition(element);
- registry.registerBeanDefinition(serviceName, beanDef);
- return beanDef;
- }
-
- private BeanDefinition createBeanDefinition(Element element) {
- RootBeanDefinition beanDefinition = new RootBeanDefinition();
- beanDefinition.setBeanClass(ScaServiceExporter.class);
- MutablePropertyValues props = new MutablePropertyValues();
- props.addPropertyValue(SERVICE_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
- props.addPropertyValue(TARGET_PROPERTY, new RuntimeBeanReference(element.getAttribute(TARGET_ATTRIBUTE)));
- props.addPropertyValue(SERVICE_NAME_PROPERTY, element.getAttribute(SERVICE_NAME_ATTRIBUTE));
- beanDefinition.setPropertyValues(props);
- return beanDefinition;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/intercept/OneWayAdvisor.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/intercept/OneWayAdvisor.java
deleted file mode 100644
index 60bf2a344d..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/intercept/OneWayAdvisor.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.sca.intercept;
-
-import java.lang.reflect.Method;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-import org.springframework.aop.framework.ReflectiveMethodInvocation;
-import org.springframework.aop.support.DefaultPointcutAdvisor;
-import org.springframework.aop.support.StaticMethodMatcherPointcut;
-import org.springframework.core.task.TaskExecutor;
-import org.springframework.sca.metadata.ServiceMetadata;
-
-/**
- * An AOP Alliance MethodInterceptor, rather than AspectJ aspect, as there's no value in typed pointcuts. Oh, if it were
- * only annotations...
- *
- * @author Rod Johnson
- */
-
-public class OneWayAdvisor extends DefaultPointcutAdvisor {
-
- private TaskExecutor taskExecutor;
-
- private final ServiceMetadata smd;
-
- public OneWayAdvisor(final ServiceMetadata aSmd, TaskExecutor taskExecutor) {
- this.smd = aSmd;
- setPointcut(new StaticMethodMatcherPointcut() {
- public boolean matches(Method method, Class targetClass) {
- for (Method m : smd.getOneWayMethods()) {
- if (m.getName().equals(method.getName())) {
- return true;
- }
- }
- return false;
- }
- });
- setAdvice(new OneWayInterceptor());
- this.taskExecutor = taskExecutor;
- }
-
-
- private class OneWayInterceptor implements MethodInterceptor {
- public Object invoke(MethodInvocation mi) throws Throwable {
- try {
- // TODO this is not right
- ReflectiveMethodInvocation rmi = (ReflectiveMethodInvocation) mi;
- final MethodInvocation clone = rmi.invocableClone();
- System.out.println("EXECUTE DEFERRED");
- taskExecutor.execute(new Runnable() {
- public void run() {
- try {
- clone.proceed();
- } catch (Throwable ex) {
- // TODO
- throw new UnsupportedOperationException();
- }
- }
- });
- } catch (Throwable t) {
- t.printStackTrace();
- }
- return null;
- }
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/AnnotationServiceMetadata.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/AnnotationServiceMetadata.java
deleted file mode 100644
index 9a04831ab8..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/AnnotationServiceMetadata.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.sca.metadata;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.osoa.sca.annotations.ComponentName;
-import org.osoa.sca.annotations.OneWay;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Service;
-
-import org.springframework.util.ReflectionUtils;
-
-/**
- * TODO not the way to get this
- *
- * @author Rod Johnson
- */
-public class AnnotationServiceMetadata implements ServiceMetadata {
-
- private final String name;
-
- private final Class<?> serviceClass;
-
- public AnnotationServiceMetadata(String name, Class<?> serviceClass) throws NoSuchServiceException {
- if (!serviceClass.isAnnotationPresent(Service.class)) {
- throw new NoSuchServiceException();
- }
- this.name = name;
- this.serviceClass = serviceClass;
- }
-
- public String getServiceName() {
- return name;
- }
-
- public Class<?>[] getServiceInterfaces() {
- return serviceClass.getAnnotation(Service.class).interfaces();
- }
-
- public List<Method> getOneWayMethods() {
- List<Method> oneWayMethods = new LinkedList<Method>();
- for (Method m : serviceClass.getMethods()) {
- if (m.isAnnotationPresent(OneWay.class)) {
- oneWayMethods.add(m);
- }
- }
-
- // TODO fields
-
- return oneWayMethods;
- }
-
- public List<Injection> getInjections() {
- final List<Injection> injections = new LinkedList<Injection>();
- for (Method m : serviceClass.getMethods()) {
- if (m.isAnnotationPresent(Property.class)) {
- injections.add(new MethodInjection(m));
- }
- }
-
- // TODO fields propertly
-
- ReflectionUtils.doWithFields(serviceClass, new ReflectionUtils.FieldCallback() {
- public void doWith(Field f) throws IllegalArgumentException {
- if (f.isAnnotationPresent(ComponentName.class)) {
- Injection componentNameInjection = new FieldInjection(f);
- componentNameInjection.setLiteralValue(name);
- injections.add(componentNameInjection);
- }
- }
- });
-
- return injections;
- }
-
- // TODO reference
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/BeanFactoryDeploymentMetadata.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/BeanFactoryDeploymentMetadata.java
deleted file mode 100644
index b819ad8f8d..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/BeanFactoryDeploymentMetadata.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.sca.metadata;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanFactoryAware;
-
-/**
- * DeploymentMetadata implementation backed by Spring BeanFactory metadata
- *
- * @author Rod Johnson
- */
-public class BeanFactoryDeploymentMetadata implements BeanFactoryAware, DeploymentMetadata {
-
- private BeanFactory beanFactory;
-
- private Map<String, ServiceMetadata> serviceNameToMetadataMap = new HashMap<String, ServiceMetadata>();
-
- public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
- this.beanFactory = beanFactory;
- }
-
-
- /* (non-Javadoc)
- * @see org.springframework.sca.metadata.DeploymentMetadata#getServiceMetadata(java.lang.String)
- */
- public synchronized ServiceMetadata getServiceMetadata(String serviceName) throws NoSuchServiceException {
- ServiceMetadata sm = serviceNameToMetadataMap.get(serviceName);
- if (sm == null) {
- Class clazz = beanFactory.getType(serviceName);
- sm = new AnnotationServiceMetadata(serviceName, clazz);
- serviceNameToMetadataMap.put(serviceName, sm);
- }
- return sm;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/DeploymentMetadata.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/DeploymentMetadata.java
deleted file mode 100644
index 950e5e3786..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/DeploymentMetadata.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.sca.metadata;
-
-/**
- * Source of ServiceMetadata by name
- *
- * @author Rod Johnson
- */
-public interface DeploymentMetadata {
-
- ServiceMetadata getServiceMetadata(String serviceName) throws NoSuchServiceException;
-
-} \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/FieldInjection.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/FieldInjection.java
deleted file mode 100644
index 3d9f1b6e79..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/FieldInjection.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.sca.metadata;
-
-import java.lang.reflect.Field;
-
-import org.osoa.sca.annotations.Reference;
-
-/**
- * @author Rod Johnson
- */
-public class FieldInjection extends Injection {
-
- private final Field field;
-
- public FieldInjection(Field field, String lookupName) {
- super(lookupName);
- this.field = field;
- }
-
- public FieldInjection(Field field) {
- Reference annotation = field.getAnnotation(Reference.class);
-
- this.field = field;
-
- if (annotation == null) {
- //throw new IllegalArgumentException("Field " + field + " not annotated");
- return;
- }
-
- if ("".equals(annotation.name())) {
- setLookupName(field.getName());
- } else {
- setLookupName(annotation.name());
- }
- }
-
- @Override
- protected void injectValue(Object target, Object value) {
- try {
- if (!field.isAccessible()) {
- field.setAccessible(true);
- }
- field.set(target, value);
- } catch (IllegalArgumentException ex) {
- // TODO
- throw new UnsupportedOperationException();
- } catch (IllegalAccessException ex) {
- // TODO
- ex.printStackTrace();
- throw new UnsupportedOperationException();
- }
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/Injection.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/Injection.java
deleted file mode 100644
index 2e81516d56..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/Injection.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.sca.metadata;
-
-import org.springframework.beans.factory.BeanFactory;
-
-/**
- * @author Rod Johnson
- */
-public abstract class Injection {
-
- private String lookupName;
-
- /**
- * Is it a literal value?
- */
- private boolean literal;
-
- /**
- * Literal value if it's a literal
- */
- private Object literalValue;
-
- protected Injection() {
-
- }
-
- protected Injection(String lookupName) {
- this.lookupName = lookupName;
- }
-
- public Object getLiteralValue() {
- return literalValue;
- }
-
- public void setLiteralValue(Object literalValue) {
- this.literal = true;
- this.literalValue = literalValue;
- }
-
- public boolean isLiteral() {
- return literal;
- }
-
- protected void setLookupName(String lookupName) {
- this.lookupName = lookupName;
- }
-
- public String getLookupName() {
- return lookupName;
- }
-
- public void apply(BeanFactory owner, Object target) {
- Object value = literalValue;
- if (!isLiteral()) {
- value = owner.getBean(lookupName);
- }
- injectValue(target, value);
- }
-
- protected abstract void injectValue(Object target, Object value);
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/MethodInjection.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/MethodInjection.java
deleted file mode 100644
index df01d1428d..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/MethodInjection.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.sca.metadata;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.osoa.sca.annotations.Property;
-
-/**
- * @author Rod Johnson
- */
-public class MethodInjection extends Injection {
-
- private final Method method;
-
- public MethodInjection(Method method, String lookupName) {
- super(lookupName);
- this.method = method;
- }
-
- public MethodInjection(Method method) {
- // TODO reference also
- Property annotation = method.getAnnotation(Property.class);
- if (annotation == null) {
- throw new IllegalArgumentException("Method " + method + " not annotated");
- }
- this.method = method;
- if ("".equals(annotation.name())) {
- setLookupName(method.getName());
- } else {
- setLookupName(annotation.name());
- }
- }
-
- @Override
- protected void injectValue(Object target, Object value) {
- try {
- method.invoke(target, value);
- } catch (IllegalArgumentException ex) {
- // TODO
- throw new UnsupportedOperationException();
- } catch (IllegalAccessException ex) {
- // TODO
- throw new UnsupportedOperationException();
- } catch (InvocationTargetException ex) {
- // TODO
- throw new UnsupportedOperationException();
- }
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/NoSuchServiceException.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/NoSuchServiceException.java
deleted file mode 100644
index b7ffdfeee6..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/NoSuchServiceException.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.sca.metadata;
-
-/**
- * @author Rod Johnson
- */
-public class NoSuchServiceException extends Exception {
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/ServiceMetadata.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/ServiceMetadata.java
deleted file mode 100644
index 5d23c499e4..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/java/org/springframework/sca/metadata/ServiceMetadata.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.sca.metadata;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-/**
- * Metadata for an SCA component.
- *
- * @author Rod Johnson
- */
-public interface ServiceMetadata {
-
- /**
- * Return the service name
- *
- * @return the service name of the component
- */
- String getServiceName();
-
- /**
- * Return the service interfaces implemented by the component
- *
- * @return interfaces implemented by the component
- */
- Class<?>[] getServiceInterfaces();
-
- /**
- * Return a list of OneWay methods
- *
- * @return never returns null
- */
- List<Method> getOneWayMethods();
-
- /**
- * Return a list of SCA injections
- * @return a list of SCA injections. Never returns null.
- */
- List<Injection> getInjections();
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/sca/spring.system.scdl b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/sca/spring.system.scdl
deleted file mode 100644
index cbd7138f0d..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/sca/spring.system.scdl
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- -->
-<!--
- Spring implementation extension configuration for the launcher environment.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
-
- name="org.apache.tuscany.launcher.SpringImplementation">
-
- <component name="spring.implementationLoader">
- <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringImplementationLoader"/>
- </component>
-
- <component name="spring.componentTypeLoader">
- <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringComponentTypeLoader"/>
- </component>
-
- <component name="spring.componentBuilder">
- <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringCompositeBuilder"/>
- </component>
-
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.handlers b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.handlers
deleted file mode 100644
index 689b49e2ae..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.handlers
+++ /dev/null
@@ -1,3 +0,0 @@
-http\://www.springframework.org/schema/sca=org.springframework.sca.config.ScaNamespaceHandler
-
-
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.schemas b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.schemas
deleted file mode 100644
index 33f7004be9..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/META-INF/spring.schemas
+++ /dev/null
@@ -1 +0,0 @@
-http\://www.springframework.org/schema/sca/spring-sca.xsd=org/springframework/sca/xml/spring-sca.xsd
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd b/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
deleted file mode 100644
index b4eeadbb74..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<xsd:schema xmlns="http://www.springframework.org/schema/sca"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- attributeFormDefault="unqualified"
- elementFormDefault="qualified"
- targetNamespace="http://www.springframework.org/schema/sca">
-
- <xsd:element name="composite">
- <xsd:complexType>
- <xsd:attribute name="component" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="sca-adapter-class" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="reference">
- <xsd:complexType>
- <xsd:attribute name="name" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="default" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="property">
- <xsd:complexType>
- <xsd:attribute name="id" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="name" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="service">
- <xsd:complexType>
- <xsd:attribute name="name" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="target" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
-</xsd:schema>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
deleted file mode 100644
index 80b22d6784..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.container.spring;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.container.spring.config.ScaApplicationContext;
-import org.apache.tuscany.container.spring.mock.TestReference;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.sca.ScaServiceExporter;
-import org.springframework.sca.ScaServiceProxyFactoryBean;
-
-/**
- * Tests the SCA extensible schema elements for Spring's XML configuration files
- *
- * @version $$Rev$$ $$Date$$
- */
-
-public class SpringConfigSchemaTestCase extends TestCase {
-
- private ConfigurableApplicationContext applicationContext;
-
- public void setUp() {
- applicationContext =
- new ScaApplicationContext(null,
- new ClassPathResource("org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml"), null);
- }
-
- public void testSCAService() {
- ScaServiceExporter service = (ScaServiceExporter) applicationContext.getBean("fooService");
- // FIXME andyp -- this is not really right.
-// TestBean service = (TestBean) applicationContext.getBean("fooService");
-// assertEquals("call me", service.echo("call me"));
- }
-
- public void testSCAReference() {
- ScaServiceProxyFactoryBean pf = (ScaServiceProxyFactoryBean) applicationContext.getBean("&fooReference");
- assertEquals("fooReference", pf.getReferenceName());
- TestReference ref = (TestReference) applicationContext.getBean("fooReference");
-// assertNotNull(ref);
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
deleted file mode 100644
index 3d07c753de..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.container.spring;
-
-import org.apache.tuscany.spi.QualifiedName;
-import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.builder.Connector;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.extension.ServiceExtension;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.wire.WireService;
-
-import org.apache.tuscany.container.spring.mock.TestBeanImpl;
-import org.apache.tuscany.test.ArtifactFactory;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.context.support.GenericApplicationContext;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-
-public final class SpringTestUtils {
- private SpringTestUtils() {
- }
-
- public static <T> Service createService(String name,
- Class<T> serviceInterface,
- CompositeComponent parent,
- WireService wireService) throws InvalidServiceContractException {
- Service service = new ServiceExtension(name, serviceInterface, parent, wireService);
- InboundWire inboundWire = ArtifactFactory.createInboundWire(name, serviceInterface);
- OutboundWire outboundWire = ArtifactFactory.createOutboundWire(name, serviceInterface);
- ArtifactFactory.terminateWire(outboundWire);
- service.setInboundWire(inboundWire);
- service.setOutboundWire(outboundWire);
- outboundWire.setTargetName(new QualifiedName("foo"));
- Connector connector = ArtifactFactory.createConnector();
- connector.connect(service);
- ArtifactFactory.terminateWire(inboundWire);
- return service;
- }
-
-
- public static GenericApplicationContext createContext() {
- GenericApplicationContext ctx = new GenericApplicationContext();
- BeanDefinition definition = new RootBeanDefinition(TestBeanImpl.class);
- ctx.registerBeanDefinition("foo", definition);
- return ctx;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceInvocationTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceInvocationTestCase.java
deleted file mode 100644
index ff5a564ee8..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceInvocationTestCase.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.apache.tuscany.spi.component.Reference;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.container.spring.mock.TestBean;
-import org.apache.tuscany.container.spring.mock.TestBeanImpl;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import org.springframework.beans.PropertyValue;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.StaticApplicationContext;
-
-/**
- * Verifies wiring from a Spring bean to an SCA composite reference
- *
- * @version $$Rev$$ $$Date$$
- */
-public class ReferenceInvocationTestCase extends TestCase {
-
- public void testInvocation() throws Exception {
- AbstractApplicationContext ctx = createSpringContext();
- SpringCompositeComponent parent = new SpringCompositeComponent("spring", ctx, null, null, null);
- parent.start();
- TestBean referenceTarget = new TestBeanImpl();
- Reference reference = createMock(Reference.class);
- expect(reference.getName()).andReturn("bar").anyTimes();
- expect(reference.isSystem()).andReturn(false).atLeastOnce();
- expect(reference.getInterface()).andStubReturn(TestBean.class);
- expect(reference.getServiceInstance()).andStubReturn(referenceTarget);
- replay(reference);
- parent.register(reference);
- ctx.getBean("foo");
- }
-
- private AbstractApplicationContext createSpringContext() {
- StaticApplicationContext beanFactory = new StaticApplicationContext();
- RootBeanDefinition definition = new RootBeanDefinition(TestBeanImpl.class);
- //REVIEW we need to figure out how to handle eager init components
- definition.setLazyInit(true);
- RuntimeBeanReference ref = new RuntimeBeanReference("bar");
- PropertyValue val = new PropertyValue("bean", ref);
- definition.getPropertyValues().addPropertyValue(val);
- beanFactory.registerBeanDefinition("foo", definition);
- return beanFactory;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ServiceInvocationTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ServiceInvocationTestCase.java
deleted file mode 100644
index 596d9f1181..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ServiceInvocationTestCase.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.apache.tuscany.spi.builder.Connector;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.extension.ServiceExtension;
-import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.wire.InboundInvocationChain;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.QualifiedName;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.container.spring.mock.TestBean;
-import org.apache.tuscany.container.spring.mock.TestBeanImpl;
-import org.apache.tuscany.test.ArtifactFactory;
-import static org.apache.tuscany.test.ArtifactFactory.createWireService;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.StaticApplicationContext;
-
-/**
- * Tests a simple invocation through a service to a Spring bean
- *
- * @version $$Rev$$ $$Date$$
- */
-public class ServiceInvocationTestCase extends TestCase {
-
- public void testInvocation() throws InvalidServiceContractException {
- AbstractApplicationContext springContext = createSpringContext();
- SpringCompositeComponent composite = new SpringCompositeComponent("parent", springContext, null, null, null);
- InboundWire inboundWire = ArtifactFactory.createInboundWire("fooService", TestBean.class);
- OutboundWire outboundWire = ArtifactFactory.createOutboundWire("fooService", TestBean.class);
- outboundWire.setTargetName(new QualifiedName("foo"));
- ArtifactFactory.terminateWire(outboundWire);
- Service service =
- new ServiceExtension("fooService", TestBean.class, composite, createWireService());
- service.setInboundWire(inboundWire);
- service.setOutboundWire(outboundWire);
- Connector connector = ArtifactFactory.createConnector();
- connector.connect(inboundWire, outboundWire, true);
- for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
- chain.setTargetInvoker(composite.createTargetInvoker("foo", chain.getOperation()));
- }
- composite.register(service);
- TestBean serviceInstance = (TestBean) composite.getService("fooService").getServiceInstance();
- assertEquals("bar", serviceInstance.echo("bar"));
- }
-
-
- private AbstractApplicationContext createSpringContext() {
- StaticApplicationContext beanFactory = new StaticApplicationContext();
- RootBeanDefinition definition = new RootBeanDefinition(TestBeanImpl.class);
- definition.setLazyInit(true);
- beanFactory.registerBeanDefinition("foo", definition);
- return beanFactory;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
deleted file mode 100644
index 50ce9a7b75..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.tuscany.spi.builder.BuilderRegistry;
-import org.apache.tuscany.spi.builder.Connector;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.ServiceExtension;
-import org.apache.tuscany.spi.model.BoundServiceDefinition;
-import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.wire.WireService;
-
-import junit.framework.TestCase;
-import static org.apache.tuscany.container.spring.SpringTestUtils.createContext;
-import org.apache.tuscany.container.spring.mock.TestBean;
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.apache.tuscany.container.spring.model.SpringImplementation;
-import org.apache.tuscany.test.ArtifactFactory;
-import org.apache.tuscany.test.binding.TestBinding;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class SpringCompositeBuilderTestCase extends TestCase {
-
- /**
- * Verfies basic build of a spring context
- */
- @SuppressWarnings("unchecked")
- public void testBuild() throws Exception {
- // Create an assembly model consisting of a component implemented by Spring
- SpringImplementation impl = new SpringImplementation(new SpringComponentType(createContext()));
- ComponentDefinition<SpringImplementation> componentDefinition =
- new ComponentDefinition<SpringImplementation>("spring", impl);
-
- // Configure the mock builder registry
- BuilderRegistry registry = createNiceMock(BuilderRegistry.class);
-
- // Test the SpringCompositeBuilder
- SpringCompositeBuilder builder = new SpringCompositeBuilder();
- builder.setBuilderRegistry(registry);
- CompositeComponent parent = createNiceMock(CompositeComponent.class);
- DeploymentContext context = createNiceMock(DeploymentContext.class);
- SpringCompositeComponent component =
- (SpringCompositeComponent) builder.build(parent, componentDefinition, context);
- TestBean bean = (TestBean) component.getApplicationContext().getBean("foo");
- assertEquals("call foo", bean.echo("call foo"));
- }
-
- /**
- * Verifies that the builder calls back into the registry to load services and wires them to bean targets when no
- * <code>sca:service</code> tag is specified in the Spring application.xml
- */
- @SuppressWarnings("unchecked")
- public void testImplicitServiceWiring() throws Exception {
- // Create an assembly model consisting of a component implemented by Spring
- SpringImplementation impl = new SpringImplementation(createComponentType());
- ComponentDefinition<SpringImplementation> componentDefinition =
- new ComponentDefinition<SpringImplementation>("spring", impl);
-
- // Create a service instance that the mock builder registry will return
- WireService wireService = ArtifactFactory.createWireService();
- ServiceExtension serviceContext =
- new ServiceExtension("fooService", TestBean.class, null, wireService);
- InboundWire inboundWire = ArtifactFactory.createInboundWire("fooService", TestBean.class);
- OutboundWire outboundWire = ArtifactFactory.createOutboundWire("fooService", TestBean.class);
- ArtifactFactory.terminateWire(outboundWire);
- serviceContext.setInboundWire(inboundWire);
- serviceContext.setOutboundWire(outboundWire);
- Connector connector = ArtifactFactory.createConnector();
- connector.connect(inboundWire, outboundWire, true);
-
- // Configure the mock builder registry
- BuilderRegistry registry = createMock(BuilderRegistry.class);
- expect(registry.build(isA(CompositeComponent.class),
- isA(BoundServiceDefinition.class),
- isA(DeploymentContext.class))).andStubReturn(serviceContext);
- replay(registry);
-
- // Test the SpringCompositeBuilder
- SpringCompositeBuilder builder = new SpringCompositeBuilder();
- builder.setWireService(wireService);
- builder.setBuilderRegistry(registry);
- CompositeComponent parent = createNiceMock(CompositeComponent.class);
- DeploymentContext context = createNiceMock(DeploymentContext.class);
- CompositeComponent component = (CompositeComponent) builder.build(parent, componentDefinition, context);
- Service service = component.getService("fooService");
- TestBean bean = (TestBean) service.getServiceInstance();
- assertEquals("call foo", bean.echo("call foo"));
- verify(registry);
- }
-
- @SuppressWarnings("unchecked")
- private SpringComponentType createComponentType() {
- SpringComponentType componentType = new SpringComponentType(createContext());
- BoundServiceDefinition<TestBinding> serviceDefinition = new BoundServiceDefinition<TestBinding>();
- serviceDefinition.setName("fooService");
- serviceDefinition.setBinding(new TestBinding());
- try {
- serviceDefinition.setTarget(new URI("foo"));
- } catch (URISyntaxException e) {
- throw new AssertionError();
- }
- componentType.add(serviceDefinition);
- return componentType;
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java
deleted file mode 100644
index f3ac13d030..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponentTestCase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.apache.tuscany.spi.component.Service;
-
-import junit.framework.TestCase;
-import static org.easymock.EasyMock.expect;
-import org.easymock.classextension.EasyMock;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.verify;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.AbstractApplicationContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SpringCompositeComponentTestCase extends TestCase {
-
- public void testAppContextStart() {
- AbstractApplicationContext appContext = EasyMock.createMock(AbstractApplicationContext.class);
- appContext.refresh();
- appContext.setParent(EasyMock.isA(ApplicationContext.class));
- appContext.start();
- replay(appContext);
- SpringCompositeComponent component = new SpringCompositeComponent("spring", appContext, null, null, null);
- component.start();
- verify(appContext);
- }
-
- public void testChildStart() {
- AbstractApplicationContext appContext = EasyMock.createNiceMock(AbstractApplicationContext.class);
- replay(appContext);
- Service service = EasyMock.createMock(Service.class);
- EasyMock.expect(service.getName()).andReturn("foo").anyTimes();
- service.start();
- service.getInterface();
- EasyMock.expectLastCall().andReturn(Object.class);
- expect(service.isSystem()).andReturn(false).atLeastOnce();
- replay(service);
- SpringCompositeComponent component = new SpringCompositeComponent("spring", appContext, null, null, null);
- component.register(service);
- component.start();
- verify(service);
- }
-
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java
deleted file mode 100644
index b110852a54..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringInvocationTestCase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.container.spring.impl;
-
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.MessageImpl;
-
-import junit.framework.TestCase;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import org.springframework.context.ApplicationContext;
-
-/**
- * Verifies a simple invocation on a Spring bean
- *
- * @version $$Rev$$ $$Date$$
- */
-public class SpringInvocationTestCase extends TestCase {
-
- /**
- * Verifies the invoker can resolve a bean in an application context and call a method l
- */
- public void testInvocation() throws Exception {
- TestBean bean = createMock(TestBean.class);
- bean.test("bar");
- expectLastCall();
- replay(bean);
- ApplicationContext context = createMock(ApplicationContext.class);
- expect(context.getBean("foo")).andReturn(bean);
- replay(context);
- SpringInvoker invoker = new SpringInvoker("foo", TestBean.class.getMethod("test", String.class), context);
- Message msg = new MessageImpl();
- msg.setBody(new String[]{"bar"});
- invoker.invoke(msg);
- verify(context);
- verify(bean);
- }
-
-
- private interface TestBean {
- void test(String msg);
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/integration/BootstrapTestCase.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/integration/BootstrapTestCase.java
deleted file mode 100644
index c5758cb2ac..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/integration/BootstrapTestCase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.container.spring.integration;
-
-import org.osoa.sca.CompositeContext;
-import org.osoa.sca.CurrentCompositeContext;
-
-import org.apache.tuscany.spi.component.Service;
-
-import org.apache.tuscany.container.spring.impl.SpringCompositeComponent;
-import org.apache.tuscany.container.spring.mock.TestBean;
-import org.apache.tuscany.test.Bootstrapper;
-
-/**
- * Bootstraps a simple scenario where a service can invoke a Spring bean. This test case is intended to be temporary and
- * replaced when the SPI test harness is finished.
- * <p/>
- * <bold>PLEASE DO NOT EMULATE</bold>
- *
- * @version $Rev$ $Date$
- */
-public class BootstrapTestCase extends Bootstrapper {
-
- private CompositeContext context;
-
- public void testDemoBoot() {
- SpringCompositeComponent comp = (SpringCompositeComponent) component.getChild("Spring");
- Service service = (Service) comp.getChild("fooService");
- TestBean bean = (TestBean) service.getServiceInstance();
- bean.echo("foo");
- bean.getBean().echo("foo");
- }
-
- protected void setUp() throws Exception {
- addExtension("spring.extension", getClass().getClassLoader().getResource("META-INF/sca/spring.system.scdl"));
- super.setUp();
- context = CurrentCompositeContext.getContext();
- }
-
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java
deleted file mode 100644
index 1c768e53cc..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBean.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.container.spring.mock;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public interface TestBean {
- String echo(String msg);
-
- TestBean getBean();
-
- void setBean(TestBean bean);
-
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java
deleted file mode 100644
index db04d8bcad..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestBeanImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.container.spring.mock;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class TestBeanImpl implements TestBean {
-
- private TestBean bean;
-
- public TestBeanImpl() {
- }
-
- public String echo(String msg) {
- return msg;
- }
-
- public TestBean getBean() {
- return bean;
- }
-
- public void setBean(TestBean bean) {
- this.bean = bean;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java
deleted file mode 100644
index 7d1a519be6..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/mock/TestReference.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.container.spring.mock;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public interface TestReference {
- String echo(String msg);
-}
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml
deleted file mode 100644
index 6ccd3963a9..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/application-context.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sca="http://www.springframework.org/schema/sca"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
-
- <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl" lazy-init="true">
- <property name="bean" ref="testReference"/>
- </bean>
- <!-- <sca:reference name="testReference" type="org.apache.tuscany.container.spring.mock.TestReference"/> -->
-
-</beans>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/default.scdl b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/default.scdl
deleted file mode 100644
index 0b2c92c667..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/META-INF/sca/default.scdl
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- -->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- name="spring.test">
-
- <component name="Spring">
- <implementation.spring location="META-INF/sca/application-context.xml">
- <service name="fooService">
- <binding.test/>
- <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
- <reference>testBean</reference>
- </service>
- <reference name="testReference">
- <interface.java class="org.apache.tuscany.container.spring.mock.TestBean"/>
- <binding.test/>
- </reference>
- </implementation.spring>
- </component>
-
-</composite>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
deleted file mode 100644
index 211211511b..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/ExplicitSpring.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sca="http://www.springframework.org/schema/sca"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
-
- <sca:service name="fooBean" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
-
- <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
- </bean>
-
-</beans>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
deleted file mode 100644
index 96a3e1ed46..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/org/apache/tuscany/container/spring/SpringConfigSchemaTest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sca="http://www.springframework.org/schema/sca"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
-
- <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
- </bean>
-
- <sca:service name="fooService" type="org.apache.tuscany.container.spring.mock.TestBean" target="testBean"/>
-
- <sca:reference name="fooReference" type="org.apache.tuscany.container.spring.mock.TestReference"/>
-
-
-</beans>
diff --git a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/test.xml b/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/test.xml
deleted file mode 100644
index d438b88577..0000000000
--- a/branches/sca-java-M2/sca/services/containers/container.spring/src/test/resources/test.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sca="http://www.springframework.org/schema/sca"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
-
- <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
-
-</beans>