本文整理了Java中org.modeshape.jcr.ExecutionContext.getId()
方法的一些代码示例,展示了ExecutionContext.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext.getId()
方法的具体详情如下:
包路径:org.modeshape.jcr.ExecutionContext
类名称:ExecutionContext
方法名:getId
[英]Get the unique identifier for this context. Each context will always have a unique identifier.
[中]获取此上下文的唯一标识符。每个上下文将始终具有唯一的标识符。
代码示例来源:origin: ModeShape/modeshape
final String sessionId() {
return context.getId();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
final String sessionId() {
return context.getId();
}
代码示例来源:origin: ModeShape/modeshape
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Session ").append(context().getId()).append(" (readonly) to workspace '").append(workspaceName());
return sb.toString();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Session ").append(context().getId()).append(" (readonly) to workspace '").append(workspaceName());
return sb.toString();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
NamespaceRegistry reg = context().getNamespaceRegistry();
sb.append("Session ").append(context().getId()).append(" to workspace '").append(workspaceName());
for (NodeKey key : changedNodesInOrder) {
SessionNode changes = changedNodes.get(key);
if (changes == null) {
continue;
}
sb.append("\n ");
sb.append(changes.getString(reg));
}
return sb.toString();
}
}
代码示例来源:origin: ModeShape/modeshape
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
NamespaceRegistry reg = context().getNamespaceRegistry();
sb.append("Session ").append(context().getId()).append(" to workspace '").append(workspaceName());
for (NodeKey key : changedNodesInOrder) {
SessionNode changes = changedNodes.get(key);
if (changes == null) {
continue;
}
sb.append("\n ");
sb.append(changes.getString(reg));
}
return sb.toString();
}
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldHaveIdentifierThatIsUnique() {
// Can't really test this, but we certainly can test that there are no duplicates in many contexts ...
Set<String> ids = new HashSet<String>();
for (int i = 0; i != 50; ++i) {
assertThat(ids.add(new ExecutionContext().getId()), is(true));
}
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldHaveIdentifierThatIsNotBlank() {
assertThat(context.getId().length(), is(not(0)));
assertThat(context.getId().trim().length(), is(not(0)));
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldCreateSubcontextsWithDifferentIdentifiers() {
ExecutionContext newContext = context.with(mock(BinaryStore.class));
assertThat(newContext.getId(), is(not(context.getId())));
}
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldHaveSameContextIdAsSession() {
assertThat(workspace.context().getId(), is(session.context().getId()));
}
代码示例来源:origin: ModeShape/modeshape
protected final void logChangesBeingSaved(Iterable<NodeKey> firstNodesInOrder,
Iterable<NodeKey> secondNodesInOrder) {
if (SAVE_LOGGER.isTraceEnabled()) {
String txn = txns.currentTransactionId();
// // Determine if there are any changes to be made. Note that this number is generally between 1 and 100,
// // though for high concurrency some numbers may go above 100. However, the 100th save will always reset
// // the counter back down to 1. (Any thread that got a save number above 100 will simply use it.)
final int s = SAVE_NUMBER.getAndIncrement();
if (s == MAX_SAVE_NUMBER) SAVE_NUMBER.set(1); // only the 100th
final AtomicInteger changes = new AtomicInteger(0);
// There are at least some changes ...
ExecutionContext context = getContext();
String id = context.getId();
String username = context.getSecurityContext().getUserName();
NamespaceRegistry registry = context.getNamespaceRegistry();
if (username == null) username = "<anonymous>";
SAVE_LOGGER.trace("Save #{0} (part of transaction '{1}') by session {2}({3}) is persisting the following changes:",
s, txn, username, id);
UnionIterator<NodeKey> unionIterator = new UnionIterator<>(firstNodesInOrder.iterator(), secondNodesInOrder);
unionIterator.forEachRemaining(key -> {
SessionNode node = changedNodes.get(key);
if (node != null && node.hasChanges()) {
SAVE_LOGGER.trace(" #{0} {1}", s, node.getString(registry));
changes.incrementAndGet();
}
});
SAVE_LOGGER.trace("Save #{0} (part of transaction '{1}') by session {2}({3}) completed persisting changes to {4} nodes",
s, txn, username, id, changes.get());
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
protected final void logChangesBeingSaved(Iterable<NodeKey> firstNodesInOrder,
Iterable<NodeKey> secondNodesInOrder) {
if (SAVE_LOGGER.isTraceEnabled()) {
String txn = txns.currentTransactionId();
// // Determine if there are any changes to be made. Note that this number is generally between 1 and 100,
// // though for high concurrency some numbers may go above 100. However, the 100th save will always reset
// // the counter back down to 1. (Any thread that got a save number above 100 will simply use it.)
final int s = SAVE_NUMBER.getAndIncrement();
if (s == MAX_SAVE_NUMBER) SAVE_NUMBER.set(1); // only the 100th
final AtomicInteger changes = new AtomicInteger(0);
// There are at least some changes ...
ExecutionContext context = getContext();
String id = context.getId();
String username = context.getSecurityContext().getUserName();
NamespaceRegistry registry = context.getNamespaceRegistry();
if (username == null) username = "<anonymous>";
SAVE_LOGGER.trace("Save #{0} (part of transaction '{1}') by session {2}({3}) is persisting the following changes:",
s, txn, username, id);
UnionIterator<NodeKey> unionIterator = new UnionIterator<>(firstNodesInOrder.iterator(), secondNodesInOrder);
unionIterator.forEachRemaining(key -> {
SessionNode node = changedNodes.get(key);
if (node != null && node.hasChanges()) {
SAVE_LOGGER.trace(" #{0} {1}", s, node.getString(registry));
changes.incrementAndGet();
}
});
SAVE_LOGGER.trace("Save #{0} (part of transaction '{1}') by session {2}({3}) completed persisting changes to {4} nodes",
s, txn, username, id, changes.get());
}
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldHaveIdentifierThatIsNotNull() {
assertThat(context.getId(), is(notNullValue()));
}
代码示例来源:origin: ModeShape/modeshape
public final void setAccessControlEnabled( boolean enabled ) {
if (this.accessControlEnabled.compareAndSet(!enabled, enabled)) {
refreshRepositoryMetadata(true);
// And notify the others ...
String userId = context.getSecurityContext().getUserName();
Map<String, String> userData = context.getData();
DateTime timestamp = context.getValueFactories().getDateFactory().create();
RecordingChanges changes = new RecordingChanges(context.getId(), context.getProcessId(), this.getKey(), null,
repositoryEnvironment.journalId());
changes.repositoryMetadataChanged();
changes.freeze(userId, userData, timestamp);
this.changeBus.notify(changes);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
public final void setAccessControlEnabled( boolean enabled ) {
if (this.accessControlEnabled.compareAndSet(!enabled, enabled)) {
refreshRepositoryMetadata(true);
// And notify the others ...
String userId = context.getSecurityContext().getUserName();
Map<String, String> userData = context.getData();
DateTime timestamp = context.getValueFactories().getDateFactory().create();
RecordingChanges changes = new RecordingChanges(context.getId(), context.getProcessId(), this.getKey(), null,
repositoryEnvironment.journalId());
changes.repositoryMetadataChanged();
changes.freeze(userId, userData, timestamp);
this.changeBus.notify(changes);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
private ConnectorChangeSetFactory createConnectorChangedSetFactory( final Connector c ) {
return () -> {
PathMappings mappings = getPathMappings(c);
RunningState repository1 = repository();
final ExecutionContext context = repository1.context();
return new ConnectorChangeSetImpl(Connectors.this, mappings,
context.getId(), context.getProcessId(),
repository1.repositoryKey(), repository1.changeBus(),
context.getValueFactories().getDateFactory(),
repository().journalId());
};
}
代码示例来源:origin: ModeShape/modeshape
private ConnectorChangeSetFactory createConnectorChangedSetFactory( final Connector c ) {
return () -> {
PathMappings mappings = getPathMappings(c);
RunningState repository1 = repository();
final ExecutionContext context = repository1.context();
return new ConnectorChangeSetImpl(Connectors.this, mappings,
context.getId(), context.getProcessId(),
repository1.repositoryKey(), repository1.changeBus(),
context.getValueFactories().getDateFactory(),
repository().journalId());
};
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
Map<String, String> userData = context.getData();
DateTime timestamp = context.getValueFactories().getDateFactory().create();
RecordingChanges changes = new RecordingChanges(context.getId(), context.getProcessId(), this.getKey(), null,
repositoryEnvironment.journalId());
changes.workspaceRemoved(name);
代码示例来源:origin: org.fcrepo/modeshape-jcr
Map<String, String> userData = context.getData();
DateTime timestamp = context.getValueFactories().getDateFactory().create();
RecordingChanges changes = new RecordingChanges(context.getId(), context.getProcessId(), this.getKey(), null,
repositoryEnvironment.journalId());
changes.workspaceAdded(name);
代码示例来源:origin: ModeShape/modeshape
Map<String, String> userData = context.getData();
DateTime timestamp = context.getValueFactories().getDateFactory().create();
RecordingChanges changes = new RecordingChanges(context.getId(), context.getProcessId(), this.getKey(), null,
repositoryEnvironment.journalId());
changes.workspaceAdded(name);
内容来源于网络,如有侵权,请联系作者删除!