From 8abcb93e2088da042ee887a10dd77879625db43a Mon Sep 17 00:00:00 2001
From: Erik Hatcher byserverdeploy
+ANT ServerDeploy User Manual
+
+
+
+
At present the tasks support:
+
+
Task | Application Servers | |
serverdeploy | Nested Elements | |
generic | Generic task | |
jonas | JOnAS 2.4 | |
weblogic | Weblogic |
The serverdeploy
task is used to run a "hot" deployment tool for
@@ -79,6 +112,7 @@ attributes are required, depending on the tool.
Also supported are nested vendor-specific elements.
+arg
@@ -125,7 +159,7 @@ using a Java based deploy tool:
</serverdeploy>
-
+
The WebLogic element contains additional attributes to run the @@ -187,7 +221,88 @@ required for all actions. WebLogic server:
- <serverdeploy action="delete">/ + <serverdeploy action="delete" source="${lib.dir}/ejb_myApp.jar"/> + <weblogic application="myapp" + server="t3://myserver:7001" + classpath="${weblogic.home}/lib/weblogic.jar" + username="${user.name}" + password="${user.password}"/> + </serverdeploy> ++ + +
+The JOnAS element contains additional attributes to run the
+JonasAdmin
deployment tool.
+
Valid actions for the tool are deploy
, undeploy
,
+list
and update
.
+
You can't use user
and password
property with this
+task.
+
+
Attribute | +Description | +Required | +
jonasroot | +The root directory for JOnAS. | +Yes | +
orb | +Choose your ORB : RMI, JEREMIE, DAVID, ... If omitted, it defaults + to the one present in classpath. The corresponding JOnAS JAR is + automatically added to the classpath. If your orb is DAVID (RMI/IIOP) you must + specify davidhost and davidport properties. | +No | +
davidhost | +The value for the system property : david.CosNaming.default_host . |
+ No | +
davidport | +The value for the system property : david.CosNaming.default_port . |
+ No | +
classname | +This is the fully qualified classname of the Java based
+ deployment tool to execute. Default to org.objectweb.jonas.adm.JonasAdmin |
+ No | +
The jonas element supports nested <arg> and <jvmarg> elements.
+ + +This example shows the use of serverdeploy to deploy a component to a JOnAS server:
+ ++ <serverdeploy action="deploy" source="${lib.dir}/ejb_myApp.jar"> + <jonas server="MyJOnAS" jonasroot="${jonas.root}" > + <classpath> + <pathelement path="${jonas.root}/lib/RMI_jonas.jar" /> + <pathelement path="${jonas.root}/config/" /> + </classpath> + </jonas> + </serverdeploy> ++ +
This example shows serverdeploy being used to list the components from a +JOnAS server and a WebLogic server:
+ ++ <serverdeploy action="list" /> + <jonas jonasroot="${jonas.root}" orb="JEREMIE" /> <weblogic application="myapp" server="t3://myserver:7001" classpath="${weblogic.home}/lib/weblogic.jar" @@ -195,6 +310,8 @@ WebLogic server: password="${user.password}"/> </serverdeploy>+ +
Copyright © 2002 Apache Software Foundation. All rights Reserved.
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java index 6b8ed2c70..4685ab286 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java @@ -160,4 +160,15 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool public void setClassName(String className) { this.className = className; } + + /** + * + */ + public Java getJava() { + return java; + } + + public String getClassName() { + return className; + } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java new file mode 100644 index 000000000..74eee5d92 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java @@ -0,0 +1,281 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + *+ * + * In the end, this task assembles the commadline parameters and + * runs the weblogic.deploy tool in a seperate JVM. + * + *@author Cyrille Morvan + *@created March 30, 2002 + *@see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool + *@see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool + *@see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy + */ +public class JonasHotDeploymentTool extends GenericHotDeploymentTool implements HotDeploymentTool { + + /** + * Description of the Field + */ + protected final static String DEFAULT_ORB = "RMI"; + + /** + * The classname of the tool to run * + */ + private final static String JONAS_DEPLOY_CLASS_NAME = "org.objectweb.jonas.adm.JonasAdmin"; + + /** + * All the valid actions that weblogic.deploy permits * + */ + private final static String[] VALID_ACTIONS = + {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; + + /** + * Description of the Field + */ + private File jonasroot; + + /** + * Description of the Field + */ + private String orb = null; + + /** + * Description of the Field + */ + private String davidHost; + + /** + * Description of the Field + */ + private int davidPort; + + + /** + * Set the host for the David ORB. + * + *@param inValue The new davidhost value + */ + public void setDavidhost(final String inValue) { + davidHost = inValue; + } + + + /** + * Set the port for the David ORB. + * + *@param inValue The new davidport value + */ + public void setDavidport(final int inValue) { + davidPort = inValue; + } + + + /** + * set the jonas root directory (-Dinstall.root=). This + * element is required. + * + *@param inValue The new jonasroot value + */ + public void setJonasroot(final File inValue) { + jonasroot = inValue; + } + + + /** + * Set the ORB to construct classpath. + * + *@param inValue RMI, JEREMIE, DAVID,... + */ + public void setOrb(final String inValue) { + orb = inValue; + } + + + /** + * gets the classpath field. + * + *@return A Path representing the "classpath" attribute. + */ + public Path getClasspath() { + + Path aClassPath = super.getClasspath(); + + if (aClassPath == null) { + aClassPath = new Path(getTask().getProject()); + } + if (orb != null) { + String aOrbJar = new File(jonasroot, "lib/" + orb + "_jonas.jar").toString(); + String aConfigDir = new File(jonasroot, "config/").toString(); + Path aJOnASOrbPath = new Path(aClassPath.getProject(), + aOrbJar + File.pathSeparator + aConfigDir); + aClassPath.append(aJOnASOrbPath); + } + return aClassPath; + } + + + /** + * Validates the passed in attributes.
+ * + * The rules are: + *
+ * + * Valid actions are contained in the static array + * VALID_ACTIONS + * + *@return true if the action attribute is valid, false if + * not. + */ + protected boolean isActionValid() { + boolean valid = false; + + String action = getTask().getAction(); + + for (int i = 0; i < VALID_ACTIONS.length; i++) { + if (action.equals(VALID_ACTIONS[i])) { + valid = true; + break; + } + } + + return valid; + } +} + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java index 19e7b69a2..5e7d03f75 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java @@ -113,6 +113,18 @@ public class ServerDeploy extends Task vendorTools.addElement(tool); } + /** + * Creates a JOnAS deployment tool, for deployment to JOnAS servers. + *
Ant calls this method on creation to handle embedded "jonas" elements + * in the ServerDeploy task. + * @param tool An instance of JonasHotDeployment tool, passed in by Ant. + */ + public void addJonas(JonasHotDeploymentTool tool) { + tool.setTask(this); + vendorTools.addElement(tool); + } + + /////////////////////////////////////////////////////////////////////////// // // Execute method