You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by pm...@apache.org on 2007/09/22 21:54:30 UTC
svn commit: r578483 - in /geronimo/server/trunk/modules:
geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/
geronimo-system/src/main/java/org/apache/geronimo/system/plugin/
Author: pmcmahan
Date: Sat Sep 22 12:54:29 2007
New Revision: 578483
URL: http://svn.apache.org/viewvc?rev=578483&view=rev
Log:
GERONIMO-3413 promote the verifyPlugin method to the PluginInstaller interface so that the
PluginInstallerGBean can be used to determine if plugins are installable.
Modified:
geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=578483&r1=578482&r2=578483&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java (original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java Sat Sep 22 12:54:29 2007
@@ -26,7 +26,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -56,6 +55,7 @@
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.NoSuchStoreException;
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
import org.apache.geronimo.system.jmx.KernelDelegate;
import org.apache.geronimo.system.plugin.DownloadPoller;
import org.apache.geronimo.system.plugin.DownloadResults;
@@ -166,6 +166,15 @@
PluginInstaller installer = getPluginInstaller();
try {
return installer.listPlugins(mavenRepository, username, password);
+ } finally {
+ kernel.getProxyManager().destroyProxy(installer);
+ }
+ }
+
+ public void validatePlugin(PluginType plugin) throws MissingDependencyException {
+ PluginInstaller installer = getPluginInstaller();
+ try {
+ installer.validatePlugin(plugin);
} finally {
kernel.getProxyManager().destroyProxy(installer);
}
Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java?rev=578483&r1=578482&r2=578483&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstaller.java Sat Sep 22 12:54:29 2007
@@ -22,6 +22,7 @@
import java.util.Map;
import javax.security.auth.login.FailedLoginException;
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.NoSuchStoreException;
import org.apache.geronimo.system.plugin.model.PluginListType;
@@ -157,6 +158,15 @@
* @param key Identifies the operation to check on
*/
public DownloadResults checkOnInstall(Object key);
+
+ /**
+ * Ensures that a plugin artifact is installable.
+ *
+ * @param plugin plugin artifact to check
+ * @throws org.apache.geronimo.kernel.repository.MissingDependencyException
+ * if plugin requires a dependency that is not present
+ */
+ public void validatePlugin(PluginType plugin) throws MissingDependencyException;
PluginListType createPluginListForRepositories(ConfigurationManager mgr, String repo) throws NoSuchStoreException;
}
Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=578483&r1=578482&r2=578483&view=diff
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Sat Sep 22 12:54:29 2007
@@ -267,8 +267,8 @@
Artifact artifact = toArtifact(instance.getModuleId());
File dir = writeableRepo.getLocation(artifact);
if (dir == null) {
- log.error(artifact + " is not installed!");
- throw new IllegalArgumentException(artifact + " is not installed!");
+ log.error(artifact + " is not installed.");
+ throw new IllegalArgumentException(artifact + " is not installed.");
}
if (!dir.isDirectory()) { // must be a packed (JAR-formatted) plugin
try {
@@ -318,8 +318,8 @@
} else {
File meta = new File(dir, "META-INF");
if (!meta.isDirectory() || !meta.canRead()) {
- log.error(artifact + " is not a plugin!");
- throw new IllegalArgumentException(artifact + " is not a plugin!");
+ log.error(artifact + " is not a plugin.");
+ throw new IllegalArgumentException(artifact + " is not a plugin.");
}
File xml = new File(meta, "geronimo-plugin.xml");
FileOutputStream fos = null;
@@ -485,6 +485,7 @@
}
}
} catch (Exception e) {
+ log.error("Unable to install plugin. ", e);
poller.setFailure(e);
} finally {
poller.setFinished();
@@ -629,7 +630,7 @@
* @throws org.apache.geronimo.kernel.repository.MissingDependencyException
* if plugin requires a dependency that is not present
*/
- private void validatePlugin(PluginType plugin) throws MissingDependencyException {
+ 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());
}
@@ -647,9 +648,9 @@
}
}
if (!upgrade) {
- log.error("Configuration " + artifact + " is already running!");
+ log.info("Configuration " + artifact + " is already running.");
throw new IllegalArgumentException(
- "Configuration " + artifact + " is already running!");
+ "Configuration " + artifact + " is already running.");
}
}
}
@@ -657,19 +658,19 @@
List<PrerequisiteType> prereqs = metadata.getPrerequisite();
for (PrerequisiteType prereq : prereqs) {
if (artifactResolver.queryArtifacts(toArtifact(prereq.getId())).length == 0) {
- log.error("Required configuration '" + prereq.getId() + "' is not installed.");
+ log.info("Required configuration '" + prereq.getId() + "' is not installed.");
throw new MissingDependencyException(
"Required configuration '" + prereq.getId() + "' is not installed.");
}
}
// 3. Check that we meet the Geronimo, JVM versions
if (metadata.getGeronimoVersion().size() > 0 && !checkGeronimoVersions(metadata.getGeronimoVersion())) {
- log.error("Cannot install plugin " + metadata.getModuleId() + " on Geronimo " + serverInfo.getVersion());
+ log.info("Cannot install plugin " + metadata.getModuleId() + " on Geronimo " + serverInfo.getVersion());
throw new MissingDependencyException(
"Cannot install plugin " + metadata.getModuleId() + " on Geronimo " + serverInfo.getVersion());
}
if (metadata.getJvmVersion().size() > 0 && !checkJVMVersions(metadata.getJvmVersion())) {
- log.error("Cannot install plugin " + metadata.getModuleId() + " on JVM " + System.getProperty(
+ log.info("Cannot install plugin " + metadata.getModuleId() + " on JVM " + System.getProperty(
"java.version"));
throw new MissingDependencyException(
"Cannot install plugin " + metadata.getModuleId() + " on JVM " + System.getProperty(
@@ -1422,8 +1423,8 @@
boolean match = false;
for (String jvmVersion : jvmVersions) {
if (jvmVersion == null || jvmVersion.equals("")) {
- log.error("jvm-version should not be empty!");
- throw new IllegalStateException("jvm-version should not be empty!");
+ log.error("jvm-version should not be empty.");
+ throw new IllegalStateException("jvm-version should not be empty.");
}
if (version.startsWith(jvmVersion)) {
match = true;
@@ -1466,8 +1467,8 @@
String version = serverInfo.getVersion();
if ((gerVersion == null) || gerVersion.equals("")) {
- log.error("geronimo-version cannot be empty!");
- throw new IllegalStateException("geronimo-version cannot be empty!");
+ log.error("geronimo-version cannot be empty.");
+ throw new IllegalStateException("geronimo-version cannot be empty.");
} else if (gerVersion.equals(version)) {
return true;
} else {