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