Package javax.jcr.observation

Examples of javax.jcr.observation.Event


        }
    }

  public void onEvent(EventIterator it) {
        while (it.hasNext()) {
            Event event = it.nextEvent();
            try {
                if (event.getType() == Event.NODE_ADDED && !(event.getPath().contains("thumbnails"))) {
                    log.info("new upload: {}", event.getPath());
                    Node addedNode = session.getRootNode().getNode(event.getPath().substring(1));
                    processNewNode(addedNode);
                    log.info("finished processing of {}", event.getPath());
                }
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
View Full Code Here


        when(repository.loginService(serviceName, null)).thenReturn(session);
        String path = "/some/path";
        String nuggetsPath = "/var/nuggets";
        PersistingJcrEventReplicationTrigger persistingJcrEventReplicationTrigger = new PersistingJcrEventReplicationTrigger(
                repository, path, serviceName, nuggetsPath);
        Event event = mock(Event.class);
        ReplicationRequest replicationRequest = persistingJcrEventReplicationTrigger.processEvent(event);
        assertNull(replicationRequest);
    }
View Full Code Here

        Node nuggetsNode = mock(Node.class);
        Node eventNode = mock(Node.class);
        when(nuggetsNode.addNode(any(String.class))).thenReturn(eventNode);
        when(session.getNode(nuggetsPath)).thenReturn(nuggetsNode);
        Event event = mock(Event.class);
        when(event.getPath()).thenReturn("/some/path/generating/event");
        ReplicationRequest replicationRequest = persistingJcrEventReplicationTrigger.processEvent(event);
        assertNotNull(replicationRequest);
    }
View Full Code Here

    public void testProcessEventWithoutPathProperty() throws Exception {
        SlingRepository repository = mock(SlingRepository.class);
        String path = "/some/path";
        String serviceName = "serviceId";
        JcrEventReplicationTrigger jcrEventReplicationTrigger = new JcrEventReplicationTrigger(repository, path, serviceName);
        Event event = mock(Event.class);
        ReplicationRequest replicationRequest = jcrEventReplicationTrigger.processEvent(event);
        assertNull(replicationRequest);
    }
View Full Code Here

    public void testProcessEventWithPathProperty() throws Exception {
        SlingRepository repository = mock(SlingRepository.class);
        String path = "/some/path";
        String serviceName = "serviceId";
        JcrEventReplicationTrigger jcrEventReplicationTrigger = new JcrEventReplicationTrigger(repository, path, serviceName);
        Event event = mock(Event.class);
        when(event.getPath()).thenReturn("/some/path/generating/event");
        ReplicationRequest replicationRequest = jcrEventReplicationTrigger.processEvent(event);
        assertNotNull(replicationRequest);
    }
View Full Code Here

    protected int eventBundlesProcessed = 0;
   
    public void onEvent(EventIterator eventIterator) {
      try {
        while (eventIterator.hasNext()) {
          Event event = eventIterator.nextEvent();
          int type = event.getType();
          switch (type) {
            case Event.PROPERTY_CHANGED:
              changedProperties.add(event.getPath());
              break;
            case Event.PROPERTY_ADDED:
              addedProperties.add(event.getPath());
              break;
            case Event.PROPERTY_REMOVED:
              removedProperties.add(event.getPath());
              break;
          }
        }
        eventBundlesProcessed++;
      } catch (RepositoryException e) {
View Full Code Here

    public void onEvent(final EventIterator it) {
        // Got a DELETE or ADD on root - schedule folders rescan if one
        // of our root folders is impacted
        try {
            while(it.hasNext()) {
                final Event e = it.nextEvent();
                logger.debug("Got event {}", e);

                this.checkChanges(e.getPath());
            }
        } catch(RepositoryException re) {
            logger.warn("RepositoryException in onEvent", re);
        }
    }
View Full Code Here

                     * @see javax.jcr.observation.EventListener#onEvent(javax.jcr.observation.EventIterator)
                     */
                    public void onEvent(final EventIterator events) {
                        try {
                            while (events.hasNext()) {
                                final Event e = events.nextEvent();
                                JcrInstaller.this.checkChanges(e.getIdentifier());
                                JcrInstaller.this.checkChanges(e.getPath());
                            }
                        } catch (final RepositoryException re) {
                            logger.warn("RepositoryException in onEvent", re);
                        }
                    }
View Full Code Here

    }

    /** Schedule a scan */
    public void onEvent(EventIterator it) {
        while(it.hasNext()) {
            final Event e = it.nextEvent();
            log.debug("Got event {}", e);
        }
        timer.scheduleScan();
    }
View Full Code Here

        @Override
        public void onEvent(EventIterator events) {
            try {
                while (events.hasNext() && failed == null) {
                    Event event = events.nextEvent();
                    boolean found = false;
                    for (Expectation exp : expected) {
                        if (exp.isEnabled() && exp.onEvent(event)) {
                            found = true;
                            expected.remove(exp);
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.