[rhq] Branch 'bundle' - 3 commits -
by mazz
0 files changed
New commits:
commit c11e82d0d7423cb60effde78428b93773da518d9
Merge: 65fb0e6... 5bdb6fe...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 16:52:18 2010 -0400
Merge branch 'bundle'
commit 65fb0e66d977493d1c919c1c3cf3a2ea0a5889fc
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 14:39:40 2010 -0400
fixing two problems with the way LD_LIB_PATH was set:
1) don't set and export on the same line - I've seen instances where you can't export and set together (can't remember if is was OS specific or shell specific, but either way, always export separately)
2) remember to append existing path but only if it exists (never end with an empty ":" because it will infer "." in the path)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh b/modules/enterprise/agent/src/etc/rhq-agent.sh
index fc48d7a..a94a761 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent.sh
@@ -185,11 +185,17 @@ fi
debug_msg "RHQ_AGENT_CMDLINE_OPTS: $RHQ_AGENT_CMDLINE_OPTS"
# ----------------------------------------------------------------------
-# Prepare LD_LIBRARY_PATH for apache
+# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent
# ----------------------------------------------------------------------
if [ "x$_LINUX" != "x" ]; then
-export LD_LIBRARY_PATH=${RHQ_AGENT_HOME}/lib
+ if [ "x$LD_LIBRARY_PATH" = "x" ]; then
+ LD_LIBRARY_PATH="${RHQ_AGENT_HOME}/lib"
+ else
+ LD_LIBRARY_PATH="${RHQ_AGENT_HOME}/lib:${LD_LIBRARY_PATH}"
+ fi
+ export LD_LIBRARY_PATH
+ debug_msg "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
fi
# ----------------------------------------------------------------------
commit 56dae8a4278fc1a36a865dbdee87552d16ccf130
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri May 28 14:04:24 2010 -0400
rhq AntMain now executes stop+(install|upgrade)+start phases if rhq.deploy.phase prop is not specified on command line; system-service type now supports start and stop phase and ensures MD5s are calculated for init script and config file; other misc fixes and improvements
(cherry picked from commit f877b026411bb0ee5f8f4ebd0f0c85aa593916c0)
diff --git a/etc/modules/sample-bundle/src/main/jbossas-init-script b/etc/modules/sample-bundle/src/main/jbossas-init-script
index 218616f..58eb98e 100755
--- a/etc/modules/sample-bundle/src/main/jbossas-init-script
+++ b/etc/modules/sample-bundle/src/main/jbossas-init-script
@@ -2,7 +2,8 @@
#
# jbossas - This shell script takes care of starting and stopping
# a JBoss Application Server (AS) instance on a Red Hat
-# Linux system.
+# Linux system. It can be run as a system service (init
+# script) and/or run manually.
#
# chkconfig: 345 84 16
# description: JBoss AS server
diff --git a/etc/modules/sample-bundle/src/main/rhq-bundle.xml b/etc/modules/sample-bundle/src/main/rhq-bundle.xml
index 7ed429a..8bfec17 100644
--- a/etc/modules/sample-bundle/src/main/rhq-bundle.xml
+++ b/etc/modules/sample-bundle/src/main/rhq-bundle.xml
@@ -23,7 +23,8 @@
required="true"
type="integer"/>
- <rhq:deployment name="appserver" preinstallTarget="appserver-preinstall">
+ <rhq:deployment-unit name="appserver"
+ preinstallTarget="appserver-preinstall" postinstallTarget="appserver-postinstall">
<rhq:system-service name="jbossas-petstore" scriptFile="jbossas-init-script"
configFile="jbossas-init-config" overwriteScript="true"
startLevels="3,4,5" startPriority="80" stopPriority="20"/>
@@ -39,7 +40,7 @@
<include name="server/default/work/**"/>
</rhq:fileset>
</rhq:ignore>
- </rhq:deployment>
+ </rhq:deployment-unit>
</rhq:bundle>
@@ -49,4 +50,8 @@
<echo>Installing Java Petstore App Server to ${rhq.deploy.dir}...</echo>
</target>
+ <target name="appserver-postinstall">
+ <echo>Done installing Java Petstore App Server to ${rhq.deploy.dir}.</echo>
+ </target>
+
</project>
diff --git a/etc/modules/sample-bundle/src/main/scripts/build.xml b/etc/modules/sample-bundle/src/main/scripts/build.xml
index c3dcd85..f182518 100644
--- a/etc/modules/sample-bundle/src/main/scripts/build.xml
+++ b/etc/modules/sample-bundle/src/main/scripts/build.xml
@@ -9,8 +9,9 @@
<!-- download JBossAS 6.0 dist from sourceforge and unzip it -->
<property name="tmp.dir" location="${java.io.tmpdir}/${user.name}"/>
<echo>tmp.dir="${tmp.dir}"</echo>
- <mkdir dir="${tmp.dir}"/>
- <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M2/jboss..."
+ <mkdir dir="${tmp.dir}"/>
+
+ <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M3/jboss..."
dest="${tmp.dir}/jbossas.zip"
usetimestamp="true"/>
<property name="jboss.home" location="target/jbossas-petstore"/>
@@ -18,7 +19,7 @@
<mkdir dir="${jboss.home}"/>
<unzip src="${tmp.dir}/jbossas.zip" dest="${jboss.home}">
<mapper>
- <globmapper from="jboss-6.0.0.20100216-M2/*" to="*"/>
+ <globmapper from="jboss-6.0.0.20100429-M3/*" to="*"/>
</mapper>
</unzip>
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
index 34177b0..5acea7e 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
@@ -38,6 +38,7 @@ import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.util.ClasspathUtils;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ProxySetup;
+import org.rhq.core.util.updater.DeploymentsMetadata;
/**
* Command line entry point into RHQ Ant. This class is entered
@@ -606,134 +607,158 @@ public class AntMain implements org.apache.tools.ant.launch.AntMain {
* @exception BuildException if the build fails
*/
private void runBuild(ClassLoader coreLoader) throws BuildException {
-
if (!readyToRun) {
return;
}
- // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields.
- final Project project = new BundleAntProject();
- project.setCoreLoader(coreLoader);
-
- Throwable error = null;
-
- try {
- addBuildListeners(project);
- addInputHandler(project);
-
- PrintStream savedErr = System.err;
- PrintStream savedOut = System.out;
- InputStream savedIn = System.in;
-
- // use a system manager that prevents from System.exit()
- SecurityManager oldsm = null;
- oldsm = System.getSecurityManager();
-
- //SecurityManager can not be installed here for backwards
- //compatibility reasons (PD). Needs to be loaded prior to
- //ant class if we are going to implement it.
- //System.setSecurityManager(new NoExitSecurityManager());
+ // RHQ
+ DeploymentPhase[] lifecycle = getLifecycle();
+ for (DeploymentPhase phase : lifecycle) {
+ System.out.println("***** Executing " + phase + " phase *****...");
+ // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields.
+ Project project = new BundleAntProject();
+ Throwable error = null;
try {
- if (allowInput) {
- project.setDefaultInputStream(System.in);
+ initProject(project, coreLoader, phase);
+ if (projectHelp) {
+ printDescription(project);
+ printTargets(project, msgOutputLevel > Project.MSG_INFO);
+ } else {
+ // make sure that we have a target to execute
+ // TODO: For RHQ, we actually might want to enforce that they do NOT specify a target and just always
+ // execute the "" target.
+ if (targets.isEmpty()) {
+ if (project.getDefaultTarget() != null) {
+ targets.addElement(project.getDefaultTarget());
+ }
+ }
+ project.executeTargets(targets);
}
- System.setIn(new DemuxInputStream(project));
- System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
- System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
-
-
+ } catch (RuntimeException exc) {
+ error = exc;
+ throw exc;
+ } catch (Error e) {
+ error = e;
+ throw e;
+ } finally {
if (!projectHelp) {
- project.fireBuildStarted();
- }
-
- // set the thread priorities
- if (threadPriority != null) {
try {
- project.log("Setting Ant's thread priority to "
- + threadPriority, Project.MSG_VERBOSE);
- Thread.currentThread().setPriority(threadPriority.intValue());
- } catch (SecurityException swallowed) {
- //we cannot set the priority here.
- project.log("A security manager refused to set the -nice value");
+ project.fireBuildFinished(error);
+ } catch (Throwable t) {
+ // yes, I know it is bad style to catch Throwable,
+ // but if we don't, we lose valuable information
+ System.err.println("Caught an exception while logging the"
+ + " end of the build. Exception was:");
+ t.printStackTrace();
+ if (error != null) {
+ System.err.println("There has been an error prior to"
+ + " that:");
+ error.printStackTrace();
+ }
+ throw new BuildException(t);
}
+ } else if (error != null) {
+ project.log(error.toString(), Project.MSG_ERR);
}
+ }
+ }
+ }
+ private DeploymentPhase[] getLifecycle() {
+ String deployDirString = definedProps.getProperty(DeployPropertyNames.DEPLOY_DIR);
+ File deployDir = new File(deployDirString);
+ DeploymentsMetadata deployMetadata = new DeploymentsMetadata(deployDir);
+ boolean isRedeploy = deployMetadata.isManaged();
- project.init();
+ DeploymentPhase[] lifecycle;
+ String phaseString = definedProps.getProperty(DeployPropertyNames.DEPLOY_PHASE);
+ if (phaseString == null) {
+ lifecycle = (isRedeploy) ? DeploymentPhase.REDEPLOY_LIFECYCLE : DeploymentPhase.DEPLOY_LIFECYCLE;
+ } else {
+ DeploymentPhase phase = DeploymentPhase.valueOf(phaseString.toUpperCase());
+ lifecycle = new DeploymentPhase[] {phase};
+ }
+ return lifecycle;
+ }
- // set user-define properties
- Enumeration e = definedProps.keys();
- while (e.hasMoreElements()) {
- String arg = (String) e.nextElement();
- String value = (String) definedProps.get(arg);
- project.setUserProperty(arg, value);
- }
+ private void initProject(Project project, ClassLoader coreLoader, DeploymentPhase phase) {
+ project.setCoreLoader(coreLoader);
+ project.setProperty(DeployPropertyNames.DEPLOY_PHASE, phase.name());
- project.setUserProperty(MagicNames.ANT_FILE,
- buildFile.getAbsolutePath());
- project.setUserProperty(MagicNames.ANT_FILE_TYPE,
- MagicNames.ANT_FILE_TYPE_FILE);
+ addBuildListeners(project);
+ addInputHandler(project);
- project.setKeepGoingMode(keepGoingMode);
- if (proxy) {
- //proxy setup if enabled
- ProxySetup proxySetup = new ProxySetup(project);
- proxySetup.enableProxies();
- }
+ PrintStream savedErr = System.err;
+ PrintStream savedOut = System.out;
+ InputStream savedIn = System.in;
- ProjectHelper.configureProject(project, buildFile);
+ // use a system manager that prevents from System.exit()
+ SecurityManager oldsm = null;
+ oldsm = System.getSecurityManager();
- if (projectHelp) {
- printDescription(project);
- printTargets(project, msgOutputLevel > Project.MSG_INFO);
- return;
- }
+ //SecurityManager can not be installed here for backwards
+ //compatibility reasons (PD). Needs to be loaded prior to
+ //ant class if we are going to implement it.
+ //System.setSecurityManager(new NoExitSecurityManager());
+ try {
+ if (allowInput) {
+ project.setDefaultInputStream(System.in);
+ }
+ System.setIn(new DemuxInputStream(project));
+ System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
+ System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
- // make sure that we have a target to execute
- if (targets.size() == 0) {
- if (project.getDefaultTarget() != null) {
- targets.addElement(project.getDefaultTarget());
- }
- }
- project.executeTargets(targets);
- } finally {
- // put back the original security manager
- //The following will never eval to true. (PD)
- if (oldsm != null) {
- System.setSecurityManager(oldsm);
+ if (!projectHelp) {
+ project.fireBuildStarted();
+ }
+
+ // set the thread priorities
+ if (threadPriority != null) {
+ try {
+ project.log("Setting Ant's thread priority to "
+ + threadPriority, Project.MSG_VERBOSE);
+ Thread.currentThread().setPriority(threadPriority.intValue());
+ } catch (SecurityException swallowed) {
+ //we cannot set the priority here.
+ project.log("A security manager refused to set the -nice value");
}
+ }
+
+
+ project.init();
+
+ // set user-define properties
+ Enumeration e = definedProps.keys();
+ while (e.hasMoreElements()) {
+ String arg = (String) e.nextElement();
+ String value = (String) definedProps.get(arg);
+ project.setUserProperty(arg, value);
+ }
+
+ project.setUserProperty(MagicNames.ANT_FILE,
+ buildFile.getAbsolutePath());
+ project.setUserProperty(MagicNames.ANT_FILE_TYPE,
+ MagicNames.ANT_FILE_TYPE_FILE);
- System.setOut(savedOut);
- System.setErr(savedErr);
- System.setIn(savedIn);
+ project.setKeepGoingMode(keepGoingMode);
+ if (proxy) {
+ //proxy setup if enabled
+ ProxySetup proxySetup = new ProxySetup(project);
+ proxySetup.enableProxies();
}
- } catch (RuntimeException exc) {
- error = exc;
- throw exc;
- } catch (Error e) {
- error = e;
- throw e;
+
+ ProjectHelper.configureProject(project, buildFile);
} finally {
- if (!projectHelp) {
- try {
- project.fireBuildFinished(error);
- } catch (Throwable t) {
- // yes, I know it is bad style to catch Throwable,
- // but if we don't, we lose valuable information
- System.err.println("Caught an exception while logging the"
- + " end of the build. Exception was:");
- t.printStackTrace();
- if (error != null) {
- System.err.println("There has been an error prior to"
- + " that:");
- error.printStackTrace();
- }
- throw new BuildException(t);
- }
- } else if (error != null) {
- project.log(error.toString(), Project.MSG_ERR);
+ // put back the original security manager
+ //The following will never eval to true. (PD)
+ if (oldsm != null) {
+ System.setSecurityManager(oldsm);
}
+
+ System.setOut(savedOut);
+ System.setErr(savedErr);
+ System.setIn(savedIn);
}
}
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
index 4f87ab6..67c6fcd 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
@@ -2,7 +2,7 @@ package org.rhq.bundle.ant;
/**
* A bundle deployment phase. One or more tasks are associated with each phase. The phases are executed as part of
- * three user-initiated actions:
+ * three user-initiated lifecycles:
*
* Deploy: INSTALL,START
* Redeploy: STOP,UPGRADE,START
@@ -17,6 +17,15 @@ public enum DeploymentPhase {
UPGRADE,
UNINSTALL;
+ public static final DeploymentPhase[] DEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.INSTALL, DeploymentPhase.START};
+
+ public static final DeploymentPhase[] REDEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UPGRADE, DeploymentPhase.START};
+
+ public static final DeploymentPhase[] UNDEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UNINSTALL};
+
@Override
public String toString() {
return name().toLowerCase();
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
index 8e3c066..88bb491 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
@@ -52,6 +52,7 @@ public class BundleTask extends AbstractBundleTask {
super.maybeConfigure();
validateAttributes();
+ // TODO: Figure out why the Ant parse() method is not initializing the child Type objects.
//validateTypes();
getProject().setBundleName(this.name);
@@ -60,8 +61,7 @@ public class BundleTask extends AbstractBundleTask {
}
/**
- * The RHQ Ant launcher will ensure that the following Ant project properties are defined prior to this method being
- * invoked:
+ * The following Ant project properties must be defined with valid values prior to this method being invoked:
*
* rhq.deploy.id - the {@link org.rhq.core.domain.bundle.BundleDeployment deployment}'s unique id
* (e.g. "10001")
@@ -72,7 +72,7 @@ public class BundleTask extends AbstractBundleTask {
* If the bundle recipe is being executed from the command line, the user must supply these properties, along
* with any input properties required by the bundle recipe.
*
- * @throws BuildException
+ * @throws BuildException if an error occurs
*/
@Override
public void execute() throws BuildException {
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
index df72add..699bbf7 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
@@ -20,6 +20,7 @@ package org.rhq.bundle.ant.type;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
+import org.rhq.bundle.ant.DeployPropertyNames;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.system.SystemInfoFactory;
@@ -69,8 +70,15 @@ public class DeploymentUnitType extends AbstractBundleType {
getProject().getBundleVersion(), getProject().getBundleDescription());
File deployDir = getProject().getDeployDir();
TemplateEngine templateEngine = createTemplateEngine();
+ if (this.systemService != null) {
+ this.files.put(this.systemService.getScriptFile(), this.systemService.getScriptDestFile());
+ if (this.systemService.getConfigFile() != null) {
+ this.files.put(this.systemService.getConfigFile(), this.systemService.getConfigDestFile());
+ this.rawFilesToReplace.add(this.systemService.getConfigFile());
+ }
+ }
if (this.files.isEmpty() && this.archives.isEmpty()) {
- throw new BuildException("You must specify at least one file to deploy via nested rhq:file and/or rhq:archive elements.");
+ throw new BuildException("You must specify at least one file to deploy via nested rhq:file, rhq:archive, and/or rhq:system-service elements.");
}
if (!this.files.isEmpty()) {
log("Deploying files " + this.files + "...", Project.MSG_VERBOSE);
@@ -113,11 +121,15 @@ public class DeploymentUnitType extends AbstractBundleType {
}
public void start() throws BuildException {
-
+ if (this.systemService != null) {
+ this.systemService.start();
+ }
}
public void stop() throws BuildException {
-
+ if (this.systemService != null) {
+ this.systemService.stop();
+ }
}
public void upgrade(boolean revert, boolean clean) throws BuildException {
@@ -125,7 +137,9 @@ public class DeploymentUnitType extends AbstractBundleType {
}
public void uninstall() throws BuildException {
- // TODO
+ if (this.systemService != null) {
+ this.systemService.uninstall();
+ }
}
public String getName() {
@@ -173,6 +187,7 @@ public class DeploymentUnitType extends AbstractBundleType {
throw new IllegalStateException("A deployment can only have one system-service child element.");
}
this.systemService = systemService;
+ this.systemService.init();
}
public void addConfigured(FileType file) {
@@ -207,6 +222,9 @@ public class DeploymentUnitType extends AbstractBundleType {
for (PropertySimple prop : config.getSimpleProperties().values()) {
templateEngine.getTokens().put(prop.getName(), prop.getStringValue());
}
+ // And add the special rhq.deploy.dir prop.
+ templateEngine.getTokens().put(DeployPropertyNames.DEPLOY_DIR,
+ getProject().getProperty(DeployPropertyNames.DEPLOY_DIR));
return templateEngine;
}
}
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
index f3ef36c..3e3c1ee 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
@@ -11,7 +11,8 @@
* 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
+ *
+ * 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.
*/
@@ -73,47 +74,72 @@ public class SystemServiceType extends AbstractBundleType {
private Set<Character> startLevelChars;
private Set<Character> stopLevelChars;
- public void install() throws BuildException {
+ private File scriptDestFile;
+ private File configDestFile;
+
+ public void init() throws BuildException {
if (!OS_NAME.equals("Linux") || !REDHAT_RELEASE_FILE.exists() ) {
throw new BuildException("The system-service element is only supported on Red Hat Linux systems.");
}
validateAttributes();
+ this.scriptDestFile = new File(getInitDir(), this.name);
+ this.configDestFile = new File(getSysConfigDir(), this.name);
+ }
+
+ public void install() throws BuildException {
// Install the config file if one was provided (e.g. /etc/sysconfig/named).
if (this.configFile != null) {
- File sysconfigDir = new File(this.root, SYSCONFIG_DIR.getPath().substring(1));
+ File sysconfigDir = getSysConfigDir();
if (!sysconfigDir.exists()) {
sysconfigDir.mkdirs();
}
if (!sysconfigDir.canWrite()) {
throw new BuildException(sysconfigDir + " directory is not writeable.");
}
- File configDestFile = new File(sysconfigDir, this.name);
- copyFile(this.configFile, configDestFile, this.overwriteConfig);
- setPermissions(configDestFile, "644");
+ // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata
+ // (i.e. MD5) can be calculated and saved.
+ //copyFile(this.configFile, this.configDestFile, this.overwriteConfig);
+ setPermissions(this.configDestFile, "644");
}
// Install the script itself (e.g. /etc/init.d/named).
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
+ File initDir = getInitDir();
if (!initDir.exists()) {
initDir.mkdirs();
}
if (!initDir.canWrite()) {
throw new BuildException(initDir + " directory is not writeable.");
}
- File scriptDestFile = new File(initDir, this.name);
- getProject().log("Installing service script " + scriptDestFile + "...");
- copyFile(this.scriptFile, scriptDestFile, this.overwriteScript);
- setPermissions(scriptDestFile, "755");
+ getProject().log("Installing service script " + this.scriptDestFile + "...");
+ // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata
+ // (i.e. MD5) can be calculated and saved.
+ //copyFile(this.scriptFile, scriptDestFile, this.overwriteScript);
+ setPermissions(this.scriptDestFile, "755");
// Create the symlinks in the rcX.d dirs (e.g. /etc/rc3.d/S24named -> ../init.d/named)
- createScriptSymlinks(scriptDestFile, this.startPriority, this.startLevelChars, 'S');
- createScriptSymlinks(scriptDestFile, this.stopPriority, this.stopLevelChars, 'K');
+ createScriptSymlinks(this.scriptDestFile, this.startPriority, this.startLevelChars, 'S');
+ createScriptSymlinks(this.scriptDestFile, this.stopPriority, this.stopLevelChars, 'K');
+ }
+
+ private File getInitDir() {
+ return new File(this.root, INIT_DIR.getPath().substring(1));
+ }
+
+ public File getScriptDestFile() {
+ return this.scriptDestFile;
+ }
+
+ private File getSysConfigDir() {
+ return new File(this.root, SYSCONFIG_DIR.getPath().substring(1));
+ }
+
+ public File getConfigDestFile() {
+ return this.configDestFile;
}
public void start() throws BuildException {
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
- File scriptFile = new File(initDir, this.name);
+ File scriptFile = getScriptDestFile();
String[] commandLine = {scriptFile.getAbsolutePath(), "start"};
try {
executeCommand(commandLine);
@@ -124,8 +150,7 @@ public class SystemServiceType extends AbstractBundleType {
}
public void stop() throws BuildException {
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
- File scriptFile = new File(initDir, this.name);
+ File scriptFile = getScriptDestFile();
String[] commandLine = {scriptFile.getAbsolutePath(), "stop"};
try {
executeCommand(commandLine);
@@ -151,16 +176,26 @@ public class SystemServiceType extends AbstractBundleType {
return scriptFile;
}
- public void setScriptFile(File scriptFile) {
- this.scriptFile = scriptFile;
+ public void setScriptFile(String scriptFile) {
+ File file = new File(scriptFile);
+ if (file.isAbsolute()) {
+ throw new BuildException("Path specified by 'scriptFile' attribute (" + scriptFile
+ + ") is not relative - it must be a relative path, relative to the Ant basedir.");
+ }
+ this.scriptFile = getProject().resolveFile(scriptFile);
}
public File getConfigFile() {
return configFile;
}
- public void setConfigFile(File configFile) {
- this.configFile = configFile;
+ public void setConfigFile(String configFile) {
+ File file = new File(configFile);
+ if (file.isAbsolute()) {
+ throw new BuildException("Path specified by 'configFile' attribute (" + configFile
+ + ") is not relative - it must be a relative path, relative to the Ant basedir.");
+ }
+ this.configFile = getProject().resolveFile(configFile);
}
public boolean isOverwriteScript() {
14 years, 1 month
[rhq] Branch 'bundle' - 2 commits - modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/FavoritesMenu.java | 112 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/GWTMenuBarView.java | 27 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 16 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 7
5 files changed, 162 insertions(+), 1 deletion(-)
New commits:
commit 5bdb6fe17d3a1ccea92377c4961bec9f426734b4
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri May 28 16:46:40 2010 -0400
favorites menu in menubar
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 9231cbc..b6c9cd4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -123,6 +123,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
SubjectCriteria criteria = new SubjectCriteria();
criteria.fetchConfiguration(true);
criteria.addFilterId(subjectId);
+ criteria.fetchRoles(true);
GWTServiceLookup.getSubjectService().findSubjectsByCriteria(criteria, new AsyncCallback<PageList<Subject>>() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/FavoritesMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/FavoritesMenu.java
new file mode 100644
index 0000000..a13e705
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/FavoritesMenu.java
@@ -0,0 +1,112 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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, 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.
+ *
+ * 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 copy 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.
+ */
+package org.rhq.enterprise.gui.coregui.client.menu;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+
+/**
+ * @author Greg Hinkle
+ */
+public class FavoritesMenu extends MenuItem {
+
+ private Menu submenu;
+
+ public FavoritesMenu() {
+ super();
+ setTitle("Favorites");
+
+ submenu = new Menu();
+ setSubmenu(submenu);
+
+ }
+
+ public void refresh() {
+ Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
+
+ if (!favorites.isEmpty()) {
+
+ Integer[] resourceIds = new Integer[favorites.size()];
+ final MenuItem[] items = new MenuItem[favorites.size()];
+ final Map<Integer, MenuItem> idToMenuItemMap = new HashMap<Integer, MenuItem>(favorites.size());
+ int i = 0;
+ for (final Integer resourceId : favorites) {
+ resourceIds[i] = resourceId;
+ MenuItem item = new MenuItem(String.valueOf(resourceId));
+ item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ History.newItem("Resource/" + resourceId);
+ }
+ });
+ items[i] = item;
+ idToMenuItemMap.put(resourceId, item);
+ i++;
+ }
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterIds(resourceIds);
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load favorite Resources.", caught);
+ }
+
+ public void onSuccess(PageList<Resource> resources) {
+ for (Resource resource : resources) {
+ MenuItem item = idToMenuItemMap.get(resource.getId());
+ // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
+ // disambiguated Resource names.
+ item.setTitle(resource.getName());
+
+ String category = resource.getResourceType().getCategory().getDisplayName();
+
+ String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
+ ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
+ item.setIcon("types/" + category + "_" + avail + "_16.png");
+ }
+ submenu.setItems(items);
+ }
+ });
+ }
+
+
+ }
+
+
+}
+
+
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/GWTMenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/GWTMenuBarView.java
index b4723e5..0c88b06 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/GWTMenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/GWTMenuBarView.java
@@ -156,4 +156,31 @@ public class GWTMenuBarView extends VLayout {
addMember(menu);
}
+ private String setupLinks() {
+ StringBuilder headerString = new StringBuilder(
+ "<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+
+ boolean first = true;
+ for (String section : SECTIONS) {
+ if (first) {
+ headerString.append("<td style=\"width: 1px;\"><img src=\"images/header/header_bg_line.png\"/></td>");
+ }
+ first = false;
+
+ String styleClass = "TopSectionLink";
+ if (section.equals(selected)) {
+ styleClass += "Selected";
+ }
+
+ headerString.append("<td class=\"" + styleClass + "\" onclick=\"document.location='#" + section + "'\" >");
+ headerString.append(section);
+ headerString.append("</td>\n");
+
+ headerString.append("<td style=\"width: 1px;\"><img src=\"images/header/header_bg_line.png\"/></td>");
+ }
+
+ headerString.append("</tr></table>");
+
+ return headerString.toString();
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 9f9995a..bcc4236 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -32,6 +32,10 @@ import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.DrawEvent;
+import com.smartgwt.client.widgets.events.DrawHandler;
+import com.smartgwt.client.widgets.events.ShowContextMenuEvent;
+import com.smartgwt.client.widgets.events.ShowContextMenuHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -115,6 +119,8 @@ public class MenuBarView extends VLayout {
final MenuBar menu = new MenuBar();
menu.setHeight(28);
+
+
Menu subsystemsMenu = new Menu();
subsystemsMenu.setTitle("Subsystems");
@@ -146,7 +152,15 @@ public class MenuBarView extends VLayout {
resourcesMenu.addItem(new EMenuItem("Servers", LinkManager.getHubServerssLink(), "types/Server_up_16.png"));//, new LinkCommand("#fsdf"));
resourcesMenu.addItem(new EMenuItem("Services", LinkManager.getHubServicesLink(), "types/Service_up_16.png"));//, new LinkCommand("#fsdf"));
resourcesMenu.addItem(new MenuItemSeparator());
-// resourcesMenu.addItem(new MenuItem("Favorite Resources"));//,)
+
+ final FavoritesMenu favoritesMenu = new FavoritesMenu();
+ resourcesMenu.addItem(favoritesMenu);
+ menu.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ System.out.println("over here");
+ favoritesMenu.refresh();
+ }
+ });
Menu groupsMenu = new Menu();
groupsMenu.setStyleName("menuBarMenuButton");
commit 317d6c26c8b69426e170eaace875f9fee55d7627
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri May 28 16:45:35 2010 -0400
Avoid updating the subject role mappings when SubjectManager.updateSubject is called
(Fixes loss of role mappings on gwt land preference save)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index 10b7eb2..06302a2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -154,6 +154,13 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
+ subjectToModify.getName() + "]");
}
+
+ // Reset the roles and ldap roles according to the current settings as this method will not update them
+ // To update assinged roles see RoleManager
+ Subject currentSubject = entityManager.find(Subject.class, subjectToModify.getId());
+ subjectToModify.setRoles(currentSubject.getRoles());
+ subjectToModify.setLdapRoles(currentSubject.getLdapRoles());
+
return entityManager.merge(subjectToModify);
}
14 years, 1 month
[rhq] Branch 'bundle' - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java | 1 -
1 file changed, 1 deletion(-)
New commits:
commit b660cd54392e1044f32424394e8e580edcffd55d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 16:06:53 2010 -0400
this can't be correct. we should not be flushing here - we don't know what happened previously nor do we know if the caller wants us to flush to the db. if we really did need this, the other get*Permissions methods would have/need this too.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
index a6b3e99..77932d0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/AuthorizationManagerBean.java
@@ -47,7 +47,6 @@ public class AuthorizationManagerBean implements AuthorizationManagerLocal {
@SuppressWarnings("unchecked")
public Set<Permission> getExplicitGlobalPermissions(Subject subject) {
- entityManager.flush();
Query query = entityManager.createNamedQuery(Subject.QUERY_GET_GLOBAL_PERMISSIONS);
query.setParameter("subject", subject);
List<Permission> results = query.getResultList();
14 years, 1 month
[rhq] Branch 'bundle' - 2 commits - modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java | 1 -
1 file changed, 1 deletion(-)
New commits:
commit 5e4cf0458fcae5170caa95e03b165e228301afb8
Merge: 194a9ad... 5bedbc5...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri May 28 14:58:39 2010 -0400
Merge branch 'bundle' of ssh://git.fedorahosted.org/git/rhq/rhq into bundle
commit 194a9ad78348e0118829da855585fa65283b60bb
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri May 28 14:58:11 2010 -0400
Refix an issue where Failed deployments are set to Success.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
index 0f1d3b2..cf9c025 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
@@ -186,7 +186,6 @@ public class BundleManager extends AgentService implements BundleAgentService, B
completeDeployment(resourceDeployment, BundleDeploymentStatus.FAILURE, result
.getErrorMessage());
}
- completeDeployment(resourceDeployment, BundleDeploymentStatus.SUCCESS, deploymentMessage);
} catch (InterruptedException ie) {
log.error("Failed to complete bundle deployment due to interrupt", ie);
completeDeployment(resourceDeployment, BundleDeploymentStatus.FAILURE, "Deployment interrupted");
14 years, 1 month
[rhq] modules/enterprise
by mazz
modules/enterprise/agent/src/etc/rhq-agent.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 65fb0e66d977493d1c919c1c3cf3a2ea0a5889fc
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 14:39:40 2010 -0400
fixing two problems with the way LD_LIB_PATH was set:
1) don't set and export on the same line - I've seen instances where you can't export and set together (can't remember if is was OS specific or shell specific, but either way, always export separately)
2) remember to append existing path but only if it exists (never end with an empty ":" because it will infer "." in the path)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh b/modules/enterprise/agent/src/etc/rhq-agent.sh
index fc48d7a..a94a761 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent.sh
@@ -185,11 +185,17 @@ fi
debug_msg "RHQ_AGENT_CMDLINE_OPTS: $RHQ_AGENT_CMDLINE_OPTS"
# ----------------------------------------------------------------------
-# Prepare LD_LIBRARY_PATH for apache
+# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent
# ----------------------------------------------------------------------
if [ "x$_LINUX" != "x" ]; then
-export LD_LIBRARY_PATH=${RHQ_AGENT_HOME}/lib
+ if [ "x$LD_LIBRARY_PATH" = "x" ]; then
+ LD_LIBRARY_PATH="${RHQ_AGENT_HOME}/lib"
+ else
+ LD_LIBRARY_PATH="${RHQ_AGENT_HOME}/lib:${LD_LIBRARY_PATH}"
+ fi
+ export LD_LIBRARY_PATH
+ debug_msg "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
fi
# ----------------------------------------------------------------------
14 years, 1 month
[rhq] Branch 'bundle' - modules/enterprise
by mazz
modules/enterprise/agent/src/etc/rhq-agent.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 5bedbc50a5bda1f3a33fe02e37d2ff44915c38f1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 14:39:40 2010 -0400
fixing two problems with the way LD_LIB_PATH was set:
1) don't set and export on the same line - I've seen instances where you can't export and set together (can't remember if is was OS specific or shell specific, but either way, always export separately)
2) remember to append existing path but only if it exists (never end with an empty ":" because it will infer "." in the path)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh b/modules/enterprise/agent/src/etc/rhq-agent.sh
index fc48d7a..a94a761 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent.sh
@@ -185,11 +185,17 @@ fi
debug_msg "RHQ_AGENT_CMDLINE_OPTS: $RHQ_AGENT_CMDLINE_OPTS"
# ----------------------------------------------------------------------
-# Prepare LD_LIBRARY_PATH for apache
+# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent
# ----------------------------------------------------------------------
if [ "x$_LINUX" != "x" ]; then
-export LD_LIBRARY_PATH=${RHQ_AGENT_HOME}/lib
+ if [ "x$LD_LIBRARY_PATH" = "x" ]; then
+ LD_LIBRARY_PATH="${RHQ_AGENT_HOME}/lib"
+ else
+ LD_LIBRARY_PATH="${RHQ_AGENT_HOME}/lib:${LD_LIBRARY_PATH}"
+ fi
+ export LD_LIBRARY_PATH
+ debug_msg "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
fi
# ----------------------------------------------------------------------
14 years, 1 month
[rhq] etc/modules modules/common
by ips
etc/modules/sample-bundle/src/main/jbossas-init-script | 3
etc/modules/sample-bundle/src/main/rhq-bundle.xml | 9
etc/modules/sample-bundle/src/main/scripts/build.xml | 7
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java | 233 +++++-----
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java | 11
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java | 6
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java | 26 -
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java | 77 ++-
8 files changed, 233 insertions(+), 139 deletions(-)
New commits:
commit 56dae8a4278fc1a36a865dbdee87552d16ccf130
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri May 28 14:04:24 2010 -0400
rhq AntMain now executes stop+(install|upgrade)+start phases if rhq.deploy.phase prop is not specified on command line; system-service type now supports start and stop phase and ensures MD5s are calculated for init script and config file; other misc fixes and improvements
(cherry picked from commit f877b026411bb0ee5f8f4ebd0f0c85aa593916c0)
diff --git a/etc/modules/sample-bundle/src/main/jbossas-init-script b/etc/modules/sample-bundle/src/main/jbossas-init-script
index 218616f..58eb98e 100755
--- a/etc/modules/sample-bundle/src/main/jbossas-init-script
+++ b/etc/modules/sample-bundle/src/main/jbossas-init-script
@@ -2,7 +2,8 @@
#
# jbossas - This shell script takes care of starting and stopping
# a JBoss Application Server (AS) instance on a Red Hat
-# Linux system.
+# Linux system. It can be run as a system service (init
+# script) and/or run manually.
#
# chkconfig: 345 84 16
# description: JBoss AS server
diff --git a/etc/modules/sample-bundle/src/main/rhq-bundle.xml b/etc/modules/sample-bundle/src/main/rhq-bundle.xml
index 7ed429a..8bfec17 100644
--- a/etc/modules/sample-bundle/src/main/rhq-bundle.xml
+++ b/etc/modules/sample-bundle/src/main/rhq-bundle.xml
@@ -23,7 +23,8 @@
required="true"
type="integer"/>
- <rhq:deployment name="appserver" preinstallTarget="appserver-preinstall">
+ <rhq:deployment-unit name="appserver"
+ preinstallTarget="appserver-preinstall" postinstallTarget="appserver-postinstall">
<rhq:system-service name="jbossas-petstore" scriptFile="jbossas-init-script"
configFile="jbossas-init-config" overwriteScript="true"
startLevels="3,4,5" startPriority="80" stopPriority="20"/>
@@ -39,7 +40,7 @@
<include name="server/default/work/**"/>
</rhq:fileset>
</rhq:ignore>
- </rhq:deployment>
+ </rhq:deployment-unit>
</rhq:bundle>
@@ -49,4 +50,8 @@
<echo>Installing Java Petstore App Server to ${rhq.deploy.dir}...</echo>
</target>
+ <target name="appserver-postinstall">
+ <echo>Done installing Java Petstore App Server to ${rhq.deploy.dir}.</echo>
+ </target>
+
</project>
diff --git a/etc/modules/sample-bundle/src/main/scripts/build.xml b/etc/modules/sample-bundle/src/main/scripts/build.xml
index c3dcd85..f182518 100644
--- a/etc/modules/sample-bundle/src/main/scripts/build.xml
+++ b/etc/modules/sample-bundle/src/main/scripts/build.xml
@@ -9,8 +9,9 @@
<!-- download JBossAS 6.0 dist from sourceforge and unzip it -->
<property name="tmp.dir" location="${java.io.tmpdir}/${user.name}"/>
<echo>tmp.dir="${tmp.dir}"</echo>
- <mkdir dir="${tmp.dir}"/>
- <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M2/jboss..."
+ <mkdir dir="${tmp.dir}"/>
+
+ <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M3/jboss..."
dest="${tmp.dir}/jbossas.zip"
usetimestamp="true"/>
<property name="jboss.home" location="target/jbossas-petstore"/>
@@ -18,7 +19,7 @@
<mkdir dir="${jboss.home}"/>
<unzip src="${tmp.dir}/jbossas.zip" dest="${jboss.home}">
<mapper>
- <globmapper from="jboss-6.0.0.20100216-M2/*" to="*"/>
+ <globmapper from="jboss-6.0.0.20100429-M3/*" to="*"/>
</mapper>
</unzip>
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
index 34177b0..5acea7e 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
@@ -38,6 +38,7 @@ import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.util.ClasspathUtils;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ProxySetup;
+import org.rhq.core.util.updater.DeploymentsMetadata;
/**
* Command line entry point into RHQ Ant. This class is entered
@@ -606,134 +607,158 @@ public class AntMain implements org.apache.tools.ant.launch.AntMain {
* @exception BuildException if the build fails
*/
private void runBuild(ClassLoader coreLoader) throws BuildException {
-
if (!readyToRun) {
return;
}
- // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields.
- final Project project = new BundleAntProject();
- project.setCoreLoader(coreLoader);
-
- Throwable error = null;
-
- try {
- addBuildListeners(project);
- addInputHandler(project);
-
- PrintStream savedErr = System.err;
- PrintStream savedOut = System.out;
- InputStream savedIn = System.in;
-
- // use a system manager that prevents from System.exit()
- SecurityManager oldsm = null;
- oldsm = System.getSecurityManager();
-
- //SecurityManager can not be installed here for backwards
- //compatibility reasons (PD). Needs to be loaded prior to
- //ant class if we are going to implement it.
- //System.setSecurityManager(new NoExitSecurityManager());
+ // RHQ
+ DeploymentPhase[] lifecycle = getLifecycle();
+ for (DeploymentPhase phase : lifecycle) {
+ System.out.println("***** Executing " + phase + " phase *****...");
+ // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields.
+ Project project = new BundleAntProject();
+ Throwable error = null;
try {
- if (allowInput) {
- project.setDefaultInputStream(System.in);
+ initProject(project, coreLoader, phase);
+ if (projectHelp) {
+ printDescription(project);
+ printTargets(project, msgOutputLevel > Project.MSG_INFO);
+ } else {
+ // make sure that we have a target to execute
+ // TODO: For RHQ, we actually might want to enforce that they do NOT specify a target and just always
+ // execute the "" target.
+ if (targets.isEmpty()) {
+ if (project.getDefaultTarget() != null) {
+ targets.addElement(project.getDefaultTarget());
+ }
+ }
+ project.executeTargets(targets);
}
- System.setIn(new DemuxInputStream(project));
- System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
- System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
-
-
+ } catch (RuntimeException exc) {
+ error = exc;
+ throw exc;
+ } catch (Error e) {
+ error = e;
+ throw e;
+ } finally {
if (!projectHelp) {
- project.fireBuildStarted();
- }
-
- // set the thread priorities
- if (threadPriority != null) {
try {
- project.log("Setting Ant's thread priority to "
- + threadPriority, Project.MSG_VERBOSE);
- Thread.currentThread().setPriority(threadPriority.intValue());
- } catch (SecurityException swallowed) {
- //we cannot set the priority here.
- project.log("A security manager refused to set the -nice value");
+ project.fireBuildFinished(error);
+ } catch (Throwable t) {
+ // yes, I know it is bad style to catch Throwable,
+ // but if we don't, we lose valuable information
+ System.err.println("Caught an exception while logging the"
+ + " end of the build. Exception was:");
+ t.printStackTrace();
+ if (error != null) {
+ System.err.println("There has been an error prior to"
+ + " that:");
+ error.printStackTrace();
+ }
+ throw new BuildException(t);
}
+ } else if (error != null) {
+ project.log(error.toString(), Project.MSG_ERR);
}
+ }
+ }
+ }
+ private DeploymentPhase[] getLifecycle() {
+ String deployDirString = definedProps.getProperty(DeployPropertyNames.DEPLOY_DIR);
+ File deployDir = new File(deployDirString);
+ DeploymentsMetadata deployMetadata = new DeploymentsMetadata(deployDir);
+ boolean isRedeploy = deployMetadata.isManaged();
- project.init();
+ DeploymentPhase[] lifecycle;
+ String phaseString = definedProps.getProperty(DeployPropertyNames.DEPLOY_PHASE);
+ if (phaseString == null) {
+ lifecycle = (isRedeploy) ? DeploymentPhase.REDEPLOY_LIFECYCLE : DeploymentPhase.DEPLOY_LIFECYCLE;
+ } else {
+ DeploymentPhase phase = DeploymentPhase.valueOf(phaseString.toUpperCase());
+ lifecycle = new DeploymentPhase[] {phase};
+ }
+ return lifecycle;
+ }
- // set user-define properties
- Enumeration e = definedProps.keys();
- while (e.hasMoreElements()) {
- String arg = (String) e.nextElement();
- String value = (String) definedProps.get(arg);
- project.setUserProperty(arg, value);
- }
+ private void initProject(Project project, ClassLoader coreLoader, DeploymentPhase phase) {
+ project.setCoreLoader(coreLoader);
+ project.setProperty(DeployPropertyNames.DEPLOY_PHASE, phase.name());
- project.setUserProperty(MagicNames.ANT_FILE,
- buildFile.getAbsolutePath());
- project.setUserProperty(MagicNames.ANT_FILE_TYPE,
- MagicNames.ANT_FILE_TYPE_FILE);
+ addBuildListeners(project);
+ addInputHandler(project);
- project.setKeepGoingMode(keepGoingMode);
- if (proxy) {
- //proxy setup if enabled
- ProxySetup proxySetup = new ProxySetup(project);
- proxySetup.enableProxies();
- }
+ PrintStream savedErr = System.err;
+ PrintStream savedOut = System.out;
+ InputStream savedIn = System.in;
- ProjectHelper.configureProject(project, buildFile);
+ // use a system manager that prevents from System.exit()
+ SecurityManager oldsm = null;
+ oldsm = System.getSecurityManager();
- if (projectHelp) {
- printDescription(project);
- printTargets(project, msgOutputLevel > Project.MSG_INFO);
- return;
- }
+ //SecurityManager can not be installed here for backwards
+ //compatibility reasons (PD). Needs to be loaded prior to
+ //ant class if we are going to implement it.
+ //System.setSecurityManager(new NoExitSecurityManager());
+ try {
+ if (allowInput) {
+ project.setDefaultInputStream(System.in);
+ }
+ System.setIn(new DemuxInputStream(project));
+ System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
+ System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
- // make sure that we have a target to execute
- if (targets.size() == 0) {
- if (project.getDefaultTarget() != null) {
- targets.addElement(project.getDefaultTarget());
- }
- }
- project.executeTargets(targets);
- } finally {
- // put back the original security manager
- //The following will never eval to true. (PD)
- if (oldsm != null) {
- System.setSecurityManager(oldsm);
+ if (!projectHelp) {
+ project.fireBuildStarted();
+ }
+
+ // set the thread priorities
+ if (threadPriority != null) {
+ try {
+ project.log("Setting Ant's thread priority to "
+ + threadPriority, Project.MSG_VERBOSE);
+ Thread.currentThread().setPriority(threadPriority.intValue());
+ } catch (SecurityException swallowed) {
+ //we cannot set the priority here.
+ project.log("A security manager refused to set the -nice value");
}
+ }
+
+
+ project.init();
+
+ // set user-define properties
+ Enumeration e = definedProps.keys();
+ while (e.hasMoreElements()) {
+ String arg = (String) e.nextElement();
+ String value = (String) definedProps.get(arg);
+ project.setUserProperty(arg, value);
+ }
+
+ project.setUserProperty(MagicNames.ANT_FILE,
+ buildFile.getAbsolutePath());
+ project.setUserProperty(MagicNames.ANT_FILE_TYPE,
+ MagicNames.ANT_FILE_TYPE_FILE);
- System.setOut(savedOut);
- System.setErr(savedErr);
- System.setIn(savedIn);
+ project.setKeepGoingMode(keepGoingMode);
+ if (proxy) {
+ //proxy setup if enabled
+ ProxySetup proxySetup = new ProxySetup(project);
+ proxySetup.enableProxies();
}
- } catch (RuntimeException exc) {
- error = exc;
- throw exc;
- } catch (Error e) {
- error = e;
- throw e;
+
+ ProjectHelper.configureProject(project, buildFile);
} finally {
- if (!projectHelp) {
- try {
- project.fireBuildFinished(error);
- } catch (Throwable t) {
- // yes, I know it is bad style to catch Throwable,
- // but if we don't, we lose valuable information
- System.err.println("Caught an exception while logging the"
- + " end of the build. Exception was:");
- t.printStackTrace();
- if (error != null) {
- System.err.println("There has been an error prior to"
- + " that:");
- error.printStackTrace();
- }
- throw new BuildException(t);
- }
- } else if (error != null) {
- project.log(error.toString(), Project.MSG_ERR);
+ // put back the original security manager
+ //The following will never eval to true. (PD)
+ if (oldsm != null) {
+ System.setSecurityManager(oldsm);
}
+
+ System.setOut(savedOut);
+ System.setErr(savedErr);
+ System.setIn(savedIn);
}
}
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
index 4f87ab6..67c6fcd 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
@@ -2,7 +2,7 @@ package org.rhq.bundle.ant;
/**
* A bundle deployment phase. One or more tasks are associated with each phase. The phases are executed as part of
- * three user-initiated actions:
+ * three user-initiated lifecycles:
*
* Deploy: INSTALL,START
* Redeploy: STOP,UPGRADE,START
@@ -17,6 +17,15 @@ public enum DeploymentPhase {
UPGRADE,
UNINSTALL;
+ public static final DeploymentPhase[] DEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.INSTALL, DeploymentPhase.START};
+
+ public static final DeploymentPhase[] REDEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UPGRADE, DeploymentPhase.START};
+
+ public static final DeploymentPhase[] UNDEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UNINSTALL};
+
@Override
public String toString() {
return name().toLowerCase();
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
index 8e3c066..88bb491 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
@@ -52,6 +52,7 @@ public class BundleTask extends AbstractBundleTask {
super.maybeConfigure();
validateAttributes();
+ // TODO: Figure out why the Ant parse() method is not initializing the child Type objects.
//validateTypes();
getProject().setBundleName(this.name);
@@ -60,8 +61,7 @@ public class BundleTask extends AbstractBundleTask {
}
/**
- * The RHQ Ant launcher will ensure that the following Ant project properties are defined prior to this method being
- * invoked:
+ * The following Ant project properties must be defined with valid values prior to this method being invoked:
*
* rhq.deploy.id - the {@link org.rhq.core.domain.bundle.BundleDeployment deployment}'s unique id
* (e.g. "10001")
@@ -72,7 +72,7 @@ public class BundleTask extends AbstractBundleTask {
* If the bundle recipe is being executed from the command line, the user must supply these properties, along
* with any input properties required by the bundle recipe.
*
- * @throws BuildException
+ * @throws BuildException if an error occurs
*/
@Override
public void execute() throws BuildException {
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
index df72add..699bbf7 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
@@ -20,6 +20,7 @@ package org.rhq.bundle.ant.type;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
+import org.rhq.bundle.ant.DeployPropertyNames;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.system.SystemInfoFactory;
@@ -69,8 +70,15 @@ public class DeploymentUnitType extends AbstractBundleType {
getProject().getBundleVersion(), getProject().getBundleDescription());
File deployDir = getProject().getDeployDir();
TemplateEngine templateEngine = createTemplateEngine();
+ if (this.systemService != null) {
+ this.files.put(this.systemService.getScriptFile(), this.systemService.getScriptDestFile());
+ if (this.systemService.getConfigFile() != null) {
+ this.files.put(this.systemService.getConfigFile(), this.systemService.getConfigDestFile());
+ this.rawFilesToReplace.add(this.systemService.getConfigFile());
+ }
+ }
if (this.files.isEmpty() && this.archives.isEmpty()) {
- throw new BuildException("You must specify at least one file to deploy via nested rhq:file and/or rhq:archive elements.");
+ throw new BuildException("You must specify at least one file to deploy via nested rhq:file, rhq:archive, and/or rhq:system-service elements.");
}
if (!this.files.isEmpty()) {
log("Deploying files " + this.files + "...", Project.MSG_VERBOSE);
@@ -113,11 +121,15 @@ public class DeploymentUnitType extends AbstractBundleType {
}
public void start() throws BuildException {
-
+ if (this.systemService != null) {
+ this.systemService.start();
+ }
}
public void stop() throws BuildException {
-
+ if (this.systemService != null) {
+ this.systemService.stop();
+ }
}
public void upgrade(boolean revert, boolean clean) throws BuildException {
@@ -125,7 +137,9 @@ public class DeploymentUnitType extends AbstractBundleType {
}
public void uninstall() throws BuildException {
- // TODO
+ if (this.systemService != null) {
+ this.systemService.uninstall();
+ }
}
public String getName() {
@@ -173,6 +187,7 @@ public class DeploymentUnitType extends AbstractBundleType {
throw new IllegalStateException("A deployment can only have one system-service child element.");
}
this.systemService = systemService;
+ this.systemService.init();
}
public void addConfigured(FileType file) {
@@ -207,6 +222,9 @@ public class DeploymentUnitType extends AbstractBundleType {
for (PropertySimple prop : config.getSimpleProperties().values()) {
templateEngine.getTokens().put(prop.getName(), prop.getStringValue());
}
+ // And add the special rhq.deploy.dir prop.
+ templateEngine.getTokens().put(DeployPropertyNames.DEPLOY_DIR,
+ getProject().getProperty(DeployPropertyNames.DEPLOY_DIR));
return templateEngine;
}
}
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
index f3ef36c..3e3c1ee 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
@@ -11,7 +11,8 @@
* 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
+ *
+ * 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.
*/
@@ -73,47 +74,72 @@ public class SystemServiceType extends AbstractBundleType {
private Set<Character> startLevelChars;
private Set<Character> stopLevelChars;
- public void install() throws BuildException {
+ private File scriptDestFile;
+ private File configDestFile;
+
+ public void init() throws BuildException {
if (!OS_NAME.equals("Linux") || !REDHAT_RELEASE_FILE.exists() ) {
throw new BuildException("The system-service element is only supported on Red Hat Linux systems.");
}
validateAttributes();
+ this.scriptDestFile = new File(getInitDir(), this.name);
+ this.configDestFile = new File(getSysConfigDir(), this.name);
+ }
+
+ public void install() throws BuildException {
// Install the config file if one was provided (e.g. /etc/sysconfig/named).
if (this.configFile != null) {
- File sysconfigDir = new File(this.root, SYSCONFIG_DIR.getPath().substring(1));
+ File sysconfigDir = getSysConfigDir();
if (!sysconfigDir.exists()) {
sysconfigDir.mkdirs();
}
if (!sysconfigDir.canWrite()) {
throw new BuildException(sysconfigDir + " directory is not writeable.");
}
- File configDestFile = new File(sysconfigDir, this.name);
- copyFile(this.configFile, configDestFile, this.overwriteConfig);
- setPermissions(configDestFile, "644");
+ // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata
+ // (i.e. MD5) can be calculated and saved.
+ //copyFile(this.configFile, this.configDestFile, this.overwriteConfig);
+ setPermissions(this.configDestFile, "644");
}
// Install the script itself (e.g. /etc/init.d/named).
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
+ File initDir = getInitDir();
if (!initDir.exists()) {
initDir.mkdirs();
}
if (!initDir.canWrite()) {
throw new BuildException(initDir + " directory is not writeable.");
}
- File scriptDestFile = new File(initDir, this.name);
- getProject().log("Installing service script " + scriptDestFile + "...");
- copyFile(this.scriptFile, scriptDestFile, this.overwriteScript);
- setPermissions(scriptDestFile, "755");
+ getProject().log("Installing service script " + this.scriptDestFile + "...");
+ // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata
+ // (i.e. MD5) can be calculated and saved.
+ //copyFile(this.scriptFile, scriptDestFile, this.overwriteScript);
+ setPermissions(this.scriptDestFile, "755");
// Create the symlinks in the rcX.d dirs (e.g. /etc/rc3.d/S24named -> ../init.d/named)
- createScriptSymlinks(scriptDestFile, this.startPriority, this.startLevelChars, 'S');
- createScriptSymlinks(scriptDestFile, this.stopPriority, this.stopLevelChars, 'K');
+ createScriptSymlinks(this.scriptDestFile, this.startPriority, this.startLevelChars, 'S');
+ createScriptSymlinks(this.scriptDestFile, this.stopPriority, this.stopLevelChars, 'K');
+ }
+
+ private File getInitDir() {
+ return new File(this.root, INIT_DIR.getPath().substring(1));
+ }
+
+ public File getScriptDestFile() {
+ return this.scriptDestFile;
+ }
+
+ private File getSysConfigDir() {
+ return new File(this.root, SYSCONFIG_DIR.getPath().substring(1));
+ }
+
+ public File getConfigDestFile() {
+ return this.configDestFile;
}
public void start() throws BuildException {
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
- File scriptFile = new File(initDir, this.name);
+ File scriptFile = getScriptDestFile();
String[] commandLine = {scriptFile.getAbsolutePath(), "start"};
try {
executeCommand(commandLine);
@@ -124,8 +150,7 @@ public class SystemServiceType extends AbstractBundleType {
}
public void stop() throws BuildException {
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
- File scriptFile = new File(initDir, this.name);
+ File scriptFile = getScriptDestFile();
String[] commandLine = {scriptFile.getAbsolutePath(), "stop"};
try {
executeCommand(commandLine);
@@ -151,16 +176,26 @@ public class SystemServiceType extends AbstractBundleType {
return scriptFile;
}
- public void setScriptFile(File scriptFile) {
- this.scriptFile = scriptFile;
+ public void setScriptFile(String scriptFile) {
+ File file = new File(scriptFile);
+ if (file.isAbsolute()) {
+ throw new BuildException("Path specified by 'scriptFile' attribute (" + scriptFile
+ + ") is not relative - it must be a relative path, relative to the Ant basedir.");
+ }
+ this.scriptFile = getProject().resolveFile(scriptFile);
}
public File getConfigFile() {
return configFile;
}
- public void setConfigFile(File configFile) {
- this.configFile = configFile;
+ public void setConfigFile(String configFile) {
+ File file = new File(configFile);
+ if (file.isAbsolute()) {
+ throw new BuildException("Path specified by 'configFile' attribute (" + configFile
+ + ") is not relative - it must be a relative path, relative to the Ant basedir.");
+ }
+ this.configFile = getProject().resolveFile(configFile);
}
public boolean isOverwriteScript() {
14 years, 1 month
[rhq] Branch 'bundle' - 2 commits - etc/modules modules/common
by ips
etc/modules/sample-bundle/src/main/jbossas-init-script | 3
etc/modules/sample-bundle/src/main/rhq-bundle.xml | 9
etc/modules/sample-bundle/src/main/scripts/build.xml | 7
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java | 233 +++++-----
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java | 11
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java | 6
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java | 26 -
modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java | 77 ++-
8 files changed, 233 insertions(+), 139 deletions(-)
New commits:
commit abbf2ef5ba6b8692ceb0b5f83d79ace81c087ae4
Merge: f877b02... 7c682ff...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri May 28 14:04:41 2010 -0400
Merge branch 'bundle' of ssh://git.fedorahosted.org/git/rhq/rhq into bundle
commit f877b026411bb0ee5f8f4ebd0f0c85aa593916c0
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri May 28 14:04:24 2010 -0400
rhq AntMain now executes stop+(install|upgrade)+start phases if rhq.deploy.phase prop is not specified on command line; system-service type now supports start and stop phase and ensures MD5s are calculated for init script and config file; other misc fixes and improvements
diff --git a/etc/modules/sample-bundle/src/main/jbossas-init-script b/etc/modules/sample-bundle/src/main/jbossas-init-script
index 218616f..58eb98e 100755
--- a/etc/modules/sample-bundle/src/main/jbossas-init-script
+++ b/etc/modules/sample-bundle/src/main/jbossas-init-script
@@ -2,7 +2,8 @@
#
# jbossas - This shell script takes care of starting and stopping
# a JBoss Application Server (AS) instance on a Red Hat
-# Linux system.
+# Linux system. It can be run as a system service (init
+# script) and/or run manually.
#
# chkconfig: 345 84 16
# description: JBoss AS server
diff --git a/etc/modules/sample-bundle/src/main/rhq-bundle.xml b/etc/modules/sample-bundle/src/main/rhq-bundle.xml
index 7ed429a..8bfec17 100644
--- a/etc/modules/sample-bundle/src/main/rhq-bundle.xml
+++ b/etc/modules/sample-bundle/src/main/rhq-bundle.xml
@@ -23,7 +23,8 @@
required="true"
type="integer"/>
- <rhq:deployment name="appserver" preinstallTarget="appserver-preinstall">
+ <rhq:deployment-unit name="appserver"
+ preinstallTarget="appserver-preinstall" postinstallTarget="appserver-postinstall">
<rhq:system-service name="jbossas-petstore" scriptFile="jbossas-init-script"
configFile="jbossas-init-config" overwriteScript="true"
startLevels="3,4,5" startPriority="80" stopPriority="20"/>
@@ -39,7 +40,7 @@
<include name="server/default/work/**"/>
</rhq:fileset>
</rhq:ignore>
- </rhq:deployment>
+ </rhq:deployment-unit>
</rhq:bundle>
@@ -49,4 +50,8 @@
<echo>Installing Java Petstore App Server to ${rhq.deploy.dir}...</echo>
</target>
+ <target name="appserver-postinstall">
+ <echo>Done installing Java Petstore App Server to ${rhq.deploy.dir}.</echo>
+ </target>
+
</project>
diff --git a/etc/modules/sample-bundle/src/main/scripts/build.xml b/etc/modules/sample-bundle/src/main/scripts/build.xml
index c3dcd85..f182518 100644
--- a/etc/modules/sample-bundle/src/main/scripts/build.xml
+++ b/etc/modules/sample-bundle/src/main/scripts/build.xml
@@ -9,8 +9,9 @@
<!-- download JBossAS 6.0 dist from sourceforge and unzip it -->
<property name="tmp.dir" location="${java.io.tmpdir}/${user.name}"/>
<echo>tmp.dir="${tmp.dir}"</echo>
- <mkdir dir="${tmp.dir}"/>
- <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M2/jboss..."
+ <mkdir dir="${tmp.dir}"/>
+
+ <get src="http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-6.0.0.M3/jboss..."
dest="${tmp.dir}/jbossas.zip"
usetimestamp="true"/>
<property name="jboss.home" location="target/jbossas-petstore"/>
@@ -18,7 +19,7 @@
<mkdir dir="${jboss.home}"/>
<unzip src="${tmp.dir}/jbossas.zip" dest="${jboss.home}">
<mapper>
- <globmapper from="jboss-6.0.0.20100216-M2/*" to="*"/>
+ <globmapper from="jboss-6.0.0.20100429-M3/*" to="*"/>
</mapper>
</unzip>
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
index 34177b0..5acea7e 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/AntMain.java
@@ -38,6 +38,7 @@ import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.util.ClasspathUtils;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ProxySetup;
+import org.rhq.core.util.updater.DeploymentsMetadata;
/**
* Command line entry point into RHQ Ant. This class is entered
@@ -606,134 +607,158 @@ public class AntMain implements org.apache.tools.ant.launch.AntMain {
* @exception BuildException if the build fails
*/
private void runBuild(ClassLoader coreLoader) throws BuildException {
-
if (!readyToRun) {
return;
}
- // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields.
- final Project project = new BundleAntProject();
- project.setCoreLoader(coreLoader);
-
- Throwable error = null;
-
- try {
- addBuildListeners(project);
- addInputHandler(project);
-
- PrintStream savedErr = System.err;
- PrintStream savedOut = System.out;
- InputStream savedIn = System.in;
-
- // use a system manager that prevents from System.exit()
- SecurityManager oldsm = null;
- oldsm = System.getSecurityManager();
-
- //SecurityManager can not be installed here for backwards
- //compatibility reasons (PD). Needs to be loaded prior to
- //ant class if we are going to implement it.
- //System.setSecurityManager(new NoExitSecurityManager());
+ // RHQ
+ DeploymentPhase[] lifecycle = getLifecycle();
+ for (DeploymentPhase phase : lifecycle) {
+ System.out.println("***** Executing " + phase + " phase *****...");
+ // RHQ: We use our own special Project subclass that adds a few extra bundle-related fields.
+ Project project = new BundleAntProject();
+ Throwable error = null;
try {
- if (allowInput) {
- project.setDefaultInputStream(System.in);
+ initProject(project, coreLoader, phase);
+ if (projectHelp) {
+ printDescription(project);
+ printTargets(project, msgOutputLevel > Project.MSG_INFO);
+ } else {
+ // make sure that we have a target to execute
+ // TODO: For RHQ, we actually might want to enforce that they do NOT specify a target and just always
+ // execute the "" target.
+ if (targets.isEmpty()) {
+ if (project.getDefaultTarget() != null) {
+ targets.addElement(project.getDefaultTarget());
+ }
+ }
+ project.executeTargets(targets);
}
- System.setIn(new DemuxInputStream(project));
- System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
- System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
-
-
+ } catch (RuntimeException exc) {
+ error = exc;
+ throw exc;
+ } catch (Error e) {
+ error = e;
+ throw e;
+ } finally {
if (!projectHelp) {
- project.fireBuildStarted();
- }
-
- // set the thread priorities
- if (threadPriority != null) {
try {
- project.log("Setting Ant's thread priority to "
- + threadPriority, Project.MSG_VERBOSE);
- Thread.currentThread().setPriority(threadPriority.intValue());
- } catch (SecurityException swallowed) {
- //we cannot set the priority here.
- project.log("A security manager refused to set the -nice value");
+ project.fireBuildFinished(error);
+ } catch (Throwable t) {
+ // yes, I know it is bad style to catch Throwable,
+ // but if we don't, we lose valuable information
+ System.err.println("Caught an exception while logging the"
+ + " end of the build. Exception was:");
+ t.printStackTrace();
+ if (error != null) {
+ System.err.println("There has been an error prior to"
+ + " that:");
+ error.printStackTrace();
+ }
+ throw new BuildException(t);
}
+ } else if (error != null) {
+ project.log(error.toString(), Project.MSG_ERR);
}
+ }
+ }
+ }
+ private DeploymentPhase[] getLifecycle() {
+ String deployDirString = definedProps.getProperty(DeployPropertyNames.DEPLOY_DIR);
+ File deployDir = new File(deployDirString);
+ DeploymentsMetadata deployMetadata = new DeploymentsMetadata(deployDir);
+ boolean isRedeploy = deployMetadata.isManaged();
- project.init();
+ DeploymentPhase[] lifecycle;
+ String phaseString = definedProps.getProperty(DeployPropertyNames.DEPLOY_PHASE);
+ if (phaseString == null) {
+ lifecycle = (isRedeploy) ? DeploymentPhase.REDEPLOY_LIFECYCLE : DeploymentPhase.DEPLOY_LIFECYCLE;
+ } else {
+ DeploymentPhase phase = DeploymentPhase.valueOf(phaseString.toUpperCase());
+ lifecycle = new DeploymentPhase[] {phase};
+ }
+ return lifecycle;
+ }
- // set user-define properties
- Enumeration e = definedProps.keys();
- while (e.hasMoreElements()) {
- String arg = (String) e.nextElement();
- String value = (String) definedProps.get(arg);
- project.setUserProperty(arg, value);
- }
+ private void initProject(Project project, ClassLoader coreLoader, DeploymentPhase phase) {
+ project.setCoreLoader(coreLoader);
+ project.setProperty(DeployPropertyNames.DEPLOY_PHASE, phase.name());
- project.setUserProperty(MagicNames.ANT_FILE,
- buildFile.getAbsolutePath());
- project.setUserProperty(MagicNames.ANT_FILE_TYPE,
- MagicNames.ANT_FILE_TYPE_FILE);
+ addBuildListeners(project);
+ addInputHandler(project);
- project.setKeepGoingMode(keepGoingMode);
- if (proxy) {
- //proxy setup if enabled
- ProxySetup proxySetup = new ProxySetup(project);
- proxySetup.enableProxies();
- }
+ PrintStream savedErr = System.err;
+ PrintStream savedOut = System.out;
+ InputStream savedIn = System.in;
- ProjectHelper.configureProject(project, buildFile);
+ // use a system manager that prevents from System.exit()
+ SecurityManager oldsm = null;
+ oldsm = System.getSecurityManager();
- if (projectHelp) {
- printDescription(project);
- printTargets(project, msgOutputLevel > Project.MSG_INFO);
- return;
- }
+ //SecurityManager can not be installed here for backwards
+ //compatibility reasons (PD). Needs to be loaded prior to
+ //ant class if we are going to implement it.
+ //System.setSecurityManager(new NoExitSecurityManager());
+ try {
+ if (allowInput) {
+ project.setDefaultInputStream(System.in);
+ }
+ System.setIn(new DemuxInputStream(project));
+ System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
+ System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
- // make sure that we have a target to execute
- if (targets.size() == 0) {
- if (project.getDefaultTarget() != null) {
- targets.addElement(project.getDefaultTarget());
- }
- }
- project.executeTargets(targets);
- } finally {
- // put back the original security manager
- //The following will never eval to true. (PD)
- if (oldsm != null) {
- System.setSecurityManager(oldsm);
+ if (!projectHelp) {
+ project.fireBuildStarted();
+ }
+
+ // set the thread priorities
+ if (threadPriority != null) {
+ try {
+ project.log("Setting Ant's thread priority to "
+ + threadPriority, Project.MSG_VERBOSE);
+ Thread.currentThread().setPriority(threadPriority.intValue());
+ } catch (SecurityException swallowed) {
+ //we cannot set the priority here.
+ project.log("A security manager refused to set the -nice value");
}
+ }
+
+
+ project.init();
+
+ // set user-define properties
+ Enumeration e = definedProps.keys();
+ while (e.hasMoreElements()) {
+ String arg = (String) e.nextElement();
+ String value = (String) definedProps.get(arg);
+ project.setUserProperty(arg, value);
+ }
+
+ project.setUserProperty(MagicNames.ANT_FILE,
+ buildFile.getAbsolutePath());
+ project.setUserProperty(MagicNames.ANT_FILE_TYPE,
+ MagicNames.ANT_FILE_TYPE_FILE);
- System.setOut(savedOut);
- System.setErr(savedErr);
- System.setIn(savedIn);
+ project.setKeepGoingMode(keepGoingMode);
+ if (proxy) {
+ //proxy setup if enabled
+ ProxySetup proxySetup = new ProxySetup(project);
+ proxySetup.enableProxies();
}
- } catch (RuntimeException exc) {
- error = exc;
- throw exc;
- } catch (Error e) {
- error = e;
- throw e;
+
+ ProjectHelper.configureProject(project, buildFile);
} finally {
- if (!projectHelp) {
- try {
- project.fireBuildFinished(error);
- } catch (Throwable t) {
- // yes, I know it is bad style to catch Throwable,
- // but if we don't, we lose valuable information
- System.err.println("Caught an exception while logging the"
- + " end of the build. Exception was:");
- t.printStackTrace();
- if (error != null) {
- System.err.println("There has been an error prior to"
- + " that:");
- error.printStackTrace();
- }
- throw new BuildException(t);
- }
- } else if (error != null) {
- project.log(error.toString(), Project.MSG_ERR);
+ // put back the original security manager
+ //The following will never eval to true. (PD)
+ if (oldsm != null) {
+ System.setSecurityManager(oldsm);
}
+
+ System.setOut(savedOut);
+ System.setErr(savedErr);
+ System.setIn(savedIn);
}
}
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
index 4f87ab6..67c6fcd 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/DeploymentPhase.java
@@ -2,7 +2,7 @@ package org.rhq.bundle.ant;
/**
* A bundle deployment phase. One or more tasks are associated with each phase. The phases are executed as part of
- * three user-initiated actions:
+ * three user-initiated lifecycles:
*
* Deploy: INSTALL,START
* Redeploy: STOP,UPGRADE,START
@@ -17,6 +17,15 @@ public enum DeploymentPhase {
UPGRADE,
UNINSTALL;
+ public static final DeploymentPhase[] DEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.INSTALL, DeploymentPhase.START};
+
+ public static final DeploymentPhase[] REDEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UPGRADE, DeploymentPhase.START};
+
+ public static final DeploymentPhase[] UNDEPLOY_LIFECYCLE =
+ new DeploymentPhase[] {DeploymentPhase.STOP, DeploymentPhase.UNINSTALL};
+
@Override
public String toString() {
return name().toLowerCase();
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
index 8e3c066..88bb491 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/task/BundleTask.java
@@ -52,6 +52,7 @@ public class BundleTask extends AbstractBundleTask {
super.maybeConfigure();
validateAttributes();
+ // TODO: Figure out why the Ant parse() method is not initializing the child Type objects.
//validateTypes();
getProject().setBundleName(this.name);
@@ -60,8 +61,7 @@ public class BundleTask extends AbstractBundleTask {
}
/**
- * The RHQ Ant launcher will ensure that the following Ant project properties are defined prior to this method being
- * invoked:
+ * The following Ant project properties must be defined with valid values prior to this method being invoked:
*
* rhq.deploy.id - the {@link org.rhq.core.domain.bundle.BundleDeployment deployment}'s unique id
* (e.g. "10001")
@@ -72,7 +72,7 @@ public class BundleTask extends AbstractBundleTask {
* If the bundle recipe is being executed from the command line, the user must supply these properties, along
* with any input properties required by the bundle recipe.
*
- * @throws BuildException
+ * @throws BuildException if an error occurs
*/
@Override
public void execute() throws BuildException {
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
index df72add..699bbf7 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/DeploymentUnitType.java
@@ -20,6 +20,7 @@ package org.rhq.bundle.ant.type;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
+import org.rhq.bundle.ant.DeployPropertyNames;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.system.SystemInfoFactory;
@@ -69,8 +70,15 @@ public class DeploymentUnitType extends AbstractBundleType {
getProject().getBundleVersion(), getProject().getBundleDescription());
File deployDir = getProject().getDeployDir();
TemplateEngine templateEngine = createTemplateEngine();
+ if (this.systemService != null) {
+ this.files.put(this.systemService.getScriptFile(), this.systemService.getScriptDestFile());
+ if (this.systemService.getConfigFile() != null) {
+ this.files.put(this.systemService.getConfigFile(), this.systemService.getConfigDestFile());
+ this.rawFilesToReplace.add(this.systemService.getConfigFile());
+ }
+ }
if (this.files.isEmpty() && this.archives.isEmpty()) {
- throw new BuildException("You must specify at least one file to deploy via nested rhq:file and/or rhq:archive elements.");
+ throw new BuildException("You must specify at least one file to deploy via nested rhq:file, rhq:archive, and/or rhq:system-service elements.");
}
if (!this.files.isEmpty()) {
log("Deploying files " + this.files + "...", Project.MSG_VERBOSE);
@@ -113,11 +121,15 @@ public class DeploymentUnitType extends AbstractBundleType {
}
public void start() throws BuildException {
-
+ if (this.systemService != null) {
+ this.systemService.start();
+ }
}
public void stop() throws BuildException {
-
+ if (this.systemService != null) {
+ this.systemService.stop();
+ }
}
public void upgrade(boolean revert, boolean clean) throws BuildException {
@@ -125,7 +137,9 @@ public class DeploymentUnitType extends AbstractBundleType {
}
public void uninstall() throws BuildException {
- // TODO
+ if (this.systemService != null) {
+ this.systemService.uninstall();
+ }
}
public String getName() {
@@ -173,6 +187,7 @@ public class DeploymentUnitType extends AbstractBundleType {
throw new IllegalStateException("A deployment can only have one system-service child element.");
}
this.systemService = systemService;
+ this.systemService.init();
}
public void addConfigured(FileType file) {
@@ -207,6 +222,9 @@ public class DeploymentUnitType extends AbstractBundleType {
for (PropertySimple prop : config.getSimpleProperties().values()) {
templateEngine.getTokens().put(prop.getName(), prop.getStringValue());
}
+ // And add the special rhq.deploy.dir prop.
+ templateEngine.getTokens().put(DeployPropertyNames.DEPLOY_DIR,
+ getProject().getProperty(DeployPropertyNames.DEPLOY_DIR));
return templateEngine;
}
}
\ No newline at end of file
diff --git a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
index f3ef36c..3e3c1ee 100644
--- a/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
+++ b/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java
@@ -11,7 +11,8 @@
* 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
+ *
+ * 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.
*/
@@ -73,47 +74,72 @@ public class SystemServiceType extends AbstractBundleType {
private Set<Character> startLevelChars;
private Set<Character> stopLevelChars;
- public void install() throws BuildException {
+ private File scriptDestFile;
+ private File configDestFile;
+
+ public void init() throws BuildException {
if (!OS_NAME.equals("Linux") || !REDHAT_RELEASE_FILE.exists() ) {
throw new BuildException("The system-service element is only supported on Red Hat Linux systems.");
}
validateAttributes();
+ this.scriptDestFile = new File(getInitDir(), this.name);
+ this.configDestFile = new File(getSysConfigDir(), this.name);
+ }
+
+ public void install() throws BuildException {
// Install the config file if one was provided (e.g. /etc/sysconfig/named).
if (this.configFile != null) {
- File sysconfigDir = new File(this.root, SYSCONFIG_DIR.getPath().substring(1));
+ File sysconfigDir = getSysConfigDir();
if (!sysconfigDir.exists()) {
sysconfigDir.mkdirs();
}
if (!sysconfigDir.canWrite()) {
throw new BuildException(sysconfigDir + " directory is not writeable.");
}
- File configDestFile = new File(sysconfigDir, this.name);
- copyFile(this.configFile, configDestFile, this.overwriteConfig);
- setPermissions(configDestFile, "644");
+ // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata
+ // (i.e. MD5) can be calculated and saved.
+ //copyFile(this.configFile, this.configDestFile, this.overwriteConfig);
+ setPermissions(this.configDestFile, "644");
}
// Install the script itself (e.g. /etc/init.d/named).
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
+ File initDir = getInitDir();
if (!initDir.exists()) {
initDir.mkdirs();
}
if (!initDir.canWrite()) {
throw new BuildException(initDir + " directory is not writeable.");
}
- File scriptDestFile = new File(initDir, this.name);
- getProject().log("Installing service script " + scriptDestFile + "...");
- copyFile(this.scriptFile, scriptDestFile, this.overwriteScript);
- setPermissions(scriptDestFile, "755");
+ getProject().log("Installing service script " + this.scriptDestFile + "...");
+ // Don't copy the file ourselves - let our parent DeploymentUnitType handle it, so the deployment metadata
+ // (i.e. MD5) can be calculated and saved.
+ //copyFile(this.scriptFile, scriptDestFile, this.overwriteScript);
+ setPermissions(this.scriptDestFile, "755");
// Create the symlinks in the rcX.d dirs (e.g. /etc/rc3.d/S24named -> ../init.d/named)
- createScriptSymlinks(scriptDestFile, this.startPriority, this.startLevelChars, 'S');
- createScriptSymlinks(scriptDestFile, this.stopPriority, this.stopLevelChars, 'K');
+ createScriptSymlinks(this.scriptDestFile, this.startPriority, this.startLevelChars, 'S');
+ createScriptSymlinks(this.scriptDestFile, this.stopPriority, this.stopLevelChars, 'K');
+ }
+
+ private File getInitDir() {
+ return new File(this.root, INIT_DIR.getPath().substring(1));
+ }
+
+ public File getScriptDestFile() {
+ return this.scriptDestFile;
+ }
+
+ private File getSysConfigDir() {
+ return new File(this.root, SYSCONFIG_DIR.getPath().substring(1));
+ }
+
+ public File getConfigDestFile() {
+ return this.configDestFile;
}
public void start() throws BuildException {
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
- File scriptFile = new File(initDir, this.name);
+ File scriptFile = getScriptDestFile();
String[] commandLine = {scriptFile.getAbsolutePath(), "start"};
try {
executeCommand(commandLine);
@@ -124,8 +150,7 @@ public class SystemServiceType extends AbstractBundleType {
}
public void stop() throws BuildException {
- File initDir = new File(this.root, INIT_DIR.getPath().substring(1));
- File scriptFile = new File(initDir, this.name);
+ File scriptFile = getScriptDestFile();
String[] commandLine = {scriptFile.getAbsolutePath(), "stop"};
try {
executeCommand(commandLine);
@@ -151,16 +176,26 @@ public class SystemServiceType extends AbstractBundleType {
return scriptFile;
}
- public void setScriptFile(File scriptFile) {
- this.scriptFile = scriptFile;
+ public void setScriptFile(String scriptFile) {
+ File file = new File(scriptFile);
+ if (file.isAbsolute()) {
+ throw new BuildException("Path specified by 'scriptFile' attribute (" + scriptFile
+ + ") is not relative - it must be a relative path, relative to the Ant basedir.");
+ }
+ this.scriptFile = getProject().resolveFile(scriptFile);
}
public File getConfigFile() {
return configFile;
}
- public void setConfigFile(File configFile) {
- this.configFile = configFile;
+ public void setConfigFile(String configFile) {
+ File file = new File(configFile);
+ if (file.isAbsolute()) {
+ throw new BuildException("Path specified by 'configFile' attribute (" + configFile
+ + ") is not relative - it must be a relative path, relative to the Ant basedir.");
+ }
+ this.configFile = getProject().resolveFile(configFile);
}
public boolean isOverwriteScript() {
14 years, 1 month
[rhq] Branch 'bundle' - 2 commits - modules/cli-tests modules/enterprise
by Jay Shaughnessy
modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js | 6
modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js | 4
modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js | 4
modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java | 24 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java | 100 ++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java | 80 ++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java | 12 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java | 27 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 110 +++++++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java | 18 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java | 12 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 10
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java | 4
18 files changed, 279 insertions(+), 165 deletions(-)
New commits:
commit 7c682ff39a29c6b7d6d962afad385cce1df17410
Merge: 7a14d13... 7cf1692...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri May 28 13:22:15 2010 -0400
Merge branch 'bundle' into bundle-jay
commit 7a14d13f9bf7c9d73af9acc1d1abef1e4dfaf5ea
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri May 28 13:21:17 2010 -0400
Bundle Deployment - Generate static deployment names
- Changed API such that all deployment creation (not just wizard)
generates standard naming.
- Refactored deploy/revert wizards based on new naming approach
- updated tests and test scripts
- Also, updated GetDeploymentConfigStep to *not* incrementStep in
getCanvas call if there is no config. That approach no mightily
messes up the wizards.
diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
index c3ffe08..4241f3b 100644
--- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
+++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManager.js
@@ -78,15 +78,15 @@ function testDeployment() {
var testDest = BundleManager.createBundleDestination( testBundleVersion.getBundle().getId(), "Deployment Test Dest", "test Dest", "/tmp/bundle-test", groupId);
// create a deployment using the above config
- var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Test", "Deployment Test of testBundle WAR", new Configuration());
+ var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Test of testBundle WAR", new Configuration());
// deploy to the destination
var bd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false);
Assert.assertNotNull( bd );
// delete the test bundle if it exists (after allowing agent audit messages to complete)
- sleep( 5000 );
- cleanupTestBundle();
+ //sleep( 5000 );
+ //cleanupTestBundle();
}
function getBundleType() {
diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js
index 19e6e4d..8f36bc6 100644
--- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js
+++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgrade.js
@@ -89,12 +89,12 @@ function testGroupDeployment() {
var testDest = BundleManager.createBundleDestination(testBundleVersion1.getBundle().getId(), "upgrade destination", "upgrade destination", "/tmp/upgrade-bundle-test", groupId);
// create a deployment of 1.0 using the 1.0 config
- var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Upgrade Deployment Test 1", "Creating initial deployment to be upgraded", config1);
+ var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Creating initial deployment to be upgraded", config1);
var bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), true);
Assert.assertNotNull( bgd, "Failed to create 1.0 deployment" );
// upgrade the deployment to 2.0 using the 2.0 config
- testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Upgrade Deployment Test 2", "Testing upgrade deployment", config2);
+ testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Testing upgrade deployment", config2);
bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false);
Assert.assertNotNull( bgd, "Failed to upgrade to 2.0 deployment" );
}
diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js
index db33709..a88faa4 100644
--- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js
+++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerUpgradeAnt.js
@@ -90,12 +90,12 @@ function testGroupDeployment() {
var testDest = BundleManager.createBundleDestination(testBundleVersion1.getBundle().getId(), "upgrade destination", "upgrade destination", "/tmp/upgrade-bundle-ant-test", groupId);
// create a deployment of 1.0 using the 1.0 config
- var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Upgrade Deployment with Ant Test 1", "Creating initial ant bundle deployment to be upgraded", config1);
+ var testDeployment = BundleManager.createBundleDeployment(testBundleVersion1.getId(), testDest.getId(), "Creating initial ant bundle deployment to be upgraded", config1);
var bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), true);
Assert.assertNotNull( bgd, "Failed to create 1.0 deployment" );
// upgrade the deployment to 2.0 using the 2.0 config
- testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Upgrade Deployment with Ant Test 2", "Testing ant bundle upgrade deployment", config2);
+ testDeployment = BundleManager.createBundleDeployment(testBundleVersion2.getId(), testDest.getId(), "Testing ant bundle upgrade deployment", config2);
bgd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false);
Assert.assertNotNull( bgd, "Failed to upgrade to 2.0 deployment" );
}
diff --git a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js
index db342e4..1e260b5 100644
--- a/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js
+++ b/modules/cli-tests/src/test/script/org/rhq/enterprise/remoting/cli/test_bundleManagerZip.js
@@ -83,7 +83,7 @@ function testDeployment() {
config.put( property );
// create a deployment using the above config
- var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Zip Test", "Deployment Test of dummy ZIP", config);
+ var testDeployment = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Deployment Test of dummy ZIP", config);
var bd = BundleManager.scheduleBundleDeployment(testDeployment.getId(), false);
Assert.assertNotNull( bd );
@@ -97,7 +97,7 @@ function testDeployment() {
config2.put( property );
// create a deployment using the above config
- var testRedeploy = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Redeployment Zip Test", "Redeploy Test of dummy ZIP", config2);
+ var testRedeploy = BundleManager.createBundleDeployment(testBundleVersion.getId(), testDest.getId(), "Redeploy Test of dummy ZIP", config2);
var bd2 = BundleManager.scheduleBundleDeployment(testRedeploy.getId(), false);
Assert.assertNotNull( bd2 );
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
index 815b647..88b67be 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/AbstractBundleDeployWizard.java
@@ -37,7 +37,6 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
private BundleVersion bundleVersion;
private boolean initialDeployment = false;
private Configuration newDeploymentConfig;
- private String newDeploymentName;
private String newDeploymentDescription;
private BundleDeployment newDeployment;
private boolean isCleanDeployment = false;
@@ -61,14 +60,6 @@ public abstract class AbstractBundleDeployWizard extends AbstractBundleWizard {
this.bundleVersion = bundleVersion;
}
- public String getNewDeploymentName() {
- return newDeploymentName;
- }
-
- public void setNewDeploymentName(String newDeploymentName) {
- this.newDeploymentName = newDeploymentName;
- }
-
public String getNewDeploymentDescription() {
return newDeploymentDescription;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
index 52248ab..0e52ab1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -71,9 +71,8 @@ public class DeployStep implements WizardStep {
canvas.addMember(deployingImage);
canvas.addMember(deployingMessage);
- bundleServer.createBundleDeployment(wizard.getBundleVersion().getId(), wizard.getDestination()
- .getId(), wizard.getNewDeploymentName(), wizard.getNewDeploymentDescription(), wizard
- .getNewDeploymentConfig(), false, -1, false, //
+ bundleServer.createBundleDeployment(wizard.getBundleVersion().getId(), wizard.getDestination().getId(),
+ wizard.getNewDeploymentDescription(), wizard.getNewDeploymentConfig(), false, -1, false, //
new AsyncCallback<BundleDeployment>() {
public void onSuccess(BundleDeployment result) {
deployingImage.setSrc("/images/status_complete.gif");
@@ -90,7 +89,7 @@ public class DeployStep implements WizardStep {
deployingImage.setSrc("/images/status_complete.gif");
deployingMessage.setText("Bundle Deployment Scheduled!");
CoreGUI.getMessageCenter().notify(
- new Message("Scheduled bundle deployment [" + wizard.getNewDeploymentName()
+ new Message("Scheduled bundle deployment [" + result.getName()
+ "] resource group [" + result.getDestination().getGroup() + "]",
Severity.Info));
wizard.setNewDeployment(result);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java
index f3c2281..505948b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentConfigStep.java
@@ -19,16 +19,18 @@
package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
public class GetDeploymentConfigStep implements WizardStep {
private final BundleDeployWizard wizard;
- private ConfigurationEditor editor;
+ private VLayout editor;
public GetDeploymentConfigStep(BundleDeployWizard wizard) {
this.wizard = wizard;
@@ -40,16 +42,22 @@ public class GetDeploymentConfigStep implements WizardStep {
public Canvas getCanvas() {
if (null == editor) {
- ConfigurationDefinition configDef = this.wizard.getBundleVersion().getConfigurationDefinition();
+ ConfigurationDefinition configDef = wizard.getBundleVersion().getConfigurationDefinition();
// if there are no prop defs for this config def then we can skip this step entirely. just
// set an empty config.
if (configDef.getPropertyDefinitions().isEmpty()) {
- this.wizard.setNewDeploymentConfig(new Configuration());
- this.wizard.getView().incrementStep();
+ wizard.setNewDeploymentConfig(new Configuration());
+ // This has started behaving badly. Instead of moving ahead let's give them a message
+ // and a chance to go back to the previous screen.
+ // this.wizard.getView().incrementStep();
+ HeaderLabel label = new HeaderLabel("No configuration needed for this bundle version");
+ label.setWidth100();
+ editor = new VLayout();
+ editor.addMember(label);
} else {
// otherwise, pop up the config editor to get the needed config
- Configuration startingConfig = (null == this.wizard.getLiveDeployment()) ? new Configuration()
+ Configuration startingConfig = (null == wizard.getLiveDeployment()) ? new Configuration()
: getNormalizedLiveConfig(configDef);
editor = new ConfigurationEditor(configDef, startingConfig);
}
@@ -59,7 +67,7 @@ public class GetDeploymentConfigStep implements WizardStep {
}
private Configuration getNormalizedLiveConfig(ConfigurationDefinition configDef) {
- Configuration config = this.wizard.getLiveDeployment().getConfiguration();
+ Configuration config = wizard.getLiveDeployment().getConfiguration();
if (null == config) {
config = new Configuration();
} else {
@@ -73,7 +81,9 @@ public class GetDeploymentConfigStep implements WizardStep {
}
public boolean nextPage() {
- wizard.setNewDeploymentConfig(editor.getConfiguration());
+ if (null == wizard.getNewDeploymentConfig()) {
+ wizard.setNewDeploymentConfig(((ConfigurationEditor) editor).getConfiguration());
+ }
return true;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
index 36c7cde..1c00b7d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
@@ -26,7 +27,10 @@ import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Jay Shaughnessy
@@ -36,6 +40,7 @@ public class GetDeploymentInfoStep implements WizardStep {
private DynamicForm form;
private final BundleDeployWizard wizard;
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
public GetDeploymentInfoStep(BundleDeployWizard wizard) {
this.wizard = wizard;
@@ -52,67 +57,52 @@ public class GetDeploymentInfoStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- final StaticTextItem nameTextItem = new StaticTextItem("name", "Deployment Name");
- nameTextItem.setWidth(300);
- wizard.setNewDeploymentName(getDeploymentName());
- wizard.setSubtitle(wizard.getNewDeploymentName());
- nameTextItem.setValue(wizard.getNewDeploymentName());
-
- final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Deployment Description");
- descriptionTextAreaItem.setWidth(300);
- descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setNewDeploymentDescription(value.toString());
- }
- });
-
- final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment",
- "Clean Deployment? (wipe deploy directory on destination platform)");
- cleanDeploymentCBItem.setValue(wizard.isCleanDeployment());
- cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- wizard.setCleanDeployment((Boolean) event.getValue());
- }
- });
-
- form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem);
- }
+ bundleServer.getBundleDeploymentName(wizard.getDestination().getId(), wizard.getBundleVersion().getId(),
+ -1, //
+ new AsyncCallback<String>() {
+
+ public void onSuccess(String result) {
+ final StaticTextItem nameTextItem = new StaticTextItem("name", "Deployment Name");
+ nameTextItem.setWidth(300);
+ wizard.setSubtitle(result);
+ nameTextItem.setValue(result);
+
+ final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description",
+ "Deployment Description");
+ descriptionTextAreaItem.setWidth(300);
+ descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setNewDeploymentDescription(value.toString());
+ }
+ });
+
+ final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment",
+ "Clean Deployment? (wipe deploy directory on destination platform)");
+ cleanDeploymentCBItem.setValue(wizard.isCleanDeployment());
+ cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setCleanDeployment((Boolean) event.getValue());
+ }
+ });
+
+ form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem);
- return form;
- }
+ }
- private String getDeploymentName() {
- String deploymentName = "none";
-
- int deploy = 1;
- String version = wizard.getBundleVersion().getVersion();
- String dest = wizard.getDestination().getName();
-
- if (wizard.isInitialDeployment()) {
- deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
- } else {
- String liveName = wizard.getLiveDeployment().getName();
- String liveVersion = wizard.getLiveDeployment().getBundleVersion().getVersion();
- if (liveVersion.equals(version)) {
- // redeploy
- int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
- deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
- deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
- } else {
- // upgrade
- deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest
- + "]. Upgrade from Version [" + liveVersion + "]";
- }
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to get deployment name.", caught);
+ }
+ });
}
- return deploymentName;
+ return form;
}
public boolean nextPage() {
- return true;
+ return form.validate();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java
index 05f8f96..9d01d2c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/AbstractBundleRevertWizard.java
@@ -30,21 +30,12 @@ public abstract class AbstractBundleRevertWizard extends AbstractBundleWizard {
// the things we build up in the wizard
private BundleDestination destination;
- private String deploymentName;
private String deploymentDescription;
private BundleDeployment deployment;
private boolean isCleanDeployment = false;
private BundleDeployment liveDeployment;
private BundleDeployment previousDeployment;
- public String getDeploymentName() {
- return deploymentName;
- }
-
- public void setDeploymentName(String deploymentName) {
- this.deploymentName = deploymentName;
- }
-
public String getDeploymentDescription() {
return deploymentDescription;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
index 827c3e3..5608172 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.revert;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
@@ -26,7 +27,10 @@ import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Jay Shaughnessy
@@ -36,6 +40,7 @@ public class GetRevertInfoStep implements WizardStep {
private DynamicForm form;
private final BundleRevertWizard wizard;
+ private final BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
public GetRevertInfoStep(BundleRevertWizard wizard) {
this.wizard = wizard;
@@ -52,42 +57,51 @@ public class GetRevertInfoStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- final StaticTextItem nameTextItem = new StaticTextItem("name", "Revert Deployment Name");
- nameTextItem.setRequired(true);
- nameTextItem.setWidth(300);
- wizard.setDeploymentName("[REVERT To] " + this.wizard.getPreviousDeployment().getName());
- wizard.setSubtitle(wizard.getDeploymentName());
- nameTextItem.setValue(wizard.getDeploymentName());
+ bundleServer.getBundleDeploymentName(wizard.getDestination().getId(), -1, wizard.getPreviousDeployment()
+ .getId(), //
+ new AsyncCallback<String>() {
- final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description",
- "Revert Deployment Description");
- descriptionTextAreaItem.setWidth(300);
- String liveDesc = this.wizard.getLiveDeployment().getDescription();
- liveDesc = (null == liveDesc) ? this.wizard.getLiveDeployment().getName() : liveDesc;
- String prevDesc = this.wizard.getPreviousDeployment().getDescription();
- prevDesc = (null == prevDesc) ? this.wizard.getPreviousDeployment().getName() : prevDesc;
- wizard.setDeploymentDescription("[REVERT From]\n" + liveDesc + "\n\n[REVERT To]\n" + prevDesc);
- descriptionTextAreaItem.setValue(wizard.getDeploymentDescription());
- descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setDeploymentDescription(value.toString());
- }
- });
+ public void onSuccess(String result) {
+ final StaticTextItem nameTextItem = new StaticTextItem("name", "Revert Deployment Name");
+ nameTextItem.setWidth(300);
+ wizard.setSubtitle(result);
+ nameTextItem.setValue(result);
+
+ final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description",
+ "Revert Deployment Description");
+ descriptionTextAreaItem.setWidth(300);
+ String liveDesc = wizard.getLiveDeployment().getDescription();
+ liveDesc = (null == liveDesc) ? wizard.getLiveDeployment().getName() : liveDesc;
+ String prevDesc = wizard.getPreviousDeployment().getDescription();
+ prevDesc = (null == prevDesc) ? wizard.getPreviousDeployment().getName() : prevDesc;
+ wizard.setDeploymentDescription("[REVERT From]\n" + liveDesc + "\n\n[REVERT To]\n" + prevDesc);
+ descriptionTextAreaItem.setValue(wizard.getDeploymentDescription());
+ descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ Object value = event.getValue();
+ if (value == null) {
+ value = "";
+ }
+ wizard.setDeploymentDescription(value.toString());
+ }
+ });
- final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment",
- "Clean Deployment? (wipe deploy directory prior to the revert deploy)");
- cleanDeploymentCBItem.setValue(wizard.isCleanDeployment());
- cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- wizard.setCleanDeployment((Boolean) event.getValue());
- }
- });
+ final CheckboxItem cleanDeploymentCBItem = new CheckboxItem("cleanDeployment",
+ "Clean Deployment? (wipe deploy directory prior to the revert deploy)");
+ cleanDeploymentCBItem.setValue(wizard.isCleanDeployment());
+ cleanDeploymentCBItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ wizard.setCleanDeployment((Boolean) event.getValue());
+ }
+ });
- form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem);
+ form.setItems(nameTextItem, descriptionTextAreaItem, cleanDeploymentCBItem);
+ }
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to get revert deployment name.", caught);
+ }
+ });
}
return form;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java
index 6388ac8..04bec9f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java
@@ -72,13 +72,13 @@ public class RevertStep implements WizardStep {
canvas.addMember(deployingMessage);
bundleServer.scheduleRevertBundleDeployment(this.wizard.getDestination().getId(), this.wizard
- .getDeploymentName(), this.wizard.getDeploymentDescription(), this.wizard.isCleanDeployment(), //
+ .getDeploymentDescription(), this.wizard.isCleanDeployment(), //
new AsyncCallback<BundleDeployment>() {
public void onSuccess(BundleDeployment result) {
deployingImage.setSrc("/images/status_complete.gif");
deployingMessage.setText("Revert Deployment Scheduled!");
CoreGUI.getMessageCenter().notify(
- new Message("Scheduled revert bundle deployment [" + wizard.getDeploymentName()
+ new Message("Scheduled revert bundle deployment [" + result.getName()
+ "] resource group [" + result.getDestination().getGroup() + "]", Severity.Info));
wizard.setDeployment(result);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
index 11b6851..ad56819 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/BundleGWTService.java
@@ -48,9 +48,9 @@ public interface BundleGWTService extends RemoteService {
BundleVersion createBundleVersionViaRecipe(String recipe) throws Exception;
- BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String name,
- String description, Configuration configuration, boolean enforcePolicy, int enforcementInterval,
- boolean pinToBundle) throws Exception;
+ BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String description,
+ Configuration configuration, boolean enforcePolicy, int enforcementInterval, boolean pinToBundle)
+ throws Exception;
BundleDestination createBundleDestination(int bundleId, String name, String description, String deployDir,
int groupId) throws Exception;
@@ -82,9 +82,11 @@ public interface BundleGWTService extends RemoteService {
ArrayList<BundleType> getAllBundleTypes() throws Exception;
+ String getBundleDeploymentName(int bundleDestinationId, int bundleVersionId, int prevDeploymentId);
+
BundleDeployment scheduleBundleDeployment(int bundleDeploymentId, boolean isCleanDeployment) throws Exception;
- BundleDeployment scheduleRevertBundleDeployment(int bundleDestinationId, String deploymentName,
- String deploymentDescription, boolean isCleanDeployment) throws Exception;
+ BundleDeployment scheduleRevertBundleDeployment(int bundleDestinationId, String deploymentDescription,
+ boolean isCleanDeployment) throws Exception;
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
index e48eb04..cfb8d18 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/BundleGWTServiceImpl.java
@@ -66,13 +66,13 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
}
- public BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String name,
- String description, Configuration configuration, boolean enforcePolicy, int enforcementInterval,
- boolean pinToBundle) throws Exception {
+ public BundleDeployment createBundleDeployment(int bundleVersionId, int bundleDestinationId, String description,
+ Configuration configuration, boolean enforcePolicy, int enforcementInterval, boolean pinToBundle)
+ throws Exception {
try {
BundleDeployment result = bundleManager.createBundleDeployment(getSessionSubject(), bundleVersionId,
- bundleDestinationId, name, description, configuration);
+ bundleDestinationId, description, configuration);
return SerialUtility.prepare(result, "createBundleDeployment");
} catch (Exception e) {
throw new Exception(ThrowableUtil.getAllMessages(e));
@@ -147,10 +147,21 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
HashMap<String, Boolean> results = new HashMap<String, Boolean>();
try {
results.putAll(bundleManager.getAllBundleVersionFilenames(getSessionSubject(), bundleVersionId));
+ return SerialUtility.prepare(results, "getAllBundleVersionFilenames");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public String getBundleDeploymentName(int bundleDestinationId, int bundleVersionId, int prevDeploymentId) {
+ String result;
+ try {
+ result = bundleManager.getBundleDeploymentName(getSessionSubject(), bundleDestinationId, bundleVersionId,
+ prevDeploymentId);
+ return SerialUtility.prepare(result, "getBundleDeploymentName");
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
- return SerialUtility.prepare(results, "getAllBundleVersionFilenames");
}
public BundleDeployment scheduleBundleDeployment(int bundleDeploymentId, boolean isCleanDeployment)
@@ -164,11 +175,11 @@ public class BundleGWTServiceImpl extends AbstractGWTServiceImpl implements Bund
}
}
- public BundleDeployment scheduleRevertBundleDeployment(int bundleDeploymentId, String deploymentName,
- String deploymentDescription, boolean isCleanDeployment) throws Exception {
+ public BundleDeployment scheduleRevertBundleDeployment(int bundleDeploymentId, String deploymentDescription,
+ boolean isCleanDeployment) throws Exception {
try {
BundleDeployment result = bundleManager.scheduleRevertBundleDeployment(getSessionSubject(),
- bundleDeploymentId, deploymentName, deploymentDescription, isCleanDeployment);
+ bundleDeploymentId, deploymentDescription, isCleanDeployment);
return SerialUtility.prepare(result, "scheduleRevertBundleDeployment");
} catch (Exception e) {
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 4b72dcf..50eaef9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -204,17 +204,22 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
public BundleDeployment createBundleDeploymentInNewTrans(Subject subject, int bundleVersionId,
int bundleDestinationId, String name, String description, Configuration configuration) throws Exception {
- return bundleManager.createBundleDeployment(subject, bundleVersionId, bundleDestinationId, name, description,
- configuration);
+ BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
+ if (null == bundleVersion) {
+ throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
+ }
+ BundleDestination bundleDestination = entityManager.find(BundleDestination.class, bundleDestinationId);
+ if (null == bundleDestination) {
+ throw new IllegalArgumentException("Invalid bundleDestinationId: " + bundleVersionId);
+ }
+
+ return createBundleDeploymentImpl(subject, bundleVersion, bundleDestination, name, description, configuration);
}
@RequiredPermission(Permission.MANAGE_BUNDLE)
public BundleDeployment createBundleDeployment(Subject subject, int bundleVersionId, int bundleDestinationId,
- String name, String description, Configuration configuration) throws Exception {
+ String description, Configuration configuration) throws Exception {
- if (null == name || "".equals(name.trim())) {
- throw new IllegalArgumentException("Invalid bundleDeploymentName: " + name);
- }
BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
if (null == bundleVersion) {
throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
@@ -223,6 +228,16 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
if (null == bundleDestination) {
throw new IllegalArgumentException("Invalid bundleDestinationId: " + bundleVersionId);
}
+
+ String name = getBundleDeploymentNameImpl(subject, bundleDestination, bundleVersion, null);
+ return this.createBundleDeploymentImpl(subject, bundleVersion, bundleDestination, name, description,
+ configuration);
+ }
+
+ private BundleDeployment createBundleDeploymentImpl(Subject subject, BundleVersion bundleVersion,
+ BundleDestination bundleDestination, String name, String description, Configuration configuration)
+ throws Exception {
+
ConfigurationDefinition configDef = bundleVersion.getConfigurationDefinition();
if (null != configDef) {
if (null == configuration) {
@@ -271,6 +286,84 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return dest;
}
+ public String getBundleDeploymentName(Subject subject, int bundleDestinationId, int bundleVersionId,
+ int prevDeploymentId) {
+ BundleDestination bundleDestination = entityManager.find(BundleDestination.class, bundleDestinationId);
+ if (null == bundleDestination) {
+ throw new IllegalArgumentException("Invalid bundleDestinationId: " + bundleVersionId);
+ }
+
+ BundleVersion bundleVersion = null;
+ BundleDeployment prevDeployment = null;
+
+ if (bundleVersionId > 0) {
+ bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
+ if (null == bundleVersion) {
+ throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
+ }
+ } else if (prevDeploymentId > 0) {
+ prevDeployment = entityManager.find(BundleDeployment.class, prevDeploymentId);
+ if (null == prevDeployment) {
+ throw new IllegalArgumentException("Invalid prevDeploymentId: " + prevDeploymentId);
+ }
+ } else {
+ throw new IllegalArgumentException("Must specify either a valid bundleVersionId [" + bundleVersionId
+ + "] or prevDeploymentId [" + prevDeploymentId + "]");
+ }
+
+ return getBundleDeploymentNameImpl(subject, bundleDestination, bundleVersion, prevDeployment);
+ }
+
+ private String getBundleDeploymentNameImpl(Subject subject, BundleDestination bundleDestination,
+ BundleVersion bundleVersion, BundleDeployment prevDeployment) {
+
+ BundleDeploymentCriteria criteria = new BundleDeploymentCriteria();
+ criteria.addFilterDestinationId(bundleDestination.getId());
+ criteria.addFilterIsLive(true);
+ criteria.fetchBundleVersion(true);
+ List<BundleDeployment> liveDeployments = bundleManager.findBundleDeploymentsByCriteria(subject, criteria);
+ BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null : liveDeployments.get(0);
+
+ String deploymentName = null;
+
+ if (null != bundleVersion) {
+ boolean isInitialDeployment = (null == liveDeployment);
+ int deploy = 1;
+ String version = bundleVersion.getVersion();
+ String dest = bundleDestination.getName();
+
+ if (isInitialDeployment) {
+ deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
+ } else {
+ String liveName = liveDeployment.getName();
+ String liveVersion = liveDeployment.getBundleVersion().getVersion();
+ if (liveVersion.equals(version)) {
+ // redeploy
+ int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
+ deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
+ deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
+ } else {
+ // upgrade
+ deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest
+ + "]. Upgrade from Version [" + liveVersion + "]";
+ }
+ }
+ } else {
+ // revert
+ if (null == liveDeployment) {
+ throw new IllegalArgumentException("Invalid Revert, no live deployment for destination"
+ + bundleDestination);
+ }
+
+ String liveName = liveDeployment.getName();
+ int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
+ int deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
+ deploymentName = "Deployment [" + deploy + "] Revert To: " + prevDeployment.getName();
+ }
+
+ return deploymentName;
+ }
+
@RequiredPermission(Permission.MANAGE_BUNDLE)
public BundleType createBundleType(Subject subject, String name, int resourceTypeId) throws Exception {
if (null == name || "".equals(name.trim())) {
@@ -670,12 +763,13 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
@RequiredPermission(Permission.MANAGE_BUNDLE)
public BundleDeployment scheduleRevertBundleDeployment(Subject subject, int bundleDestinationId,
- String deploymentName, String deploymentDescription, boolean isCleanDeployment) throws Exception {
+ String deploymentDescription, boolean isCleanDeployment) throws Exception {
BundleDeploymentCriteria c = new BundleDeploymentCriteria();
c.addFilterDestinationId(bundleDestinationId);
c.addFilterIsLive(true);
c.fetchReplacedBundleDeployment(true);
+ c.fetchDestination(true);
List<BundleDeployment> liveDeployments = bundleManager.findBundleDeploymentsByCriteria(subject, c);
if (1 != liveDeployments.size()) {
throw new IllegalArgumentException("No live deployment found for destinationId [" + bundleDestinationId
@@ -702,7 +796,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// fresh and can be tracked. The key difference in the schedule request is that we set isRevert=true,
// tell the bundle handler that we are in fact reverting from the current live deployment. The
// deployment creation is done in a new transaction so it can then be scheduled.
- String name = (null != deploymentName) ? deploymentName : prevDeployment.getName();
+ String name = getBundleDeploymentNameImpl(subject, liveDeployment.getDestination(), null, prevDeployment);
String desc = (null != deploymentDescription) ? deploymentDescription : prevDeployment.getDescription();
Configuration config = (null == prevDeployment.getConfiguration()) ? null : prevDeployment.getConfiguration()
.deepCopy(false);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
index a5937b4..c917d80 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
@@ -123,9 +123,9 @@ public interface BundleManagerLocal extends BundleManagerRemote {
throws Exception;
/**
- * Equivalent to a all to {@link BundleManagerRemote#createBundleDeployment(Subject, int, int, String, String, Configuration)}
- * with different transaction semantics. Useful when an slsb method needs to both create a deployment and schedules
- * it prior to returning to an external caller.
+ * Similar to {@link BundleManagerRemote#createBundleDeployment(Subject, int, int, String, Configuration)} but
+ * supplies the internally generated deploymentName and has different transaction semantics. Useful when an
+ * slsb method needs to both create a deployment and schedules it prior to returning to an external caller.
*/
public BundleDeployment createBundleDeploymentInNewTrans(Subject subject, int bundleVersionId,
int bundleDestinationId, String name, String description, Configuration configuration) throws Exception;
@@ -133,6 +133,18 @@ public interface BundleManagerLocal extends BundleManagerRemote {
// added here because the same method in @Remote was commented out to bypass a WSProvide issue
HashMap<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception;
+ /**
+ * Needed by the Bundle Deploy and Revert wizards GUI to generate a deployment name for display.
+ *
+ * @param subject
+ * @param bundleDestinationId required
+ * @param bundleVersionId required for progressive deployment, -1 for revert
+ * @param prevDeploymentId required for revert deployment, -1 for progressive
+ * @return
+ */
+ public String getBundleDeploymentName(Subject subject, int bundleDestinationId, int bundleVersionId,
+ int prevDeploymentId);
+
/**
* Not for general consumption. A special case method to build the pojo that can be sent to the agent to
* schedule the deployment request. Uses NOT_SUPPORTED transaction attribute to avoid having the cleaned pojo
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
index 03d6297..3ce410d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerRemote.java
@@ -120,10 +120,13 @@ public interface BundleManagerRemote {
@WebParam(name = "packageVersionId") int packageVersionId) throws Exception;
/**
+ * Create a new bundle deployment. Note that bundle deployment names are generated by this
+ * call. This provides useful, uniform naming for display. An optional, custom description
+ * can be added. This call defines a deployment. The defined deployment can then be
+ * scheduled in a separate call.
* @param subject user that must have proper permissions
* @param BundleVersionId the BundleVersion being deployed by this deployment
* @param BundleDestinationId the BundleDestination for the deployment
- * @param name a name for this deployment. not null or empty
* @param description an optional longer description describing this deployment
* @param configuration a Configuration (pojo) to be associated with this deployment. Although
* it is not enforceable must be that of the associated BundleVersion.
@@ -134,7 +137,6 @@ public interface BundleManagerRemote {
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "bundleVersionId") int bundleVersionId, //
@WebParam(name = "bundleDestinationId") int bundleDestinationId, //
- @WebParam(name = "name") String name, //
@WebParam(name = "description") String description, //
@WebParam(name = "configuration") Configuration configuration) throws Exception;
@@ -338,13 +340,12 @@ public interface BundleManagerRemote {
* A revert first rolls back to the previous deployment (bundle version and configuration) and then rolls forward
* by replacing changed files that had been backed up during the most recent (live) deployment.
* The returned BundleDeployment represents the new live deployment and can be used to track the history of the
- * individual revert deployments.
+ * individual revert deployments. Note that bundle deployment names are generated by this
+ * call. This provides useful, uniform naming for display. An optional, custom description can be added.
* <br/><br/>
* TODO: Add the scheduling capability, currently it's Immediate.
* <br/>
* @param subject user that must have proper permissions
- * @param deploymentName a name for this revert deployment. If null defaults to the name of the previous
- * deployment.
* @param deploymentDescription an optional longer description describing this deployment. If null defaults
* to the description of the previous deployment.
* @param isCleanDeployment if true perform a wipe of the deploy directory prior to the revert deployment. Backed up
@@ -356,7 +357,6 @@ public interface BundleManagerRemote {
BundleDeployment scheduleRevertBundleDeployment( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "bundleDestinationId") int bundleDestinationId, //
- @WebParam(name = "deploymentName") String deploymentName, //
@WebParam(name = "deploymentDescription") String deploymentDescription, //
@WebParam(name = "isCleanDeployment") boolean isCleanDeployment) throws Exception;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index d336e87..2463e89 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -341,8 +341,8 @@ public class WebservicesManagerBean implements WebservicesRemote {
}
public BundleDeployment createBundleDeployment(Subject subject, int bundleVersionId, int bundleDestinationId,
- String name, String description, Configuration configuration) throws Exception {
- return bundleManager.createBundleDeployment(subject, bundleVersionId, bundleDestinationId, name, description,
+ String description, Configuration configuration) throws Exception {
+ return bundleManager.createBundleDeployment(subject, bundleVersionId, bundleDestinationId, description,
configuration);
}
@@ -421,9 +421,9 @@ public class WebservicesManagerBean implements WebservicesRemote {
}
public BundleDeployment scheduleRevertBundleDeployment(Subject subject, int bundleDestinationId,
- String deploymentName, String deploymentDescription, boolean isCleanDeployment) throws Exception {
- return bundleManager.scheduleRevertBundleDeployment(subject, bundleDestinationId, deploymentName,
- deploymentDescription, isCleanDeployment);
+ String deploymentDescription, boolean isCleanDeployment) throws Exception {
+ return bundleManager.scheduleRevertBundleDeployment(subject, bundleDestinationId, deploymentDescription,
+ isCleanDeployment);
}
//BUNDLEMANAGER: END ----------------------------------
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index f668692..4b9dd37 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -966,8 +966,8 @@ public class BundleManagerBeanTest extends UpdateSubsytemTestBase {
private BundleDeployment createDeployment(String name, BundleVersion bv, BundleDestination dest,
Configuration config) throws Exception {
final String fullName = TEST_PREFIX + "-bundledeployment-" + name;
- BundleDeployment bd = bundleManager.createBundleDeployment(overlord, bv.getId(), dest.getId(), fullName,
- fullName, config);
+ BundleDeployment bd = bundleManager
+ .createBundleDeployment(overlord, bv.getId(), dest.getId(), fullName, config);
assert bd.getId() > 0;
assert bd.getName().endsWith(fullName);
14 years, 1 month
[rhq] 11 commits - .classpath modules/core modules/enterprise
by mazz
.classpath | 6
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 3
modules/core/util/src/main/java/org/rhq/core/util/updater/DeploymentData.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java | 47 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java | 16 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java | 23 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 21 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 129 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java | 21 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/HeaderLabel.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 84 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 19 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 2
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css | 25 -
modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png |binary
23 files changed, 327 insertions(+), 115 deletions(-)
New commits:
commit 7cf16927f6a488da0933c6d1941132df1d373eb1
Merge: 11e04e1... 666820e...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 13:09:28 2010 -0400
Merge branch 'bundle'
commit 666820e178fa96199cdc6d728b4cabd522fe12ce
Merge: e7dd203... 845d357...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 12:58:01 2010 -0400
Merge branch 'bundle' of ssh://git.fedorahosted.org/git/rhq/rhq into bundle
commit e7dd20308d3829dc5ae11b17623455d19823d572
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri May 28 12:57:48 2010 -0400
make javadoc more clear
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/updater/DeploymentData.java b/modules/core/util/src/main/java/org/rhq/core/util/updater/DeploymentData.java
index 3ace2f9..32c1a26 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/updater/DeploymentData.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/updater/DeploymentData.java
@@ -65,7 +65,7 @@ public class DeploymentData {
* that the regex must be applied to - in other words, the regex value is only applied
* to relative file names as found in their associated zip file.
* @param rawFilesToRealize identifies the raw files that need to be realized; note that each item in this set
- * must match a <code>rawFiles</code> entry
+ * must match a key to a <code>rawFiles</code> entry
* @param templateEngine if one or more filesToRealize are specified, this template engine is used to determine
* the values that should replace all replacement variables found in those files
* @param ignoreRegex the files/directories to ignore when updating an existing deployment
commit 845d3575948d0cef40fb5b133486626ddd6ae3ea
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri May 28 11:18:31 2010 -0400
L&F tweaks, bundle table additions, new bundle action buttons
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java
index 9e231bd..2ee987f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentDataSource.java
@@ -56,15 +56,17 @@ public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment>
DataSourceTextField name = new DataSourceTextField("name", "Deployment Name");
addField(name);
+ DataSourceTextField bundleVersion = new DataSourceTextField("bundleVersionVersion", "Bundle Version");
+ addField(bundleVersion);
+
DataSourceTextField description = new DataSourceTextField("description", "Description");
addField(description);
- DataSourceDateTimeField created = new DataSourceDateTimeField("createdTime", "Deployment Time");
- addField(created);
-
- DataSourceTextField bundleVersion = new DataSourceTextField("bundleVersion", "Bundle Version");
- addField(bundleVersion);
+ DataSourceTextField status = new DataSourceTextField("status", "Status");
+ addField(status);
+ DataSourceDateTimeField created = new DataSourceDateTimeField("deploymentTime", "Deployment Time");
+ addField(created);
}
@Override
@@ -119,8 +121,10 @@ public class BundleDeploymentDataSource extends RPCDataSource<BundleDeployment>
record.setAttribute("name", from.getName());
record.setAttribute("deployDir", from.getDestination().getDeployDir());
record.setAttribute("description", from.getDescription());
- record.setAttribute("createdTime", new Date(from.getCtime()));
+ record.setAttribute("deploymentTime", new Date(from.getCtime()));
record.setAttribute("configuration", from.getConfiguration());
+ record.setAttribute("status", from.getStatus().name());
+ record.setAttribute("deployer", from.getSubjectName());
if (from.getBundleVersion() != null) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 907a2a0..3ab7627 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -94,5 +94,28 @@ public class BundleDeploymentListView extends Table {
}
});
+
+ getListGrid().getField("bundleVersionVersion").setWidth("80");
+ getListGrid().getField("bundleVersionVersion").setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("bundleId") + "/versions/"
+ + listGridRecord.getAttribute("bundleVersionId") + "\">" + o + "</a>";
+ }
+ });
+
+ getListGrid().getField("description").setWidth("25%");
+ getListGrid().getField("deploymentTime").setWidth("20%");
+ getListGrid().getField("status").setWidth("25%");
+ ListGridField status = getListGrid().getField("status");
+ HashMap<String, String> statusIcons = new HashMap<String, String>();
+ statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(), "subsystems/bundle/install-loader.gif");
+ statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.MIXED.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.WARN.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.SUCCESS.name(), "subsystems/bundle/Ok_11.png");
+ status.setValueIcons(statusIcons);
+ status.setValueIconHeight(11);
+ status.setWidth(80);
+
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 27f8b0b..6b84ece 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -30,6 +30,7 @@ import java.util.HashSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.AnimationEffect;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
@@ -91,8 +92,7 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
addMember(new BackButton("Back to Destination: " + deployment.getDestination().getName(), "Bundles/" + version.getBundle().getId() + "/destinations/" + deployment.getDestination().getId()));
- addMember(new HeaderLabel("<img src=\"" + Canvas.getImgURL("subsystems/bundle/BundleDeployment_24.png")
- + "\"/> " + deployment.getName()));
+ addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDeployment_24.png"), deployment.getName()));
DynamicForm form = new DynamicForm();
form.setNumCols(4);
@@ -158,6 +158,8 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
Table table = new Table("Deployment Machines");
+ table.setTitleComponent(new HTMLFlow("Select a row to show install detials"));
+
ListGridField resourceIcon = new ListGridField("resourceAvailabity", "");
HashMap<String, String> icons = new HashMap<String, String>();
icons.put("UP", "types/Platform_up_16.png");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 74b7b2b..1eda39e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.HashSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -53,8 +54,10 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
+import org.rhq.enterprise.gui.coregui.client.bundle.deployment.BundleDeploymentListView;
import org.rhq.enterprise.gui.coregui.client.bundle.revert.BundleRevertWizard;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
@@ -85,12 +88,14 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
this.destination = bundleDestination;
this.bundle = bundleDestination.getBundle();
- addMember(new HeaderLabel("<img src=\"" + Canvas.getImgURL("subsystems/bundle/BundleDestination_24.png")
- + "\"/> " + destination.getName()));
+ addMember(new BackButton("Back to Bundle: " + bundle.getName(),"Bundles/Bundle/" + bundle.getId()));
+
+ addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDestination_24.png"), destination.getName()));
DynamicForm form = new DynamicForm();
form.setWidth100();
form.setNumCols(4);
+ form.setColWidths("20%","30%","25%","25%");
LinkItem bundleName = new LinkItem("bundle");
bundleName.setTitle("Bundle");
@@ -176,7 +181,14 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
}
private Table createDeploymentsTable() {
- Table table = new Table("Deployment History");
+
+ Criteria criteria = new Criteria();
+ criteria.addCriteria("bundleDestinationId", destination.getId());
+
+ return new BundleDeploymentListView(criteria);
+
+
+ /* Table table = new Table("Deployment History");
ListGridField name = new ListGridField("name", "Name");
name.setCellFormatter(new CellFormatter() {
@@ -220,7 +232,7 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
table.getListGrid().setData(records.toArray(new ListGridRecord[records.size()]));
- return table;
+ return table;*/
}
public void renderView(final ViewPath viewPath) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
index e8985c7..6b08c63 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleVersionDataSource.java
@@ -46,14 +46,16 @@ public class BundleVersionDataSource extends RPCDataSource<BundleVersion> {
idField.setPrimaryKey(true);
addField(idField);
+ DataSourceTextField latestVersionField = new DataSourceTextField("version", "Version");
+ addField(latestVersionField);
+
DataSourceTextField nameField = new DataSourceTextField("name", "Name");
addField(nameField);
DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
addField(descriptionField);
- DataSourceTextField latestVersionField = new DataSourceTextField("version", "Version");
- addField(latestVersionField);
+
DataSourceIntegerField deploymentCountField = new DataSourceIntegerField("fileCount", "File Count");
addField(deploymentCountField);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index a75587f..41c6637 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -25,8 +25,14 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.util.BooleanCallback;
+import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -36,6 +42,7 @@ import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
@@ -44,6 +51,7 @@ import org.rhq.enterprise.gui.coregui.client.Breadcrumb;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.deployment.BundleDeploymentView;
import org.rhq.enterprise.gui.coregui.client.bundle.destination.BundleDestinationListView;
import org.rhq.enterprise.gui.coregui.client.bundle.destination.BundleDestinationView;
@@ -52,8 +60,10 @@ import org.rhq.enterprise.gui.coregui.client.bundle.version.BundleVersionView;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
+import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -64,6 +74,8 @@ public class BundleView extends VLayout implements BookmarkableView {
DynamicForm form;
private Table bundleVersionsTable;
+ private BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+
private Bundle bundle;
public BundleView() {
@@ -90,10 +102,11 @@ public class BundleView extends VLayout implements BookmarkableView {
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
+ addMember(headerLabel);
+
+ addMember(createSummaryForm());
TabSet tabs = new TabSet();
- Tab summaryTab = createSummaryTab();
- tabs.addTab(summaryTab);
Tab versionsTab = createVersionsTab();
tabs.addTab(versionsTab);
@@ -101,7 +114,6 @@ public class BundleView extends VLayout implements BookmarkableView {
Tab deploymentsTab = createDestinationsTab();
tabs.addTab(deploymentsTab);
- addMember(headerLabel);
addMember(tabs);
if (nextViewId != null) {
@@ -139,38 +151,31 @@ public class BundleView extends VLayout implements BookmarkableView {
return versionsTab;
}
- private Tab createSummaryTab() {
- Tab summaryTab = new Tab("Summary");
+ private DynamicForm createSummaryForm() {
form = new DynamicForm();
- form.setWidth("50%");
+ form.setWidth100();
+ form.setColWidths("20%","30%","25%","25%");
+ form.setNumCols(4);
form.setWrapItemTitles(false);
form.setPadding(10);
StaticTextItem descriptionItem = new StaticTextItem("description", "Description");
descriptionItem.setWrap(false);
+ descriptionItem.setValue(bundle.getDescription());
StaticTextItem versionCountItem = new StaticTextItem("versionCount", "Version Count");
+ versionCountItem.setValue(bundle.getBundleVersions() != null ? bundle.getBundleVersions().size() : 0);
+ StaticTextItem destinationsCountItem = new StaticTextItem("destinationsCount", "Destinations Count");
+ destinationsCountItem.setValue(bundle.getDestinations() != null ? bundle.getDestinations().size() : 0);
- StaticTextItem latestVersionItem = new StaticTextItem("latestVersion", "Latest Version");
- latestVersionItem.setWrap(false);
-
-
- StaticTextItem liveDeployments = new StaticTextItem("liveDeployments", "Live Deployments");
-
-
- form.setFields(descriptionItem, versionCountItem, latestVersionItem, liveDeployments);
+ form.setFields(descriptionItem, getTagItem(), getActionItem(), versionCountItem, destinationsCountItem);
+ return form;
+ }
- form.setValue("description", bundle.getDescription());
- form.setValue("versionCount", bundle.getBundleVersions() != null ? bundle.getBundleVersions().size() : 0);
-
-
- HLayout layout = new HLayout();
- layout.setWidth100();
-
- layout.addMember(form);
+ private CanvasItem getTagItem() {
TagEditorView tagEditor = new TagEditorView(bundle.getTags(), false, new TagsChangedCallback() {
public void tagsChanged(HashSet<Tag> tags) {
@@ -185,17 +190,84 @@ public class BundleView extends VLayout implements BookmarkableView {
});
}
});
-// tagEditor.setAlwaysEdit(true);
tagEditor.setVertical(true);
- layout.addMember(tagEditor);
+ CanvasItem tagItem = new CanvasItem("tags");
+ tagItem.setShowTitle(false);
+ tagItem.setRowSpan(3);
+ tagItem.setCanvas(tagEditor);
- summaryTab.setPane(layout);
+ return tagItem;
+ }
+ private CanvasItem getActionItem() {
+ VLayout layout = new VLayout(10);
+
+ IButton deleteButton = new IButton("Delete");
+ deleteButton.setIcon("subsystems/bundle/BundleAction_Delete_16.png");
+ deleteButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SC.ask("Are you sure you want to delete this bundle?", new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ bundleManager.deleteBundle(bundleBeingViewed, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to delete bundle [" + bundle.getName() + "]", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted bundle [" + bundle.getName() + "]", Message.Severity.Info));
+ }
+ });
+ }
+ }
+ });
+ }
+ });
- return summaryTab;
- }
+ IButton deployButton = new IButton("Deploy");
+ deployButton.setIcon("subsystems/bundle/BundleAction_Deploy_16.png");
+ deployButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+
+ // can change this back to SINGLE selection when we feel like it. currently allowing the wizard to
+ // select the bundle.
+
+ BundleCriteria bc = new BundleCriteria();
+ bc.addFilterId(bundle.getId());
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ bundleManager.findBundlesByCriteria(bc, new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to load bundle to deploy [" + bundle.getName() + "]", caught);
+ }
+
+ public void onSuccess(PageList<Bundle> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to get single bundle to deploy [" + bundle.getName() + "]",
+ Message.Severity.Error));
+ return;
+ }
+ new BundleDeployWizard(result.get(0).getId()).startBundleWizard();
+ }
+ });
+ }
+ });
+
+ layout.addMember(deleteButton);
+ layout.addMember(deployButton);
+
+
+ CanvasItem actionItem = new CanvasItem("actions");
+ actionItem.setRowSpan(3);
+ actionItem.setShowTitle(false);
+ actionItem.setCanvas(layout);
+ return actionItem;
+ }
public void renderView(final ViewPath viewPath) {
@@ -212,6 +284,7 @@ public class BundleView extends VLayout implements BookmarkableView {
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterId(bundleId);
criteria.fetchBundleVersions(true);
+ criteria.fetchDestinations(true);
criteria.fetchTags(true);
GWTServiceLookup.getBundleService().findBundlesByCriteria(criteria,
@@ -222,7 +295,7 @@ public class BundleView extends VLayout implements BookmarkableView {
public void onSuccess(PageList<Bundle> result) {
Bundle bundle = result.get(0);
- viewId.getBreadcrumbs().set(0,new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
+ viewId.getBreadcrumbs().set(0, new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
viewBundle(bundle, viewPath.getCurrent());
// viewId.getBreadcrumbs().add(new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
CoreGUI.refreshBreadCrumbTrail();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index c668e84..86e42a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -83,7 +83,8 @@ public class BundleVersionView extends VLayout implements BookmarkableView {
addMember(new BackButton("Back to Bundle: " + version.getBundle().getName(),"Bundles/Bundle/" + version.getBundle().getId()));
- addMember(new HeaderLabel("<img src=\"" + Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png") + "\"/> " + version.getName() + ": " + version.getVersion()));
+ addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"), version.getName() + ": " + version.getVersion()));
+
addMember(tabs);
if (nextViewId != null) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/HeaderLabel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/HeaderLabel.java
index f6dbee7..2052702 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/HeaderLabel.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/HeaderLabel.java
@@ -28,7 +28,7 @@ import com.smartgwt.client.widgets.Label;
public class HeaderLabel extends HTMLFlow {
public HeaderLabel(String icon, String contents) {
- this("<img src=\"" + getImgURL(icon) + "\"/> " + contents);
+ this("<img src=\"" + getImgURL(icon) + "\" style=\"vertical-align: middle;\"/> " + contents);
}
public HeaderLabel(String contents) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 592bceb..329bbab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -192,7 +192,9 @@ public class Table extends VLayout {
titleLayout.setAlign(VerticalAlignment.BOTTOM);
if (headerIcon != null) {
- titleLayout.addMember(new Img(headerIcon,24, 24));
+ Img img = new Img(headerIcon,24, 24);
+ img.setPadding(4);
+ titleLayout.addMember(img);
}
titleLayout.addMember(title);
commit 2723617708cbe5d8e6d347de97bd856b056412db
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 27 18:02:19 2010 -0400
Bundle : more work on static deployment naming. wizard is acting a bit
strange at end but seems to work. May need F5 to clear it.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
index 513685e..36c7cde 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
@@ -54,7 +54,6 @@ public class GetDeploymentInfoStep implements WizardStep {
final StaticTextItem nameTextItem = new StaticTextItem("name", "Deployment Name");
nameTextItem.setWidth(300);
- nameTextItem.setRequired(true);
wizard.setNewDeploymentName(getDeploymentName());
wizard.setSubtitle(wizard.getNewDeploymentName());
nameTextItem.setValue(wizard.getNewDeploymentName());
@@ -100,8 +99,8 @@ public class GetDeploymentInfoStep implements WizardStep {
String liveVersion = wizard.getLiveDeployment().getBundleVersion().getVersion();
if (liveVersion.equals(version)) {
// redeploy
- int iStart = liveName.indexOf("["), iEnd = liveName.indexOf("]");
- deploy = Integer.valueOf(liveName.substring(iStart, iEnd) + 1);
+ int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
+ deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
} else {
// upgrade
@@ -114,6 +113,6 @@ public class GetDeploymentInfoStep implements WizardStep {
}
public boolean nextPage() {
- return form.validate();
+ return true;
}
}
commit ad0d278d3a5ee8838f96e11e23536f09126486fc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 27 18:00:59 2010 -0400
update gwt jar versions
diff --git a/.classpath b/.classpath
index 9804072..b6ae47b 100644
--- a/.classpath
+++ b/.classpath
@@ -247,9 +247,9 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/libvirt/libvirt/0.4.1/libvirt-0.4.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.0.0/gwt-user-2.0.0.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.0.0/gwt-dev-2.0.0.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.1/smartgwt-2.1.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.0.3/gwt-user-2.0.3.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/google/gwt/gwt-dev/2.0.3/gwt-dev-2.0.3.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/com/smartgwt/smartgwt/2.2/smartgwt-2.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
commit 439319b9e83bb2e83a2106ac86f32f4258c3adb7
Merge: a93cf0d... c579592...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 27 15:22:18 2010 -0400
Merge branch 'bundle' of ssh://git.fedorahosted.org/git/rhq/rhq into bundle
commit c579592cf1c89e6b146560de773bb5495439e380
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Thu May 27 15:15:47 2010 -0400
Fix font overriding by gwt themes (we're back to tahoma)
Improve breadcrumb layout
resource icons displayed
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
index 8916c0a..76e104c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -40,7 +40,8 @@ public class BreadcrumbTrailPane extends HTMLPane {
setBackgroundColor("#E6E3E3");
setBackgroundImage("[skin]images/SectionHeader/header_opened_stretch.png"); //ToolStrip/background.png");
setBackgroundRepeat(BkgndRepeat.REPEAT_X);
- setPadding(5);
+// setPadding(5);
+
setOverflow(Overflow.CLIP_V);
}
@@ -58,7 +59,7 @@ public class BreadcrumbTrailPane extends HTMLPane {
if (!viewId.getBreadcrumbs().isEmpty()) {
if (!first) {
path.append("/");
- content.append(" > ");
+ content.append("<img src=\"images/header/breadcrumb_space.png\" style=\"vertical-align: middle;\" width=\"28\" height=\"28\"/>");
} else {
first = false;
}
@@ -81,7 +82,7 @@ public class BreadcrumbTrailPane extends HTMLPane {
content.append("<a href=\"#");
// NOTE: We have to call toString() below, because GWT chokes if you try to append a StringBuilder.
content.append(path.toString() + breadcrumb.getName());
- content.append("\">");
+ content.append("\" style=\"padding: 0 10px;\">");
content.append(breadcrumb.getDisplayName());
content.append("</a>");
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index ab30742..4dbb543 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -76,7 +76,11 @@ public class LinkManager {
}
public static String getDashboardLink() {
- return "/Dashboard.do";
+ if (GWT) {
+ return "#Dashboard";
+ } else {
+ return "/Dashboard.do";
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 4c5ad03..74b7b2b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -154,6 +154,7 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
private Canvas getActionLayout() {
VLayout actionLayout = new VLayout();
+ actionLayout.setMembersMargin(10);
IButton deployButton = new IButton("Deploy");
deployButton.setIcon("subsystems/bundle/BundleAction_Deploy_16.png");
deployButton.addClickHandler(new ClickHandler() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index e6cfcd6..bdc854c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -53,13 +53,15 @@ public class BundlesListView extends Table {
public BundlesListView(Criteria criteria) {
super("Bundles", criteria);
- setHeaderIcon("subsystems/bundle/Bundle_24.png");
}
@Override
protected void onInit() {
super.onInit();
+ setHeaderIcon("subsystems/bundle/Bundle_24.png");
+
+
setDataSource(new BundlesWithLatestVersionDataSource());
getListGrid().getField("id").setWidth("60");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index b2a7f14..8852dfc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -33,14 +33,22 @@ import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.admin.agent.install.RemoteAgentInstallView;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
+import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
/**
* @author Greg Hinkle
*/
-public class InventoryView extends HLayout {
+public class InventoryView extends HLayout implements BookmarkableView {
public static final String VIEW_PATH = "Inventory";
@@ -179,4 +187,78 @@ public class InventoryView extends HLayout {
contentCanvas.addChild(newContent);
contentCanvas.markForRedraw();
}
+
+
+
+ private void renderContentView(ViewPath viewPath) {
+
+ ViewId currentSectionViewId = viewPath.getCurrent();
+ ViewId currentPageViewId = viewPath.getNext();
+
+ String section = currentSectionViewId.getPath();
+ String page = currentPageViewId.getPath();
+
+
+ Canvas content = null;
+ if ("Reports".equals(section)) {
+
+ if ("Inventory Summary".equals(page)) {
+ content = new FullHTMLPane("/rhq/admin/report/resourceInstallReport-body.xhtml");
+ }
+
+
+ } else if ("Security".equals(section)) {
+
+ if ("Manage Users".equals(page)) {
+ content = new UsersView();
+ } else if ("Manage Roles".equals(page)) {
+ content = new RolesView();
+ } else if ("Auto Discovery Queue".equals(page)) {
+ content = new ResourceAutodiscoveryView();
+ } else if ("Remote Agent Install".equals(page)) {
+ content = new RemoteAgentInstallView();
+ }
+ }
+
+
+ /* for (String name : treeGrids.keySet()) {
+
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (name.equals(section)) {
+ treeGrid.setSelectedPaths(page);
+ } else {
+ treeGrid.deselectAllRecords();
+ }
+ }*/
+
+
+
+ setContent(content);
+
+
+ if (content instanceof BookmarkableView) {
+ ((BookmarkableView) content).renderView(viewPath.next().next());
+ }
+
+
+ }
+
+
+ public void renderView(ViewPath viewPath) {
+
+/*
+ if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
+
+ if (viewPath.isEnd()) {
+ // Display default view
+ setContent(defaultView());
+ } else {
+ renderContentView(viewPath);
+ }
+ }
+*/
+
+
+
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 91627d2..c08c42f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -80,15 +80,15 @@ public class ResourceSearchView extends Table {
setWidth100();
setHeight100();
- DynamicForm searchPanel = new DynamicForm();
- final TextItem searchBox = new TextItem("query", "Search Resources");
- searchBox.setValue("");
- searchPanel.setWrapItemTitles(false);
- searchPanel.setFields(searchBox);
+// DynamicForm searchPanel = new DynamicForm();
+// final TextItem searchBox = new TextItem("query", "Search Resources");
+// searchBox.setValue("");
+// searchPanel.setWrapItemTitles(false);
+// searchPanel.setFields(searchBox);
final ResourceDatasource datasource = new ResourceDatasource();
- setTitleComponent(searchPanel);
+// setTitleComponent(searchPanel);
setDataSource(datasource);
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
@@ -97,6 +97,7 @@ public class ResourceSearchView extends Table {
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
+ ListGridField iconField = new ListGridField("icon","", 40);
ListGridField nameField = new ListGridField("name", "Name", 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
@@ -111,7 +112,7 @@ public class ResourceSearchView extends Table {
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
+ getListGrid().setFields(idField, iconField, nameField, descriptionField, typeNameField, pluginNameField,
categoryField, availabilityField);
addTableAction("Uninventory", Table.SelectionEnablement.ANY,
@@ -122,7 +123,7 @@ public class ResourceSearchView extends Table {
});
- searchBox.addKeyPressHandler(new KeyPressHandler() {
+ /*searchBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
datasource.setQuery((String) searchBox.getValue());
@@ -139,7 +140,7 @@ public class ResourceSearchView extends Table {
System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
}
}
- });
+ });*/
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
index b69eb0e..3c4e3a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
@@ -89,7 +89,7 @@ public class TaggedView extends VLayout implements BookmarkableView {
tileLayout = new TileLayout();
tileLayout.setWidth100();
- tileLayout.setTileHeight(250);
+ tileLayout.setTileHeight(220);
tileLayout.setTileWidth(getWidth() / 2 - 20);
addMember(tileLayout);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 05997e8..40274c1 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -8,8 +8,8 @@
body, p, td, th, option, input, textarea, select {
color: #000000;
- font-family: tahoma, verdana, sans-serif;
- font-size: 11px;
+ font-family: tahoma, verdana, sans-serif !important;
+ font-size: 11px !important;
}
img {
@@ -27,22 +27,15 @@ hr {
width: 100%;
}
-a:link {
- color: #4A5D75;
- font-weight: bold;
- text-decoration: none;
-}
+a, a:link, a:visited, a:hover {
+ color: #4A5D75 !important;
+ font-weight: bold !important;
+ text-decoration: none !important;
-a:visited {
- color: #4A5D75;
- font-weight: bold;
- text-decoration: none;
}
a:hover {
- color: #4A5D75;
- font-weight: bold;
- text-decoration: underline;
+ text-decoration: underline !important;
}
@@ -214,7 +207,7 @@ a:hover {
.SubTabButtonSelectedFocusedOver,
.SubTabButtonDisabled,
.SubTabButtonSelectedDisabled {
- font-family: Arial, Verdana, Bitstream Vera Sans, sans-serif;
+ font-family: tahoma, verdona, sans-serif;
font-size: 11px;
padding: 2px;
}
@@ -297,7 +290,7 @@ a:hover {
.SimpleButtonSelectedOver,
.SimpleButtonSelectedFocusedOver,
.SimpleButtonSelectedDisabled{
- font-family: Arial, Verdana, Bitstream Vera Sans, sans-serif;
+ font-family: tahoma, verdana, sans-serif;
font-size: 11px;
padding: 2px;
font-weight: bold;
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png b/modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png
new file mode 100644
index 0000000..e25b082
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/header/breadcrumb_space.png differ
commit a93cf0db1237d95b681fd383d8e73edf61855275
Merge: 8a80b6d... a06d973...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 27 14:07:43 2010 -0400
Merge branch 'bundle' of ssh://git.fedorahosted.org/git/rhq/rhq into bundle
commit 8a80b6de7a7701d0155f87807bd36d3afaa69f28
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 27 14:06:56 2010 -0400
Set deployment names to uneditable generated strings. This helps the user
set an intelligent value for a tricky field and will provide a more
consistent listing view of deployments
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
index c471ec6..3d315c1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/BundleDeployWizard.java
@@ -42,9 +42,9 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
List<WizardStep> steps = init();
steps.add(new SelectBundleStep(this));
steps.add(new GetDestinationStep(this));
- steps.add(new GetDeploymentInfoStep(this));
steps.add(new SelectBundleVersionStep(this));
steps.add(new GetDeploymentConfigStep(this));
+ steps.add(new GetDeploymentInfoStep(this));
steps.add(new DeployStep(this));
}
@@ -55,9 +55,9 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
List<WizardStep> steps = init();
steps.add(new GetDestinationStep(this));
- steps.add(new GetDeploymentInfoStep(this));
steps.add(new SelectBundleVersionStep(this));
steps.add(new GetDeploymentConfigStep(this));
+ steps.add(new GetDeploymentInfoStep(this));
steps.add(new DeployStep(this));
}
@@ -72,9 +72,9 @@ public class BundleDeployWizard extends AbstractBundleDeployWizard {
this.setDestination(destination);
List<WizardStep> steps = init();
- steps.add(new GetDeploymentInfoStep(this));
steps.add(new SelectBundleVersionStep(this));
steps.add(new GetDeploymentConfigStep(this));
+ steps.add(new GetDeploymentInfoStep(this));
steps.add(new DeployStep(this));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
index 5fbe7a1..513685e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
@@ -21,8 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deploy;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
@@ -52,19 +52,12 @@ public class GetDeploymentInfoStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- final TextItem nameTextItem = new TextItem("name", "Deployment Name");
+ final StaticTextItem nameTextItem = new StaticTextItem("name", "Deployment Name");
nameTextItem.setWidth(300);
nameTextItem.setRequired(true);
- nameTextItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setSubtitle(value.toString());
- wizard.setNewDeploymentName(value.toString());
- }
- });
+ wizard.setNewDeploymentName(getDeploymentName());
+ wizard.setSubtitle(wizard.getNewDeploymentName());
+ nameTextItem.setValue(wizard.getNewDeploymentName());
final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description", "Deployment Description");
descriptionTextAreaItem.setWidth(300);
@@ -93,6 +86,33 @@ public class GetDeploymentInfoStep implements WizardStep {
return form;
}
+ private String getDeploymentName() {
+ String deploymentName = "none";
+
+ int deploy = 1;
+ String version = wizard.getBundleVersion().getVersion();
+ String dest = wizard.getDestination().getName();
+
+ if (wizard.isInitialDeployment()) {
+ deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
+ } else {
+ String liveName = wizard.getLiveDeployment().getName();
+ String liveVersion = wizard.getLiveDeployment().getBundleVersion().getVersion();
+ if (liveVersion.equals(version)) {
+ // redeploy
+ int iStart = liveName.indexOf("["), iEnd = liveName.indexOf("]");
+ deploy = Integer.valueOf(liveName.substring(iStart, iEnd) + 1);
+ deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
+ } else {
+ // upgrade
+ deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest
+ + "]. Upgrade from Version [" + liveVersion + "]";
+ }
+ }
+
+ return deploymentName;
+ }
+
public boolean nextPage() {
return form.validate();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
index f4ecf09..827c3e3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
@@ -21,8 +21,8 @@ package org.rhq.enterprise.gui.coregui.client.bundle.revert;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
@@ -52,30 +52,21 @@ public class GetRevertInfoStep implements WizardStep {
form.setNumCols(2);
form.setColWidths("50%", "*");
- final TextItem nameTextItem = new TextItem("name", "Revert Deployment Name");
+ final StaticTextItem nameTextItem = new StaticTextItem("name", "Revert Deployment Name");
nameTextItem.setRequired(true);
nameTextItem.setWidth(300);
- wizard.setDeploymentName("[Reverted] " + this.wizard.getPreviousDeployment().getName());
+ wizard.setDeploymentName("[REVERT To] " + this.wizard.getPreviousDeployment().getName());
+ wizard.setSubtitle(wizard.getDeploymentName());
nameTextItem.setValue(wizard.getDeploymentName());
- nameTextItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- Object value = event.getValue();
- if (value == null) {
- value = "";
- }
- wizard.setSubtitle(value.toString());
- wizard.setDeploymentName(value.toString());
- }
- });
final TextAreaItem descriptionTextAreaItem = new TextAreaItem("description",
- "revert Deployment Description");
+ "Revert Deployment Description");
descriptionTextAreaItem.setWidth(300);
String liveDesc = this.wizard.getLiveDeployment().getDescription();
liveDesc = (null == liveDesc) ? this.wizard.getLiveDeployment().getName() : liveDesc;
String prevDesc = this.wizard.getPreviousDeployment().getDescription();
prevDesc = (null == prevDesc) ? this.wizard.getPreviousDeployment().getName() : prevDesc;
- wizard.setDeploymentDescription("[Reverted From]\n" + liveDesc + "\n\n[Reverted To]\n" + prevDesc);
+ wizard.setDeploymentDescription("[REVERT From]\n" + liveDesc + "\n\n[REVERT To]\n" + prevDesc);
descriptionTextAreaItem.setValue(wizard.getDeploymentDescription());
descriptionTextAreaItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
commit e309498563db198a660db70588abafd4a33daf6d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 27 14:05:34 2010 -0400
Change RHQ_BUNDLE_RES_DEP_HIST.CATEGORY to nullable. The upgrade did not
mirror dbsetup.
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index a00c8a5..b84efb4 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2628,8 +2628,7 @@
<schema-alterColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="ACTION" nullable="FALSE" />
<schema-addColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="INFO" columnType="VARCHAR2" precision="512" />
<schema-alterColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="INFO" nullable="FALSE" />
- <schema-addColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="CATEGORY" columnType="VARCHAR2" precision="32" />
- <schema-alterColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="CATEGORY" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="CATEGORY" columnType="VARCHAR2" precision="32" />
<schema-addColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="STATUS" columnType="VARCHAR2" precision="16" />
<schema-alterColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="STATUS" nullable="FALSE" />
<schema-addColumn table="RHQ_BUNDLE_RES_DEP_HIST" column="MESSAGE" columnType="LONGVARCHAR" />
14 years, 1 month