From: <ma...@rh...> - 2008-10-28 20:05:07
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [1855] [RHQ-1027][RHQ-1029] first iteration of the agent update binary jar</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>1855</dd> <dt>Author</dt> <dd>mazz</dd> <dt>Date</dt> <dd>2008-10-28 15:05:01 -0500 (Tue, 28 Oct 2008)</dd> </dl> <h3>Log Message</h3> <pre>[RHQ-1027][RHQ-1029] first iteration of the agent update binary jar</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkclasspath">rhq/trunk/.classpath</a></li> <li><a href="#rhqtrunkmodulesenterpriseagentantrunxml">rhq/trunk/modules/enterprise/agent/ant-run.xml</a></li> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiagentupdateAgentUpdateServletjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java</a></li> <li><a href="#rhqtrunkmodulesenterprisepomxml">rhq/trunk/modules/enterprise/pom.xml</a></li> <li><a href="#rhqtrunkmodulesenterpriseservercontainersrcmainscriptsrhqcontainerbuildxml">rhq/trunk/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml</a></li> </ul> <h3>Added Paths</h3> <ul> <li>rhq/trunk/modules/enterprise/agentupdate/</li> <li><a href="#rhqtrunkmodulesenterpriseagentupdatepomxml">rhq/trunk/modules/enterprise/agentupdate/pom.xml</a></li> <li>rhq/trunk/modules/enterprise/agentupdate/src/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/java/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/</li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/</li> <li><a href="#rhqtrunkmodulesenterpriseagentupdatesrcmainjavaorgrhqenterpriseagentupdateAgentUpdatejava">rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/AgentUpdate.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseagentupdatesrcmainjavaorgrhqenterpriseagentupdateLoggerAntBuildListenerjava">rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/LoggerAntBuildListener.java</a></li> <li>rhq/trunk/modules/enterprise/agentupdate/src/main/resources/</li> <li><a href="#rhqtrunkmodulesenterpriseagentupdatesrcmainresourcesLICENSE">rhq/trunk/modules/enterprise/agentupdate/src/main/resources/LICENSE</a></li> <li><a href="#rhqtrunkmodulesenterpriseagentupdatesrcmainresourcesREADMEtxt">rhq/trunk/modules/enterprise/agentupdate/src/main/resources/README.txt</a></li> <li><a href="#rhqtrunkmodulesenterpriseagentupdatesrcmainresourcesrhqagentupdatebuildxml">rhq/trunk/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkclasspath"></a> <div class="modfile"><h4>Modified: rhq/trunk/.classpath (1854 => 1855)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/.classpath 2008-10-28 15:25:32 UTC (rev 1854) +++ rhq/trunk/.classpath 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -47,6 +47,7 @@ </span><span class="cx"> <classpathentry kind="src" path="modules/enterprise/comm/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/agent/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/agent/src/test/java"/> </span><span class="add">+ <classpathentry kind="src" path="modules/enterprise/agentupdate/src/main/java"/> </span><span class="cx"> <classpathentry kind="src" path="modules/enterprise/server/jar/src/main/java"/> <classpathentry kind="src" path="modules/enterprise/server/jar/src/test/java"/> <classpathentry kind="src" path="modules/enterprise/server/plugins/disk/src/main/java"/> </span></pre></div> <a id="rhqtrunkmodulesenterpriseagentantrunxml"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/agent/ant-run.xml (1854 => 1855)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/agent/ant-run.xml 2008-10-28 15:25:32 UTC (rev 1854) +++ rhq/trunk/modules/enterprise/agent/ant-run.xml 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -52,7 +52,7 @@ </span><span class="cx"> <path id="endorsed.classpath"> <!-- The JAXB jars need to go in endorsed, since we use JAXB 2.1, which would cause conflicts with </span><span class="rem">- JAXB 2.0, which is bundled with Java 6, when running under Java 6. JAXB 2.1 depends on </span><span class="add">+ JAXB 2.0, which is bundled with Java 6, when running under Java 6. JAXB 2.1 depends on </span><span class="cx"> Activation 1.1, which we also need to include, in order to remain compatible with Java 5, which bundles Activation 1.0. --> <fileset dir="${settings.localRepository}" id="endorsed.classpath.fileset"> </span><span class="lines">@@ -62,7 +62,7 @@ </span><span class="cx"> </fileset> </path> </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> <fileset dir="${settings.localRepository}" id="native.fileset"> <include name="org/hyperic/sigar-dist/${sigar.version}/sigar-dist-${sigar.version}.zip" /> </fileset> </span><span class="lines">@@ -87,7 +87,9 @@ </span><span class="cx"> --> <target name="package-dist"> <echo>Running ant package-dist</echo> </span><span class="rem">- <property name="agent.distro.dir" location="${basedir}/target/rhq-agent-${project.version}"/> </span><span class="add">+ <!-- do not put our distro in a directory with a specific version in the name! --> + <property name="agent.distro.dir" location="${basedir}/target/rhq-agent"/> + </span><span class="cx"> <!-- Don't want to delete every time <delete dir="${agent.distro.dir}" />--> <copy todir="${agent.distro.dir}/lib" </span><span class="lines">@@ -99,7 +101,7 @@ </span><span class="cx"> flatten="true"> <fileset refid="endorsed.classpath.fileset" /> </copy> </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> <unzip dest="${agent.distro.dir}/lib" overwrite="false"> <fileset refid="native.fileset" /> <patternset> </span><span class="lines">@@ -156,63 +158,38 @@ </span><span class="cx"> </fileset> </copy> </span><span class="rem">- <delete file="${basedir}/target/rhq-agent-${project.version}.zip" /> - <zip destfile="${basedir}/target/rhq-agent-${project.version}.zip" > - <!-- The zip task does not mantain file permissions, we have to make sure they are set here --> </span><span class="add">+ <delete file="${basedir}/target/rhq-agent-${project.version}.zip" /> + <zip destfile="${basedir}/target/rhq-agent-${project.version}.zip" > + <!-- The zip task does not mantain file permissions, we have to make sure they are set here --> </span><span class="cx"> <zipfileset dir="${basedir}/target"> </span><span class="rem">- <include name="rhq-agent-${project.version}/**"/> - <exclude name="rhq-agent-${project.version}/bin/*.sh"/> - <exclude name="rhq-agent-${project.version}/lib/*.so"/> - <exclude name="rhq-agent-${project.version}/lib/*.sl"/> - <exclude name="rhq-agent-${project.version}/lib/*.dylib"/> </span><span class="add">+ <include name="rhq-agent/**"/> + <exclude name="rhq-agent/bin/*.sh"/> + <exclude name="rhq-agent/lib/*.so"/> + <exclude name="rhq-agent/lib/*.sl"/> + <exclude name="rhq-agent/lib/*.dylib"/> </span><span class="cx"> </zipfileset> <zipfileset dir="${basedir}/target" filemode="755"> </span><span class="rem">- <include name="rhq-agent-${project.version}/bin/*.sh"/> - <include name="rhq-agent-${project.version}/lib/*.so"/> - <include name="rhq-agent-${project.version}/lib/*.sl"/> - <include name="rhq-agent-${project.version}/lib/*.dylib"/> - </zipfileset> </span><span class="add">+ <include name="rhq-agent/bin/*.sh"/> + <include name="rhq-agent/lib/*.so"/> + <include name="rhq-agent/lib/*.sl"/> + <include name="rhq-agent/lib/*.dylib"/> + </zipfileset> </span><span class="cx"> </zip> </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> <mkdir dir="${settings.localRepository}/org/rhq/rhq-enterprise-agent/${project.version}"/> <copy file="${basedir}/target/rhq-agent-${project.version}.zip" tofile="${settings.localRepository}/org/rhq/rhq-enterprise-agent/${project.version}/rhq-enterprise-agent-${project.version}.zip" </span><span class="rem">- verbose="true"/> - </span><span class="add">+ verbose="true"/> + </span><span class="cx"> <antcall target="package-connectors-dist" /> </target> <!-- ======================================================================= --> </span><span class="rem">- <target name="package-standalone"> </span><span class="add">+ <target name="package-connectors-dist" if="agent-with-connectors"> + <property name="connectors.distro.dir" location="${basedir}/target/rhq-product_connectors-${project.version}"/> </span><span class="cx"> </span><span class="rem">- <delete dir="${java.io.tmpdir}/rhqagent" /> - - <unjar dest="${java.io.tmpdir}/rhqagent"> - <fileset refid="run.classpath.fileset" /> - <patternset> - <exclude name="META-INF/**" /> - </patternset> - </unjar> - - <mkdir dir="target/standalone" /> - <delete file="target/standalone/rhq-agent.jar" /> - <jar jarfile="target/standalone/rhq-agent.jar"> - <fileset dir="${java.io.tmpdir}/rhqagent" /> - <manifest> - <attribute name="Main-Class" value="org.rhq.enterprise.agent.AgentMain"/> - </manifest> - </jar> - - </target> - - <!-- - ======================================================================= - --> - <target name="package-connectors-dist" if="agent-with-connectors"> - <property name="connectors.distro.dir" location="${basedir}/target/rhq-product_connectors-${project.version}"/> - </span><span class="cx"> <property name="trunk.dir" location="${basedir}/../../.."/> <property name="product_connectors.dir" location="${trunk.dir}/etc/product_connectors"/> </span><span class="lines">@@ -229,11 +206,11 @@ </span><span class="cx"> <zip destfile="${basedir}/target/rhq-product_connectors-${project.version}.zip" > <fileset dir="${basedir}/target" includes="rhq-product_connectors-${project.version}/**"/> </zip> </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> <mkdir dir="${settings.localRepository}/org/rhq/rhq-enterprise-agent/${project.version}"/> <copy file="${basedir}/target/rhq-product_connectors-${project.version}.zip" todir="${settings.localRepository}/org/rhq/rhq-enterprise-agent/${project.version}" </span><span class="rem">- verbose="true"/> </span><span class="add">+ verbose="true"/> </span><span class="cx"> </target> </project> </span></pre></div> <a id="rhqtrunkmodulesenterpriseagentupdatepomxml"></a> <div class="addfile"><h4>Added: rhq/trunk/modules/enterprise/agentupdate/pom.xml (0 => 1855)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/agentupdate/pom.xml (rev 0) +++ rhq/trunk/modules/enterprise/agentupdate/pom.xml 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -0,0 +1,159 @@ </span><span class="add">+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.rhq</groupId> + <artifactId>rhq-parent</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <groupId>org.rhq</groupId> + <artifactId>rhq-enterprise-agentupdate</artifactId> + <packaging>jar</packaging> + + <name>RHQ Enterprise Agent Update</name> + <description>RHQ Agent Update</description> + + <scm> + <connection>scm:svn:http://svn.rhq-project.org/repos/rhq/trunk/modules/enterprise/agentupdate/</connection> + <developerConnection>scm:svn:http://svn.rhq-project.org/repos/rhq/trunk/modules/enterprise/agentupdate/</developerConnection> + </scm> + + <properties> + <scm.module.path>modules/enterprise/agentupdate/</scm.module.path> + <ant.version>1.7.1</ant.version> + </properties> + + <dependencies> + + <!-- Internal Deps --> + + <!-- have a dependency on the agent because we need it built/assembled first --> + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-enterprise-agent</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + + <!-- 3rd Party Deps --> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>${ant.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant-launcher</artifactId> + <version>${ant.version}</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>gnu-getopt</groupId> + <artifactId>getopt</artifactId> + <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> + </dependency> + + </dependencies> + + <build> + <plugins> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <phase>process-classes</phase> + <configuration> + <tasks> + + <!-- create our rhq-agent-update-version.properties file that goes in our jar --> + <tstamp> + <format property="build.time" pattern="dd.MMM.yyyy HH.mm.ss z" /> + </tstamp> + + <echo file="${project.build.outputDirectory}/rhq-agent-update-version.properties" append="false">rhq-agent.latest.version=${project.version} +rhq-agent.latest.build-number=${buildNumber} +</echo> + + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <!-- assemble the self-executing jar --> + <execution> + <id>agent-update-package</id> + <phase>process-resources</phase> + <configuration> + <tasks> + <copy file="${settings.localRepository}/org/rhq/rhq-enterprise-agent/${project.version}/rhq-enterprise-agent-${project.version}.zip" + todir="${project.build.outputDirectory}" /> + <fileset dir="${settings.localRepository}" id="run.classpath.fileset"> + <!-- we do not need logging (yet) in AgentUpdate + <include name="log4j/log4j/1.2.14/log4j-1.2.14.jar" /> + <include name="commons-logging/commons-logging/${commons-logging.version}/commons-logging-${commons-logging.version}.jar" /> + --> + <include name="gnu-getopt/getopt/${getopt.version}/getopt-${getopt.version}.jar" /> + <include name="org/apache/ant/ant/${ant.version}/ant-${ant.version}.jar" /> + <include name="org/apache/ant/ant-launcher/${ant.version}/ant-launcher-${ant.version}.jar" /> + </fileset> + <unjar dest="${project.build.outputDirectory}"> + <fileset refid="run.classpath.fileset" /> + <patternset> + <exclude name="META-INF/**" /> + <exclude name="images/" /> + </patternset> + </unjar> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>org.rhq.enterprise.agent.update.AgentUpdate</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + + </plugins> + </build> + + <reporting> + <plugins> + + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + + </plugins> + </reporting> + +</project> </span><span class="cx">\ No newline at end of file Property changes on: rhq/trunk/modules/enterprise/agentupdate/pom.xml ___________________________________________________________________ </span></pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Added: rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/AgentUpdate.java </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/AgentUpdate.java (rev 0) </span><span class="add">+++ rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/AgentUpdate.java 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -0,0 +1,416 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.agent.update; + +import gnu.getopt.Getopt; +import gnu.getopt.LongOpt; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.URI; +import java.net.URL; +import java.util.Map; +import java.util.Properties; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +import org.apache.tools.ant.Project; +import org.apache.tools.ant.helper.ProjectHelper2; + +/** + * The main entry class to the standalone agent updater. + * This class must be placed in the agent update binary jar file in the + * proper place and its name must be specified in that jar file's Main-Class + * manifest entry. + * + * @author John Mazzitelli + * + */ +public class AgentUpdate { + private static final String RHQ_AGENT_UPDATE_VERSION_PROPERTIES = "rhq-agent-update-version.properties"; + + private static final String DEFAULT_OLD_AGENT_HOME = "./rhq-agent"; + private static final String DEFAULT_NEW_AGENT_HOME_PARENT = "."; + private static final String DEFAULT_LOG_FILE = "./rhq-agent-update.log"; + private static final boolean DEFAULT_QUIET_FLAG = false; + private static final String DEFAULT_SCRIPT_FILE = "rhq-agent-update-build.xml"; + + private boolean showVersion = false; + private boolean updateFlag = false; + private boolean installFlag = false; + private String oldAgentHomeArgument = DEFAULT_OLD_AGENT_HOME; + private String newAgentHomeParentArgument = DEFAULT_NEW_AGENT_HOME_PARENT; + private String logFileArgument = DEFAULT_LOG_FILE; + private String jarFileArgument = null; + private boolean quietFlag = DEFAULT_QUIET_FLAG; + private String scriptFileArgument = DEFAULT_SCRIPT_FILE; + + /** + * The main startup point for the self-executing agent update jar. + * + * @param args the command line arguments + */ + public static void main(String args[]) throws Exception { + AgentUpdate agentUpdate = new AgentUpdate(); + + // check the command line arguments and set our internals based on them + // any exceptions coming out of here will abort the update + try { + agentUpdate.processArguments(args); + } catch (IllegalArgumentException error) { + error.printStackTrace(); + agentUpdate.printSyntax(); + return; + } catch (UnsupportedOperationException helpException) { + // this exception occurs simply when the --help option was specified or help needs to be displayed + try { + System.out.println(new String(agentUpdate.getJarFileContent("README.txt"))); + } catch (Throwable t) { + System.out.println("Cannot show README.txt: " + t); + } + System.out.println(); + agentUpdate.printSyntax(); + System.out.println(); + agentUpdate.showVersion(); + return; + } + + // if the user passed --version, show the version and exit immediately + if (agentUpdate.showVersion) { + agentUpdate.showVersion(); + return; + } + + // where should we log our messages? + File logFile = new File(agentUpdate.logFileArgument); + + // what script should we use? if user did not specify a custom one, use the default + // one located in our classloader; otherwise, find the custom one on file system + URL buildFile; + if (DEFAULT_SCRIPT_FILE.equals(agentUpdate.scriptFileArgument)) { + buildFile = AgentUpdate.class.getClassLoader().getResource(agentUpdate.scriptFileArgument); + } else { + buildFile = new File(agentUpdate.scriptFileArgument).toURI().toURL(); + } + + // set some properties that we can pass to the ANT script + Properties props = agentUpdate.getAgentUpdateVersionProperties(); + props.setProperty("rhq.agent.update.jar-file", agentUpdate.getJarFilename()); + if (agentUpdate.updateFlag) { + props.setProperty("rhq.agent.update.update-flag", "true"); + props.setProperty("rhq.agent.update.update-agent-dir", agentUpdate.oldAgentHomeArgument); + } else if (agentUpdate.installFlag) { + props.setProperty("rhq.agent.update.install-flag", "true"); + props.setProperty("rhq.agent.update.install-agent-dir", agentUpdate.newAgentHomeParentArgument); + } + + // run the ant script now + agentUpdate.startAnt(buildFile, null, props, logFile, !agentUpdate.quietFlag); + + return; + } + + private void showVersion() throws Exception { + System.out.println("============================================"); + System.out.println("RHQ Agent Update Binary Version Information:"); + System.out.println("============================================"); + System.out.println(new String(getJarFileContent(RHQ_AGENT_UPDATE_VERSION_PROPERTIES))); + } + + private String getJarFilename() throws Exception { + if (this.jarFileArgument == null) { + URL propsUrl = this.getClass().getClassLoader().getResource(RHQ_AGENT_UPDATE_VERSION_PROPERTIES); + String propsUrlString = propsUrl.toString(); + // the URL string is something like "jar:file:/dir/foo.jar!/rhq-agent-update-version.properties + // we need to get the filename, so strip the jar stuff off of it + propsUrlString = propsUrlString.replaceFirst("jar:", ""); + propsUrlString = propsUrlString.replaceFirst("!/" + RHQ_AGENT_UPDATE_VERSION_PROPERTIES, ""); + File propsFile = new File(new URI(propsUrlString)); + this.jarFileArgument = propsFile.getAbsolutePath(); + } + + return this.jarFileArgument; + } + + private Properties getAgentUpdateVersionProperties() throws Exception { + byte[] bytes = getJarFileContent(RHQ_AGENT_UPDATE_VERSION_PROPERTIES); + InputStream propertiesStream = new ByteArrayInputStream(bytes); + Properties versionProps = new Properties(); + versionProps.load(propertiesStream); + return versionProps; + } + + private byte[] getJarFileContent(String filename) throws Exception { + JarFile jarFile = new JarFile(getJarFilename()); // use the jar file because user might have used --jar + JarEntry jarFileEntry = jarFile.getJarEntry(filename); + InputStream jarFileEntryStream = jarFile.getInputStream(jarFileEntry); + return slurp(jarFileEntryStream); + } + + private void printSyntax() { + System.out.println("Valid options are:"); + System.out.println("[--help] : Help information on how to use this jar file."); + System.out.println("[--version] : Shows version information about this jar file and exits."); + System.out.println("[--update[=<old agent home>]] : When specified, this will update an existing"); + System.out.println(" agent. If you do not specify the directory"); + System.out.println(" where the existing agent is, the default is:"); + System.out.println(" " + DEFAULT_OLD_AGENT_HOME); + System.out.println(" This is mutually exclusive of --install"); + System.out.println("[--install[=<new agent dir>]] : When specified, this will install a new agent"); + System.out.println(" without attempting to update any existing"); + System.out.println(" agent. If you do not specify the directory,"); + System.out.println(" the default is:" + DEFAULT_NEW_AGENT_HOME_PARENT); + System.out.println(" Note the directory will be the parent of the"); + System.out.println(" new agent home installation directory."); + System.out.println(" This is mutually exclusive of --update"); + System.out.println("[--quiet] : If specified, this turns off console log messages."); + System.out.println("[--jar=<jar file>] : If specified, the agent found in the given jar file will"); + System.out.println(" be the new one that will be installed. You usually do not"); + System.out.println(" have to specify this, since the jar running this update"); + System.out.println(" code will usually be the one that contains the agent to"); + System.out.println(" be installed. Do not use this unless you have a reason."); + System.out.println("[--log=<log file>] : If specified, this is where the log messages will be"); + System.out.println(" written. Default=" + DEFAULT_LOG_FILE); + System.out.println("[--script=<ant script>] : If specified, this will override the default"); + System.out.println(" upgrade script URL found in the classloader."); + System.out.println(" Users will rarely need this;"); + System.out.println(" use this only if you know what you are doing."); + System.out.println(" Default=" + DEFAULT_SCRIPT_FILE); + } + + /** + * Processes the command line arguments passed to the self-executing jar. + * + * @param args the arguments to process + * + * @throws UnsupportedOperationException if the help option was specified + * @throws IllegalArgumentException if an argument was invalid + * @throws FileNotFoundException if --update is specified with an invalid agent home directory + */ + private void processArguments(String args[]) throws Exception { + + // if no arguments were specified, then we assume user needs help + if (args.length <= 0) { + throw new UnsupportedOperationException(); + } + + String sopts = "u::i::qhvl:j:s:"; + LongOpt[] lopts = { new LongOpt("update", LongOpt.OPTIONAL_ARGUMENT, null, 'u'), // updates existing agent + new LongOpt("install", LongOpt.OPTIONAL_ARGUMENT, null, 'i'), // installs agent + new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'), // if not set, dumps log message to stdout too + new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'), // will show the syntax help + new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'v'), // shows version info + new LongOpt("log", LongOpt.REQUIRED_ARGUMENT, null, 'l'), // location of the log file + new LongOpt("jar", LongOpt.REQUIRED_ARGUMENT, null, 'j'), // location of an external jar that has our agent + new LongOpt("script", LongOpt.REQUIRED_ARGUMENT, null, 's') }; // switch immediately to the given server + + Getopt getopt = new Getopt(AgentUpdate.class.getSimpleName(), args, sopts, lopts); + int code; + + while ((code = getopt.getopt()) != -1) { + switch (code) { + case ':': + case '?': + case 1: { + throw new IllegalArgumentException("Bad argument!"); + } + + case 'u': { + this.updateFlag = true; + String value = getopt.getOptarg(); + if (value != null) { + this.oldAgentHomeArgument = value; + } + + // make sure the directory actually exists + File agentHome = new File(this.oldAgentHomeArgument); + if (!agentHome.exists() || !agentHome.isDirectory()) { + throw new FileNotFoundException("There is no agent located at: " + this.oldAgentHomeArgument); + } + + // be nice for the user - if the user specified the agent's parent directory, + // then set the old agent home argument to the "real" agent home directory + File possibleHomeDir = new File(agentHome, "rhq-agent"); + if (possibleHomeDir.exists() && possibleHomeDir.isDirectory()) { + agentHome = possibleHomeDir; + } + + // make it an absolute path + this.oldAgentHomeArgument = agentHome.getAbsolutePath(); + break; + } + + case 'i': { + this.installFlag = true; + String value = getopt.getOptarg(); + if (value != null) { + this.newAgentHomeParentArgument = value; + } + break; + } + + case 'q': { + this.quietFlag = true; + break; + } + + case 'h': { + throw new UnsupportedOperationException(); + } + + case 'v': { + this.showVersion = true; + break; + } + + case 'l': { + this.logFileArgument = getopt.getOptarg(); + break; + } + + case 'j': { + this.jarFileArgument = getopt.getOptarg(); + File jarFile = new File(this.jarFileArgument); + if (!jarFile.exists() || !jarFile.isFile()) { + throw new FileNotFoundException("There is no agent jar located at: " + this.jarFileArgument); + } + break; + } + + case 's': { + this.scriptFileArgument = getopt.getOptarg(); + break; + } + } + } + + if (getopt.getOptind() < args.length) { + throw new IllegalArgumentException("Bad arguments."); + } + + if (this.showVersion) { + return; // do not continue, this will exit the VM after showing the version info + } + + if (this.updateFlag && this.installFlag) { + throw new IllegalArgumentException("Cannot use both --update and --install"); + } + + if (!this.updateFlag && !this.installFlag) { + throw new IllegalArgumentException("Must specify either --update or --install"); + } + + return; + } + + private byte[] slurp(InputStream stream) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + long numBytesCopied = 0; + int bufferSize = 32768; + + try { + // make sure we buffer the input + stream = new BufferedInputStream(stream, bufferSize); + byte[] buffer = new byte[bufferSize]; + for (int bytesRead = stream.read(buffer); bytesRead != -1; bytesRead = stream.read(buffer)) { + out.write(buffer, 0, bytesRead); + numBytesCopied += bytesRead; + } + } catch (IOException ioe) { + throw new RuntimeException("Stream data cannot be slurped", ioe); + } finally { + try { + stream.close(); + } catch (IOException ioe2) { + } + } + + return out.toByteArray(); + } + + /** + * Launches ANT and runs the default target in the given build file. + * + * @param buildFile the build file that ANT will run + * @param customTaskDefs the properties file found in classloader that contains all the taskdef definitions + * @param properties set of properties to set for the ANT task to access + * @param logFile where ANT messages will be logged + * @param logStdOut if <code>true</code>, log messages will be sent to stdout as well as the log file + * + * @throws RuntimeException + */ + private void startAnt(URL buildFile, String customTaskDefs, Properties properties, File logFile, boolean logStdOut) { + PrintWriter logFileOutput = null; + + try { + logFileOutput = new PrintWriter(new FileOutputStream(logFile)); + + ClassLoader classLoader = getClass().getClassLoader(); + + Properties taskDefs = new Properties(); + if (customTaskDefs != null) { + InputStream taskDefsStream = classLoader.getResourceAsStream(customTaskDefs); + try { + taskDefs.load(taskDefsStream); + } finally { + taskDefsStream.close(); + } + } + + Project project = new Project(); + project.setCoreLoader(classLoader); + project.init(); + + // notice we are adding the listener before we set the properties - if we do not want the + // the properties echoed out in the log (e.g. if they contain sensitive passwords) + // we should do this after we set the properties. + project.addBuildListener(new LoggerAntBuildListener(logFileOutput, Project.MSG_VERBOSE)); + if (logStdOut) { + project.addBuildListener(new LoggerAntBuildListener(new PrintWriter(System.out), Project.MSG_INFO)); + } + + if (properties != null) { + for (Map.Entry<Object, Object> property : properties.entrySet()) { + project.setProperty(property.getKey().toString(), property.getValue().toString()); + } + } + + for (Map.Entry<Object, Object> taskDef : taskDefs.entrySet()) { + project.addTaskDefinition(taskDef.getKey().toString(), Class.forName(taskDef.getValue().toString(), + true, classLoader)); + } + + new ProjectHelper2().parse(project, buildFile); + project.executeTarget(project.getDefaultTarget()); + } catch (Exception e) { + throw new RuntimeException("Cannot run ANT on script [" + buildFile + "]. Cause: " + e, e); + } finally { + if (logFileOutput != null) { + logFileOutput.close(); + } + } + } +} </span></pre></div> <a id="rhqtrunkmodulesenterpriseagentupdatesrcmainjavaorgrhqenterpriseagentupdateAgentUpdatejava"></a> <div class="propset"><h4>Property changes: rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/AgentUpdate.java</h4> <pre class="diff"> </pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Added: rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/LoggerAntBuildListener.java </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/LoggerAntBuildListener.java (rev 0) </span><span class="add">+++ rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/LoggerAntBuildListener.java 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -0,0 +1,110 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.enterprise.agent.update; + +import java.io.PrintWriter; +import java.util.Date; + +import org.apache.tools.ant.BuildEvent; +import org.apache.tools.ant.BuildListener; +import org.apache.tools.ant.Target; +import org.apache.tools.ant.Task; + +/** + * Listens for ANT build events and logs them to a log stream. + * + * @author John Mazzitelli + */ +public class LoggerAntBuildListener implements BuildListener { + private PrintWriter output; + private int priorityThreshold; + + public LoggerAntBuildListener(PrintWriter logFile, int priorityThreshold) { + this.output = logFile; + this.priorityThreshold = priorityThreshold; + + // just output our first line with the date this was started + this.output.println(new Date().toString()); + } + + public void buildFinished(BuildEvent event) { + logEvent(event, "FINISHED!"); + } + + public void buildStarted(BuildEvent event) { + logEvent(event, "STARTED!"); + } + + public void messageLogged(BuildEvent event) { + logEvent(event, null); + } + + public void targetFinished(BuildEvent event) { + logEvent(event, null); + } + + public void targetStarted(BuildEvent event) { + logEvent(event, null); + } + + public void taskFinished(BuildEvent event) { + logEvent(event, null); + } + + public void taskStarted(BuildEvent event) { + logEvent(event, null); + } + + private void logEvent(BuildEvent event, String additionalMessage) { + if (event.getPriority() > this.priorityThreshold) { + return; + } + + String message = event.getMessage(); + Throwable exception = event.getException(); + Target target = event.getTarget(); + Task task = event.getTask(); + + if (additionalMessage != null) { + output.println(additionalMessage); + } + + if (target != null) { + output.print("[" + target.getName() + "] "); + } + + if (task != null) { + output.print("[" + task.getTaskName() + "] "); + } + + if (message != null) { + output.print(message); + } + + if (exception != null) { + output.println(); + exception.printStackTrace(output); + } + + output.println(); + output.flush(); + + return; + } +} </span><span class="cx">\ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseagentupdatesrcmainjavaorgrhqenterpriseagentupdateLoggerAntBuildListenerjava"></a> <div class="propset"><h4>Property changes: rhq/trunk/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/LoggerAntBuildListener.java</h4> <pre class="diff"> </pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Added: rhq/trunk/modules/enterprise/agentupdate/src/main/resources/LICENSE </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/agentupdate/src/main/resources/LICENSE (rev 0) </span><span class="add">+++ rhq/trunk/modules/enterprise/agentupdate/src/main/resources/LICENSE 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -0,0 +1,31 @@ </span><span class="add">+RHQ Management Platform +Copyright (C) 2006-2008 Red Hat, Inc. and others +All rights reserved. + +This program is free software; you can redistribute it and/or +modify it under the following terms. + +Parts of this project are available under the terms of the +GNU General Public License, version 2, as published by the Free +Software Foundation. Other parts are available under the +GNU General Public License, version 2, as published by the +Free Software Foundation, and/or the GNU Lesser +General Public License, version 2.1, also as published by the Free +Software Foundation. Which license a module is under is defined +by the header text of the code within a module. + +It is the intention of this license that plugins to this platform +can be distrubuted under other licenses as they link only to the +modules that are also available under the GNU Lesser General +Public License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License and the GNU Lesser General Public License +for more details. + +You should have received a copies of the GNU General Public License +and the GNU Lesser General Public License along with this program; +if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. </span></pre></div> <a id="rhqtrunkmodulesenterpriseagentupdatesrcmainresourcesREADMEtxt"></a> <div class="addfile"><h4>Added: rhq/trunk/modules/enterprise/agentupdate/src/main/resources/README.txt (0 => 1855)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/agentupdate/src/main/resources/README.txt (rev 0) +++ rhq/trunk/modules/enterprise/agentupdate/src/main/resources/README.txt 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -0,0 +1,63 @@ </span><span class="add">+======================= +RHQ Agent Update Binary +======================= + +_______________________ +DESCRIPTION + +This is the RHQ Agent Update Binary jar file. The purpose of this +jar file is to allow you to install a fresh agent on a box +where an agent does not yet exist and to allow you to update +an agent that is already installed. + +This jar file is not meant to be unjar'ed. +It is intended to be run as a "self-executing jar" via the +"java -jar" command. + +Note that a running RHQ Agent will be able to auto-update itself +using this jar file, if the RHQ Agent downloaded this file +during its "auto-update-check" routine. If you do not want to +use or rely on the RHQ Agent's auto-update functionality, +you can use this jar file to manually update an existing agent +by following the instructions below. + +_______________________ +VERSION + +To determine the version of this agent update binary (which is the same +as the agent version itself), you can pass the "--version" command +line option to the self-executing jar file. + +_______________________ +USAGE + +This is a "self-executing" jar file, meaning you can execute it using +the Java command line: + +java -jar <agent-update-binary-filename> + +where <agent-update-binary-filename> is the name of the jar file itself. +If you run that exact command, with no other command line arguments +passed to Java, help information will be displayed on the console. + +If you run this command: + +java -jar <agent-update-binary-filename> --install[=<new-agent-directory>] + +a new agent will be installed in the given directory, or your current +working directory if you do not specify a directory. + +If you run this command: + +java -jar <agent-update-binary-filename> --update[=<old-agent-directory>] + +that will update an existing agent located in the directory +specified by <old-agent-directory>, or in the current working directory +if you do not specify a directory. + +There are additional command line arguments that can be specified +to the agent update binary jar file; to get full help text, run: + +java -jar <agent-update-binary-filename> --help + +which is the same as not passing any command line arguments. </span><span class="cx">Property changes on: rhq/trunk/modules/enterprise/agentupdate/src/main/resources/README.txt ___________________________________________________________________ </span></pre></div> <a id="svnmimetype"></a> <div class="addfile"><h4>Added: svn:mime-type ( => )</h4> <pre class="diff"> <span class="info">Added: svn:keywords + Date Author Id Revision HeadURL </span></pre></div> <a id="svneolstyle"></a> <div class="addfile"><h4>Added: svn:eol-style ( => )</h4> <pre class="diff"> <span class="info"> Added: rhq/trunk/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml </span><span class="cx">=================================================================== </span><span class="rem">--- rhq/trunk/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml (rev 0) </span><span class="add">+++ rhq/trunk/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml 2008-10-28 20:05:01 UTC (rev 1855) </span><span class="lines">@@ -0,0 +1,131 @@ </span><span class="add">+<?xml version="1.0" encoding="UTF-8"?> + +<project name="rhq-agent-update" default="start" basedir="."> + + <!-- the initial target that logs some basic information, then performs the install or update --> + <target name="start" depends="header, verify, install, update"> + </target> + + <!-- performs a base install - this does not attempt to upgrade an agent; this provisions a fresh new agent --> + <target name="install" unless="rhq.agent.update.update-flag"> + <unjar src="${rhq.agent.update.jar-file}" + dest="${basedir}"> + <patternset> + <include name="rhq-enterprise-agent-${rhq-agent.latest.version}.zip"/> + </patternset> + </unjar> + <unzip src="${basedir}/rhq-enterprise-agent-${rhq-agent.latest.version}.zip" + dest="${rhq.agent.update.install-agent-dir}"/> + <delete file="${basedir}/rhq-enterprise-agent-${rhq-agent.latest.version}.zip" + failonerror="false"/> + <echo>Agent version ${rhq-agent.latest.version} (build number=${rhq-agent.latest.build-number}) has been installed to ${rhq.agent.update.install-agent-dir}</echo> + </target> + + <!-- upgrades an existing agent --> + <target name="update" if="rhq.agent.update.update-flag"> + <!-- we build up the new, updated agent in the update-### subdirectory + only when we feel we successfully have a complete agent will we attempt to + move it in the current agent's place --> + <property name="_update.tmp.dir.name" value="update-${rhq-agent.latest.build-number}" /> + <property name="_update.tmp.dir" location="${rhq.agent.update.update-agent-dir}/${_update.tmp.dir.name}" /> + <unjar src="${rhq.agent.update.jar-file}" + dest="${_update.tmp.dir}"> + <patternset> + <include name="rhq-enterprise-agent-${rhq-agent.latest.version}.zip"/> + </patternset> + </unjar> + <unzip src="${_update.tmp.dir}/rhq-enterprise-agent-${rhq-agent.latest.version}.zip" + dest="${_update.tmp.dir}"/> + <delete file="${_update.tmp.dir}/rhq-enterprise-agent-${rhq-agent.latest.version}.zip" + failonerror="false"/> + + <!-- at this point, we have the new but raw agent extracted to the ${_update.tmp.dir}/rhq-agent --> + + <!-- if there are plugins, keep them --> + <copy todir="${_update.tmp.dir}/rhq-agent/plugins"> + <fileset dir="${rhq.agent.update.update-agent-dir}/plugins"/> + </copy> + + <!-- if there is a failover list, keep it --> + <copy file="${rhq.agent.update.update-agent-dir}/data/failover-list.dat" + tofile="${_update.tmp.dir}/rhq-agent/data/failover-list.dat" + failonerror="false" /> + + <!-- copy any custom launch scripts (we are going to lose our UNIX +x permission bits) --> + <move file="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-env.bat" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-env.bat.default" /> + <copy file="${rhq.agent.update.update-agent-dir}/bin/rhq-agent-env.bat" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-env.bat" /> + <move file="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-env.sh" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-env.sh.default"/> + <copy file="${rhq.agent.update.update-agent-dir}/bin/rhq-agent-env.sh" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-env.sh" /> + <move file="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-wrapper.bat" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-wrapper.bat.default"/> + <copy file="${rhq.agent.update.update-agent-dir}/bin/rhq-agent-wrapper.bat" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-wrapper.bat" /> + <move file="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-wrapper.sh" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-wrapper.sh.default"/> + <copy file="${rhq.agent.update.update-agent-dir}/bin/rhq-agent-wrapper.sh" + tofile="${_update.tmp.dir}/rhq-agent/bin/rhq-agent-wrapper.sh" /> + <move file="${_update.tmp.dir}/rhq-agent/bin/wrapper/rhq-agent-wrapper.conf" + tofile="${_update.tmp.dir}/rhq-agent/bin/wrapper/rhq-agent-wrapper.conf.default"/> + <copy file="${rhq.agent.update.update-agent-dir}/bin/wrapper/rhq-agent-wrapper.conf" + tofile="${_update.tmp.dir}/rhq-agent/bin/wrapper/rhq-agent-wrapper.conf" /> + + <!-- copy over the agent-configuration and log4j xml files, but rename them so they do not take effect --> + <copy file="${rhq.agent.update.update-agent-dir}/conf/agent-configuration.xml" + tofile="${_update.tmp.dir}/rhq-agent/conf/agent-configuration.xml.custom" + failonerror="false"/> + <copy file="${rhq.agent.update.update-agent-dir}/conf/log4j.xml" + tofile="${_update.tmp.dir}/rhq-agent/conf/log4j.xml.custom" + failonerror="false"/> + + <!-- every... [truncated message content] |