diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 22:48:13 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 22:48:13 +0000 |
commit | 90ba7b1a18706b434520d531358619438a43b4f0 (patch) | |
tree | 4c571d7829da8a0df07368ac51292bc07db5526e /java/sca/modules/implementation-java/src/main/java/org/apache/tuscany | |
parent | 40ddf83655bc926c1babc72ba36a1c658eadb516 (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-java/src/main/java/org/apache/tuscany')
4 files changed, 33 insertions, 28 deletions
diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java index db2d3efe56..d3c9c16f48 100644 --- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java +++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.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.java; @@ -26,13 +26,15 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import javax.xml.namespace.QName; + /** * Represents a Java implementation. * * @version $Rev$ $Date$ */ public interface JavaImplementation extends BaseJavaImplementation { - + QName TYPE = new QName(SCA11_NS, "implementation.java"); /** * Returns the constructor used to instantiate implementation instances. * diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java index 97773879fa..3351ee85c0 100644 --- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java +++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java @@ -6,32 +6,35 @@ * 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.java.impl; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation; /** * Represents a Java implementation. - * + * * @version $Rev$ $Date$ */ abstract class BaseJavaImplementationImpl extends ImplementationImpl implements BaseJavaImplementation { private String className; private Class<?> javaClass; - - protected BaseJavaImplementationImpl() { + + protected BaseJavaImplementationImpl(QName type) { + super(type); } public String getName() { @@ -71,7 +74,7 @@ abstract class BaseJavaImplementationImpl extends ImplementationImpl implements public int hashCode() { return String.valueOf(getName()).hashCode(); } - + @Override public boolean equals(Object obj) { if (obj == this) { diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java index 43a074e0ec..9e4c2eb8f4 100644 --- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java +++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.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.java.impl; @@ -54,10 +54,10 @@ public class JavaImplementationImpl extends BaseJavaImplementationImpl implement private long maxAge = -1; private long maxIdleTime = -1; private JavaScopeImpl scope = JavaScopeImpl.STATELESS; - + protected JavaImplementationImpl() { - super(); - } + super(TYPE); + } public JavaConstructorImpl<?> getConstructor() { return constructorDefinition; @@ -106,7 +106,7 @@ public class JavaImplementationImpl extends BaseJavaImplementationImpl implement public List<Method> getAllowsPassByReferenceMethods() { return allowsPassByReferenceMethods; } - + public boolean isAllowsPassByReference(Method method) { return allowsPassByReference || allowsPassByReferenceMethods.contains(method); } diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java index c325c871f4..4f74094a1f 100644 --- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java +++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.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.java.xml; @@ -84,7 +84,7 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm /** * Report a error. - * + * * @param problems * @param message * @param model @@ -104,7 +104,7 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm /** * Report a exception. - * + * * @param problems * @param message * @param model @@ -130,7 +130,7 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm ExtensionType implType = policyFactory.createImplementationType(); implType.setType(getArtifactType()); implType.setUnresolved(true); - javaImplementation.setType(implType); + javaImplementation.setExtensionType(implType); javaImplementation.setUnresolved(true); javaImplementation.setName(reader.getAttributeValue(null, CLASS)); @@ -176,9 +176,9 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm //throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName())); return; } - + javaImplementation.setJavaClass(javaClass); - + try { javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass()); } catch (IntrospectionException e) { @@ -187,10 +187,10 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm //throw ce; return; } - + javaImplementation.setUnresolved(false); mergeComponentType(resolver, javaImplementation); - + // FIXME the introspector should always create at least one service if (javaImplementation.getServices().isEmpty()) { javaImplementation.getServices().add(assemblyFactory.createService()); |