public synchronized void createWorkspace(String workspaceName) throws RepositoryException
{
SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
final WorkspaceContainer wsContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
if (wsContainer == null)
{
throw new RepositoryException("Workspace " + workspaceName
+ " is not configured. Use RepositoryImpl.configWorkspace() method");
}
WorkspaceInitializer workspaceInitializer =
repositoryContainer.getWorkspaceContainer(workspaceName).getWorkspaceInitializer();
SystemParametersPersistenceConfigurator sppc =
(SystemParametersPersistenceConfigurator)repositoryContainer
.getComponentInstanceOfType(SystemParametersPersistenceConfigurator.class);
if (sppc != null)
{
WorkspaceEntry workspaceEntry = repositoryContainer.getWorkspaceEntry(workspaceName);
repositoryContainer.setInitializerAndValidateOverriddenParameters(workspaceEntry, workspaceInitializer);
}
if (isWorkspaceInitialized(workspaceName))
{
LOG.warn("Workspace '" + workspaceName + "' is presumably initialized. config canceled");
return;
}
workspaceInitializer.initWorkspace();
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
{
public Void run()
{
wsContainer.start();
return null;
}
});
LOG.info("Workspace " + workspaceName + "@" + this.name + " is initialized");
}