Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. 
   * See the copyright.txt in the distribution for a full listing 
   * of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * 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,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  * 
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 /*
  * Copyright (C) 2002,
  *
  * Arjuna Technologies Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
  * UK.
  *
  * $Id: SagasHLSImple.java,v 1.3.4.1 2005/11/22 10:34:09 kconner Exp $
  */
 
 package com.arjuna.mwlabs.wscf11.model.sagas.arjunacore;
 
 
 
 
 
 
 
 
 
 
 
The ArjunaCore coordination service implementation.

Author(s):
Mark Little (mark.little@arjuna.com)
Version:
$Id: SagasHLSImple.java,v 1.3.4.1 2005/11/22 10:34:09 kconner Exp $
Since:
1.0.
 
 
 public class SagasHLSImple implements SagasHLSUserCoordinatorService
 {
     public final static String serviceType = "Sagas11HLS";
     public final static String coordinationType = "http://docs.oasis-open.org/ws-tx/wsba/2006/06/AtomicOutcome";
 
     public SagasHLSImple()
     {
 	try
 	{
 	    ActivityManagerFactory.activityManager().addHLS((HLSthis);
 	}
 	catch (Exception ex)
 	{
 	    throw new HLSError(ex.toString());
 	}
 
     }
 
     {
 	return this;
     }
 
    public UserCoordinator userCoordinator ()
    {
    }
    {
    }

    
An activity has begun and is active on the current thread.
    public void begun () throws SystemException
    {
    }

    
The current activity is completing with the specified completion status.

Parameters:
cs The completion status to use.
Returns:
The result of terminating the relationship of this HLS and the current activity.
    public Outcome complete (CompletionStatus csthrows SystemException
    {
    }

    
The activity has been suspended.
    public void suspended () throws SystemException
    {
    }

    
The activity has been resumed on the current thread.
    public void resumed () throws SystemException
    {
    }

    
The activity has completed and is no longer active on the current thread.
    public void completed () throws SystemException
    {
    }

    
We identify the HLS by the name of the coordination protocol it supports.
    public String identity () throws SystemException
    {
        return ;
    }

    
The activity service maintains a priority ordered list of HLS implementations. If an HLS wishes to be ordered based on priority then it can return a non-negative value: the higher the value, the higher the priority and hence the earlier in the list of HLSes it will appear (and be used in).

Returns:
a positive value for the priority for this HLS, or zero/negative if the order is not important.
    public int priority () throws SystemException
    {
	return 0;
    }

    
Return the context augmentation for this HLS, if any on the current activity.

Returns:
a context object or null if no augmentation is necessary.
    public Context context () throws SystemException
    {
        ensureContextInitialised();
        if ( != null) {
            try {
                SOAPContext ctx = (SOAPContext.newInstance();
                ctx.initialiseContext(.currentCoordinator());
                return ctx;
            } catch (Exception ex) {
                ex.printStackTrace();
                throw new SystemException(ex.toString());
            }
        } else {
            throw new SystemException("Unable to create SOAPContext for SAGAS 1.1 service");
        }
    }
    private void ensureContextInitialised() throws SystemException
    {
        if (!) {
            synchronized(this) {
                if (!) {
                    // we  only do this once no matter what happens
                     = true;
                    try {
                        Class<?> factoryClass = ProtocolRegistry.sharedManager().getProtocolImplementation().getClass();
                        ContextProvider contextProvider = factoryClass.getAnnotation(ContextProvider.class);
                        String providerServiceType = contextProvider.serviceType();
                        if (!providerServiceType.equals()) {
                            throw new SystemException("Invalid serviceType for SOAPContext factory registered for SAGAS 1.1 service expecting " +  + " got " + providerServiceType);
                        }
                        Class contextClass = contextProvider.contextImplementation();
                        if (!SOAPContext.class.isAssignableFrom(contextClass)) {
                            throw new SystemException("SOAPContext factory registered for SAGAS 1.1 service provides invalid context implementation");
                        }
                         = contextClass;
                    } catch (ProtocolNotRegisteredException pnre) {
                        throw new SystemException("No SOAPContext factory registered for SAGAS 1.1 service");
                    }
                }
            }
        }
    }
    
If the application requires and if the coordination protocol supports it, then this method can be used to execute a coordination protocol on the currently enlisted participants at any time prior to the termination of the coordination scope. This implementation only supports coordination at the end of the activity.

Parameters:
cs The completion status to use when determining how to execute the protocol.
Returns:
The result of executing the protocol, or null.
Throws:
com.arjuna.mw.wsas.exceptions.WrongStateException Thrown if the coordinator is in a state the does not allow coordination to occur.
com.arjuna.mw.wsas.exceptions.ProtocolViolationException Thrown if the protocol is violated in some manner during execution.
com.arjuna.mw.wsas.exceptions.SystemException Thrown if any other error occurs.
    {
    }

    

Returns:
the status of the current coordinator. If there is no activity associated with the thread then NoActivity will be returned.
Throws:
com.arjuna.mw.wsas.exceptions.SystemException Thrown if any error occurs.
See also:
com.arjuna.mw.wsas.status.Status
    public com.arjuna.mw.wsas.status.Status status () throws SystemException
    {
    }

    
Not supported by basic ArjunaCore.

Returns:
the complete list of qualifiers that have been registered with the current coordinator.
Throws:
com.arjuna.mw.wsas.exceptions.SystemException Thrown if any error occurs.
    {
    }

    

Returns:
The unique identity of the current coordinator.
Throws:
com.arjuna.mw.wsas.exceptions.SystemException Thrown if any error occurs.
    {
    }
    public static String className ()
    {
    	return SagasHLSImple.class.getName();
    }
    private static Class<?> CONTEXT_IMPLE_CLASS = null;
    private static boolean initialised = false;
    private CoordinatorControl      _coordManager;
New to GrepCode? Check out our FAQ X