@Override public final void addContextData( String key, String value ) { this.context = context.with(key, value); }
protected SessionQueryContext( JcrSession session, Locale locale ) { this.session = session; this.executionContext = (locale == null) ? session.context() : session.context().with(locale); this.factories = executionContext.getValueFactories(); }
SystemNamespaceRegistry( JcrRepository.RunningState repository ) { this.repository = repository; this.cache = new SimpleNamespaceRegistry(); // Pre-load all of the built-in namespaces ... this.cache.register(new ExecutionContext().getNamespaceRegistry().getNamespaces()); }
protected JcrValueFactory( ExecutionContext context ) { this.valueFactories = context.getValueFactories(); this.namespaces = context.getNamespaceRegistry(); this.executionContextProcessId = context.getProcessId(); }
/** * Create an instance of an execution context that uses the {@link AccessController#getContext() current JAAS calling context} * , with default implementations for all other components (including default namespaces in the * {@link #getNamespaceRegistry() namespace registry}. */ @SuppressWarnings( "synthetic-access" ) public ExecutionContext() { this(new NullSecurityContext(), null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); initializeDefaultNamespaces(this.getNamespaceRegistry()); assert securityContext != null; }
/** * @see org.modeshape.jcr.security.JaasProvider#authenticate(javax.jcr.Credentials, java.lang.String, java.lang.String, org.modeshape.jcr.ExecutionContext, java.util.Map) */ @Override public ExecutionContext authenticate(Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) { ExecutionContext ctx = super.authenticate(credentials, repositoryName, workspaceName, repositoryContext, sessionAttributes); if (ctx != null) { return repositoryContext.with(new SrampSecurityContext(ctx.getSecurityContext())); } return ctx; }
protected MockJcrTypeSystem( JcrValueFactory valueFactory ) { this.executionContext = new ExecutionContext(); this.valueFactory = valueFactory; this.delegate = this.executionContext.getValueFactories().getTypeSystem(); }
public AllPathsCache( NodeCache cache, NodeCache removedCache, ExecutionContext context ) { this.cache = cache; this.removedCache = removedCache; this.pathFactory = context.getValueFactories().getPathFactory(); }
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); } }
/** * Create a new importer that will place the content in the supplied destination under the supplied path. * * @param context the context in which the importing should be performed; may not be null * */ public CndImporter( ExecutionContext context ) { assert context != null; this.localRegistry = new LocalNamespaceRegistry(context.getNamespaceRegistry()); this.context = context.with(this.localRegistry); this.valueFactory = new JcrValueFactory(this.context); this.nameFactory = this.context.getValueFactories().getNameFactory(); this.stringFactory = this.context.getValueFactories().getStringFactory(); this.nodeTypes = new LinkedList<NodeTypeDefinition>(); }
protected LegacySidecarExtraPropertyStore( FileSystemConnector connector ) { this.connector = connector; this.registry = this.connector.registry(); this.propertyFactory = this.connector.getContext().getPropertyFactory(); this.factories = this.connector.getContext().getValueFactories(); this.stringFactory = factories.getStringFactory(); }
@BeforeClass public static void beforeAll() throws Exception { File gitDir = new File("../../.git"); RepositoryBuilder builder = new RepositoryBuilder(); repository = builder.setGitDir(gitDir).readEnvironment().findGitDir().build(); git = new Git(repository); context = new ExecutionContext(); values = new Values(context.getValueFactories(), context.getBinaryStore()); }
@Before public void beforeEach() { context = new ExecutionContext(); context.getNamespaceRegistry().register("x", "http://example.com"); typeSystem = context.getValueFactories().getTypeSystem(); parser = new XPathParser(typeSystem); }
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()); }; }
protected BasicSaveContext( ExecutionContext context ) { this.now = context.getValueFactories().getDateFactory().create(); this.userId = context.getSecurityContext().getUserName(); }
@Override public String toString() { StringBuilder sb = new StringBuilder("Execution context for "); if (getSecurityContext() == null) sb.append("null"); else sb.append(getSecurityContext().getUserName()); sb.append(" (").append(id).append(')'); return sb.toString(); }
@Test public void shouldUseJcrCardinalityPerPropertyDefinition() throws Exception { initializeData(); // Verify that the node does exist in the source ... Path pathToNode = session.context().getValueFactories().getPathFactory().create("/a/b"); Node carsNode = session.node(pathToNode); String mixinTypesName = JcrLexicon.MIXIN_TYPES.getString(session.context().getNamespaceRegistry()); Property mixinTypes = carsNode.getProperty(mixinTypesName); // Check that the JCR property is a MultiProperty - this call will throw an exception if the property is not. mixinTypes.getValues(); }
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); }
@Before public void beforeEach() { context = new QueryContext(new ExecutionContext(), mock(RepositoryCache.class), Collections.singleton("workspace"), mock(Schemata.class), mock(RepositoryIndexes.class), mock(NodeTypes.class), mock(BufferManager.class)); rule = AddAccessNodes.INSTANCE; }