| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jalios.jstore.jsync.JSyncUtil
public class JSyncUtil
This class provides utility methods
| Field Summary | |
|---|---|
static org.apache.log4j.Logger | 
logger
 | 
static String | 
REVISION
 | 
| Fields inherited from interface com.jalios.jstore.jsync.JSyncConstants | 
|---|
SC_BAD_ADDRESS, SC_BAD_LEADER, SC_BAD_MESSAGE, SC_INTERNAL_SERVER_ERROR, SC_JOIN_REJECTED, SC_LEADER_CANNOT_JOIN, SC_NO_ACK, SC_NO_SEND, SC_OK, SC_UNKNOWN, SC_UNKNOWN_URID, SC_URID_ALREADY_ADDED, STATUS_LEADER, STATUS_LONE, STATUS_MEMBER, STATUS_SUBLEADER | 
| Fields inherited from interface com.jalios.util.JaliosConstants | 
|---|
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR | 
| Constructor Summary | |
|---|---|
JSyncUtil()
 | 
|
| Method Summary | |
|---|---|
static boolean | 
checkIP(javax.servlet.ServletRequest request,
        org.apache.oro.text.regex.Pattern ipPattern)
 | 
static int | 
cleanStatusCode(int status)
 | 
static String | 
getStatusPhrase(int status)
Returns an english phrase associated to the given status code.  | 
static void | 
main(String[] args)
 | 
static AckMessage | 
readAck(InputStream in)
Read and parse an AckMessage  | 
static AckMessage | 
readAck(String responseBody)
Read and parse an AckMessage  | 
static Message | 
readMessage(InputStream in)
Read and parse a Message  | 
static Message | 
readMessage(String responseBody)
Read and parse a Message  | 
static AckMessage | 
sendMessage(String url,
            Message msg)
Send a message  | 
static void | 
writeAck(OutputStream out,
         String urid,
         int status,
         StampTable progressTable)
Write an AckMessage  | 
static void | 
writeMessage(OutputStream out,
             Message msg)
Write a Message  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String REVISION
public static final org.apache.log4j.Logger logger
| Constructor Detail | 
|---|
public JSyncUtil()
| Method Detail | 
|---|
public static AckMessage sendMessage(String url,
                                     Message msg)
url - the url the message must be sent tomsg - the message to be sent
public static void writeAck(OutputStream out,
                            String urid,
                            int status,
                            StampTable progressTable)
out - the OutputStream to use for writing the messageurid - the URID of the senderstatus - the status codeprogressTable - the progressTable of the senderpublic static AckMessage readAck(InputStream in)
in - the InputStream that contains the message to be read
public static AckMessage readAck(String responseBody)
responseBody - a string containing the message to be read, usually the response body of JSync http request.
public static void writeMessage(OutputStream out,
                                Message msg)
out - the OutputStream to use for writing the messagemsg - the message to write
public static Message readMessage(InputStream in)
                           throws org.jdom.JDOMException,
                                  IOException
in - the InputStream that contains the message to be read
org.jdom.JDOMException
IOException
public static Message readMessage(String responseBody)
                           throws org.jdom.JDOMException,
                                  IOException
responseBody - a string containing the message to be read, usually the response body of JSync http request.
org.jdom.JDOMException
IOExceptionpublic static int cleanStatusCode(int status)
public static String getStatusPhrase(int status)
status - the status code
public static boolean checkIP(javax.servlet.ServletRequest request,
                              org.apache.oro.text.regex.Pattern ipPattern)
public static void main(String[] args)
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||