Package org.apache.sandesha2

Examples of org.apache.sandesha2.SandeshaException


        }
      }
    } catch (NumberFormatException e) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.propertyInvalidValue,
          Sandesha2Constants.Properties.MessageTypesToDrop);
      throw new SandeshaException(message, e);
    }
  }
View Full Code Here


   */
  public static SequenceReport getOutgoingSequenceReport(ServiceClient serviceClient) throws SandeshaException {

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

    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();

    String internalSequenceID = getInternalSequenceIdFromServiceClient(serviceClient);
View Full Code Here

    while (incomingSequenceIDIter.hasNext()) {
      String sequenceID = (String) incomingSequenceIDIter.next();
      SequenceReport incomingSequenceReport = getIncomingSequenceReport(sequenceID, configCtx);
      if (incomingSequenceReport == null) {
        throw new SandeshaException(SandeshaMessageHelper.getMessage(
            SandeshaMessageKeys.incommingSequenceReportNotFound, sequenceID));
      }
      incomingSequenceReports.add(incomingSequenceReport);
    }
View Full Code Here

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

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

    String to = toEPR.getAddress();
    if (to == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    if (offer) {
      String offeredSequenceID = SandeshaUtil.getUUID();
      options.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, offeredSequenceID);
    }

    // setting a new squenceKey if not already set.
    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);

    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);

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

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

    //When the message is marked as Dummy the application processor will not actually try to send it.
    //But still the create Sequence will be added.

    options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_TRUE);

    String oldAction = options.getAction();
    options.setAction(SpecSpecificConstants.getCreateSequenceAction(rmSpecVersion));
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();

    // cleanup previous sequence
    cleanupTerminatedSequence(to, oldSequenceKey, SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration()));
   
    try {     
      //just to inform the sender.
      serviceClient.fireAndForget (null);
    } catch (AxisFault e) {
      throw new SandeshaException(e);
    }
    finally {
      options.setAction(oldAction);
     
      options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_FALSE);
View Full Code Here

  public static String createSequence(ServiceClient serviceClient, boolean offer)
      throws SandeshaException {

    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));
   
    String newSequenceKey = SandeshaUtil.getUUID();
    createSequence(serviceClient, offer, newSequenceKey);
   
View Full Code Here

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

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

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

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

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);

    String oldAction = options.getAction();

    //in WSRM 1.0 we are adding another application msg with the LastMessage tag, instead of sending a terminate here.
    //Actual terminate will be sent once all the messages upto this get acked
   
    try {
      if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(rmSpecVersion)) {
        SOAPEnvelope terminateEnvelope = configureTerminateSequence(options, serviceContext
            .getConfigurationContext());
        OMElement terminateBody = terminateEnvelope.getBody().getFirstChildWithName(
            new QName(rmNamespaceValue,
                Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE));

        // to inform the Sandesha2 out handler.
        serviceClient.fireAndForget(terminateBody);

      } else {
        options.setAction(Sandesha2Constants.SPEC_2005_02.Actions.ACTION_LAST_MESSAGE);
        options.setProperty(SandeshaClientConstants.LAST_MESSAGE, Constants.VALUE_TRUE);
        serviceClient.fireAndForget(null);
      }
     
    } catch (AxisFault e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.couldNotSendTerminate,
          e.toString());
      throw new SandeshaException(message, e);
    } finally {
      options.setAction(oldAction);
    }
  }
View Full Code Here

  }

  public static void terminateSequence(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);
    terminateSequence(serviceClient);
View Full Code Here

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

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

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

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

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);

    SOAPEnvelope closeSequnceEnvelope = configureCloseSequence(options, serviceContext.getConfigurationContext());
    OMElement closeSequenceBody = closeSequnceEnvelope.getBody().getFirstChildWithName(
        new QName(rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE));

    String oldAction = options.getAction();
    options.setAction(SpecSpecificConstants.getCloseSequenceAction(rmSpecVersion));
    try {
      //to inform the sandesha2 out handler
      serviceClient.fireAndForget (closeSequenceBody);
    } catch (AxisFault e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.couldNotSendClose,
          e.toString());
      throw new SandeshaException(message, e);
    } finally {
      options.setAction(oldAction);
    }
  }
View Full Code Here

  public static void closeSequence(ServiceClient serviceClient, String sequenceKey) throws SandeshaException {

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

    String specVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
    if (!Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(specVersion)) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.closeSequenceSpecLevel,
          specVersion);
      throw new SandeshaException (message);
    }
   
    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
    closeSequence(serviceClient);
View Full Code Here

  public static void waitUntilSequenceCompleted(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);
    waitUntilSequenceCompleted(serviceClient);
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.