jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: rev 57008 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core
Date Tue, 09 Nov 2004 09:11:07 GMT
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();
     }
 
     /**

Mime
View raw message