Examples of ObservationManager


Examples of javax.jcr.observation.ObservationManager

        // make sure the session has no more registered event listeners which
        // may be notified on changes, and - worse - prevent the objects from
        // being collected
        try {
            ObservationManager om = session.getWorkspace().getObservationManager();
            EventListenerIterator eli = om.getRegisteredEventListeners();
            if (eli.hasNext()) {
                log.debug("Unregistering remaining EventListeners of {}", userId);
                while (eli.hasNext()) {
                    EventListener el = (EventListener) eli.next();
                    om.removeEventListener(el);
                }
            }
        } catch (RepositoryException re) {
            log.info("Cannot check or unregister event listeners of session " +
                "{}, logging out", userId);
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

                if (repConfig.getSearchConfig() != null) {
                    SystemSession defSysSession = getSystemSession(wspName);
                    systemSearchMgr = new SearchManager(repConfig.getSearchConfig(),
                            nsReg, ntReg, defSysSession.getItemStateManager(),
                            SYSTEM_ROOT_NODE_ID, null, null);
                    ObservationManager obsMgr = defSysSession.getWorkspace().getObservationManager();
                    obsMgr.addEventListener(systemSearchMgr, Event.NODE_ADDED
                            | Event.NODE_REMOVED | Event.PROPERTY_ADDED
                            | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED,
                            "/" + NameFormat.format(QName.JCR_SYSTEM, defSysSession.getNamespaceResolver()),
                            true, null, null, false);
                } else {
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

      this.prefixes = new LinkedHashMap<String, String>();

      // Observation manager per session
      ObservationManagerRegistry observationManagerRegistry =
         (ObservationManagerRegistry)container.getComponentInstanceOfType(ObservationManagerRegistry.class);
      ObservationManager observationManager = observationManagerRegistry.createObservationManager(this);

      LocalWorkspaceDataManagerStub workspaceDataManager =
         (LocalWorkspaceDataManagerStub)container.getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class);

      this.dataManager = new SessionDataManager(this, workspaceDataManager);
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

      this.prefixes = new LinkedHashMap<String, String>();

      // Observation manager per session
      ObservationManagerRegistry observationManagerRegistry =
         (ObservationManagerRegistry)container.getComponentInstanceOfType(ObservationManagerRegistry.class);
      ObservationManager observationManager = observationManagerRegistry.createObservationManager(this);

      LocalWorkspaceDataManagerStub workspaceDataManager =
         (LocalWorkspaceDataManagerStub)container.getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class);

      this.dataManager = new SessionDataManager(this, workspaceDataManager);
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

      this.prefixes = new LinkedHashMap<String, String>();

      // Observation manager per session
      ObservationManagerRegistry observationManagerRegistry =
         (ObservationManagerRegistry)container.getComponentInstanceOfType(ObservationManagerRegistry.class);
      ObservationManager observationManager = observationManagerRegistry.createObservationManager(this);

      LocalWorkspaceDataManagerStub workspaceDataManager =
         (LocalWorkspaceDataManagerStub)container.getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class);

      this.dataManager = new SessionDataManager(this, workspaceDataManager);
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

                        getWorkspaceInfo(wspName).itemStateMgr,
                        vMgr.getPersistenceManager(), SYSTEM_ROOT_NODE_ID,
                        null, null, executor);

                SystemSession defSysSession = getSystemSession(wspName);
                ObservationManager obsMgr = defSysSession.getWorkspace().getObservationManager();
                obsMgr.addEventListener(systemSearchMgr, Event.NODE_ADDED
                        | Event.NODE_REMOVED | Event.PROPERTY_ADDED
                        | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED,
                        "/" + defSysSession.getJCRName(NameConstants.JCR_SYSTEM),
                        true, null, null, false);
            }
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

    /**
     * Utility method that removes all registered event listeners.
     */
    private void removeRegisteredEventListeners() {
        try {
            ObservationManager manager = getWorkspace().getObservationManager();
            // Use a copy to avoid modifying the set of registered listeners
            // while iterating over it
            Collection<EventListener> listeners =
                IteratorUtils.toList(manager.getRegisteredEventListeners());
            for (EventListener listener : listeners) {
                try {
                    manager.removeEventListener(listener);
                } catch (RepositoryException e) {
                    log.warn("Error removing event listener: " + listener, e);
                }
            }
        } catch (RepositoryException e) {
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

    protected EntryCollector(SessionImpl systemSession, ACLEditor systemEditor, NodeId rootID) throws RepositoryException {
        this.systemSession = systemSession;
        this.systemEditor = systemEditor;
        this.rootID = rootID;

        ObservationManager observationMgr = systemSession.getWorkspace().getObservationManager();
        /*
         Make sure the collector and all subscribed listeners are informed upon
         ACL modifications. Interesting events are:
         - new ACL (NODE_ADDED)
         - new ACE (NODE_ADDED)
         - changing ACE (PROPERTY_CHANGED)
         - removed ACL (NODE_REMOVED)
         - removed ACE (NODE_REMOVED)
        */
        int events = Event.PROPERTY_CHANGED | Event.NODE_ADDED | Event.NODE_REMOVED;
        String[] ntNames = new String[] {
                systemSession.getJCRName(NT_REP_ACCESS_CONTROLLABLE),
                systemSession.getJCRName(NT_REP_ACL),
                systemSession.getJCRName(NT_REP_ACE)
        };
        observationMgr.addEventListener(this, events, systemSession.getRootNode().getPath(), true, null, ntNames, true);       
    }
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

            throws RepositoryException {
        if (supportsObservation) {
            // register local event listener
            Collection<EventSubscription> subscr = sInfo.getSubscriptions();
            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();
                } finally {
                    for (EventListener listener : listeners) {
                        try {
                            obsMgr.removeEventListener(listener);
                        } catch (RepositoryException e) {
                            // ignore and remove next
                        }
                    }
                }
View Full Code Here

Examples of javax.jcr.observation.ObservationManager

                if (repConfig.getSearchConfig() != null) {
                    SystemSession defSysSession = getSystemSession(wspName);
                    systemSearchMgr = new SearchManager(repConfig.getSearchConfig(),
                            nsReg, ntReg, defSysSession.getItemStateManager(),
                            SYSTEM_ROOT_NODE_ID, null, null);
                    ObservationManager obsMgr = defSysSession.getWorkspace().getObservationManager();
                    obsMgr.addEventListener(systemSearchMgr, Event.NODE_ADDED
                            | Event.NODE_REMOVED | Event.PROPERTY_ADDED
                            | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED,
                            "/" + NameFormat.format(QName.JCR_SYSTEM, defSysSession.getNamespaceResolver()),
                            true, null, null, false);
                } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.