OBR metadata are updated by default in Cave commands git-svn-id: https://svn.apache.org/repos/asf/karaf/cave/trunk@1166207 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/karaf-cave/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf-cave/commit/cd8a97c9 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/cd8a97c9 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/cd8a97c9 Branch: refs/heads/master Commit: cd8a97c9920aedeb764f59cbfb21ccd0e444bce7 Parents: fd51e6e Author: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Authored: Wed Sep 7 14:56:51 2011 +0000 Committer: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Committed: Wed Sep 7 14:56:51 2011 +0000 ---------------------------------------------------------------------- .../server/command/CreateRepositoryCommand.java | 12 +++---- .../command/PopulateRepositoryCommand.java | 6 ++-- .../server/command/ScanRepositoryCommand.java | 38 -------------------- .../server/command/UpdateRepositoryCommand.java | 38 ++++++++++++++++++++ .../OSGI-INF/blueprint/cave-server-commands.xml | 4 +-- 5 files changed, 49 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/cd8a97c9/server/command/src/main/java/org/apache/karaf/cave/server/command/CreateRepositoryCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/CreateRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/CreateRepositoryCommand.java index 224b3e5..937573c 100644 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/CreateRepositoryCommand.java +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/CreateRepositoryCommand.java @@ -30,11 +30,11 @@ public class CreateRepositoryCommand extends CaveRepositoryCommandSupport { @Option(name = "-l", aliases = {"--location"}, description = "Location of the new Cave Repository on the file system", required = false, multiValued = false) String location; - @Option(name = "-s", aliases = {"--scan"}, description = "If the Cave Repository should be scanned now", required = false, multiValued = false) - boolean scan; + @Option(name = "-nu", aliases = {"--no-update"}, description = "Disable the OBR metadata generation at creation time", required = false, multiValued = false) + boolean noUpdate = false; - @Option(name = "-r", aliases = {"--register"}, description = "If the Cave Repository should be registered in Karaf OBR", required = false, multiValued = false) - boolean register; + @Option(name = "-nr", aliases = {"--no-register"}, description = "Disable the registration of this Cave Repository in the OBR service", required = false, multiValued = false) + boolean noRegister; @Argument(index = 0, name = "name", description = "The name of the Cave Repository", required = true, multiValued = false) String name = null; @@ -46,10 +46,10 @@ public class CreateRepositoryCommand extends CaveRepositoryCommandSupport { getCaveRepositoryService().createRepository(name, false); } CaveRepository caveRepository = getExistingRepository(name); - if (scan) { + if (!noUpdate) { caveRepository.scan(); } - if (register) { + if (!noRegister) { getCaveRepositoryService().register(name); } return null; http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/cd8a97c9/server/command/src/main/java/org/apache/karaf/cave/server/command/PopulateRepositoryCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/PopulateRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/PopulateRepositoryCommand.java index 0d47b5d..87f15dd 100644 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/PopulateRepositoryCommand.java +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/PopulateRepositoryCommand.java @@ -29,8 +29,8 @@ import java.net.URL; @Command(scope = "cave", name = "populate-repository", description = "Populate a Karaf Cave repository with the artifacts present at the given URL") public class PopulateRepositoryCommand extends CaveRepositoryCommandSupport { - @Option(name = "-u", aliases = { "--update" }, description = "Update the OBR metadata on the fly", required = false, multiValued = false) - boolean update = false; + @Option(name = "-nu", aliases = { "--no-update" }, description = "Update the OBR metadata on the fly", required = false, multiValued = false) + boolean noUpdate = false; @Argument(index = 0, name = "name", description = "The name of the Karaf Cave repository", required = true, multiValued = false) String name = null; @@ -40,7 +40,7 @@ public class PopulateRepositoryCommand extends CaveRepositoryCommandSupport { protected Object doExecute() throws Exception { CaveRepository repository = getExistingRepository(name); - repository.populate(new URL(url), update); + repository.populate(new URL(url), !noUpdate); return null; } http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/cd8a97c9/server/command/src/main/java/org/apache/karaf/cave/server/command/ScanRepositoryCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/ScanRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/ScanRepositoryCommand.java deleted file mode 100644 index ea3774a..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/ScanRepositoryCommand.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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; -import org.apache.karaf.cave.server.api.CaveRepository; - -/** - * Command to scan an existing repository and update the OBR metadata - */ -@Command(scope = "cave", name = "scan-repository", description = "Scan an existing Karaf Cave repository and update OBR metadata") -public class ScanRepositoryCommand extends CaveRepositoryCommandSupport { - - @Argument(index = 0, name = "name", description = "The name of the Karaf Cave repository", required = true, multiValued = false) - String name = null; - - protected Object doExecute() throws Exception { - CaveRepository caveRepository = getExistingRepository(name); - caveRepository.scan(); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/cd8a97c9/server/command/src/main/java/org/apache/karaf/cave/server/command/UpdateRepositoryCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/UpdateRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/UpdateRepositoryCommand.java new file mode 100644 index 0000000..c1a8019 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/UpdateRepositoryCommand.java @@ -0,0 +1,38 @@ +/* + * 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; +import org.apache.karaf.cave.server.api.CaveRepository; + +/** + * Command to update the OBR metadata + */ +@Command(scope = "cave", name = "update-repository", description = "Update OBR metadata of a Cave Repository") +public class UpdateRepositoryCommand extends CaveRepositoryCommandSupport { + + @Argument(index = 0, name = "name", description = "The name of the Karaf Cave repository", required = true, multiValued = false) + String name = null; + + protected Object doExecute() throws Exception { + CaveRepository caveRepository = getExistingRepository(name); + caveRepository.scan(); + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/cd8a97c9/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 d860052..feb6a04 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 @@ -50,8 +50,8 @@ <null/> </completers> </command> - <command name="cave/scan-repository"> - <action class="org.apache.karaf.cave.server.command.ScanRepositoryCommand"> + <command name="cave/update-repository"> + <action class="org.apache.karaf.cave.server.command.UpdateRepositoryCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers>
