Package org.serviceconnector.service

Examples of org.serviceconnector.service.SubscriptionMask


    int noiSecs = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.NO_DATA_INTERVAL);
    int noiInMillis = noiSecs * Constants.SEC_TO_MILLISEC_FACTOR;
    String cscSCMaskString = reqMessage.getHeader(SCMPHeaderAttributeKey.CASCADED_MASK);
    String cascSubscriptionId = reqMessage.getHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID);
    Subscription cscSubscription = this.subscriptionRegistry.getSubscription(cascSubscriptionId);
    SubscriptionMask cscMask = new SubscriptionMask(cscSCMaskString);
    Subscription tmpCascSCSubscription = new Subscription(cscMask, sessionInfo, ipAddressList, noiInMillis, AppContext
        .getBasicConfiguration().getSubscriptionTimeoutMillis(), true);
    tmpCascSCSubscription.setService(abstractService);

    switch (abstractService.getType()) {
View Full Code Here


      Map<String, SubscriptionMask> clnSubscriptions = cascClient.getClientSubscriptionIds();
      if (clnSubscriptions.size() != 0) {
        // cascaded client still has client subscriptions set cascaded mask
        String cascadedMask = cascClient.evalSubscriptionMaskFromClientSubscriptions();
        msgToForward.setHeader(SCMPHeaderAttributeKey.CASCADED_MASK, cascadedMask);
        cascClient.setSubscriptionMask(new SubscriptionMask(cascadedMask));
        SCMPCscAbortSubscriptionCall cscAbortCall = new SCMPCscAbortSubscriptionCall(this.requester, msgToForward);
        cscAbortCall.invoke(callback, oti);
        return;
      }
      // no client subscription left - destroy client after XAB
View Full Code Here

    String tmpCscMask = msgToForward.getHeader(SCMPHeaderAttributeKey.CASCADED_MASK);
    if (tmpCscMask == null) {
      // its the case if a client is subscribing directly
      tmpCscMask = msgToForward.getHeader(SCMPHeaderAttributeKey.MASK);
    }
    SubscriptionMask currentSubscriptionMask = cascClient.getSubscriptionMask();
    if (currentSubscriptionMask != null) {
      // cascaded client already has subscribed clients, figure out combined mask
      tmpCscMask = SubscriptionMask.masking(currentSubscriptionMask, tmpCscMask);
    }
    msgToForward.setHeader(SCMPHeaderAttributeKey.CASCADED_MASK, tmpCscMask);
View Full Code Here

  private void subscribeCascadedSCWithActiveCascadedClient(CascadedClient cascClient, SCMPMessage msgToForward,
      ISCMPMessageCallback callback, int oti) throws Exception {
    // set cascaded subscriptonId and cascadedMask
    msgToForward.setHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID, cascClient.getSubscriptionId());
    String clientMaskString = msgToForward.getHeader(SCMPHeaderAttributeKey.MASK);
    SubscriptionMask cascClientMask = cascClient.getSubscriptionMask();
    String cascadedMask = SubscriptionMask.masking(cascClientMask, clientMaskString);
    msgToForward.setHeader(SCMPHeaderAttributeKey.CASCADED_MASK, cascadedMask);
    SCMPCscSubscribeCall subscribeCall = new SCMPCscSubscribeCall(this.requester, msgToForward);
    subscribeCall.invoke(callback, oti);
  }
View Full Code Here

  private void changeSubscriptionCascadedSCWithActiveCascadedClient(CascadedClient cascClient, SCMPMessage msgToForward,
      ISCMPMessageCallback callback, int oti) throws Exception {
    // set cascaded subscriptonId and cascadedMask
    msgToForward.setHeader(SCMPHeaderAttributeKey.CASCADED_SUBSCRIPTION_ID, cascClient.getSubscriptionId());
    String clientMaskString = msgToForward.getHeader(SCMPHeaderAttributeKey.MASK);
    SubscriptionMask cascClientMask = cascClient.getSubscriptionMask();
    String cascadedMask = SubscriptionMask.masking(cascClientMask, clientMaskString);
    msgToForward.setHeader(SCMPHeaderAttributeKey.CASCADED_MASK, cascadedMask);
    SCMPCscChangeSubscriptionCall cscChangeSubscriptionCall = new SCMPCscChangeSubscriptionCall(this.requester, msgToForward);
    cscChangeSubscriptionCall.invoke(callback, oti);
  }
