001: /*
002: * JulpExamplesMain.java
003: *
004: * Created on February 7, 2004, 10:10 AM
005: */
006:
007: package org.julp.examples;
008:
009: /**
010: *
011: * @author leonard
012: */
013:
014: public class JulpExamplesMain {
015:
016: /** Creates a new instance of JulpExamplesMain */
017: public JulpExamplesMain() {
018: }
019:
020: /**
021: * @param args the command line arguments
022: */
023: public static void main(String[] args) {
024:
025: String driver = null;
026: String dbURL = null;
027: String user = null;
028: String password = "";
029: String connectionOptions = null;
030: String filePath = null;
031: String example = null;
032:
033: for (int i = 0; i < args.length; i++) {
034: if (args[i].startsWith("-d")) {
035: driver = args[i].substring(2).trim();
036: System.out.println("driver: " + driver);
037: } else if (args[i].startsWith("-r")) {
038: dbURL = args[i].substring(2).trim();
039: System.out.println("dbURL: " + dbURL);
040: } else if (args[i].startsWith("-u")) {
041: user = args[i].substring(2).trim();
042: System.out.println("user: " + user);
043: } else if (args[i].startsWith("-p")) {
044: password = args[i].substring(2).trim();
045: System.out.println("password: " + password);
046: } else if (args[i].startsWith("-o")) {
047: connectionOptions = args[i].substring(2).trim();
048: System.out.println("connectionOptions: "
049: + connectionOptions);
050: } else if (args[i].startsWith("-f")) {
051: filePath = args[i].substring(2).trim();
052: System.out.println("filePath: " + filePath);
053: } else if (args[i].startsWith("-e")) {
054: example = args[i].substring(2).trim();
055: //System.out.println("example: " + example);
056: }
057: }
058:
059: //driver = "org.hsqldb.jdbcDriver";
060: //dbURL = "jdbc:hsqldb:hsq://localhost";
061: //user = "sa";
062: //password = "";
063: //connectionOptions = "";
064: //filePath = "C:\\Temp\\ProjectJulp\\julp-examples\\lib\\setup.sql";
065: //example = "findAllProducts";
066:
067: System.out.println("======================= Example: "
068: + example + " ===========================\n");
069: if (driver == null || dbURL == null || user == null
070: || filePath == null || example == null) {
071: System.out
072: .println("Usage: -d{JDBCDriver} -r{dbURL} -u{user} [-p password] [-o connection_options (name1=value1,name2=value2,...)] -f{filePath} -e{Example name}");
073: return;
074: }
075:
076: JulpExamples examples = new JulpExamples();
077: examples.setDriver(driver);
078: examples.setDbURL(dbURL);
079: examples.setUser(user);
080: examples.setPassword(password);
081: examples.setConnectionOptions(connectionOptions);
082: examples.setFilePath(filePath);
083: examples.setExample(example);
084:
085: if (example.equals("findAllProducts")) {
086: examples.findAllProducts();
087: } else if (example.equals("createAndStoreProductsLater")) {
088: examples.createAndStoreProductsLater();
089: } else if (example.equals("findAllCustomers")) {
090: examples.findAllCustomers();
091: } else if (example.equals("findAllCustomersWithPhone")) {
092: examples.findAllCustomersWithPhone();
093: } else if (example.equals("createAndStoreCustomers")) {
094: examples.createAndStoreCustomers();
095: } else if (example.equals("getProductPages")) {
096: examples.getProductPages();
097: } else if (example.equals("findCustomer")) {
098: examples.findCustomer();
099: } else if (example.equals("spreadsheet")) {
100: examples.spreadsheet();
101: } else if (example.equals("modifyInvoices")) {
102: examples.modifyInvoices();
103: } else if (example.equals("INClause")) {
104: examples.inClause();
105: } else if (example.equals("selectAs")) {
106: examples.selectAs();
107: // }else if (example.equals("tableModel")){
108: // examples.tableModel();
109: }
110:
111: }
112: }
|