Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

GenDefaults.java

Go to the documentation of this file.
00001 package cedar.jetweb.xml;
00002 
00003 import cedar.jetweb.generator.GeneratorWrapper;
00004 import cedar.jetweb.db.DBObjectManager;
00005 import cedar.jetweb.db.DBConnectionManager;
00006 import cedar.jetweb.db.DBConfig;
00007 import cedar.jetweb.JetWebException;
00008 
00009 import cedar.jetweb.generator.Herwig;
00010 import cedar.jetweb.generator.Generator;
00011 import cedar.jetweb.JetWebConfig;
00012 
00013 //need to do export CLASSPATH=/home/jmonk/Cedar/jetweb/trunk/build:/home/jmonk/Cedar/Java/lib/mysql-connector-java-3.1.11-bin.jar:/home/jmonk/Cedar/Java/lib/jdom.jar:/home/jmonk/Cedar/Java/lib/jdom.jar:/home/jmonk/Cedar/Java/lib/xmlParserAPIs.jar:/home/jmonk/Cedar/Java/lib/xercesImpl.jar:/home/jmonk/Cedar/Java/lib/jas.jar:/home/jmonk/Cedar/Java/lib/xml-apis.jar
00014 
00015 public class GenDefaults{
00016 
00017     public static void main(String[] args){
00018     
00019     JetWebConfig.init();
00020 
00021     JetWebGeneratorReader reader = null;
00022     GeneratorWrapper wrapper = null;
00023 
00024     if(args.length<1){
00025         System.out.println("Pass xml file as argument");
00026         return;
00027     }
00028     
00029     try{
00030 
00031         reader = new JetWebGeneratorReader(args[0]);
00032         wrapper = reader.getGeneratorWrapper();
00033     }catch(Throwable e){
00034         System.err.println
00035         ("Unable to create generator class from xml file");
00036         System.err.println(e.toString());
00037         //return;
00038     }
00039     
00040     DBConnectionManager connManager = new DBConnectionManager();
00041 
00042     String[] dbs = {DBConfig.JETWEB, "hepdata", "test"};
00043 
00044     connManager.init(dbs);
00045 
00046     DBObjectManager objManager = new DBObjectManager();
00047 
00048     objManager.passDBConnection(connManager);
00049 
00050     String tableName = wrapper.toString()+"_defaults";
00051 
00052     //String tableName = "testDefaults";
00053 
00054     System.out.println("Writing to table "+tableName);
00055 
00056     try {
00057         objManager.writeObject(wrapper, tableName, "test");
00058     } catch (Exception e) {
00059     }
00060 
00061     System.out.println("finished");
00062 
00063     //return;
00064     };
00065 
00066 }

Generated Wed Jan 17 09:14:27 GMT 2007