View Full Code Here

    ipAddressList = ipAddressList + Constants.SLASH + request.getRemoteSocketAddress().getAddress().getHostAddress();
    reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);

    String mask = reqMessage.getHeader(SCMPHeaderAttributeKey.MASK);
    SubscriptionMask subscriptionMask = new SubscriptionMask(mask);
    String sessionInfo = reqMessage.getHeader(SCMPHeaderAttributeKey.SESSION_INFO);
    int noiInSecs = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.NO_DATA_INTERVAL);
    int noiInMillis = noiInSecs * Constants.SEC_TO_MILLISEC_FACTOR;
    // create temporary subscription
    Subscription tmpSubscription = new Subscription(subscriptionMask, sessionInfo, ipAddressList, noiInMillis, AppContext
View Full Code Here

            writer.writeEndElement();
            continue;
          }
          if (value instanceof SubscriptionMask) {
            writer.writeStartElement("subscriptionMask");
            SubscriptionMask subscriptionMask = (SubscriptionMask) value;
            writer.writeCData(subscriptionMask.getValue());
            writer.writeEndElement();
            continue;
          }
          if (value instanceof PublishMessageQueue<?>) {
            writer.writeStartElement("subscriptionQueue");
View Full Code Here

    ipAddressList = ipAddressList + Constants.SLASH + request.getRemoteSocketAddress().getAddress().getHostAddress();
    reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);

    String mask = reqMessage.getHeader(SCMPHeaderAttributeKey.MASK);
    SubscriptionMask subscriptionMask = new SubscriptionMask(mask);
    String sessionInfo = reqMessage.getHeader(SCMPHeaderAttributeKey.SESSION_INFO);
    int noiInSecs = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.NO_DATA_INTERVAL);
    int noiInMillis = noiInSecs * Constants.SEC_TO_MILLISEC_FACTOR;
    // create temporary subscription
    Subscription tmpSubscription = new Subscription(subscriptionMask, sessionInfo, ipAddressList, noiInMillis, AppContext
View Full Code Here

        publishMessageQueue.unsubscribe(cascSubscription.getId());
        cascSubscription.getServer().removeSession(cascSubscription);
        SubscriptionLogger.logUnsubscribe(serviceName, cascSubscription.getId());
      } else {
        // unsubscribe made by cascaded SC on behalf of his clients
        SubscriptionMask cascSCMask = new SubscriptionMask(cascadedSCMask);
        publishMessageQueue.changeSubscription(cascSubscription.getId(), cascSCMask);
        cascSubscription.setMask(cascSCMask);
        SubscriptionLogger.logChangeSubscribe(serviceName, cascSubscription.getId(), cascadedSCMask);
      }
      CscUnsubscribeCallbackForCasc callback = new CscUnsubscribeCallbackForCasc(request, response, responderCallback,
          cascSubscription);
      cascadedSC.cascadedSCUnsubscribe(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      // delete unreferenced nodes in queue
      publishMessageQueue.removeNonreferencedNodes();
      return;
    default:
      // code for other types of services is below
      break;
    }

    if (cascadedSCMask == null) {
      // unsubscribe made by cascaded SC on behalf of his last client
      this.subscriptionRegistry.removeSubscription(cascSubscription.getId());
      publishMessageQueue.unsubscribe(cascSubscription.getId());
      cascSubscription.getServer().removeSession(cascSubscription);
      SubscriptionLogger.logUnsubscribe(serviceName, cascSubscription.getId());

      if (reqMessage.getSessionId() == null) {
        // no session id set, cascadedSC unsubscribe on his own because of an error
        SCMPMessage reply = new SCMPMessage(reqMessage.getSCMPVersion());
        reply.setIsReply(true);
        reply.setServiceName(serviceName);
        reply.setMessageType(getKey());
        // no need to forward to server
        response.setSCMP(reply);
        responderCallback.responseCallback(request, response);
        // delete unreferenced nodes in queue
        publishMessageQueue.removeNonreferencedNodes();
        this.abortCascSubscriptions(cascSubscription, reqMessage);
        return;
      }
    } else {
      // unsubscribe made by cascaded SC on behalf of his clients
      SubscriptionMask cascSCMask = new SubscriptionMask(cascadedSCMask);
      publishMessageQueue.changeSubscription(cascSubscription.getId(), cascSCMask);
      cascSubscription.setMask(cascSCMask);
      SubscriptionLogger.logChangeSubscribe(serviceName, cascSubscription.getId(), cascadedSCMask);
    }
    // use server of cascaded client to unsubscribe
View Full Code Here

        queue.unsubscribe(cascSubscription.getId());
        cascSubscription.getServer().removeSession(cascSubscription);
        SubscriptionLogger.logUnsubscribe(serviceName, cascSubscription.getId());
      } else {
        // unsubscribe made by cascaded SC on behalf of a clients, others are left
        SubscriptionMask cascSCMask = new SubscriptionMask(cascadedSCMask);
        queue.changeSubscription(cascSubscription.getId(), cascSCMask);
        cascSubscription.setMask(cascSCMask);
        SubscriptionLogger.logChangeSubscribe(serviceName, cascSubscription.getId(), cascadedSCMask);
      }
      CscAbortSubscriptionCommandCallback callback = new CscAbortSubscriptionCommandCallback(request, response,
          responderCallback, cascSubscription);
      cascadedSC.cascadedSCAbortSubscription(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      return;
    default:
      // code for other types of services is below
      break;
    }
    StatefulServer server = (StatefulServer) cascSubscription.getServer();

    PublishMessageQueue<SCMPMessage> publishMessageQueue = ((IPublishService) cascSubscription.getService()).getMessageQueue();
    if (cascadedSCMask == null) {
      // subscription abort made by cascaded SC on behalf of his last client
      this.subscriptionRegistry.removeSubscription(cascSubscription.getId());
      publishMessageQueue.unsubscribe(cascSubscription.getId());
      cascSubscription.getServer().removeSession(cascSubscription);
      SubscriptionLogger.logUnsubscribe(serviceName, cascSubscription.getId());
    } else {
      // unsubscribe made by cascaded SC on behalf of a clients, others are left
      SubscriptionMask cascSCMask = new SubscriptionMask(cascadedSCMask);
      publishMessageQueue.changeSubscription(cascSubscription.getId(), cascSCMask);
      cascSubscription.setMask(cascSCMask);
      SubscriptionLogger.logChangeSubscribe(serviceName, cascSubscription.getId(), cascadedSCMask);
    }
    // set up abort message
View Full Code Here

TOP

Related Classes of org.serviceconnector.service.SubscriptionMask

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.