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 2004/07/23 08:14:35 UTC
cvs commit: incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment Deployer.java
djencks 2004/07/22 23:14:35
Modified: modules/deployment/src/java/org/apache/geronimo/deployment
Deployer.java
Log:
allow null module and null plan when directly deploying, similar to command line style
Revision Changes Path
1.22 +37 -20 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
Index: Deployer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Deployer.java 23 Jun 2004 22:44:49 -0000 1.21
+++ Deployer.java 23 Jul 2004 06:14:35 -0000 1.22
@@ -31,6 +31,7 @@
import java.util.Properties;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
@@ -64,34 +65,50 @@
}
public URI deploy(File moduleFile, File deploymentPlan) throws DeploymentException {
- URL moduleURL;
- try {
- moduleURL = moduleFile.toURL();
- } catch (MalformedURLException e) {
- throw new DeploymentException(e);
- }
ConfigurationBuilder builder = null;
XmlObject plan = null;
- for (Iterator i = builders.iterator(); i.hasNext();) {
- ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
+ if (deploymentPlan != null) {
try {
- plan = candidate.getDeploymentPlan(moduleURL);
- if (!plan.validate()) {
- throw new DeploymentException("Unable to parse plan");
- }
+ plan = getLoader().parse(deploymentPlan, null, null);
} catch (XmlException e) {
throw new DeploymentException(e);
+ } catch (IOException e) {
+ throw new DeploymentException(e);
}
- if (plan != null) {
- builder = candidate;
- break;
+ for (Iterator i = builders.iterator(); i.hasNext();) {
+ ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
+ if (candidate.canConfigure(plan)) {
+ builder = candidate;
+ break;
+ }
+ }
+ if (builder == null) {
+ throw new DeploymentException("No deployer found for this plan type: " + deploymentPlan);
+ }
+ } else if (moduleFile != null) {
+ URL moduleURL;
+ try {
+ moduleURL = moduleFile.toURL();
+ } catch (MalformedURLException e) {
+ throw new DeploymentException(e);
+ }
+ for (Iterator i = builders.iterator(); i.hasNext();) {
+ ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
+ try {
+ plan = candidate.getDeploymentPlan(moduleURL);
+ } catch (XmlException e) {
+ throw new DeploymentException(e);
+ }
+ if (plan != null) {
+ builder = candidate;
+ break;
+ }
+ }
+ if (builder == null) {
+ throw new DeploymentException("No deployer found for this module type: " + moduleFile);
}
}
- if (builder == null) {
- throw new DeploymentException("No deployer found for this module type: " + moduleFile);
- }
-
try {
File carfile = File.createTempFile("deployer", ".car");
try {