maguro 2005/03/26 21:04:42
Modified: modules/core/src/java/org/openejb/corba/transaction
AbstractServerTransactionPolicyConfig.java
ClientTransactionInterceptor.java
IORTransactionInterceptor.java
Log:
Updated to use the default Sun ORB.
Revision Changes Path
1.2 +10 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractServerTransactionPolicyConfig.java 15 Mar 2005 05:27:04
-0000 1.1
+++ AbstractServerTransactionPolicyConfig.java 27 Mar 2005 02:04:42
-0000 1.2
@@ -19,21 +19,29 @@
import org.omg.CORBA.Any;
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.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;
+
/**
* @version $Rev: $ $Date$
*/
public abstract class AbstractServerTransactionPolicyConfig implements
ServerTransactionPolicyConfig {
public void importTransaction(ServerRequestInfo serverRequestInfo)
throws SystemException {
- ServiceContext serviceContext =
serverRequestInfo.get_request_service_context(TransactionService.value);
+ ServiceContext serviceContext = null;
+ try {
+ serviceContext =
serverRequestInfo.get_request_service_context(TransactionService.value);
+ } catch (BAD_PARAM e) {
+ // do nothing
+ }
PropagationContext propagationContext;
if (serviceContext == null) {
propagationContext = null;
1.6 +14 -18
openejb/modules/core/src/java/org/openejb/corba/transaction/ClientTransactionInterceptor.java
Index: ClientTransactionInterceptor.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/transaction/ClientTransactionInterceptor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ClientTransactionInterceptor.java 20 Mar 2005 23:13:32 -0000 1.5
+++ ClientTransactionInterceptor.java 27 Mar 2005 02:04:42 -0000 1.6
@@ -49,7 +49,6 @@
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.INV_POLICY;
import org.omg.CORBA.LocalObject;
import org.omg.IOP.CodecPackage.FormatMismatch;
import org.omg.IOP.CodecPackage.TypeMismatch;
@@ -58,10 +57,12 @@
import org.omg.PortableInterceptor.ClientRequestInterceptor;
import org.omg.PortableInterceptor.ForwardRequest;
+import org.openejb.corba.ClientContextManager;
import org.openejb.corba.idl.CosTSInteroperation.TAG_OTS_POLICY;
import org.openejb.corba.idl.CosTransactions.ADAPTS;
import org.openejb.corba.idl.CosTransactions.OTSPolicyValueHelper;
import org.openejb.corba.util.Util;
+import org.openejb.corba.util.TypeCode;
/**
@@ -94,11 +95,7 @@
taggedComponent =
ri.get_effective_component(TAG_OTS_POLICY.value);
} catch (BAD_PARAM e) {
- if ((e.minor & 25) == 25) {
- //tagged component missing
- return;
- }
- throw e;
+ return;
}
if (log.isDebugEnabled()) log.debug("Target has a transaction
policy");
@@ -106,23 +103,22 @@
byte[] data = taggedComponent.component_data;
Any any = null;
try {
- any = Util.getCodec().decode_value(data,
OTSPolicyValueHelper.type());
+ any = Util.getCodec().decode_value(data, TypeCode.SHORT);
} catch (FormatMismatch formatMismatch) {
- log.error("Mismatched format");
+ log.error("Mismatched format", formatMismatch);
throw (INTERNAL) new INTERNAL("Mismatched
format").initCause(formatMismatch);
} catch (TypeMismatch typeMismatch) {
- log.error("Type mismatch");
+ log.error("Type mismatch", typeMismatch);
throw (INTERNAL) new INTERNAL("Type
mismatch").initCause(typeMismatch);
}
+
short value = OTSPolicyValueHelper.extract(any);
if (value == ADAPTS.value) {
- ClientTransactionPolicy policy = null;
- try {
- policy = (ClientTransactionPolicy)
ri.get_request_policy(ClientTransactionPolicyFactory.POLICY_TYPE);
- } catch (INV_POLICY e) {
- throw new INTERNAL("No transaction policy configured");
- }
- ClientTransactionPolicyConfig clientTransactionPolicyConfig =
policy.getClientTransactionPolicyConfig();
+ ClientTransactionPolicyConfig clientTransactionPolicyConfig =
ClientContextManager.getClientContext().getTransactionConfig();
+ if (clientTransactionPolicyConfig == null) return;
+
+ if (log.isDebugEnabled()) log.debug("Client has a transaction
policy");
+
clientTransactionPolicyConfig.exportTransaction(ri);
}
}
1.3 +8 -8
openejb/modules/core/src/java/org/openejb/corba/transaction/IORTransactionInterceptor.java
Index: IORTransactionInterceptor.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/transaction/IORTransactionInterceptor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IORTransactionInterceptor.java 20 Mar 2005 06:26:08 -0000 1.2
+++ IORTransactionInterceptor.java 27 Mar 2005 02:04:42 -0000 1.3
@@ -49,15 +49,15 @@
import org.omg.CORBA.Any;
import org.omg.CORBA.INV_POLICY;
import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.ORB;
import org.omg.IOP.TAG_INTERNET_IOP;
import org.omg.IOP.TAG_OTS_POLICY;
import org.omg.IOP.TaggedComponent;
import org.omg.PortableInterceptor.IORInfo;
import org.omg.PortableInterceptor.IORInterceptor;
+
import org.openejb.corba.idl.CosTSInteroperation.TAG_INV_POLICY;
import org.openejb.corba.idl.CosTransactions.ADAPTS;
-import org.openejb.corba.idl.CosTransactions.InvocationPolicyValueHelper;
-import org.openejb.corba.idl.CosTransactions.OTSPolicyValueHelper;
import org.openejb.corba.idl.CosTransactions.SHARED;
import org.openejb.corba.util.Util;
@@ -72,14 +72,14 @@
public void establish_components(IORInfo info) {
try {
- Any invAny = Util.getORB().create_any();
- InvocationPolicyValueHelper.insert(invAny, SHARED.value);
+ Any invAny = ORB.init().create_any();
+ invAny.insert_short(SHARED.value);
byte[] invBytes = Util.getCodec().encode_value(invAny);
TaggedComponent invocationPolicyComponent = new
TaggedComponent(TAG_INV_POLICY.value, invBytes);
info.add_ior_component_to_profile(invocationPolicyComponent,
TAG_INTERNET_IOP.value);
- Any otsAny = Util.getORB().create_any();
- OTSPolicyValueHelper.insert(otsAny, ADAPTS.value);
+ Any otsAny = ORB.init().create_any();
+ otsAny.insert_short(ADAPTS.value);
byte[] otsBytes = Util.getCodec().encode_value(otsAny);
TaggedComponent otsPolicyComponent = new
TaggedComponent(TAG_OTS_POLICY.value, otsBytes);
info.add_ior_component_to_profile(otsPolicyComponent,
TAG_INTERNET_IOP.value);