--- /dev/null
+/*
+ * Copyright
+ * 2011 axYus - http://www.axyus.com
+ * 2011 C.Marchand - christophe.marchand@axyus.com
+ *
+ * This file is part of XEMELIOS_NB.
+ *
+ * XEMELIOS_NB is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * XEMELIOS_NB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with XEMELIOS_NB; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+package fr.gouv.finances.cp.buildtools.persist.ora;
+
+import fr.gouv.finances.cp.buildtools.persist.ora.ihm.OraGenFrame;
+import java.io.File;
+import java.io.FileFilter;
+import javax.swing.JOptionPane;
+import nu.xom.Builder;
+import nu.xom.Document;
+import nu.xom.Nodes;
+
+/**
+ * Cette classe a pour rôle d'aider à convertir les fichiers de configuration de
+ * persistence pour oracle
+ * @author cmarchand
+ */
+public class Generator {
+ public static void main(String[] args) {
+ if(args.length<1) throw new RuntimeException("vous devez spécifier le répertoire du module à traiter");
+ File f = new File(args[0]);
+ if(f.exists()) {
+ new Generator(f);
+ }
+ }
+
+ protected Generator(File moduleDirectory) {
+ File conf = new File(moduleDirectory,"conf");
+ if(conf.exists()) {
+ File[] childs = conf.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File pathname) {
+ return !pathname.isDirectory();
+ }
+ });
+ if(childs.length==0) {
+ JOptionPane.showMessageDialog(null, "Impossible de trouver le fichier de configuration.");
+ } else {
+ try {
+ Builder builder = new Builder();
+ Document doc = builder.build(childs[0]);
+ Nodes nodes = doc.query("/documents/document/@persistence-config");
+ String persistenceFileName = nodes.get(0).getValue();
+ File persistFile = new File(conf, persistenceFileName);
+ System.out.println(persistFile.getAbsolutePath());
+ OraGenFrame fr = new OraGenFrame(persistFile);
+ fr.setVisible(true);
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ } else {
+ JOptionPane.showMessageDialog(null, "Le répertoire "+conf.getAbsolutePath()+"\nn'existe pas.");
+ }
+ }
+}