karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [1/2] git commit: [KARAF-2433] Add cave:repository-destroy command
Date Thu, 09 Jan 2014 20:24:59 GMT
Updated Branches:
  refs/heads/master cd86ef14d -> 11f8946d7


[KARAF-2433] Add cave:repository-destroy command


Project: http://git-wip-us.apache.org/repos/asf/karaf-cave/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cave/commit/636c1095
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/636c1095
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/636c1095

Branch: refs/heads/master
Commit: 636c1095425c20c742e3399747a231d0fdc54c7c
Parents: cd86ef1
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Thu Jan 9 21:21:49 2014 +0100
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Thu Jan 9 21:23:34 2014 +0100

----------------------------------------------------------------------
 .../command/RepositoryDestroyCommand.java       | 40 ++++++++++++++++++++
 .../OSGI-INF/blueprint/cave-server-commands.xml |  5 +++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/636c1095/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryDestroyCommand.java
----------------------------------------------------------------------
diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryDestroyCommand.java
b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryDestroyCommand.java
new file mode 100644
index 0000000..d5259bf
--- /dev/null
+++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryDestroyCommand.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.cave.server.command;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+
+/**
+ * Destroy a Cave repository
+ */
+@Command(scope = "cave", name = "repository-destroy", description = "Destroy a Cave repository
from the registry, including delete of storage")
+public class RepositoryDestroyCommand extends CaveRepositoryCommandSupport {
+
+    @Argument(index = 0, name = "name", description = "The name of the repository", required
= true, multiValued = false)
+    String name = null;
+
+    protected Object doExecute() throws Exception {
+        if (getCaveRepositoryService().getRepository(name) == null) {
+            System.err.println("Cave repository " + name + " doesn't exist");
+            return null;
+        }
+        getCaveRepositoryService().destroy(name);
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/636c1095/server/command/src/main/resources/OSGI-INF/blueprint/cave-server-commands.xml
----------------------------------------------------------------------
diff --git a/server/command/src/main/resources/OSGI-INF/blueprint/cave-server-commands.xml
b/server/command/src/main/resources/OSGI-INF/blueprint/cave-server-commands.xml
index 193c6ed..21583a4 100644
--- a/server/command/src/main/resources/OSGI-INF/blueprint/cave-server-commands.xml
+++ b/server/command/src/main/resources/OSGI-INF/blueprint/cave-server-commands.xml
@@ -32,6 +32,11 @@
                 <property name="caveRepositoryService" ref="caveRepositoryService"/>
             </action>
         </command>
+        <command name="cave/repository-destroy">
+            <action class="org.apache.karaf.cave.server.command.RepositoryDestroyCommand">
+                <property name="CaveRepositoryService" ref="caveRepositoryService"/>
+            </action>
+        </command>
         <command name="cave/repository-uninstall">
             <action class="org.apache.karaf.cave.server.command.RepositoryUninstallCommand">
                 <property name="caveRepositoryService" ref="caveRepositoryService"/>


Mime
View raw message