summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/interface/src/main/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-26 23:44:59 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-26 23:44:59 +0000
commit71a7cba384b8ae7f4578fb9ab1f725d5ce616074 (patch)
tree98bbc7c066d037a8d9ea1fea7a3ccfa64419ab11 /branches/sca-java-1.x/modules/interface/src/main/java
parent01a38d872dc2692d2a31f07f9c8f8098aa078853 (diff)
Merge all changes from 1.5.2 branch into trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830026 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/interface/src/main/java')
-rw-r--r--branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java33
-rw-r--r--branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java5
2 files changed, 19 insertions, 19 deletions
diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
index 8fa91a8e52..2065940c8d 100644
--- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
+++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.sca.interfacedef.impl;
+import java.lang.ref.WeakReference;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -43,8 +44,8 @@ import org.apache.tuscany.sca.interfacedef.DataType;
*/
public class DataTypeImpl<L> implements DataType<L> {
private String dataBinding;
- private Class<?> physical;
- private Type genericType;
+ private WeakReference<Class<?>> physical;
+ private WeakReference<Type> genericType;
private L logical;
private Map<Class<?>, Object> metaDataMap;
@@ -77,8 +78,8 @@ public class DataTypeImpl<L> implements DataType<L> {
public DataTypeImpl(String dataBinding, Class<?> physical, Type genericType, L logical) {
super();
this.dataBinding = dataBinding;
- this.physical = physical;
- this.genericType = genericType;
+ this.physical = new WeakReference<Class<?>>(physical);
+ this.genericType = new WeakReference<Type>(genericType);
this.logical = logical;
}
@@ -88,14 +89,14 @@ public class DataTypeImpl<L> implements DataType<L> {
* @return the physical type used by the runtime
*/
public Class<?> getPhysical() {
- return physical;
+ return physical.get();
}
/**
* @param physical the physical to set
*/
public void setPhysical(Class<?> physical) {
- this.physical = physical;
+ this.physical = new WeakReference<Class<?>>(physical);
}
/**
@@ -103,7 +104,7 @@ public class DataTypeImpl<L> implements DataType<L> {
* @return The java generic type
*/
public Type getGenericType() {
- return genericType;
+ return genericType.get();
}
/**
@@ -111,7 +112,7 @@ public class DataTypeImpl<L> implements DataType<L> {
* @param genericType
*/
public void setGenericType(Type genericType) {
- this.genericType = genericType;
+ this.genericType = new WeakReference<Type>(genericType);
}
/**
@@ -161,9 +162,9 @@ public class DataTypeImpl<L> implements DataType<L> {
final int prime = 31;
int result = 1;
result = prime * result + ((dataBinding == null) ? 0 : dataBinding.hashCode());
- result = prime * result + ((genericType == null) ? 0 : genericType.hashCode());
+ result = prime * result + ((genericType == null || genericType.get() == null) ? 0 : genericType.get().hashCode());
result = prime * result + ((logical == null) ? 0 : logical.hashCode());
- result = prime * result + ((physical == null) ? 0 : physical.hashCode());
+ result = prime * result + ((physical == null || physical.get() == null) ? 0 : physical.get().hashCode());
return result;
}
@@ -181,20 +182,20 @@ public class DataTypeImpl<L> implements DataType<L> {
return false;
} else if (!dataBinding.equals(other.dataBinding))
return false;
- if (genericType == null) {
+ if (genericType == null || genericType.get() == null) {
if (other.genericType != null)
return false;
- } else if (!genericType.equals(other.genericType))
+ } else if (!genericType.get().equals(other.genericType.get()))
return false;
if (logical == null) {
if (other.logical != null)
return false;
} else if (!logical.equals(other.logical))
return false;
- if (physical == null) {
+ if (physical == null || physical.get() == null) {
if (other.physical != null)
return false;
- } else if (!physical.equals(other.physical))
+ } else if (!physical.get().equals(other.physical.get()))
return false;
return true;
}
@@ -219,8 +220,8 @@ public class DataTypeImpl<L> implements DataType<L> {
StringBuilder b = new StringBuilder( 256 );
b.append( "DataType[" );
b.append( "dataBinding=" + ((dataBinding==null) ? "null" : dataBinding) );
- b.append( ", genericType=" + ((genericType==null) ? "null" : genericType) );
- b.append( ", physical=" + ((physical==null) ? "null" : physical) );
+ b.append( ", genericType=" + ((genericType==null || genericType.get()==null) ? "null" : genericType.get()) );
+ b.append( ", physical=" + ((physical==null || physical.get()==null) ? "null" : physical.get()) );
b.append( ", logical=" + ((logical==null) ? "null" : logical) );
b.append( ", metaData size=" + ((metaDataMap==null) ? "0" : metaDataMap.size()) );
b.append( "]" );
diff --git a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
index 149e6306e5..9aeeafe6b9 100644
--- a/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
+++ b/branches/sca-java-1.x/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
@@ -209,8 +209,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
}
for (Operation operation : source.getCallbackInterface().getOperations()) {
- Operation targetOperation =
- getOperation(target.getCallbackInterface().getOperations(), operation.getName());
+ Operation targetOperation = map(target.getCallbackInterface(), operation);
if (targetOperation == null) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Callback operation not found on target", source,
@@ -221,7 +220,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
}
if (!source.getCallbackInterface().isRemotable()) {
// FIXME: for remotable operation, only compare name for now
- if (!operation.equals(targetOperation)) {
+ if (!isCompatible(operation, targetOperation, false)) {
if (!silent) {
throw new IncompatibleInterfaceContractException("Target callback operation is not compatible",
source, target, operation, targetOperation);