Section 7.1.6 of the Modeshape docs say 'Your application can now create and remove workspaces using the standard JCR 2.0 API.'
The JCR 2.0 doc says to use Workspace.createWorkspace(String name)
How do I make this part of my repository obtained using the code at the bottom of this post?
Also, how to I get a list of the workspaces already in the repository?
Thanks
for (RepositoryFactory factory : ServiceLoader.load(RepositoryFactory.class)) {
if (factory instanceof org.modeshape.jcr.api.RepositoryFactory) {
org.modeshape.jcr.api.RepositoryFactory modeshapeRepositoryFactory = (org.modeshape.jcr.api.RepositoryFactory) factory;
final Repositories repositories = modeshapeRepositoryFactory.getRepositories(JCR_CONFIG_FILE_URL);
if (repositories != null) {
Set<String> repositoryNames = repositories.getRepositoryNames();
if (repositoryNames != null) {
for (String repoName : repositoryNames) {
log.info(repoName);
}
}
}
else {
System.out.println("repositories reference was null");
}
}
try {
repository = factory.getRepository(parameters);
if (repository != null) {
printRepoDetails(repository, parameters, factory);
repositoryFactory = factory; // Keep reference to allow clean shutdown. Not part of JCR 2.0
break;
}
}
catch (RepositoryException e) {
log.error("Error getting repository: \n" + e.toString());
e.printStackTrace();
}
}