Changeset 2140
- Timestamp:
- 2001-03-09T11:30:02+13:00 (22 years ago)
- Location:
- trunk/java-client
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/TODO
r2124 r2140 1 1 Here are a list of things left to do in the Java client: 2 2 3 1) Complete and test Java Server 4 2) Merge in Davids interface to the Standford code 5 3) Merge in Georges filter code 6 4) Get IOR propogation working (getior) 7 5) Some GUI's ... 8 6) Work out why Collection name doesn't work. 9 7) Get the p2p stuff going 10 8) change make to $(MAKE) in the makefiles 11 9) comments... 12 10) ... 3 1) Merge in Davids interface to the Standford code 4 2) Some GUI's ... 5 3) Work out why Collection name doesn't work. 6 4) Get the p2p stuff going 7 5) comments... 8 6) ... 13 9 14 a) sort out the configure flags in mico so we only get what we need in the ORB 10 a) find out what causes the "specified name does not exist" error 11 message and how to fix it. 15 12 b) ... -
trunk/java-client/org/nzdl/gsdl/SimpleClient.java
r2135 r2140 106 106 int verbosity = 2; 107 107 108 String[] urlsCompiledIn =109 {110 "http://nikau.cs.waikato.ac.nz/~say1/gsdl/cgi-bin/getior",111 "http://www.nzdl.org/cgi-bin/getior"112 };113 114 108 /** 115 109 * Basic no-args constructor. Not recommended for normal use, … … 117 111 */ 118 112 protected SimpleClient() { 119 init(null); 113 nzdl = NzdlIORs.findIOR(null, URLFromCommandLine, 114 IORFileName, IORFromCommandLine); 115 if (nzdl == null) 116 throw new Error("URK! unable to find an IOR..."); 120 117 } 121 118 … … 126 123 SimpleClient(String [] args) { 127 124 parseArgs(args); 128 init(args); 129 } 130 131 /** 132 * 133 */ 134 protected void init(String [] args) { 135 136 // read our prevously seed IORs ... 137 String IOR = null; 138 139 // try a URL from the command line 140 if (URLFromCommandLine != null) { 141 IOR = NzdlIORs.getIORfromURL(URLFromCommandLine); 142 attemptToInitialise(args, null, IOR); 143 } 144 145 // try an IOR from the command line 146 if (IORFromCommandLine != null && nzdl == null) { 147 IOR = NzdlIORs. registerIOR(IORFromCommandLine); 148 attemptToInitialise(args, null, IOR); 149 } 150 151 // try an IOR from a file (the filename may have been 152 // given from teh commandline 153 if (nzdl == null) { 154 IOR = NzdlIORs.getIORfromFile(IORFileName); 155 attemptToInitialise(args, null, IOR); 156 } 157 158 // try the compiled-in URLs 159 if (nzdl == null) { 160 for (int i=0;( i<urlsCompiledIn.length && nzdl == null );i++) { 161 IOR = NzdlIORs.getIORfromURL(urlsCompiledIn[i]); 162 attemptToInitialise(args, null,IOR); 163 } 164 } 165 166 // the knownIORs is the last resort 167 if (nzdl == null) { 168 IOR = NzdlIORs.getFirstValid(); 169 attemptToInitialise(args, null, IOR); 170 } 171 } 125 nzdl = NzdlIORs.findIOR(args, URLFromCommandLine, 126 IORFileName, IORFromCommandLine); 127 if (nzdl == null) 128 throw new Error("URK! unable to find an IOR..."); 129 } 130 172 131 173 132 private boolean attemptToInitialise(String [] _args, -
trunk/java-client/org/nzdl/gsdl/util/NzdlIORs.java
r2136 r2140 91 91 public static String IORFileName = "/tmp/localcorba.objid"; 92 92 93 94 /** 95 * 93 /** default places wit look for IORs ... */ 94 static String[] urlsCompiledIn = 95 { 96 "http://nikau.cs.waikato.ac.nz/~say1/gsdl/cgi-bin/getior", 97 "http://www.nzdl.org/cgi-bin/getior" 98 }; 99 100 101 102 /** 103 * Get the first known-good IOR 104 * @see java.lang.String 105 * @return the string containing the IOR 96 106 */ 97 107 public static String getFirstValid() { … … 102 112 while (e.hasMoreElements()) { 103 113 String IOR = (String) e.nextElement(); 104 if (attemptToInitialise(null, null, IOR) ) {114 if (attemptToInitialise(null, null, IOR) != null) { 105 115 return IOR; 106 116 } … … 111 121 112 122 /** 113 * 123 * Check that the class has been correctly initialised 114 124 */ 115 125 static protected void checkLoaded() { … … 149 159 150 160 /** 151 * 161 * Save the IORs back to the underlying file 162 * @see java.io.File 152 163 */ 153 164 static protected void checkSave() { … … 165 176 } 166 177 } 167 168 /** 169 * 170 */ 171 public static void validate() { 178 /** 179 * Find a valid IOR to initialise from. 180 * @param _args the command line arguments 181 * @param _URL a URL to look for an IOR in 182 * @param _filename a local filename to look for an IOR in 183 * @param _IOR a string to look for an IOR in 184 * @see org.omg.CORBA.ORB 185 */ 186 public static NzdlServiceClient findIOR(String [] _args, 187 String _URL, 188 String _filename, 189 String _IOR) { 190 191 // read our prevously seed IORs ... 192 String IOR = null; 193 NzdlServiceClient client = null; 194 195 // try a URL from the command line 196 if ( _URL != null) { 197 IOR = NzdlIORs.getIORfromURL(_URL); 198 client = attemptToInitialise(_args, null, IOR); 199 } 200 201 // try an IOR from the command line 202 if (_IOR != null && client == null) { 203 IOR = NzdlIORs.registerIOR(_IOR); 204 client = attemptToInitialise(_args, null, IOR); 205 } 206 207 // try an IOR from a file (the filename may have been 208 // given from teh commandline 209 if (client == null) { 210 IOR = NzdlIORs.getIORfromFile(_filename); 211 client = attemptToInitialise(_args, null, IOR); 212 } 213 214 // try the compiled-in URLs 215 if (client == null) { 216 for (int i=0;( i<urlsCompiledIn.length && client == null );i++) { 217 IOR = NzdlIORs.getIORfromURL(urlsCompiledIn[i]); 218 client = attemptToInitialise(_args, null,IOR); 219 } 220 } 221 222 // the knownIORs is the last resort 223 if (client == null) { 224 IOR = NzdlIORs.getFirstValid(); 225 client = attemptToInitialise(_args, null, IOR); 226 } 227 return client; 228 } 229 230 /** 231 * Connect to each of the ORB's described by the IORs and throw away 232 * any that can't be connected to. 233 * @see org.omg.CORBA.ORB 234 */ 235 public static void validate() { 172 236 checkLoaded(); 173 237 synchronized (knownIORs) { … … 181 245 while (e.hasMoreElements()) { 182 246 String IOR = (String) e.nextElement(); 183 if (attemptToInitialise(null, null, IOR) ) {247 if (attemptToInitialise(null, null, IOR) != null) { 184 248 valid.put(IOR,""); 185 249 } … … 197 261 198 262 /** 199 * 200 */ 201 public static String registerIOR(String str) 263 * Register a given IOR 264 * @see java.lang.String 265 * @param str the IOR 266 * @return the str 267 */ 268 public static String registerIOR(String str) 202 269 { 203 270 checkLoaded(); … … 211 278 212 279 /** 213 * 280 * Retrieve an IOR from a URL 281 * @see java.net.URL 282 * @param str the url to retrieve 283 * @return the IOR 214 284 */ 215 285 public static String getIORfromURL(String str) … … 237 307 } 238 308 239 /** 240 * Pre: Accept SourceOfID as either: URL or IOR string or Filename 241 * Post: extract localcorba.objid from source of ID 309 /** 310 * Retrieve an IOR from a file 311 * @see java.io.File 312 * @param str the file to open 313 * @return the IOR 242 314 */ 243 315 public static String getIORfromFile(String file) { 244 316 checkLoaded(); 245 317 String ior = null; 246 file = file.trim(); 318 if (file == null || file.equals("")) 319 return ""; 320 file = file.trim(); 247 321 try { 248 322 BufferedReader input … … 259 333 } // end of getIorKey 260 334 261 /** 262 * Pre: Accept SourceOfID as either: URL or IOR string or Filename 263 * Post: extract localcorba.objid from source of ID 335 /** 336 * Write all IORs to a flat file (for reading from c++ etc). 337 * 338 * Not used for the properties files. 339 * 340 * @see java.util.Properties 341 * @param file the file to write to 264 342 */ 265 343 public static void writeToFile(String file) { … … 284 362 285 363 286 287 static private boolean attemptToInitialise(String [] _args, 364 /** 365 * Attempt to connect to the object pointed to by an IOR 366 * @see org.omg.CORBA.ORB 367 * @param _args the command line arguments 368 * @param _props the system properties 369 * @param _IOR the IOR string 370 * @return the newly created NzdlServiceClient 371 */ 372 static public NzdlServiceClient attemptToInitialise(String [] _args, 288 373 Properties _props, 289 374 String _IOR) { 290 375 checkLoaded(); 376 NzdlServiceClient nzdl = null; 291 377 try { 292 NzdlServiceClientnzdl = new NzdlServiceClient( _args, _props, _IOR);378 nzdl = new NzdlServiceClient( _args, _props, _IOR); 293 379 } catch (Throwable t) { 294 380 System.err.println ("failed to initialise using:"); 295 381 System.err.println (_IOR); 296 return false;297 } 298 return true;382 return null; 383 } 384 return nzdl; 299 385 } 300 386 387 /** 388 * Write the System properties to a file called "System.properties" in 389 * the current directory. 390 */ 301 391 public static final void main( String [] args ) { 302 392
Note:
See TracChangeset
for help on using the changeset viewer.