Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.arjuna.mwlabs.wst11.at.remote;
  
 
An implementation of UserTransaction which employs an RPC MEP based completion protocol specific to JBoss to complete the transaction. This implementation allows the client to be deployed without the need to expose any service endpoints.
 
 {
 
 	{
 		try
 		{
              = XTSPropertyManager.getWSCEnvironmentBean().getCoordinatorURL11();
 
 			/*
 			 * If the coordinator URL hasn't been specified via the
 			 * configuration file then assume we are using a locally registered
 			 * implementation.
 			 */
 
 			{
                 final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
                  = serviceRegistry.getServiceURI(.) ;
 			}
 		}
 		catch (Exception ex)
 		{
 			// TODO
 
 		}
         // this implementation cannot provide support for subordinate transactions
          = null;
 	}
 
         return ;
     }
 
     public void begin () throws WrongStateExceptionSystemException
     {
 		begin(0);
 	}
 
 	public void begin (int timeoutthrows WrongStateExceptionSystemException
 	{
 		try
 		{
 			if (.currentTransaction() != null)
 				throw new WrongStateException();
 
 			Context ctx = startTransaction(timeoutnull);
 
 
 		}
 		{
 			tidyup();
 
 			throw new SystemException(ex.toString());
		}
		{
			throw new SystemException(ex.toString());
		}
		catch (SystemException ex)
		{
			throw ex;
		}
	}
	public void commit () throws TransactionRolledBackException,
	{
		try
		{
		}
		catch (SystemException ex)
		{
			throw ex;
		}
		finally
		{
		}
	}
	{
		try
		{
		}
		catch (SystemException ex)
		{
			throw ex;
		}
		finally
		{
		}
	}
	{
		try
		{
		}
		catch (SystemException ex)
		{
			return "Unknown";
		}
		{
			return "Unknown";
		}
	}
	public String toString ()
	{
	}

    
method provided for the benefit of UserSubordinateTransactionImple to allow it to begin a subordinate transaction which requires an existing context to be installed on the thread before it will start and instal la new transaction

    public void beginSubordinate(int timeoutthrows WrongStateExceptionSystemException
    {
        throw new SystemException("UserTransactionStandaloneImple does not support subordinate transactions");
    }
	/*
	 * enlist the client for the completiopn protocol so it can commit or ro0ll back the transaction
	 */
	private final void enlistCompletionParticipants ()
	{
        TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();
        final TxContextImple currentTx = (TxContextImpletm.currentTransaction();
        if (currentTx == null)
            throw new UnknownTransactionException();
        final String id = currentTx.identifier();
        W3CEndpointReference completionCoordinator = null;
        try
        {
            completionCoordinator = tm.registerParticipant(null.);
        }
        catch (InvalidProtocolException ex)
        {
            ex.printStackTrace();
            throw new SystemException(ex.toString());
        }
        catch (InvalidStateException ex)
        {
            throw new WrongStateException();
        }
        catch (CannotRegisterException ex)
        {
            // cause could actually be no activity or already registered
            throw new UnknownTransactionException();
        }
        .put(idcompletionCoordinator);
	}

    
fetch the coordination context type stashed in the current AT context implememtation and use it to construct an instance of the coordination context extension type we need to send down the wire to the activation coordinator

Parameters:
current the current AT context implememtation
Returns:
an instance of the coordination context extension type
    {
        CoordinationContextType contextType = getContextType(current);
        CoordinationContext context = new CoordinationContext();
        context.setCoordinationType(contextType.getCoordinationType());
        context.setExpires(contextType.getExpires());
        context.setIdentifier(contextType.getIdentifier());
        context.setRegistrationService(contextType.getRegistrationService());
        return context;
    }

    
fetch the coordination context type stashed in the current AT context implememtation

Parameters:
current the current AT context implememtation
Returns:
the coordination context type stashed in the current AT context implememtation
    {
        ContextImple contextImple = (ContextImple)current.context();
        return contextImple.getCoordinationContext();
    }
    protected final Context startTransaction(int timeoutTxContextImple current)
	{
		try
		{
            // TODO: tricks for per app _activationCoordinatorService config, perhaps:
            //InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/foo.properties");
            final Long expires = (timeout > 0 ? new Long(timeout) : null) ;
            final String messageId = MessageId.getMessageId() ;
            final CoordinationContext currentContext = (current != null ? getContext(current) : null);
            final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(
                    messageId.expirescurrentContext) ;
            if (coordinationContext == null)
            {
                throw new SystemException(
                        ..get_mwlabs_wst_at_remote_UserTransaction11Imple__2());
            }
            return new ContextImple(coordinationContext) ;
		}
        catch (final InvalidCreateParametersException icpe)
        {
            throw icpe ;
        }
		catch (final SoapFault sf)
		{
			throw new SystemException(sf.getMessage()) ;
		}
		catch (final Exception ex)
		{
			throw new SystemException(ex.toString());
		}
	}
	private final void commitWithoutAck ()
	{
		TxContextImple ctx = null;
		String id = null;
		try
		{
            if (ctx == null) {
                throw new WrongStateException();
            }
			id = ctx.identifier();
			/*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
			final W3CEndpointReference completionCoordinator = (W3CEndpointReference.get(id);
			if (completionCoordinator == null)
				throw new WrongStateException();
			CompletionRPCStub completionStub = new CompletionRPCStub(idcompletionCoordinator);
			completionStub.commit();
		}
		catch (SystemException ex)
		{
			throw ex;
		}
		{
			throw ex;
		}
		{
			throw ex;
		}
		catch (SecurityException ex)
		{
			throw ex;
		}
        catch (WrongStateException ex)
        {
            throw ex;
        }
		catch (Exception ex)
		{
			throw new SystemException(ex.toString());
		}
		finally
		{
			try
			{
				if (ctx != null)
			}
			catch (Exception ex)
			{
			}
			if (id != null)
		}
	}
	{
		TxContextImple ctx = null;
		String id = null;
		try
		{
            if (ctx == null) {
                throw new WrongStateException();
            }
			id = ctx.identifier();
			/*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
			if (completionCoordinator == null)
				throw new WrongStateException();
			CompletionRPCStub completionStub = new CompletionRPCStub(idcompletionCoordinator);
			completionStub.rollback();
		}
		catch (SystemException ex)
		{
			throw ex;
		}
		{
			throw ex;
		}
		catch (SecurityException ex)
		{
			throw ex;
		}
        catch (WrongStateException ex)
        {
            throw ex;
        }
		catch (Exception ex)
		{
			throw new SystemException(ex.toString());
		}
		finally
		{
			try
			{
				if (ctx != null)
			}
			catch (Exception ex)
			{
			}
			if (id != null)
		}
	}
	protected final void tidyup ()
	{
		try
		{
		}
		catch (Exception ex)
		{
		}
	}
New to GrepCode? Check out our FAQ X