com.jabberwookie
Class Component2Server

java.lang.Object
  |
  +--com.jabberwookie.Stream
        |
        +--com.jabberwookie.Component2Server
All Implemented Interfaces:
UnrecognizedChunkListener

public class Component2Server
extends Stream
implements UnrecognizedChunkListener

Implements the required methods to establish a connection to a Jabber server as a component. This allows you to create new services for the server.

Author:
smeiners

Field Summary
 
Fields inherited from class com.jabberwookie.Stream
chunkProcessor, chunkQueue, connected, connectionId, DEBUG, in, iqListener, mListener, ns, out, outWriter, parserT, pListener, processor, PROCESSOR_WAIT_TIME, unListener, waitingIds
 
Constructor Summary
Component2Server(java.io.InputStream in, java.io.OutputStream out, java.lang.String secret)
          Creates a new instance of Component2Server.
Component2Server(java.io.InputStream in, java.io.OutputStream out, java.lang.String secret, Processor processor)
          Creates a new instance of Component2Server.
 
Method Summary
 void close()
          Closes the stream.
 void docStart(java.lang.String tag, java.util.Hashtable attrs)
           
 void incomingChunk(Chunk chunk)
          From UnrecognizedChunkListener, needed for authentication.
 boolean open(java.lang.String serverName, int timeoutSecs)
          Opens the stream and attempts to authenticate itself.
 void setUnrecogizedChunkListener(UnrecognizedChunkListener listener)
          Since Jabber components are set to receive data from specific namespaces only this overrides the default Stream.setUnrecogizedChunkListener(com.jabberwookie.UnrecognizedChunkListener) to do nothing.
 
Methods inherited from class com.jabberwookie.Stream
cData, chunkStart, chunkStop, docStop, dtdData, elementStart, elementStop, getConnectionId, isConnected, processChunk, processingInstruction, send, send, setAllListeners, setIQListener, setMessageListener, setNamespaces, setPresenceListener, setProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Component2Server

public Component2Server(java.io.InputStream in,
                        java.io.OutputStream out,
                        java.lang.String secret)
Creates a new instance of Component2Server. Since this class doesn't understand what a Socket is you'll have to open one youself and then pass in the input and output stream.

Parameters:
secret - The secret used to authenticate yourself to the Jabber server.

Component2Server

public Component2Server(java.io.InputStream in,
                        java.io.OutputStream out,
                        java.lang.String secret,
                        Processor processor)
Creates a new instance of Component2Server. Since this class doesn't understand what a Socket is you'll have to open one youself and then pass in the input and output stream. Please see the documentation for Stream.Stream(InputStream,OutputStream,Processor) and Stream.setProcessor(Processor) for more information about the Processor.

Parameters:
secret - The secret used to authenticate yourself to the Jabber server.
Method Detail

setUnrecogizedChunkListener

public void setUnrecogizedChunkListener(UnrecognizedChunkListener listener)
Since Jabber components are set to receive data from specific namespaces only this overrides the default Stream.setUnrecogizedChunkListener(com.jabberwookie.UnrecognizedChunkListener) to do nothing.

Overrides:
setUnrecogizedChunkListener in class Stream

open

public boolean open(java.lang.String serverName,
                    int timeoutSecs)
             throws java.io.IOException
Opens the stream and attempts to authenticate itself.

Specified by:
open in class Stream
Parameters:
serverName -
timeoutSecs -
Returns:
Throws:
java.io.IOException

close

public void close()
Closes the stream.

Specified by:
close in class Stream

docStart

public void docStart(java.lang.String tag,
                     java.util.Hashtable attrs)
Overrides:
docStart in class Stream

incomingChunk

public void incomingChunk(Chunk chunk)
From UnrecognizedChunkListener, needed for authentication.

Specified by:
incomingChunk in interface UnrecognizedChunkListener