[jboss-cvs] JBossAS SVN: r65819 - trunk/iiop/src/main/org/jboss/tm/iiop.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 3 18:40:24 EDT 2007
Author: reverbel
Date: 2007-10-03 18:40:23 -0400 (Wed, 03 Oct 2007)
New Revision: 65819
Removed:
trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptor.java
trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptorInitializer.java
Log:
Delete TM/OTS/DTM code, which now lives in a separate project (at http://xactor.sourceforge.net).
Deleted: trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptor.java
===================================================================
--- trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptor.java 2007-10-03 22:26:30 UTC (rev 65818)
+++ trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptor.java 2007-10-03 22:40:23 UTC (rev 65819)
@@ -1,229 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.tm.iiop;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.TCKind;
-import org.omg.CosTransactions.PropagationContext;
-import org.omg.CosTransactions.PropagationContextHelper;
-import org.omg.IOP.Codec;
-import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
-import org.omg.IOP.ServiceContext;
-import org.omg.PortableInterceptor.ClientRequestInfo;
-import org.omg.PortableInterceptor.ClientRequestInterceptor;
-import org.omg.PortableInterceptor.InvalidSlot;
-
-import org.jboss.iiop.CorbaORB;
-import org.jboss.logging.Logger;
-
-/**
- * This implementation of
- * <code>org.omg.PortableInterceptor.ClientRequestInterceptor</code>
- * inserts the transactional context into outgoing requests.
- *
- * @author <a href="mailto:reverbel at ime.usp.br">Francisco Reverbel</a>
- * @author <a href="mailto:ivanneto at ime.usp.br">Ivan Neto</a>
- * @version $Revision$
- */
-public class TxClientInterceptor
- extends LocalObject
- implements ClientRequestInterceptor
-{
- /** @since 4.0.1 */
- static final long serialVersionUID = -8021933521763745659L;
-
- // Static fields -------------------------------------------------
-
- private static final int txContextId = org.omg.IOP.TransactionService.value;
- private static int slotId;
- private static Codec codec;
- private static org.omg.PortableInterceptor.Current piCurrent;
- private static Any emptyAny = null;
- private static final Logger log =
- Logger.getLogger(TxClientInterceptor.class);
- private static final boolean traceEnabled = log.isTraceEnabled();
-
- /** Propagation context associated with the current thread. */
- private static ThreadLocal threadLocalData = new ThreadLocal();
-
- // Static methods ------------------------------------------------
-
- static void init(int slotId, Codec codec,
- org.omg.PortableInterceptor.Current piCurrent)
- {
- TxClientInterceptor.slotId = slotId;
- TxClientInterceptor.codec = codec;
- TxClientInterceptor.piCurrent = piCurrent;
- }
-
- /**
- * Sets the transaction propagation context to be sent out with the IIOP
- * requests generated by the current thread.
- */
- public static void setOutgoingPropagationContext(PropagationContext pc)
- {
- Any any = CorbaORB.getInstance().create_any();
- PropagationContextHelper.insert(any, pc);
- try
- {
- piCurrent.set_slot(slotId, any);
- }
- catch (InvalidSlot e)
- {
- throw new RuntimeException("Exception setting propagation context: "
- + e);
- }
- }
-
- /**
- * Unsets the transaction propagation context associated with the current
- * thread.
- */
- public static void unsetOutgoingPropagationContext()
- {
- try
- {
- piCurrent.set_slot(slotId, getEmptyAny());
- }
- catch (InvalidSlot e)
- {
- throw new RuntimeException("Exception unsetting propagation context: "
- + e);
- }
- }
-
- /**
- * Suspends the transaction propagation context associated with the current
- * thread.
- */
- public static void suspendOutgoingPropagationContext()
- {
- try
- {
- Any pcAny = piCurrent.get_slot(slotId);
- threadLocalData.set(pcAny);
- piCurrent.set_slot(slotId, getEmptyAny());
- }
- catch (InvalidSlot e)
- {
- throw new RuntimeException("Exception suspending propagation " +
- "context: " + e);
- }
- }
-
- /**
- * Resumes the transaction propagation context associated with the current
- * thread.
- */
- public static void resumeOutgoingPropagationContext()
- {
- try
- {
- Any pcAny = (Any) threadLocalData.get();
- piCurrent.set_slot(slotId, pcAny);
- }
- catch (InvalidSlot e)
- {
- throw new RuntimeException("Exception resuming propagation context: "
- + e);
- }
- }
-
- /**
- * Auxiliary method that returns an empty Any.
- */
- private static Any getEmptyAny()
- {
- if (emptyAny == null)
- emptyAny = CorbaORB.getInstance().create_any();
- return emptyAny;
- }
-
- // Constructor ---------------------------------------------------
-
- public TxClientInterceptor()
- {
- // do nothing
- }
-
- // org.omg.PortableInterceptor.Interceptor operations ------------
-
- public String name()
- {
- return "TxClientInterceptor";
- }
-
- public void destroy()
- {
- // do nothing
- }
-
- // ClientRequestInterceptor operations ---------------------------
-
- public void send_request(ClientRequestInfo ri)
- {
- if (traceEnabled)
- log.trace("send_request: " + ri.operation());
- try
- {
- Any any = ri.get_slot(slotId);
- if (any.type().kind().value() != TCKind._tk_null)
- {
- ServiceContext sc = new ServiceContext(txContextId,
- codec.encode_value(any));
- ri.add_request_service_context(sc,
- true /*replace existing context*/);
- }
- }
- catch (InvalidSlot e)
- {
- throw new RuntimeException("Exception getting slot in " +
- "TxServerInterceptor: " + e);
- }
- catch (InvalidTypeForEncoding e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void send_poll(ClientRequestInfo ri)
- {
- // do nothing
- }
-
- public void receive_reply(ClientRequestInfo ri)
- {
- // do nothing
- }
-
- public void receive_exception(ClientRequestInfo ri)
- {
- // do nothing
- }
-
- public void receive_other(ClientRequestInfo ri)
- {
- // do nothing
- }
-
-}
Deleted: trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptorInitializer.java
===================================================================
--- trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptorInitializer.java 2007-10-03 22:26:30 UTC (rev 65818)
+++ trunk/iiop/src/main/org/jboss/tm/iiop/TxClientInterceptorInitializer.java 2007-10-03 22:40:23 UTC (rev 65819)
@@ -1,86 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.tm.iiop;
-
-import org.omg.CORBA.LocalObject;
-import org.omg.IOP.Codec;
-import org.omg.IOP.ENCODING_CDR_ENCAPS;
-import org.omg.IOP.Encoding;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitializer;
-
-/**
- * This is an <code>org.omg.PortableInterceptor.ORBInitializer</code> that
- * installs a <code>TxClientInterceptor</code>.
- *
- * @author <a href="mailto:reverbel at ime.usp.br">Francisco Reverbel</a>
- * @version $Revision$
- */
-public class TxClientInterceptorInitializer
- extends LocalObject
- implements ORBInitializer
-{
- /** @since 4.0.1 */
- static final long serialVersionUID = 5904050829195193816L;
-
- public TxClientInterceptorInitializer()
- {
- // do nothing
- }
-
- // org.omg.PortableInterceptor.ORBInitializer operations ---------
-
- public void pre_init(ORBInitInfo info)
- {
- // do nothing
- }
-
- public void post_init(ORBInitInfo info)
- {
- try
- {
- // Use CDR encapsulation with GIOP 1.0 encoding
- Encoding encoding = new Encoding(ENCODING_CDR_ENCAPS.value,
- (byte)1, /* GIOP version */
- (byte)0 /* GIOP revision*/);
- Codec codec = info.codec_factory().create_codec(encoding);
-
- // Get reference to PICurrent
- org.omg.CORBA.Object obj =
- info.resolve_initial_references("PICurrent");
- org.omg.PortableInterceptor.Current piCurrent =
- org.omg.PortableInterceptor.CurrentHelper.narrow(obj);
-
- // Init fields slot id, codec, and piCurrent of the interceptor class
- TxClientInterceptor.init(info.allocate_slot_id(), codec, piCurrent);
-
- // Create and register interceptor
- TxClientInterceptor interceptor = new TxClientInterceptor();
- info.add_client_request_interceptor(interceptor);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Unexpected " + e);
- }
- }
-
-}
More information about the jboss-cvs-commits
mailing list