]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - legacy/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/web/ajaxplorer/svn/SvnMkdirAction.java
Restructure SLC
[gpl/argeo-slc.git] / legacy / runtime / org.argeo.slc.server / src / main / java / org / argeo / slc / web / ajaxplorer / svn / SvnMkdirAction.java
diff --git a/legacy/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/web/ajaxplorer/svn/SvnMkdirAction.java b/legacy/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/web/ajaxplorer/svn/SvnMkdirAction.java
new file mode 100644 (file)
index 0000000..21cbaaa
--- /dev/null
@@ -0,0 +1,43 @@
+/*\r
+ * Copyright (C) 2007-2012 Mathieu Baudier\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *         http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.web.ajaxplorer.svn;\r
+\r
+import java.io.File;\r
+\r
+import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
+import org.argeo.slc.web.ajaxplorer.file.FileMkdirAction;\r
+import org.tmatesoft.svn.core.SVNException;\r
+\r
+public class SvnMkdirAction extends FileMkdirAction<SvnDriver> {\r
+       @Override\r
+       protected void postProcess(SvnDriver driver, File newDir) {\r
+               try {\r
+                       driver.beginWriteAction(newDir.getParentFile());\r
+\r
+                       log.debug("SVN Add: " + newDir);\r
+                       driver.getManager().getWCClient().doAdd(newDir, true,\r
+                                       newDir.isDirectory(), true, true);\r
+\r
+                       driver.commitAll("Commit new dir " + newDir.getName());\r
+                       driver.completeWriteAction(newDir.getParentFile());\r
+               } catch (SVNException e) {\r
+                       throw new AjxpDriverException("Cannot commit new dir" + newDir, e);\r
+               } finally {\r
+                       driver.rollbackWriteAction(newDir.getParentFile());\r
+               }\r
+       }\r
+\r
+}\r