com.web_visage.ichat
Class DefaultConnectionResource

java.lang.Object
  extended by com.web_visage.ichat.DefaultConnectionResource
All Implemented Interfaces:
ConnectionResource, IChatResource

public class DefaultConnectionResource
extends java.lang.Object
implements ConnectionResource

Sychronous socket based connection resource.

Author:
K.Baturytski

Constructor Summary
DefaultConnectionResource(IChatMessageFactory messageFactory, java.lang.String serverIp, int serverPort)
          Constructor.
 
Method Summary
 void acquire()
          Acquires new resource.
 IChatReader getReader()
          Returns a reader for the resource.
 IChatWriter getWriter()
          Returns a writer for the resource.
 boolean isConnected()
          Checks whether resource is connected.
 void release()
          Releases the resource and performs necessary cleanup.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConnectionResource

public DefaultConnectionResource(IChatMessageFactory messageFactory,
                                 java.lang.String serverIp,
                                 int serverPort)
Constructor.

Parameters:
serverIp -
serverPort -
Throws:
java.io.IOException
java.net.UnknownHostException
Method Detail

getReader

public IChatReader getReader()
Description copied from interface: ConnectionResource
Returns a reader for the resource.

Specified by:
getReader in interface ConnectionResource
Returns:
See Also:
ConnectionResource.getReader()

getWriter

public IChatWriter getWriter()
Description copied from interface: ConnectionResource
Returns a writer for the resource.

Specified by:
getWriter in interface ConnectionResource
Returns:
See Also:
ConnectionResource.getWriter()

acquire

public void acquire()
             throws IChatException,
                    java.io.IOException
Description copied from interface: IChatResource
Acquires new resource.

Specified by:
acquire in interface IChatResource
Throws:
IChatException
java.io.IOException
See Also:
IChatResource.acquire()

release

public void release()
             throws IChatException,
                    java.io.IOException
Description copied from interface: IChatResource
Releases the resource and performs necessary cleanup.

Specified by:
release in interface IChatResource
Throws:
IChatException
java.io.IOException
See Also:
IChatResource.release()

isConnected

public boolean isConnected()
Description copied from interface: ConnectionResource
Checks whether resource is connected.

Specified by:
isConnected in interface ConnectionResource
Returns:
See Also:
ConnectionResource.isConnected()