summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-05-02 06:18:19 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-05-02 06:18:19 +0000
commit3ca8a1eec06e82a603c03e1d2aaca4669d7d78ed (patch)
treed5f1f5ccd8a2d0564e77b4c0dbbf201580c38557
parent62bbc88103ff9b26a2b88ccffeda0dba2294aa66 (diff)
Get the spring reference and property annotations going
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@770894 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java35
-rw-r--r--java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java47
-rw-r--r--java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java5
3 files changed, 84 insertions, 3 deletions
diff --git a/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
new file mode 100644
index 0000000000..58dd94f657
--- /dev/null
+++ b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class ComponentTie {
+
+ private RuntimeComponent component;
+
+ public ComponentTie(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ public Object getService(Class<?> type, String name) {
+ return component.getComponentContext().getService(type, name);
+ }
+}
diff --git a/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
new file mode 100644
index 0000000000..09a53267d7
--- /dev/null
+++ b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class PropertyValueTie {
+
+ private RuntimeComponent component;
+ private JavaPropertyValueObjectFactory propertyFactory;
+
+ public PropertyValueTie(RuntimeComponent component, JavaPropertyValueObjectFactory propertyFactory) {
+ this.component = component;
+ this.propertyFactory = propertyFactory;
+ }
+
+ public Object getPropertyObj(Class<?> type, String name) {
+ List<ComponentProperty> props = component.getProperties();
+ for (ComponentProperty prop : props) {
+ if (prop.getName().equals(name)) {
+ return propertyFactory.createValueFactory(prop, prop.getValue(), type).getInstance();
+ }
+ }
+ return null; // property name not found
+ }
+}
diff --git a/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
index cf98440903..ac913fdee2 100644
--- a/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
+++ b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
@@ -134,11 +134,10 @@ public class SpringImplementationTie {
} // end method getBean( String, Class )
public Object getComponentTie() {
- return new ComponentTie();
+ return new ComponentTie(component);
}
-
public Object getPropertyValueTie() {
- return new PropertyValueTie();
+ return new PropertyValueTie(component, propertyFactory);
}
}