source: trunk/gsdl3/src/java/org/greenstone/gsdl3/Library2.java@ 4155

Last change on this file since 4155 was 3503, checked in by kjdon, 22 years ago

changed prompt

  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/*
2 * Library2.java
3 * Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19package org.greenstone.gsdl3;
20
21import org.greenstone.gsdl3.core.*;
22import org.greenstone.gsdl3.util.*;
23
24import java.io.BufferedReader;
25import java.io.InputStreamReader;
26import java.io.File;
27import java.io.IOException;
28/**
29 * A program to take XML cgi-input from the command line and return html
30 *
31 * @author <a href="mailto:[email protected]">Katherine Don</a>
32 * @version $Revision: 3503 $
33 */
34
35final public class Library2 {
36
37 public static void main(String args[]) {
38
39 if (args.length != 3) {
40 System.out.println("Usage: Library2 <gsdl3 home> <site name> <interface name>");
41 System.exit(1);
42 }
43
44 ConfigVars config_ = new ConfigVars();
45 config_.gsdl3_home_ = args[0];
46 config_.site_name_ = args[1];
47 config_.interface_name_ = args[2];
48
49 config_.createXML();
50
51 // new message router - create it and pass a handle to recept.
52 // the servlet wont use this directly
53 MessageRouter message_router_ = new MessageRouter();
54
55 message_router_.setSiteHome(GSFile.siteHome(config_.gsdl3_home_,
56 config_.site_name_));
57 message_router_.configure();
58 // new receptionist
59 Receptionist recept_ = new Receptionist();
60 recept_.setConfigVars(config_);
61 recept_.setMessageRouter(message_router_);
62 recept_.configure();
63
64 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
65 String query=null;
66 String result=null;
67 while (true) {
68 System.out.println("Please enter an XML representation of cgi params (all on one line), or 'exit' to quit");
69 try {
70 query = br.readLine();
71 } catch (Exception e) {
72 System.err.println("Library1 exception:"+e.getMessage());
73 }
74 if (query.startsWith("exit")) {
75 System.exit(1);
76 }
77
78 result = recept_.process(query);
79
80 System.out.println(result);
81
82
83 }
84
85 }
86}
87
88
Note: See TracBrowser for help on using the repository browser.