Package com.alu.e3.data.model.sub

Examples of com.alu.e3.data.model.sub.ApiIds


    props.putAll(identity.getApi().getProperties());
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        props.putAll(policy.getProperties());
      }
    }

    if(identity.getAuth() != null)
      props.putAll(identity.getAuth().getProperties());
View Full Code Here


    // Next add all of the tdr values for the Policies
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        if(doStatic)
          processTdrGenerationRuleStatic(policy.getTdrGenerationRule(), exchange, properties);
        else
          processTdrGenerationRuleDynamic(policy.getTdrGenerationRule(), exchange, properties, efType);
      }
    }

    // Finally add the values from the Auth
    Auth auth = identity.getAuth();
View Full Code Here

          }

          cachingTableContext.set(contextId, new ContextWrapper(ctx));
          // If this APIContext is the default one, adding it at index 0 ; this is the place where we're
          // looking for it in getMatchingPolicies
          ApiIds apiIds = new ApiIds(ctx.getId(), ctx.getContextId(), ctx.getBucketId(), ctx.getStatus()==StatusType.ACTIVE);
          if(ctx.isDefaultContext())
            api.getContextIds().add(0, apiIds);
          else
            api.getContextIds().add(apiIds);
View Full Code Here

        if (api.getContextIds().isEmpty() == false) {
          if (result == null)
            result = new ArrayList<CallDescriptor>();

          // Looking for default context, placed at index 0 by addApi
          ApiIds ctx = api.getContextIds().get(0);
          if (ctx.isStatusActive()) {
            if (logger.isDebugEnabled()) {
              logger.debug("Adding CallDescriptor({}, {}, {})", new String[] {
                  null,
                  ""+ctx.getApiContextId(),
                  ""+ctx.getApiBucketId()
                  });
            }
            result.add(new CallDescriptor(null, ctx.getApiContextId(), ctx.getApiBucketId()));
          }
        }
      }
    } else {

      // We have an Auth and an API, check matching policies
      for (AuthIds authCtx : auth.getPolicyContexts()) {

        String policyIdInAuth = authCtx.getPolicyId();

        boolean policyAdded = false;

        // API may be null if Auth is for "Company"
        if (api != null) {
          for (String policyIdInApi : api.getPolicyIds()) {

            // Matching means that the policy is in Auth and API
            if (policyIdInApi.equals(policyIdInAuth)) {
              Policy policy = getPolicyById(policyIdInAuth);
              if (result == null)
                result = new ArrayList<CallDescriptor>();
              if (authCtx.isStatusActive()) {
                if (logger.isDebugEnabled()) {
                  logger.debug("Adding CallDescriptor({}, {}, {})", new String[] {
                      policy.getId(),
                      ""+authCtx.getPolicyContextId(),
                      ""+authCtx.getPolicyBucketId()
                      });
                }
                result.add(new CallDescriptor(policy, authCtx.getPolicyContextId(), authCtx.getPolicyBucketId()));
              }
              policyAdded = true;
            }
          }
        }

        // If the policy wasn't added...
        if (!policyAdded) {
          // Slow, but need to check if that policy has some API attached
          Policy policy = getPolicyById(policyIdInAuth, false);
          if ((policy.getApiIds() == null) || policy.getApiIds().isEmpty()) {
            if (result == null)
              result = new ArrayList<CallDescriptor>();
            if (authCtx.isStatusActive()) {
              result.add(new CallDescriptor(policy, authCtx.getPolicyContextId(), authCtx.getPolicyBucketId()));
            }
          }
        }
      }

      // Now check the apiContext on the auth which is in the list of API
      if (api != null) {
        for (ApiIds ctx : api.getContextIds()) {
          if (ctx.getApiContextName().equals(auth.getApiContext())) {
            if (result == null)
              result = new ArrayList<CallDescriptor>();
            if (ctx.isStatusActive()) {
              if (logger.isDebugEnabled()) {
                logger.debug("Adding CallDescriptor({}, {}, {})", new String[] {
                    null,
                    ""+ctx.getApiContextId(),
                    ""+ctx.getApiBucketId()
                    });
              }
              result.add(new CallDescriptor(null, ctx.getApiContextId(), ctx.getApiBucketId()));
            }
          }
        }
      }
    }
View Full Code Here

      Random r = new Random();
     
      Integer id = new Integer(r.nextInt());
      context.setContextId(id);
      contexts.put(id, context);
      ApiIds ids = new ApiIds(context.getId(), context.getContextId(), 0, true);
      api.getContextIds().add(ids);
    }
  }
View Full Code Here

  }

  private static final LoadBalancing toDataModel(com.alu.e3.prov.restapi.model.LoadBalancing loadBalancing) {
    if (loadBalancing==null) throw new IllegalArgumentException("loadBalancing must not be null");

    LoadBalancing lb = new LoadBalancing();
    lb.setLoadBalancingType(toDataModel(loadBalancing.getLoadBalancingType()));

    if(loadBalancing.getTargetHealthCheck() != null)
      lb.setTargetHealthCheck(toDataModel(loadBalancing.getTargetHealthCheck()));

    if(loadBalancing.getFailOver() != null)
      lb.setFailOver(toDataModel(loadBalancing.getFailOver()));

    return lb;
  }
View Full Code Here

  }

  public static final QuotaRLBucket toDataModel(com.alu.e3.prov.restapi.model.AuthIdsNoIdType authIds) {
    if (authIds==null) throw new IllegalArgumentException("authIds must not be null");

    QuotaRLBucket ids = new QuotaRLBucket();
    ids.getAuthIds().addAll(authIds.getAuthIds());
    ids.setId(authIds.getId());

    return ids;
  }
View Full Code Here

  private static final QuotaRLBucket toDataModel(com.alu.e3.prov.restapi.model.AuthIdsType authIds) {
    if (authIds==null) throw new IllegalArgumentException("authIds must not be null");
    if (authIds.getId()==null) throw new IllegalArgumentException("id must not be null");

    QuotaRLBucket ids = new QuotaRLBucket();
    ids.getAuthIds().addAll(authIds.getAuthIds());
    ids.setId(authIds.getId());

    return ids;
  }
View Full Code Here

    return t;
  }

  private static final SBAuthentication toDataModel(Authentication authentication) {
    if (authentication==null) return null; // throw new IllegalArgumentException("authentication must not be null");
    SBAuthentication s = new SBAuthentication();
    s.setType(authentication.getType());
    for (Key k : authentication.getData().getKey())
      s.getKeys().put(k.getName(), k.getValue());
    return s;
  }
View Full Code Here

  }

  private static final TargetHealthCheck toDataModel(com.alu.e3.prov.restapi.model.TargetHealthCheck targetHealthCheckType) {
    if (targetHealthCheckType==null) throw new IllegalArgumentException("targetHealthCheckType must not be null");

    TargetHealthCheck thc = new TargetHealthCheck();
    thc.setType(targetHealthCheckType.getType());

    return thc;
  }
View Full Code Here

TOP

Related Classes of com.alu.e3.data.model.sub.ApiIds

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.