Package org.serviceconnector.service

Examples of org.serviceconnector.service.CascadedPublishService


    // update csc subscription id list for cascaded subscription
    cascSubscription.removeCscSubscriptionId(reqMessage.getSessionId());

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      // publish service is cascaded
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();

      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());
      } 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
View Full Code Here


    // update csc subscription id list for cascaded subscription
    cascSubscription.removeCscSubscriptionId(reqMessage.getSessionId());

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      // publish service is cascaded
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();

      PublishMessageQueue<SCMPMessage> queue = ((IPublishService) cascSubscription.getService()).getMessageQueue();
      if (cascadedSCMask == null) {
        // subscription abort made by cascaded SC on behalf of his last client
        this.subscriptionRegistry.removeSubscription(cascSubscription.getId());
        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;
    }
View Full Code Here

    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      // publish service is cascaded
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      ClnChangeSubscriptionCommandCallback callback = new ClnChangeSubscriptionCommandCallback(request, response,
          responderCallback, subscription);
      cascadedSC.cascadedSCChangeSubscription(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      return;
    default:
      // code for other types of services is below
      break;
    }
View Full Code Here

    this.subscriptionRegistry.removeSubscription(subscription);
    publishMessageQueue.unsubscribe(subscriptionId);

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      // publish service is cascaded
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      // free server from subscription
      cascadedSC.removeSession(subscription);
      ClnUnsubscribeCommandCallback callback = new ClnUnsubscribeCommandCallback(request, response, responderCallback,
          subscription);
      cascadedSC.cascadedSCUnsubscribe(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      return;
    default:
      // code for other types of services is below
      break;
    }
View Full Code Here

    reqMessage.setHeader(SCMPHeaderAttributeKey.IP_ADDRESS_LIST, ipAddressList);
    int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      // publish service is cascaded
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      CscChangeSubscriptionCallbackForCasc callback = new CscChangeSubscriptionCallbackForCasc(request, response,
          responderCallback, cascSubscription, cascadedSCMask);
      cascadedSC.cascadedSCChangeSubscription(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      return;
    default:
      // code for other types of services is below
      break;
    }
View Full Code Here

    tmpCascSCSubscription.setService(abstractService);

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      // publish service is cascaded
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      // add server to subscription
      tmpCascSCSubscription.setServer(cascadedSC);

      ISubscriptionCallback callback = null;
      if (cscSubscription == null) {
        // cascaded SC not subscribed yet
        callback = new SubscribeCommandCallback(request, response, responderCallback, tmpCascSCSubscription);
      } else {
        // subscribe is made by an active cascaded SC
        callback = new CscChangeSubscriptionCallbackForCasc(request, response, responderCallback, cscSubscription,
            cscSCMaskString);
      }
      cascadedSC.cascadedSCSubscribe(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      return;
    default:
      // code for other types of services is below
      break;
    }
View Full Code Here

   *             the exception
   */
  private void subscribeCascadedSCWithInActiveCascadedClient(CascadedClient cascClient, SCMPMessage msgToForward,
      ISubscriptionCallback callback, int oti) throws Exception {
    // cascaded client not subscribed - subscribe
    CascadedPublishService cascPublishService = cascClient.getPublishService();
    // adapt NO_DATA_INTERVAL for cascaded client
    msgToForward.setHeader(SCMPHeaderAttributeKey.NO_DATA_INTERVAL, cascPublishService.getNoDataIntervalSeconds());
    SCMPCscSubscribeCall cscSubscribeCall = new SCMPCscSubscribeCall(this.requester, msgToForward);

    // set cascaded mask in message
    String tmpCscMask = msgToForward.getHeader(SCMPHeaderAttributeKey.CASCADED_MASK);
    if (tmpCscMask == null) {
View Full Code Here

   */
  @Override
  public void abortSession(AbstractSession session, String reason) {
    if (session instanceof Subscription) {
      Subscription subscription = (Subscription) session;
      CascadedPublishService casService = (CascadedPublishService) subscription.getService();

      PublishMessageQueue<SCMPMessage> publishMessageQueue = casService.getMessageQueue();
      // unsubscribe subscription
      publishMessageQueue.unsubscribe(subscription.getId());
      publishMessageQueue.removeNonreferencedNodes();

      CascadedClient cascClient = casService.getCascClient();
      // remove timed out subscription id from client subscription list
      cascClient.removeClientSubscriptionId(subscription.getId());

      if (cascClient.isDestroyed() == true) {
        // cascaded client got destroyed - do not continue
        return;
      }

      long msgSeqNr = cascClient.getMsgSequenceNr().incrementAndGetMsgSequenceNr();
      IRequest request = new NettyHttpRequest(null, null, null);
      SCMPMessage abortMessage = new SCMPMessage();
      abortMessage.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSeqNr);
      abortMessage.setHeader(SCMPHeaderAttributeKey.SERVICE_NAME, casService.getName());
      // cascaded id will be set in following (cascadedSCAbortSubscription) method
      request.setMessage(abortMessage);

      if (subscription.isCascaded() == true) {
        // XAB procedure for casc subscriptions
View Full Code Here

    reqMessage.setSessionId(tmpSubscription.getId());

    switch (abstractService.getType()) {
    case CASCADED_PUBLISH_SERVICE:
      // publish service is cascaded
      CascadedPublishService cascadedPublishService = (CascadedPublishService) abstractService;
      CascadedSC cascadedSC = cascadedPublishService.getCascadedSC();
      // add server to subscription
      tmpSubscription.setServer(cascadedSC);
      // service is cascaded - subscribe is made by a normal client
      SubscribeCommandCallback callback = new SubscribeCommandCallback(request, response, responderCallback, tmpSubscription);
      cascadedSC.cascadedSCSubscribe(cascadedPublishService.getCascClient(), reqMessage, callback, oti);
      return;
    default:
      // code for other types of services is below
      break;
    }
View Full Code Here

      if (noData == false) {
        // message received,insert in queue
        LOGGER.debug("receive publication for cascaded client put message in queue service=" + cascClient.getServiceName()
            + " sid=" + sid);

        CascadedPublishService publishService = cascClient.getPublishService();
        if (publishService.getType() == ServiceType.CASCADED_CACHE_GUARDIAN) {
          // Managed data arrived over cache guardian - handle caching
          AppContext.getSCCache().cacheManagedData(reply);
        }
        PublishMessageQueue<SCMPMessage> publishMessageQueue = this.cascClient.getPublishService().getMessageQueue();
        publishMessageQueue.insert(reply);
View Full Code Here

TOP

Related Classes of org.serviceconnector.service.CascadedPublishService

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.