Package com.alu.e3.data.model

Examples of com.alu.e3.data.model.ApiJar


  public void process(Exchange exchange) throws Exception {
    Api api = this.dataManager.getApiById(apiId, false);
    HttpServletRequest request = (HttpServletRequest) exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST);
    //retrieve the real IP adress from the request
    String remoteAddr = CommonTools.remoteAddr(request);
    CanonicalizedIpAddress ip = new CanonicalizedIpAddress(remoteAddr);
    if(this.dataManager.isIpAllowed(api, ip.getIp())) {
      exchange.setProperty(ExchangeConstantKeys.E3_API.toString(), api);   
    }
    else {
      Exception exception = new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Not Authorized from this IP address");
      exchange.setException(exception);     
View Full Code Here


    this.apiId = apiId;
  }
 
  @Override
  public void process(Exchange exchange) throws Exception {
    Api api = this.dataManager.getApiById(apiId, false);
    HttpServletRequest request = (HttpServletRequest) exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST);
    //retrieve the real IP adress from the request
    String remoteAddr = CommonTools.remoteAddr(request);
    CanonicalizedIpAddress ip = new CanonicalizedIpAddress(remoteAddr);
    if(this.dataManager.isIpAllowed(api, ip.getIp())) {
View Full Code Here

    Map<String, String> properties = (Map<String,String>) exchange.getProperty(ExchangeConstantKeys.E3_MODEL_PROPERTIES.toString());
    if(properties == null)
      properties = new HashMap<String, String>();

    // First add the TDRs from the API
    Api api = identity.getApi();
    if (api != null)
      if(doStatic)
        processTdrGenerationRuleStatic(api.getTdrGenerationRule(), exchange, properties);
      else
        processTdrGenerationRuleDynamic(api.getTdrGenerationRule(), exchange, properties, efType);

    // Next add all of the tdr values for the Policies
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
View Full Code Here

      api.setTdr(new TdrData());
    }
  }

  protected void deployApi(Api api, ExchangeData exchange) throws RollbackException, ProvisionException {
    ApiJar oldApiJar = null;
    try {
      oldApiJar = dataManager.getApiJar(api.getId());

      byte[] apiNewJarBytes = apiBuilder.build(api, exchange);

      if (apiNewJarBytes != null) {
        deploymentManager.deployApi(exchange, apiNewJarBytes);
      } else {
        LOG.error("No Jar data created for for Api ID: " + api.getId());
      }
    } catch (DeploymentException e) {
      LOG.error("Deployment failed for Api ID: " + api.getId(), e);

      deploymentManager.undeployApi(exchange, api.getId());

      // Roll back old API
      if (oldApiJar != null) {
        try {
          // Deploy N-1 jar
          deploymentManager.deployApi(exchange, oldApiJar.getData());
          // throw this status for error mgmt 
          throw new RollbackException(ApplicationCodeConstants.ROUTE_CREATION_FAILED_ROLLBACK_OK, "Route edition failed, rollback ok.");

        } catch (DeploymentException e1) {         
          throw new RollbackException(ApplicationCodeConstants.ROLLBACK_FAILED, "Second try deployment, give up", e1);
View Full Code Here

   
    // A location which will identify the bundle in the bundle context
    String location = BUNDLE_LOCATION_URI_PREFIX + event.getKey();
   
    // The ApiJar object extracted from the event, containing the queueName to post ACKs and bundle's data
    ApiJar jar = event.getValue();
   
    // Start bundle installation
    handleAddOrUpdateEvent(location, jar, event.getKey());
    if(logger.isDebugEnabled()) { 
      logger.debug("[EntryAdded] Finished handling event for apiId " + event.getKey());
View Full Code Here

   
    // A location which will identify the bundle in the bundle context
    String location = BUNDLE_LOCATION_URI_PREFIX + event.getKey();
   
    // The ApiJar object extracted from the event, containing the queueName to post ACKs and bundle's data
    ApiJar jar = event.getValue();
   
    // Start bundle update
    handleAddOrUpdateEvent(location, jar, event.getKey());
   
    if(logger.isDebugEnabled()) {
View Full Code Here

  // Gateways are listening on cachingTableApiJars map to be
  // notified of bundle updates through cache mechanism
  //----------------------------------------------------------------
  @Override
  public boolean deployApi(String apiId, byte[] jarData) {
    ApiJar data = new ApiJar();
    data.setId(apiId);
    data.setData(jarData);
    boolean result = cachingTableApiJars.set(apiId, data);
    return result;
  }
View Full Code Here

    return cachingTableApiJars.get(apiId);
  }

  @Override
  public boolean undeployApi(String apiId) {
    ApiJar undeployed = cachingTableApiJars.remove(apiId);
    return undeployed != null;
  }
View Full Code Here


  protected List<CallDescriptor> checkSubscriberIdAuth(String subscriberId, AuthIdentity authIdentity) throws GatewayException {

    // Get subscriber matching CallDescriptors
    Auth auth;
    try {
      auth = dataManager.getAuthById(subscriberId);
    } catch (InvalidIDException e) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, e.getMessage() );
    }

    if (auth == null || !auth.getStatus().isActive()) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Authorization status is invalid");
    }

    return   dataManager.getMatchingPolicies(authIdentity.getApi(), auth);
View Full Code Here

          processTdrGenerationRuleDynamic(policy.getTdrGenerationRule(), exchange, properties, efType);
      }
    }

    // Finally add the values from the Auth
    Auth auth = identity.getAuth();
    if(auth != null)
      if(doStatic)
        processTdrGenerationRuleStatic(auth.getTdrGenerationRule(), exchange, properties);
      else
        processTdrGenerationRuleDynamic(auth.getTdrGenerationRule(), exchange, properties, efType);
  }
View Full Code Here

TOP

Related Classes of com.alu.e3.data.model.ApiJar

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.