Class AFrame
java.lang.Object
org.apache.vinci.transport.FrameComponent
org.apache.vinci.transport.Frame
org.apache.vinci.transport.QueryableFrame
org.apache.vinci.transport.VinciFrame
org.apache.vinci.transport.document.AFrame
- All Implemented Interfaces:
Transportable
This class is a VinciFrame with extensions for support of XML attributes.
This class provides a set of "aadd" decorator methods that are almost exactly the same as the
"fadd" methods of the Frame class, except they return an empty set of attributes that can then be
populated. See the "main()" method for an example of how to use this class to easily create
documents with attributes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDecorator method for adding a valueless tag.Decorator method for adding boolean valued tags.Decorator method for adding binary valued tags.Decorator method for adding double valued tags.Decorator method for adding double-array valued tags.Decorator method for adding float-valued tags.Decorator method for adding float-array valued tags.Decorator method for adding int valued tags.Decorator method for adding int-array valued tags.Decorator method for adding long valued tags.Decorator method for adding long-array valued tags.Decorator method for adding String valued tags.Decorator method for adding Frame-valued tags.aaddTrueBinary
(String key, byte[] val) This is a hack method which allows you to add binary-valued tags to Frames in a manner such that there is no textual encoding overhead of that binary data.Get the attributes associated with a particular key.createFrameLeaf
(byte[] array) Override the createFrameLeaf to create an AFrameLeaf so that leaf values can have attributes.createSubFrame
(String tag_name, int initialCapacity) Override the createSubFrame to create an AFrame of precise capacity.fgetAFrame
(String key) Convenience method for fetching sub-frames when their type is known to be AFramestatic TransportableFactory
Get a TransportableFactory that creates new AFrames.Get the attributes associated with this FrameComponent.static AFrame
rpc
(Transportable in, String service_name) static AFrame
rpc
(Transportable in, String service_name, int socket_timeout) static AFrame
rpc
(Transportable in, String service_name, int socket_timeout, int connect_timeout) void
Set the attributes (replacing any previous ones) assocated with this Frame component.static AFrame
Create an AFrame that is a (deep) copy of the given transportable.Methods inherited from class org.apache.vinci.transport.VinciFrame
add, ensureCapacity, fdrop, fdropFirst, fget, fgetFirst, fgetVinciFrame, fkeys, freset, fset, fset, fset, fset, fset, fset, fset, fset, fsetTrueBinary, getKeyValuePair, getKeyValuePairCount, getVinciFrameFactory, set, stripWhitespace, toVinciFrame
Methods inherited from class org.apache.vinci.transport.QueryableFrame
fgetBoolean, fgetBytes, fgetDouble, fgetDoubleArray, fgetFloat, fgetFloatArray, fgetFrame, fgetInt, fgetIntArray, fgetLong, fgetLongArray, fgetString, fgetStringArray, fgetTrueBinary
-
Constructor Details
-
AFrame
public AFrame() -
AFrame
public AFrame(int capacity) - Parameters:
capacity
- -
-
-
Method Details
-
setAttributes
Description copied from class:FrameComponent
Set the attributes (replacing any previous ones) assocated with this Frame component. Default implementation does nothing since attributes are not supported by default.- Overrides:
setAttributes
in classFrameComponent
- Parameters:
s
- -
-
getAttributes
Description copied from class:FrameComponent
Get the attributes associated with this FrameComponent.- Overrides:
getAttributes
in classFrameComponent
- Returns:
- The set of attributes associated with this FrameComponent. This method may return "null" to indicate there are no attributes. It could however return an empty Attribute set depending on the implementation.
-
createAttributes
-
getAFrameFactory
Get a TransportableFactory that creates new AFrames.- Returns:
- -
-
toAFrame
Create an AFrame that is a (deep) copy of the given transportable.- Parameters:
t
- -- Returns:
- -
-
createSubFrame
Override the createSubFrame to create an AFrame of precise capacity.- Overrides:
createSubFrame
in classVinciFrame
- Parameters:
tag_name
- -initialCapacity
- -- Returns:
- the created sub-frame.
-
createFrameLeaf
Override the createFrameLeaf to create an AFrameLeaf so that leaf values can have attributes.- Overrides:
createFrameLeaf
in classFrame
- Parameters:
array
- -- Returns:
- the created FrameLeaf.
-
fgetAFrame
Convenience method for fetching sub-frames when their type is known to be AFrame- Parameters:
key
- The key identifying the value to retrieve.- Returns:
- The requested value, or null if the specified key does not exist.
- Throws:
ClassCastException
- if the value was not of type AFrame.
-
aget
Get the attributes associated with a particular key. If there is more than one matching key, then the attributes of only the first matching key are returned.- Parameters:
key
- The key whose attributes to fetch.- Returns:
- The (possibly empty) set of attributes associated with the key, or null (which indicates no such key).
-
aadd
Decorator method for adding float-valued tags.- Parameters:
key
- The key to be associated with the value.val
- -- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding float-array valued tags.- Parameters:
key
- The key to be associated with the value.val
- -- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding double valued tags.- Parameters:
key
- The key to be associated with the value.val
- -- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding double-array valued tags.- Parameters:
key
- The key to be associated with the value.val
- The array to add. The array is immediately converted to string representation.- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding int valued tags.- Parameters:
key
- The key to be associated with the value.val
- The int to add.- Returns:
- The (empty) set of attributes associated with the key.
-
aadd
Decorator method for adding int-array valued tags.- Parameters:
key
- The key to be associated with the value.val
- The array to add. The array is immediately converted to string representation.- Returns:
- The set of attributes associated with the key.
-
aadd
Decorator method for adding long valued tags.- Parameters:
key
- The key to be associated with the value.val
- The long value to add.- Returns:
- The (empty) set of attributes associated with the key.
-
aadd
Decorator method for adding long-array valued tags.- Parameters:
key
- The key to be associated with the value.val
- The array to add. The array is immediately converted to string representation.- Returns:
- The (empty) set of attributes associated with the key.
-
aadd
Decorator method for adding String valued tags.- Parameters:
key
- The key to be associated with the value.val
- The string to add.- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding binary valued tags. Encodes the data in Base64.- Parameters:
key
- The key to be associated with the value.val
- The data to be encoded and added to this frame.- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding boolean valued tags.- Parameters:
key
- The key to be associated with the value.val
- The boolean value to add.- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding Frame-valued tags.- Parameters:
key
- The key to be associated with the value.val
- The sub-frame to add. Note this frame is not copied.- Returns:
- The (empty) set of attributes associated with the added key.
-
aadd
Decorator method for adding a valueless tag.- Parameters:
key
- The key name.- Returns:
- The (empty) set of attributes associated with the added key.
-
aaddTrueBinary
This is a hack method which allows you to add binary-valued tags to Frames in a manner such that there is no textual encoding overhead of that binary data. This is NOT necessarily XTalk-1.0 compatible which formally requires only UTF-8, but it still works. Binary data added using this method can be retrieved using QueryableFrame/VinciFrame getter method fgetTrueBinary(String). WARNING: if the default XTalk parser is replaced with another one, applications that depend on this method may break! NOTE: This method should only be used when performance hit of Base64 encoding binary data [as performed by aadd(String, byte[])] is unacceptable.- Parameters:
key
- The key to be associated with the value.val
- The byte array to be added to the frame. Note the array is NOT copied or converted in any way.- Returns:
- The (empty) set of attributes associated with the added key.
-
rpc
public static AFrame rpc(Transportable in, String service_name) throws IOException, ServiceException, ServiceDownException, VNSException - Parameters:
in
- -service_name
- -- Returns:
- -
- Throws:
IOException
- -ServiceException
- -ServiceDownException
- -VNSException
- -IllegalStateException
- if VNS_HOST is not specified.
-
rpc
public static AFrame rpc(Transportable in, String service_name, int socket_timeout) throws IOException, ServiceException, ServiceDownException, VNSException - Parameters:
in
- -service_name
- -socket_timeout
- -- Returns:
- -
- Throws:
IOException
- -ServiceException
- -ServiceDownException
- -VNSException
- -IllegalStateException
- if VNS_HOST is not specified.
-
rpc
public static AFrame rpc(Transportable in, String service_name, int socket_timeout, int connect_timeout) throws IOException, ServiceException, ServiceDownException, VNSException - Parameters:
in
- -service_name
- -socket_timeout
- -connect_timeout
- -- Returns:
- -
- Throws:
IOException
- -ServiceException
- -ServiceDownException
- -VNSException
- -IllegalStateException
- if VNS_HOST is not specified.
-