Package com.alu.e3.topology.model

Examples of com.alu.e3.topology.model.Topology


    StaticTdr s = new StaticTdr();
    s.setValue          (tdrStaticRule.getValue());
    s.setTdrPropName      (tdrStaticRule.getTdrPropName());
    s.setPropertyName      (tdrStaticRule.getPropertyName());

    TdrType tdrType = new TdrType();
    s.setTypes          (tdrType);
    tdrType.getType().addAll  (tdrStaticRule.getTypes());

    return s;
  }
View Full Code Here


    DynamicTdr s = new DynamicTdr();
    s.setHttpHeaderName      (tdrDynamicRule.getHttpHeaderName());
    s.setTdrPropName      (tdrDynamicRule.getTdrPropName());
    s.setExtractFrom      (tdrDynamicRule.getExtractFrom());

    TdrType tdrType = new TdrType();
    s.setTypes          (tdrType);
    tdrType.getType().addAll  (tdrDynamicRule.getTypes());

    return s;
  }
View Full Code Here

  private static final Validation fromDataModel(com.alu.e3.data.model.sub.Validation val) {
    if (val == null)
      return null;

    Validation rVal = new Validation();

    if (val.getXml() != null) {
      rVal.setXml(new Validation.Xml());
    }
    if (val.getSchema() != null) {
      rVal.setSchema(fromDataModel(val.getSchema()));
    }

    if (val.getSoap() != null) {
      rVal.setSoap(new Validation.Soap(com.alu.e3.prov.restapi.model.SoapVersionEnum.fromValue(val.getSoap().getVersion().value())));
    }

    return rVal;
  }
View Full Code Here

   
    return perfWatch;
  }
 
  public TdrStreamWriter(File dir) throws TransformerConfigurationException {
    this(new RotatableFileWriterProvider(dir, TDR_FILE_SIZE, TDR_FILE_AGE) {
      @Override
      protected String getFileName() {
        return "tdrs." + System.currentTimeMillis() + ".xml";   // TDR file name
      }
View Full Code Here

   
    topologyWatcher.setPollingInterval(POLLING_INTERVAL);
   
    topologyClient = new DummyTopologyClient();
   
    healthCheckFactory = new DummyHealthCheckFactory();
   
    setHealthCheckGateways(gatewayList);
    setHealthCheckGatewaysActive(gatewayActiveList);
    setHealthCheckSpeakers(activeSpeakerList);
   
View Full Code Here

  private void createTestResources(String[] gatewayList, String[] gatewayActiveList, String[] activeSpeakerList) {
    topologyWatcher = new TopologyWatcher();
   
    topologyWatcher.setPollingInterval(POLLING_INTERVAL);
   
    topologyClient = new DummyTopologyClient();
   
    healthCheckFactory = new DummyHealthCheckFactory();
   
    setHealthCheckGateways(gatewayList);
    setHealthCheckGatewaysActive(gatewayActiveList);
View Full Code Here

   
    return instance;
  }
 
  private void createTestResources(String[] gatewayList, String[] gatewayActiveList, String[] activeSpeakerList) {
    topologyWatcher = new TopologyWatcher();
   
    topologyWatcher.setPollingInterval(POLLING_INTERVAL);
   
    topologyClient = new DummyTopologyClient();
   
View Full Code Here

    StringBuffer warnings = new StringBuffer();


    try {
     
      Topology tmpTopology = topology.getTopologyFromFile(srcTopologyFile.getAbsolutePath());
     
      if(logger.isDebugEnabled()) {
        logger.debug("Installing E3 on all topology targets ...");
      }
     
View Full Code Here

   
    return parse(fin);
  }
 
  public Topology parse(InputStream topologyInputStream) throws TopologyParserException, UnsupportedEncodingException {
    Topology topology = null;
    Element rootElement = getRootElement(topologyInputStream);
   
    String type = rootElement.getAttribute("type");
    if(logger.isDebugEnabled()) {
      logger.debug("Topology type: " + type);
View Full Code Here

 
  class CommonTopologyParser extends TopologyParser {
   
    @Override
    Topology parseElement(Element rootElement) throws TopologyParserException, UnsupportedEncodingException {
      Topology topology = new Topology();
     
      // Finding keypair to use
      NodeList keyNodes = rootElement.getElementsByTagName("Key");
      if(logger.isDebugEnabled()) {
        logger.debug("Found " + keyNodes.getLength() + " SSH keys");
      }
      for(int i = 0; i < keyNodes.getLength(); i++)
      {
        Element keyElement = (Element) keyNodes.item(i);
        if(keyElement == null) {
          continue;
        }
 
        String strPrivateKey = "", strPublicKey = "";
        String strKeyName = keyElement.getAttribute("name");
        String privateKeyPath = keyElement.getAttribute("privatekeypath");
        if (privateKeyPath != null && !privateKeyPath.isEmpty())
        {
          String strKeyFormat = keyElement.getAttribute("format");
          privateKeyPath += File.separatorChar + strKeyName + "." + strKeyFormat;
         
          try {
            StringBuffer fileContent = new StringBuffer(1000);
                BufferedReader br = new BufferedReader(new FileReader(privateKeyPath));
                char[] buf = new char[1024];
                int nRead=0;
                while((nRead=br.read(buf)) != -1){
                  fileContent.append(buf, 0, nRead);
                }
                br.close();
                strPrivateKey = fileContent.toString();
                 
                 
          } catch (Exception e) {
            if(logger.isErrorEnabled()) {
              logger.error(e.getMessage());
            }
            throw new TopologyParserException(e.getMessage());
          }
        } 
        else
        {
          NodeList privateKeyNode = keyElement.getElementsByTagName("PrivateKey");
          strPublicKey = keyElement.getElementsByTagName("PublicKey").item(0).getTextContent();
          strPrivateKey = (privateKeyNode == null || privateKeyNode.getLength() == 0) ? null : privateKeyNode.item(0).getTextContent();
        }

        SSHKey key = new SSHKey(strKeyName, strPrivateKey == null ? null : strPrivateKey.getBytes("UTF-8"), strPublicKey.getBytes("UTF-8"));
        topology.addKey(key);
       
        if(logger.isDebugEnabled()) {
          logger.debug(key.toString());
        }
      }
     

      NodeList labNodes = rootElement.getElementsByTagName("Node");
      if(logger.isDebugEnabled()) {
        logger.debug("Found " + labNodes.getLength() + " nodes in this topology");
      }
     
      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.topology.model.Topology

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.