1 |
|
---|
2 | /*
|
---|
3 | * SimpleGraphicalClient.java
|
---|
4 | * Copyright (C) 2001 New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU General Public License
|
---|
17 | * along with this program; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 | */
|
---|
20 |
|
---|
21 | package org.nzdl.gsdl.SimpleGraphicalClient;
|
---|
22 |
|
---|
23 | import java.awt.*;
|
---|
24 | import javax.swing.*;
|
---|
25 | import java.util.*;
|
---|
26 | import java.io.*;
|
---|
27 | import java.net.URL;
|
---|
28 |
|
---|
29 | // long live GNU ...
|
---|
30 | import gnu.getopt.Getopt;
|
---|
31 | import gnu.getopt.LongOpt;
|
---|
32 |
|
---|
33 | // local libraries
|
---|
34 | import org.nzdl.gsdl.service.NzdlCollectionInfo;
|
---|
35 | import org.nzdl.gsdl.service.NzdlQuery;
|
---|
36 | import org.nzdl.gsdl.service.NzdlRequest;
|
---|
37 | import org.nzdl.gsdl.service.NzdlResponse;
|
---|
38 | import org.nzdl.gsdl.service.NzdlResultSet;
|
---|
39 | import org.nzdl.gsdl.service.NzdlService;
|
---|
40 | import org.nzdl.gsdl.service.NzdlServiceClient;
|
---|
41 | import org.nzdl.gsdl.util.NzdlIORs;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Class SimpleGraphicalClient
|
---|
45 | *
|
---|
46 | * A class to test the workings of Corba interface from the client side.
|
---|
47 | *
|
---|
48 | * @author Dave Nichols ([email protected])
|
---|
49 | * @author stuart yeates ([email protected])
|
---|
50 | * @author Brett Sheeran ([email protected])
|
---|
51 | * @author Gordon Paynter ([email protected])
|
---|
52 | * @version $Revision: 2145 $
|
---|
53 | * @see org.nzdl.gsdl.service.NzdlCollectionInfo
|
---|
54 | * @see org.nzdl.gsdl.service.NzdlQuery
|
---|
55 | * @see org.nzdl.gsdl.service.NzdlRequest
|
---|
56 | * @see org.nzdl.gsdl.service.NzdlResponse
|
---|
57 | * @see org.nzdl.gsdl.service.NzdlResultSet
|
---|
58 | * @see org.nzdl.gsdl.service.NzdlService
|
---|
59 | * @see org.nzdl.gsdl.service.NzdlServiceImpl
|
---|
60 | * @see org.nzdl.gsdl.util.NzdlIORs;
|
---|
61 | * @see gnu.getopt.Getopt;
|
---|
62 | * @see gnu.getopt.LongOpt;
|
---|
63 | */
|
---|
64 |
|
---|
65 |
|
---|
66 | public class SimpleGraphicalClient implements Cloneable {
|
---|
67 |
|
---|
68 | CSModel csModel;
|
---|
69 | CSFrame window;
|
---|
70 |
|
---|
71 |
|
---|
72 | /** The underlying CORBA inferface */
|
---|
73 | NzdlService nzdl = null;
|
---|
74 |
|
---|
75 | /** The name of the file we look for IOR's in */
|
---|
76 | String IORFileName = "/tmp/localcorba.objid";
|
---|
77 | /** The IOR that was specified on the commandline */
|
---|
78 | String IORFromCommandLine = null;
|
---|
79 |
|
---|
80 | /** How verbose do we want to be ? */
|
---|
81 | int verbosity = 2;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Basic constructor
|
---|
85 | */
|
---|
86 | SimpleGraphicalClient() {
|
---|
87 | System.err.println("in constructor");
|
---|
88 | init(null);
|
---|
89 | }
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Normal constructor
|
---|
93 | * @param args the command line arguments
|
---|
94 | */
|
---|
95 | public SimpleGraphicalClient(String [] args) {
|
---|
96 |
|
---|
97 | init(args);
|
---|
98 | }
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Do initialisation, including finding a server to connect to and
|
---|
102 | * setting up all the GUI stuff
|
---|
103 | * @param args the command line arguments
|
---|
104 | */
|
---|
105 | void init(String [] args) {
|
---|
106 | nzdl = NzdlIORs.findIOR(null, null,
|
---|
107 | IORFileName, IORFromCommandLine);
|
---|
108 | if (nzdl == null)
|
---|
109 | throw new Error("URK! unable to find an IOR...");
|
---|
110 |
|
---|
111 | csModel = new CSModel(nzdl);
|
---|
112 |
|
---|
113 | window = new CSFrame("Search via Corba", csModel);
|
---|
114 | Toolkit theKit = window.getToolkit(); // Get the window toolkit
|
---|
115 | Dimension screenSize = theKit.getScreenSize(); // Get screen size
|
---|
116 |
|
---|
117 | // Set the position to screen center & size to half screen size
|
---|
118 | /* window.setBounds(screenSize.width/4, screenSize.height/4, // Position
|
---|
119 | screenSize.width/2, screenSize.height/2); // Size
|
---|
120 |
|
---|
121 | */
|
---|
122 | window.setVisible(true);
|
---|
123 | } // init
|
---|
124 |
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Start the SimpleGraphicalClient
|
---|
128 | * @param commandline arguments (only used in ORB initialisation).
|
---|
129 | */
|
---|
130 |
|
---|
131 | public static void main(String args[])
|
---|
132 | {
|
---|
133 |
|
---|
134 | System.err.println("starting...");
|
---|
135 | SimpleGraphicalClient sgc = new SimpleGraphicalClient();
|
---|
136 |
|
---|
137 |
|
---|
138 | } //main
|
---|
139 |
|
---|
140 |
|
---|
141 | } // class GraphicalClient
|
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 |
|
---|
146 |
|
---|
147 |
|
---|