/** * Returns the value of the CONTENT document from a given entry document. * * @param entryDocument a {@link Document} instance representing a schematic entry. * @return a {@link Document} or {@code null} if there is no {@link org.modeshape.schematic.SchematicEntry.FieldName#CONTENT} * document. */ static Document content(Document entryDocument) { return entryDocument.getDocument(FieldName.CONTENT); }
public Document getPersistenceConfiguration() { Document storage = doc.getDocument(FieldName.STORAGE); if (storage == null) { return null; } return storage.getDocument(FieldName.PERSISTENCE); }
/** * Returns the value of the CONTENT document from a given entry document. * * @param entryDocument a {@link Document} instance representing a schematic entry. * @return a {@link Document} or {@code null} if there is no {@link org.modeshape.schematic.SchematicEntry.FieldName#CONTENT} * document. */ static Document content(Document entryDocument) { return entryDocument.getDocument(FieldName.CONTENT); }
public InitialContent( Document workspaces ) { workspacesInitialContentFiles = new HashMap<String, String>(); if (workspaces != null) { Document initialContent = workspaces.getDocument(FieldName.INITIAL_CONTENT); if (initialContent != null) { parseInitialContent(initialContent); } } }
/** * Get the configuration for the garbage collection aspects of this repository. * * @return the garbage collection configuration; never null */ public GarbageCollection getGarbageCollection() { return new GarbageCollection(doc.getDocument(FieldName.GARBAGE_COLLECTION)); }
/** * Get the configuration for the monitoring-related aspects of this repository. * * @return the monitoring configuration; never null */ public MonitoringSystem getMonitoring() { return new MonitoringSystem(doc.getDocument(FieldName.MONITORING)); }
public boolean isCreatingWorkspacesAllowed() { Document workspaces = doc.getDocument(FieldName.WORKSPACES); if (workspaces != null) { return workspaces.getBoolean(FieldName.ALLOW_CREATION, Default.ALLOW_CREATION); } return Default.ALLOW_CREATION; }
/** * Get the configuration for the monitoring-related aspects of this repository. * * @return the monitoring configuration; never null */ public MonitoringSystem getMonitoring() { return new MonitoringSystem(doc.getDocument(FieldName.MONITORING)); }
public int getWorkspaceCacheSize() { Document storage = doc.getDocument(FieldName.WORKSPACES); if (storage != null) { return storage.getInteger(FieldName.WORKSPACE_CACHE_SIZE, Default.WORKSPACE_CACHE_SIZE); } return Default.WORKSPACE_CACHE_SIZE; }
public boolean isCreatingWorkspacesAllowed() { Document workspaces = doc.getDocument(FieldName.WORKSPACES); if (workspaces != null) { return workspaces.getBoolean(FieldName.ALLOW_CREATION, Default.ALLOW_CREATION); } return Default.ALLOW_CREATION; }
/** * Get the name of the workspace that should be used for sessions where the client does not specify the name of the workspace. * * @return the default workspace name; never null */ public String getDefaultWorkspaceName() { Document workspaces = doc.getDocument(FieldName.WORKSPACES); if (workspaces != null) { return workspaces.getString(FieldName.DEFAULT, Default.DEFAULT); } return Default.DEFAULT; }
/** * Get the configuration for the document optimization for this repository. * * @return the document optimization configuration; never null */ public DocumentOptimization getDocumentOptimization() { Document storage = doc.getDocument(FieldName.STORAGE); if (storage == null) { storage = Schematic.newDocument(); } return new DocumentOptimization(storage.getDocument(FieldName.DOCUMENT_OPTIMIZATION)); }
public BinaryStorage getBinaryStorage() { Document storage = doc.getDocument(FieldName.STORAGE); if (storage == null) { storage = Schematic.newDocument(); } return new BinaryStorage(storage.getDocument(FieldName.BINARY_STORAGE)); }
/** * Returns the initial content configuration for this repository configuration * * @return a {@code non-null} {@link InitialContent} */ public InitialContent getInitialContent() { return new InitialContent(doc.getDocument(FieldName.WORKSPACES)); }
/** * Returns the reindexing configuration. * * @return a {@link org.modeshape.jcr.RepositoryConfiguration.Reindexing} instance, never {@code null}. */ public Reindexing getReindexing() { return new Reindexing(doc.getDocument(FieldName.REINDEXING)); }
/** * Get the configuration for the document optimization for this repository. * * @return the document optimization configuration; never null */ public DocumentOptimization getDocumentOptimization() { Document storage = doc.getDocument(FieldName.STORAGE); if (storage == null) { storage = Schematic.newDocument(); } return new DocumentOptimization(storage.getDocument(FieldName.DOCUMENT_OPTIMIZATION)); }
public BinaryStorage getBinaryStorage() { Document storage = doc.getDocument(FieldName.STORAGE); if (storage == null) { storage = Schematic.newDocument(); } return new BinaryStorage(storage.getDocument(FieldName.BINARY_STORAGE)); }
/** * Get the configuration for the garbage collection aspects of this repository. * * @return the garbage collection configuration; never null */ public GarbageCollection getGarbageCollection() { return new GarbageCollection(doc.getDocument(FieldName.GARBAGE_COLLECTION)); }
public ChildReferencesInfo getChildReferencesInfo( Document document ) { // Now look at the 'childrenInfo' document for info about the next block ... Document childrenInfo = document.getDocument(CHILDREN_INFO); if (childrenInfo != null) { long totalSize = childrenInfo.getLong(COUNT, 0L); long blockSize = childrenInfo.getLong(BLOCK_SIZE, 0L); String nextBlockKey = childrenInfo.getString(NEXT_BLOCK); String lastBlockKey = childrenInfo.getString(LAST_BLOCK, nextBlockKey); return new ChildReferencesInfo(totalSize, blockSize, nextBlockKey, lastBlockKey); } return null; }
@Test public void shouldParseDocumentWithNestedDocument() throws Exception { bson = (Document)parser("{ \"foo\" : 32 , \"nested\" : { \"bar\" : \"baz\", \"bom\" : true }}").parseValue(); assertField("foo", 32); bson = bson.getDocument("nested"); assertField("bar", "baz"); assertField("bom", true); }