|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.realtime.xmpp.util.RestartingEndpoint | +--com.realtime.xmpp.dom.DomComponent | +--com.realtime.xmpp.dom.DomAcceptComponent | +--com.realtime.xmpp.examples.EchoComponent
This is the standard EchoComponent to demonstrate communications with the Jabber server. This component echoes incoming packets back to jabber.
For now, it only works with <message> and <iq> packets. All other packets are dropped.
Message packets simply have their 'to' and 'from' fields reversed. Iq packets have their sub-elements removed, and then replaced by a single <error> element.
All status messages and errors are sent to the console.
Nested Class Summary |
Nested classes inherited from class com.realtime.xmpp.dom.DomAcceptComponent |
DomAcceptComponent.AuthenticationManager |
Field Summary | |
protected static java.lang.String |
USAGE
Command line help string. |
Fields inherited from class com.realtime.xmpp.dom.DomAcceptComponent |
m_authenticationMonitor, m_bAuthenticated, m_sSecret |
Fields inherited from class com.realtime.xmpp.dom.DomComponent |
m_transformer |
Fields inherited from class com.realtime.xmpp.util.RestartingEndpoint |
m_session, m_sessionRestarter, XMPP_REQUEST_TIMEOUT |
Constructor Summary | |
EchoComponent(java.lang.String sHost,
int nPort,
java.lang.String sSecret)
Create an ACCEPT namespaced component that generates DOM packets from incoming messages. |
Method Summary | |
void |
incomingPacket(org.dom4j.Element request)
Echo the incoming packet back to jabber. |
static void |
main(java.lang.String[] argv)
Command line testing. |
Methods inherited from class com.realtime.xmpp.dom.DomAcceptComponent |
init, start, waitForAuthentication |
Methods inherited from class com.realtime.xmpp.dom.DomComponent |
getDomTransformer, query, send |
Methods inherited from class com.realtime.xmpp.util.RestartingEndpoint |
fastStart, getComponentName, getSession, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String USAGE
Constructor Detail |
public EchoComponent(java.lang.String sHost, int nPort, java.lang.String sSecret) throws java.security.NoSuchAlgorithmException
Create an ACCEPT namespaced component that generates DOM packets from incoming messages. Uses the secret to handshake with the Jabber server.
sHost
- The host name to connect to.nPort
- The server port to connect to.sSecret
- The secret to validate us with the Jabber server.
java.security.NoSuchAlgorithmException
- Generated when the SHA1 digest
is unavailable.Method Detail |
public void incomingPacket(org.dom4j.Element request)
Echo the incoming packet back to jabber.
For now, only work with message and iq packets. All other packets are dropped.
Message packets simply have their 'to' and 'from' fields reversed. Iq packets have their sub-elements removed, and replaced by a single error element.
Status messages are sent to the console.
incomingPacket
in interface DomPacketListener
request
- The XMPP packet as a DOM element.public static void main(java.lang.String[] argv)
Command line testing. If there are no arguments, a help prompt will be generated.
argv
- Command line arguments. At least one argument,
the secret, is required. The second, and optional, argument is
the host name as a DNS resolvable server name. The third
parameter is used as the port number to connect to on the host.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |