edu.tcnj.cs.ClayClient
Class ClayClient

java.lang.Object
  |
  +--edu.tcnj.cs.ClayClient.ClayClient
All Implemented Interfaces:
ClayClientListener

public class ClayClient
extends java.lang.Object
implements ClayClientListener


Constructor Summary
ClayClient(java.lang.String serverAddr, int listeningPort)
           
 
Method Summary
 boolean addClayInboundServer(int port)
           
 void addTarget(java.lang.String name, edu.tcnj.cs.ClayClient.ClayClientListener callback)
           
 void closeSession(java.lang.String workgroup)
           
 javax.xml.soap.SOAPMessage createClayBroadcastMessage(java.util.Hashtable attribs, org.w3c.dom.Document xmlDoc)
          Returns a SOAP message with ClayMessage's action set to broadcast and the XML document as an attachment.
 org.w3c.dom.Document createClayDocument(java.lang.String action, java.lang.String target, java.util.Hashtable attribs)
          Returns an XML Document containing a ClayDocument element populated with the contents of the hashtable.
 javax.xml.soap.SOAPMessage createClayMessage(java.lang.String action, java.util.Hashtable attribs)
          Returns a SOAP message containing a ClayMessage element populated with the contents of the hashtable.
 java.util.Vector getClientList()
           
 java.lang.String getProjectServerName()
           
 java.lang.String getServerAddr()
           
 java.lang.String getSessionID()
           
 java.lang.String getUsername()
           
 boolean isValidClayMessage(javax.xml.soap.SOAPMessage clayMsg, boolean printErrors)
          Returns true if the SOAPMessage contains one and only one ClayMessage element.
 boolean login(java.lang.String user, java.lang.String psw, java.lang.String client, java.lang.String version)
           
 void logout()
           
 void logout(java.lang.String workgroup)
           
 void onClayDocument(org.w3c.dom.Document inDoc)
           
 void onClaySOAPMessage(javax.xml.soap.SOAPMessage inMsg)
           
 void sendClayMessage(javax.xml.soap.SOAPMessage outMsg)
           
 javax.xml.soap.SOAPMessage sendLockingClayMessage(javax.xml.soap.SOAPMessage reqMsg, java.lang.String urlDest)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClayClient

public ClayClient(java.lang.String serverAddr,
                  int listeningPort)
           throws edu.tcnj.cs.ClayClient.ClayException
Method Detail

getUsername

public java.lang.String getUsername()

getSessionID

public java.lang.String getSessionID()

getServerAddr

public java.lang.String getServerAddr()

getProjectServerName

public java.lang.String getProjectServerName()

addClayInboundServer

public boolean addClayInboundServer(int port)
                             throws edu.tcnj.cs.ClayClient.ClayException
edu.tcnj.cs.ClayClient.ClayException

createClayMessage

public javax.xml.soap.SOAPMessage createClayMessage(java.lang.String action,
                                                    java.util.Hashtable attribs)
                                             throws javax.xml.soap.SOAPException
Returns a SOAP message containing a ClayMessage element populated with the contents of the hashtable.

Parameters:
action - Either a ClayServerLite reserved word or client-specific action.
attribs - Additional attributes for inclusion in the ClayDocument element.
javax.xml.soap.SOAPException

createClayDocument

public org.w3c.dom.Document createClayDocument(java.lang.String action,
                                               java.lang.String target,
                                               java.util.Hashtable attribs)
Returns an XML Document containing a ClayDocument element populated with the contents of the hashtable.

Parameters:
action - Attribute parsed by the target's onClayDocument method.
target - Registered name of a client class that extends ClayClientListener.
attribs - Additional attributes for inclusion in the ClayDocument element.

createClayBroadcastMessage

public javax.xml.soap.SOAPMessage createClayBroadcastMessage(java.util.Hashtable attribs,
                                                             org.w3c.dom.Document xmlDoc)
                                                      throws javax.xml.soap.SOAPException
Returns a SOAP message with ClayMessage's action set to broadcast and the XML document as an attachment. Sending this message to the ClayServerLite will trigger the distribution of the xmlDoc to all clients in the workgroup.

Parameters:
attribs - Additional attributes for inclusion in the ClayMessage element.
xmlDoc - The XML document for distribution.
javax.xml.soap.SOAPException

isValidClayMessage

public boolean isValidClayMessage(javax.xml.soap.SOAPMessage clayMsg,
                                  boolean printErrors)
Returns true if the SOAPMessage contains one and only one ClayMessage element.

Parameters:
clayMsg - SOAPMessage to be validated.
printErrors - If failed, explain what went wrong on the console.

sendClayMessage

public void sendClayMessage(javax.xml.soap.SOAPMessage outMsg)

sendLockingClayMessage

public javax.xml.soap.SOAPMessage sendLockingClayMessage(javax.xml.soap.SOAPMessage reqMsg,
                                                         java.lang.String urlDest)
                                                  throws javax.xml.soap.SOAPException
javax.xml.soap.SOAPException

onClayDocument

public void onClayDocument(org.w3c.dom.Document inDoc)
Specified by:
onClayDocument in interface ClayClientListener

onClaySOAPMessage

public void onClaySOAPMessage(javax.xml.soap.SOAPMessage inMsg)
Specified by:
onClaySOAPMessage in interface ClayClientListener

addTarget

public void addTarget(java.lang.String name,
                      edu.tcnj.cs.ClayClient.ClayClientListener callback)
               throws edu.tcnj.cs.ClayClient.ClayException
edu.tcnj.cs.ClayClient.ClayException

getClientList

public java.util.Vector getClientList()

login

public boolean login(java.lang.String user,
                     java.lang.String psw,
                     java.lang.String client,
                     java.lang.String version)

closeSession

public void closeSession(java.lang.String workgroup)

logout

public void logout()

logout

public void logout(java.lang.String workgroup)