/** * Retrieve the {@link org.apache.jackrabbit.webdav.observation.SubscriptionDiscovery} * object for the given resource. Note, that the discovery object will be empty * if there are no subscriptions present.<br> * Note that all subscriptions present on the given resource are returned. * However, the subscription id will not be visible in order to avoid abuse * by clients not having registered the subscription originally. * * @param resource */ public SubscriptionDiscovery getSubscriptionDiscovery(ObservationResource resource) { Subscription[] subsForResource = subscriptions.getByPath(resource.getLocator()); return new SubscriptionDiscovery(subsForResource); }
/** * Create a new <code>Subscription</code> with the given {@link SubscriptionInfo} * and {@link org.apache.jackrabbit.webdav.observation.ObservationResource resource}. * * @param info * @param resource * @throws DavException if resource is not based on a JCR repository or * the repository does not support observation. */ public SubscriptionImpl(SubscriptionInfo info, ObservationResource resource) throws DavException { setInfo(info); locator = resource.getLocator(); session = JcrDavSession.getRepositorySession(resource.getSession()); try { obsMgr = session.getWorkspace().getObservationManager(); } catch (RepositoryException e) { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e); } }