protected final void logSendOperation( ChangeSet changeSet ) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Sending to cluster '{0}' {1} changes on workspace {2} made by {3} from process '{4}' at {5}", clusteringService.toString(), changeSet.size(), changeSet.getWorkspaceName(), changeSet.getUserData(), changeSet.getProcessKey(), changeSet.getTimestamp()); } }
/** * Returns the set of keys for the nodes which has been changed. * * @return the set of changed node keys; never {@code null} * @see org.modeshape.jcr.cache.change.ChangeSet#changedNodes() */ public Set<NodeKey> changedNodes() { return content.changedNodes(); }
/** * Returns the identifier of the local {@link org.modeshape.jcr.journal.ChangeJournal} instance. * * @return either a non-null {@link String} if journaling is enabled, or {@code null} if journaling isn't enabled. * @see org.modeshape.jcr.cache.change.ChangeSet#getJournalId() */ public String getJournalId() { return content.getJournalId(); }
protected final void logReceivedOperation( ChangeSet changeSet ) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Received from cluster '{0}' {1} changes on workspace {2} made by {3} from process '{4}' at {5}", clusteringService.toString(), changeSet.size(), changeSet.getWorkspaceName(), changeSet.getUserId(), changeSet.getProcessKey(), changeSet.getTimestamp()); } }
@Override public void notify( ChangeSet changeSet ) { //do not store records from jcr:system boolean systemWorkspaceChanges = RepositoryConfiguration.SYSTEM_WORKSPACE_NAME.equalsIgnoreCase(changeSet.getWorkspaceName()); if (changeSet.isEmpty() || systemWorkspaceChanges) { return; } addRecords(new JournalRecord(changeSet)); }
protected List<Event> convert( ChangeSet changeSet ) { List<Event> events = new ArrayList<>(); if (shouldRejectChangeSet(changeSet)) { return events; } String userData = changeSet.getUserData().get(OBSERVATION_USER_DATA_KEY); JcrEventBundle bundle = new JcrEventBundle(changeSet.getTimestamp(), changeSet.getUserId(), userData); for (Change change : changeSet) { processChange(events, bundle, change); } return events; }
if (!processId.equals(changeSet.getProcessKey())) { final String workspaceName = changeSet.getWorkspaceName(); final Collection<SequencingConfiguration> configs = this.configByWorkspaceName.get(workspaceName); if (configs == null) { submitWork(config, matcher, workspaceName, stringFactory.create(propName), changeSet.getUserId()); submitWork(config, matcher, workspaceName, stringFactory.create(propName), changeSet.getUserId());
protected void evictChangedNodes( ChangeSet changes ) { if (!closed) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Cache for workspace '{0}' received {1} changes from remote sessions: {2}", workspaceName, changes.size(), changes); } // Clear this workspace's cached nodes (iteratively is okay since it's a ConcurrentMap) ... for (NodeKey key : changes.changedNodes()) { if (closed) break; nodesByKey.remove(key); } } }
@Override public void notify( ChangeSet changeSet ) { if (!systemWorkspaceName.equals(changeSet.getWorkspaceName())) { if (processId.equals(changeSet.getProcessKey())) {
/** * Get the name of the workspace in which the changes were made. * * @return the workspace name; may be null only when workspaces are added or removed * @see org.modeshape.jcr.cache.change.ChangeSet#getWorkspaceName() */ public String getWorkspaceName() { return content.getWorkspaceName(); }
@Override public void notify( ChangeSet changeSet ) { // Track all changes, even those that originate in remote processes ... increment(ValueMetric.NODE_CHANGES, changeSet.changedNodes().size()); if (changeSet.getWorkspaceName() == null) { // This is a change in the workspaces or repository metadata ... for (Change change : changeSet) { if (change instanceof WorkspaceAdded) { increment(ValueMetric.WORKSPACE_COUNT); } else if (change instanceof WorkspaceRemoved) { decrement(ValueMetric.WORKSPACE_COUNT); } } } // ValueMetric.SESSION_SAVES are tracked in JcrSession.save() ... }
@Override public void notify( ChangeSet changeSet ) { if (changeSet == null || !getKey().equals(changeSet.getRepositoryKey())) { return; if (changeSet.getWorkspaceName() == null) {
/** * Returns the time of the changeset, in UTC millis. * * @return a timestamp * @see org.modeshape.jcr.cache.change.ChangeSet#getTimestamp() */ public long getChangeTimeMillis() { return content.getTimestamp().getMillisecondsInUtc(); }
@Override public int hashCode() { return content.getUUID().hashCode(); }
/** * Get the key of the process in which the changes were made. * * @return the process key; never null * @see org.modeshape.jcr.cache.change.ChangeSet#getProcessKey() */ public String getProcessKey() { return content.getProcessKey(); }
/** * Returns the ID (username) of the user which performed the changes. * * @return a {@link String} representing the username; may be {@code null} in the case of changes performed "by the system. * @see org.modeshape.jcr.cache.change.ChangeSet#getUserId() */ public String getUserId() { return content.getUserId(); }
/** * Get the key of the repository in which the changes were made. * * @return the repository key; never null * @see org.modeshape.jcr.cache.change.ChangeSet#getRepositoryKey() */ public String getRepositoryKey() { return content.getRepositoryKey(); }
/** * @param changeSet the changes being processed * @return <code>true</code> if event occurred in a different session or if events from same session should be processed */ private boolean acceptBasedOnOriginatingSession( ChangeSet changeSet ) { return !this.noLocal || !getSessionId().equals(changeSet.getSessionId()); }
protected final void logReceivedOperation( ChangeSet changeSet ) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Received from cluster '{0}' {1} changes on workspace {2} made by {3} from process '{4}' at {5}", clusteringService.toString(), changeSet.size(), changeSet.getWorkspaceName(), changeSet.getUserId(), changeSet.getProcessKey(), changeSet.getTimestamp()); } }
protected List<Event> convert( ChangeSet changeSet ) { List<Event> events = new ArrayList<>(); if (shouldRejectChangeSet(changeSet)) { return events; } String userData = changeSet.getUserData().get(OBSERVATION_USER_DATA_KEY); JcrEventBundle bundle = new JcrEventBundle(changeSet.getTimestamp(), changeSet.getUserId(), userData); for (Change change : changeSet) { processChange(events, bundle, change); } return events; }