public abstract class MessageWriter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
boolean |
active |
java.util.ArrayList<java.lang.String> |
currentpath |
Constructor and Description |
---|
MessageWriter() |
Modifier and Type | Method and Description |
---|---|
void |
addBooleanField(java.lang.String fieldname,
boolean fieldcontent) |
void |
addDateField(java.lang.String fieldname,
java.util.Date fieldcontent) |
void |
addDecimalField(java.lang.String fieldname,
java.math.BigDecimal fieldcontent) |
void |
addIntegerField(java.lang.String fieldname,
int fieldcontent) |
void |
addLongBinaryField(java.lang.String fieldname,
SFile binaryfile) |
void |
addStringField(java.lang.String fieldname,
java.lang.String fieldcontent) |
abstract void |
checkConnection() |
static void |
checkLabelCorrect(java.lang.String label,
java.lang.String context)
This method checks that a label (field name or structure name) is compliant
to the rules of a OLc messages.
|
protected java.lang.String |
currentpath() |
void |
endMessage() |
void |
endStructure(java.lang.String structurename) |
abstract void |
flushMessage() |
java.lang.String |
getCurrentPadding() |
boolean |
isActive() |
boolean |
isIsfirstelementinstructure() |
abstract void |
sendMessageElement(MessageElement messageelement) |
void |
sendMessageError(int errorcode,
java.lang.String errormessage) |
void |
startNewMessage()
method to be implemented by a MessageWriter: ensures that a communication is
open, reopen it if required, and start sending a message
|
void |
startStructure(java.lang.String structurename) |
public java.util.ArrayList<java.lang.String> currentpath
public boolean active
public boolean isIsfirstelementinstructure()
public java.lang.String getCurrentPadding()
public abstract void checkConnection() throws java.io.IOException
java.io.IOException
- if the connection has an issuepublic abstract void sendMessageElement(MessageElement messageelement) throws java.io.IOException
messageelement
- Element to be sentjava.io.IOException
- if any exception is received while sending the element.public abstract void flushMessage() throws java.io.IOException
java.io.IOException
public static void checkLabelCorrect(java.lang.String label, java.lang.String context)
label
- the label to checkpublic void startNewMessage() throws java.io.IOException
java.io.IOException
- if any problem happens with the communicationpublic void startStructure(java.lang.String structurename) throws java.io.IOException
structurename
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'java.io.IOException
- if any problem happens with the communicationpublic void addStringField(java.lang.String fieldname, java.lang.String fieldcontent) throws java.io.IOException
fieldname
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'fieldcontent
- payload (potentially null string)java.io.IOException
- if any problem happens with the communicationpublic void addDateField(java.lang.String fieldname, java.util.Date fieldcontent) throws java.io.IOException
fieldname
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'fieldcontent
- payload (potentially null date)java.io.IOException
- if any problem happens with the communicationpublic void addBooleanField(java.lang.String fieldname, boolean fieldcontent) throws java.io.IOException
fieldname
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'fieldcontent
- payload (boolean true or false)java.io.IOException
- if any problem happens with the communicationpublic void addIntegerField(java.lang.String fieldname, int fieldcontent) throws java.io.IOException
fieldname
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'fieldcontent
- payload (non null integer)java.io.IOException
- if any problem happens with the communicationpublic void addDecimalField(java.lang.String fieldname, java.math.BigDecimal fieldcontent) throws java.io.IOException
fieldname
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'fieldcontent
- payload (potentially null BigDecimal)java.io.IOException
- if any problem happens with the communicationpublic void addLongBinaryField(java.lang.String fieldname, SFile binaryfile) throws java.io.IOException
fieldname
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a minus
'-' or an underscore '_'binaryfile
- payload (potentially null SFile)java.io.IOException
- if any problem happens with the communicationpublic void endStructure(java.lang.String structurename) throws java.io.IOException
structurename
- has to be a valid name (first character an upper case
latine letter (A...Z), other characters either an
upper-case latine letter (A...Z), a figure (0...9), a
minus '-' or an underscore '_'java.io.IOException
- if any problem happens with the communicationpublic void endMessage() throws java.io.IOException
java.io.IOException
- if any problem happens with the communicationpublic void sendMessageError(int errorcode, java.lang.String errormessage) throws java.io.IOException
errorcode
- code of the error (0 to signal error code is not used /
not significant)errormessage
- human readable messagejava.io.IOException
- if any problem happens with the communicationprotected java.lang.String currentpath()
public boolean isActive()