1 /*------------------------------------------------------------------------------
  2 Name:      CorbaDriver.java
  3 Project:   xmlBlaster.org
  4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
  5 Comment:   CorbaDriver class to invoke the xmlBlaster server using CORBA.
  6 Version:   $Id: CorbaDriver.java 15510 2006-09-17 18:54:55Z ruff $
  7 ------------------------------------------------------------------------------*/
  8 package org.xmlBlaster.protocol.corba;
  9 
 10 import java.util.logging.Logger;
 11 import java.util.logging.Level;
 12 
 13 import org.xmlBlaster.util.FileLocator;
 14 import org.xmlBlaster.util.Global;
 15 import org.xmlBlaster.util.XmlBlasterException;
 16 import org.xmlBlaster.util.context.ContextNode;
 17 import org.xmlBlaster.util.def.ErrorCode;
 18 import org.xmlBlaster.util.def.Constants;
 19 import org.xmlBlaster.util.protocol.corba.OrbInstanceFactory;
 20 import org.xmlBlaster.protocol.I_Authenticate;
 21 import org.xmlBlaster.protocol.I_XmlBlaster;
 22 import org.xmlBlaster.protocol.I_Driver;
 23 import org.xmlBlaster.protocol.corba.authenticateIdl.AuthServerPOATie;
 24 import org.xmlBlaster.protocol.corba.AuthServerImpl;
 25 import org.xmlBlaster.engine.qos.AddressServer;
 26 import java.io.PrintWriter;
 27 import java.io.FileOutputStream;
 28 import java.io.File;
 29 import org.omg.CosNaming.NamingContext;
 30 import org.omg.CosNaming.NamingContextExt;
 31 import org.omg.CosNaming.NameComponent;
 32 
 33 /**
 34  * CorbaDriver class to invoke the xmlBlaster server using CORBA.
 35  * Note the IANA assigned official CORBA ports:
 36  * <pre>
 37  *  corba-iiop      683/tcp    CORBA IIOP 
 38  *  corba-iiop      683/udp    CORBA IIOP 
 39  *  corba-iiop-ssl  684/tcp    CORBA IIOP SSL
 40  *  corba-iiop-ssl  684/udp    CORBA IIOP SSL
 41  *  
 42  *  corbaloc        2809/tcp   CORBA LOC
 43  *  corbaloc        2809/udp   CORBA LOC
 44  * </pre>
 45  * We use the following CORBA specific ports:
 46  * <pre>
 47  *   7608 as the default port to look for a naming service
 48  *   3412 is the xmlBlaster assigned port, used for bootstrapping (optional)
 49  * </pre>
 50  * JacORB CORBA socket:<br />
 51  *  org.jacorb.util.Environment.getProperty("OAIAddr");<br />
 52  *  org.jacorb.util.Environment.getProperty("OAPort");
 53  * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/protocol.corba.JacORB.html">The protocol.corba.JacORB requirement</a>
 54  * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/protocol.corba.NameService.html">The protocol.corba.NameService requirement</a>
 55  */
 56 public class CorbaDriver implements I_Driver, CorbaDriverMBean
 57 {
 58    private String ME = "CorbaDriver";
 59    private org.omg.CORBA.ORB orb;
 60    private Global glob;
 61    private static Logger log = Logger.getLogger(CorbaDriver.class.getName());
 62    private NamingContextExt namingContextExt;
 63    private NameComponent [] nameXmlBlaster;
 64    private NameComponent [] nameNode;
 65    private String iorFile;
 66    /** The singleton handle for this xmlBlaster server */
 67    private AuthServerImpl authServer;
 68    /** The singleton handle for this xmlBlaster server */
 69    private I_Authenticate authenticate;
 70    /** The singleton handle for this xmlBlaster server */
 71    private I_XmlBlaster xmlBlasterImpl;
 72    private org.omg.PortableServer.POA rootPOA;
 73    private org.omg.CORBA.Object authRef;
 74    /** The URL path over which the IOR can be accessed (via our http bootstrap server) */
 75    private final String urlPath = "/AuthenticationService.ior";
 76    private AddressServer addressServer;
 77    /** My JMX registration, can be done optionally by implementing classes */
 78    protected Object mbeanHandle;
 79    protected ContextNode contextNode;
 80    protected boolean isActive;
 81 
 82    /** Get a human readable name of this driver */
 83    public String getName() {
 84       return ME;
 85    }
 86 
 87    /**
 88     * Access the xmlBlaster internal name of the protocol driver. 
 89     * @return "IOR"
 90     */
 91    public String getProtocolId() {
 92       return "IOR";
 93    }
 94 
 95    /** Enforced by I_Plugin */
 96    public String getType() {
 97       return getProtocolId();
 98    }
 99 
100    /** Enforced by I_Plugin */
101    public String getVersion() {
102       return "1.0";
103    }
104 
105    /**
106     * This method is called by the PluginManager (enforced by I_Plugin). 
107     * @see org.xmlBlaster.util.plugin.I_Plugin#init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)
108     */
109    public void init(org.xmlBlaster.util.Global glob, org.xmlBlaster.util.plugin.PluginInfo pluginInfo) 
110       throws XmlBlasterException {
111 
112       this.glob = glob;
113       this.ME = "CorbaDriver" + this.glob.getLogPrefixDashed();
114 
115 
116       org.xmlBlaster.engine.ServerScope engineGlob = (org.xmlBlaster.engine.ServerScope)glob.getObjectEntry(Constants.OBJECT_ENTRY_ServerScope);
117       if (engineGlob == null)
118          throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "could not retreive the ServerNodeScope. Am I really on the server side ?");
119       try {
120          this.authenticate = engineGlob.getAuthenticate();
121          if (this.authenticate == null) {
122             throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "authenticate object is null");
123          }
124          I_XmlBlaster xmlBlasterImpl = this.authenticate.getXmlBlaster();
125          if (xmlBlasterImpl == null) {
126             throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "xmlBlasterImpl object is null");
127          }
128 
129          // For JMX instanceName may not contain ","
130          this.contextNode = new ContextNode(ContextNode.SERVICE_MARKER_TAG,
131                "CorbaDriver[" + getType() + "]",
132                glob.getContextNode());
133          this.mbeanHandle = this.glob.registerMBean(this.contextNode, this);
134          init(glob, new AddressServer(glob, getType(), glob.getId(), pluginInfo.getParameters()), this.authenticate, xmlBlasterImpl);
135          
136          activate();
137       }
138       catch (XmlBlasterException ex) {
139          throw ex;
140       }
141       catch (Throwable ex) {
142          throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "init. Could'nt initialize the driver.", ex);
143       }
144    }
145 
146 
147    /**
148     * Get the address how to access this driver. 
149     * @return "IOR:00034500350..."
150     */
151    public String getRawAddress()
152    {
153       if (this.orb == null || this.authRef == null)
154          return null;
155       return this.orb.object_to_string(this.authRef);
156    }
157 
158    /**
159     * Start xmlBlaster CORBA access. 
160     * Is called after plugin is created
161     * @param args The command line parameters
162     */
163    private synchronized void init(Global glob, AddressServer addressServer, I_Authenticate authenticate, I_XmlBlaster xmlBlasterImpl) throws XmlBlasterException
164    {
165       this.authenticate = authenticate;
166       this.xmlBlasterImpl = xmlBlasterImpl;
167       this.addressServer = addressServer;
168 
169       this.orb = OrbInstanceFactory.createOrbInstance(this.glob, (String[])null,
170                                     glob.getProperty().getProperties(), addressServer);
171 
172       try {
173          rootPOA = org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
174          rootPOA.the_POAManager().activate();
175 
176          authServer = new AuthServerImpl(glob, orb, this.addressServer, this.authenticate, this.xmlBlasterImpl);
177 
178          // USING TIE:
179          org.omg.PortableServer.Servant authServant = new AuthServerPOATie(authServer);
180          this.authRef = ((AuthServerPOATie)(authServant))._this(orb);
181          this.addressServer.setRawAddress(orb.object_to_string(this.authRef));
182       }
183       catch (org.omg.CORBA.COMM_FAILURE e) {
184          throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, "Could not initialize CORBA, do you use the SUN-JDK delivered ORB instead of JacORB or ORBaccus? Try 'jaco org.xmlBlaster.Main' and read instructions in xmlBlaster/bin/jaco", e);
185       }
186       catch (Throwable e) {
187          e.printStackTrace();
188          throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, "Could not initialize CORBA", e);
189       }
190    }
191 
192    /**
193     * Activate xmlBlaster access through this protocol.
194     */
195    public synchronized void activate() throws XmlBlasterException {
196       if (log.isLoggable(Level.FINER)) log.finer("Entering activate");
197       try {
198          // NOT TIE:
199          // org.omg.PortableServer.Servant authServant = new AuthServerImpl(orb);
200          // this.authRef = rootPOA.servant_to_reference(authServant);
201 
202          // There are three variants how xmlBlaster publishes its AuthServer IOR (object reference)
203 
204          // 1) Write IOR to given file
205          iorFile = this.addressServer.getEnv("iorFile", "").getValue();
206          if (log.isLoggable(Level.FINE)) log.fine(this.addressServer.getEnvLookupKey("iorFile") + " = " + iorFile);
207          if(iorFile != null && iorFile.length() > 0) {
208             PrintWriter ps = new PrintWriter(new FileOutputStream(new File(iorFile)));
209             //if (log.isLoggable(Level.FINEST)) log.dump(ME, "Dumping authRef=" + this.authRef + " to " + iorFile + ": " + orb.object_to_string(this.authRef));
210             ps.println(orb.object_to_string(this.authRef));
211             ps.close();
212             log.info("Published AuthServer IOR to file " + iorFile + ", this will be deleted on shutdown.");
213          }
214 
215          // 2) Publish IOR on given port (switch off this feature with '-bootstrapPort 0'
216          if (glob.getBootstrapAddress().getBootstrapPort() > 0) {
217             glob.getHttpServer().registerRequest(urlPath, orb.object_to_string(this.authRef));
218             log.info("Published AuthServer IOR on " + glob.getBootstrapAddress().getRawAddress());
219          }
220 
221          // 3) Publish IOR to a naming service -plugin/ior/useNameService  true/false
222          boolean useNameService = this.addressServer.getEnv("useNameService", true).getValue();  // default is to publish myself to the naming service
223          if (useNameService) {
224 
225             /*
226             // We check if a name server is running, if not we just create and start one:
227             Class nameServer = Class.forName("jacorb.naming.NameServer");
228             if (nameServer != null) {
229                try {
230                   namingContextExt = getNamingService();
231                }
232                catch (XmlBlasterException e) {
233                   class MyNameServer extends Thread {
234                      public void run() {
235                         Thread.currentThread().setName("XmlBlaster CorbaDriver NameServerThread");
236                         String[] aa = new String[1];
237                         // !!! where do we get the document root from (see jacorb.NameServerURL in jacorb.properties)?
238                         aa[0] = "/home/ruff/xmlBlaster/demo/html/NS_Ref";
239                         // !!! using reflection in future to avoid JacORB dependency (nameServer. Method main):
240                         jacorb.naming.NameServer.main(aa);
241                         log.info(ME, "Created Name server");
242                      }
243                   }
244                   MyNameServer thr = new MyNameServer();
245                   thr.start();
246                   Timestamp.sleep(500);
247                   log.info(ME, "Started CORBA naming service");
248                }
249             }
250             */
251 
252             // Register xmlBlaster with a name server:
253             // NameService entry is e.g. xmlBlaster.MOM/heron.MOM
254             try {
255                namingContextExt = getNamingService();
256 
257                String contextId = this.addressServer.getEnv("NameService.context.id", "xmlBlaster").getValue();
258                String contextKind = this.addressServer.getEnv("NameService.context.kind", "MOM").getValue();
259 
260                nameXmlBlaster = new NameComponent[1];
261                nameXmlBlaster[0] = new NameComponent();
262                nameXmlBlaster[0].id = contextId;      // old style: "xmlBlaster-Authenticate"
263                nameXmlBlaster[0].kind = contextKind;  // kind is like a file extension (does not make much sense here)
264                NamingContext relativeContext = null;
265                int numTries = 5;  // We need to retry
266                for(int i=0; i<numTries; i++) {
267                   try {
268                      relativeContext = namingContextExt.bind_new_context(nameXmlBlaster);
269                      if (relativeContext != null) {
270                         break;
271                      }
272                   }
273                   catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
274                      if (log.isLoggable(Level.FINE)) log.fine("Can't register CORBA NameService context '" +
275                                     OrbInstanceFactory.getString(nameXmlBlaster) + "': " + ex.toString());
276                      try {
277                         org.omg.CORBA.Object obj = namingContextExt.resolve(nameXmlBlaster);
278                         relativeContext = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);
279                         break;
280                      }
281                      catch (Throwable e) {
282                         log.severe("Can't register CORBA NameService context '" +
283                                    OrbInstanceFactory.getString(nameXmlBlaster) + "', #"+i+"/"+numTries+": " + e.toString());
284                      }
285                   }
286                   catch (org.omg.CORBA.NO_IMPLEMENT ex) {  // JacORB 1.3.x bug (remove this catch when updated to JacORB 1.4x)
287                      if (log.isLoggable(Level.FINE)) log.fine("Can't register CORBA NameService context '" +
288                                     OrbInstanceFactory.getString(nameXmlBlaster) + "': " + ex.toString());
289                      try {
290                         org.omg.CORBA.Object obj = namingContextExt.resolve(nameXmlBlaster);
291                         relativeContext = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);
292                         break;
293                      }
294                      catch (Throwable e) {
295                         log.severe("Can't register CORBA NameService context '" +
296                                    OrbInstanceFactory.getString(nameXmlBlaster) + "', #"+i+"/"+numTries+": " + e.toString());
297                      }
298                   }
299                }
300                if (relativeContext != null) {
301                   String clusterId = this.addressServer.getEnv("NameService.node.id", glob.getStrippedId()).getValue();
302                   String clusterKind = this.addressServer.getEnv("NameService.node.kind", "MOM").getValue();
303                   nameNode = new NameComponent[] { new NameComponent(clusterId, clusterKind) };
304                   relativeContext.rebind(nameNode, this.authRef);
305                }
306                else {
307                   // delegate error handling
308                   throw new XmlBlasterException(glob, ErrorCode.RESOURCE_UNAVAILABLE, ME, "Can't bind to naming service");
309                }
310 
311                log.info("Published AuthServer IOR to NameService ORBInitRef='" + System.getProperty("ORBInitRef") +
312                             "' with name '" + OrbInstanceFactory.getString(nameXmlBlaster) + "/" + OrbInstanceFactory.getString(nameNode) + "'");
313             }
314             catch (XmlBlasterException e) {
315                log.warning(e.getMessage());
316                namingContextExt = null;
317                if (glob.getBootstrapAddress().getBootstrapPort() > 0) {
318                   log.info("You don't need the naming service, i'll switch to builtin http IOR download");
319                }
320                else if (iorFile != null) {
321                   log.info("You don't need the naming service, i'll switch to plugin/ior/iorFile = " + iorFile);
322                }
323                else {
324                   usage();
325                   log.severe("You switched off the internal http server and you didn't specify a file name for IOR dump nor a Naming Service was found!");
326                }
327             } catch (org.omg.CORBA.COMM_FAILURE e) {
328                namingContextExt = null;
329                if (glob.getBootstrapAddress().getBootstrapPort() > 0) {
330                   log.info("Can't publish AuthServer to naming service, is your naming service really running?\n" +
331                                e.toString() +
332                                "\nYou don't need the naming service, i'll switch to builtin http IOR download");
333                }
334                else if (iorFile != null) {
335                   log.info("Can't publish AuthServer to naming service, is your naming service really running?\n" +
336                                e.toString() +
337                                "\nYou don't need the naming service, i'll switch to plugin/ior/iorFile = " + iorFile);
338                }
339                else {
340                   usage();
341                   log.severe("Can't publish AuthServer to naming service, is your naming service really running?\n" +
342                                e.toString() +
343                                "\nYou switched off the internal http server and you didn't specify a file name for IOR dump!");
344                }
345             }
346          } // if useNameService
347       }
348       catch (org.omg.CORBA.COMM_FAILURE e) {
349          throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, "Could not initialize CORBA, do you use the SUN-JDK delivered ORB instead of JacORB or ORBaccus? Try 'jaco org.xmlBlaster.Main' and read instructions in xmlBlaster/bin/jaco", e);
350       }
351       catch (Throwable e) {
352          e.printStackTrace();
353          throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, "Could not initialize CORBA", e);
354       }
355       // orbacus needs this
356       if (orb.work_pending()) orb.perform_work();
357       this.isActive = true;
358    }
359 
360    /**
361     * JMX
362     * Deactivate xmlBlaster access (standby), no clients can connect. 
363     */
364    public synchronized void deActivate() {
365       if (log.isLoggable(Level.FINER)) log.finer("Entering deActivate");
366       this.isActive = false;
367 
368       try {
369          glob.getHttpServer().removeRequest(urlPath);
370       } catch(XmlBlasterException e) {
371          log.severe(e.getMessage());
372       }
373 
374       try {
375          if (namingContextExt != null && nameXmlBlaster != null) {
376             NamingContext relativeContext = null;
377             try {
378                org.omg.CORBA.Object obj = namingContextExt.resolve(nameXmlBlaster);
379                relativeContext = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);
380             }
381             catch (Throwable e) {
382                log.warning("Can't unregister CORBA NameService context id=" + nameXmlBlaster[0].id + " kind=" + nameXmlBlaster[0].kind + " failed: " + e.toString());
383             }
384             if (relativeContext != null) {
385                relativeContext.unbind(nameNode);
386             }
387          }
388          namingContextExt = null;
389       }
390       catch (Throwable e) {
391          log.warning("Problems during ORB cleanup: " + e.toString());
392          e.printStackTrace();
393       }
394 
395       try {
396          if (iorFile != null) FileLocator.deleteFile(null, iorFile);
397          iorFile = null;
398       }
399       catch (Throwable e) {
400          log.warning("Problems during ORB cleanup: " + e.toString());
401       }
402 
403       if (this.authRef != null) this.authRef._release();
404    }
405 
406    /**
407     *  Instructs the ORB to shut down, which causes all object adapters to shut down. 
408     * <p />
409     * JacORB behavior:<br />
410     * The POA is not "connected" to the ORB in any particular way
411     * other than that is exists. You can call destroy() on a POA
412     * to make it disappear. Calling shutdown() on the ORB will 
413     * implicitly destroy all POAs.
414     * <p />
415     * Ports are not linked to POAs in JacORB. Rather, there is a single
416     * master port in any server-side ORB which gets created when the
417     * root poa is retrieved for the first time. The server process
418     * accepts incoming connections on this port and creates new
419     * ports for every client process. Because of this connection
420     * multiplexing, ports are not released when POAs are destroyed, 
421     * but when clients exit, or when server-side timouts occur.
422     */
423    public void shutdown() throws XmlBlasterException {
424       if (log.isLoggable(Level.FINER)) log.finer("Shutting down ...");
425       deActivate();
426 
427       this.glob.unregisterMBean(this.mbeanHandle);
428 
429       if (this.authServer != null) {
430          this.authServer.shutdown();
431       }
432 
433       if (rootPOA != null && this.authRef != null) {
434          try {
435             log.fine("Deactivate POA ...");
436             this.authRef._release();
437             // poa.deactivate_object(poa.servant_to_id(this.authRef));
438             rootPOA.deactivate_object(rootPOA.reference_to_id(this.authRef));
439          } catch(Exception e) { log.warning("POA deactivate authentication servant failed"); }
440       }
441 
442       if (rootPOA != null) {
443          /*
444          try {
445             log.trace(ME, "Deactivate POA Manager ...");
446             rootPOA.the_POAManager().deactivate(false, true);
447          } catch(Exception e) { log.warn(ME, "rootPOA deactivate failed: " + e.toString()); }
448          rootPOA deactivate failed: org.omg.PortableServer.POAManagerPackage.AdapterInactive: IDL:omg.org/PortableServer/POAManager/AdapterInactive:1.0
449          */
450          /*
451          try {
452             log.trace(ME, "_release POA Manager ...");
453             rootPOA.the_POAManager()._release();
454          } catch(Exception e) { log.warn(ME, "rootPOA _release failed: " + e.toString()); }
455          rootPOA _release failed: org.omg.CORBA.NO_IMPLEMENT: This is a locally constrained object.  vmcid: 0x0  minor code: 0  completed: No
456          */
457          try {
458             this.rootPOA.destroy(true, true);
459          }
460          catch (Exception ex) {
461             log.warning("shutdown:exception occured rootPOA.destroy(): " + ex.toString());
462          }
463          rootPOA = null;
464       }
465 
466       this.authRef = null;
467 
468       if (this.orb != null) {
469          boolean wait_for_completion = false;
470          try {
471             this.orb.shutdown(wait_for_completion);
472             this.orb = null;
473          }
474          catch (Throwable ex) {
475             log.warning("shutdown: Exception occured during orb.shutdown("+wait_for_completion+"): " + ex.toString());
476          }
477       }
478 
479       log.info("POA and ORB are down, CORBA resources released.");
480    }
481 
482    public boolean isShutdown() {
483       return this.orb == null;
484    }
485 
486    /**
487     * Locate the CORBA Naming Service.
488     * <p />
489     * The found naming service is cached, for better performance in subsequent calls
490     * @return NamingContextExt, reference on name service<br />
491     *         Note that this reference may be invalid, because the naming service is not running any more
492     * @exception XmlBlasterException
493     *                    CORBA error handling if no naming service is found
494     */
495    private NamingContextExt getNamingService() throws XmlBlasterException
496    {
497       if (log.isLoggable(Level.FINER)) log.finer("getNamingService() ...");
498       if (namingContextExt != null)
499          return namingContextExt;
500 
501       NamingContextExt nameService = null;
502       try {
503          // Get a reference to the Name Service, CORBA compliant:
504          org.omg.CORBA.Object nameServiceObj = orb.resolve_initial_references("NameService");
505          if (nameServiceObj == null) {
506             //log.warn(ME + ".NoNameService", "Can't access naming service, is there any running?");
507             throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME + ".NoNameService", "Can't access naming service, is there any running?");
508          }
509          if (log.isLoggable(Level.FINE)) log.fine("Successfully accessed initial orb references for naming service (IOR)");
510 
511          nameService = org.omg.CosNaming.NamingContextExtHelper.narrow(nameServiceObj);
512          if (nameService == null) {
513             log.severe("Can't access naming service == null");
514             throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME + ".NoNameService", "Can't access naming service (narrow problem)");
515          }
516          if (log.isLoggable(Level.FINE)) log.fine("Successfully narrowed handle for naming service");
517 
518          return nameService; // Note: the naming service IOR is successfully evaluated (from a IOR),
519                              // but it is not sure that the naming service is really running
520       }
521       catch (XmlBlasterException e) {
522          throw e;
523       }
524       catch (Exception e) {
525          if (log.isLoggable(Level.FINE)) log.fine(e.toString() + ": " + e.getMessage());
526          throw XmlBlasterException.convert(glob, ErrorCode.RESOURCE_CONFIGURATION, ME + ".NoNameService", "No CORBA naming service found - start <xmlBlaster/bin/ns ns.ior> and specify <-ORBInitRef NameService=...> if you want one.", e);
527          //throw new XmlBlasterException(ME + ".NoNameService", "No CORBA naming service found - read docu at <http://www.jacorb.org> if you want one.");
528       }
529    }
530 
531    /**
532     * Command line usage.
533     */
534    public String usage()
535    {
536       String text = "\n";
537       text += "CorbaDriver options:\n";
538       text += "   -bootstrapHostname  IP address where the builtin http server publishes its AuthServer IOR\n";
539       text += "                       This is useful for multihomed hosts or dynamic dial in IPs.\n";
540       text += "   -bootstrapPort      Port number where the builtin http server publishes its AuthServer IOR.\n";
541       text += "                       Default is bootstrap port "+Constants.XMLBLASTER_PORT+", the port 0 switches this feature off.\n";
542       text += "   -plugin/ior/iorFile\n";
543       text += "                       Specify a file where to dump the IOR of the AuthServer (for client access).\n";
544       text += "   -plugin/ior/iorString\n";
545       text += "                       Clients can specify the raw IOR string directly (for client access).\n";
546       text += "   -plugin/ior/useNameService true/false [true]\n";
547       text += "                       Publish the IOR to a naming service.\n";
548       text += "   -plugin/ior/hostname\n";
549       text += "                       Allows to force the corba server IP address for multi-homed hosts.\n";
550       text += "   -plugin/ior/port    Allows to force the corba server port number.\n";
551       text += "   " + Global.getJmxUsageLinkInfo(this.getClass().getName(), null);
552       text += "\n";
553       text += " For JacORB only:\n";
554       text += "   java -DOAIAddr=<ip> Use '-plugin/ior/hostname'\n";
555       text += "   java -DOAPort=<nr>  Use '-plugin/ior/port'\n";
556       text += "   java -Djacorb.log.default.verbosity=3  Switch CORBA debugging on\n";
557       text += "   java ... -ORBInitRef NameService=corbaloc:iiop:localhost:7608/StandardNS/NameServer-POA/_root\n";
558       text += "\n";
559       return text;
560    }
561 
562    /**
563     * @return A link for JMX usage
564     */
565    public java.lang.String getUsageUrl() {
566       return Global.getJavadocUrl(this.getClass().getName(), null);
567    }
568 
569    /* dummy to have a copy/paste functionality in jconsole */
570    public void setUsageUrl(java.lang.String url) {
571    }
572 
573    /**
574     * JMX
575     * @see org.xmlBlaster.util.admin.I_AdminService#isActive()
576     */
577    public boolean isActive() {
578       return this.isActive;
579    }
580 }


syntax highlighted by Code2HTML, v. 0.9.1