Package com.alu.e3.data.model

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


    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



  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

    Map<String, String> props = new HashMap<String,String>();

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

        logger.error("Unable to create log-collection directory: {}", COLLECTION_PATH);
        return 0L;
      }

      // Iterate through all instances in the current topology     
      Instance logCollectorInstance = Utilities.getManagerByIP(CommonTools.getLocalHostname(), CommonTools.getLocalAddress(),  topology.getInstancesByType(E3Constant.E3MANAGER), logger);
      List<Instance> instances = getInstanceList(this.topology);
      if(logger.isDebugEnabled()) {
        logger.debug("There are {} instances in the current topology", instances.size());
      }
      for (Instance logSource : instances) {
View Full Code Here

    // Iterate through all instances in the current topology
    // (Note: use TRACE-level log statements so that our logging doesn't appear in returned log tails)
    List<Instance> instances = getInstanceList(this.topology);
    logger.trace("There are {} instances in the current topology", instances.size());

    Instance collectorInstance;
    try {
      collectorInstance = Utilities.getManagerByIP(CommonTools.getLocalHostname(), CommonTools.getLocalAddress(),  topology.getInstancesByType(E3Constant.E3MANAGER), logger);
    } catch (NonExistingManagerException e) {
      String errMsg = "Cannot find manager at " + CommonTools.getLocalAddress() + " while collecting active logs.";
      logger.error(errMsg);
View Full Code Here

   
    healthCheckFactory.setSpeakers(speakers);
  }
 
  private Instance createInstance(String type, String intIP, String extIP) {
    Instance instance = new Instance();
   
    instance.setType(type);
    instance.setArea("myArea");
    instance.setInternalIP(intIP);
    instance.setExternalIP(extIP);
    instance.setName("myArea:"+type+":"+intIP+":"+extIP);
   
    return instance;
  }
View Full Code Here

  //if more instances are registered with the same InternalIP, only the first is removed

  private void onInstanceRemoved(Instance removedInstance) {
    if (!E3Constant.TDR_COLLECTOR.equals(removedInstance.getType())) return;
    Instance toRemove = null;
    for (Instance currentInstance : TDRCollectors) {
      if (currentInstance.getInternalIP().equals(removedInstance.getInternalIP())) {
        toRemove = currentInstance;
      }
    }
View Full Code Here

          " (" + removedInstance.getInternalIP() + ")");
    }
  }
 
  protected void getMyName() {
    Instance inst = topologyClient.whoAmI(E3Constant.E3GATEWAY);
    if (inst != null) {
      myName = inst.getName();
      if (logger.isDebugEnabled()) {
        logger.debug("I found my name: " + myName);
      }
    }
  }
View Full Code Here

             
              if (!CommonTools.isLocal(localizedGatewayIP))
              {
                /* Get the ssh key. TODO: handle case without sshkey (eg. if user/password provided) */
                // return manager can not be null
                Instance manager = Utilities.getManagerByIP(CommonTools.getLocalHostname(), CommonTools.getLocalAddress(),  topology.getInstancesByType(E3Constant.E3MANAGER), logger);
                SSHKey key = manager.getSSHKey();
                if (key != null) {
                  if(logger.isDebugEnabled()) {
                    logger.debug("using key: " + key.getName());
                  }
                }
View Full Code Here

     
      HashSet<String> instancesNameAlreadyAdded = new HashSet<String>();
     
      for(int i = 0; i < labNodes.getLength(); i++)
      {
        Instance instance = new Instance();
        Node node = labNodes.item(i);

        instance.setName(node.getAttributes().getNamedItem("name").getTextContent());
       
        if (instancesNameAlreadyAdded.contains(instance.getName()))
        {
          throw new TopologyParserException("Each node name in the topology configuration file must be unique. The name " + instance.getName() + "is set to more than one node");
        }

        for(int j = 0; j < node.getChildNodes().getLength(); j++)
        {
          Node child = node.getChildNodes().item(j);
          if(child.getNodeName().equals("Type"))
          {
            instance.setType(child.getAttributes().getNamedItem("type").getTextContent());
          }
          else if(child.getNodeName().equals("ExternalDNS"))
          {
            instance.setExternalDNS(child.getAttributes().getNamedItem("url").getTextContent());
          }
          else if(child.getNodeName().equals("ExternalIP"))
          {
            instance.setExternalIP(child.getAttributes().getNamedItem("ip").getTextContent());
          }
          else if(child.getNodeName().equals("InternalIP"))
          {
            instance.setInternalIP(child.getAttributes().getNamedItem("ip").getTextContent());
          }
          else if(child.getNodeName().equals("Port"))
          {
            instance.setPort(child.getAttributes().getNamedItem("port").getTextContent());
          }
          else if(child.getNodeName().equals("Area"))
          {
            instance.setArea(child.getAttributes().getNamedItem("name").getTextContent());
            topology.getAreas().add(child.getAttributes().getNamedItem("name").getTextContent());
         
          else if(child.getNodeName().equals("Credentials"))
          {
            if (child.getAttributes().getNamedItem("key") != null) {
              instance.setSSHKeyName(child.getAttributes().getNamedItem("key").getTextContent());
              instance.setSSHKey(topology.getKeys().get(instance.getSSHKeyName()));
            }
            if (child.getAttributes().getNamedItem("user") != null) {
              instance.setUser(child.getAttributes().getNamedItem("user").getTextContent());
            }
            if (child.getAttributes().getNamedItem("password") != null) {
              instance.setPassword(child.getAttributes().getNamedItem("password").getTextContent());
            }
          }
          else if(child.getNodeName().equals("KeyUsed"))
          {
            if (child.getAttributes().getNamedItem("key") != null) {
              instance.setSSHKeyName(child.getAttributes().getNamedItem("key").getTextContent());
              instance.setSSHKey(topology.getKeys().get(instance.getSSHKeyName()));
            }
            if (child.getAttributes().getNamedItem("user") != null) {
              instance.setUser(child.getAttributes().getNamedItem("user").getTextContent());
            }
            if (child.getAttributes().getNamedItem("password") != null) {
              instance.setPassword(child.getAttributes().getNamedItem("password").getTextContent());
            }
          }
         
        }

        logger.debug(instance.toString());
       
        topology.addInstance(instance);
      }
     
      return topology;
View Full Code Here

TOP

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

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.