initializeSystemContent(systemGraph);
// Create the namespace registry and corresponding execution context.
// Note that this persistent registry has direct access to the system workspace.
Name uriProperty = DnaLexicon.NAMESPACE_URI;
PathFactory pathFactory = executionContext.getValueFactories().getPathFactory();
Path systemPath = pathFactory.create(JcrLexicon.SYSTEM);
Path namespacesPath = pathFactory.create(systemPath, DnaLexicon.NAMESPACES);
PropertyFactory propertyFactory = executionContext.getPropertyFactory();
Property namespaceType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.NAMESPACE);
// Now create the registry implementation ...
this.persistentRegistry = new GraphNamespaceRegistry(systemGraph, namespacesPath, uriProperty, namespaceType);
this.executionContext = executionContext.with(persistentRegistry);
// Add the built-ins, ensuring we overwrite any badly-initialized values ...
for (Map.Entry<String, String> builtIn : JcrNamespaceRegistry.STANDARD_BUILT_IN_NAMESPACES_BY_PREFIX.entrySet()) {
this.persistentRegistry.register(builtIn.getKey(), builtIn.getValue());
}
// Set up the repository type manager ...
try {
boolean includeInheritedProperties = Boolean.valueOf(this.options.get(Option.TABLES_INCLUDE_COLUMNS_FOR_INHERITED_PROPERTIES));
// this.repositoryTypeManager = new RepositoryNodeTypeManager(this, includeInheritedProperties);
this.repositoryTypeManager = new RepositoryNodeTypeManager(this, includeInheritedProperties);
this.repositoryTypeManager.registerNodeTypes(new CndNodeTypeSource(new String[] {
"/org/jboss/dna/jcr/jsr_170_builtins.cnd", "/org/jboss/dna/jcr/dna_builtins.cnd"}));
} catch (RepositoryException re) {
re.printStackTrace();
throw new IllegalStateException("Could not load node type definition files", re);
} catch (IOException ioe) {
ioe.printStackTrace();
throw new IllegalStateException("Could not access node type definition files", ioe);
}
if (WORKSPACES_SHARE_SYSTEM_BRANCH) {
if (Boolean.valueOf(this.options.get(Option.PROJECT_NODE_TYPES))) {
// Note that the node types are written directly to the system workspace.
Path parentOfTypeNodes = pathFactory.create(systemPath, JcrLexicon.NODE_TYPES);
this.repositoryTypeManager.projectOnto(systemGraph, parentOfTypeNodes);
}
// Create the projection for the system repository ...
ProjectionParser projectionParser = ProjectionParser.getInstance();
String rule = "/jcr:system => /jcr:system";
Projection.Rule[] systemProjectionRules = projectionParser.rulesFromString(this.executionContext, rule);
this.systemSourceProjection = new Projection(systemSourceName, systemWorkspaceName, true, systemProjectionRules);
// Define the federated repository source. Use the same name as the repository, since this federated source
// will not be in the connection factory ...
this.federatedSource = new FederatedRepositorySource();
this.federatedSource.setName("JCR " + repositorySourceName);
this.federatedSource.initialize(new FederatedRepositoryContext(this.connectionFactory));
} else {
this.federatedSource = null;
this.systemSourceProjection = null;
}
this.lockManagers = new ConcurrentHashMap<String, WorkspaceLockManager>();
this.locksPath = pathFactory.create(pathFactory.createRootPath(), JcrLexicon.SYSTEM, DnaLexicon.LOCKS);
// If the repository is to support searching ...
if (Boolean.valueOf(this.options.get(Option.QUERY_EXECUTION_ENABLED)) && WORKSPACES_SHARE_SYSTEM_BRANCH) {
// Determine whether the federated source and original source support queries and searches ...
RepositorySourceCapabilities fedCapabilities = federatedSource != null ? federatedSource.getCapabilities() : null;