|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.candle.roma.kxm.KxmField | +--com.candle.roma.kxm.KxmMessage
This class represents a message with a collection of fields. The KxmMessage class provides an interface to access the whole message: create a KxmMessage object from a data buffer, extract a data buffer from a KxmMessage object, get message information. In addition, it supports the KxmField interfaces, which can be used to get nested fields and type information about message data.
KxmField
,
KxmDate
,
KxmException
,
KxmRange
,
KxmMsgCreateOptions
,
KxmMsgWriteOptions
,
KxmMsgConvertOptions
Fields inherited from class com.candle.roma.kxm.KxmField |
DTYPE_DATE, DTYPE_DATETIME, DTYPE_GDAY, DTYPE_GMONTH, DTYPE_GMONTHDAY, DTYPE_GYEAR, DTYPE_GYEARMONTH, DTYPE_NONE, DTYPE_TIME, EXACT, FLAG_ARRAY, FLAG_DEFAULT_VALUE, FLAG_GROUP, FLAG_ROOT, FLAG_UNION, FLAG_XMLATTR, FLAG_XMLDOC, FLAG_XMLELEM, GET_SCHEMA_FIELDS, NTYPE_DECIMAL, NTYPE_DOUBLE, NTYPE_FLOAT, NTYPE_INT16, NTYPE_INT32, NTYPE_INT64, NTYPE_INT8, NTYPE_INTEGER, NTYPE_NONE, NTYPE_UINT16, NTYPE_UINT32, NTYPE_UINT64, NTYPE_UINT8, SEARCH, TYPE_BINARY, TYPE_BOOL, TYPE_DATE, TYPE_DURATION, TYPE_GROUP, TYPE_NUMBER, TYPE_QNAME, TYPE_STRING, TYPE_XMLATTR, TYPE_XMLELEM, UNIQUE |
Constructor Summary | |
KxmMessage(byte[] data)
Creates a message object from data parsed as an XML. |
|
KxmMessage(byte[] data,
int options)
Creates a message object from data. |
|
KxmMessage(byte[] data,
java.lang.String format,
int options,
KxmEncoding encoding)
Creates a message object from data. |
|
KxmMessage(byte[] data,
java.lang.String format,
KxmMsgCreateOptions options)
Creates the message from data. |
|
KxmMessage(java.lang.String format)
Creates an empty message of the specified format. |
|
KxmMessage(java.lang.String format,
byte[] data)
Creates a message based on the MDR format defintion specified by the format parameter. |
|
KxmMessage(java.lang.String format,
byte[] data,
int options)
Creates a message object from data. |
|
KxmMessage(java.lang.String format,
int options)
Creates an empty message of the specified format. |
|
KxmMessage(java.lang.String format,
KxmMsgCreateOptions options)
Creates an empty message of the specified format. |
Method Summary | |
java.lang.Object |
clone()
Returns a copy of the KxmMessage object. |
KxmMessage |
convert(java.lang.String format)
Converts message data from one format to another one. |
KxmMessage |
convert(java.lang.String format,
int options)
Converts a message buffer from one message format to another one. |
KxmMessage |
convert(java.lang.String format,
KxmMsgConvertOptions options)
Converts message data from one message format to another one. |
void |
destroy()
Forces destruction of the underlying JNI object. |
static long |
getAliveMessagesCount()
|
java.lang.String |
getFormatName()
Returns the Metadata Repository format definition name that this message is based on. |
KxmEncoding |
getLastEncoding()
Returns encoding that was in effect for the last call of the following methods: write() write(KxmEncoding) write(KxmMsgWriteOptions) |
java.lang.String |
getXmlDocName()
Returns a name of the root XML element. |
java.lang.String |
toString()
Returns a string representation of the object. |
byte[] |
write()
Extracts message data. |
byte[] |
write(KxmEncoding encoding)
Extracts message data. |
byte[] |
write(KxmMsgWriteOptions options)
Extracts message data. |
Methods inherited from class com.candle.roma.kxm.KxmField |
applyFormat, applyFormat, at, declareNs, findField, findField, getArrayLen, getArrayLenRange, getBool, getByteArray, getCharacterData, getDate, getDateType, getDefault, getDouble, getDuration, getField, getField, getField, getField, getFlags, getHandle, getLocalPart, getLong, getName, getNsPrefix, getNsUri, getNumericType, getNumOfFields, getNumOfFields, getObject, getParent, getQName, getString, getType, getValueLenRange, isArray, isDefaultValue, isEmpty, isGroup, isInvalid, isNil, isRoot, loadMessageApi, set, set, set, set, set, set, set, set, set, setArrayLen, setBool, setCharacterData, setEmpty, setNil |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int STANDALONE
KxmMessage(String)
KxmMessage(String,int)
KxmMessage(String,byte[])
KxmMessage(String,byte[],int)
KxmMessage(byte[],int)
KxmMessage(byte[])
public static final int MDR
KxmMessage(String)
KxmMessage(String,int)
KxmMessage(String,byte[])
KxmMessage(String,byte[],int)
KxmMessage(byte[],int)
KxmMessage(byte[])
public static final int ANY
KxmMessage(String)
KxmMessage(String,int)
KxmMessage(String,byte[])
KxmMessage(String,byte[],int)
KxmMessage(byte[],int)
KxmMessage(byte[])
public static final int FORMAT_NAME
KxmMessage(String)
KxmMessage(String,int)
KxmMessage(String,byte[])
KxmMessage(String,byte[],int)
KxmMessage(byte[],int)
KxmMessage(byte[])
public static final int TO_XML
convert(String,int)
convert(String)
public static final int TO_FORMAT
convert(String,int)
convert(String)
public static final int BY_MAP
convert(String,int)
convert(String)
Constructor Detail |
public KxmMessage(java.lang.String format) throws KxmException
format
- Name of the message format.KxmException
- will be thrown on an error.public KxmMessage(java.lang.String format, int options) throws KxmException
format
- Name of the message format. An application
specifies either the format name of the message or the
name of the XML document, depending on the type parameter provided.type
- Specifies the type of message to be created. It must be on
of the following constants: KxmMessage.MDR
Creates message based on MDR format defintion specified
by the formatName parameter. If MDR does not contain
format definition then function fails.
KxmMessage.STANDALONE
Creates XML message not described in the MDR.
The formatNamae specifies name of the root element.
KxmMessage.ANY
The same as MDR, but if format definition is not present
then creates XML message not described in the MDR,
same as STANDALONE does.
KxmMessage.FORMAT_NAME
Creates message based on MDR format defintion
specified by the formatName parameter. If MDR
does not contain format definition then method fails.
KxmException
- will be thrown on an error.public KxmMessage(java.lang.String format, byte[] data) throws KxmException
format
- Name of the message format.data
- Message data.KxmException
- will be thrown on an error.public KxmMessage(java.lang.String format, byte[] data, int options) throws KxmException
format
- Name of the message format.data
- Message data.opt
- Specifies type of message to be created. It must be on of the following constants: KxmMessage.MDR
Creates message based on MDR format defintion specified by
the format parameter. If MDR does not contain format definition
then XML-Auto-Recognize logic takes place: the method preparses message
as an XML and determines name of the root XML element. If preparsing
succeeds then method tries to load the MDR format definition with name
matching the root XML element. If format definition is not found
again then method fails.KxmMessage.STANDALONE
Not allowed parameter, method fails.KxmMessage.ANY
The same as MDR, but if XML-Auto-Recognize logic
fails then the method parses data as an XML.
KxmMessage.FORMAT_NAME
Creates message based on MDR format
defintion specified by the formatName parameter. If MDR does not
contain format definition then method fails.KxmException
- will be thrown on an error.public KxmMessage(byte[] data) throws KxmException
data
- Message dataKxmException
- will be thrown on an error.public KxmMessage(byte[] data, int options) throws KxmException
data
- Message data.options
- Specifies type of message to be created. It must be
one of the following constants:KxmMessage.MDR
Creates message based on MDR format defintion specified by
the formatName parameter. If MDR does not contain format definition
then XML-Auto-Recognize logic takes place: the method preparses message
as an XML and determines name of the root XML element. If preparsing
succeeds then method tries to load the MDR format definition with name
matching the root XML element. If format definition is not found
again then method fails.KxmMessage.STANDALONE
Parses data as an XML.KxmMessage.ANY
The same as MDR, but if XML-Auto-Recognize logic
fails then the method parses data as an XML.KxmMessage.FORMAT_NAME
Not allowed parameter, method fails.KxmException
- will be thrown on an error.public KxmMessage(byte[] data, java.lang.String format, int options, KxmEncoding encoding) throws KxmException
data
- Message data.format
- Name of the message format, can be null.options
- Specifies type of message to be created. It must be
one of the following constants:KxmMessage.MDR
Creates message based on MDR format defintion specified by
the format parameter. If MDR does not contain format definition
or the format parameter is null, then XML-Auto-Recognize logic takes place:
the method preparses message as an XML and determines name of the root XML element.
If preparsing succeeds, then method tries to load the MDR format definition with name
matching the root XML element. If format definition is not found
again, then method fails.KxmMessage.STANDALONE
The format paramter should be null.
Parses data as an XML message.KxmMessage.ANY
The same as MDR, but if XML-Auto-Recognize logic
fails, then the method parses data as an XML message.
KxmMessage.FORMAT_NAME
Creates message based on the MDR format
defintion specified by the format parameter. If MDR does not
contain format definition or format paramter is null, then method fails.encoding
- Encoding, can be null. This parameter is used as a suggestion of the encoding
for the XML message. If recognized encoding of the input message
does not match the this parameter, then parameter is ignored.
For the raw messages the only supported encodings are
"NATIVE" and "UTF-16".KxmException
- will be thrown on an error.public KxmMessage(java.lang.String format, KxmMsgCreateOptions options) throws KxmException
format
- Name of the message format.option
- Message creation options.KxmException
- will be thrown on an error.KxmMsgCreateOptions
public KxmMessage(byte[] data, java.lang.String format, KxmMsgCreateOptions options) throws KxmException
data
- Message data.format
- Name of the message format, can be null.options
- Message creation options.KxmException
- will be thrown on an error.KxmMsgCreateOptions
Method Detail |
public java.lang.String getFormatName() throws KxmException
KxmException
- will be thrown on an error.public java.lang.String getXmlDocName() throws KxmException
KxmException
- will be thrown on an error.public KxmMessage convert(java.lang.String format, int options) throws KxmException
format
- Depending from options, it is either:
TO_FORMAT
)TO_XML
)BY_MAP
)options
- Conversion options. This parameter determines how the function
converts the message:
KxmMessage.TO_XML
The function converts the message
into a standalone XML document. The name parameter should specify
the root element name for the target XML document. This option does
not use any conversion maps.
KxmMessage.TO_FORMAT
The function converts
the message into the format specified by the name and defined in the
Metadata Repository. This option first searches conversion map that
can convert from the source to the target format. The map is only
searched in the same namespace where source format resides. If the
map is not found then the format is converted based on default
conversion rules.
KxmMessage.BY_MAP
The function converts the message
by the map specified by the name and defined in the Metadata
Repository. The message can not be standalone and should have the
same format as the source format of the map.
KxmException
- will be thrown on an error.public KxmMessage convert(java.lang.String format) throws KxmException
format
- Name of the target format.KxmException
- will be thrown on an error.public KxmMessage convert(java.lang.String format, KxmMsgConvertOptions options) throws KxmException
format
- Name of the target format.options
- Message conversion options.KxmException
- will be thrown on an error.KxmMsgConvertOptions
public byte[] write() throws KxmException
KxmException
- will be thrown on an error.public byte[] write(KxmEncoding encoding) throws KxmException
encoding
- Specifies in which encoding message should
be written. The only allowed encoding for the raw messages
is "NATIVE". For the XML messages any supported encoding
is allowed. For the XML messages "NATIVE" means "UTF-8"
on the ASCII platforms and current encoding of the platform
on the non-ASCII platforms.
If the encoding parameter is null, then this method is
equivalent to the write()
method.KxmException
- will be thrown on an error.public byte[] write(KxmMsgWriteOptions options) throws KxmException
options
- Message extraction options.
If the options parameter is null, then this method is
equivalent to the write()
method.KxmException
- will be thrown on an error.public KxmEncoding getLastEncoding() throws KxmException
write()
write(KxmEncoding)
write(KxmMsgWriteOptions)
KxmException
- is thrown if there was no write call.public void destroy() throws KxmException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class KxmField
public static long getAliveMessagesCount()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |