public class SubscriptionImpl extends Object implements org.apache.jackrabbit.webdav.observation.Subscription, org.apache.jackrabbit.webdav.observation.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(org.apache.jackrabbit.webdav.observation.SubscriptionInfo info,
org.apache.jackrabbit.webdav.observation.ObservationResource resource)
Create a new
Subscription with the given SubscriptionInfo
and resource. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
eventsProvideNodeTypeInformation() |
boolean |
eventsProvideNoLocalFlag() |
static org.apache.jackrabbit.webdav.observation.EventType[] |
getAllEventTypes() |
static org.apache.jackrabbit.webdav.observation.EventType |
getEventType(int jcrEventType)
Static utility method to convert the type defined by a
JCR event into an EventType
object. |
static int |
getJcrEventType(org.apache.jackrabbit.webdav.observation.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. |
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(org.apache.jackrabbit.webdav.observation.SubscriptionInfo info,
org.apache.jackrabbit.webdav.observation.ObservationResource resource)
throws org.apache.jackrabbit.webdav.DavException
Subscription with the given SubscriptionInfo
and resource.info - resource - org.apache.jackrabbit.webdav.DavException - if resource is not based on a JCR repository or
the repository does not support observation.public String getSubscriptionId()
getSubscriptionId in interface org.apache.jackrabbit.webdav.observation.Subscriptionpublic boolean eventsProvideNodeTypeInformation()
eventsProvideNodeTypeInformation in interface org.apache.jackrabbit.webdav.observation.Subscriptionpublic boolean eventsProvideNoLocalFlag()
eventsProvideNoLocalFlag in interface org.apache.jackrabbit.webdav.observation.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 org.apache.jackrabbit.webdav.xml.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 org.apache.jackrabbit.webdav.observation.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 org.apache.jackrabbit.webdav.observation.EventType[] getAllEventTypes()
public static int getJcrEventType(org.apache.jackrabbit.webdav.observation.EventType eventType)
throws org.apache.jackrabbit.webdav.DavException
EventType as present in
the Xml body into the corresponding JCR event constant defined by
Event.eventType - Event.org.apache.jackrabbit.webdav.DavException - if the given event type does not define a valid
JCR event type, such as returned by getEventType(int).Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.