⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 corbaconnection.java

📁 java开源的企业总线.xmlBlaster
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
   /**    * Logout from the server.    * Note that this kills the server ping thread as well (if in failsafe mode)    * @return true successfully logged out    *         false failure on logout    */   public boolean disconnect(String qos) {      if (log.isLoggable(Level.FINER)) log.finer("disconnect() ...");      if (this.xmlBlaster == null) {         try {            shutdown();         }         catch (XmlBlasterException ex) {            log.severe("disconnect. Could not shutdown properly. " + ex.getMessage());         }         return false;      }      try {         if (this.authServer != null) {            if(this.sessionId==null) {               this.authServer.logout(xmlBlaster);            }            else {               this.authServer.disconnect(this.sessionId, (qos==null)?"":qos); // secPlgn.exportMessage(""));            }         }         shutdown();         this.xmlBlaster = null;         return true;      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         log.warning("Remote exception: " + OrbInstanceFactory.convert(glob, e).getMessage());      } catch(org.omg.CORBA.OBJ_ADAPTER e) {         log.warning("No disconnect possible, no CORBA connection available: " + e.toString());      } catch(org.omg.CORBA.TRANSIENT e) {         log.warning("No disconnect possible, CORBA connection lost: " + e.toString());      } catch(org.omg.CORBA.COMM_FAILURE e) {         log.warning("No disconnect possible, CORBA connection lost: " + e.toString());      } catch(org.omg.CORBA.OBJECT_NOT_EXIST e) {         log.warning("No disconnect possible, CORBA connection lost: " + e.toString());      } catch(Throwable e) {         XmlBlasterException xmlBlasterException = XmlBlasterException.convert(glob, ME, null, e);         log.warning(xmlBlasterException.getMessage());         e.printStackTrace();      }      try {         shutdown();      }      catch (XmlBlasterException ex) {         log.severe("disconnect. Could not shutdown properly. " + ex.getMessage());      }      this.xmlBlaster = null;      return false;   }   /**    * Shut down the callback server.    * Is called by logout()    */   public void shutdown() throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("shutdown()");      if (this.authServer != null) {         this.authServer._release();         this.authServer = null;      }      if (this.xmlBlaster != null) {         this.xmlBlaster._release();         this.xmlBlaster = null;      }      if (this.orb != null) {         boolean wait_for_completion = false;         try {            this.orb.shutdown(wait_for_completion);            this.orb = null;         }         catch (Throwable ex) {            log.warning("shutdown: Exception occured during orb.shutdown("+wait_for_completion+"): " + ex.toString());         }      }   }   /**    * @return true if you are logged in    */   public boolean isLoggedIn() {      return this.xmlBlaster != null;   }   /**    * Enforced by I_XmlBlasterConnection interface (failsafe mode).    * see explanations of subscribe() method.    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public final String subscribe(String xmlKey, String qos) throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("subscribe() ...");      try {         return getXmlBlaster().subscribe(xmlKey, qos);      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         throw OrbInstanceFactory.convert(glob, e); // transform Corba exception to native exception      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "subscribe", e);      }   }   /**    * Enforced by I_XmlBlasterConnection interface (failsafe mode)    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public final String[] unSubscribe(String xmlKey, String qos) throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("unSubscribe() ...");      try {         return getXmlBlaster().unSubscribe(xmlKey, qos);      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         throw OrbInstanceFactory.convert(glob, e); // transform Corba exception to native exception      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "unSubscribe", e);      }   }   /**    * Publish fault-tolerant the given message.    * <p />    * This is a wrapper around the raw CORBA publish() method    * If the server disappears you get an exception.    * This call will not block.    * <p />    * Enforced by I_XmlBlasterConnection interface (failsafe mode)    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public final String publish(MsgUnitRaw msgUnit) throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("Publishing ...");      try {         return getXmlBlaster().publish(OrbInstanceFactory.convert(msgUnit));      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         if (log.isLoggable(Level.FINE)) log.fine("XmlBlasterException: " + e.getMessage());         throw OrbInstanceFactory.convert(glob, e); // transform Corba exception to native exception      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "publish() failed", e);      }   }   /**    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public String[] publishArr(MsgUnitRaw [] msgUnitArr) throws XmlBlasterException   {      if (log.isLoggable(Level.FINER)) log.finer("publishArr() num of Entries: " + msgUnitArr.length);      try {         return getXmlBlaster().publishArr(OrbInstanceFactory.convert(msgUnitArr));      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         if (log.isLoggable(Level.FINE)) log.fine("XmlBlasterException: " + e.getMessage());         throw OrbInstanceFactory.convert(glob, e); // transform Corba exception to native exception      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "publishArr", e);      }   }   /**    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public void publishOneway(MsgUnitRaw[] msgUnitArr) throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("publishOneway() ...");      try {         getXmlBlaster().publishOneway(OrbInstanceFactory.convert(msgUnitArr));      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "publishOneway", e);      }   }   /**    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public final String[] erase(String xmlKey, String qos) throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("erase() ...");      if (xmlKey==null) xmlKey = "";      if (qos==null) qos = "";      try {         return getXmlBlaster().erase(xmlKey, qos);      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         throw OrbInstanceFactory.convert(glob, e); // transform Corba exception to native exception      } catch(Throwable e) {         log.severe("IO exception: " + e.toString() + " sessionId=" + this.sessionId);         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "erase", e);      }   }   /**    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    */   public final MsgUnitRaw[] get(String xmlKey, String qos) throws XmlBlasterException {      if (log.isLoggable(Level.FINER)) log.finer("get() ...");      try {         return OrbInstanceFactory.convert(glob, getXmlBlaster().get(xmlKey, qos));      } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {         throw OrbInstanceFactory.convert(glob, e); // transform Corba exception to native exception      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "get", e);      }   }   /**    * Register a listener for to receive information about the progress of incoming data.     * Only one listener is supported, the last call overwrites older calls. This implementation    * does nothing here, it just returns null.    *     * @param listener Your listener, pass 0 to unregister.    * @return The previously registered listener or 0    */   public I_ProgressListener registerProgressListener(I_ProgressListener listener) {      log.fine("This method is currently not implemeented.");      return null;   }   /**    * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a>    * @see org.xmlBlaster.client.protocol.I_XmlBlasterConnection#ping(String)    */   public String ping(String qos) throws XmlBlasterException {      if (this.xmlBlaster == null && this.authServer != null) {         return this.authServer.ping(qos); // low level ping without having connect() to xmlBlaster      }      try {         return getXmlBlaster().ping(qos);      } catch(Throwable e) {         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "ping", e);      }   }   /**    * Command line usage.    * <p />    * These variables may be set in xmlBlaster.properties as well.    * Don't use the "-" prefix there.    */   public static String usage()   {      String text = "\n";      text += "CorbaConnection 'IOR' options:\n";      text += "   -bootstrapHostname <hostname or IP>\n";      text += "                       The host where to find xmlBlaster internal HTTP IOR download [localhost]\n";      text += "   -bootstrapPort <port>\n";      text += "                       The bootstrap port where xmlBlaster publishes its IOR [" + Constants.XMLBLASTER_PORT + "]\n";      text += "   -dispatch/connection/plugin/ior/iorString <IOR:00459...>\n";      text += "                       The IOR string from the running xmlBlaster server.\n";      text += "   -dispatch/connection/plugin/ior/iorFile <fileName>\n";      text += "                       A file with the xmlBlaster IOR.\n";      text += "   -dispatch/connection/plugin/ior/useNameService <true/false>\n";      text += "                       Try to access xmlBlaster through a naming service [true]\n";      text += "   -dispatch/callback/plugin/ior/hostname <ip>\n";      text += "                       Allows to set the callback-server's IP address for multi-homed hosts.\n";      text += "   -dispatch/callback/plugin/ior/port <port>\n";      text += "                       Allows to set the callback-server's port number.\n";      text += " For JacORB only:\n";      text += "   java -DOAIAddr=<ip> Use '-dispatch/callback/plugin/ior/hostname'\n";      text += "   java -DOAPort=<nr>  Use '-dispatch/callback/plugin/ior/port'\n";      text += "   java -Djacorb.log.default.verbosity=3  Switch CORBA debugging on\n";      text += "   java ... -ORBInitRef NameService=corbaloc:iiop:localhost:7608/StandardNS/NameServer-POA/_root\n";      text += "   java -DORBInitRef.NameService=corbaloc:iiop:localhost:7608/StandardNS/NameServer-POA/_root\n";      text += "\n";      return text;   }} // class CorbaConnection

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -