📄 emailconnection.java
字号:
public void shutdown() { if (log.isLoggable(Level.FINER)) log.finer("Entering shutdown of callback server"); this.isLoggedIn = false; } /** * @return true if you are logged in */ public final boolean isLoggedIn() { return this.isLoggedIn; } /** * Enforced by I_XmlBlasterConnection interface (failsafe mode). * Subscribe to messages. * <p /> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.subscribe.html">The interface.subscribe requirement</a> */ public final String subscribe(String xmlKey_literal, String qos_literal) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering subscribe(id=" + getSecretSessionId() + ")"); return (String)super.sendEmail(xmlKey_literal, qos_literal, MethodName.SUBSCRIBE, SocketExecutor.WAIT_ON_RESPONSE); } /** * Unsubscribe from messages. * <p /> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.unSubscribe.html">The interface.unSubscribe requirement</a> */ public final String[] unSubscribe(String xmlKey_literal, String qos_literal) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering unSubscribe(): id=" + getSecretSessionId()); return (String[])super.sendEmail(xmlKey_literal, qos_literal, MethodName.UNSUBSCRIBE, SocketExecutor.WAIT_ON_RESPONSE); /* MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.UNSUBSCRIBE, sessionId); parser.addKeyAndQos(xmlKey_literal, qos_literal); Object response = super.execute(parser, SocketExecutor.WAIT_ON_RESPONSE, SocketUrl.SOCKET_TCP); return (String[])response; */ } /** * Publish a message. * The normal publish is handled here like a publishArr * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.publish.html">The interface.publish requirement</a> */ public final String publish(MsgUnitRaw msgUnit) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering publish(): id=" + getSecretSessionId()); return (String)super.sendEmail(msgUnit, MethodName.PUBLISH, SocketExecutor.WAIT_ON_RESPONSE); /* MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.PUBLISH, sessionId); parser.addMessage(msgUnit); Object response = super.execute(parser, SocketExecutor.WAIT_ON_RESPONSE, SocketUrl.SOCKET_TCP); String[] arr = (String[])response; // return the QoS return arr[0]; // return the QoS */ } /** * Publish multiple messages in one sweep. * <p /> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.publish.html">The interface.publish requirement</a> */ public final String[] publishArr(MsgUnitRaw[] msgUnitArr) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering publishArr: id=" + getSecretSessionId()); if (msgUnitArr == null) { if (log.isLoggable(Level.FINE)) log.fine("The argument of method publishArr() are invalid"); throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME + ".InvalidArguments", "The argument of method publishArr() are invalid"); } return (String[])super.sendEmail(msgUnitArr, MethodName.PUBLISH, SocketExecutor.WAIT_ON_RESPONSE); /* try { MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.PUBLISH, sessionId); parser.addMessage(msgUnitArr); Object response = super.execute(parser, SocketExecutor.WAIT_ON_RESPONSE, SocketUrl.SOCKET_TCP); return (String[])response; // return the QoS } catch (IOException e1) { if (log.isLoggable(Level.FINE)) log.fine(e1.toString()); throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "publishArr", e1); } */ } /** * Publish multiple messages in one sweep. * <p /> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.publish.html">The interface.publish requirement</a> */ public final void publishOneway(MsgUnitRaw[] msgUnitArr) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering publishOneway: id=" + getSecretSessionId()); if (msgUnitArr == null) { if (log.isLoggable(Level.FINE)) log.fine("The argument of method publishOneway() are invalid"); return; } super.sendEmail(msgUnitArr, MethodName.PUBLISH_ONEWAY, SocketExecutor.ONEWAY); /* try { MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.PUBLISH_ONEWAY, sessionId); parser.addMessage(msgUnitArr); super.execute(parser, SocketExecutor.ONEWAY, SocketUrl.SOCKET_TCP); } catch (Throwable e) { if (log.isLoggable(Level.FINE)) log.fine("Sending of oneway message failed: " + e.toString()); throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, MethodName.PUBLISH_ONEWAY.toString(), e); } */ } /** * Delete messages. * <p /> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.erase.html">The interface.erase requirement</a> */ public final String[] erase(String xmlKey_literal, String qos_literal) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering erase() id=" + getSecretSessionId()); return (String[])super.sendEmail(xmlKey_literal, qos_literal, MethodName.ERASE, SocketExecutor.WAIT_ON_RESPONSE); /* try { MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.ERASE, sessionId); parser.addKeyAndQos(xmlKey_literal, qos_literal); Object response = super.execute(parser, SocketExecutor.WAIT_ON_RESPONSE, SocketUrl.SOCKET_TCP); return (String[])response; // return the QoS TODO } catch (IOException e1) { if (log.isLoggable(Level.FINE)) log.fine(e1.toString()); throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, MethodName.ERASE.toString(), e1); } */ } /** * Synchronous access a message. * <p /> * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.get.html">The interface.get requirement</a> */ public final MsgUnitRaw[] get(String xmlKey_literal, String qos_literal) throws XmlBlasterException { if (log.isLoggable(Level.FINER)) log.finer("Entering get() xmlKey=\n" + xmlKey_literal + ") ..."); return (MsgUnitRaw[])super.sendEmail(xmlKey_literal, qos_literal, MethodName.GET, SocketExecutor.WAIT_ON_RESPONSE); /* try { MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.GET, sessionId); parser.addKeyAndQos(xmlKey_literal, qos_literal); Object response = super.execute(parser, SocketExecutor.WAIT_ON_RESPONSE, SocketUrl.SOCKET_TCP); return (MsgUnitRaw[])response; } catch (IOException e1) { if (log.isLoggable(Level.FINE)) log.fine(e1.toString()); throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, MethodName.GET.toString(), e1); } */ } /** * Check server. * @see <a href="http://www.xmlBlaster.org/xmlBlaster/src/java/org/xmlBlaster/protocol/corba/xmlBlaster.idl" target="others">CORBA xmlBlaster.idl</a> */ public String ping(String qos) throws XmlBlasterException { if (!this.isInitialized) return ""; // "<qos><state info='INITIAL'/></qos>" // Send from ClientDispatchConnection.java on connect if (qos != null && qos.indexOf(Constants.INFO_INITIAL) != -1) { if (log.isLoggable(Level.FINE)) log.fine("Email connection ping is suppressed as doing it before connect() may" + " block the clients connect() if the server is not running"); //return Constants.RET_OK; throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_FORCEASYNC, ME, "Going initially to polling (async delivery) in case server is not available to avoid blocking pingResponseTimeout"); } return (String)super.sendEmail(qos, MethodName.PING, SocketExecutor.WAIT_ON_RESPONSE); } /** * Command line usage. * @see SmtpClient#setSessionProperties(Properties, Global, I_PluginConfig) */ public String usage() { String text = "\n"; text += "EmailConnection 'email' options:\n"; text += " -dispatch/connection/plugin/email/port\n"; text += " Specify a port number where the SMTP MTA listens [25].\n"; text += " -dispatch/connection/plugin/email/hostname\n"; text += " Specify a hostname where the SMTP MTA runs [localhost].\n"; text += " -dispatch/connection/plugin/email/responseTimeout\n"; text += " How long to wait for a method invocation to return [60000].\n"; text += " Defaults to one minute.\n"; text += " -dispatch/connection/plugin/email/multiThreaded\n"; text += " Use seperate threads per update() on client side [true].\n"; text += " -dispatch/connection/plugin/email/compress/type\n"; text += " Valid values are: '', '"+Constants.COMPRESS_ZLIB_STREAM+"', '"+Constants.COMPRESS_ZLIB+"' [].\n"; text += " '' disables compression, '"+Constants.COMPRESS_ZLIB_STREAM+"' compresses whole stream.\n"; text += " '"+Constants.COMPRESS_ZLIB+"' only compresses flushed chunks bigger than 'compress/minSize' bytes.\n"; text += " -dispatch/connection/plugin/email/compress/minSize\n"; text += " Compress message bigger than given bytes, see above.\n"; text += " -dump[email] true switches on detailed 'email' debugging [false].\n"; text += "\n"; return text; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -