RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName);
RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName);
RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName);
RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName);
RepositoryConfiguration config2 = engine.getRepositoryConfiguration(config.getName()); Document sequencerA2 = (Document)config2.getDocument() .getDocument(FieldName.SEQUENCING)
RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName);
/** * Immediately change and apply the specified persistence field to the repository configuration * * @param defn the attribute definition for the value; may not be null * @param newValue the new string value * @throws RepositoryException if there is a problem obtaining the repository configuration or applying the change * @throws OperationFailedException if there is a problem obtaining the raw value from the supplied model node */ public void changePersistenceField(MappedAttributeDefinition defn, ModelNode newValue) throws RepositoryException, OperationFailedException { ModeShapeEngine engine = getEngine(); String repositoryName = repositoryName(); // Get a snapshot of the current configuration ... RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName); // Now start to make changes ... Editor editor = config.edit(); EditableDocument persistence = editor.getOrCreateDocument(FieldName.STORAGE).getOrCreateDocument(FieldName.PERSISTENCE); // Change the field ... String fieldName = defn.getFieldName(); // Get the raw value from the model node ... Object rawValue = defn.getTypedValue(newValue); // And update the field ... persistence.set(fieldName, rawValue); // Get and apply the changes to the current configuration. Note that the 'update' call asynchronously // updates the configuration, and returns a Future<JcrRepository> that we could use if we wanted to // wait for the changes to take place. But we don't want/need to wait, so we'll not use the Future ... Changes changes = editor.getChanges(); engine.update(repositoryName, changes); }
/** * Immediately change and apply the specified field in the current repository configuration to the new value. * * @param defn the attribute definition for the value; may not be null * @param newValue the new string value * @throws RepositoryException if there is a problem obtaining the repository configuration or applying the change * @throws OperationFailedException if there is a problem obtaining the raw value from the supplied model node */ public void changeField( MappedAttributeDefinition defn, ModelNode newValue ) throws RepositoryException, OperationFailedException { ModeShapeEngine engine = getEngine(); String repositoryName = repositoryName(); // Get a snapshot of the current configuration ... RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName); // Now start to make changes ... Editor editor = config.edit(); // Find the Document containing the field ... EditableDocument fieldContainer = editor; for (String fieldName : defn.getPathToContainerOfField()) { fieldContainer = editor.getOrCreateDocument(fieldName); } // Get the raw value from the model node ... Object rawValue = defn.getTypedValue(newValue); // Change the field ... String fieldName = defn.getFieldName(); fieldContainer.set(fieldName, rawValue); // Apply the changes to the current configuration ... Changes changes = editor.getChanges(); engine.update(repositoryName, changes); }
RepositoryConfiguration config = engine.getRepositoryConfiguration(repositoryName);