01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15:
16: package org.griphyn.vdl.router;
17:
18: import org.griphyn.vdl.classes.*;
19: import org.griphyn.vdl.parser.*;
20: import org.griphyn.vdl.router.*;
21: import org.griphyn.vdl.dbschema.*;
22: import org.griphyn.vdl.directive.*;
23: import org.griphyn.vdl.util.ChimeraProperties;
24: import org.griphyn.vdl.util.Logging;
25: import org.griphyn.vdl.toolkit.Toolkit;
26: import java.io.IOException;
27: import java.sql.SQLException;
28:
29: public class ToText extends Toolkit {
30: public ToText(String arg0) {
31: super (arg0);
32: }
33:
34: public void showUsage() {
35: }
36:
37: public static void main(String[] args)
38: throws IllegalArgumentException, IOException, Exception {
39: ToText me = new ToText("ToText");
40: if (args.length != 1)
41: throw new IllegalArgumentException("java prg xml");
42:
43: // create debug output
44: Logging.instance().register("state", System.err);
45: Logging.instance().register("route", System.err);
46:
47: // // force file
48: // me.m_props.setProperty( "vds.db.vds", "file" );
49: // me.m_props.setProperty( "vds.db.file.store", args[0] );
50:
51: // user supplied database, set up me.m_dbschema
52: String vdcSchemaName = ChimeraProperties.instance()
53: .getVDCSchemaName();
54: Connect connect = new Connect();
55: DatabaseSchema dbschema = connect
56: .connectDatabase(vdcSchemaName);
57:
58: Definitions defs = null;
59: if (dbschema instanceof InMemorySchema) {
60: // already everything in main memory, use backdoor (Yuck! Dirty!)
61: // avoid duplicating DVs in main memory.
62: defs = ((InMemorySchema) dbschema).backdoor();
63: } else {
64: // Load all Definitions into an in-memory database (uiuiui)
65: me.m_logger.log("app", 1,
66: "loading *all* definitions into memory");
67: defs = new Definitions();
68: defs.setDefinition(((VDC) dbschema).searchDefinition(null,
69: null, null, -1));
70: }
71:
72: if (defs == null) {
73: System.err.println("No input data, nothing to route");
74: return;
75: }
76:
77: // create new route object, in memory classes
78: Route r = new Route(new InMemorySchema(defs));
79:
80: // dump contents onto stdout
81: //r.dump(System.out); no longer a valid operation
82: }
83: }
|