You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2004/11/09 10:11:07 UTC

svn commit: rev 57008 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core

Author: stefan
Date: Tue Nov  9 01:11:06 2004
New Revision: 57008

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
Log:
adding method for workspace creation

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java	Tue Nov  9 01:11:06 2004
@@ -407,6 +407,24 @@
         return (String[]) wspConfigs.keySet().toArray(new String[wspConfigs.keySet().size()]);
     }
 
+    /**
+     * 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
+     */
+    public void createWorkspace(String workspaceName) throws RepositoryException {
+        if (wspConfigs.containsKey(workspaceName)) {
+            throw new RepositoryException("workspace '" + workspaceName + "' already exists.");
+        }
+
+        // create the workspace configuration
+        repConfig.createWorkspaceConfig(workspaceName);
+        // add new configuration to map of workspace configs
+        wspConfigs.put(workspaceName, repConfig.getWorkspaceConfig(workspaceName));
+    }
+
     synchronized PersistentItemStateProvider getWorkspaceStateManager(String workspaceName)
             throws NoSuchWorkspaceException, RepositoryException {
         // check state

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java	Tue Nov  9 01:11:06 2004
@@ -297,6 +297,16 @@
         getItemManager().dump(ps);
     }
 
+    /**
+     * Returns the names of all workspaces of this repository with respect of the
+     * access rights of this session.
+     *
+     * @return the names of all workspaces of this repository.
+     */
+    public String[] getWorkspaceNames() {
+        return rep.getWorkspaceNames();
+    }
+
     //--------------------------------------------------------------< Session >
     /**
      * @see Session#checkPermission(String, String)
@@ -444,16 +454,6 @@
      */
     public Workspace getWorkspace() {
         return wsp;
-    }
-
-    /**
-     * Returns the names of all workspaces of this repository with respect of the
-     * access rights of this session.
-     *
-     * @return the names of all workspaces of this repository.
-     */
-    public String[] getWorkspaceNames() {
-        return rep.getWorkspaceNames();
     }
 
     /**