public AllPathsCache( NodeCache cache, NodeCache removedCache, ExecutionContext context ) { this.cache = cache; this.removedCache = removedCache; this.pathFactory = context.getValueFactories().getPathFactory(); }
public AllPathsCache( NodeCache cache, NodeCache removedCache, ExecutionContext context ) { this.cache = cache; this.removedCache = removedCache; this.pathFactory = context.getValueFactories().getPathFactory(); }
protected ReferenceConstraintChecker( String[] valueConstraints, ExecutionContext context ) { this.context = context; NameFactory factory = context.getValueFactories().getNameFactory(); constraints = new Name[valueConstraints.length]; for (int i = 0; i < valueConstraints.length; i++) { constraints[i] = factory.create(valueConstraints[i]); } }
protected BooleanConstraintChecker( ExecutionContext executionContext, String... constraints ) { this.valueFactories = executionContext.getValueFactories(); if (constraints != null && constraints.length > 0) { constraint = valueFactories.getBooleanFactory().create(constraints[0]); } else { constraint = null; } }
@Override public void setDefaultPrimaryTypeName( String defaultPrimaryType ) throws ConstraintViolationException { if (defaultPrimaryType == null || defaultPrimaryType.trim().length() == 0) { this.defaultPrimaryType = null; } else { try { this.defaultPrimaryType = getContext().getValueFactories().getNameFactory().create(defaultPrimaryType); } catch (ValueFormatException vfe) { throw new ConstraintViolationException(vfe); } } }
protected AbstractSessionCache(ExecutionContext context, WorkspaceCache sharedWorkspaceCache) { this.logger = Logger.getLogger(getClass()); this.context = context; this.sharedWorkspaceCache = sharedWorkspaceCache; this.workspaceCache.set(sharedWorkspaceCache); ValueFactories factories = this.context.getValueFactories(); this.nameFactory = factories.getNameFactory(); this.pathFactory = factories.getPathFactory(); this.rootPath = this.pathFactory.createRootPath(); }
public void setName( String name ) throws ConstraintViolationException { if (name == null) { throw new ConstraintViolationException(); } try { this.name = context.getValueFactories().getNameFactory().create(name); } catch (ValueFormatException vfe) { throw new ConstraintViolationException(vfe); } }
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(); }
public boolean canSetProperty( JcrSession session, String propertyName, Value[] values ) { CheckArg.isNotNull(propertyName, "propertyName"); if (values == null || values.length == 0) { return canRemoveProperty(propertyName); } Name name = context.getValueFactories().getNameFactory().create(propertyName); // Reuse the logic in RepositoryNodeTypeManager ... return nodeTypes().findPropertyDefinition(session, this.name, null, name, values, true) != null; }
private NodeTypeMatcher nodeTypePredicate( NodeTypes nodeTypes, IndexDefinition defn ) { // Get the indexed node type ... String indexedNodeType = defn.getNodeTypeName(); Name indexedNodeTypeName = context().getValueFactories().getNameFactory().create(indexedNodeType); Set<Name> allNodeTypes = nodeTypes.getAllSubtypes(indexedNodeTypeName); assert allNodeTypes != null; return NodeTypeMatcher.create(allNodeTypes, nodeTypes); }
public boolean canSetProperty( JcrSession session, String propertyName, Value[] values ) { CheckArg.isNotNull(propertyName, "propertyName"); if (values == null || values.length == 0) { return canRemoveProperty(propertyName); } Name name = context.getValueFactories().getNameFactory().create(propertyName); // Reuse the logic in RepositoryNodeTypeManager ... return nodeTypes().findPropertyDefinition(session, this.name, null, name, values, true) != null; }
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); }
@Override public boolean getBoolean() throws RepositoryException { checkSession(); try { return context().getValueFactories().getBooleanFactory().create(property().getFirstValue()); } catch (org.modeshape.jcr.value.ValueFormatException e) { throw new ValueFormatException(e.getMessage(), e); } }
SystemContent( SessionCache systemCache ) { this.system = systemCache; ExecutionContext context = systemCache.getContext(); this.propertyFactory = context.getPropertyFactory(); ValueFactories factories = context.getValueFactories(); this.booleans = factories.getBooleanFactory(); this.strings = factories.getStringFactory(); this.names = factories.getNameFactory(); this.referenceFactory = factories.getReferenceFactory(); this.weakReferenceFactory = factories.getWeakReferenceFactory(); this.jcrValues = new JcrValueFactory(context); }
@Override public Calendar getDate() throws RepositoryException { checkSession(); try { return context().getValueFactories().getDateFactory().create(property().getFirstValue()).toCalendar(); } catch (org.modeshape.jcr.value.ValueFormatException e) { throw new ValueFormatException(e.getMessage(), e); } }
@Override public JcrNodeType getNodeType( String nodeTypeName ) throws NoSuchNodeTypeException, RepositoryException { session.checkLive(); Name ntName = context().getValueFactories().getNameFactory().create(nodeTypeName); JcrNodeType type = nodeTypes().getNodeType(ntName); if (type != null) { type = type.with(context(), session); return type; } throw new NoSuchNodeTypeException(JcrI18n.typeNotFound.text(nodeTypeName)); }
private void writeInitializedAt() { LOGGER.debug("Marking repository '{0}' as fully initialized", name); LocalDocumentStore store = documentStore().localStore(); EditableDocument repositoryInfo = store.edit(REPOSITORY_INFO_KEY, true); if (repositoryInfo.get(REPOSITORY_INITIALIZED_AT_FIELD_NAME) == null) { DateTime now = context().getValueFactories().getDateFactory().create(); repositoryInfo.setDate(REPOSITORY_INITIALIZED_AT_FIELD_NAME, now.toDate()); } LOGGER.debug("Repository '{0}' is fully initialized", name); }
@Override @Before public void beforeEach() { super.beforeEach(); this.context = new ExecutionContext(); this.bufferMgr = new BufferManager(context); this.types = new ValueTypeSystem(context.getValueFactories()); }
@Override @Before public void beforeEach() { super.beforeEach(); this.context = new ExecutionContext(); this.bufferMgr = new BufferManager(context); this.types = new ValueTypeSystem(context.getValueFactories()); }
@Test public void shouldConvertValuesToCoreTypes() { ExecutionContext ctx = new ExecutionContext(); Name n1 = ctx.getValueFactories().getNameFactory().create("mix:title"); Name n2 = ctx.getValueFactories().getNameFactory().create("mix:titl"); index.add(key("key8"), "mixinTypes", new Object[]{n1}); index.commit(); SetCriteria sc = new SetCriteria(propertyValue(def4), new Literal(n1), new Literal(n2)); validate(sc, "key8"); }