if (conn != null) {
// We found a source that we can use for the system ...
systemSourceName = pair.getSourceName();
if (pair.getWorkspaceName() != null) {
// There should be the named workspace ...
Graph temp = Graph.create(conn, executionContext);
temp.useWorkspace(pair.getWorkspaceName());
// found it ...
systemWorkspaceName = pair.getWorkspaceName();
}
} else {
I18n msg = JcrI18n.systemSourceNameOptionValueDoesNotReferenceExistingSource;
Logger.getLogger(getClass()).warn(msg, systemSourceNameValue, systemSourceName);
}
} catch (InvalidWorkspaceException e) {
// Bad workspace name ...
systemSourceName = null;
I18n msg = JcrI18n.systemSourceNameOptionValueDoesNotReferenceValidWorkspace;
Logger.getLogger(getClass()).warn(msg, systemSourceNameValue, systemSourceName);
} catch (IllegalArgumentException e) {
// Invalid format ...
systemSourceName = null;
I18n msg = JcrI18n.systemSourceNameOptionValueIsNotFormattedCorrectly;
Logger.getLogger(getClass()).warn(msg, systemSourceNameValue);
}
}
if (systemSourceName == null) {
// Create the in-memory repository source that we'll use for the "/jcr:system" branch in this repository.
// All workspaces will be set up with a federation connector that projects this system repository into
// "/jcr:system", and all other content is projected to the repositories actual source (and workspace).
// (The federation connector refers to this configuration as an "offset mirror".)
systemWorkspaceName = "jcr:system";
systemSourceName = "jcr:system source";
InMemoryRepositorySource transientSystemSource = new InMemoryRepositorySource();
transientSystemSource.setName(systemSourceName);
transientSystemSource.setDefaultWorkspaceName(systemWorkspaceName);
connectionFactoryWithSystem = new ConnectionFactoryWithSystem(connectionFactory, transientSystemSource);
}
this.systemWorkspaceName = systemWorkspaceName;
this.systemSourceName = systemSourceName;
this.connectionFactory = connectionFactoryWithSystem;
assert this.systemSourceName != null;
assert this.connectionFactory != null;
// Set up the "/jcr:system" branch ...
Graph systemGraph = Graph.create(this.systemSourceName, this.connectionFactory, executionContext);
systemGraph.useWorkspace(systemWorkspaceName);
initializeSystemContent(systemGraph);
this.sourceName = repositorySourceName;
// Create the namespace registry and corresponding execution context.
// Note that this persistent registry has direct access to the system workspace.