[KARAF-871] Rename commands git-svn-id: https://svn.apache.org/repos/asf/karaf/cave/trunk@1510370 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/d499da15 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/d499da15 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/d499da15 Branch: refs/heads/master Commit: d499da15e6698c96e1da8de9f97228fa38f0636d Parents: 24b8c83 Author: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Authored: Mon Aug 5 04:19:30 2013 +0000 Committer: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Committed: Mon Aug 5 04:19:30 2013 +0000 ---------------------------------------------------------------------- .../server/command/CreateRepositoryCommand.java | 58 -------------------- .../server/command/ListRepositoriesCommand.java | 41 -------------- .../command/PopulateRepositoryCommand.java | 53 ------------------ .../server/command/ProxyRepositoryCommand.java | 53 ------------------ .../command/RegisterRepositoryCommand.java | 37 ------------- .../server/command/RemoveRepositoryCommand.java | 36 ------------ .../server/command/RepositoriesListCommand.java | 41 ++++++++++++++ .../server/command/RepositoryCreateCommand.java | 58 ++++++++++++++++++++ .../command/RepositoryInstallCommand.java | 37 +++++++++++++ .../command/RepositoryPopulateCommand.java | 53 ++++++++++++++++++ .../command/RepositoryProxyUrlCommand.java | 53 ++++++++++++++++++ .../command/RepositoryUninstallCommand.java | 36 ++++++++++++ .../server/command/RepositoryUpdateCommand.java | 38 +++++++++++++ .../RepositoryUploadArtifactCommand.java | 50 +++++++++++++++++ .../server/command/UpdateRepositoryCommand.java | 38 ------------- .../server/command/UploadArtifactCommand.java | 50 ----------------- .../OSGI-INF/blueprint/cave-server-commands.xml | 32 +++++------ 17 files changed, 382 insertions(+), 382 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/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 deleted file mode 100644 index c54a10e..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/CreateRepositoryCommand.java +++ /dev/null @@ -1,58 +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.felix.gogo.commands.Option; -import org.apache.karaf.cave.server.api.CaveRepository; - -/** - * Command to create a Karaf Cave repository. - */ -@Command(scope = "cave", name = "create-repository", description = "Creates a new Karaf Cave repository") -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 = "-nu", aliases = {"--no-update"}, description = "Omit generating OBR metadata during creation", required = false, multiValued = false) - boolean noUpdate = false; - - @Option(name = "-nr", aliases = {"--no-register"}, description = "Do not register the Cave repository within the OBR service", required = false, multiValued = false) - boolean noRegister = false; - - @Argument(index = 0, name = "name", description = "The name of the Cave Repository", required = true, multiValued = false) - String name = null; - - protected Object doExecute() throws Exception { - if (location != null) { - getCaveRepositoryService().createRepository(name, location, false); - } else { - getCaveRepositoryService().createRepository(name, false); - } - CaveRepository caveRepository = getExistingRepository(name); - if (!noUpdate) { - caveRepository.scan(); - } - if (!noRegister) { - getCaveRepositoryService().install(name); - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/ListRepositoriesCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/ListRepositoriesCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/ListRepositoriesCommand.java deleted file mode 100644 index 709fd6d..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/ListRepositoriesCommand.java +++ /dev/null @@ -1,41 +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.Command; -import org.apache.karaf.cave.server.api.CaveRepository; - -/** - * Command to list all Karaf Cave repositories available. - */ -@Command(scope = "cave", name = "list-repositories", description = "List all Karaf Cave repositories") -public class ListRepositoriesCommand extends CaveRepositoryCommandSupport { - - private static final String OUTPUT_FORMAT = "%-20s %-20s"; - - protected Object doExecute() throws Exception { - CaveRepository[] repositories = getCaveRepositoryService().getRepositories(); - - System.out.println(String.format(OUTPUT_FORMAT, "Name", "Location")); - for (int i = 0; i < repositories.length; i++) { - System.out.println(String.format(OUTPUT_FORMAT, "[" + repositories[i].getName() + "]", "[" + repositories[i].getLocation() + "]")); - } - - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/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 deleted file mode 100644 index f0e1f07..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/PopulateRepositoryCommand.java +++ /dev/null @@ -1,53 +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.felix.gogo.commands.Option; -import org.apache.karaf.cave.server.api.CaveRepository; - -import java.net.URL; - -/** - * Command to populate a Karaf Cave repository from a given 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 = "-nu", aliases = { "--no-update" }, description = "Not update the OBR metadata", required = false, multiValued = false) - boolean noUpdate = false; - - @Option(name = "-f", aliases = { "--filter" }, description = "Regex filter on the artifacts URL", required = false, multiValued = false) - String filter; - - @Argument(index = 0, name = "name", description = "The name of the Karaf Cave repository", required = true, multiValued = false) - String name = null; - - @Argument(index = 1, name = "url", description = "The source URL to scan", required = true, multiValued = false) - String url = null; - - protected Object doExecute() throws Exception { - CaveRepository repository = getExistingRepository(name); - repository.populate(new URL(url), filter, !noUpdate); - if (!noUpdate) { - getCaveRepositoryService().install(name); - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/ProxyRepositoryCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/ProxyRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/ProxyRepositoryCommand.java deleted file mode 100644 index 8d7bba1..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/ProxyRepositoryCommand.java +++ /dev/null @@ -1,53 +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.felix.gogo.commands.Option; -import org.apache.karaf.cave.server.api.CaveRepository; - -import java.net.URL; - -/** - * Add an URL to proxy in the Karaf Cave repository. - */ -@Command(scope = "cave", name = "proxy-repository", description = "Proxy a given URL in the Karaf Cave repository") -public class ProxyRepositoryCommand extends CaveRepositoryCommandSupport { - - @Argument(index = 0, name = "name", description = "The Karaf Cave repository in which we want to proxy the URL", required = true, multiValued = false) - String name = null; - - @Argument(index = 1, name = "URL", description = "The URL to proxy in the Karaf Cave repository", required = true, multiValued = false) - String url = null; - - @Option(name = "-nu", aliases = { "--no-update", "--no-refresh", "--no-register" }, description = "No refresh of the OBR URLs", required = false, multiValued = false) - boolean noUpdate = false; - - @Option(name = "-f", aliases = { "--filter" }, description = "Regex filter on the artifacts URL", required = false, multiValued = false) - String filter; - - protected Object doExecute() throws Exception { - CaveRepository repository = getExistingRepository(name); - repository.proxy(new URL(url), filter); - if (!noUpdate) { - getCaveRepositoryService().install(name); - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RegisterRepositoryCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RegisterRepositoryCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RegisterRepositoryCommand.java deleted file mode 100644 index 1dbda52..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/RegisterRepositoryCommand.java +++ /dev/null @@ -1,37 +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 register a Karaf Cave repository into the Karaf OBR. - */ -@Command(scope = "cave", name = "register-repository", description = "Register a Karaf Cave repository in the Karaf OBR") -public class RegisterRepositoryCommand extends CaveRepositoryCommandSupport { - - @Argument(index = 0, name = "name", description = "Name of Karaf Cave repository to register", required = true, multiValued = false) - String name = null; - - protected Object doExecute() throws Exception { - getCaveRepositoryService().install(name); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/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 deleted file mode 100644 index c43650f..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/RemoveRepositoryCommand.java +++ /dev/null @@ -1,36 +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; - -/** - * Remove a Karaf Cave repository from the repositories registry. - */ -@Command(scope = "cave", name = "remove-repository", description = "Remove a Karaf Cave repository from the Cave repository list") -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().uninstall(name); - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java new file mode 100644 index 0000000..f7eccf1 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java @@ -0,0 +1,41 @@ +/* + * 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.Command; +import org.apache.karaf.cave.server.api.CaveRepository; + +/** + * Command to list all Karaf Cave repositories available. + */ +@Command(scope = "cave", name = "repositories-list", description = "List all Karaf Cave repositories") +public class RepositoriesListCommand extends CaveRepositoryCommandSupport { + + private static final String OUTPUT_FORMAT = "%-20s %-20s"; + + protected Object doExecute() throws Exception { + CaveRepository[] repositories = getCaveRepositoryService().getRepositories(); + + System.out.println(String.format(OUTPUT_FORMAT, "Name", "Location")); + for (int i = 0; i < repositories.length; i++) { + System.out.println(String.format(OUTPUT_FORMAT, "[" + repositories[i].getName() + "]", "[" + repositories[i].getLocation() + "]")); + } + + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java new file mode 100644 index 0000000..f78109f --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java @@ -0,0 +1,58 @@ +/* + * 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.felix.gogo.commands.Option; +import org.apache.karaf.cave.server.api.CaveRepository; + +/** + * Command to create a Karaf Cave repository. + */ +@Command(scope = "cave", name = "repository-create", description = "Create a new Karaf Cave repository") +public class RepositoryCreateCommand extends CaveRepositoryCommandSupport { + + @Option(name = "-l", aliases = {"--location"}, description = "Location of the new repository on the file system", required = false, multiValued = false) + String location; + + @Option(name = "-nu", aliases = {"--no-update"}, description = "Do not generate OBR metadata during creation", required = false, multiValued = false) + boolean noUpdate = false; + + @Option(name = "-nr", aliases = {"--no-register"}, description = "Do not register the repository within the OBR service", required = false, multiValued = false) + boolean noRegister = false; + + @Argument(index = 0, name = "name", description = "The name of the repository", required = true, multiValued = false) + String name = null; + + protected Object doExecute() throws Exception { + if (location != null) { + getCaveRepositoryService().createRepository(name, location, false); + } else { + getCaveRepositoryService().createRepository(name, false); + } + CaveRepository caveRepository = getExistingRepository(name); + if (!noUpdate) { + caveRepository.scan(); + } + if (!noRegister) { + getCaveRepositoryService().install(name); + } + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java new file mode 100644 index 0000000..1667355 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java @@ -0,0 +1,37 @@ +/* + * 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 install a Karaf Cave repository into the Karaf OBR service. + */ +@Command(scope = "cave", name = "repository-install", description = "Install (register) a Karaf Cave repository in the Karaf OBR service") +public class RepositoryInstallCommand extends CaveRepositoryCommandSupport { + + @Argument(index = 0, name = "name", description = "Name of repository", required = true, multiValued = false) + String name = null; + + protected Object doExecute() throws Exception { + getCaveRepositoryService().install(name); + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java new file mode 100644 index 0000000..a93f928 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java @@ -0,0 +1,53 @@ +/* + * 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.felix.gogo.commands.Option; +import org.apache.karaf.cave.server.api.CaveRepository; + +import java.net.URL; + +/** + * Command to populate a Karaf Cave repository from a given URL. + */ +@Command(scope = "cave", name = "repository-populate", description = "Populate a Karaf Cave repository with the artifacts present at the given URL") +public class RepositoryPopulateCommand extends CaveRepositoryCommandSupport { + + @Option(name = "-nu", aliases = { "--no-update" }, description = "Do not update the OBR metadata", required = false, multiValued = false) + boolean noUpdate = false; + + @Option(name = "-f", aliases = { "--filter" }, description = "Regex filter on the artifacts URL", required = false, multiValued = false) + String filter; + + @Argument(index = 0, name = "name", description = "The name of the repository", required = true, multiValued = false) + String name = null; + + @Argument(index = 1, name = "url", description = "The source URL to scan", required = true, multiValued = false) + String url = null; + + protected Object doExecute() throws Exception { + CaveRepository repository = getExistingRepository(name); + repository.populate(new URL(url), filter, !noUpdate); + if (!noUpdate) { + getCaveRepositoryService().install(name); + } + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyUrlCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyUrlCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyUrlCommand.java new file mode 100644 index 0000000..d52948f --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyUrlCommand.java @@ -0,0 +1,53 @@ +/* + * 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.felix.gogo.commands.Option; +import org.apache.karaf.cave.server.api.CaveRepository; + +import java.net.URL; + +/** + * Add an URL to proxy in the Karaf Cave repository. + */ +@Command(scope = "cave", name = "repository-proxy-url", description = "Proxy a given URL in the Karaf Cave repository") +public class RepositoryProxyUrlCommand extends CaveRepositoryCommandSupport { + + @Argument(index = 0, name = "name", description = "The repository proxying the URL", required = true, multiValued = false) + String name = null; + + @Argument(index = 1, name = "URL", description = "The URL to proxy", required = true, multiValued = false) + String url = null; + + @Option(name = "-nu", aliases = { "--no-update", "--no-refresh", "--no-register" }, description = "No refresh of the OBR URLs", required = false, multiValued = false) + boolean noUpdate = false; + + @Option(name = "-f", aliases = { "--filter" }, description = "Regex filter on the artifacts URL", required = false, multiValued = false) + String filter; + + protected Object doExecute() throws Exception { + CaveRepository repository = getExistingRepository(name); + repository.proxy(new URL(url), filter); + if (!noUpdate) { + getCaveRepositoryService().install(name); + } + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java new file mode 100644 index 0000000..906c672 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java @@ -0,0 +1,36 @@ +/* + * 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; + +/** + * Uninstall a Karaf Cave repository from the repositories registry. + */ +@Command(scope = "cave", name = "repository-uninstall", description = "Uninstall a Karaf Cave repository from the Cave repository registry") +public class RepositoryUninstallCommand extends CaveRepositoryCommandSupport { + + @Argument(index = 0, name = "name", description = "The repository name", required = true, multiValued = false) + String name = null; + + protected Object doExecute() throws Exception { + getCaveRepositoryService().uninstall(name); + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java new file mode 100644 index 0000000..7b225b6 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.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 of a Karaf Cave repository + */ +@Command(scope = "cave", name = "repository-update", description = "Update OBR metadata of a Karaf Cave repository") +public class RepositoryUpdateCommand 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 { + CaveRepository caveRepository = getExistingRepository(name); + caveRepository.scan(); + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java new file mode 100644 index 0000000..c76f567 --- /dev/null +++ b/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java @@ -0,0 +1,50 @@ +/* + * 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.felix.gogo.commands.Option; +import org.apache.karaf.cave.server.api.CaveRepository; + +import java.net.URL; + +/** + * Command to upload an artifact into a Karaf Cave repository + */ +@Command(scope = "cave", name = "repository-upload-artifact", description = "Upload an artifact in a Karaf Cave repository") +public class RepositoryUploadArtifactCommand extends CaveRepositoryCommandSupport { + + @Argument(index = 0, name = "repository", description = "The name of the repository", required = true, multiValued = false) + String name = null; + + @Argument(index = 1, name = "artifact", description = "The URL of the artifact to upload", required = true, multiValued = false) + String url = null; + + @Option(name = "-nu", aliases = { "--no-update", "--no-refresh", "--no-register" }, description = "Do not refresh the OBR repository service", required = false, multiValued = true) + boolean noUpdate = false; + + public Object doExecute() throws Exception { + CaveRepository caveRepository = getExistingRepository(name); + caveRepository.upload(new URL(url)); + if (!noUpdate) { + getCaveRepositoryService().install(name); + } + return null; + } + +} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/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 deleted file mode 100644 index c1a8019..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/UpdateRepositoryCommand.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 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/d499da15/server/command/src/main/java/org/apache/karaf/cave/server/command/UploadArtifactCommand.java ---------------------------------------------------------------------- diff --git a/server/command/src/main/java/org/apache/karaf/cave/server/command/UploadArtifactCommand.java b/server/command/src/main/java/org/apache/karaf/cave/server/command/UploadArtifactCommand.java deleted file mode 100644 index 72e7ae9..0000000 --- a/server/command/src/main/java/org/apache/karaf/cave/server/command/UploadArtifactCommand.java +++ /dev/null @@ -1,50 +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.felix.gogo.commands.Option; -import org.apache.karaf.cave.server.api.CaveRepository; - -import java.net.URL; - -/** - * Command to upload an artifact into a Karaf Cave repository. - */ -@Command(scope = "cave", name = "upload-artifact", description = "Upload an artifact in a Karaf Cave repository") -public class UploadArtifactCommand extends CaveRepositoryCommandSupport { - - @Argument(index = 0, name = "repository", description = "The name of the Karaf Cave repository", required = true, multiValued = false) - String name = null; - - @Argument(index = 1, name = "artifact", description = "The URL of the artifact to upload", required = true, multiValued = false) - String url = null; - - @Option(name = "-nu", aliases = { "--no-update", "--no-refresh", "--no-register" }, description = "Not refresh the OBR repository service", required = false, multiValued = true) - boolean noUpdate = false; - - public Object doExecute() throws Exception { - CaveRepository caveRepository = getExistingRepository(name); - caveRepository.upload(new URL(url)); - if (!noUpdate) { - getCaveRepositoryService().install(name); - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/d499da15/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 e88a63f..0f6155a 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 @@ -22,18 +22,18 @@ <reference id="caveRepositoryService" interface="org.apache.karaf.cave.server.api.CaveRepositoryService"/> <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0"> - <command name="cave/list-repositories"> - <action class="org.apache.karaf.cave.server.command.ListRepositoriesCommand"> + <command name="cave/repositories-list"> + <action class="org.apache.karaf.cave.server.command.RepositoriesListCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> </command> - <command name="cave/create-repository"> - <action class="org.apache.karaf.cave.server.command.CreateRepositoryCommand"> + <command name="cave/repository-create"> + <action class="org.apache.karaf.cave.server.command.RepositoryCreateCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> </command> - <command name="cave/remove-repository"> - <action class="org.apache.karaf.cave.server.command.RemoveRepositoryCommand"> + <command name="cave/repository-uninstall"> + <action class="org.apache.karaf.cave.server.command.RepositoryUninstallCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers> @@ -41,8 +41,8 @@ <null/> </completers> </command> - <command name="cave/update-repository"> - <action class="org.apache.karaf.cave.server.command.UpdateRepositoryCommand"> + <command name="cave/repository-update"> + <action class="org.apache.karaf.cave.server.command.RepositoryUpdateCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers> @@ -50,8 +50,8 @@ <null/> </completers> </command> - <command name="cave/proxy-repository"> - <action class="org.apache.karaf.cave.server.command.ProxyRepositoryCommand"> + <command name="cave/repository-proxy-url"> + <action class="org.apache.karaf.cave.server.command.RepositoryProxyUrlCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers> @@ -59,8 +59,8 @@ <null/> </completers> </command> - <command name="cave/populate-repository"> - <action class="org.apache.karaf.cave.server.command.PopulateRepositoryCommand"> + <command name="cave/repository-populate"> + <action class="org.apache.karaf.cave.server.command.RepositoryPopulateCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers> @@ -68,8 +68,8 @@ <null/> </completers> </command> - <command name="cave/register-repository"> - <action class="org.apache.karaf.cave.server.command.RegisterRepositoryCommand"> + <command name="cave/repository-install"> + <action class="org.apache.karaf.cave.server.command.RepositoryInstallCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers> @@ -77,8 +77,8 @@ <null/> </completers> </command> - <command name="cave/upload-artifact"> - <action class="org.apache.karaf.cave.server.command.UploadArtifactCommand"> + <command name="cave/repository-upload-artifact"> + <action class="org.apache.karaf.cave.server.command.RepositoryUploadArtifactCommand"> <property name="caveRepositoryService" ref="caveRepositoryService"/> </action> <completers>
