Package com.arjuna.webservices.wscoor

Examples of com.arjuna.webservices.wscoor.CoordinationContextType


    public void testInvalidProtocolProtocolIdentifierException()
        throws Exception
    {
        final String messageId = "testInvalidProtocolProtocolIdentifierException" ;
        final String protocolIdentifier = TestUtil.INVALID_PROTOCOL_PROTOCOL_IDENTIFIER ;
        final CoordinationContextType coordinationContext = new CoordinationContextType() ;
        coordinationContext.setCoordinationType(new URI(TestUtil.COORDINATION_TYPE)) ;
        coordinationContext.setIdentifier(new AttributedURIType("identifier")) ;
        coordinationContext.setRegistrationService(registrationCoordinator) ;
        try
        {
            RegistrationCoordinator.register(coordinationContext, messageId, registrationRequester, protocolIdentifier) ;
        }
        catch (final InvalidProtocolException ipe) {}
View Full Code Here


    public void testInvalidStateProtocolIdentifierException()
        throws Exception
    {
        final String messageId = "testInvalidStateProtocolIdentifierException" ;
        final String protocolIdentifier = TestUtil.INVALID_STATE_PROTOCOL_IDENTIFIER ;
        final CoordinationContextType coordinationContext = new CoordinationContextType() ;
        coordinationContext.setCoordinationType(new URI(TestUtil.COORDINATION_TYPE)) ;
        coordinationContext.setIdentifier(new AttributedURIType("identifier")) ;
        coordinationContext.setRegistrationService(registrationCoordinator) ;
        try
        {
            RegistrationCoordinator.register(coordinationContext, messageId, registrationRequester, protocolIdentifier) ;
        }
        catch (final InvalidStateException ise) {}
View Full Code Here

    public void testNoActivityProtocolIdentifierException()
        throws Exception
    {
        final String messageId = "testNoActivityProtocolIdentifierException" ;
        final String protocolIdentifier = TestUtil.NO_ACTIVITY_PROTOCOL_IDENTIFIER ;
        final CoordinationContextType coordinationContext = new CoordinationContextType() ;
        coordinationContext.setCoordinationType(new URI(TestUtil.COORDINATION_TYPE)) ;
        coordinationContext.setIdentifier(new AttributedURIType("identifier")) ;
        coordinationContext.setRegistrationService(registrationCoordinator) ;
        try
        {
            RegistrationCoordinator.register(coordinationContext, messageId, registrationRequester, protocolIdentifier) ;
        }
        catch (final NoActivityException nae) {}
View Full Code Here

    {
        final String messageID = "testKnownCoordinationType" ;
        final String coordinationTypeURI = TestUtil.COORDINATION_TYPE ;
        try
        {
            final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(activationCoordinatorURI, messageID, coordinationTypeURI, null, null) ;
           
            assertNotNull(coordinationContext);
            assertNotNull(coordinationContext.getCoordinationType()) ;
            assertEquals(TestUtil.COORDINATION_TYPE, coordinationContext.getCoordinationType().getValue());
            assertNotNull(coordinationContext.getRegistrationService()) ;
            assertNotNull(coordinationContext.getRegistrationService().getAddress()) ;
            assertNotNull(coordinationContext.getRegistrationService().getAddress().getValue()) ;
        }
        catch (final Throwable th)
        {
            fail("Unexpected exception: " + th);
        }
View Full Code Here

        throws InvalidCreateParametersException
    {
        if (coordinationTypeURI.equals(TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE))
            throw new InvalidCreateParametersException();

        CoordinationContextType testCoordinationContext = new CoordinationContextType();

        final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
        final String registrationURI = soapRegistry.getServiceURI(CoordinationConstants.SERVICE_REGISTRATION_COORDINATOR) ;
        final EndpointReferenceType registrationService = new EndpointReferenceType(new AttributedURIType(registrationURI)) ;
       
        testCoordinationContext.setIdentifier(new AttributedURIType(Integer.toString(nextIdentifier()))) ;
        testCoordinationContext.setCoordinationType(new URI(_coordinationType)) ;
        testCoordinationContext.setRegistrationService(registrationService) ;
       
        final NamedElement extension = new NamedElement(TestUtil.TEST_ELEMENT_EXTENSION_VALUE_QNAME,
            new TextElement(TestUtil.TEST_EXTENSION_VALUE)) ;
        testCoordinationContext.putAnyContent(extension) ;
       
        _identifier++;

        return testCoordinationContext;
    }
View Full Code Here

       
                final JTAContextImple jtaContext = JTAContextImple.getContext() ;
                final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
                final String registrationCoordinatorURI = soapRegistry.getServiceURI(CoordinationConstants.SERVICE_REGISTRATION_COORDINATOR) ;
               
                final CoordinationContextType coordinationContext = new CoordinationContextType() ;
                coordinationContext.setCoordinationType(new URI(coordinationTypeURI)) ;
                coordinationContext.setIdentifier(new AttributedURIType(jtaContext.getTransactionIdentifier())) ;
                final int transactionExpires = jtaContext.getTransactionExpires() ;
                if (transactionExpires > 0)
                {
                    coordinationContext.setExpires(new AttributedUnsignedIntType(transactionExpires)) ;
                }
                final EndpointReferenceType registrationCoordinator = new EndpointReferenceType(new AttributedURIType(registrationCoordinatorURI)) ;
                InstanceIdentifier.setEndpointInstanceIdentifier(registrationCoordinator, jtaContext.getTransactionIdentifier()) ;
                coordinationContext.setRegistrationService(registrationCoordinator) ;

            /*
             * Now add the registrar for this specific coordinator to
             * the mapper.
             */
 
View Full Code Here

                final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
                final String registrationCoordinatorURI = soapRegistry.getServiceURI(CoordinationConstants.SERVICE_REGISTRATION_COORDINATOR) ;
               
                final ArjunaContextImple arjunaContext = ArjunaContextImple.getContext() ;
                final CoordinationContextType coordinationContext = new CoordinationContextType() ;
                coordinationContext.setCoordinationType(new URI(coordinationTypeURI)) ;
                coordinationContext.setIdentifier(new AttributedURIType(arjunaContext.getTransactionIdentifier(0))) ;
                final int transactionExpires = arjunaContext.getTransactionExpires(0) ;
                if (transactionExpires > 0)
                {
                    coordinationContext.setExpires(new AttributedUnsignedIntType(transactionExpires)) ;
                }
                final EndpointReferenceType registrationCoordinator = new EndpointReferenceType(new AttributedURIType(registrationCoordinatorURI)) ;
                InstanceIdentifier.setEndpointInstanceIdentifier(registrationCoordinator, arjunaContext.getTransactionIdentifier(0)) ;
                coordinationContext.setRegistrationService(registrationCoordinator) ;

        /*
         * Now add the registrar for this specific coordinator to the
         * mapper.
         */
 
View Full Code Here

       
                final ArjunaContextImple arjunaContext = ArjunaContextImple.getContext() ;
                final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
                final String registrationCoordinatorURI = soapRegistry.getServiceURI(CoordinationConstants.SERVICE_REGISTRATION_COORDINATOR) ;
               
                final CoordinationContextType coordinationContext = new CoordinationContextType() ;
                coordinationContext.setCoordinationType(new URI(coordinationTypeURI)) ;
                coordinationContext.setIdentifier(new AttributedURIType("urn:"+arjunaContext.getTransactionIdentifier())) ;
                final int transactionExpires = arjunaContext.getTransactionExpires() ;
                if (transactionExpires > 0)
                {
                    coordinationContext.setExpires(new AttributedUnsignedIntType(transactionExpires)) ;
                }
                final EndpointReferenceType registrationCoordinator = new EndpointReferenceType(new AttributedURIType(registrationCoordinatorURI)) ;
                InstanceIdentifier.setEndpointInstanceIdentifier(registrationCoordinator, arjunaContext.getTransactionIdentifier()) ;
                coordinationContext.setRegistrationService(registrationCoordinator) ;

        /*
         * Now add the registrar for this specific coordinator to the
         * mapper.
         */

        _coordManager.enlistSynchronization(new CleanupSynchronization(_coordManager.identifier().toString(), _theRegistrar));

        /*
         * TODO Uughh! This does a suspend for us! Left over from original
         * WS-AS stuff.
         *
         * TODO
         * REFACTOR, REFACTOR, REFACTOR.
         */
       
        _theRegistrar.associate();

        return coordinationContext;
                } else {
                    // we need to create a subordinate transaction and register it as both a durable and volatile
                    // participant with the registration service defined in the current context

                    SubordinateCoordinator subTx = (SubordinateCoordinator) createSubordinate();
                    // hmm, need to create wrappers here as the subTx is in WSCF which only knows
                    // about WSAS and WS-C and the participant is in WS-T
                    String vtppid = subTx.getVolatile2PhaseId();
                    String dtppid = subTx.getDurable2PhaseId();
                    Volatile2PCParticipant vtpp = new SubordinateVolatile2PCStub(subTx);
                    Durable2PCParticipant dtpp = new SubordinateDurable2PCStub(subTx);
                    final String messageId = MessageId.getMessageId() ;
                    EndpointReferenceType participant;
                    EndpointReferenceType coordinator;
                    participant= getParticipant(vtppid);
                    coordinator = RegistrationCoordinator.register(currentContext, messageId, participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC) ;
                    ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(vtpp, vtppid, coordinator), vtppid) ;
                    participant= getParticipant(dtppid);
                    coordinator = RegistrationCoordinator.register(currentContext, messageId, participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC) ;
                    ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(dtpp, dtppid, coordinator), dtppid) ;

                    // ok now create the context
                    final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
                    final String registrationCoordinatorURI = soapRegistry.getServiceURI(CoordinationConstants.SERVICE_REGISTRATION_COORDINATOR) ;

                    final CoordinationContextType coordinationContext = new CoordinationContextType() ;
                    coordinationContext.setCoordinationType(new URI(coordinationTypeURI));
                    String txId = subTx.get_uid().stringForm();
                    coordinationContext.setIdentifier(new AttributedURIType("urn:"+ txId)) ;
                    AttributedUnsignedIntType expiresObject = currentContext.getExpires();
                    if (expiresObject != null) {
                        long transactionExpires = currentContext.getExpires().getValue();
                        if (transactionExpires > 0) {
                            coordinationContext.setExpires(new AttributedUnsignedIntType(transactionExpires)) ;
                        }
                    }
                    final EndpointReferenceType registrationCoordinator = new EndpointReferenceType(new AttributedURIType(registrationCoordinatorURI)) ;
                    InstanceIdentifier.setEndpointInstanceIdentifier(registrationCoordinator, txId) ;
                    coordinationContext.setRegistrationService(registrationCoordinator) ;
                    coordinationContext.setRegistrationService(registrationCoordinator) ;

                    // now associate the tx id with the sub transaction

                    _theRegistrar.associate(subTx);
                    return coordinationContext;
View Full Code Here

     * @throws SoapFault for processing errors.
     */
    public void invoke(final XMLStreamReader in, final MessageContext messageContext)
        throws XMLStreamException, SoapFault
    {
        final CoordinationContextType coordinationContext = new CoordinationContextType(in) ;
        CoordinationContext.setContext(messageContext, coordinationContext) ;
    }
View Full Code Here

     */
    public void writeContent(final XMLStreamWriter out, final QName headerElementName,
        final MessageContext context, final SoapDetails soapDetails)
        throws XMLStreamException
    {
        final CoordinationContextType coordinationContext = CoordinationContext.getThreadContext() ;
        if (coordinationContext != null)
        {
            coordinationContext.putAttribute(soapDetails.getMustUnderstandQName(), soapDetails.getMustUnderstandValue()) ;
            StreamHelper.writeElement(out, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT_QNAME, coordinationContext) ;
        }
    }
View Full Code Here

TOP

Related Classes of com.arjuna.webservices.wscoor.CoordinationContextType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.