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 2013/12/18 09:19:25 UTC

[04/50] [abbrv] Start of the Cave manual.

http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/7b1fa499/server/api/src/main/java/org/apache/karaf/cave/server/api/CaveRepositoryService.java
----------------------------------------------------------------------
diff --git a/server/api/src/main/java/org/apache/karaf/cave/server/api/CaveRepositoryService.java b/server/api/src/main/java/org/apache/karaf/cave/server/api/CaveRepositoryService.java
index c9fc55a..4e99e79 100644
--- a/server/api/src/main/java/org/apache/karaf/cave/server/api/CaveRepositoryService.java
+++ b/server/api/src/main/java/org/apache/karaf/cave/server/api/CaveRepositoryService.java
@@ -53,6 +53,7 @@ public interface CaveRepositoryService {
 
     /**
      * Destroy an existing Karaf Cave repository.
+     * Warning: destroy also remove the Karaf Cave repository storage.
      *
      * @param name the name of Karaf Cave repository to destroy.
      * @throws Exception in case of destroy failure.
@@ -62,6 +63,15 @@ public interface CaveRepositoryService {
     void destroy(String name) throws Exception;
 
     /**
+     * Remove an existing Karaf Cave repository from the registry.
+     * NB: the Karaf Cave repository storage is not removed.
+     *
+     * @param name the name of Karaf Cave repository to remove.
+     * @throws Exception in case of remove failure.
+     */
+    void remove(String name) throws Exception;
+
+    /**
      * Register a Karaf Cave repository into the OBR.
      *
      * @param name the name of the Karaf Cave repository.

http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/7b1fa499/server/command/src/main/java/org/apache/karaf/cave/server/command/RemoveRepositoryCommand.java
----------------------------------------------------------------------
diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RemoveRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RemoveRepositoryCommand.java
new file mode 100644
index 0000000..5c9a39b
--- /dev/null
+++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RemoveRepositoryCommand.java
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/**
+ * Remove a Karaf Cave repository from the repositories registry.
+ */
+public class RemoveRepositoryCommand extends CaveRepositoryCommandSupport {
+
+    @Argument(index = 0, name = "name", description = "The Karaf Cave repository name", required = true, multiValued = false)
+    String name = null;
+
+    protected Object doExecute() throws Exception {
+        getCaveRepositoryService().destroy(name);
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/7b1fa499/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 c7b5a74..d860052 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,15 @@
                 <property name="caveRepositoryService" ref="caveRepositoryService"/>
             </action>
         </command>
+        <command name="cave/remove-repository">
+            <action class="org.apache.karaf.cave.server.command.RemoveRepositoryCommand">
+                <property name="caveRepositoryService" ref="caveRepositoryService"/>
+            </action>
+            <completers>
+                <ref component-id="repositoryCompleter"/>
+                <null/>
+            </completers>
+        </command>
         <command name="cave/destroy-repository">
             <action class="org.apache.karaf.cave.server.command.DestroyRepositoryCommand">
                 <property name="caveRepositoryService" ref="caveRepositoryService"/>

http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/7b1fa499/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java
index fdeee1c..e9fef66 100644
--- a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java
+++ b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java
@@ -82,6 +82,19 @@ public class CaveRepositoryServiceImpl implements CaveRepositoryService {
     }
 
     /**
+     * Remove a Karaf Cave repository from the repositories registry.
+     *
+     * @param name the name of Karaf Cave repository to remove.
+     * @throws Exception in case of remove failure.
+     */
+    public synchronized void remove(String name) throws Exception {
+        CaveRepository repository = this.getRepository(name);
+        if (repository != null) {
+            repositories.remove(name);
+        }
+    }
+
+    /**
      * Destroy a Karaf Cave repository.
      *
      * @param name the name of Karaf Cave repository to destroy.