You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/01/17 08:54:24 UTC
svn commit: r612745 - in /geronimo/server/trunk:
framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/
framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/
framework/modules/geronimo-...
Author: djencks
Date: Wed Jan 16 23:54:17 2008
New Revision: 612745
URL: http://svn.apache.org/viewvc?rev=612745&view=rev
Log:
GERONIMO-3754 Add name/pw to sourceRepositoryFactory. Fix some problems with patch re trying to install already-installed plugins
Modified:
geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/MissingDependencyException.java
geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadPoller.java
geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadResults.java
geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/RemoteSourceRepository.java
geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java
geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java
Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java Wed Jan 16 23:54:17 2008
@@ -57,8 +57,8 @@
DownloadResults results = showProgress(consoleReader, mgr, key);
int time = (int)(System.currentTimeMillis() - start) / 1000;
printResults(consoleReader, results, time);
- if(results.isFinished() && !results.isFailed() && results.getInstalledConfigIDs().length == 1) {
- Artifact target = results.getInstalledConfigIDs()[0];
+ if(results.isFinished() && !results.isFailed() && results.getInstalledConfigIDs().size() == 1) {
+ Artifact target = results.getInstalledConfigIDs().get(0);
consoleReader.printString(DeployUtils.reformat("Now starting "+target+"...", 4, 72));
consoleReader.flushConsole();
new CommandStart().execute(consoleReader, connection, new BaseCommandArgs(new String[]{target.toString()}));
@@ -107,13 +107,11 @@
if (!results.isFailed()) {
DeployUtils.println("**** Installation Complete!", 0, consoleReader);
- for (int i = 0; i < results.getDependenciesPresent().length; i++) {
- Artifact uri = results.getDependenciesPresent()[i];
+ for (Artifact uri: results.getDependenciesPresent()) {
DeployUtils.println("Used existing: " + uri, 0, consoleReader);
}
- for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
- Artifact uri = results.getDependenciesInstalled()[i];
+ for (Artifact uri: results.getDependenciesInstalled()) {
DeployUtils.println("Installed new: " + uri, 0, consoleReader);
}
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/MissingDependencyException.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/MissingDependencyException.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/MissingDependencyException.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/MissingDependencyException.java Wed Jan 16 23:54:17 2008
@@ -18,6 +18,7 @@
package org.apache.geronimo.kernel.repository;
import java.util.Stack;
+import java.io.Serializable;
import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -25,6 +26,7 @@
* @version $Rev$ $Date$
*/
public class MissingDependencyException extends Exception {
+ private static final long serialVersionUID = -2557777157677213124L;
private Artifact query;
private Stack<Artifact> stack;
Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadPoller.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadPoller.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadPoller.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadPoller.java Wed Jan 16 23:54:17 2008
@@ -17,6 +17,7 @@
package org.apache.geronimo.system.plugin;
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
/**
* An interface for callers who want to monitor the progress of an installation.
@@ -49,6 +50,12 @@
* was installed.
*/
void addRestartedConfigID(Artifact target);
+
+ /**
+ * Provides details on why a plugin was not installed.
+ * @param e MissingDependencyException containing info on
+ */
+ void addSkippedConfigID(MissingDependencyException e);
/**
* Notes that the current install operation found a dependency, and that
Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadResults.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadResults.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadResults.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/DownloadResults.java Wed Jan 16 23:54:17 2008
@@ -19,7 +19,10 @@
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
+import java.util.Collections;
+
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
/**
* Provides the results of a configuration download operation. This is updated
@@ -33,6 +36,7 @@
private List<Artifact> installedConfigIDs = new ArrayList<Artifact>();
private List<Artifact> dependenciesPresent = new ArrayList<Artifact>();
private List<Artifact> dependenciesInstalled = new ArrayList<Artifact>();
+ private List<MissingDependencyException> skippedPlugins = new ArrayList<MissingDependencyException>();
private String currentFile;
private String currentMessage;
private int currentFileProgress = -1;
@@ -68,6 +72,10 @@
restartedConfigIDs.add(target);
}
+ public void addSkippedConfigID(MissingDependencyException e) {
+ skippedPlugins.add(e);
+ }
+
public synchronized void addDependencyPresent(Artifact dep) {
dependenciesPresent.add(dep);
}
@@ -130,32 +138,36 @@
* request passed previously downloaded configurations on the command
* line and the caller doesn't know what the Config IDs are.
*/
- public Artifact[] getInstalledConfigIDs() {
- return installedConfigIDs.toArray(new Artifact[installedConfigIDs.size()]);
+ public List<Artifact> getInstalledConfigIDs() {
+ return Collections.unmodifiableList(installedConfigIDs);
+ }
+
+ public List<Artifact> getRemovedConfigIDs() {
+ return Collections.unmodifiableList(removedConfigIDs);
}
- public Artifact[] getRemovedConfigIDs() {
- return (Artifact[]) removedConfigIDs.toArray(new Artifact[installedConfigIDs.size()]);
+ public List<Artifact> getRestartedConfigIDs() {
+ return Collections.unmodifiableList(restartedConfigIDs);
}
- public Artifact[] getRestartedConfigIDs() {
- return (Artifact[]) restartedConfigIDs.toArray(new Artifact[installedConfigIDs.size()]);
+ public List<MissingDependencyException> getSkippedPlugins() {
+ return Collections.unmodifiableList(skippedPlugins);
}
/**
* Gets the dependencies that we've needed but they're already present in
* the local server so no installation was necessary.
*/
- public Artifact[] getDependenciesPresent() {
- return (Artifact[]) dependenciesPresent.toArray(new Artifact[dependenciesPresent.size()]);
+ public List<Artifact> getDependenciesPresent() {
+ return Collections.unmodifiableList(dependenciesPresent);
}
/**
* Gets the dependencies that we've successfully downloaded and installed
* into the local server environment.
*/
- public Artifact[] getDependenciesInstalled() {
- return (Artifact[]) dependenciesInstalled.toArray(new Artifact[dependenciesInstalled.size()]);
+ public List<Artifact> getDependenciesInstalled() {
+ return Collections.unmodifiableList(dependenciesInstalled);
}
/**
Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Wed Jan 16 23:54:17 2008
@@ -503,7 +503,7 @@
*/
public PluginListType listPlugins(URL mavenRepository, String username, String password) throws IOException, FailedLoginException {
try {
- SourceRepository repo = SourceRepositoryFactory.getSourceRepository(mavenRepository.toString());
+ SourceRepository repo = SourceRepositoryFactory.getSourceRepository(mavenRepository.toString(), username, password);
return repo.getPluginList();
} catch (IllegalStateException e) {
return null;
@@ -560,19 +560,25 @@
try {
Map<Artifact, PluginType> metaMap = new HashMap<Artifact, PluginType>();
// Step 1: validate everything
+ List<PluginType> toInstall = new ArrayList<PluginType>();
for (PluginType metadata : pluginsToInstall.getPlugin()) {
- validatePlugin(metadata);
- verifyPrerequisites(metadata);
-
- PluginArtifactType instance = metadata.getPluginArtifact().get(0);
+ try {
+ validatePlugin(metadata);
+ verifyPrerequisites(metadata);
- if (instance.getModuleId() != null) {
- metaMap.put(toArtifact(instance.getModuleId()), metadata);
+ PluginArtifactType instance = metadata.getPluginArtifact().get(0);
+
+ if (instance.getModuleId() != null) {
+ metaMap.put(toArtifact(instance.getModuleId()), metadata);
+ }
+ toInstall.add(metadata);
+ } catch (MissingDependencyException e) {
+ //ignore
}
}
// Step 2: everything is valid, do the installation
- for (PluginType metadata : pluginsToInstall.getPlugin()) {
+ for (PluginType metadata : toInstall) {
// 2. Unload obsoleted configurations
PluginArtifactType instance = metadata.getPluginArtifact().get(0);
List<Artifact> obsoletes = new ArrayList<Artifact>();
@@ -804,13 +810,13 @@
*/
public void validatePlugin(PluginType plugin) throws MissingDependencyException {
if (plugin.getPluginArtifact().size() != 1) {
- throw new IllegalArgumentException("A plugin configuration must include one plugin artifact, not " + plugin.getPluginArtifact().size());
+ throw new MissingDependencyException("A plugin configuration must include one plugin artifact, not " + plugin.getPluginArtifact().size(), null, (Stack<Artifact>) null);
}
PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
- // 1. Check that it's not already running
+ // 1. Check that it's not already installed
if (metadata.getModuleId() != null) { // that is, it's a real configuration not a plugin list
Artifact artifact = toArtifact(metadata.getModuleId());
- if (configManager.isRunning(artifact)) {
+ if (configManager.isInstalled(artifact)) {
boolean upgrade = false;
for (ArtifactType obsolete : metadata.getObsoletes()) {
Artifact test = toArtifact(obsolete);
@@ -820,9 +826,9 @@
}
}
if (!upgrade) {
- log.info("Configuration " + artifact + " is already running.");
- throw new IllegalArgumentException(
- "Configuration " + artifact + " is already running.");
+ log.info("Configuration " + artifact + " is already installed.");
+ throw new MissingDependencyException(
+ "Configuration " + artifact + " is already installed.", toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
}
}
}
Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/RemoteSourceRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/RemoteSourceRepository.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/RemoteSourceRepository.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/RemoteSourceRepository.java Wed Jan 16 23:54:17 2008
@@ -60,25 +60,30 @@
private String username = null;
private String password = null;
- public RemoteSourceRepository(URI base) {
+ public RemoteSourceRepository(URI base, String username, String password) {
if (!base.getPath().endsWith("/")) {
throw new IllegalArgumentException("base uri must end with '/', not " + base);
}
this.base = base;
+ this.username = username;
+ this.password = password;
}
public PluginListType getPluginList() {
try {
URL uri = base.resolve("geronimo-plugins.xml").toURL();
- InputStream in = uri.openStream();
- try {
- return PluginXmlUtil.loadPluginList(in);
- } finally {
- in.close();
+ InputStream in = openStream(null, uri);
+ if (in != null) {
+ try {
+ return PluginXmlUtil.loadPluginList(in);
+ } finally {
+ in.close();
+ }
}
} catch (Exception e) {
- return null;
+ // TODO: log it?
}
+ return null;
}
public OpenResult open(Artifact artifact, FileWriteMonitor monitor) throws IOException, FailedLoginException {
Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/SourceRepositoryFactory.java Wed Jan 16 23:54:17 2008
@@ -22,7 +22,6 @@
import java.io.File;
import java.net.URI;
-import java.net.URISyntaxException;
/**
* @version $Rev$ $Date$
@@ -32,6 +31,10 @@
}
public static SourceRepository getSourceRepository(String repo) {
+ return getSourceRepository(repo, null, null);
+ }
+
+ public static SourceRepository getSourceRepository(String repo, String user, String pass) {
if (repo == null) {
throw new IllegalArgumentException("No repo supplied");
}
@@ -41,7 +44,7 @@
}
String scheme = repoURI.getScheme();
if (scheme.startsWith("http")) {
- return new RemoteSourceRepository(repoURI);
+ return new RemoteSourceRepository(repoURI, user, pass);
} else if ("file".equals(scheme)) {
return new LocalSourceRepository(new File(repoURI));
}
Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java?rev=612745&r1=612744&r2=612745&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java (original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java Wed Jan 16 23:54:17 2008
@@ -18,16 +18,16 @@
import java.io.IOException;
import java.io.Serializable;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
+
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+
import org.apache.geronimo.console.MultiPageModel;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.system.plugin.DownloadResults;
@@ -38,7 +38,6 @@
* @version $Rev$ $Date$
*/
public class DownloadStatusHandler extends BaseImportExportHandler {
- private final static Log log = LogFactory.getLog(DownloadStatusHandler.class);
public DownloadStatusHandler() {
super(DOWNLOAD_STATUS_MODE, "/WEB-INF/view/car/downloadStatus.jsp");
@@ -72,13 +71,11 @@
if(results.isFailed()) {
throw new PortletException("Unable to install configuration", results.getFailure());
}
- List dependencies = new ArrayList();
- for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
- Artifact uri = results.getDependenciesInstalled()[i];
+ List<InstallResults> dependencies = new ArrayList<InstallResults>();
+ for (Artifact uri: results.getDependenciesInstalled()) {
dependencies.add(new InstallResults(uri.toString(), "installed"));
}
- for (int i = 0; i < results.getDependenciesPresent().length; i++) {
- Artifact uri = results.getDependenciesPresent()[i];
+ for (Artifact uri: results.getDependenciesPresent()) {
dependencies.add(new InstallResults(uri.toString(), "already present"));
}
request.getPortletSession(true).setAttribute("car.install.results", dependencies);
@@ -91,6 +88,7 @@
}
public static class InstallResults implements Serializable {
+ private static final long serialVersionUID = -3745382506085182610L;
private String name;
private String action;