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


      boolean rejectSubscriptionFlag = reply.getHeaderFlag(SCMPHeaderAttributeKey.REJECT_SESSION);
      if (rejectSubscriptionFlag == false) {
        // session has not been rejected
        String newMask = reqMessage.getHeader(SCMPHeaderAttributeKey.MASK);
        PublishMessageQueue<SCMPMessage> queue = ((IPublishService) subscription.getService()).getMessageQueue();
        SubscriptionMask mask = new SubscriptionMask(newMask);
        SubscriptionLogger.logChangeSubscribe(serviceName, subscriptionId, newMask);
        queue.changeSubscription(subscriptionId, mask);
        subscription.setMask(mask);
      }
    }
View Full Code Here

      boolean rejectSubscriptionFlag = reply.getHeaderFlag(SCMPHeaderAttributeKey.REJECT_SESSION);
      if (rejectSubscriptionFlag == false) {
        if (tempSubscription.isCascaded() == true) {
          // update csc subscription id list for cascaded subscription
          tempSubscription.addCscSubscriptionId(this.reqMessage.getSessionId(),
              new SubscriptionMask(reqMessage.getHeader(SCMPHeaderAttributeKey.MASK)));
        }
        // subscription has not been rejected, add server to subscription
        PublishMessageQueue<SCMPMessage> publishMessageQueue = ((IPublishService) this.tempSubscription.getService())
            .getMessageQueue();
        ReceivePublicationTimeout crpTimeout = new ReceivePublicationTimeout(publishMessageQueue, noDataIntervalMillis);
        SubscriptionMask subscriptionMask = tempSubscription.getMask();
        publishMessageQueue.subscribe(tempSubscription.getId(), subscriptionMask, crpTimeout);
        // finally add subscription to the registry & schedule subscription timeout internal
        this.subscriptionRegistry.addSubscription(tempSubscription.getId(), tempSubscription);
        SubscriptionLogger.logSubscribe(serviceName, tempSubscription.getId(), subscriptionMask.getValue());
        // forward local subscription no matter what server sends
        reply.setSessionId(tempSubscription.getId());
      } else {
        // subscription has been rejected - remove subscription id from header
        reply.removeHeader(SCMPHeaderAttributeKey.SESSION_ID);
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t01_maskDoesntMatchTest() {
    String clientMask = "000012100012832102FADF-----------X-----------";
    SubscriptionMask clnMask = new SubscriptionMask(clientMask);
    SCMPMessage publishMsg = new SCMPMessage();

    // missing X in mask
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "0000121%%%%%%%%%%%%%%%-----------------------");
    Assert.assertFalse(clnMask.matches(publishMsg));

    // missing X in mask
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "000012100012832102FADF-----------------------");
    Assert.assertFalse(clnMask.matches(publishMsg));
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t10_maskDoesMatchTest() {
    String clientMask = "000012100012832102FADF-----------X-----------";
    SubscriptionMask clnMask = new SubscriptionMask(clientMask);
    SCMPMessage publishMsg = new SCMPMessage();

    // wild card match
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "0000121%%%%%%%%%%%%%%%-----------X-----------");
    Assert.assertTrue(clnMask.matches(publishMsg));

    // mask are equally
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "000012100012832102FADF-----------X-----------");
    Assert.assertTrue(clnMask.matches(publishMsg));
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t01_maskDoesntMatchTest() {
    String clientMask = "000012100012832102FADF-----------X-----------";
    SubscriptionMask clnMask = new SubscriptionMask(clientMask);
    SCMPMessage publishMsg = new SCMPMessage(SCMPVersion.CURRENT);

    // missing X in mask
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "0000121%%%%%%%%%%%%%%%-----------------------");
    Assert.assertFalse(clnMask.matches(publishMsg));

    // missing X in mask
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "000012100012832102FADF-----------------------");
    Assert.assertFalse(clnMask.matches(publishMsg));
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t10_maskDoesMatchTest() {
    String clientMask = "000012100012832102FADF-----------X-----------";
    SubscriptionMask clnMask = new SubscriptionMask(clientMask);
    SCMPMessage publishMsg = new SCMPMessage(SCMPVersion.CURRENT);

    // wild card match
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "0000121%%%%%%%%%%%%%%%-----------X-----------");
    Assert.assertTrue(clnMask.matches(publishMsg));

    // mask are equally
    publishMsg.setHeader(SCMPHeaderAttributeKey.MASK, "000012100012832102FADF-----------X-----------");
    Assert.assertTrue(clnMask.matches(publishMsg));
  }
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

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.