// Lee la configuracion que se encuentra en conf/RegistryConf
  private void readConfXml() {
    try {
      File inputFile = new File("src/java/Conf/RegistryConf.xml");
      DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
      Document doc = dBuilder.parse(inputFile);
      doc.getDocumentElement().normalize();
      NodeList nList = doc.getElementsByTagName("RegistryConf");
      for (int i = 0; i < nList.getLength(); i++) {
        Node nNode = nList.item(i);
        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
          Element eElement = (Element) nNode;
          RegistryConf reg = new RegistryConf();
          String aux;
          int idSensor;
          int value;
          aux = eElement.getElementsByTagName("idSensor").item(0).getTextContent();
          idSensor = Integer.parseInt(aux);
          reg.setIdSensor(idSensor);

          aux = eElement.getElementsByTagName("saveType").item(0).getTextContent();
          reg.setSaveTypeString(aux);

          aux = eElement.getElementsByTagName("value").item(0).getTextContent();
          value = Integer.parseInt(aux);
          reg.setValue(value);

          registryConf.add(reg);
          lastRead.put(idSensor, 0);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #2
0
 private void deflate(String tmpDir, String path) {
   String tmpFile = "tmp-" + Utils.timestamp() + ".zip";
   try {
     ZipFile zipFile = new ZipFile(tmpFile);
     ZipParameters parameters = new ZipParameters();
     parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
     parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
     parameters.setIncludeRootFolder(false);
     zipFile.addFolder(tmpDir, parameters);
   } catch (Exception e) {
     e.printStackTrace();
     return;
   }
   File from = null;
   File to = null;
   try {
     File target = new File(path);
     if (target.exists()) FileUtils.forceDelete(target);
     from = new File(tmpFile);
     to = new File(path);
     FileUtils.moveFile(from, to);
   } catch (IOException e) {
     Utils.onError(new Error.FileMove(tmpFile, path));
   }
   try {
     FileUtils.deleteDirectory(new File(tmpDir));
   } catch (IOException e) {
     Utils.log("can't delete temporary folder");
   }
 }
  public ArrayList<String> collectLinks(String p) {
    ArrayList<String> PageLinks = new ArrayList<String>();
    try {

      URL url = new URL(p);
      BufferedReader br3 = new BufferedReader(new InputStreamReader(url.openStream()));
      String str = "";
      while (null != (str = br3.readLine())) {
        Pattern link =
            Pattern.compile(
                "<a target=\"_top\" href=\"/m/.*", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
        Matcher match = link.matcher(str);
        while (match.find()) {
          String tmp = match.group();
          int start = tmp.indexOf('/');
          tmp = tmp.substring(start + 1, tmp.indexOf('\"', start + 1));
          if (Crawl.contains("http://www.rottentomatoes.com/" + tmp)
              || ToCrawl.contains("http://www.rottentomatoes.com/" + tmp)
              || PageLinks.contains("http://www.rottentomatoes.com/" + tmp)) continue;
          PageLinks.add("http://www.rottentomatoes.com/" + tmp);
          // bw4.write("http://www.rottentomatoes.com/"+tmp+"\r\n");
        }
      }

      br3.close();
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return PageLinks;
  }
  public String getSelectStr(String kind) {
    try {
      String strSelect = "select " + "\n";
      Node xmlNode = xmlCon.selectSingleNode(xmlDoc, "//db_table");
      NodeList nodelist = null;
      Node tempNode = null;

      if (kind.equals("all")) {
        nodelist =
            xmlCon.selectNodes(
                xmlNode, "//db_table/logical_model/select_clause/logical_column[@dispflg='true']");
      } else if (kind.equals("use_flg")) {
        nodelist =
            xmlCon.selectNodes(
                xmlNode,
                "//db_table/logical_model/select_clause/logical_column[@dispflg='true' and @use_flg='1']");
      }
      // System.out.println(nodelist.getLength());
      for (int i = 0; i < nodelist.getLength(); i++) {
        // Sortが効かないので、番号がついている属性を指定して、SelectSingleNodeする。
        if (kind.equals("all")) {
          tempNode = nodelist.item(i);
        } else if (kind.equals("use_flg")) {
          tempNode =
              xmlCon.selectSingleNode(
                  xmlDoc,
                  "//db_table/logical_model/select_clause/logical_column[@use_order='"
                      + i
                      + "' and @dispflg='true' and @use_flg='1']");
        }
        // System.out.println(tempNode);
        if (tempNode != null) { // 同じ名前が重なる場合はNullとなる。
          if (strSelect.equals("select " + "\n")) {
            strSelect +=
                "     "
                    + xmlCon.selectSingleNode(tempNode, ".//sql").getFirstChild().getNodeValue();
            strSelect +=
                " as "
                    + xmlCon.selectSingleNode(tempNode, ".//name").getFirstChild().getNodeValue()
                    + "\n";
          } else {
            strSelect +=
                "    ,"
                    + xmlCon.selectSingleNode(tempNode, ".//sql").getFirstChild().getNodeValue();
            strSelect +=
                " as "
                    + xmlCon.selectSingleNode(tempNode, ".//name").getFirstChild().getNodeValue()
                    + "\n";
          }
        }
      }
      return strSelect;
    } catch (Exception e) {
      log.error("exception in getSelectStr():\n", e);
      e.printStackTrace();
    }
    return null;
  }
Beispiel #5
0
 public static void main(String[] pArgs) {
   try {
     AppConfig appConfig = new AppConfig(new File(pArgs[0]));
     System.out.println("version: " + appConfig.getAppVersion());
     System.out.println("appname: " + appConfig.getAppName());
   } catch (Exception e) {
     e.printStackTrace(System.err);
   }
 }
 public Document readFile(String filepath) {
   try {
     xmlDoc = xmlCon.readFile(filepath);
     return xmlDoc;
   } catch (Exception e) {
     log.error("exception in readFile():\n", e);
     e.printStackTrace();
   }
   return null;
 }
 public TrackDatabase(InputStream is) throws IOException {
   try {
     createDOM();
     load(is);
   } catch (Exception e) {
     e.printStackTrace();
     if (!(e instanceof IOException)) throw new IOException(e.toString());
     create();
   }
 }
 public String getLimitStr() {
   try {
     String strFrom = " limit 10000 " + "\n";
     return strFrom;
   } catch (Exception e) {
     log.error("exception in getLimitStr():\n", e);
     e.printStackTrace();
   }
   return null;
 }
Beispiel #9
0
 /**
  * Creates an AppConfig using class <code>pAppClass</code> to search for the config file resource.
  * That class must have a resource file <code>AppConfig.xml</code>.
  */
 private AppConfig(InputSource pInputSource) throws InvalidInputException, DataNotFoundException {
   try {
     DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
     Document document = builder.parse(pInputSource);
     mConfigFileDocument = document;
   } catch (Exception e) {
     e.printStackTrace(System.err);
     throw new InvalidInputException("unable to load XML configuration file", e);
   }
 }
 /**
  * Read a DICOM dataset and write an XML representation of it to the standard output, or vice
  * versa.
  *
  * @param arg either one filename of the file containing the DICOM dataset, or a direction
  *     argument (toDICOM or toXML, case insensitive) and an input filename
  */
 public static void main(String arg[]) {
   try {
     boolean bad = true;
     boolean toXML = true;
     String filename = null;
     if (arg.length == 1) {
       bad = false;
       toXML = true;
       filename = arg[0];
     } else if (arg.length == 2) {
       filename = arg[1];
       if (arg[0].toLowerCase(java.util.Locale.US).equals("toxml")) {
         bad = false;
         toXML = true;
       } else if (arg[0].toLowerCase(java.util.Locale.US).equals("todicom")
           || arg[0].toLowerCase(java.util.Locale.US).equals("todcm")) {
         bad = false;
         toXML = false;
       }
     }
     if (bad) {
       System.err.println(
           "usage: XMLRepresentationOfDicomObjectFactory [toDICOM|toXML] inputfile");
     } else {
       if (toXML) {
         AttributeList list = new AttributeList();
         // System.err.println("reading list");
         list.read(filename, null, true, true);
         // System.err.println("making document");
         Document document = new XMLRepresentationOfDicomObjectFactory().getDocument(list);
         // System.err.println(toString(document));
         write(System.out, document);
       } else {
         // long startReadTime = System.currentTimeMillis();
         AttributeList list =
             new XMLRepresentationOfDicomObjectFactory().getAttributeList(filename);
         // System.err.println("AttributeList.main(): read XML and create DICOM AttributeList -
         // done in "+(System.currentTimeMillis()-startReadTime)+" ms");
         String sourceApplicationEntityTitle =
             Attribute.getSingleStringValueOrEmptyString(
                 list, TagFromName.SourceApplicationEntityTitle);
         list.removeMetaInformationHeaderAttributes();
         FileMetaInformation.addFileMetaInformation(
             list, TransferSyntax.ExplicitVRLittleEndian, sourceApplicationEntityTitle);
         list.write(
             System.out,
             TransferSyntax.ExplicitVRLittleEndian,
             true /*useMeta*/,
             true /*useBufferedStream*/);
       }
     }
   } catch (Exception e) {
     e.printStackTrace(System.err);
   }
 }
 private void create() {
   try {
     tracks = new Vector();
     hash = new Hashtable();
     createDOM();
     doc = db.newDocument();
     docElt = doc.createElement(docElementName);
     doc.appendChild(docElt);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public void parse() {
   try {
     // Create SAX Parser factory
     SAXParserFactory spfactory = SAXParserFactory.newInstance();
     // Create SAX Parser
     SAXParser parser = spfactory.newSAXParser();
     // Process XML file by given default handler
     parser.parse(new ByteArrayInputStream(data.getBytes()), new XMLParseContent(result, data));
     // parser.parse(new File("tmp.xml"), new XMLParseRevId(userName,result,data));
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public apiParser(String sdkfile) {
    System.out.println(sdkfile);
    File file = new File(sdkfile);
    try {
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();

      Document doc = db.parse(file);
      NodeList apiList = doc.getElementsByTagName("n1:api");
      NodeList inputList = doc.getElementsByTagName("n1:input");
      NodeList typeList = doc.getElementsByTagName("n1:type");

      for (int i = 0; i < apiList.getLength(); i++) {
        Node api_node = apiList.item(i);
        String api_id = api_node.getAttributes().getNamedItem("id").getNodeValue();
        String api_name = api_node.getAttributes().getNamedItem("name").getNodeValue();
        String input_type_id =
            inputList.item(i).getAttributes().getNamedItem("type_ref").getNodeValue();

        // System.out.println(api_id + " : " + api_name + " : " + input_type_id);
        ArrayList<String> api_params = new ArrayList<String>();

        for (int j = 0; j < typeList.getLength(); j++) {

          if (input_type_id.equalsIgnoreCase(
              typeList.item(j).getAttributes().getNamedItem("id").getNodeValue())) {
            Element e1 = (Element) typeList.item(j);

            NodeList param_l = e1.getElementsByTagName("n1:param");

            for (int k = 0; k < param_l.getLength(); k++) {

              String param_name =
                  param_l.item(k).getAttributes().getNamedItem("name").getNodeValue();
              // String param_desc =
              // param_l.item(k).getAttributes().getNamedItem("desc").getNodeValue();
              api_params.add(param_name);
              // System.out.println(param_name +":"+param_desc);
            }

            break;
          }
        }
        apiRoom s_room = new apiRoom(api_id, api_name, api_params);
        apiRooms.add(s_room);
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  @Override
  public VPackage parse() {

    logger.debug("Starting parsing package: " + xmlFile.getAbsolutePath());

    long startParsing = System.currentTimeMillis();

    try {
      Document document = getDocument();
      Element root = document.getDocumentElement();

      _package = new VPackage(xmlFile);

      Node name = root.getElementsByTagName(EL_NAME).item(0);
      _package.setName(name.getTextContent());
      Node descr = root.getElementsByTagName(EL_DESCRIPTION).item(0);
      _package.setDescription(descr.getTextContent());

      NodeList list = root.getElementsByTagName(EL_CLASS);

      boolean initPainters = false;
      for (int i = 0; i < list.getLength(); i++) {
        PackageClass pc = parseClass((Element) list.item(i));
        if (pc.getPainterName() != null) {
          initPainters = true;
        }
      }

      if (initPainters) {
        _package.initPainters();
      }

      logger.info(
          "Parsing the package '{}' finished in {}ms.\n",
          _package.getName(),
          (System.currentTimeMillis() - startParsing));
    } catch (Exception e) {
      collector.collectDiagnostic(e.getMessage(), true);
      if (RuntimeProperties.isLogDebugEnabled()) {
        e.printStackTrace();
      }
    }

    try {
      checkProblems("Error parsing package file " + xmlFile.getName());
    } catch (Exception e) {
      return null;
    }

    return _package;
  }
  public static void main(String[] args) {
    try {
      DocumentBuilderFactory dBuilderFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder dBuilder = dBuilderFactory.newDocumentBuilder();

      Document document = dBuilder.parse("DOMSample.xml");

      Element rootElement = document.getDocumentElement();

      System.out.println("Root Element's Value : " + rootElement.getTextContent());
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }
Beispiel #16
0
 private String inflate(String path) {
   if (!new File(path).canRead()) {
     Utils.onError(new Error.FileRead(path));
     return null;
   }
   String tmpDir = "tmp-" + Utils.timestamp();
   try {
     ZipFile zipFile = new ZipFile(path);
     zipFile.extractAll(tmpDir);
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   }
   return tmpDir;
 }
  public void CaricamentoFile() {
    DocumentBuilderFactory factory;
    DocumentBuilder parser;
    Document document;
    try {
      factory = DocumentBuilderFactory.newInstance();
      parser = factory.newDocumentBuilder();

      InputStream is = getClass().getClassLoader().getResource("text/caselle.xml").openStream();
      document = parser.parse(is);
      handleDocument(document);
    } catch (Exception ex) {
      System.out.println("Errore." + ex);
      ex.printStackTrace();
    }
  }
 // Guarda registro en la BD
 public boolean saveRegistry(int idSensor, int value) {
   try {
     Registry r = new Registry();
     r.setIdsensor(idSensor);
     r.setValue(value);
     r.setDate(new Date());
     Session session = HibernateUtil.getSessionFactory().openSession();
     Transaction tx = session.beginTransaction();
     session.save(r);
     tx.commit();
     session.close();
     return true;
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
 }
 private int countResults(InputStream s) throws SocketTimeoutException {
   ResultHandler handler = new ResultHandler();
   int count = 0;
   try {
     SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
     //		  ByteArrayInputStream bis = new ByteArrayInputStream(s.getBytes("UTF-8"));
     saxParser.parse(s, handler);
     count = handler.getCount();
   } catch (SocketTimeoutException e) {
     throw new SocketTimeoutException();
   } catch (Exception e) {
     System.err.println("SAX Error");
     e.printStackTrace();
     return -1;
   }
   return count;
 }
 public String getTableSQL(String xmlString) {
   try {
     xmlDoc = xmlCon.toXMLDocument(xmlString);
     String sqlString = "";
     sqlString += getSelectStr("all");
     sqlString += getFromStr();
     sqlString += getWhereStr("", "all");
     sqlString += getGroupByStr("all");
     sqlString += getOrderByStr("all");
     sqlString += getLimitStr();
     return sqlString;
   } catch (Exception e) {
     log.error("exception in getTableSQL():\n", e);
     e.printStackTrace();
   }
   return null;
 }
  // El string debe estar em formato json
  public boolean updateRegistry(String dataJson) {
    try {
      // Crea objeto json con string por parametro
      JSONObject json = new JSONObject(dataJson);
      // Obtiene el array de Registos
      JSONArray arr = json.getJSONArray("Registry");
      // Recorre el array
      for (int i = 0; i < arr.length(); i++) {
        // Obtiene los datos idSensor y value
        int idSensor = arr.getJSONObject(i).getInt("idSensor");

        int value = arr.getJSONObject(i).getInt("value");
        // Recorre la configuracion de registro
        for (RegistryConf reg : registryConf) {

          // Se fija si el registro corresponde a esta configuracion
          if (reg.getIdSensor() == idSensor) {

            // Checkea el criterio para guardar, o no en la BD
            // Checkea tambien si el valor es igual al anterior
            if (reg.getSaveTypeString() == "ONCHANGE" && lastRead.get(idSensor) != value) {
              // Actualizo la ultima lectura y guardo en la BD
              lastRead.put(idSensor, value);
              saveRegistry(idSensor, value);

            } else if (reg.getSaveTypeString() == "ONTIME") {
              // Variables auxiliares, para checkear tiempo
              Long auxLong = System.currentTimeMillis() / 1000;
              int now = auxLong.intValue();
              int timeToSave = lastRead.get(idSensor) + reg.getValue();
              // Checkea si ya es tiempo para guerdar un nuevo registro
              if (now >= timeToSave) {
                // Actualizo el ultimo guardado
                lastRead.put(idSensor, now);
                saveRegistry(idSensor, value);
              }
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return false;
  }
Beispiel #22
0
  /**
   * EPML2PNML
   *
   * @param args String[]
   */
  private static void EPML2PNML(String[] args) {
    if (args.length != 2) {
      System.out.println("���ṩEPML�ļ�·����PNML���Ŀ¼!");
      System.exit(-1);
    }
    epmlImport epml = new epmlImport();
    // load the single epml file
    String filename = args[0];
    try {
      EPCResult epcRes = (EPCResult) epml.importFile(new FileInputStream(filename));
      // convert all epc models to pnml files
      ArrayList<ConfigurableEPC> alEPCs = epcRes.getAllEPCs();
      PnmlExport export = new PnmlExport();
      for (ConfigurableEPC epc : alEPCs) {
        String id = epc.getIdentifier();
        if (id.equals("1An_klol")
            || id.equals("1An_l1y8")
            || id.equals("1Ex_dzq9")
            || id.equals("1Ex_e6dx")
            || id.equals("1Ku_9soy")
            || id.equals("1Ku_a4cg")
            || id.equals("1Or_lojl")
            || id.equals("1Pr_d1ur")
            || id.equals("1Pr_djki")
            || id.equals("1Pr_dkfa")
            || id.equals("1Pr_dl73")
            || id.equals("1Ve_musj")
            || id.equals("1Ve_mvwz")) continue;
        // save pnml files to the same folder
        File outFile = new File(args[1] + "/" + id + ".pnml");
        if (outFile.exists()) continue;
        FileOutputStream fos = new FileOutputStream(outFile);
        PetriNet petri = AMLtoPNML.convert(epc);
        try {
          export.export(new ProvidedObject("PetriNet", new Object[] {petri}), fos);
        } catch (Exception ex1) {
          ex1.printStackTrace(System.out);
        }
      }
    } catch (IOException ex) {
      ex.printStackTrace(System.out);
    }

    System.out.println("EPML Conversion Done");
  }
Beispiel #23
0
 private File getWorkingDirectory(File f) {
   try {
     File workingDir =
         new File(
             Properties.get(Names.WORKING_DIR)
                 + Names.PATH_SEPARATOR
                 + getOpType()
                 + Names.PATH_SEPARATOR
                 + "work"
                 + getNewCount());
     if (!workingDir.exists()) workingDir.mkdirs();
     FileUtil.deleteContents(workingDir);
     return workingDir;
   } catch (Exception ignore) {
     // ++ notify of error - maybe out of disk space
     ignore.printStackTrace();
     return null;
   }
 }
Beispiel #24
0
  /** used for cut and paste. */
  public void addObjectFromClipboard(String a_value) throws CircularIncludeException {
    Reader reader = new StringReader(a_value);
    Document document = null;
    try {
      document = UJAXP.getDocument(reader);
    } catch (Exception e) {
      e.printStackTrace();
      return;
    } // try-catch

    Element root = document.getDocumentElement();
    if (!root.getNodeName().equals("clipboard")) {
      return;
    } // if

    Node child;
    for (child = root.getFirstChild(); child != null; child = child.getNextSibling()) {
      if (!(child instanceof Element)) {
        continue;
      } // if
      Element element = (Element) child;

      IGlyphFactory factory = GlyphFactory.getFactory();

      if (XModule.isMatch(element)) {
        EModuleInvoke module = (EModuleInvoke) factory.createXModule(element);
        addModule(module);
        continue;
      } // if

      if (XContour.isMatch(element)) {
        EContour contour = (EContour) factory.createXContour(element);
        addContour(contour);
        continue;
      } // if

      if (XInclude.isMatch(element)) {
        EIncludeInvoke include = (EIncludeInvoke) factory.createXInclude(element);
        addInclude(include);
        continue;
      } // if
    } // while
  }
Beispiel #25
0
  public static void main(String[] argv) {
    try {
      // SAXパーサーファクトリを生成
      SAXParserFactory spfactory = SAXParserFactory.newInstance();

      // SAXパーサーを生成
      SAXParser parser = spfactory.newSAXParser();

      // XMLファイルを指定されたデフォルトハンドラーで処理します
      String fileName = "dos2unix.mm";

      //      parser.parse(new File("helloworld.xml"), new HelloWorldSax());
      parser.parse(new File(fileName), new HelloWorldSax());

    } catch (Exception e) {

      e.printStackTrace();
    }
  }
Beispiel #26
0
  private static Element readXmlFile(GenericFile file) {
    try {
      BufferedReader reader = new BufferedReader(file.getReader());
      StringBuilder sBuilder = new StringBuilder();
      for (String line = reader.readLine(); line != null; line = reader.readLine()) {
        sBuilder.append(line);
        sBuilder.append("\n");
      }

      DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
      Document doc = dBuilder.parse(new ByteArrayInputStream(sBuilder.toString().getBytes()));
      doc.getDocumentElement().normalize();
      return doc.getDocumentElement();
    } catch (Exception e) {
      e.printStackTrace();
      System.err.println(e.getMessage());
      return null;
    }
  }
  public String getFromStr() {
    try {
      String strFrom = "from " + "\n";
      Node xmlNode = xmlCon.selectSingleNode(xmlDoc, "//db_table");
      NodeList nodelist = xmlCon.selectNodes(xmlNode, "//db_table");

      for (int i = 0; i < nodelist.getLength(); i++) {
        if (i == 0) {
          strFrom += "     " + ((Element) nodelist.item(i)).getAttribute("name") + "\n";
        } else {
          strFrom += "    ," + ((Element) nodelist.item(i)).getAttribute("name") + "\n";
        }
      }
      return strFrom;
    } catch (Exception e) {
      log.error("exception in getFromStr():\n", e);
      e.printStackTrace();
    }
    return null;
  }
Beispiel #28
0
  private static void AML2PNML(String[] args) {
    if (args.length != 3) {
      System.out.println("���ṩAML����Ŀ¼��PNML���Ŀ¼�Լ��ֵ��ļ�!");
      System.exit(-1);
    }
    System.out.println("����Ŀ¼��" + args[0]);
    System.out.println("���Ŀ¼��" + args[1]);
    System.out.println("�ֵ��ļ���" + args[2]);
    // load the dict
    AMLtoPNML.loadDict(args[2]);
    File srcDir = new File(args[0]);
    File[] lstAML = srcDir.listFiles();
    PnmlExport export = new PnmlExport();
    for (int i = 0; i < lstAML.length; i++) {
      if (lstAML[i].isDirectory()) {
        continue;
      }
      System.out.print(lstAML[i].getName() + "==>");
      try {
        FileInputStream fis = new FileInputStream(lstAML[i]);
        int idx = lstAML[i].getName().indexOf(".xml");
        File outFile = new File(args[1] + "/" + lstAML[i].getName().substring(0, idx) + ".pnml");
        FileOutputStream fos = new FileOutputStream(outFile);
        EPCResult epcRes = (EPCResult) AMLtoPNML.importFile(fis);
        ConfigurableEPC epc = epcRes.getMainEPC();
        PetriNet petri = AMLtoPNML.convert(epc);
        export.export(new ProvidedObject("PetriNet", new Object[] {petri}), fos);
        System.out.println(outFile.getName());
      } catch (FileNotFoundException ex) {
        ex.printStackTrace(System.out);
      } catch (IOException ioe) {
        ioe.printStackTrace(System.out);
      } catch (Exception e) {
        e.printStackTrace(System.out);
      }
    }

    System.out.println("Conversion Done");
  }
  public String getJoinTableStr(Node node) {
    try {
      // 複数カラムJoin用のLoop
      String strJoin = "";
      String tableName1 = "";
      String tableName2 = "";

      Node tableNode1 = xmlCon.selectSingleNode(node, ".//table1");
      tableName1 = ((Element) tableNode1).getAttribute("tablename");
      Node tableNode2 = xmlCon.selectSingleNode(node, ".//table2");
      tableName2 = ((Element) tableNode2).getAttribute("tablename");

      NodeList columList1 = xmlCon.selectNodes(tableNode1, ".//join_column");
      NodeList columList2 = xmlCon.selectNodes(tableNode2, ".//join_column");

      for (int i = 0; i < columList1.getLength(); i++) { // 複数Table用のループ
        if (i == 0) {
          strJoin += "";
        } else {
          strJoin += "\n" + "    and ";
        }
        strJoin +=
            tableName1
                + "."
                + xmlCon.selectSingleNode(columList1.item(i), ".").getFirstChild().getNodeValue();
        strJoin +=
            " = "
                + tableName2
                + "."
                + xmlCon.selectSingleNode(columList2.item(i), ".").getFirstChild().getNodeValue();
      }

      return strJoin;
    } catch (Exception e) {
      log.error("exception in getJoinTableStr():\n", e);
      e.printStackTrace();
    }
    return null;
  }
  public String getJoinStr() {
    try {
      //			String strJoin = "where 'mode'!='viewer' "+"\n";
      String strJoin = "where 1=1 " + "\n";
      Node xmlNode = xmlCon.selectSingleNode(xmlDoc, "//RDBModel");
      NodeList nodelist = xmlCon.selectNodes(xmlNode, "//RDBModel/joins/join");

      for (int i = 0; i < nodelist.getLength(); i++) { // 複数Table用のループ
        //				xmlCon.selectSingleNode(nodelist.item(i),"//table1");
        if (i == 0) {
          strJoin += "    and " + getJoinTableStr(nodelist.item(i)) + "\n";
        } else {
          strJoin += "    and " + getJoinTableStr(nodelist.item(i)) + "\n";
        }
      }
      return strJoin;
    } catch (Exception e) {
      log.error("exception in getJoinStr():\n", e);
      e.printStackTrace();
    }
    return null;
  }