You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/12/06 14:32:59 UTC
svn commit: r354426 - in /geronimo/trunk: applications/magicGball/
applications/remote-deploy/src/java/org/apache/geronimo/deployment/remote/
modules/assembly/ modules/deploy-jsr88/
modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/fa...
Author: ammulder
Date: Tue Dec 6 05:32:43 2005
New Revision: 354426
URL: http://svn.apache.org/viewcvs?rev=354426&view=rev
Log:
Remote deployment works (GERONIMO-358)
JSR-88 deployer (& geronimo-deployment-plugin) URLs now look like
deployer:geronimo:jmx://host:port (or deployer:geronimo:jmx if
you want the default localhost:1099)
deploy:waitForStarted and deploy:stopRemoteServer don't take a
deployer URL any more, just a JMX connect URL (well, the part
starting with jmx:)
Maven scripts updated accordingly (plugin rebuild required)
Added:
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java
Modified:
geronimo/trunk/applications/magicGball/maven.xml
geronimo/trunk/applications/remote-deploy/src/java/org/apache/geronimo/deployment/remote/FileUploadServlet.java
geronimo/trunk/modules/assembly/maven.xml
geronimo/trunk/modules/deploy-jsr88/project.xml
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
geronimo/trunk/modules/hot-deploy/src/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java
geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java
geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java
Modified: geronimo/trunk/applications/magicGball/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/magicGball/maven.xml?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/applications/magicGball/maven.xml (original)
+++ geronimo/trunk/applications/magicGball/maven.xml Tue Dec 6 05:32:43 2005
@@ -96,7 +96,7 @@
<ant:echo message="Waiting for server at: ${maven.build.dir}/geronimo-${geronimo_version}"/>
<u:sleep millis="60000"/>
<deploy:waitForStarted
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="jmx:rmi://localhost/jndi/rmi:/JMXConnector"
username="system"
password="manager"
maxtries="125"
@@ -106,7 +106,7 @@
</goal>
<goal name="deployAppSSL" prereqs="ear">
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
module="${basedir}/target/magicGball-${geronimo_version}.ear"
@@ -114,21 +114,21 @@
</goal>
<goal name="startAppSSL">
<deploy:start
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
id="org/apache/geronimo/MagicGBallCorba"/>
</goal>
<goal name="stopAppSSL">
<deploy:stop
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
id="org/apache/geronimo/MagicGBallCorba"/>
</goal>
<goal name="undeployAppSSL">
<deploy:undeploy
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
id="org/apache/geronimo/MagicGBallCorba"/>
@@ -152,7 +152,7 @@
<goal name="deployAppNoSec" prereqs="ear">
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
module="${basedir}/target/magicGball-${geronimo_version}.ear"
@@ -160,21 +160,21 @@
</goal>
<goal name="startAppNoSec">
<deploy:start
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
id="org/apache/geronimo/MagicGBallCorbaNoSec"/>
</goal>
<goal name="stopAppNoSec">
<deploy:stop
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
id="org/apache/geronimo/MagicGBallCorbaNoSec"/>
</goal>
<goal name="undeployAppNoSec">
<deploy:undeploy
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
id="org/apache/geronimo/MagicGBallCorbaNoSec"/>
Modified: geronimo/trunk/applications/remote-deploy/src/java/org/apache/geronimo/deployment/remote/FileUploadServlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/remote-deploy/src/java/org/apache/geronimo/deployment/remote/FileUploadServlet.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/applications/remote-deploy/src/java/org/apache/geronimo/deployment/remote/FileUploadServlet.java (original)
+++ geronimo/trunk/applications/remote-deploy/src/java/org/apache/geronimo/deployment/remote/FileUploadServlet.java Tue Dec 6 05:32:43 2005
@@ -76,6 +76,7 @@
for (int i = 0; i < names.length; i++) {
out.writeUTF(names[i]);
}
+ out.flush();
out.close();
}
@@ -88,12 +89,15 @@
while((read = in.read(buf, 0, Math.min(buf.length, length - total))) > -1) {
out.write(buf, 0, read);
total += read;
+ if(total == length) {
+ break;
+ }
}
} finally {
try {out.flush();} catch (IOException e) {}
out.close();
}
- if(total != read) {
+ if(total != length) {
throw new IOException("Unable to read entire upload file ("+total+"b expecting "+length+"b)");
}
}
Modified: geronimo/trunk/modules/assembly/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/maven.xml?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/maven.xml (original)
+++ geronimo/trunk/modules/assembly/maven.xml Tue Dec 6 05:32:43 2005
@@ -477,7 +477,7 @@
configs="geronimo/security/${pom.currentVersion}/car geronimo/runtime-deployer/${pom.currentVersion}/car geronimo/jetty-runtime-deployer/${pom.currentVersion}/car geronimo/tomcat-runtime-deployer/${pom.currentVersion}/car"/>
<ant:echo message="Waiting for server at: ${geronimo.assembly.dir}"/>
<deploy:waitForStarted
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
maxtries="125"
username="system"
password="manager"
@@ -487,13 +487,13 @@
<echo message="server has started"/>
<!-- <deploy:distribute-->
- <!-- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"-->
+ <!-- uri="deployer:geronimo:jmx"-->
<!-- username="system"-->
<!-- password="manager"-->
<!-- plan="${basedir}/target/plan/j2ee-jetty-plan.xml"-->
<!-- />-->
<!-- <deploy:distribute-->
- <!-- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"-->
+ <!-- uri="deployer:geronimo:jmx"-->
<!-- username="system"-->
<!-- password="manager"-->
<!-- plan="${basedir}/target/plan/j2ee-tomcat-plan.xml"-->
@@ -501,20 +501,20 @@
<!-- building server corba configuration-->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/j2ee-server-corba-plan.xml"
/>
<!-- building app client corba configuration-->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/j2ee-client-corba-plan.xml"
/>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/j2ee-client-security-plan.xml"
@@ -523,7 +523,7 @@
<!-- building tranql connector default database configuration-->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/default-database-plan.xml"
@@ -532,7 +532,7 @@
<!-- building system database configuration-->
<ant:echo>Building system database configuration</ant:echo>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/system-database-plan.xml"
@@ -540,7 +540,7 @@
<!-- building system activemq configuration-->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/system-activemq-plan.xml"
@@ -548,7 +548,7 @@
<!-- building system jms configuration-->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/system-jms-plan.xml"
@@ -557,7 +557,7 @@
<!-- build the spring runtime configuration -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/spring-runtime-plan.xml"
@@ -565,7 +565,7 @@
<!-- build the spring deployer configuration -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/spring-deployer-plan.xml"
@@ -574,7 +574,7 @@
<!-- build the J2EEServer secure configuration -->
<!--
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/j2ee-secure-plan.xml"
@@ -583,7 +583,7 @@
<!-- build the J2EE client configuration -->
<!-- <deploy:distribute-->
- <!-- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"-->
+ <!-- uri="deployer:geronimo:jmx"-->
<!-- username="system"-->
<!-- password="manager"-->
<!-- plan="${basedir}/target/plan/j2ee-client-plan.xml"-->
@@ -591,14 +591,14 @@
<!-- build the directory server configuration -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/directory-server-plan.xml"/>
<!-- build the Demo configuration -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
module="${maven.repo.local}/geronimo/wars/geronimo-demo-${pom.currentVersion}.war"
@@ -607,13 +607,13 @@
<!-- build the Welcome site configuration -->
<ant:echo>Building welcome website configuration</ant:echo>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/welcome-jetty-plan.xml"
module="${maven.repo.local}/geronimo/wars/geronimo-welcome-${pom.currentVersion}.war"/>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/welcome-tomcat-plan.xml"
@@ -621,13 +621,13 @@
<!-- Management console -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/webconsole-jetty-plan.xml"
module="${maven.repo.local}/geronimo/ears/geronimo-console-${pom.currentVersion}.ear"/>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/webconsole-tomcat-plan.xml"
@@ -635,34 +635,34 @@
<!-- Debug Tool -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
module="${maven.repo.local}/geronimo/wars/geronimo-jmxdebug-${pom.currentVersion}.war"/>
<!-- Remote Deploy -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
module="${maven.repo.local}/geronimo/wars/geronimo-remote-deploy-${pom.currentVersion}.war"/>
<!-- UDDI -->
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/uddi-server-jetty-plan.xml"
module="${maven.repo.local}/geronimo/wars/geronimo-uddi-server-${pom.currentVersion}.war"/>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/uddi-server-tomcat-plan.xml"
module="${maven.repo.local}/geronimo/wars/geronimo-uddi-server-${pom.currentVersion}.war"/>
<deploy:distribute
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="deployer:geronimo:jmx"
username="system"
password="manager"
plan="${basedir}/target/plan/j2ee-hot-deploy-plan.xml" />
@@ -671,7 +671,7 @@
<!-- <attainGoal name="init-database"/>-->
<deploy:stopRemoteServer
- uri="deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+ uri="jmx:rmi://localhost/jndi/rmi:/JMXConnector"
username="system"
password="manager"/>
<echo message="server has stopped"/>
Modified: geronimo/trunk/modules/deploy-jsr88/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/project.xml?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/project.xml (original)
+++ geronimo/trunk/modules/deploy-jsr88/project.xml Tue Dec 6 05:32:43 2005
@@ -96,6 +96,12 @@
<version>${pom.currentVersion}</version>
</dependency>
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-util</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
<!-- only until we move out various DConfigBean trees -->
<dependency>
<groupId>geronimo</groupId>
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java Tue Dec 6 05:32:43 2005
@@ -17,9 +17,11 @@
package org.apache.geronimo.deployment.plugin.factories;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.geronimo.deployment.plugin.DisconnectedDeploymentManager;
+import org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
+import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
+import org.apache.geronimo.kernel.KernelRegistry;
+
import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
@@ -27,12 +29,9 @@
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-
-import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
-import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
-import org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager;
-import org.apache.geronimo.deployment.plugin.DisconnectedDeploymentManager;
-import org.apache.geronimo.kernel.KernelRegistry;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
/**
* Implementation of JSR88 DeploymentFactory.
@@ -45,6 +44,7 @@
*/
public class DeploymentFactoryImpl implements DeploymentFactory {
public static final String URI_PREFIX = "deployer:geronimo:";
+ private static final int DEFAULT_PORT = 1099;
public String getDisplayName() {
return "Apache Geronimo";
@@ -55,7 +55,50 @@
}
public boolean handlesURI(String uri) {
- return uri.startsWith(URI_PREFIX);
+ return parseURI(uri) != null;
+ }
+
+ private ConnectParams parseURI(String uri) {
+ uri = uri.trim();
+ if(!uri.startsWith(URI_PREFIX)) {
+ return null;
+ }
+ uri = uri.substring(URI_PREFIX.length());
+ int pos = uri.indexOf(":");
+ String protocol = pos == -1 ? uri : uri.substring(0, pos);
+ uri = pos == -1 ? "" : uri.substring(pos+1);
+ if(protocol.equals("jmx")) {
+ if(!uri.startsWith("//")) {
+ return new ConnectParams(protocol, "localhost", DEFAULT_PORT);
+ }
+ uri = uri.substring(2);
+ pos = uri.indexOf(':');
+ if(pos == -1) {
+ return new ConnectParams(protocol, uri.equals("") ? "localhost" : uri, DEFAULT_PORT);
+ }
+ if(uri.indexOf('/', pos+1) > -1) {
+ return null;
+ }
+ if(uri.indexOf(':', pos+1) > -1) {
+ return null;
+ }
+ String host = uri.substring(0, pos);
+ String port = uri.substring(pos+1);
+ try {
+ return new ConnectParams(protocol, host.equals("") ? "localhost" : host, Integer.parseInt(port));
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ } else if(protocol.equals("inVM")) {
+ if(uri.startsWith("//")) {
+ String kernel = uri.substring(2);
+ return new ConnectParams(protocol, kernel, -1);
+ } else {
+ return new ConnectParams(protocol,
+ KernelRegistry.getSingleKernel() == null ? null : KernelRegistry.getSingleKernel().getKernelName(),
+ -1);
+ }
+ } else return null;
}
public DeploymentManager getDisconnectedDeploymentManager(String uri) throws DeploymentManagerCreationException {
@@ -67,31 +110,31 @@
}
public DeploymentManager getDeploymentManager(String uri, String username, String password) throws DeploymentManagerCreationException {
- if (!handlesURI(uri)) {
+ ConnectParams params = parseURI(uri);
+ if (params == null) {
return null;
}
try {
- uri = uri.substring(URI_PREFIX.length());
- if (uri.startsWith("jmx")) {
-
+ if (params.getProtocol().equals("jmx")) {
Map environment = new HashMap();
String[] credentials = new String[]{username, password};
environment.put(JMXConnector.CREDENTIALS, credentials);
-
try {
- JMXServiceURL address = new JMXServiceURL("service:" + uri);
+ JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+params.getHost()+":"+params.getPort()+"/JMXConnector");
JMXConnector jmxConnector = JMXConnectorFactory.connect(address, environment);
- JMXDeploymentManager manager = new RemoteDeploymentManager(jmxConnector);
+ RemoteDeploymentManager manager = new RemoteDeploymentManager(jmxConnector, params.getHost());
+ if(!manager.isSameMachine()) {
+ manager.setAuthentication(username, password);
+ }
return manager;
} catch (IOException e) {
throw (DeploymentManagerCreationException)new DeploymentManagerCreationException(e.getMessage()).initCause(e);
} catch (SecurityException e) {
throw (AuthenticationFailedException) new AuthenticationFailedException("Invalid login.").initCause(e);
}
- } else if(uri.equals("inVM")) { //todo: allow specifying a kernel by name
- JMXDeploymentManager manager = new LocalDeploymentManager(KernelRegistry.getSingleKernel());
- return manager;
+ } else if(params.getProtocol().equals("inVM")) {
+ return new LocalDeploymentManager(KernelRegistry.getKernel(params.getHost()));
} else {
throw new DeploymentManagerCreationException("Invalid URI: " + uri);
}
@@ -106,8 +149,40 @@
}
}
- static {
+ static {
DeploymentFactoryManager manager = DeploymentFactoryManager.getInstance();
manager.registerDeploymentFactory(new DeploymentFactoryImpl());
+ }
+
+ private final static class ConnectParams {
+ private String protocol;
+ private String host;
+ private int port;
+
+ public ConnectParams(String protocol, String host, int port) {
+ this.protocol = protocol;
+ this.host = host;
+ this.port = port;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public String toString() {
+ return protocol+" / "+host+" / "+port;
+ }
+ }
+
+ public static void main(String[] args) {
+ System.out.println("Parsed: "+new DeploymentFactoryImpl().parseURI("deployer:geronimo:inVM"));
}
}
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java Tue Dec 6 05:32:43 2005
@@ -16,9 +16,24 @@
*/
package org.apache.geronimo.deployment.plugin.jmx;
-import java.io.File;
-import java.io.InputStream;
-import java.util.*;
+import org.apache.geronimo.connector.deployment.RARConfigurer;
+import org.apache.geronimo.deployment.plugin.TargetImpl;
+import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.deployment.plugin.local.CommandSupport;
+import org.apache.geronimo.deployment.plugin.local.DistributeCommand;
+import org.apache.geronimo.deployment.plugin.local.RedeployCommand;
+import org.apache.geronimo.deployment.plugin.local.StartCommand;
+import org.apache.geronimo.deployment.plugin.local.StopCommand;
+import org.apache.geronimo.deployment.plugin.local.UndeployCommand;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.web.deployment.WARConfigurer;
+
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.shared.DConfigBeanVersionType;
import javax.enterprise.deploy.shared.ModuleType;
@@ -30,36 +45,32 @@
import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
import javax.enterprise.deploy.spi.exceptions.TargetException;
import javax.enterprise.deploy.spi.status.ProgressObject;
-import javax.management.ObjectName;
import javax.management.MalformedObjectNameException;
-import org.apache.geronimo.deployment.plugin.TargetImpl;
-import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
-import org.apache.geronimo.deployment.plugin.local.*;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.config.NoSuchStoreException;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.connector.deployment.RARConfigurer;
-import org.apache.geronimo.web.deployment.WARConfigurer;
+import javax.management.ObjectName;
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
/**
* @version $Rev$ $Date$
*/
public abstract class JMXDeploymentManager implements DeploymentManager {
- private Kernel kernel;
+ protected Kernel kernel;
private ConfigurationManager configurationManager;
private CommandContext commandContext;
protected void initialize(Kernel kernel) {
this.kernel = kernel;
configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
- commandContext = new CommandContext();
- commandContext.setLogErrors(true);
- commandContext.setVerbose(true);
+ commandContext = new CommandContext(true, true, null, null);
+ }
+
+ public void setAuthentication(String username, String password) {
+ commandContext.setUsername(username);
+ commandContext.setPassword(password);
}
public void release() {
@@ -125,7 +136,6 @@
if (kernel == null) {
throw new IllegalStateException("Disconnected");
}
-
try {
ArrayList result = new ArrayList();
for (int i = 0; i < targetList.length; i++) {
@@ -164,7 +174,7 @@
if (kernel == null) {
throw new IllegalStateException("Disconnected");
}
- DistributeCommand command = new DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan);
+ DistributeCommand command = createDistributeCommand(targetList, moduleArchive, deploymentPlan);
command.setCommandContext(commandContext);
new Thread(command).start();
return command;
@@ -174,7 +184,7 @@
if (kernel == null) {
throw new IllegalStateException("Disconnected");
}
- DistributeCommand command = new DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan);
+ DistributeCommand command = createDistributeCommand(targetList, moduleArchive, deploymentPlan);
command.setCommandContext(commandContext);
new Thread(command).start();
return command;
@@ -218,7 +228,7 @@
if (kernel == null) {
throw new IllegalStateException("Disconnected");
}
- RedeployCommand command = new RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ RedeployCommand command = createRedeployCommand(moduleIDList, moduleArchive, deploymentPlan);
command.setCommandContext(commandContext);
new Thread(command).start();
return command;
@@ -228,7 +238,7 @@
if (kernel == null) {
throw new IllegalStateException("Disconnected");
}
- RedeployCommand command = new RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ RedeployCommand command = createRedeployCommand(moduleIDList, moduleArchive, deploymentPlan);
command.setCommandContext(commandContext);
new Thread(command).start();
return command;
@@ -289,20 +299,38 @@
throw new InvalidModuleException("Not supported");
}
- public void setCommandContext(CommandContext commandContext) {
- this.commandContext = commandContext;
+ protected DistributeCommand createDistributeCommand(Target[] targetList, File moduleArchive, File deploymentPlan) {
+ return new DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan);
+ }
+
+ protected DistributeCommand createDistributeCommand(Target[] targetList, InputStream moduleArchive, InputStream deploymentPlan) {
+ return new DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan);
+ }
+
+ protected RedeployCommand createRedeployCommand(TargetModuleID[] moduleIDList, File moduleArchive, File deploymentPlan) {
+ return new RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ }
+
+ protected RedeployCommand createRedeployCommand(TargetModuleID[] moduleIDList, InputStream moduleArchive, InputStream deploymentPlan) {
+ return new RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ }
+
+ public void setLogConfiguration(boolean shouldLog, boolean verboseStatus) {
+ commandContext.setLogErrors(shouldLog);
+ commandContext.setVerbose(verboseStatus);
}
public static class CommandContext {
private boolean logErrors;
private boolean verbose;
+ private String username;
+ private String password;
- public CommandContext() {
- }
-
- public CommandContext(boolean logErrors, boolean verbose) {
+ private CommandContext(boolean logErrors, boolean verbose, String username, String password) {
this.logErrors = logErrors;
this.verbose = verbose;
+ this.username = username;
+ this.password = password;
}
public boolean isLogErrors() {
@@ -319,6 +347,22 @@
public void setVerbose(boolean verbose) {
this.verbose = verbose;
+ }
+
+ private void setUsername(String username) {
+ this.username = username;
+ }
+
+ private void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
}
}
}
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java Tue Dec 6 05:32:43 2005
@@ -16,24 +16,63 @@
*/
package org.apache.geronimo.deployment.plugin.jmx;
-import java.io.IOException;
-import javax.management.remote.JMXConnector;
-import javax.management.MBeanServerConnection;
import org.apache.geronimo.kernel.jmx.KernelDelegate;
+import org.apache.geronimo.deployment.plugin.local.DistributeCommand;
+import org.apache.geronimo.deployment.plugin.local.RedeployCommand;
+
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import java.io.IOException;
+import java.io.File;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.Enumeration;
/**
- * Connects to a Kernel in a remote VM.
+ * Connects to a Kernel in a remote VM (may or many not be on the same machine).
*
* @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
*/
public class RemoteDeploymentManager extends JMXDeploymentManager {
private JMXConnector jmxConnector;
- private MBeanServerConnection mbServerConnection;
+ private boolean isSameMachine;
- public RemoteDeploymentManager(JMXConnector jmxConnector) throws IOException {
+ public RemoteDeploymentManager(JMXConnector jmxConnector, String hostname) throws IOException {
this.jmxConnector = jmxConnector;
- mbServerConnection = jmxConnector.getMBeanServerConnection();
+ MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection();
initialize(new KernelDelegate(mbServerConnection));
+ checkSameMachine(hostname);
+ }
+
+ public boolean isSameMachine() {
+ return isSameMachine;
+ }
+
+ private void checkSameMachine(String hostname) {
+ isSameMachine = false;
+ if(hostname.equals("localhost") || hostname.equals("127.0.0.1")) {
+ isSameMachine = true;
+ return;
+ }
+ try {
+ InetAddress dest = InetAddress.getByName(hostname);
+ Enumeration en = NetworkInterface.getNetworkInterfaces();
+ while(en.hasMoreElements()) {
+ NetworkInterface iface = (NetworkInterface) en.nextElement();
+ Enumeration ine = iface.getInetAddresses();
+ while (ine.hasMoreElements()) {
+ InetAddress address = (InetAddress) ine.nextElement();
+ if(address.equals(dest)) {
+ isSameMachine = true;
+ }
+ }
+ }
+ } catch (Exception e) {
+ System.err.println("Unable to look up host name '"+hostname+"'; assuming it is a different machine, but this may not get very far. ("+e.getMessage()+")");
+ }
}
public void release() {
@@ -43,8 +82,38 @@
jmxConnector = null;
} catch (IOException e) {
throw (IllegalStateException) new IllegalStateException("Unable to close connection").initCause(e);
- } finally {
- mbServerConnection = null;
+ }
+ }
+
+ protected DistributeCommand createDistributeCommand(Target[] targetList, File moduleArchive, File deploymentPlan) {
+ if(isSameMachine) {
+ return super.createDistributeCommand(targetList, moduleArchive, deploymentPlan);
+ } else {
+ return new org.apache.geronimo.deployment.plugin.remote.DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan);
+ }
+ }
+
+ protected DistributeCommand createDistributeCommand(Target[] targetList, InputStream moduleArchive, InputStream deploymentPlan) {
+ if(isSameMachine) {
+ return super.createDistributeCommand(targetList, moduleArchive, deploymentPlan);
+ } else {
+ return new org.apache.geronimo.deployment.plugin.remote.DistributeCommand(kernel, targetList, moduleArchive, deploymentPlan);
+ }
+ }
+
+ protected RedeployCommand createRedeployCommand(TargetModuleID[] moduleIDList, File moduleArchive, File deploymentPlan) {
+ if(isSameMachine) {
+ return super.createRedeployCommand(moduleIDList, moduleArchive, deploymentPlan);
+ } else {
+ return new org.apache.geronimo.deployment.plugin.remote.RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ }
+ }
+
+ protected RedeployCommand createRedeployCommand(TargetModuleID[] moduleIDList, InputStream moduleArchive, InputStream deploymentPlan) {
+ if(isSameMachine) {
+ return super.createRedeployCommand(moduleIDList, moduleArchive, deploymentPlan);
+ } else {
+ return new org.apache.geronimo.deployment.plugin.remote.RedeployCommand(kernel, moduleIDList, moduleArchive, deploymentPlan);
}
}
}
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java Tue Dec 6 05:32:43 2005
@@ -16,24 +16,24 @@
*/
package org.apache.geronimo.deployment.plugin.local;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.List;
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.FileOutputStream;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
import javax.enterprise.deploy.shared.CommandType;
import javax.enterprise.deploy.shared.ModuleType;
-import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.Target;
import javax.management.ObjectName;
-
-import org.apache.geronimo.kernel.jmx.JMXUtil;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* @version $Rev: 190584 $ $Date$
@@ -48,6 +48,7 @@
protected File deploymentPlan;
protected InputStream moduleStream;
protected InputStream deploymentStream;
+ protected ObjectName deployer;
public AbstractDeployCommand(CommandType command, Kernel kernel, File moduleArchive, File deploymentPlan, InputStream moduleStream, InputStream deploymentStream, boolean spool) {
super(command);
@@ -57,9 +58,10 @@
this.moduleStream = moduleStream;
this.deploymentStream = deploymentStream;
this.spool = spool;
+ deployer = getDeployerName();
}
- protected ObjectName getDeployerName() {
+ private ObjectName getDeployerName() {
Set deployers = kernel.listGBeans(JMXUtil.getObjectName(DEPLOYER_NAME));
if (deployers.isEmpty()) {
fail("No Deployer GBean present in running Geronimo server. " +
@@ -98,8 +100,9 @@
}
}
- protected void doDeploy(ObjectName deployer, Target target, boolean finished) throws Exception {
- Object[] args = {moduleArchive, deploymentPlan};
+ protected void doDeploy(Target target, boolean finished) throws Exception {
+ File[] args = {moduleArchive, deploymentPlan};
+ massageFileNames(args);
List objectNames = (List) kernel.invoke(deployer, "deploy", args, DEPLOY_SIG);
if (objectNames == null || objectNames.isEmpty()) {
throw new DeploymentException("Server didn't deploy anything");
@@ -127,5 +130,12 @@
addWebURLs(kernel);
complete("Completed with id " + parentName);
}
+ }
+
+ protected void massageFileNames(File[] inputs) {
+ }
+
+ public URL getRemoteDeployUploadURL() throws Exception {
+ return new URL((String)kernel.getAttribute(deployer, "remoteDeployUploadURL"));
}
}
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java Tue Dec 6 05:32:43 2005
@@ -17,13 +17,17 @@
package org.apache.geronimo.deployment.plugin.local;
-import java.util.*;
-import java.io.StringWriter;
-import java.io.PrintWriter;
+import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.CommandContext;
+import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+
import javax.enterprise.deploy.shared.ActionType;
import javax.enterprise.deploy.shared.CommandType;
-import javax.enterprise.deploy.shared.StateType;
import javax.enterprise.deploy.shared.ModuleType;
+import javax.enterprise.deploy.shared.StateType;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
import javax.enterprise.deploy.spi.status.ClientConfiguration;
@@ -31,15 +35,19 @@
import javax.enterprise.deploy.spi.status.ProgressEvent;
import javax.enterprise.deploy.spi.status.ProgressListener;
import javax.enterprise.deploy.spi.status.ProgressObject;
-import javax.management.ObjectName;
import javax.management.MalformedObjectNameException;
-
-import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager.CommandContext;
-import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
-import org.apache.geronimo.kernel.InternalKernelException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.gbean.GBeanQuery;
+import javax.management.ObjectName;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* @version $Rev$ $Date$
@@ -51,7 +59,7 @@
private String message;
private final Set listeners = new HashSet();
private final List moduleIDs = new ArrayList();
- private CommandContext commandContext = new CommandContext();
+ private CommandContext commandContext = null; //todo: this is pretty bad; should add it into constructor
private ProgressEvent event = null;
@@ -113,7 +121,7 @@
listeners.remove(pol);
}
- protected final void fail(String message) {
+ public final void fail(String message) {
sendEvent(message, StateType.FAILED);
}
@@ -121,11 +129,11 @@
sendEvent(message, StateType.COMPLETED);
}
- protected final void updateStatus(String message) {
+ public final void updateStatus(String message) {
sendEvent(message, state);
}
- protected void doFail(Exception e) {
+ public void doFail(Exception e) {
if (e instanceof InternalKernelException) {
Exception test = (Exception)((InternalKernelException)e).getCause();
if(test != null) {
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java Tue Dec 6 05:32:43 2005
@@ -17,15 +17,13 @@
package org.apache.geronimo.deployment.plugin.local;
-import java.io.File;
-import java.io.InputStream;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.kernel.Kernel;
import javax.enterprise.deploy.shared.CommandType;
import javax.enterprise.deploy.spi.Target;
-import javax.management.ObjectName;
-
-import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.kernel.Kernel;
+import java.io.File;
+import java.io.InputStream;
/**
* @version $Rev$ $Date$
@@ -55,11 +53,10 @@
copyTo(deploymentPlan, deploymentStream);
}
}
- ObjectName deployer = getDeployerName();
if (deployer == null) {
return;
}
- doDeploy(deployer, targetList[0], true);
+ doDeploy(targetList[0], true);
} catch (Exception e) {
doFail(e);
} finally {
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Tue Dec 6 05:32:43 2005
@@ -16,25 +16,25 @@
*/
package org.apache.geronimo.deployment.plugin.local;
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.List;
-import javax.enterprise.deploy.shared.CommandType;
-import javax.enterprise.deploy.spi.TargetModuleID;
-import javax.management.ObjectName;
-
import org.apache.geronimo.deployment.plugin.TargetImpl;
import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.management.ObjectName;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.List;
+
/**
* @version $Rev$ $Date$
*/
@@ -53,7 +53,6 @@
}
public void run() {
- ObjectName deployer = getDeployerName();
if (deployer == null) {
return;
}
@@ -104,7 +103,7 @@
kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG);
updateStatus("Uninstalled "+configID);
- doDeploy(deployer, module.getTarget(), false);
+ doDeploy(module.getTarget(), false);
updateStatus("Deployed "+configID);
List list = configurationManager.loadRecursive(configID);
Added: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java?rev=354426&view=auto
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java (added)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java Tue Dec 6 05:32:43 2005
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.geronimo.deployment.plugin.remote;
+
+import org.apache.geronimo.kernel.Kernel;
+
+import javax.enterprise.deploy.spi.Target;
+import java.io.File;
+import java.io.InputStream;
+
+/**
+ * A version of the distribute command that works on a server different
+ * than the application server.
+ *
+ * @version $Rev: 190584 $ $Date: 2005-12-04 12:07:10 -0500 (Sun, 04 Dec 2005) $
+ */
+public class DistributeCommand extends org.apache.geronimo.deployment.plugin.local.DistributeCommand {
+ public DistributeCommand(Kernel kernel, Target[] targetList, File moduleArchive, File deploymentPlan) {
+ super(kernel, targetList, moduleArchive, deploymentPlan);
+ }
+
+ public DistributeCommand(Kernel kernel, Target[] targetList, InputStream moduleStream, InputStream deploymentStream) {
+ super(kernel, targetList, moduleStream, deploymentStream);
+ }
+
+ protected void massageFileNames(File[] inputs) {
+ RemoteDeployUtil.uploadFilesToServer(inputs, this);
+ }
+}
Added: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java?rev=354426&view=auto
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java (added)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java Tue Dec 6 05:32:43 2005
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.geronimo.deployment.plugin.remote;
+
+import org.apache.geronimo.kernel.Kernel;
+
+import javax.enterprise.deploy.spi.TargetModuleID;
+import java.io.File;
+import java.io.InputStream;
+
+/**
+ * A version of the redeploy command that works on a server different
+ * than the application server.
+ *
+ * @version $Rev: 190584 $ $Date: 2005-12-04 12:07:10 -0500 (Sun, 04 Dec 2005) $
+ */
+public class RedeployCommand extends org.apache.geronimo.deployment.plugin.local.RedeployCommand {
+ public RedeployCommand(Kernel kernel, TargetModuleID[] moduleIDList, File moduleArchive, File deploymentPlan) {
+ super(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ }
+
+ public RedeployCommand(Kernel kernel, TargetModuleID[] moduleIDList, InputStream moduleArchive, InputStream deploymentPlan) {
+ super(kernel, moduleIDList, moduleArchive, deploymentPlan);
+ }
+
+ protected void massageFileNames(File[] inputs) {
+ RemoteDeployUtil.uploadFilesToServer(inputs, this);
+ }
+}
Added: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java?rev=354426&view=auto
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java (added)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java Tue Dec 6 05:32:43 2005
@@ -0,0 +1,120 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.geronimo.deployment.plugin.remote;
+
+import org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand;
+import org.apache.geronimo.util.encoders.Base64;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.DataOutputStream;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataInputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ * Knows how to upload files to a server
+ *
+ * @version $Rev: 190584 $ $Date: 2005-12-04 12:07:10 -0500 (Sun, 04 Dec 2005) $
+ */
+public class RemoteDeployUtil {
+ public static void uploadFilesToServer(File[] files, AbstractDeployCommand progress) {
+ if(files == null) {
+ return;
+ }
+ List valid = new LinkedList();
+ for(int i=0; i<files.length; i++) {
+ if(files[i] == null) {
+ continue;
+ }
+ File file = files[i];
+ if(!file.exists() || !file.canRead()) {
+ continue;
+ }
+ valid.add(new Integer(i));
+ }
+ if(valid.size() > 0) {
+ progress.updateStatus("Uploading "+valid.size()+" file(s) to server");
+ try {
+ URL url = progress.getRemoteDeployUploadURL();
+ URLConnection con = connectToServer(url, progress.getCommandContext().getUsername(), progress.getCommandContext().getPassword());
+ DataOutputStream out = new DataOutputStream(new BufferedOutputStream(con.getOutputStream()));
+ out.writeInt(valid.size());
+ byte[] buf = new byte[1024];
+ int size, total, length, threshold, next;
+ for (Iterator it = valid.iterator(); it.hasNext();) {
+ Integer index = (Integer) it.next();
+ File file = files[index.intValue()];
+ out.writeInt(length = (int)file.length());
+ threshold = Math.max(length / 100, 10240);
+ next = threshold;
+ BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
+ total = 0;
+ while((size = in.read(buf)) > -1) {
+ out.write(buf, 0, size);
+ total += size;
+ if(total > next) {
+ progress.updateStatus("Uploading "+file.getName()+": "+(total/1024)+" kB");
+ while(total > next) next += threshold;
+ }
+ }
+ }
+ out.flush();
+ out.close();
+ DataInputStream in = new DataInputStream(new BufferedInputStream(con.getInputStream()));
+ String status = in.readUTF();
+ if(!status.equals("OK")) {
+ progress.fail("Unable to upload files to server: "+status);
+ return;
+ }
+ progress.updateStatus("File upload complete (Server: "+status+")");
+ int count = in.readInt();
+ if(count != valid.size()) {
+ progress.fail("Server did not receive all "+valid.size()+" files ("+count+")");
+ }
+ for (Iterator it = valid.iterator(); it.hasNext();) {
+ Integer index = (Integer) it.next();
+ String serverFileName = in.readUTF();
+ files[index.intValue()] = new File(serverFileName);
+ }
+ in.close();
+ progress.updateStatus(count+" file(s) transferred to server. Resuming deployment operation.");
+ } catch (Exception e) {
+ progress.doFail(e);
+ }
+ }
+ }
+
+ private static URLConnection connectToServer(URL url, String username, String password) throws IOException {
+ URLConnection con = url.openConnection();
+ String auth = username + ":" + password;
+ byte[] data = auth.getBytes();
+ String s = new String(Base64.encode(data));
+ while(s.length() % 4 != 0) s += "=";
+ con.setRequestProperty("Authorization", "Basic "+s);
+ con.setDoInput(true);
+ con.setDoOutput(true);
+ con.connect();
+ return con;
+ }
+}
Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java (original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java Tue Dec 6 05:32:43 2005
@@ -17,18 +17,6 @@
package org.apache.geronimo.deployment.cli;
-import java.io.*;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.jar.JarFile;
-import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
-import javax.enterprise.deploy.spi.DeploymentManager;
-import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
-import javax.enterprise.deploy.spi.factories.DeploymentFactory;
-import javax.management.ObjectName;
-
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException;
import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
@@ -37,6 +25,25 @@
import org.apache.geronimo.system.main.CommandLineManifest;
import org.apache.geronimo.util.SimpleEncryption;
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+import javax.management.ObjectName;
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.jar.JarFile;
+
/**
* Supports two types of connections to the server. One, via JSR-88, is valid
* whenever the server is online, for any command except "package". The other,
@@ -46,13 +53,16 @@
* @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
*/
public class ServerConnection {
- private final static Map OPTION_HELP = new LinkedHashMap(4);
+ private final static Map OPTION_HELP = new LinkedHashMap(9);
static {
- OPTION_HELP.put("--uri", "A URI to contact the server. The server must be running for this " +
- "to work. If not specified, the deployer defaults to operating on a " +
- "Geronimo server running on the standard port on localhost.\n" +
+ OPTION_HELP.put("--uri", "A URI to contact the server. If not specified, the deployer defaults to " +
+ "operating on a Geronimo server running on the standard port on localhost.\n" +
"A URI to connect to Geronimo (including optional host and port parameters) has the form: " +
- "deployer:geronimo:jmx:rmi:///jndi/rmi:[//host[:port]]/JMXConnector");
+ "deployer:geronimo:jmx[://host[:port]] (though you could also just use --host and --port instead).");
+ OPTION_HELP.put("--host", "The host name of a Geronimo server to deploy to. This option is " +
+ "not compatible with --uri, but is often used with --port.");
+ OPTION_HELP.put("--port", "The RMI listen port of a Geronimo server to deploy to. This option is " +
+ "not compatible with --uri, but is often used with --host. The default port is 1099.");
OPTION_HELP.put("--offline", "Indicates that you don't want the deployer to try to connect to " +
"a Geronimo server over the network. If you're running on the same machine as the " +
"Geronimo installation, using this option means that you're asserting that the" +
@@ -95,25 +105,24 @@
return false;
}
String last = (String) args.get(args.size()-1);
- if(last.equals("--uri") || last.equals("--url") || last.equals("--driver") || last.equals("--user") ||
- last.equals("--password")) {
- return true;
- }
- return false;
+ return last.equals("--uri") || last.equals("--url") || last.equals("--driver") || last.equals("--user") ||
+ last.equals("--password") || last.equals("--host") || last.equals("--port");
}
- private final static String DEFAULT_URI = "deployer:geronimo:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector";
+ private final static String DEFAULT_URI = "deployer:geronimo:jmx";
private DeploymentManager manager;
private KernelWrapper kernel;
private PrintWriter out;
private BufferedReader in;
private SavedAuthentication auth;
+ private boolean logToSysErr;
+ private boolean verboseMessages;
public ServerConnection(String[] args, boolean forceLocal, PrintWriter out, BufferedReader in) throws DeploymentException {
- String uri = null, driver = null, user = null, password = null;
+ String uri = null, driver = null, user = null, password = null, host = null;
+ Integer port = null;
boolean offline = false;
- JMXDeploymentManager.CommandContext commandContext = new JMXDeploymentManager.CommandContext();
this.out = out;
this.in = in;
for(int i = 0; i < args.length; i++) {
@@ -122,12 +131,39 @@
if(uri != null) {
throw new DeploymentSyntaxException("Cannot specify more than one URI");
} else if(i >= args.length-1) {
- throw new DeploymentSyntaxException("Must specify a URI (--uri deployer:...)");
+ throw new DeploymentSyntaxException("Must specify a URI (e.g. --uri deployer:...)");
}
if(offline) {
throw new DeploymentSyntaxException("Cannot specify a URI in offline mode");
}
+ if(host != null || port != null) {
+ throw new DeploymentSyntaxException("Cannot specify a URI as well as a host/port");
+ }
uri = args[++i];
+ } else if(arg.equals("--host")) {
+ if(host != null) {
+ throw new DeploymentSyntaxException("Cannot specify more than one host");
+ } else if(i >= args.length-1) {
+ throw new DeploymentSyntaxException("Must specify a hostname (e.g. --host localhost)");
+ }
+ if(uri != null) {
+ throw new DeploymentSyntaxException("Cannot specify a URI as well as a host/port");
+ }
+ host = args[++i];
+ } else if(arg.equals("--port")) {
+ if(port != null) {
+ throw new DeploymentSyntaxException("Cannot specify more than one port");
+ } else if(i >= args.length-1) {
+ throw new DeploymentSyntaxException("Must specify a port (e.g. --port 1099)");
+ }
+ if(uri != null) {
+ throw new DeploymentSyntaxException("Cannot specify a URI as well as a host/port");
+ }
+ try {
+ port = new Integer(args[++i]);
+ } catch (NumberFormatException e) {
+ throw new DeploymentSyntaxException("Port must be a number ("+e.getMessage()+")");
+ }
} else if(arg.equals("--driver")) {
if(driver != null) {
throw new DeploymentSyntaxException("Cannot specify more than one driver");
@@ -173,9 +209,9 @@
}
password = args[++i];
} else if (arg.equals("--verbose")) {
- commandContext.setVerbose(true);
+ verboseMessages = true;
} else if (arg.equals("--syserr")) {
- commandContext.setLogErrors(true);
+ logToSysErr = true;
} else {
throw new DeploymentException("Invalid option "+arg);
}
@@ -186,13 +222,16 @@
if(forceLocal && !offline) {
throw new DeploymentSyntaxException("This command may only be run offline. Make sure the server is not running and use the --offline option.");
}
- if(forceLocal && (uri != null || driver != null || user != null || password != null)) {
+ if(forceLocal && (uri != null || driver != null || user != null || password != null || host != null || port != null)) {
throw new DeploymentSyntaxException("This command does not use normal server connectivity. No standard options are allowed.");
}
+ if(host != null || port != null) {
+ uri = DEFAULT_URI+"://"+(host == null ? "" : host)+(port == null ? "" : ":"+port);
+ }
if(forceLocal || offline) {
initializeKernel();
} else {
- tryToConnect(uri, commandContext, driver, user, password, true);
+ tryToConnect(uri, driver, user, password, true);
if(manager == null) {
throw new DeploymentException("Unexpected error; connection failed.");
}
@@ -224,7 +263,7 @@
return auth.uri;
}
- private void tryToConnect(String argURI, JMXDeploymentManager.CommandContext commandContext, String driver, String user, String password, boolean authPrompt) throws DeploymentException {
+ private void tryToConnect(String argURI, String driver, String user, String password, boolean authPrompt) throws DeploymentException {
DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
if(driver != null) {
loadDriver(driver, mgr);
@@ -265,7 +304,7 @@
if(authPrompt && !useURI.equals(DEFAULT_URI) && user == null && password == null) {
// Non-standard URI, but no authentication information
- doAuthPromptAndRetry(useURI, commandContext, user, password);
+ doAuthPromptAndRetry(useURI, user, password);
return;
} else { // Standard URI with no auth, Non-standard URI with auth, or else this is the 2nd try already
try {
@@ -273,7 +312,7 @@
auth = new SavedAuthentication(useURI, user, password.toCharArray());
} catch(AuthenticationFailedException e) { // server's there, you just can't talk to it
if(authPrompt) {
- doAuthPromptAndRetry(useURI, commandContext, user, password);
+ doAuthPromptAndRetry(useURI, user, password);
return;
} else {
throw new DeploymentException("Login Failed");
@@ -285,7 +324,7 @@
if (manager instanceof JMXDeploymentManager) {
JMXDeploymentManager deploymentManager = (JMXDeploymentManager) manager;
- deploymentManager.setCommandContext(commandContext);
+ deploymentManager.setLogConfiguration(logToSysErr, verboseMessages);
}
}
@@ -311,7 +350,7 @@
}
}
- private void doAuthPromptAndRetry(String uri, JMXDeploymentManager.CommandContext commandContext, String user, String password) throws DeploymentException {
+ private void doAuthPromptAndRetry(String uri, String user, String password) throws DeploymentException {
try {
if(user == null) {
out.print("Username: ");
@@ -324,7 +363,7 @@
} catch(IOException e) {
throw new DeploymentException("Unable to prompt for login", e);
}
- tryToConnect(uri, commandContext, null, user, password, false);
+ tryToConnect(uri, null, user, password, false);
}
public DeploymentManager getDeploymentManager() {
Modified: geronimo/trunk/modules/hot-deploy/src/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/hot-deploy/src/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/modules/hot-deploy/src/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java (original)
+++ geronimo/trunk/modules/hot-deploy/src/java/org/apache/geronimo/deployment/hot/DirectoryHotDeployer.java Tue Dec 6 05:32:43 2005
@@ -262,7 +262,7 @@
private DeploymentManager getDeploymentManager() throws DeploymentManagerCreationException {
DeploymentManager manager = factory.getDeploymentManager(deploymentURI, deploymentUser, deploymentPassword);
if(manager instanceof JMXDeploymentManager) {
- ((JMXDeploymentManager)manager).setCommandContext(new JMXDeploymentManager.CommandContext(false, true));
+ ((JMXDeploymentManager)manager).setLogConfiguration(false, true);
}
return manager;
}
Modified: geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java (original)
+++ geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StopRemoteServer.java Tue Dec 6 05:32:43 2005
@@ -1,15 +1,14 @@
package org.apache.geronimo.deployment.mavenplugin;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.KernelDelegate;
+
import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-
-import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
-import org.apache.geronimo.kernel.jmx.KernelDelegate;
-import org.apache.geronimo.kernel.Kernel;
+import java.util.HashMap;
+import java.util.Map;
/**
*/
@@ -19,9 +18,9 @@
private Kernel kernel;
public void execute() throws Exception {
- String uri = getUri().substring(DeploymentFactoryImpl.URI_PREFIX.length());
+ String uri = getUri();
if (!uri.startsWith("jmx")) {
- throw new Exception("bad uri");
+ throw new Exception("Bad JMX URI ("+uri+")");
}
Map environment = new HashMap();
Modified: geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java?rev=354426&r1=354425&r2=354426&view=diff
==============================================================================
--- geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java (original)
+++ geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/WaitForStarted.java Tue Dec 6 05:32:43 2005
@@ -16,22 +16,21 @@
*/
package org.apache.geronimo.deployment.mavenplugin;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.jmx.KernelDelegate;
+import org.apache.geronimo.kernel.management.State;
+
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-
-import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
-import org.apache.geronimo.kernel.jmx.KernelDelegate;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.InternalKernelException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
public class WaitForStarted extends AbstractModuleCommand {
@@ -59,9 +58,9 @@
}
public void execute() throws Exception {
- String uri = getUri().substring(DeploymentFactoryImpl.URI_PREFIX.length());
+ String uri = getUri();
if (!uri.startsWith("jmx")) {
- throw new Exception("bad uri");
+ throw new Exception("Bad JMX URI ("+uri+")");
}
Map environment = new HashMap();