Package org.apache.axis2.context

Examples of org.apache.axis2.context.ServiceContext


      throw new SandeshaException ("'To' address is not set");
   
    String to = toEPR.getAddress();
    String sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext==null)
      throw new SandeshaException ("Service Context is null");
   
    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();
    String internalSequenceID = getInternalSequenceID(to,sequenceKey);
   
    return getOutgoingSequenceReport(internalSequenceID,configurationContext);
  }
View Full Code Here


   *
   * @param serviceClient
   * @throws SandeshaException
   */
  public static void terminateSequence (ServiceClient serviceClient) throws SandeshaException {   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext==null)
      throw new SandeshaException ("ServiceContext is null");
   
    Options options = serviceClient.getOptions();
    if (options==null)
      throw new SandeshaException ("Options object is not set");
   
    String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);

    if (rmSpecVersion==null)
      rmSpecVersion = SpecSpecificConstants.getDefaultSpecVersion ();
   
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);
   
    SOAPEnvelope terminateEnvelope = configureTerminateSequence(options,serviceContext.getConfigurationContext());
    OMElement terminateBody = terminateEnvelope.getBody().getFirstChildWithName(new QName (rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE));
   
    String oldAction = options.getAction();
    options.setAction(SpecSpecificConstants.getTerminateSequenceAction(rmSpecVersion));
   
View Full Code Here

   *
   * @param serviceClient
   * @throws SandeshaException
   */
  public static void closeSequence (ServiceClient serviceClient) throws SandeshaException {
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext==null)
      throw new SandeshaException ("ServiceContext is null");
   
    Options options = serviceClient.getOptions();
    if (options==null)
      throw new SandeshaException ("Options object is not set");
   
    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 {
View Full Code Here

      throw new SandeshaException ("To EPR is not set");
   
    String to = toEPR.getAddress();
    String sequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext==null)
      throw new SandeshaException ("Service context is not set");
   
    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();
   
    String internalSequenceID = generateInternalSequenceIDForTheClientSide(to,sequenceKey);
   
    SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
    if (sequenceReport==null)
View Full Code Here

       
    Options options = serviceClient.getOptions();
    if (options==null)
      throw new SandeshaException ("Options object is not set");
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext==null)
      throw new SandeshaException ("ServiceContext is null");
   
    ConfigurationContext configContext = serviceContext.getConfigurationContext();
   
    EndpointReference toEPR = options.getTo();
    if (toEPR==null)
      throw new SandeshaException ("'To' address is not set is not set");
View Full Code Here

       
        if (referenceMessage.getServiceContext()!=null) {
          newMessageContext.setServiceContext(referenceMessage.getServiceContext());
          newMessageContext.setServiceContextID(referenceMessage.getServiceContextID());
        } else {
          ServiceContext serviceContext = new ServiceContext (referenceMessage.getAxisService(),newMessageContext.getServiceGroupContext());
          newMessageContext.setServiceContext(serviceContext);
        }
      } else {
        AxisService axisService = new AxisService("AnonymousRMService");
       
        AxisServiceGroup serviceGroup = newMessageContext.getAxisServiceGroup();
        axisService.setParent(serviceGroup);
        serviceGroup.addChild(axisService);
       
        ServiceContext serviceContext = new ServiceContext(axisService, newMessageContext.getServiceGroupContext());

        newMessageContext.setAxisService(axisService);
        newMessageContext.setServiceContext(serviceContext);
      }
View Full Code Here

          // be the RMIn
          OperationContext responseMsgOpCtx = requestMsgOpCtx;
          if (requestMsgOpCtx.getAxisOperation().getMessageReceiver() == null) {
            // Generate a new RM In Only operation

            ServiceContext serviceCtx = msgCtx.getServiceContext();
            AxisOperation op = msgCtx.getAxisService().getOperation(Sandesha2Constants.RM_IN_ONLY_OPERATION);
            responseMsgOpCtx = OperationContextFactory.createOperationContext (op.getAxisSpecificMEPConstant(), op, serviceCtx);         
          }
         
          responseMessageContext.setOperationContext(responseMsgOpCtx);
View Full Code Here

   * @return
   * @throws SandeshaException
   */
  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);

    return getOutgoingSequenceReport(internalSequenceID, configurationContext);
  }
View Full Code Here

    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()));
   
    // If the client requested async operations, mint a replyTo EPR
    boolean resetReply = false;
    if(options.isUseSeparateListener() && options.getReplyTo() == null) {
      try {
        if(log.isDebugEnabled()) log.debug("Creating replyTo EPR");
       
        // Try to work out which transport to use. If the user didn't choose one
        // then we use the To address to take a guess.
        TransportOutDescription senderTransport = options.getTransportOut();
        String transportName = null;
        if(senderTransport != null) {
          transportName = senderTransport.getName();
        }

        if(transportName == null) {
          int index = to.indexOf(':');
          if(index > 0) transportName = to.substring(0, index);
        }

        EndpointReference replyTo = serviceContext.getMyEPR(transportName);
        if(replyTo != null) {
          options.setReplyTo(replyTo);
          resetReply = true;
        }
       
View Full Code Here

   */
  public static void terminateSequence(ServiceClient serviceClient) throws SandeshaException {
   
    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));

View Full Code Here

TOP

Related Classes of org.apache.axis2.context.ServiceContext

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.