Author: kelvingoodson
Date: Wed Jul 21 17:30:04 2010
New Revision: 966324
URL: http://svn.apache.org/viewvc?rev=966324&view=rev
Log:
make the interface matching audit trail more useful in problem determination
-- not sure if util package is a good place for this Audit class, but OK to
start with -- would have just specialized StringBuffer if it hadn't been final
:(
Added:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java
(with props)
Modified:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
Modified:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java?rev=966324&r1=966323&r2=966324&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
Wed Jul 21 17:30:04 2010
@@ -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);
-
+
}
Modified:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java?rev=966324&r1=966323&r2=966324&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
Wed Jul 21 17:30:04 2010
@@ -33,6 +33,7 @@ import org.apache.tuscany.sca.interfaced
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
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
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
*/
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
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
}
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
* 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
return null;
}
}
+
/**
* In various places in the process of an SCA application we match one
interface against
Added:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java?rev=966324&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java
(added)
+++
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java
Wed Jul 21 17:30:04 2010
@@ -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();
+ }
+}
Propchange:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java
------------------------------------------------------------------------------
svn:keywords = Rev Date