use of org.apache.jackrabbit.core.xml.ClonedInputSource in project jackrabbit by apache.
the class RepositoryImpl method createWorkspace.
/**
* Creates a workspace with the given name.
*
* @param workspaceName name of the new workspace
* @throws RepositoryException if a workspace with the given name
* already exists or if another error occurs
* @see WorkspaceImpl#createWorkspace(String)
*/
protected void createWorkspace(String workspaceName) throws RepositoryException {
synchronized (wspInfos) {
if (wspInfos.containsKey(workspaceName)) {
throw new RepositoryException("workspace '" + workspaceName + "' already exists.");
}
// needed to get newly created workspace config file content when
// running in clustered environment
StringBuffer workspaceConfigContent = null;
if (context.getClusterNode() != null) {
workspaceConfigContent = new StringBuffer();
}
// create the workspace configuration
WorkspaceConfig config = repConfig.createWorkspaceConfig(workspaceName, workspaceConfigContent);
WorkspaceInfo info = createWorkspaceInfo(config);
wspInfos.put(workspaceName, info);
if (workspaceConfigContent != null && createWorkspaceEventChannel != null) {
// notify other cluster node that workspace has been created
InputSource s = new InputSource(new StringReader(workspaceConfigContent.toString()));
createWorkspaceEventChannel.workspaceCreated(workspaceName, new ClonedInputSource(s));
}
}
}
use of org.apache.jackrabbit.core.xml.ClonedInputSource in project jackrabbit by apache.
the class RepositoryImpl method createWorkspace.
/**
* Creates a workspace with the given name and given workspace configuration
* template.
*
* @param workspaceName name of the new workspace
* @param configTemplate the workspace configuration template of the new
* workspace
* @throws RepositoryException if a workspace with the given name already
* exists or if another error occurs
* @see WorkspaceImpl#createWorkspace(String,InputSource)
*/
protected void createWorkspace(String workspaceName, InputSource configTemplate) throws RepositoryException {
if (createWorkspaceEventChannel == null) {
createWorkspaceInternal(workspaceName, configTemplate);
} else {
ClonedInputSource template = new ClonedInputSource(configTemplate);
createWorkspaceInternal(workspaceName, template.cloneInputSource());
createWorkspaceEventChannel.workspaceCreated(workspaceName, template);
}
}
Aggregations