String workspaceName,
String pathInWorkspace ) {
CheckArg.isNotNull(source, "source");
// Verify connectivity ...
Graph graph = Graph.create(source, context);
if (workspaceName != null) {
Workspace workspace = null;
try {
workspace = graph.useWorkspace(workspaceName); // should throw exception if not connectable
} catch (InvalidWorkspaceException e) {
// Try creating the workspace ...
workspace = graph.createWorkspace().named(workspaceName);
}
assert workspace.getRoot() != null;
}
// Verify the path ...
Path path = pathInWorkspace != null ? path(pathInWorkspace) : path(DEFAULT_PATH);
Node parent = graph.getNodeAt(path);
assert parent != null;
// Now create the content information ...
configurationContent = new ConfigurationDefinition(source, workspaceName, path, context, null);
return this;