Package org.apache.sandesha2

Examples of org.apache.sandesha2.SandeshaException


    setUpServiceClientAnonymousOperations (serviceClient);
   
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configContext = serviceContext.getConfigurationContext();

    String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
    if (rmSpecVersion == null)
      rmSpecVersion = Sandesha2Constants.SPEC_VERSIONS.v1_0;

    if (Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmSpecVersion)) {
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.emptyAckRequestSpecLevel, rmSpecVersion));
    }
   
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);

    SOAPEnvelope dummyEnvelope = configureAckRequest(options, configContext);
   
    OMElement ackRequestedHeaderBlock = dummyEnvelope.getHeader().getFirstChildWithName(
        new QName(rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED));

    String oldAction = options.getAction();

    serviceClient.addHeader(ackRequestedHeaderBlock);

    try {
      //to inform the sandesha2 out handler
      serviceClient.fireAndForget (null);
    } catch (AxisFault e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotSendAckRequestException, e.toString());
      throw new SandeshaException(message, e);
    }

    serviceClient.removeHeaders();
    options.setAction(oldAction);
  }
View Full Code Here


  }

  public static void sendAckRequest(ServiceClient serviceClient, String sequenceKey) throws SandeshaException {
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
    sendAckRequest(serviceClient);
View Full Code Here

      //only do this if we are running inOrder
      if(SandeshaUtil.getPropertyBean(configContext.getAxisConfiguration()).isInOrder()){
        Invoker invoker = (Invoker)SandeshaUtil.getSandeshaStorageManager(configContext, configContext.getAxisConfiguration()).getInvoker();
        if (invoker==null){
          throw new SandeshaException(SandeshaMessageHelper.getMessage(
            SandeshaMessageKeys.invokerNotFound, sequenceID));
        }
       
        invoker.forceInvokeOfAllMessagesCurrentlyOnSequence(configContext, sequenceID, allowLaterDeliveryOfMissingMessages);     
      }
View Full Code Here

  private static SOAPEnvelope configureCloseSequence(Options options, ConfigurationContext configurationContext)
      throws SandeshaException {

    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    EndpointReference epr = options.getTo();
    if (epr == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    //first see if the cliet has told us which sequence to close
    String internalSequenceID =
      (String)options.getProperty(SandeshaClientConstants.INTERNAL_SEQUENCE_ID);
   
    if(internalSequenceID==null){
      //lookup the internal seq id based on to EPR and sequenceKey
      String to = epr.getAddress();
      String sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
      internalSequenceID = SandeshaUtil.getInternalSequenceID(to, sequenceKey);
    }

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
   
    // Get a transaction for getting the sequence properties
    Transaction transaction = null;
    String sequenceID = null;
   
    try
    {
      transaction = storageManager.getTransaction();
      sequenceID = SandeshaUtil.getSequenceIDFromInternalSequenceID(internalSequenceID, storageManager);
    }
    finally
    {
      // Commit the tran whatever happened
      if(transaction != null) transaction.commit();
    }
   
    if (sequenceID == null)
      sequenceID = Sandesha2Constants.TEMP_SEQUENCE_ID; 

    String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);

    if (rmSpecVersion == null)
      rmSpecVersion = SpecSpecificConstants.getDefaultSpecVersion();

    if (!SpecSpecificConstants.isSequenceClosingAllowed(rmSpecVersion))
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.closeSequenceSpecLevel, rmSpecVersion));

    SOAPEnvelope dummyEnvelope = null;
    SOAPFactory factory = null;
    String soapNamespaceURI = options.getSoapVersionURI();
View Full Code Here

*/
    if (rmdBean != null) {
      return SequenceReport.SEQUENCE_STATUS_ESTABLISHED;
    }

    throw new SandeshaException(SandeshaMessageHelper.getMessage(
        SandeshaMessageKeys.cannotFindSequence, sequenceID
        ));
  }
View Full Code Here

  private static SOAPEnvelope configureTerminateSequence(Options options, ConfigurationContext configurationContext)
      throws SandeshaException {

    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    EndpointReference epr = options.getTo();
    if (epr == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    //first see if the cliet has told us which sequence to terminate
    String internalSequenceID =
      (String)options.getProperty(SandeshaClientConstants.INTERNAL_SEQUENCE_ID);
View Full Code Here

          anonOutOnlyOperation.setPhasesInFaultFlow(referenceOperation.getRemainingPhasesInFlow());

          service.addOperation(anonOutOnlyOperation);
        } else {
          String message = "Cant find RM Operations. Please engage the Sandesha2 module before doing the invocation.";
          throw new SandeshaException (message);
        }
      }

      AxisOperation anonOutInOperation = service.getOperation(ServiceClient.ANON_OUT_IN_OP);
     
      if (anonOutInOperation==null) {
        anonOutInOperation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_OUT_IN);
        anonOutInOperation.setName(ServiceClient.ANON_OUT_IN_OP);
       
        AxisOperation referenceOperation = service.getOperation(Sandesha2Constants.RM_IN_OUT_OPERATION);
       
        if (referenceOperation!=null) {
          anonOutInOperation.setPhasesOutFlow(referenceOperation.getPhasesOutFlow());
          anonOutInOperation.setPhasesOutFaultFlow(referenceOperation.getPhasesOutFaultFlow());
          anonOutInOperation.setPhasesInFaultFlow(referenceOperation.getPhasesInFaultFlow());
          anonOutInOperation.setPhasesInFaultFlow(referenceOperation.getRemainingPhasesInFlow());
         
          //operation will be added to the service only if a valid referenceOperation was found.
          service.addOperation(anonOutInOperation);
        }
      }
    } catch (AxisFault e) {
      throw new SandeshaException (e);
    }
  }
View Full Code Here

    if (log.isTraceEnabled())
      log.trace("Looking up sequence with identifier " + internalSequenceId);
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();

    // Get the in use storage manager and the sequence property bean manager
View Full Code Here

    if (log.isTraceEnabled())
      log.trace("Looking up sequence with identifier " + internalSequenceId);
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();

    // Get the in use storage manager and the sequence property bean manager
View Full Code Here

   */
  private static String getInternalSequenceIdFromServiceClient(ServiceClient serviceClient) throws SandeshaException
  {
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    EndpointReference toEPR = options.getTo();
    if (toEPR == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    String to = toEPR.getAddress();
    String sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);

View Full Code Here

TOP

Related Classes of org.apache.sandesha2.SandeshaException

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.