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.Dimension;
|
---|
24 | import java.awt.Toolkit;
|
---|
25 |
|
---|
26 | // local libraries
|
---|
27 | import org.nzdl.gsdl.service.NzdlCollectionInfo;
|
---|
28 | import org.nzdl.gsdl.service.NzdlQuery;
|
---|
29 | import org.nzdl.gsdl.service.NzdlRequest;
|
---|
30 | import org.nzdl.gsdl.service.NzdlResponse;
|
---|
31 | import org.nzdl.gsdl.service.NzdlResultSet;
|
---|
32 | import org.nzdl.gsdl.service.NzdlService;
|
---|
33 | import org.nzdl.gsdl.service.NzdlServiceClient;
|
---|
34 | import org.nzdl.gsdl.util.NzdlServiceFactory;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Class SimpleGraphicalClient
|
---|
38 | *
|
---|
39 | * A class to test the workings of Corba interface from the client side.
|
---|
40 | *
|
---|
41 | * @author Dave Nichols ([email protected])
|
---|
42 | * @author stuart yeates ([email protected])
|
---|
43 | * @author Brett Sheeran ([email protected])
|
---|
44 | * @author Gordon Paynter ([email protected])
|
---|
45 | * @version $Revision: 2179 $
|
---|
46 | * @see org.nzdl.gsdl.service.NzdlCollectionInfo
|
---|
47 | * @see org.nzdl.gsdl.service.NzdlQuery
|
---|
48 | * @see org.nzdl.gsdl.service.NzdlRequest
|
---|
49 | * @see org.nzdl.gsdl.service.NzdlResponse
|
---|
50 | * @see org.nzdl.gsdl.service.NzdlResultSet
|
---|
51 | * @see org.nzdl.gsdl.service.NzdlService
|
---|
52 | * @see org.nzdl.gsdl.service.NzdlServiceClient
|
---|
53 | * @see org.nzdl.gsdl.util.NzdlServiceFactory;
|
---|
54 | */
|
---|
55 |
|
---|
56 |
|
---|
57 | public class SimpleGraphicalClient implements Cloneable {
|
---|
58 |
|
---|
59 | CSModel csModel;
|
---|
60 | CSFrame window;
|
---|
61 |
|
---|
62 |
|
---|
63 | /** The underlying CORBA inferface */
|
---|
64 | NzdlService nzdl = null;
|
---|
65 |
|
---|
66 | /** The name of the file we look for IOR's in */
|
---|
67 | String IORFileName = "/tmp/localcorba.objid";
|
---|
68 | /** The IOR that was specified on the commandline */
|
---|
69 | String IORFromCommandLine = null;
|
---|
70 |
|
---|
71 | /** How verbose do we want to be ? */
|
---|
72 | int verbosity = 2;
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Basic constructor
|
---|
76 | */
|
---|
77 | SimpleGraphicalClient() {
|
---|
78 | System.err.println("in constructor");
|
---|
79 | init(null);
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Normal constructor
|
---|
84 | * @param args the command line arguments
|
---|
85 | */
|
---|
86 | public SimpleGraphicalClient(String [] args) {
|
---|
87 |
|
---|
88 | init(args);
|
---|
89 | }
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Do initialisation, including finding a server to connect to and
|
---|
93 | * setting up all the GUI stuff
|
---|
94 | * @param args the command line arguments
|
---|
95 | */
|
---|
96 | void init(String [] args) {
|
---|
97 | nzdl = NzdlServiceFactory.createNzdlService(args,
|
---|
98 | System.getProperties(),
|
---|
99 | null,
|
---|
100 | IORFileName,
|
---|
101 | IORFromCommandLine);
|
---|
102 | if (nzdl == null)
|
---|
103 | throw new Error("URK! unable to find an IOR...");
|
---|
104 |
|
---|
105 | csModel = new CSModel(nzdl);
|
---|
106 |
|
---|
107 | window = new CSFrame("Search via Corba", csModel);
|
---|
108 | Toolkit theKit = window.getToolkit(); // Get the window toolkit
|
---|
109 | Dimension screenSize = theKit.getScreenSize(); // Get screen size
|
---|
110 |
|
---|
111 | // Set the position to screen center & size to half screen size
|
---|
112 | /* window.setBounds(screenSize.width/4, screenSize.height/4, // Position
|
---|
113 | screenSize.width/2, screenSize.height/2); // Size
|
---|
114 |
|
---|
115 | */
|
---|
116 | window.setVisible(true);
|
---|
117 | } // init
|
---|
118 |
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * Start the SimpleGraphicalClient
|
---|
122 | * @param commandline arguments (only used in ORB initialisation).
|
---|
123 | */
|
---|
124 |
|
---|
125 | public static void main(String args[])
|
---|
126 | {
|
---|
127 |
|
---|
128 | System.err.println("starting...");
|
---|
129 | SimpleGraphicalClient sgc = new SimpleGraphicalClient();
|
---|
130 |
|
---|
131 |
|
---|
132 | } //main
|
---|
133 |
|
---|
134 |
|
---|
135 | } // class GraphicalClient
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 |
|
---|
140 |
|
---|
141 |
|
---|