Package javax.jcr.observation

Examples of javax.jcr.observation.Event


                } catch (InterruptedException e) {
                    // ignore
                }
            }
            while (events.hasNext()) {
                Event event = events.nextEvent();
                try {
                    String path = event.getPath();
                    try {
                        Item item = session.getItem(path);
                        if (item.isNode()) {
                            Node n = (Node) item;
                            recurse(n, testDelay);
View Full Code Here


        ObservationManager obsMgr = getSession().getWorkspace().getObservationManager();
        obsMgr.addEventListener(new EventListener() {
                @Override
                public void onEvent(EventIterator events) {
                    while (events.hasNext()) {
                        Event event = events.nextEvent();
                        try {
                            switch (event.getType()) {
                                case Event.NODE_ADDED:
                                    if (!addNodes.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.NODE_REMOVED:
                                    if (!removeNodes.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.PROPERTY_ADDED:
                                    if (!addProperties.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.PROPERTY_CHANGED:
                                    if (!setProperties.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.PROPERTY_REMOVED:
                                    if (!removeProperties.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                default:
                                    failedEvents.add(event);
View Full Code Here

        ObservationManager obsMgr = getSession().getWorkspace().getObservationManager();
        obsMgr.addEventListener(new EventListener() {
                @Override
                public void onEvent(EventIterator events) {
                    while (events.hasNext()) {
                        Event event = events.nextEvent();
                        try {
                            switch (event.getType()) {
                                case Event.NODE_ADDED:
                                    if (!addNodes.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.NODE_REMOVED:
                                    if (!removeNodes.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.PROPERTY_ADDED:
                                    if (!addProperties.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                case Event.PROPERTY_REMOVED:
                                    if (!removeProperties.remove(event.getPath())) {
                                        failedEvents.add(event);
                                    }
                                    break;
                                default:
                                    failedEvents.add(event);
View Full Code Here

        }

        @Override
        public void propertyAdded(PropertyState after) {
            if (!stopped && filterRef.get().include(Event.PROPERTY_ADDED, jcrPath(), associatedParentNode)) {
                Event event = generatePropertyEvent(Event.PROPERTY_ADDED, path, after);
                events.add(Iterators.singleton(event));
            }
        }
View Full Code Here

        }

        @Override
        public void propertyChanged(PropertyState before, PropertyState after) {
            if (!stopped && filterRef.get().include(Event.PROPERTY_CHANGED, jcrPath(), associatedParentNode)) {
                Event event = generatePropertyEvent(Event.PROPERTY_CHANGED, path, after);
                events.add(Iterators.singleton(event));
            }
        }
View Full Code Here

        }

        @Override
        public void propertyDeleted(PropertyState before) {
            if (!stopped && filterRef.get().include(Event.PROPERTY_REMOVED, jcrPath(), associatedParentNode)) {
                Event event = generatePropertyEvent(Event.PROPERTY_REMOVED, path, before);
                events.add(Iterators.singleton(event));
            }
        }
View Full Code Here

            String jcrPath = namePathMapper.getJcrPath(path);

            Iterator<Event> nodeEvent;
            if (filter.include(eventType, jcrParentPath, associatedParentNode)) {
                // TODO support userId, identifier, info, date
                Event event = new EventImpl(eventType, jcrPath, null, null, null, 0);
                nodeEvent = singleton(event);
            }
            else {
                nodeEvent = Iterators.empty();
            }
View Full Code Here

         *
         * @see javax.jcr.observation.EventListener#onEvent(EventIterator)
         */
        public void onEvent(EventIterator events) {
            while (events.hasNext()) {
                Event ev = events.nextEvent();
                try {
                    String evPath = ev.getPath();
                    String repGroups = session.getJCRName(UserConstants.P_GROUPS);
                    // TODO: add better evaluation.
                    if (repGroups.equals(Text.getName(evPath)) &&
                            userNodePath.equals(Text.getRelativeParent(evPath, 1))) {
                        // recalculate the is...Admin flags
                        switch (ev.getType()) {
                            case Event.PROPERTY_REMOVED:
                                isUserAdmin = false;
                                isGroupAdmin = false;
                                break;
                            case Event.PROPERTY_ADDED:
View Full Code Here

         */
        public synchronized void onEvent(EventIterator events) {
            try {
                boolean reload = false;
                while (events.hasNext() && !reload) {
                    Event ev = events.nextEvent();
                    String path = ev.getPath();
                    // only invalidate cache if any of the events affects the
                    // nodes defining permissions for the principals.
                    switch (ev.getType()) {
                        case Event.NODE_ADDED:
                        case Event.NODE_REMOVED:
                            reload = acPaths.contains(Text.getRelativeParent(path, 2));
                            break;
                        case Event.PROPERTY_ADDED:
View Full Code Here

     */
    public Object next() {
        if (next == null) {
            throw new NoSuchElementException();
        }
        Event e = next;
        fetchNext();
        pos++;
        return e;
    }
View Full Code Here

TOP

Related Classes of javax.jcr.observation.Event

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.