djencks 2005/04/19 21:47:37
Modified: modules/core/src/java/org/openejb/corba/transaction
AbstractServerTransactionPolicyConfig.java
MappedServerTransactionPolicyConfig.java
ServerTransactionInterceptor.java
Log:
bug fixes and cleanup of tx interop
Revision Changes Path
1.3 +7 -5
openejb/modules/core/src/java/org/openejb/corba/transaction/AbstractServerTransactionPolicyConfig.java
Index: AbstractServerTransactionPolicyConfig.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/transaction/AbstractServerTransactionPolicyConfig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractServerTransactionPolicyConfig.java 27 Mar 2005 02:04:42
-0000 1.2
+++ AbstractServerTransactionPolicyConfig.java 20 Apr 2005 01:47:37
-0000 1.3
@@ -17,15 +17,15 @@
package org.openejb.corba.transaction;
import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.INTERNAL;
import org.omg.CORBA.SystemException;
-import org.omg.CORBA.BAD_PARAM;
import org.omg.IOP.Codec;
import org.omg.IOP.CodecPackage.FormatMismatch;
+import org.omg.IOP.CodecPackage.TypeMismatch;
import org.omg.IOP.ServiceContext;
import org.omg.IOP.TransactionService;
import org.omg.PortableInterceptor.ServerRequestInfo;
-
import org.openejb.corba.idl.CosTransactions.PropagationContext;
import org.openejb.corba.idl.CosTransactions.PropagationContextHelper;
import org.openejb.corba.util.Util;
@@ -35,6 +35,7 @@
* @version $Rev: $ $Date$
*/
public abstract class AbstractServerTransactionPolicyConfig implements
ServerTransactionPolicyConfig {
+
public void importTransaction(ServerRequestInfo serverRequestInfo)
throws SystemException {
ServiceContext serviceContext = null;
try {
@@ -50,9 +51,11 @@
Codec codec = Util.getCodec();
Any any;
try {
- any = codec.decode(encoded);
+ any = codec.decode_value(encoded,
PropagationContextHelper.type());
} catch (FormatMismatch formatMismatch) {
throw (INTERNAL) new INTERNAL("Could not decode encoded
propagation context").initCause(formatMismatch);
+ } catch (TypeMismatch typeMismatch) {
+ throw (INTERNAL) new INTERNAL("Could not decode encoded
propagation context").initCause(typeMismatch);
}
propagationContext = PropagationContextHelper.extract(any);
}
@@ -63,6 +66,5 @@
}
protected abstract void importTransaction(String operation,
PropagationContext propagationContext) throws SystemException;
-
}
1.2 +8 -9
openejb/modules/core/src/java/org/openejb/corba/transaction/MappedServerTransactionPolicyConfig.java
Index: MappedServerTransactionPolicyConfig.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/transaction/MappedServerTransactionPolicyConfig.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MappedServerTransactionPolicyConfig.java 15 Mar 2005 05:27:04 -0000
1.1
+++ MappedServerTransactionPolicyConfig.java 20 Apr 2005 01:47:37 -0000
1.2
@@ -18,29 +18,28 @@
import java.util.Map;
-import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.SystemException;
import org.openejb.corba.idl.CosTransactions.PropagationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* @version $Rev: $ $Date$
*/
public class MappedServerTransactionPolicyConfig extends
AbstractServerTransactionPolicyConfig {
+ private static Log log =
LogFactory.getLog(MappedServerTransactionPolicyConfig.class);
private final Map operationToPolicyMap;
public MappedServerTransactionPolicyConfig(Map operationToPolicyMap) {
this.operationToPolicyMap = operationToPolicyMap;
}
protected void importTransaction(String operation, PropagationContext
propagationContext) throws SystemException {
- //TODO TOTAL HACK WARNING FIXME!!
- int pos = operation.indexOf("__");
- if (pos > -1) {
- operation = operation.substring(0, pos);
- }
-
OperationTxPolicy operationTxPolicy = (OperationTxPolicy)
operationToPolicyMap.get(operation);
if (operationTxPolicy == null) {
- throw new BAD_OPERATION("Operation " + operation + " not
recognized, no tx mapping");
+ //TODO figure out if there is some way to detect if the method
should be mapped or shouldn't
+ //e.g. _is_a shows up but should not be mapped.
+ log.info("No tx mapping for operation: " + operation);
+ return;
}
operationTxPolicy.importTransaction(propagationContext);
}
1.5 +3 -5
openejb/modules/core/src/java/org/openejb/corba/transaction/ServerTransactionInterceptor.java
Index: ServerTransactionInterceptor.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/transaction/ServerTransactionInterceptor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ServerTransactionInterceptor.java 20 Mar 2005 04:52:33 -0000 1.4
+++ ServerTransactionInterceptor.java 20 Apr 2005 01:47:37 -0000 1.5
@@ -50,18 +50,16 @@
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.PortableInterceptor.ServerRequestInterceptor;
-
/**
* @version $Revision$ $Date$
*/
class ServerTransactionInterceptor extends LocalObject implements
ServerRequestInterceptor {
-
public ServerTransactionInterceptor() {
}
public void receive_request(ServerRequestInfo serverRequestInfo) throws
ForwardRequest {
- ServerTransactionPolicy policy = (ServerTransactionPolicy)
serverRequestInfo.get_server_policy(ServerTransactionPolicyFactory.POLICY_TYPE);
+ ServerTransactionPolicy policy = (ServerTransactionPolicy)
serverRequestInfo.get_server_policy(ServerTransactionPolicyFactory.POLICY_TYPE);
if (policy == null) {
throw new INTERNAL("No transaction policy configured");
}