public void cargarConfiguracion() throws ConfiguracionException {

    try {
      SAXBuilder builder = new SAXBuilder();
      File xmlFile = new File(this.getPathConfig());
      Document document = (Document) builder.build(xmlFile);
      Element rootNode = document.getRootElement();
      this.setHoraUnificador(Integer.valueOf(rootNode.getChildText("horaUnificador")));
      this.setMinutoUnificador(Integer.valueOf(rootNode.getChildText("minutoUnificador")));
      this.setManianaOTardeUnificador(rootNode.getChildText("manianaOTardeUnificador"));

      this.setSmtp(rootNode.getChildText("smtp"));
      this.setPuerto(rootNode.getChildText("puerto"));
      this.setDesdeMail(rootNode.getChildText("desde"));
      this.setTLS(Boolean.valueOf(rootNode.getChildText("tls")));
      this.setAuth(Boolean.valueOf(rootNode.getChildText("auth")));
      this.setUser(rootNode.getChildText("user"));
      this.setPassword(rootNode.getChildText("password"));

      this.setIpBD(rootNode.getChildText("ipBD"));
      this.setPortBD(rootNode.getChildText("portBD"));

      this.setPathTempImages(rootNode.getChildText("pathTempImages"));
      this.setPathExportDesign(rootNode.getChildText("pathExportDesign"));
      this.setPathConfig(rootNode.getChildText("pathConfig"));
      this.setPathDownloadApp(rootNode.getChildText("pathDownloadApp"));
      this.setKeyGoogleMap(rootNode.getChildText("keyGoogleMap"));

    } catch (Exception e) {
      LogFwk.getInstance(Configuracion.class)
          .error("Error al leer el archivo de configuracion. Detalle: " + e.getMessage());
      throw new ConfiguracionException(
          "Error al leer el archivo de configuracion. Detalle: " + e.getMessage());
    }
  }
Exemplo n.º 2
0
 // get licensing features, with appropriate defaults
 @SuppressWarnings("unchecked")
 private void loadLicensingFeatures(Element licensingElt) {
   List<LicensingFeature> licensingFeats = new ArrayList<LicensingFeature>();
   boolean containsLexFeat = false;
   if (licensingElt != null) {
     for (Iterator<Element> it = licensingElt.getChildren("feat").iterator(); it.hasNext(); ) {
       Element featElt = it.next();
       String attr = featElt.getAttributeValue("attr");
       if (attr.equals("lex")) containsLexFeat = true;
       String val = featElt.getAttributeValue("val");
       List<String> alsoLicensedBy = null;
       String alsoVals = featElt.getAttributeValue("also-licensed-by");
       if (alsoVals != null) {
         alsoLicensedBy = Arrays.asList(alsoVals.split("\\s+"));
       }
       boolean licenseEmptyCats = true;
       boolean licenseMarkedCats = false;
       boolean instantiate = true;
       byte loc = LicensingFeature.BOTH;
       String lmc = featElt.getAttributeValue("license-marked-cats");
       if (lmc != null) {
         licenseMarkedCats = Boolean.valueOf(lmc).booleanValue();
         // change defaults
         licenseEmptyCats = false;
         loc = LicensingFeature.TARGET_ONLY;
         instantiate = false;
       }
       String lec = featElt.getAttributeValue("license-empty-cats");
       if (lec != null) {
         licenseEmptyCats = Boolean.valueOf(lec).booleanValue();
       }
       String inst = featElt.getAttributeValue("instantiate");
       if (inst != null) {
         instantiate = Boolean.valueOf(inst).booleanValue();
       }
       String locStr = featElt.getAttributeValue("location");
       if (locStr != null) {
         if (locStr.equals("target-only")) loc = LicensingFeature.TARGET_ONLY;
         if (locStr.equals("args-only")) loc = LicensingFeature.ARGS_ONLY;
         if (locStr.equals("both")) loc = LicensingFeature.BOTH;
       }
       licensingFeats.add(
           new LicensingFeature(
               attr, val, alsoLicensedBy, licenseEmptyCats, licenseMarkedCats, instantiate, loc));
     }
   }
   if (!containsLexFeat) {
     licensingFeats.add(LicensingFeature.defaultLexFeature);
   }
   _licensingFeatures = new LicensingFeature[licensingFeats.size()];
   licensingFeats.toArray(_licensingFeatures);
 }