Package javax.jcr.observation

Examples of javax.jcr.observation.EventListener


            if (subscr.size() != 0) {
                ObservationManager obsMgr = sInfo.getSession().getWorkspace().getObservationManager();
                List<EventListener> listeners = new ArrayList<EventListener>(subscr.size());
                try {
                    for (EventSubscription s : subscr) {
                        EventListener listener = s.getLocalEventListener();
                        listeners.add(listener);
                        obsMgr.addEventListener(listener, EventSubscription.ALL_EVENTS,
                                "/", true, null, null, false);
                    }
                    return call.run();
View Full Code Here


            Node node = (Node)item;
            Element udElem = updateInfo.getUpdateElement();
            boolean removeExisting = DomUtil.hasChildElement(udElem, XML_REMOVEEXISTING, NAMESPACE);

            // register eventListener in order to be able to report the modified resources.
            EventListener el = new EListener(updateInfo.getPropertyNameSet(), ms);
            registerEventListener(el, node.getPath());

            // perform the update/restore according to the update info
            if (updateInfo.getVersionHref() != null) {
                String[] hrefs = updateInfo.getVersionHref();
View Full Code Here

     */
    public void dispose() {
        try {
            EventListenerIterator it = getRegisteredEventListeners();
            while (it.hasNext()) {
                EventListener l = it.nextEventListener();
                log.debug("removing EventListener: " + l);
                removeEventListener(l);
            }
        } catch (RepositoryException e) {
            log.error("Internal error: Unable to dispose ObservationManager.", e);
View Full Code Here

                ObservationManager obsMgr = sInfo.getSession().getWorkspace().getObservationManager();
                List listeners = new ArrayList(subscr.size());
                try {
                    for (Iterator it = subscr.iterator(); it.hasNext(); ) {
                        EventSubscription s = (EventSubscription) it.next();
                        EventListener listener = s.getLocalEventListener();
                        listeners.add(listener);
                        obsMgr.addEventListener(listener, EventSubscription.ALL_EVENTS,
                                "/", true, null, null, false);
                    }
                    return call.run();
View Full Code Here

        try {
            Element udElem = updateInfo.getUpdateElement();
            boolean removeExisting = DomUtil.hasChildElement(udElem, ItemResourceConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);

            // register eventListener in order to be able to report the modified resources.
            EventListener el = new EListener(updateInfo.getPropertyNameSet(), ms);
            registerEventListener(el, session.getRootNode().getPath());

            String[] hrefs = updateInfo.getVersionHref();
            if (hrefs == null || hrefs.length < 1) {
                throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid update request body: at least a single version href must be specified.");
View Full Code Here

     */
    public void dispose() {
        try {
            EventListenerIterator it = getRegisteredEventListeners();
            while (it.hasNext()) {
                EventListener l = it.nextEventListener();
                log.debug("removing EventListener: " + l);
                removeEventListener(l);
            }
        } catch (RepositoryException e) {
            log.error("Internal error: Unable to dispose ObservationManager.", e);
View Full Code Here

            throws RepositoryException, InterruptedException, ExecutionException {
        long t = 0;
        final AtomicInteger eventCount = new AtomicInteger();
        final AtomicInteger nodeCount = new AtomicInteger();

        EventListener listener = new EventListener() {
            @Override
            public void onEvent(EventIterator events) {
                for (; events.hasNext(); events.nextEvent()) {
                    eventCount.incrementAndGet();
                }
View Full Code Here

     */
    public void dispose() {
        try {
            EventListenerIterator it = getRegisteredEventListeners();
            while (it.hasNext()) {
                EventListener l = it.nextEventListener();
                log.debug("removing EventListener: " + l);
                removeEventListener(l);
            }
        } catch (RepositoryException e) {
            log.error("Internal error: Unable to dispose ObservationManager.", e);
View Full Code Here

        try {
            Element udElem = updateInfo.getUpdateElement();
            boolean removeExisting = DomUtil.hasChildElement(udElem, ItemResourceConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);

            // register eventListener in order to be able to report the modified resources.
            EventListener el = new EListener(updateInfo.getPropertyNameSet(), ms);
            registerEventListener(el, session.getRootNode().getPath());

            String[] hrefs = updateInfo.getVersionHref();
            if (hrefs == null || hrefs.length < 1) {
                throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid update request body: at least a single version href must be specified.");
View Full Code Here

    public void testGetSize() throws RepositoryException {
        EventListener[] listeners = toArray(obsMgr.getRegisteredEventListeners());
        assertEquals("A new session must not have any event listeners registered.", 0, listeners.length);

        EventListener listener1 = new EventResult(log);
        EventListener listener2 = new EventResult(log);
        addEventListener(listener1);
        addEventListener(listener2);

        listeners = toArray(obsMgr.getRegisteredEventListeners());
        assertEquals("Wrong number of event listeners.", 2, listeners.length);
View Full Code Here

TOP

Related Classes of javax.jcr.observation.EventListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.