Package org.cipango.kaleo.presence.policy.PolicyManager

Examples of org.cipango.kaleo.presence.policy.PolicyManager.SubHandling


    try
    {
      XcapUri xcapUri = _xcapResources.get(0);
      XcapResource xcapResource = _xcapService.getResource(xcapUri, false, null, null);
      Ruleset ruleset = RulesetDocument.Factory.parse(xcapResource.getSelectedResource().getDom()).getRuleset();
      SubHandling best = null;
      String domain = null;
      if (subscriberUri.indexOf('@') != -1)
        domain = subscriberUri.substring(subscriberUri.indexOf('@') + 1);
     
      for (int i = 0; i < ruleset.getRuleArray().length; i++)
      {
        RuleType rule = ruleset.getRuleArray(i);
        if (match(rule.getConditions(), subscriberUri, domain))
        {
          SubHandling subHandling = getSubHandling(rule.getActions());
          if (best == null || subHandling.getValue() > best.getValue())
            best = subHandling;
        }
      }
      if (best == null)
      {
        for (int i = 0; i < ruleset.getRuleArray().length; i++)
        {
          RuleType rule = ruleset.getRuleArray(i);
          if (matchOma(rule.getConditions(), subscriberUri))
          {
            SubHandling subHandling = getSubHandling(rule.getActions());
            if (best == null || subHandling.getValue() > best.getValue())
              best = subHandling;
          }
        }
      }
      if (best == null)
      {
        for (int i = 0; i < ruleset.getRuleArray().length; i++)
        {
          RuleType rule = ruleset.getRuleArray(i);
          if (matchOmaOtherIdentity(rule.getConditions()))
          {
            SubHandling subHandling = getSubHandling(rule.getActions());
            if (best == null || subHandling.getValue() > best.getValue())
              best = subHandling;
          }
        }
      }
      __log.debug("Got policy " + best + " for subscriber {} and resource {}", subscriberUri, _resourceUri);
View Full Code Here


    else
      subscriberUri = URIUtil.toCanonical(subscribe.getFrom().getURI());
   
    try
    {     
      SubHandling subHandling = _policyManager.getPolicy(subscriberUri, presentity);
      if (subHandling == SubHandling.BLOCK)
      {
        _log.debug("Reject presence subscription from {} to {} due to policy", subscriberUri, presentity.getUri());
        SipServletResponse response = subscribe.createResponse(SipServletResponse.SC_FORBIDDEN);
        response.send();
View Full Code Here

      {
        Iterator<Subscription> it = presentity.getSubscriptions().iterator();
        while (it.hasNext())
        {
          Subscription subscription = it.next();
          SubHandling subHandling = policy.getPolicy(subscription.getUri());
         
          State state = subscription.getState();
          boolean authorised = subscription.isAuthorized();
          switch (subHandling)
          {
View Full Code Here

TOP

Related Classes of org.cipango.kaleo.presence.policy.PolicyManager.SubHandling

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.