Author: jbonofre
Date: Wed Aug 14 21:36:46 2013
New Revision: 1514060
URL: http://svn.apache.org/r1514060
Log:
Cleanup in the Cave commands.
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/CaveRepositoryCommandSupport.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/CaveRepositoryCommandSupport.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/CaveRepositoryCommandSupport.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/CaveRepositoryCommandSupport.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/CaveRepositoryCommandSupport.java
Wed Aug 14 21:36:46 2013
@@ -16,7 +16,6 @@
*/
package org.apache.karaf.cave.server.command;
-import org.apache.karaf.cave.server.api.CaveRepository;
import org.apache.karaf.cave.server.api.CaveRepositoryService;
import org.apache.karaf.shell.console.OsgiCommandSupport;
@@ -35,12 +34,4 @@ public abstract class CaveRepositoryComm
this.caveRepositoryService = caveRepositoryService;
}
- protected CaveRepository getExistingRepository(String name) {
- CaveRepository caveRepository =
caveRepositoryService.getRepository(name);
- if (caveRepository == null) {
- throw new IllegalArgumentException("Cave repository " + name + "
does not exist");
- }
- return caveRepository;
- }
-
}
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoriesListCommand.java
Wed Aug 14 21:36:46 2013
@@ -20,9 +20,9 @@ import org.apache.felix.gogo.commands.Co
import org.apache.karaf.cave.server.api.CaveRepository;
/**
- * Command to list all Karaf Cave repositories available.
+ * Command to list all Cave repositories
*/
-@Command(scope = "cave", name = "repositories-list", description = "List all
Karaf Cave repositories")
+@Command(scope = "cave", name = "repositories-list", description = "List all
Cave repositories")
public class RepositoriesListCommand extends CaveRepositoryCommandSupport {
private static final String OUTPUT_FORMAT = "%-20s %-20s";
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryCreateCommand.java
Wed Aug 14 21:36:46 2013
@@ -22,34 +22,38 @@ import org.apache.felix.gogo.commands.Op
import org.apache.karaf.cave.server.api.CaveRepository;
/**
- * Command to create a Karaf Cave repository.
+ * Create a Cave repository.
*/
-@Command(scope = "cave", name = "repository-create", description = "Create a
new Karaf Cave repository")
+@Command(scope = "cave", name = "repository-create", description = "Create a
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)
+ @Option(name = "-l", aliases = {"--location"}, description = "Location of
the 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 = "-no", aliases = {"--no-obr-generate"}, description = "Do
not generate OBR metadata", required = false, multiValued = false)
+ boolean noOBRGenerate = false;
- @Option(name = "-nr", aliases = {"--no-register"}, description = "Do not
register the repository within the OBR service", required = false, multiValued
= false)
- boolean noRegister = false;
+ @Option(name = "-ni", aliases = {"--no-install"}, description = "Do not
install the repository in the OBR service", required = false, multiValued =
false)
+ boolean noInstall = 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 (getCaveRepositoryService().getRepository(name) != null) {
+ System.err.println("Cave repository " + name + " already exists");
+ return null;
+ }
if (location != null) {
getCaveRepositoryService().createRepository(name, location, false);
} else {
getCaveRepositoryService().createRepository(name, false);
}
- CaveRepository caveRepository = getExistingRepository(name);
- if (!noUpdate) {
+ CaveRepository caveRepository =
getCaveRepositoryService().getRepository(name);
+ if (!noOBRGenerate) {
caveRepository.scan();
}
- if (!noRegister) {
+ if (!noInstall) {
getCaveRepositoryService().install(name);
}
return null;
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryInstallCommand.java
Wed Aug 14 21:36:46 2013
@@ -21,15 +21,19 @@ import org.apache.felix.gogo.commands.Co
import org.apache.karaf.cave.server.api.CaveRepository;
/**
- * Command to install a Karaf Cave repository into the Karaf OBR service.
+ * Command to install a Cave repository into the OBR service.
*/
-@Command(scope = "cave", name = "repository-install", description = "Install
(register) a Karaf Cave repository in the Karaf OBR service")
+@Command(scope = "cave", name = "repository-install", description = "Install a
Cave repository in the OBR service")
public class RepositoryInstallCommand extends CaveRepositoryCommandSupport {
- @Argument(index = 0, name = "name", description = "Name of repository",
required = true, multiValued = 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 (getCaveRepositoryService().getRepository(name) == null) {
+ System.err.println("Cave repository " + name + " doesn't exist");
+ return null;
+ }
getCaveRepositoryService().install(name);
return null;
}
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryPopulateCommand.java
Wed Aug 14 21:36:46 2013
@@ -24,12 +24,12 @@ import org.apache.karaf.cave.server.api.
import java.net.URL;
/**
- * Command to populate a Karaf Cave repository from a given URL.
+ * Populate a 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")
+@Command(scope = "cave", name = "repository-populate", description = "Populate
a Cave repository with the artifacts available at a given URL")
public class RepositoryPopulateCommand extends CaveRepositoryCommandSupport {
- @Option(name = "-nu", aliases = { "--no-update" }, description = "Do not
update the OBR metadata", required = false, multiValued = false)
+ @Option(name = "-no", aliases = { "--no-obr-generate" }, description = "Do
not generate 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)
@@ -38,11 +38,15 @@ public class RepositoryPopulateCommand e
@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)
+ @Argument(index = 1, name = "url", description = "The source URL to use",
required = true, multiValued = false)
String url = null;
protected Object doExecute() throws Exception {
- CaveRepository repository = getExistingRepository(name);
+ if (getCaveRepositoryService().getRepository(name) == null) {
+ System.err.println("Cave repository " + name + " doesn't exist");
+ return null;
+ }
+ CaveRepository repository =
getCaveRepositoryService().getRepository(name);
repository.populate(new URL(url), filter, !noUpdate);
if (!noUpdate) {
getCaveRepositoryService().install(name);
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryProxyCommand.java
Wed Aug 14 21:36:46 2013
@@ -24,25 +24,29 @@ import org.apache.karaf.cave.server.api.
import java.net.URL;
/**
- * Add an URL to proxy in the Karaf Cave repository.
+ * Add an URL to proxy in the Cave repository.
*/
@Command(scope = "cave", name = "repository-proxy", description = "Proxy a
given URL in the Karaf Cave repository")
public class RepositoryProxyCommand extends CaveRepositoryCommandSupport {
- @Argument(index = 0, name = "name", description = "The repository proxying
the URL", required = true, multiValued = false)
+ @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 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)
+ @Option(name = "-no", aliases = { "--no-update", "--no-refresh",
"--no-obr-register" }, description = "No refresh of the OBR service", 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);
+ if (getCaveRepositoryService().getRepository(name) == null) {
+ System.err.println("Cave repository " + name + " doesn't exist");
+ return null;
+ }
+ CaveRepository repository =
getCaveRepositoryService().getRepository(name);
repository.proxy(new URL(url), filter);
if (!noUpdate) {
getCaveRepositoryService().install(name);
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUninstallCommand.java
Wed Aug 14 21:36:46 2013
@@ -20,15 +20,19 @@ import org.apache.felix.gogo.commands.Ar
import org.apache.felix.gogo.commands.Command;
/**
- * Uninstall a Karaf Cave repository from the repositories registry.
+ * Uninstall a Cave repository from the repositories registry
*/
-@Command(scope = "cave", name = "repository-uninstall", description =
"Uninstall a Karaf Cave repository from the Cave repository registry")
+@Command(scope = "cave", name = "repository-uninstall", description =
"Uninstall a Cave repository from the repositories registry")
public class RepositoryUninstallCommand extends CaveRepositoryCommandSupport {
- @Argument(index = 0, name = "name", description = "The repository name",
required = true, multiValued = 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 (getCaveRepositoryService().getRepository(name) == null) {
+ System.err.println("Cave repository " + name + " doesn't exist");
+ return null;
+ }
getCaveRepositoryService().uninstall(name);
return null;
}
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUpdateCommand.java
Wed Aug 14 21:36:46 2013
@@ -21,16 +21,20 @@ import org.apache.felix.gogo.commands.Co
import org.apache.karaf.cave.server.api.CaveRepository;
/**
- * Command to update the OBR metadata of a Karaf Cave repository
+ * Update the OBR metadata of a Cave repository
*/
-@Command(scope = "cave", name = "repository-update", description = "Update OBR
metadata of a Karaf Cave repository")
+@Command(scope = "cave", name = "repository-update", description = "Update OBR
metadata of a 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);
+ if (getCaveRepositoryService().getRepository(name) == null) {
+ System.err.println("Cave repository " + name + " doesn't exist");
+ return null;
+ }
+ CaveRepository caveRepository =
getCaveRepositoryService().getRepository(name);
caveRepository.scan();
return null;
}
Modified:
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java
URL:
http://svn.apache.org/viewvc/karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java?rev=1514060&r1=1514059&r2=1514060&view=diff
==============================================================================
---
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java
(original)
+++
karaf/cave/trunk/server/command/src/main/java/org/apache/karaf/cave/server/command/RepositoryUploadArtifactCommand.java
Wed Aug 14 21:36:46 2013
@@ -24,9 +24,9 @@ import org.apache.karaf.cave.server.api.
import java.net.URL;
/**
- * Command to upload an artifact into a Karaf Cave repository
+ * Upload an artifact into a Cave repository
*/
-@Command(scope = "cave", name = "repository-upload-artifact", description =
"Upload an artifact in a Karaf Cave repository")
+@Command(scope = "cave", name = "repository-upload-artifact", description =
"Upload an artifact in a Cave repository")
public class RepositoryUploadArtifactCommand extends
CaveRepositoryCommandSupport {
@Argument(index = 0, name = "repository", description = "The name of the
repository", required = true, multiValued = false)
@@ -35,11 +35,15 @@ public class RepositoryUploadArtifactCom
@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)
+ @Option(name = "-no", aliases = { "--no-update", "--no-refresh",
"--no-obr-register" }, description = "Do not refresh the OBR service", required
= false, multiValued = true)
boolean noUpdate = false;
public Object doExecute() throws Exception {
- CaveRepository caveRepository = getExistingRepository(name);
+ if (getCaveRepositoryService().getRepository(name) == null) {
+ System.err.println("Cave repository " + name + " doesn't exist");
+ return null;
+ }
+ CaveRepository caveRepository =
getCaveRepositoryService().getRepository(name);
caveRepository.upload(new URL(url));
if (!noUpdate) {
getCaveRepositoryService().install(name);