diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules')
3 files changed, 52 insertions, 9 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java index 930d4e22e5..94bce6d6b4 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java @@ -19,6 +19,8 @@ package org.apache.tuscany.sca.interfacedef; +import org.apache.tuscany.sca.interfacedef.util.Audit; + /** * The InterfaceContractMapper is responsible to match interfaces * @@ -57,7 +59,7 @@ public interface InterfaceContractMapper { Compatibility compatibility, boolean ignoreCallback, boolean silent, - StringBuffer audit) throws IncompatibleInterfaceContractException; + Audit audit) throws IncompatibleInterfaceContractException; /** * Test if the source data type is compatible with the target data type. The @@ -177,7 +179,7 @@ public interface InterfaceContractMapper { * the variant of isCompatibleSubset with the audit parameter is intended to supersed the other * -- the presence of both indicates a partial development state */ - boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, StringBuffer audit); + boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, Audit audit); /** * Check that two interfaces are mutually compatible. The interfaces are mutually compatible if the two @@ -226,5 +228,5 @@ public interface InterfaceContractMapper { * @return A compatible operation if the target interface is compatible superset of the source interface */ Operation map(Interface target, Operation source); - + } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java index eca4cde843..f0f46dd41e 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java @@ -33,6 +33,7 @@ import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.util.Audit; import org.apache.tuscany.sca.interfacedef.util.XMLType; import org.apache.tuscany.sca.policy.ExtensionType; @@ -54,7 +55,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return isCompatible(source, target, passByValue, null); } - public boolean isCompatible(DataType source, DataType target, boolean passByValue, StringBuffer audit) { + public boolean isCompatible(DataType source, DataType target, boolean passByValue, Audit audit) { if (source == target) { return true; } @@ -199,7 +200,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return isCompatible(source, target, compatibilityType, true, null); } - public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType, boolean byValue, StringBuffer audit) { + public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType, boolean byValue, Audit audit) { if (source == target) { return true; } @@ -345,7 +346,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { */ public boolean checkCompatibility(InterfaceContract source, InterfaceContract target, Compatibility compatibility, - boolean ignoreCallback, boolean silent, StringBuffer audit) + boolean ignoreCallback, boolean silent, Audit audit) throws IncompatibleInterfaceContractException { if (source == target) { @@ -397,7 +398,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { if (!silent) { if (audit == null) - audit = new StringBuffer(); + audit = new Audit(); if (!isCompatible(operation, targetOperation, Compatibility.SUBSET, true, audit)) { throw new IncompatibleInterfaceContractException( @@ -466,7 +467,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } if (!silent) { - StringBuffer audit = new StringBuffer(); + Audit audit = new Audit(); if (!isCompatible(operation, targetOperation, Compatibility.SUBSET, true, audit)){ throw new IncompatibleInterfaceContractException("Operations called " + operation.getName() + @@ -559,7 +560,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { * the variant of isCompatibleSubset with the audit parameter is intended to supersede the other * -- the presence of both indicates a partial development state */ - public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, StringBuffer audit) { + public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, Audit audit) { try { return checkCompatibility(source, target, Compatibility.SUBSET, false, false, audit); @@ -601,6 +602,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return null; } } + /** * In various places in the process of an SCA application we match one interface against diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java new file mode 100644 index 0000000000..0830860409 --- /dev/null +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java @@ -0,0 +1,39 @@ +/* + * 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.interfacedef.util; + + +/* + * utility to allow building up an audit trail in case reporting is necessary later + * + */ +public class Audit { + private StringBuffer buf; + + public Audit() { + this.buf = new StringBuffer(); + } + public void append(String str) { + buf.append("||| " + str); + } + public String toString() { + return buf.toString(); + } +} |