本文整理了Java中org.modeshape.jcr.ExecutionContext.getProcessId()
方法的一些代码示例,展示了ExecutionContext.getProcessId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext.getProcessId()
方法的具体详情如下:
包路径:org.modeshape.jcr.ExecutionContext
类名称:ExecutionContext
方法名:getProcessId
[英]Get the identifier for the process in which this context exists. Multiple contexts running in the same "process" will all have the same identifier.
[中]获取存在此上下文的进程的标识符。在同一“进程”中运行的多个上下文都将具有相同的标识符。
代码示例来源:origin: ModeShape/modeshape
protected final boolean isInTheSameProcessAs( String otherProcessId ) {
return session().context().getProcessId().equalsIgnoreCase(otherProcessId);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
protected final boolean isInTheSameProcessAs( String otherProcessId ) {
return session().context().getProcessId().equalsIgnoreCase(otherProcessId);
}
代码示例来源:origin: ModeShape/modeshape
protected JcrValueFactory( ExecutionContext context ) {
this.valueFactories = context.getValueFactories();
this.namespaces = context.getNamespaceRegistry();
this.executionContextProcessId = context.getProcessId();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
protected JcrValueFactory( ExecutionContext context ) {
this.valueFactories = context.getValueFactories();
this.namespaces = context.getNamespaceRegistry();
this.executionContextProcessId = context.getProcessId();
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
RepositoryLockManager with( JcrRepository.RunningState repository,
RepositoryConfiguration.GarbageCollection gcConfig ) {
assert this.systemWorkspaceName == repository.repositoryCache().getSystemWorkspaceName();
assert this.processId == repository.context().getProcessId();
PathFactory pathFactory = repository.context().getValueFactories().getPathFactory();
Path locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, ModeShapeLexicon.LOCKS);
assert this.locksPath.equals(locksPath);
return new RepositoryLockManager(repository, gcConfig);
}
代码示例来源:origin: ModeShape/modeshape
final JcrValue valueFrom( javax.jcr.Node value ) throws RepositoryException {
if (!(value instanceof AbstractJcrNode)) {
throw new IllegalArgumentException("Invalid node type (expected a ModeShape node): " + value.getClass().toString());
}
AbstractJcrNode node = (AbstractJcrNode)value;
if (!this.isInTheSameProcessAs(node.session().context().getProcessId())) {
throw new RepositoryException(JcrI18n.nodeNotInTheSameSession.text(node.path()));
}
NodeKey key = ((AbstractJcrNode)value).key();
Reference ref = session.context().getValueFactories().getReferenceFactory()
.create(key, ((AbstractJcrNode)value).isForeign());
return valueFrom(PropertyType.REFERENCE, ref);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
RepositoryLockManager( JcrRepository.RunningState repository, RepositoryConfiguration.GarbageCollection gcConfig ) {
this.repository = repository;
this.systemWorkspaceName = repository.repositoryCache().getSystemWorkspaceName();
this.processId = repository.context().getProcessId();
this.locksByNodeKey = new ConcurrentHashMap<NodeKey, ModeShapeLock>();
PathFactory pathFactory = repository.context().getValueFactories().getPathFactory();
this.locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, ModeShapeLexicon.LOCKS);
this.logger = Logger.getLogger(getClass());
long lockGCIntervalMillis = gcConfig.getIntervalInMillis();
assert lockGCIntervalMillis > 0;
/*
* Each time the garbage collection process runs, session-scoped locks that are still used by active sessions will have their
* expiry times extended by this amount of time. Each repository instance in the ModeShape cluster will run its own cleanup
* process, which will extend the expiry times of its own locks. As soon as a repository is no longer running the cleanup
* process, we know that there can be no active sessions.
*
* The default GC interval is expressed in hours, so we make the extension slightly larger to avoid any lock being expired
* prematurely.
*/
this.lockExtensionIntervalMillis = lockGCIntervalMillis + TimeUnit.MILLISECONDS.convert(10, TimeUnit.MINUTES);
/*
* The amount of time that a lock may be active before considered expired. The sweep process will extend the locks for active
* sessions, so only unused locks will have an unmodified expiry time.
*
* The default GC interval is expressed in hours, so we make the default age slightly less to avoid stale lock.
*/
this.defaultLockAgeMillis = lockGCIntervalMillis - TimeUnit.MILLISECONDS.convert(10, TimeUnit.MINUTES);
}
代码示例来源:origin: ModeShape/modeshape
RepositoryLockManager( JcrRepository.RunningState repository, RepositoryConfiguration.GarbageCollection gcConfig ) {
this.repository = repository;
this.systemWorkspaceName = repository.repositoryCache().getSystemWorkspaceName();
this.processId = repository.context().getProcessId();
this.locksByNodeKey = new ConcurrentHashMap<NodeKey, ModeShapeLock>();
PathFactory pathFactory = repository.context().getValueFactories().getPathFactory();
this.locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, ModeShapeLexicon.LOCKS);
this.logger = Logger.getLogger(getClass());
long lockGCIntervalMillis = gcConfig.getIntervalInMillis();
assert lockGCIntervalMillis > 0;
/*
* Each time the garbage collection process runs, session-scoped locks that are still used by active sessions will have their
* expiry times extended by this amount of time. Each repository instance in the ModeShape cluster will run its own cleanup
* process, which will extend the expiry times of its own locks. As soon as a repository is no longer running the cleanup
* process, we know that there can be no active sessions.
*
* The default GC interval is expressed in hours, so we make the extension slightly larger to avoid any lock being expired
* prematurely.
*/
this.lockExtensionIntervalMillis = lockGCIntervalMillis + TimeUnit.MILLISECONDS.convert(10, TimeUnit.MINUTES);
/*
* The amount of time that a lock may be active before considered expired. The sweep process will extend the locks for active
* sessions, so only unused locks will have an unmodified expiry time.
*
* The default GC interval is expressed in hours, so we make the default age slightly less to avoid stale lock.
*/
this.defaultLockAgeMillis = lockGCIntervalMillis - TimeUnit.MILLISECONDS.convert(10, TimeUnit.MINUTES);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
final JcrValue valueFrom( javax.jcr.Node value ) throws RepositoryException {
if (!(value instanceof AbstractJcrNode)) {
throw new IllegalArgumentException("Invalid node type (expected a ModeShape node): " + value.getClass().toString());
}
AbstractJcrNode node = (AbstractJcrNode)value;
if (!this.isInTheSameProcessAs(node.session().context().getProcessId())) {
throw new RepositoryException(JcrI18n.nodeNotInTheSameSession.text(node.path()));
}
NodeKey key = ((AbstractJcrNode)value).key();
Reference ref = session.context().getValueFactories().getReferenceFactory()
.create(key, ((AbstractJcrNode)value).isForeign());
return valueFrom(PropertyType.REFERENCE, ref);
}
代码示例来源:origin: ModeShape/modeshape
RepositoryLockManager with( JcrRepository.RunningState repository,
RepositoryConfiguration.GarbageCollection gcConfig ) {
assert this.systemWorkspaceName == repository.repositoryCache().getSystemWorkspaceName();
assert this.processId == repository.context().getProcessId();
PathFactory pathFactory = repository.context().getValueFactories().getPathFactory();
Path locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, ModeShapeLexicon.LOCKS);
assert this.locksPath.equals(locksPath);
return new RepositoryLockManager(repository, gcConfig);
}
代码示例来源: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: 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
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
private void fireSequencingFailureEvent( AbstractJcrNode sequencedNode,
JcrSession inputSession,
Throwable cause,
String sequencerName ) throws RepositoryException {
assert sequencedNode != null;
assert inputSession != null;
Name primaryType = sequencedNode.getPrimaryTypeName();
Set<Name> mixinTypes = sequencedNode.getMixinTypeNames();
final ExecutionContext context = inputSession.context();
RecordingChanges sequencingChanges = new RecordingChanges(inputSession.sessionId(), context.getProcessId(),
inputSession.getRepository().repositoryKey(),
inputSession.workspaceName(), inputSession.getRepository()
.journalId());
sequencingChanges.nodeSequencingFailure(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes,
work.getOutputPath(), work.getUserId(), work.getSelectedPath(), sequencerName,
cause);
repository.changeBus().notify(sequencingChanges);
}
代码示例来源:origin: ModeShape/modeshape
private void fireSequencingFailureEvent( AbstractJcrNode sequencedNode,
JcrSession inputSession,
Throwable cause,
String sequencerName ) throws RepositoryException {
assert sequencedNode != null;
assert inputSession != null;
Name primaryType = sequencedNode.getPrimaryTypeName();
Set<Name> mixinTypes = sequencedNode.getMixinTypeNames();
final ExecutionContext context = inputSession.context();
RecordingChanges sequencingChanges = new RecordingChanges(inputSession.sessionId(), context.getProcessId(),
inputSession.getRepository().repositoryKey(),
inputSession.workspaceName(), inputSession.getRepository()
.journalId());
sequencingChanges.nodeSequencingFailure(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes,
work.getOutputPath(), work.getUserId(), work.getSelectedPath(), sequencerName,
cause);
repository.changeBus().notify(sequencingChanges);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
@Override
public void setValue( Node value )
throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
if (value == null) {
this.remove();
return;
}
checkSession();
checkForLock();
checkForCheckedOut();
checkModifyPermission();
if (!value.isNodeType(JcrMixLexicon.REFERENCEABLE.getString(this.context().getNamespaceRegistry()))) {
throw new ValueFormatException(JcrI18n.nodeNotReferenceable.text());
}
AbstractJcrNode jcrNode = session.getNodeByIdentifier(value.getIdentifier());
if (!jcrNode.isInTheSameProcessAs(session.context().getProcessId())) {
throw new RepositoryException(JcrI18n.nodeNotInTheSameSession.text(jcrNode.path()));
}
JcrValue referenceValue = session().valueFactory().createValue(jcrNode);
internalSetValue(referenceValue.asType(this.getType()));
}
代码示例来源:origin: ModeShape/modeshape
private void fireSequencingEvent( AbstractJcrNode sequencedNode,
List<AbstractJcrNode> outputNodes,
JcrSession outputSession,
String sequencerName ) throws RepositoryException {
final ExecutionContext context = outputSession.context();
RecordingChanges sequencingChanges = new RecordingChanges(outputSession.sessionId(), context.getProcessId(),
outputSession.getRepository().repositoryKey(),
outputSession.workspaceName(), outputSession.getRepository()
.journalId());
Name primaryType = sequencedNode.getPrimaryTypeName();
Set<Name> mixinTypes = sequencedNode.getMixinTypeNames();
for (AbstractJcrNode outputNode : outputNodes) {
sequencingChanges.nodeSequenced(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes, outputNode.key(),
outputNode.path(), work.getOutputPath(), work.getUserId(), work.getSelectedPath(),
sequencerName);
}
sequencingChanges.freeze(outputSession.getUserID(), null, context.getValueFactories().getDateFactory().create());
repository.changeBus().notify(sequencingChanges);
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
private void fireSequencingEvent( AbstractJcrNode sequencedNode,
List<AbstractJcrNode> outputNodes,
JcrSession outputSession,
String sequencerName ) throws RepositoryException {
final ExecutionContext context = outputSession.context();
RecordingChanges sequencingChanges = new RecordingChanges(outputSession.sessionId(), context.getProcessId(),
outputSession.getRepository().repositoryKey(),
outputSession.workspaceName(), outputSession.getRepository()
.journalId());
Name primaryType = sequencedNode.getPrimaryTypeName();
Set<Name> mixinTypes = sequencedNode.getMixinTypeNames();
for (AbstractJcrNode outputNode : outputNodes) {
sequencingChanges.nodeSequenced(sequencedNode.key(), sequencedNode.path(), primaryType, mixinTypes, outputNode.key(),
outputNode.path(), work.getOutputPath(), work.getUserId(), work.getSelectedPath(),
sequencerName);
}
sequencingChanges.freeze(outputSession.getUserID(), null, context.getValueFactories().getDateFactory().create());
repository.changeBus().notify(sequencingChanges);
}
代码示例来源:origin: ModeShape/modeshape
@Override
public void setValue( Node value )
throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
if (value == null) {
this.remove();
return;
}
checkSession();
checkForLock();
checkForCheckedOut();
checkModifyPermission();
if (!value.isNodeType(JcrMixLexicon.REFERENCEABLE.getString(this.context().getNamespaceRegistry()))) {
throw new ValueFormatException(JcrI18n.nodeNotReferenceable.text());
}
AbstractJcrNode jcrNode = session.getNodeByIdentifier(value.getIdentifier());
if (!jcrNode.isInTheSameProcessAs(session.context().getProcessId())) {
throw new RepositoryException(JcrI18n.nodeNotInTheSameSession.text(jcrNode.path()));
}
JcrValue referenceValue = session().valueFactory().createValue(jcrNode);
internalSetValue(referenceValue.asType(this.getType()));
}
内容来源于网络,如有侵权,请联系作者删除!