Author: antelder
Date: Sat May 2 06:18:19 2009
New Revision: 770894
URL: http://svn.apache.org/viewvc?rev=770894&view=rev
Log:
Get the spring reference and property annotations going
Added:
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
Modified:
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
Added:
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java?rev=770894&view=auto
==============================================================================
---
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
(added)
+++
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
Sat May 2 06:18:19 2009
@@ -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);
+ }
+}
Added:
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java?rev=770894&view=auto
==============================================================================
---
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
(added)
+++
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
Sat May 2 06:18:19 2009
@@ -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
+ }
+}
Modified:
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java?rev=770894&r1=770893&r2=770894&view=diff
==============================================================================
---
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
(original)
+++
tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
Sat May 2 06:18:19 2009
@@ -134,11 +134,10 @@
} // 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);
}
}