/** * Marks the given document as cacheable, by setting a flag. * * @param document a {@link EditableDocument} instance; never null * @param cacheable a boolean which indicates whether the document should be cacheable or not. */ public void setCacheable(EditableDocument document, boolean cacheable) { document.set(CACHEABLE_FIELD, cacheable); }
/** * Adds single property value. * * @param name property name. * @param value property value. */ public void put(String name, Object value) { if (value instanceof EsRequest) { document.setDocument(name, ((EsRequest)value).document); } else { document.set(name, value); } }
@Override protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) throws OperationFailedException { binaries.set(FieldName.TYPE, FieldValue.BINARY_STORAGE_TYPE_CASSANDRA); String address = ModelAttributes.CASSANDRA_HOST.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.ADDRESS, address); }
protected void addSequencer( EditableDocument doc, String desc, String type, String... pathExpressions ) { EditableDocument sequencing = doc.getOrCreateDocument(FieldName.SEQUENCING); EditableDocument sequencers = sequencing.getOrCreateDocument(FieldName.SEQUENCERS); // Create the sequencer doc ... String name = desc; EditableDocument sequencer = Schematic.newDocument(); sequencer.set(FieldName.NAME, name); sequencer.set(FieldName.CLASSNAME, type); sequencer.setArray(FieldName.PATH_EXPRESSIONS, (Object[])pathExpressions); // Set it on the 'sequencers' doc ... sequencers.set(name, sequencer); }
@Override protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) throws OperationFailedException { binaries.set(FieldName.TYPE, FieldValue.BINARY_STORAGE_TYPE_TRANSIENT); }
@Override public void start( StartContext startContext ) { EditableDocument compositeDocument = Schematic.newDocument(); //iterate through all the contained nested stored values (which should've been started) and update this configuration for (String storeName : nestedStoresValues.keySet()) { compositeDocument.set(storeName, nestedStoresValues.get(storeName).getValue().getBinaryConfiguration()); } binaries.setDocument(RepositoryConfiguration.FieldName.COMPOSITE_STORE_NAMED_BINARY_STORES, compositeDocument); }
@Override protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) { binaries.set(RepositoryConfiguration.FieldName.TYPE, RepositoryConfiguration.FieldValue.BINARY_STORAGE_TYPE_COMPOSITE); }
/** * Marks the given document as queryable, by setting a flag. * * @param document a {@link EditableDocument} instance; never null * @param queryable a boolean which indicates whether the document should be queryable or not. */ public void setQueryable( EditableDocument document, boolean queryable ) { document.set(QUERYABLE_FIELD, queryable); }
/** * Marks the given document as queryable, by setting a flag. * * @param document a {@link EditableDocument} instance; never null * @param queryable a boolean which indicates whether the document should be queryable or not. */ public void setQueryable( EditableDocument document, boolean queryable ) { document.set(QUERYABLE_FIELD, queryable); }
/** * Marks the given document as cacheable, by setting a flag. * * @param document a {@link EditableDocument} instance; never null * @param cacheable a boolean which indicates whether the document should be cacheable or not. */ public void setCacheable(EditableDocument document, boolean cacheable) { document.set(CACHEABLE_FIELD, cacheable); }
@Override protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) throws OperationFailedException { binaries.set(FieldName.TYPE, FieldValue.BINARY_STORAGE_TYPE_DATABASE); // We don't need to add a dependency since we'll look it up by JNDI and we'll // not shutdown if the data source is shutdown String dataSource = ModelAttributes.DATA_SOURCE_JNDI_NAME.resolveModelAttribute(context, model).asString(); binaries.set(FieldName.DATA_SOURCE_JNDI_NAME, dataSource); }
private void enableMonitoring( boolean enableMonitoring, EditableDocument configDoc ) { EditableDocument monitoring = configDoc.getOrCreateDocument(FieldName.MONITORING); monitoring.set(FieldName.MONITORING_ENABLED, enableMonitoring); } }
@Override protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) { binaries.set(FieldName.TYPE, FieldValue.BINARY_STORAGE_TYPE_CUSTOM); model.asPropertyList().forEach(property -> writeCustomProperty(binaries, property)); }
private void parseTextExtraction( ModelNode model, EditableDocument configDoc ) { if (model.hasDefined(ModelKeys.TEXT_EXTRACTORS_THREAD_POOL_NAME)) { EditableDocument extractors = configDoc.getOrCreateDocument(FieldName.TEXT_EXTRACTION); String poolName = model.get(ModelKeys.TEXT_EXTRACTORS_THREAD_POOL_NAME).asString(); extractors.set(FieldName.THREAD_POOL, poolName); } if (model.hasDefined(ModelKeys.TEXT_EXTRACTORS_MAX_POOL_SIZE)) { EditableDocument sequencing = configDoc.getOrCreateDocument(FieldName.TEXT_EXTRACTION); int maxPoolSize = model.get(ModelKeys.TEXT_EXTRACTORS_MAX_POOL_SIZE).asInt(); sequencing.set(FieldName.MAX_POOL_SIZE, maxPoolSize); } }
private void parseReindexing( ModelNode model, EditableDocument configDoc ) { if (model.hasDefined(ModelKeys.REINDEXING_ASYNC)) { EditableDocument reindexing = configDoc.getOrCreateDocument(FieldName.REINDEXING); boolean async = model.get(ModelKeys.REINDEXING_ASYNC).asBoolean(); reindexing.set(FieldName.REINDEXING_ASYNC, async); } if (model.hasDefined(ModelKeys.REINDEXING_MODE)) { EditableDocument reindexing = configDoc.getOrCreateDocument(FieldName.REINDEXING); String mode = model.get(ModelKeys.REINDEXING_MODE).asString(); reindexing.set(FieldName.REINDEXING_MODE, mode); } }
private void parseSequencing( ModelNode model, EditableDocument configDoc ) { if (model.hasDefined(ModelKeys.SEQUENCERS_THREAD_POOL_NAME)) { EditableDocument sequencing = configDoc.getOrCreateDocument(FieldName.SEQUENCING); String sequencingThreadPool = model.get(ModelKeys.SEQUENCERS_THREAD_POOL_NAME).asString(); sequencing.set(FieldName.THREAD_POOL, sequencingThreadPool); } if (model.hasDefined(ModelKeys.SEQUENCERS_MAX_POOL_SIZE)) { EditableDocument sequencing = configDoc.getOrCreateDocument(FieldName.SEQUENCING); int maxPoolSize = model.get(ModelKeys.SEQUENCERS_MAX_POOL_SIZE).asInt(); sequencing.set(FieldName.MAX_POOL_SIZE, maxPoolSize); } }
/** * Creates a default storage configuration, which will be used whenever no specific binary store is configured. * @return a {@link org.modeshape.jboss.service.BinaryStorage} instance, never {@code null} */ static BinaryStorage defaultConfig() { // By default binaries are not stored on disk EditableDocument binaries = Schematic.newDocument(); binaries.set(RepositoryConfiguration.FieldName.TYPE, RepositoryConfiguration.FieldValue.BINARY_STORAGE_TYPE_TRANSIENT); return new BinaryStorage(binaries); } }
protected void addFederatedSegment( EditableDocument document, String externalNodeKey, String name ) { EditableArray federatedSegmentsArray = document.getArray(FEDERATED_SEGMENTS); if (federatedSegmentsArray == null) { federatedSegmentsArray = Schematic.newArray(); document.set(FEDERATED_SEGMENTS, federatedSegmentsArray); } if (!StringUtil.isBlank(externalNodeKey)) { EditableDocument federatedSegment = DocumentFactory.newDocument(KEY, externalNodeKey, NAME, name); federatedSegmentsArray.add(federatedSegment); } }
protected void addFederatedSegment( EditableDocument document, String externalNodeKey, String name ) { EditableArray federatedSegmentsArray = document.getArray(FEDERATED_SEGMENTS); if (federatedSegmentsArray == null) { federatedSegmentsArray = Schematic.newArray(); document.set(FEDERATED_SEGMENTS, federatedSegmentsArray); } if (!StringUtil.isBlank(externalNodeKey)) { EditableDocument federatedSegment = DocumentFactory.newDocument(KEY, externalNodeKey, NAME, name); federatedSegmentsArray.add(federatedSegment); } }
protected void changeLastUpgradeId( JcrRepository repository, int value ) throws Exception { // modify the repository-info document to force an upgrade on the next restart DocumentStore documentStore = repository.documentStore(); documentStore.localStore().runInTransaction(() -> { EditableDocument editableDocument = documentStore.localStore().edit(RepositoryCache.REPOSITORY_INFO_KEY, true); editableDocument.set("lastUpgradeId", value); documentStore.localStore().put(RepositoryCache.REPOSITORY_INFO_KEY, editableDocument); return null; }, 0); }