summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-spring
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-06-23 22:48:13 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-06-23 22:48:13 +0000
commit90ba7b1a18706b434520d531358619438a43b4f0 (patch)
tree4c571d7829da8a0df07368ac51292bc07db5526e /java/sca/modules/implementation-spring
parent40ddf83655bc926c1babc72ba36a1c658eadb516 (diff)
Add a QName as the type for binding/implementation and use it to compare model types instead of class
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@787865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-spring')
-rw-r--r--java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
index 24e78b9291..72ad5adb61 100644
--- a/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
+++ b/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.implementation.spring;
@@ -22,6 +22,8 @@ import java.net.URL;
import java.util.Hashtable;
import java.util.List;
+import javax.xml.namespace.QName;
+
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentType;
import org.apache.tuscany.sca.assembly.Extensible;
@@ -34,13 +36,14 @@ import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
/**
- * Represents a Spring implementation.
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ * Represents a Spring implementation.
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
*/
public class SpringImplementation extends ImplementationImpl implements Implementation, ComponentPreProcessor, Extensible {
-
+ private final static QName TYPE = new QName(SCA11_NS, "implementation.spring");
// The location attribute which points to the Spring application-context XML file
private String location;
// The application-context file as a Spring Resource
@@ -54,6 +57,7 @@ public class SpringImplementation extends ImplementationImpl implements Implemen
private Hashtable<String, Reference> unresolvedBeanRef;
public SpringImplementation() {
+ super(TYPE);
this.location = null;
this.resource = null;
setUnresolved(true);
@@ -84,8 +88,8 @@ public class SpringImplementation extends ImplementationImpl implements Implemen
return resource;
}
- /*
- * Returns the componentType for this Spring implementation
+ /*
+ * Returns the componentType for this Spring implementation
*/
public ComponentType getComponentType() {
return componentType;
@@ -145,35 +149,35 @@ public class SpringImplementation extends ImplementationImpl implements Implemen
} // end method setPropertyClass
/**
- * Gets the Java Class for an SCA property
+ * Gets the Java Class for an SCA property
* @param propertyName - the property name
* @return - a Class object for the type of the property
*/
public Class<?> getPropertyClass(String propertyName) {
return propertyMap.get(propertyName);
} // end method getPropertyClass
-
+
public void setUnresolvedBeanRef(String refName, Reference reference) {
if (refName == null || reference == null)
return;
unresolvedBeanRef.put(refName, reference);
return;
} // end method setUnresolvedBeanRef
-
+
public Reference getUnresolvedBeanRef(String refName) {
return unresolvedBeanRef.get(refName);
} // end method getUnresolvedBeanRef
-
-
+
+
/**
- * Use preProcess to validate and map the references and properties dynamically
+ * Use preProcess to validate and map the references and properties dynamically
*/
public void preProcess(Component component) {
if (!(component instanceof RuntimeComponent))
return;
-
+
RuntimeComponent rtc = (RuntimeComponent) component;
-
+
for (Reference reference : rtc.getReferences()) {
if (unresolvedBeanRef.containsKey(reference.getName())) {
Reference ref = unresolvedBeanRef.get(reference.getName());
@@ -184,14 +188,14 @@ public class SpringImplementation extends ImplementationImpl implements Implemen
}
for (Property property : rtc.getProperties()) {
- if (unresolvedBeanRef.containsKey(property.getName())) {
+ if (unresolvedBeanRef.containsKey(property.getName())) {
componentType.getProperties().add(createProperty(property));
this.setPropertyClass(property.getName(), property.getClass());
unresolvedBeanRef.remove(property.getName());
}
- }
+ }
}
-
+
protected Reference createReference(Reference reference, InterfaceContract interfaze) {
Reference newReference;
try {
@@ -203,7 +207,7 @@ public class SpringImplementation extends ImplementationImpl implements Implemen
}
return newReference;
}
-
+
protected Property createProperty(Property property) {
Property newProperty;
try {