public class SubscriptionImpl extends Object implements Subscription, ObservationConstants, EventListener
Subscription class encapsulates a single subscription with
the following responsibilities:HEADER_POLL_TIMEOUT, HEADER_SUBSCRIPTIONID, N_EVENT, N_EVENTBUNDLE, N_EVENTDATE, N_EVENTDISCOVERY, N_EVENTINFO, N_EVENTMIXINNODETYPE, N_EVENTPRIMARYNODETYPE, N_EVENTTYPE, N_EVENTUSERDATA, N_EVENTUSERID, NAMESPACE, SUBSCRIPTIONDISCOVERY, XML_EVENT, XML_EVENT_LOCAL, XML_EVENT_TRANSACTION_ID, XML_EVENTBUNDLE, XML_EVENTDATE, XML_EVENTDISCOVERY, XML_EVENTIDENTIFIER, XML_EVENTINFO, XML_EVENTMIXINNODETYPE, XML_EVENTPRIMARNODETYPE, XML_EVENTSWITHLOCALFLAG, XML_EVENTSWITHTYPES, XML_EVENTTYPE, XML_EVENTUSERDATA, XML_EVENTUSERID, XML_FILTER, XML_NODETYPE_NAME, XML_NOLOCAL, XML_SUBSCRIPTION, XML_SUBSCRIPTIONID, XML_SUBSCRIPTIONINFO, XML_UUID| Constructor and Description |
|---|
SubscriptionImpl(SubscriptionInfo info,
ObservationResource resource)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
eventsProvideNodeTypeInformation() |
boolean |
eventsProvideNoLocalFlag() |
static EventType[] |
getAllEventTypes() |
static EventType |
getEventType(int jcrEventType)
Static utility method to convert the type defined by a
JCR event into an EventType
object. |
static int |
getJcrEventType(EventType eventType)
Static utility method to convert an
EventType as present in
the Xml body into the corresponding JCR event constant defined by
Event. |
String |
getSubscriptionId()
Returns the id of this subscription.
|
void |
onEvent(EventIterator events)
Records the events passed as a new event bundle in order to make them
available with the next
discoverEvents(long) request. |
protected static void |
serializeInfoMap(Element eventElem,
Session session,
Map<?,?> map) |
Element |
toXml(Document document)
Return the Xml representation of this
Subscription as required
for the SubscriptionDiscovery
webdav property that in included in the response body of a successful SUBSCRIBE
request or as part of a PROPFIND response. |
public SubscriptionImpl(SubscriptionInfo info, ObservationResource resource) throws DavException
info - resource - DavException - if resource is not based on a JCR repository or
the repository does not support observation.public String getSubscriptionId()
getSubscriptionId in interface Subscriptionpublic boolean eventsProvideNodeTypeInformation()
eventsProvideNodeTypeInformation in interface Subscriptionpublic boolean eventsProvideNoLocalFlag()
eventsProvideNoLocalFlag in interface Subscriptionpublic Element toXml(Document document)
Subscription as required
for the SubscriptionDiscovery
webdav property that in included in the response body of a successful SUBSCRIBE
request or as part of a PROPFIND response.toXml in interface XmlSerializabledocument - XmlSerializable.toXml(Document)public void onEvent(EventIterator events)
discoverEvents(long) request. If this
subscription is expired it will remove itself as listener from the
observation manager.onEvent in interface EventListenerevents - to be recorded.EventListener.onEvent(EventIterator),
discoverEvents(long)public static EventType getEventType(int jcrEventType)
JCR event into an EventType
object.jcrEventType - EventType representation of the given JCR event type.IllegalArgumentException - if the given int does not represent a
valid type constants as defined by Event.public static EventType[] getAllEventTypes()
public static int getJcrEventType(EventType eventType) throws DavException
EventType as present in
the Xml body into the corresponding JCR event constant defined by
Event.eventType - Event.DavException - if the given event type does not define a valid
JCR event type, such as returned by getEventType(int).Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.