|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.connection.AttributeSubscriptionList
public class AttributeSubscriptionList
AttributeSubscriptionList
is used for defining pairs messageId::attributeId
for subscription to row data in incoming protocol "event" messages.
Subscribed attributes can be defined or undefined in protocol. In any case subscribed attribute will not
be parsed by Platform SDK. They can be accessed on the message level by indexers
with their id (in the string form, e.g. "14"
) as a key.
ConfServerProtocol protocol = new ConfServerProtocol(
new Endpoint("conf-srv", HOST, PORT));
protocol.setUserName(USERNAME);
protocol.set...
AttributeSubscriptionList subscriptionList = new AttributeSubscriptionList();
subscriptionList.addAttribute(EventObjectsRead.ID, "9"); // 9 - "ConfObject"
subscriptionList.applyToContext(protocol.connectionContext());
protocol.open();
After such configuration of the connection, incoming EventObjectsRead
will not contain Documents at eventObjectsRead.getConfObject()
,
but it will be possible to get raw string as it is packed for transportation with:
String confData = (String) ((DataSupport) eventObjectsRead).attributes().get("9");
For Platform SDK version earlier than 8.5, "raw attribute value" means minimal values "wrapping"
with classes like Integer, Long, String or byte[].
subscriptionList.addAttribute(EventObjectsRead.ID, "9", AttributeSubscriptionType.Raw);
And then the data may be accessed by the way like:
AttributeRawValue confData = (AttributeRawValue) ((DataSupport) eventObjectsRead).attributes().get("9");
AttributeRawValue
Nested Class Summary | |
---|---|
static class |
AttributeSubscriptionList.AttributeSubscriptionType
Enumeration defining possible types of attribute subscription. |
Field Summary | |
---|---|
static java.lang.String |
SUBSCRIPTION_LIST_KEY
The key this list is expected in context under. |
Constructor Summary | |
---|---|
AttributeSubscriptionList()
|
Method Summary | |
---|---|
void |
addAttribute(int messageId,
java.lang.String attributeId)
Adds given pair messageId::attributeId to list. |
void |
addAttribute(int messageId,
java.lang.String attributeId,
AttributeSubscriptionList.AttributeSubscriptionType type)
Adds given pair messageId::attributeId to list. |
void |
applyToContext(ConnectionContext ctx)
Apply this subscription list to given ConnectionContext . |
static boolean |
attributeSubscribed(ConnectionContext context,
int msgId,
java.lang.String attrId)
Deprecated. |
boolean |
contains(int messageId,
java.lang.String attrId)
Deprecated. |
java.util.Map<java.lang.String,AttributeSubscriptionList.AttributeSubscriptionType> |
getMessageSubscriptions(int messageId)
Returns attributes mappings for particular message. |
boolean |
removeAttribute(int messageId,
java.lang.String attrId)
Removes subscription for given messageId::attrId pair. |
boolean |
removeWholeMessage(int messageId)
Removes subscription to all attributes for given message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SUBSCRIPTION_LIST_KEY
Constructor Detail |
---|
public AttributeSubscriptionList()
Method Detail |
---|
public void applyToContext(ConnectionContext ctx)
ConnectionContext
. This method replaces
subscription in the context (if exists) with the current one.
ctx
- ConnectionContext to apply subscription to@Deprecated public boolean contains(int messageId, java.lang.String attrId)
messageId
- message IDattrId
- attribute ID
getMessageSubscriptions(int)
public java.util.Map<java.lang.String,AttributeSubscriptionList.AttributeSubscriptionType> getMessageSubscriptions(int messageId)
messageId
- protocol message id.
public void addAttribute(int messageId, java.lang.String attributeId)
messageId::attributeId
to list.
messageId
- message ID.attributeId
- attribute ID.public void addAttribute(int messageId, java.lang.String attributeId, AttributeSubscriptionList.AttributeSubscriptionType type)
messageId::attributeId
to list.
messageId
- message ID.attributeId
- attribute ID.type
- subscription type or null.public boolean removeAttribute(int messageId, java.lang.String attrId)
messageId
- message IDattrId
- attribute ID
public boolean removeWholeMessage(int messageId)
messageId
- message ID.
@Deprecated public static boolean attributeSubscribed(ConnectionContext context, int msgId, java.lang.String attrId)
context
- connection context to look in.msgId
- message ID.attrId
- attribute ID.
getMessageSubscriptions(int)
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |