You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2014/01/09 21:22:32 UTC
git commit: [KARAF-2433] Add cave:repository-destroy command
Updated Branches:
refs/heads/cave-2.x def2cf4ad -> cc8a56ccc
[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/cc8a56cc
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/cc8a56cc
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/cc8a56cc
Branch: refs/heads/cave-2.x
Commit: cc8a56ccca80f6aa509d5123b28d75d4546000b9
Parents: def2cf4
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Thu Jan 9 21:21:49 2014 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Thu Jan 9 21:21:49 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/cc8a56cc/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/cc8a56cc/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"/>