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

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


              usedBucketIds.add(bucketId);
              ok2 = true;
            }
          }

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


        int idx = (int)(Math.random() * Integer.MAX_VALUE);
        Integer contextId = Integer.valueOf(idx);
        if (!cachingTableContext.containsKey(contextId)) {
          ctx.setContextId(contextId);
          ctx.setCreatedDate(new Date());
          cachingTableContext.set(contextId, new ContextWrapper(ctx));
          policy.getContextIds().add(contextId);
          ok = true;
        }
      }
    }
View Full Code Here

  }

  @Override
  public APIContext getApiContextById(Integer id) {

    ContextWrapper ctx = cachingTableContext.get(id);

    if (ctx == null)
      throw new IllegalArgumentException("There is no Context available with that ID");

    return ctx.getApiContext();
  }
View Full Code Here

  }

  @Override
  public Context getPolicyContextById(Integer id) {

    ContextWrapper ctx = cachingTableContext.get(id);

    if (ctx == null)
      throw new IllegalArgumentException("There is no Context available with that ID");

    return ctx.getPolicyContext();
  }
View Full Code Here

  public void fillLimitsById(Integer contextId, Limit limit) {

    if (limit == null)
      throw new IllegalArgumentException("Limit must not be null");

    ContextWrapper ctx = cachingTableContext.get(contextId);

    if (ctx == null)
      throw new IllegalArgumentException("There is no limit available with that ID");

    if (ctx.getApiContext() != null) {
      // It's an API Context
      limit.setQuotaPerDay(null);
      limit.setQuotaPerWeek(null);
      limit.setQuotaPerMonth(null);
      limit.setRateLimitPerMinute(new Counter(ctx.getApiContext().getMaxRateLimitTPMWarning(), ctx.getApiContext().getMaxRateLimitTPMThreshold()));
      limit.setRateLimitPerSecond(new Counter(ctx.getApiContext().getMaxRateLimitTPSWarning(), ctx.getApiContext().getMaxRateLimitTPSThreshold()));
    }

    if (ctx.getPolicyContext() != null) {
      // It's a Policy Context
      limit.setQuotaPerDay(ctx.getPolicyContext().getQuotaPerDay());
      limit.setQuotaPerWeek(ctx.getPolicyContext().getQuotaPerWeek());
      limit.setQuotaPerMonth(ctx.getPolicyContext().getQuotaPerMonth());
      limit.setRateLimitPerMinute(ctx.getPolicyContext().getRateLimitPerMinute());
      limit.setRateLimitPerSecond(ctx.getPolicyContext().getRateLimitPerSecond());
      limit.setCreatedDate(ctx.getPolicyContext().getCreatedDate());
    }
  }
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.ContextWrapper

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.