[
https://jira.jboss.org/jira/browse/DNA-281?page=com.atlassian.jira.plugin...
]
Randall Hauch commented on DNA-281:
-----------------------------------
The Graph API changes to support workspaces are as follows. Note that each example
returns the graph's Workspace object, which has the name as well as access to the
actual location of the root.
To use an existing workspace:
Workspace ws = graph.useWorkspace("my workspace name");
Note that if the workspace name is null, the "default" workspace is to be used
(whatever that means for the source, or if it's not supported, an exception will be
thrown). The resulting Workspace object will have the name of the actual workspace being
used.
To create a new workspace:
Workspace ws = graph.createWorkspace().named("new workspace name");
This will fail if the workspace cannot be created (e.g., it might already exist, or the
source might not allow creating workspaces). Or, you can always create a new workspace
using this technique:
Workspace ws = graph.createWorkspace().namedSomethingLike("workspace");
As long as the source supports creating new workspaces, it should create a workspace and
adjust the supplied name so that it is unique. Or, you can create a new workspace by
cloning the contents of an existing workspace:
Workspace ws1 =
graph.createWorkspace().clonedFrom("original").named("something");
Workspace ws2 =
graph.createWorkspace().clonedFrom("original").namedSomethingLike("something");
As soon as these operations are performed, the graph will start using the resulting
workspace (known as the "current" workspace). You can also get the current
workspace:
Workspace ws = graph.getCurrentWorkspace();
or the name of the current workspace:
String name = graph.getCurrentWorkspaceName();
which is identical to:
String name = graph.getCurrentWorkspace() != null ?
graph.getCurrentWorkspace().getName() : null;
You can also obtain the list of all available workspaces:
Set<String> workspaceNames = graph.getWorkspaces();
Connector support for workspaces
--------------------------------
Key: DNA-281
URL:
https://jira.jboss.org/jira/browse/DNA-281
Project: DNA
Issue Type: Feature Request
Components: API, Connectors
Affects Versions: 0.3
Reporter: Randall Hauch
Assignee: Randall Hauch
Fix For: 0.4
The connector framework doesn't currently have a notion of workspaces. They were
originally designed this way to keep things simple, but it turns out that not having
workspaces means that a separate RepositorySource would be needed for each JCR workspace,
and even if multiple RepositorySource instances connected to the back end system, a lot of
inefficiencies would be introduced (including duplicate connection pools, inability to
efficiently handle inter-workspace operations like copying or cloning, difficulty managing
sources when creating new workspaces, etc.).
Therefore, to more closely match the JCR API and to more efficiently support
inter-workspace operations (within the same repository), the DNA connector framework
should have a notion of workspaces.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira