public class MessageEnvelope extends Object implements Serializable, Comparable<MessageEnvelope>
Modifier and Type | Class and Description |
---|---|
static class |
MessageEnvelope.MappingXdiEntityCollectionMessageCollectionIterator |
Modifier and Type | Field and Description |
---|---|
protected Graph |
graph |
protected static MemoryGraphFactory |
graphFactory |
Modifier | Constructor and Description |
---|---|
|
MessageEnvelope() |
protected |
MessageEnvelope(Graph graph) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(MessageEnvelope other) |
Message |
createMessage()
Creates a new XDI message in this XDI message envelope.
|
Message |
createMessage(long index)
Creates a new XDI message in this XDI message envelope.
|
Message |
createMessage(XDIAddress senderXDIAddress)
Creates a new XDI message in this XDI message envelope for a given sender.
|
Message |
createMessage(XDIAddress senderXDIAddress,
long index)
Creates a new XDI message in this XDI message envelope for a given sender.
|
void |
deleteMessageCollections()
Deletes all message collections from this message envelope.
|
boolean |
equals(Object object) |
static MessageEnvelope |
fromGraph(Graph graph)
Factory method that creates an XDI message envelope bound to a given graph.
|
static MessageEnvelope |
fromOperationXDIAddressAndTargetXDIAddress(XDIAddress operationXDIAddress,
XDIAddress targetXDIAddress)
Factory method that creates an XDI message envelope bound to a given graph.
|
static MessageEnvelope |
fromOperationXDIAddressAndTargetXDIAddressOrTargetXDIStatement(XDIAddress operationXDIAddress,
String targetXDIAddressOrTargetStatement)
Factory method that creates an XDI message envelope bound to a given graph.
|
static MessageEnvelope |
fromOperationXDIAddressAndTargetXDIStatements(XDIAddress operationXDIAddress,
Iterator<XDIStatement> targetXDIStatements)
Factory method that creates an XDI message envelope bound to a given graph.
|
Graph |
getGraph()
Returns the underlying graph to which this XDI message envelope is bound.
|
Message |
getMessage(XDIAddress messageXDIAddress)
Finds a message by its XDI address.
|
MessageCollection |
getMessageCollection(boolean create)
Returns an existing XDI message collection in this XDI message envelope, or creates a new one.
|
MessageCollection |
getMessageCollection(XDIAddress senderXDIAddress,
boolean create)
Returns an existing XDI message collection in this XDI message envelope, or creates a new one.
|
long |
getMessageCollectionCount()
Returns the number of message collections in the message envelope.
|
ReadOnlyIterator<MessageCollection> |
getMessageCollections()
Returns all message collections in this message envelope.
|
long |
getMessageCount()
Returns the number of messages in the message envelope.
|
ReadOnlyIterator<Message> |
getMessages()
Returns all messages in this message envelope.
|
ReadOnlyIterator<Message> |
getMessages(XDIAddress senderXDIAddress)
Finds messages with a given sender in this message envelope.
|
long |
getOperationCount()
Returns the number of operations in all messages of the message envelope.
|
ReadOnlyIterator<XdiInnerRoot> |
getOperationResults()
Returns all operation results in this message envelope.
|
ReadOnlyIterator<Operation> |
getOperations()
Returns all operations in this message envelope.
|
int |
hashCode() |
static boolean |
isValid(Graph graph)
Checks if a graph is a valid XDI message envelope.
|
String |
toString() |
protected static final MemoryGraphFactory graphFactory
protected Graph graph
protected MessageEnvelope(Graph graph)
public MessageEnvelope()
public static boolean isValid(Graph graph)
graph
- The graph to check.public static MessageEnvelope fromGraph(Graph graph)
graph
- The graph that is an XDI message envelope.public static MessageEnvelope fromOperationXDIAddressAndTargetXDIAddress(XDIAddress operationXDIAddress, XDIAddress targetXDIAddress)
operationXDIAddress
- The operation identifier to use for the new operation.targetXDIAddress
- The target address to which the operation applies.public static MessageEnvelope fromOperationXDIAddressAndTargetXDIStatements(XDIAddress operationXDIAddress, Iterator<XDIStatement> targetXDIStatements)
operationXDIAddress
- The operation identifier to use for the new operation.targetXDIStatements
- The target statements to which the operation applies.public static final MessageEnvelope fromOperationXDIAddressAndTargetXDIAddressOrTargetXDIStatement(XDIAddress operationXDIAddress, String targetXDIAddressOrTargetStatement)
operationXDIAddress
- The operation identifier to use for the new operation.targetXDIAddressOrTargetStatement
- The target address or target statement to which the operation applies.public Graph getGraph()
public MessageCollection getMessageCollection(XDIAddress senderXDIAddress, boolean create)
senderXDIAddress
- The sender.create
- Whether to create an XDI message collection if it does not exist.public MessageCollection getMessageCollection(boolean create)
create
- Whether to create an XDI message collection if it does not exist.public ReadOnlyIterator<MessageCollection> getMessageCollections()
public void deleteMessageCollections()
public ReadOnlyIterator<Message> getMessages()
public ReadOnlyIterator<Message> getMessages(XDIAddress senderXDIAddress)
senderXDIAddress
- The sender to look for.public Message getMessage(XDIAddress messageXDIAddress)
messageXDIAddress
- The message to look for.public ReadOnlyIterator<Operation> getOperations()
public ReadOnlyIterator<XdiInnerRoot> getOperationResults()
public long getMessageCollectionCount()
public long getMessageCount()
public long getOperationCount()
public Message createMessage(XDIAddress senderXDIAddress, long index)
senderXDIAddress
- The sender.index
- Index in an ordered collection.public Message createMessage(XDIAddress senderXDIAddress)
senderXDIAddress
- The sender.public Message createMessage(long index)
public Message createMessage()
public int compareTo(MessageEnvelope other)
compareTo
in interface Comparable<MessageEnvelope>
Copyright © 2017. All rights reserved.