[rhq] Branch 'release-3.0.0' - modules/plugins
by lkrejci
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/RemoteDownloader.java | 20 +
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/ScriptDeployer.java | 52 ++++
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/CreateChildResourceFacetDelegate.java | 2
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/script/ScriptComponent.java | 105 +++++++++-
4 files changed, 172 insertions(+), 7 deletions(-)
New commits:
commit 689adfded272d5021c61a05e67acd87b0717205a
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Nov 18 14:16:50 2010 +0100
BZ 568917 - Implementing ContentFacet on ScriptComponent so that the support for uploading a new script is complete.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/RemoteDownloader.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/RemoteDownloader.java
index dd408d9..39ed50c 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/RemoteDownloader.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/RemoteDownloader.java
@@ -46,15 +46,20 @@ import org.rhq.plugins.jbossas5.util.ManagedComponentUtils;
public class RemoteDownloader implements PackageDownloader {
private ResourceContext<?> resourceContext;
+ private boolean resourceExists;
private ProfileServiceConnection profileServiceConnection;
private static final Log LOG = LogFactory.getLog(RemoteDownloader.class);
/**
- * @param resourceContext
+ * @param resourceContext the resource context if the resource exists or
+ * the parent resource context if the resource doesn't exist yet
+ * @param resourceExists this tells the downloader which API to use. This has to go
+ * hand in hand with the resourceContext that is being provided.
* @param profileServiceConnection
*/
- public RemoteDownloader(ResourceContext<?> resourceContext, ProfileServiceConnection profileServiceConnection) {
- this.resourceContext = resourceContext;
+ public RemoteDownloader(ResourceContext<?> resourceContext, boolean resourceExists, ProfileServiceConnection profileServiceConnection) {
+ this.resourceContext = resourceContext;
+ this.resourceExists = resourceExists;
this.profileServiceConnection = profileServiceConnection;
}
@@ -77,8 +82,13 @@ public class RemoteDownloader implements PackageDownloader {
os = new BufferedOutputStream(new FileOutputStream(contentCopy));
ContentContext contentContext = resourceContext.getContentContext();
ContentServices contentServices = contentContext.getContentServices();
- contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);
-
+
+ if (resourceExists) {
+ contentServices.downloadPackageBits(contentContext, key, os, true);
+ } else {
+ contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);
+ }
+
return contentCopy;
} catch (IOException e) {
throw new IllegalStateException("Failed to copy the deployed archive to destination.", e);
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/ScriptDeployer.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/ScriptDeployer.java
index 3897832..52331c0 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/ScriptDeployer.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/deploy/ScriptDeployer.java
@@ -22,6 +22,8 @@ package org.rhq.plugins.jbossas5.deploy;
import java.io.File;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.resource.CreateResourceStatus;
import org.rhq.core.domain.resource.ResourceType;
@@ -96,4 +98,54 @@ public class ScriptDeployer implements Deployer {
}
}
+ public DeployIndividualPackageResponse update(ResourcePackageDetails existingPackage, ResourceType resourceType) {
+ File script = null;
+ DeployIndividualPackageResponse response = new DeployIndividualPackageResponse(existingPackage.getKey());
+
+ try {
+
+ ResourcePackageDetails details = existingPackage;
+ script = downloader.prepareArchive(details.getKey(), resourceType);
+
+ String targetFileName = script.getName();
+
+ Configuration deploymentConfig = details.getDeploymentTimeConfiguration();
+ if (deploymentConfig != null) {
+ targetFileName = deploymentConfig.getSimpleValue(PROP_TARGET_FILE_NAME, targetFileName);
+ }
+
+ File target = new File(binDir, targetFileName);
+
+ if (!ScriptFileFinder.getScriptFileFilter(systemInfo).accept(target)) {
+ response.setResult(ContentResponseResult.FAILURE);
+ response.setErrorMessage("The supplied filename has a wrong extension. One of: "
+ + ScriptFileFinder.getSupportedFileExtensions(systemInfo) + " was expected.");
+
+ return response;
+ }
+
+ if (!target.exists()) {
+ response.setResult(ContentResponseResult.FAILURE);
+ response.setErrorMessage("A file called '" + targetFileName
+ + "' already exists in the server bin directory.");
+
+ return response;
+ }
+
+ FileUtil.copyFile(script, target);
+
+ response.setResult(ContentResponseResult.SUCCESS);
+
+ return response;
+ } catch (Exception e) {
+ response.setErrorMessage(e.getMessage());
+ response.setResult(ContentResponseResult.FAILURE);
+
+ return response;
+ } finally {
+ if (script != null) {
+ downloader.destroyArchive(script);
+ }
+ }
+ }
}
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/CreateChildResourceFacetDelegate.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/CreateChildResourceFacetDelegate.java
index 1998ba8..5a9bed1 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/CreateChildResourceFacetDelegate.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/CreateChildResourceFacetDelegate.java
@@ -150,7 +150,7 @@ public class CreateChildResourceFacetDelegate implements CreateChildResourceFace
ProfileServiceConnection profileServiceConnection = this.component.getConnection();
PackageDownloader downloader = runningEmbedded() ? new LocalDownloader() : new RemoteDownloader(
- component.getResourceContext(), profileServiceConnection);
+ component.getResourceContext(), false, profileServiceConnection);
if (ScriptComponent.TYPE_NAME.equals(resourceType.getName())) {
String jbossHome = component.getResourceContext().getPluginConfiguration()
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/script/ScriptComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/script/ScriptComponent.java
index deaf284..fd283f5 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/script/ScriptComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/script/ScriptComponent.java
@@ -23,11 +23,16 @@
package org.rhq.plugins.jbossas5.script;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -37,7 +42,17 @@ import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -47,15 +62,23 @@ import org.rhq.core.pluginapi.util.ProcessExecutionUtility;
import org.rhq.core.system.ProcessExecution;
import org.rhq.core.system.ProcessExecutionResults;
import org.rhq.core.system.SystemInfo;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.plugins.jbossas5.ApplicationServerComponent;
+import org.rhq.plugins.jbossas5.ApplicationServerPluginConfigurationProperties;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.rhq.plugins.jbossas5.deploy.Deployer;
+import org.rhq.plugins.jbossas5.deploy.RemoteDownloader;
+import org.rhq.plugins.jbossas5.deploy.ScriptDeployer;
/**
* A JON service that provides the ability to execute a script.
*
* @author Ian Springer
+ * @author Lukas Krejci
*/
-public class ScriptComponent implements ResourceComponent<ApplicationServerComponent>, OperationFacet, DeleteResourceFacet {
+public class ScriptComponent implements ResourceComponent<ApplicationServerComponent>, OperationFacet, DeleteResourceFacet, ContentFacet {
public static final String TYPE_NAME = "Script";
+ public static final String PACKAGE_TYPE = "script";
public static final String PATH_CONFIG_PROP = "path";
public static final String ENVIRONMENT_VARIABLES_CONFIG_PROP = "environmentVariables";
@@ -67,6 +90,9 @@ public class ScriptComponent implements ResourceComponent<ApplicationServerCompo
private static final String EXIT_CODE_RESULT_PROP = "exitCode";
private static final String OUTPUT_RESULT_PROP = "output";
+ private static final String PACKAGE_VERSION = "none";
+ private static final String PACKAGE_ARCHITECTURE = "noarch";
+
private final Log log = LogFactory.getLog(this.getClass());
private ResourceContext<ApplicationServerComponent> resourceContext;
@@ -142,6 +168,83 @@ public class ScriptComponent implements ResourceComponent<ApplicationServerCompo
}
}
+ public List<DeployPackageStep> generateInstallationSteps(ResourcePackageDetails packageDetails) {
+ return null;
+ }
+
+ public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails> packages, ContentServices contentServices) {
+ DeployPackagesResponse response = new DeployPackagesResponse();
+ if (packages.size() != 1) {
+ log.warn("Request to deploy a script containing multiple files, which is obivously illegal: " + packages);
+ response.setOverallRequestResult(ContentResponseResult.FAILURE);
+ response.setOverallRequestErrorMessage("Only one script can be updated at a time.");
+ return response;
+ }
+
+ try {
+ String jbossHomeDir = resourceContext.getParentResourceComponent().getResourceContext().getPluginConfiguration().getSimpleValue(ApplicationServerPluginConfigurationProperties.HOME_DIR, null);
+ SystemInfo systemInfo = resourceContext.getSystemInformation();
+ ProfileServiceConnection profileServiceConnection = resourceContext.getParentResourceComponent().getConnection();
+
+ ScriptDeployer deployer = new ScriptDeployer(jbossHomeDir, systemInfo, new RemoteDownloader(resourceContext, true, profileServiceConnection));
+ ResourcePackageDetails packageDetails = packages.iterator().next();
+
+ DeployIndividualPackageResponse scriptUpdateResult = deployer.update(packageDetails, resourceContext.getResourceType());
+
+ response.setOverallRequestResult(scriptUpdateResult.getResult());
+ response.addPackageResponse(scriptUpdateResult);
+ } catch (Exception e) {
+ response.setOverallRequestErrorMessage(e.getMessage());
+ response.setOverallRequestResult(ContentResponseResult.FAILURE);
+ }
+
+ return response;
+ }
+
+ public RemovePackagesResponse removePackages(Set<ResourcePackageDetails> packages) {
+ throw new UnsupportedOperationException("Cannot remove a package backing a script.");
+ }
+
+ public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
+ Set<ResourcePackageDetails> results = new HashSet<ResourcePackageDetails>();
+ if (PACKAGE_TYPE.equals(type.getName())) {
+ File scriptFile = new File(resourceContext.getResourceKey());
+
+ PackageDetailsKey key = new PackageDetailsKey(scriptFile.getName(), PACKAGE_VERSION, PACKAGE_TYPE, PACKAGE_ARCHITECTURE);
+ ResourcePackageDetails details = new ResourcePackageDetails(key);
+ details.setDisplayName(scriptFile.getName());
+ details.setFileName(scriptFile.getAbsolutePath());
+ details.setFileSize(scriptFile.length());
+ details.setLocation(scriptFile.getAbsolutePath());
+ details.setFileCreatedDate(scriptFile.lastModified());
+ details.setInstallationTimestamp(System.currentTimeMillis());
+ try {
+ details.setSHA256(new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(scriptFile));
+ } catch (IOException e) {
+ log.warn("Failed to compute the SHA256 digest of the script: " + scriptFile.getAbsolutePath(), e);
+ }
+ results.add(details);
+ }
+
+ return results;
+ }
+
+ public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+ String jbossHomeDir = resourceContext.getParentResourceComponent().getResourceContext().getPluginConfiguration().getSimpleValue(ApplicationServerPluginConfigurationProperties.HOME_DIR, null);
+ File binDir = new File(jbossHomeDir, "bin");
+
+ String scriptName = packageDetails.getKey().getName();
+
+ File script = new File(binDir, scriptName);
+
+ try {
+ return new FileInputStream(script);
+ } catch (FileNotFoundException e) {
+ log.warn("Failed to retrieve package bits for script " + packageDetails, e);
+ return null;
+ }
+ }
+
private void setCommandLineArguments(Configuration params, ProcessExecution processExecution) {
List<String> processExecutionArguments = processExecution.getArguments();
if (null == processExecutionArguments) {
13 years, 7 months
[rhq] 2 commits - modules/core
by Heiko W. Rupp
modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java | 20 ++++++----
1 file changed, 12 insertions(+), 8 deletions(-)
New commits:
commit 9bf79bfb1f8ec9d6694d30192b9df0351efa9004
Merge: d961337... 1957616...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Nov 18 09:33:34 2010 +0100
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit d9613378b632700856ee9c1b76e5d9a5864784e0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Nov 17 16:53:48 2010 +0100
BZ 653846 speed up PC initialization by only parsing the plugin descriptor once.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java
index d9976cb..873b3a6 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java
@@ -94,7 +94,7 @@ public class PluginManager implements ContainerService {
/**
* Finds all plugins using the plugin finder defined in the
* {@link #setConfiguration(PluginContainerConfiguration) plugin container configuration} and
- * {@link #loadPlugin(URL, ClassLoader) loads} each plugin found.
+ * {@link #loadPlugin(java.net.URL, ClassLoader, org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor) loads} each plugin found.
*
* @see ContainerService#initialize()
*/
@@ -118,6 +118,8 @@ public class PluginManager implements ContainerService {
// build our empty class loader manager - we use it to create and manage our plugin's classloaders
Map<String, URL> pluginNamesUrls = new HashMap<String, URL>();
+ // Save descriptors for later use, so we don't need to parse them twice.
+ Map<URL, PluginDescriptor> descriptors = new HashMap<URL, PluginDescriptor>();
PluginDependencyGraph graph = new PluginDependencyGraph();
boolean createResourceCL = configuration.isCreateResourceClassloaders();
this.classLoaderManager = new ClassLoaderManager(pluginNamesUrls, graph, rootCL, tmpDir, createResourceCL);
@@ -134,6 +136,7 @@ public class PluginManager implements ContainerService {
if (!disabledPlugins.contains(descriptor.getName())) {
AgentPluginDescriptorUtil.addPluginToDependencyGraph(graph, descriptor);
pluginNamesUrls.put(descriptor.getName(), url);
+ descriptors.put(url, descriptor);
} else {
log.info("Not loading disabled plugin: " + url);
}
@@ -153,7 +156,8 @@ public class PluginManager implements ContainerService {
try {
ClassLoader pluginClassLoader = this.classLoaderManager.obtainPluginClassLoader(nextPlugin);
- loadPlugin(pluginUrl, pluginClassLoader);
+ PluginDescriptor descriptor = descriptors.get(pluginUrl);
+ loadPlugin(pluginUrl, pluginClassLoader, descriptor);
} catch (Throwable t) {
// for some reason, the plugin failed to load - it will be ignored, its depending plugins will also fail later
log.error("Plugin [" + nextPlugin + "] at [" + pluginUrl
@@ -165,7 +169,7 @@ public class PluginManager implements ContainerService {
} else {
// TODO (ips, 10/21/10): I don't think this block of code is needed any longer. I am commenting it for
// now, but it should eventually be deleted.
- // Loading a null plugin loads the plugin using the current classloader (for unit test testing)
+ // Loading a null plugin loads the plugin using the current classloader (for unit test testing)
//log.info("Loading the null plugin which uses non-isolated classloader");
//loadPlugin(null, thisClassLoader);
}
@@ -283,7 +287,7 @@ public class PluginManager implements ContainerService {
/**
* Returns the manager of all classloaders created for the plugin manager.
- *
+ *
* @return the classloader manager for all plugins
*/
public ClassLoaderManager getClassLoaderManager() {
@@ -303,19 +307,19 @@ public class PluginManager implements ContainerService {
* This will create a {@link PluginEnvironment} for the plugin at the given URL. The plugin's descriptor is parsed.
* Once this method returns, the plugin's components are ready to be created and used.
*
+ *
* @param pluginUrl the new plugin's jar location
* @param classLoader the new plugin's classloader
- *
+ * @param pluginDescriptor THe already parsed plugin descriptor for this plugin
* @throws PluginContainerException if the plugin fails to load
*/
- private void loadPlugin(URL pluginUrl, ClassLoader classLoader) throws PluginContainerException {
+ private void loadPlugin(URL pluginUrl, ClassLoader classLoader, PluginDescriptor pluginDescriptor) throws PluginContainerException {
if (log.isDebugEnabled()) {
log.debug("Loading plugin from [" + pluginUrl + "] in classloader [" + classLoader + "]...");
}
PluginDescriptorLoader pluginDescriptorLoader = new PluginDescriptorLoader(pluginUrl, classLoader);
- PluginDescriptor pluginDescriptor = pluginDescriptorLoader.loadPluginDescriptor();
PluginEnvironment pluginEnvironment = new PluginEnvironment(pluginDescriptor.getName(), pluginDescriptorLoader);
String pluginName = pluginEnvironment.getPluginName();
@@ -396,4 +400,4 @@ public class PluginManager implements ContainerService {
return;
}
-}
\ No newline at end of file
+}
13 years, 7 months
[rhq] Branch 'release-3.0.0' - 2 commits - modules/enterprise modules/plugins
by fdrabek
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 523 +++++-----
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java | 10
2 files changed, 274 insertions(+), 259 deletions(-)
New commits:
commit e1c81ab6769109cce3d01ecec265df8508f438bb
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Thu Nov 18 09:12:06 2010 +0100
reverting of BZ-648790 - user needs only View Group permission to see Group Plugin Configuration Update
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 90f28d4..c49aa9d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -1,20 +1,14 @@
/*
- * 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 as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * 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 as published by the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.rhq.enterprise.server.configuration;
@@ -109,7 +103,7 @@ import org.rhq.enterprise.server.util.QuartzUtil;
/**
* The manager responsible for working with resource and plugin configurations.
- *
+ *
* @author John Mazzitelli
* @author Ian Springer
*/
@@ -150,7 +144,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!authorizationManager.canViewResource(subject, resourceId)) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view plugin configuration for [" + resource + "]");
+ + "] does not have permission to view plugin configuration for [" + resource + "]");
}
Configuration pluginConfiguration = configurationManager.getPluginConfiguration(resourceId);
@@ -159,7 +153,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
// Use new transaction because this only works if the resource in question has not
- // yet been loaded by Hibernate. We want the query to return a non-proxied configuration,
+ // yet been loaded by Hibernate. We want the query to return a non-proxied configuration,
// this is critical for remote API use.
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public Configuration getPluginConfiguration(int resourceId) {
@@ -200,15 +194,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
entityManager.merge(update);
} else {
- handlePluginConfiguratonUpdateRemoteException(resource, response.getStatus().toString(),
- response.getErrorMessage());
+ handlePluginConfiguratonUpdateRemoteException(resource, response.getStatus().toString(), response
+ .getErrorMessage());
update.setStatus(response.getStatus());
update.setErrorMessage(response.getErrorMessage());
}
}
- // use requires new so that exceptions bubbling up from the agent.updatePluginConfiguration don't force callers to rollback as well
+ // use requires new so that exceptions bubbling up from the agent.updatePluginConfiguration don't force callers to
+ // rollback as well
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public ConfigurationUpdateResponse executePluginConfigurationUpdate(PluginConfigurationUpdate update) {
Resource resource = update.getResource();
@@ -226,7 +221,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
agentClient.getDiscoveryAgentService().executeServiceScanDeferred();
} catch (Exception e) {
log.warn("Failed to execute service scan - cannot detect children of the newly connected resource ["
- + resource + "]", e);
+ + resource + "]", e);
}
response = new ConfigurationUpdateResponse(update.getId(), null, ConfigurationUpdateStatus.SUCCESS, null);
@@ -238,7 +233,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public PluginConfigurationUpdate updatePluginConfiguration(Subject subject, int resourceId,
- @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration configuration) throws ResourceNotFoundException {
+ @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration configuration)
+ throws ResourceNotFoundException {
Subject overlord = subjectManager.getOverlord();
Resource resource = resourceManager.getResourceById(overlord, resourceId);
@@ -274,7 +270,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_READ, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration for [" + resource + "]");
+ + "] does not have permission to view resource configuration for [" + resource + "]");
}
Configuration result = configurationManager.getResourceConfiguration(resourceId);
@@ -283,7 +279,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
// Use new transaction because this only works if the resource in question has not
- // yet been loaded by Hibernate. We want the query to return a non-proxied configuration,
+ // yet been loaded by Hibernate. We want the query to return a non-proxied configuration,
// this is critical for remote API use.
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public Configuration getResourceConfiguration(int resourceId) {
@@ -297,7 +293,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public ResourceConfigurationUpdate getLatestResourceConfigurationUpdate(Subject subject, int resourceId,
- boolean fromStructured) {
+ boolean fromStructured) {
log.debug("Getting current resource configuration for resource [" + resourceId + "]");
Resource resource;
@@ -306,7 +302,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
// Get the latest configuration as known to the server (i.e. persisted in the DB).
try {
Query query = entityManager
- .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
+ .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
query.setParameter("resourceId", resourceId);
current = (ResourceConfigurationUpdate) query.getSingleResult();
resource = current.getResource();
@@ -317,13 +313,13 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
throw new NoResultException("Cannot get latest resource configuration for unknown resource ["
- + resourceId + "]");
+ + resourceId + "]");
}
}
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_READ, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration for [" + resource + "]");
+ + "] does not have permission to view resource configuration for [" + resource + "]");
}
// Check whether or not a resource configuration update is currently in progress.
@@ -364,12 +360,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
// not effect our current transaction since the persist call was made with REQUIRES_NEW
// and thus only that new tx was rolled back
log.debug("Resource is currently in progress of changing its resource configuration - "
- + "since it hasn't finished yet, will use the last successful resource configuration: " + e);
+ + "since it hasn't finished yet, will use the last successful resource configuration: " + e);
}
}
} else {
log.warn("Could not get live resource configuration for resource [" + resource
- + "]; will assume latest resource configuration update is the current resource configuration.");
+ + "]; will assume latest resource configuration update is the current resource configuration.");
}
return current;
@@ -381,7 +377,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
private ResourceConfigurationUpdate persistNewAgentReportedResourceConfiguration(Resource resource,
- Configuration liveConfig) throws ConfigurationUpdateStillInProgressException {
+ Configuration liveConfig) throws ConfigurationUpdateStillInProgressException {
if (liveConfig.getRawConfigurations() != null) {
for (RawConfiguration raw : liveConfig.getRawConfigurations()) {
@@ -392,16 +388,15 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
/*
- * NOTE: We pass the overlord, since this is a system side-effect. here, the system
- * and *not* the user, is choosing to persist the most recent configuration because it was different
- * from the last known value. again, the user isn't attempting to change the value; instead, *JON*
- * is triggering save based on the semantics that we want to provide for configuration updates.
- * For the same reason, we pass null as the subject.
- */
+ * NOTE: We pass the overlord, since this is a system side-effect. here, the system and *not* the user, is
+ * choosing to persist the most recent configuration because it was different from the last known value. again,
+ * the user isn't attempting to change the value; instead, *JON* is triggering save based on the semantics that
+ * we want to provide for configuration updates. For the same reason, we pass null as the subject.
+ */
ResourceConfigurationUpdate update = this.configurationManager.persistNewResourceConfigurationUpdateHistory(
- this.subjectManager.getOverlord(), resource.getId(), liveConfig, ConfigurationUpdateStatus.SUCCESS, null,
- false);
- //resource.setResourceConfiguration(liveConfig.deepCopy(false));
+ this.subjectManager.getOverlord(), resource.getId(), liveConfig, ConfigurationUpdateStatus.SUCCESS,
+ null, false);
+ // resource.setResourceConfiguration(liveConfig.deepCopy(false));
resource.setResourceConfiguration(liveConfig.deepCopyWithoutProxies());
return update;
}
@@ -425,13 +420,13 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
throw new NoResultException("Cannot get latest plugin configuration for unknown resource ["
- + resourceId + "]");
+ + resourceId + "]");
}
}
if (!authorizationManager.canViewResource(subject, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view plugin configuration for [" + resource + "]");
+ + "] does not have permission to view plugin configuration for [" + resource + "]");
}
return current;
@@ -444,10 +439,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
query.setParameter("resourceId", resourceId);
ResourceConfigurationUpdate latestConfigUpdate = (ResourceConfigurationUpdate) query.getSingleResult();
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_READ, latestConfigUpdate
- .getResource().getId())) {
+ .getResource().getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view Resource configuration for ["
- + latestConfigUpdate.getResource() + "]");
+ + "] does not have permission to view Resource configuration for ["
+ + latestConfigUpdate.getResource() + "]");
}
updateInProgress = (latestConfigUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
} catch (NoResultException nre) {
@@ -465,8 +460,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
PluginConfigurationUpdate latestConfigUpdate = (PluginConfigurationUpdate) query.getSingleResult();
if (!authorizationManager.canViewResource(subject, latestConfigUpdate.getResource().getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view plugin configuration for ["
- + latestConfigUpdate.getResource() + "]");
+ + "] does not have permission to view plugin configuration for ["
+ + latestConfigUpdate.getResource() + "]");
}
updateInProgress = (latestConfigUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
} catch (NoResultException nre) {
@@ -480,14 +475,14 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
boolean updateInProgress;
try {
Query query = entityManager
- .createNamedQuery(GroupResourceConfigurationUpdate.QUERY_FIND_LATEST_BY_GROUP_ID);
+ .createNamedQuery(GroupResourceConfigurationUpdate.QUERY_FIND_LATEST_BY_GROUP_ID);
query.setParameter("groupId", groupId);
GroupResourceConfigurationUpdate latestConfigGroupUpdate = (GroupResourceConfigurationUpdate) query
- .getSingleResult();
+ .getSingleResult();
if (!authorizationManager.canViewGroup(subject, latestConfigGroupUpdate.getGroup().getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view group Resource configuration for ["
- + latestConfigGroupUpdate.getGroup() + "]");
+ + "] does not have permission to view group Resource configuration for ["
+ + latestConfigGroupUpdate.getGroup() + "]");
}
updateInProgress = (latestConfigGroupUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
@@ -505,11 +500,11 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Query query = entityManager.createNamedQuery(GroupPluginConfigurationUpdate.QUERY_FIND_LATEST_BY_GROUP_ID);
query.setParameter("groupId", groupId);
GroupPluginConfigurationUpdate latestConfigGroupUpdate = (GroupPluginConfigurationUpdate) query
- .getSingleResult();
+ .getSingleResult();
if (!authorizationManager.canViewGroup(subject, latestConfigGroupUpdate.getGroup().getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view group plugin configuration for ["
- + latestConfigGroupUpdate.getGroup() + "]");
+ + "] does not have permission to view group plugin configuration for ["
+ + latestConfigGroupUpdate.getGroup() + "]");
}
updateInProgress = (latestConfigGroupUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS);
@@ -522,11 +517,11 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public Map<Integer, Configuration> getResourceConfigurationsForCompatibleGroup(Subject subject, int groupId)
- throws ConfigurationUpdateStillInProgressException, Exception {
+ throws ConfigurationUpdateStillInProgressException, Exception {
if (authorizationManager.hasGroupPermission(subject, Permission.CONFIGURE_READ, groupId) == false) {
throw new PermissionException("User[name=" + subject.getName()
- + "] does not have permission to view configuration for group[id=" + groupId + "]");
+ + "] does not have permission to view configuration for group[id=" + groupId + "]");
}
// The below call will also handle the check to see if the subject has perms to view the group.
@@ -538,10 +533,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
AvailabilityType availability = (groupComposite.getExplicitAvail() == 1) ? AvailabilityType.UP
- : AvailabilityType.DOWN;
+ : AvailabilityType.DOWN;
if (availability == AvailabilityType.DOWN)
throw new Exception("Current group Resource configuration for " + groupId
- + " cannot be calculated, because one or more of this group's member Resources are DOWN.");
+ + " cannot be calculated, because one or more of this group's member Resources are DOWN.");
// If we got this far, all member Resources are UP. Now check to make sure no config updates, group-level or
// resource-level, are in progress.
@@ -554,7 +549,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
int userPreferencesTimeout = new SubjectPreferences(subject).getGroupConfigurationTimeoutPeriod();
Set<Resource> groupMembers = group.getExplicitResources();
Map<Integer, Configuration> liveConfigs = LiveConfigurationLoader.getInstance().loadLiveResourceConfigurations(
- groupMembers, userPreferencesTimeout);
+ groupMembers, userPreferencesTimeout);
// If we got this far, we were able to retrieve all of the live configs from the Agents. Now load the current
// persisted configs from the DB and compare them to the corresponding live configs. For any that are not equal,
@@ -567,22 +562,22 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!liveConfig.equals(currentPersistedConfig)) {
// If the live config is different than the persisted config, persist it as the new current config.
ResourceConfigurationUpdate update = persistNewAgentReportedResourceConfiguration(memberResource,
- liveConfig);
+ liveConfig);
if (update != null)
currentPersistedConfigs.put(memberResource.getId(), update.getConfiguration());
else
log.error("Current Configuration for " + memberResource
- + " does not match latest associated ResourceConfigurationUpdate with SUCCESS status.");
+ + " does not match latest associated ResourceConfigurationUpdate with SUCCESS status.");
}
}
return currentPersistedConfigs;
}
public Map<Integer, Configuration> getPluginConfigurationsForCompatibleGroup(Subject subject, int groupId)
- throws ConfigurationUpdateStillInProgressException, Exception {
+ throws ConfigurationUpdateStillInProgressException, Exception {
// The below call will also handle the check to see if the subject has perms to view the group.
ResourceGroup group = this.resourceGroupManager
- .getResourceGroupById(subject, groupId, GroupCategory.COMPATIBLE);
+ .getResourceGroupById(subject, groupId, GroupCategory.COMPATIBLE);
// Check to make sure no config updates, group-level or resource-level, are in progress.
ensureNoPluginConfigurationUpdatesInProgress(group);
@@ -595,16 +590,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
private void ensureNoResourceConfigurationUpdatesInProgress(ResourceGroup compatibleGroup)
- throws ConfigurationUpdateStillInProgressException {
+ throws ConfigurationUpdateStillInProgressException {
if (isGroupResourceConfigurationUpdateInProgress(this.subjectManager.getOverlord(), compatibleGroup.getId())) {
throw new ConfigurationUpdateStillInProgressException("Current group Resource configuration for "
- + compatibleGroup
- + " cannot be calculated, because a group Resource configuration update is currently in progress "
- + " (please wait for this update to complete or delete it from the history).");
+ + compatibleGroup
+ + " cannot be calculated, because a group Resource configuration update is currently in progress "
+ + " (please wait for this update to complete or delete it from the history).");
}
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- ResourceConfigurationUpdate.QUERY_FIND_BY_GROUP_ID_AND_STATUS);
+ ResourceConfigurationUpdate.QUERY_FIND_BY_GROUP_ID_AND_STATUS);
countQuery.setParameter("groupId", compatibleGroup.getId());
countQuery.setParameter("status", ConfigurationUpdateStatus.INPROGRESS);
long count = (Long) countQuery.getSingleResult();
@@ -613,20 +608,21 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
query.setParameter("groupId", compatibleGroup.getId());
query.setParameter("status", ConfigurationUpdateStatus.INPROGRESS);
List<Resource> resources = query.getResultList();
- throw new ConfigurationUpdateStillInProgressException("Current group Resource configuration for "
- + compatibleGroup
- + " cannot be calculated, because Resource configuration updates are currently in progress for the"
- + " following Resources (please wait for these updates to complete or delete them from the history): "
- + resources);
+ throw new ConfigurationUpdateStillInProgressException(
+ "Current group Resource configuration for "
+ + compatibleGroup
+ + " cannot be calculated, because Resource configuration updates are currently in progress for the"
+ + " following Resources (please wait for these updates to complete or delete them from the history): "
+ + resources);
}
}
private void ensureNoPluginConfigurationUpdatesInProgress(ResourceGroup compatibleGroup)
- throws ConfigurationUpdateStillInProgressException {
+ throws ConfigurationUpdateStillInProgressException {
if (isGroupPluginConfigurationUpdateInProgress(this.subjectManager.getOverlord(), compatibleGroup.getId())) {
throw new ConfigurationUpdateStillInProgressException("Current group plugin configuration for "
- + compatibleGroup
- + " cannot be calculated, because a group plugin configuration update is currently in progress.");
+ + compatibleGroup
+ + " cannot be calculated, because a group plugin configuration update is currently in progress.");
}
List<Resource> resourcesWithPluginConfigUpdatesInProgress = new ArrayList<Resource>();
for (Resource memberResource : compatibleGroup.getExplicitResources()) {
@@ -635,22 +631,22 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
if (!resourcesWithPluginConfigUpdatesInProgress.isEmpty())
throw new ConfigurationUpdateStillInProgressException(
- "Current group plugin configuration for "
- + compatibleGroup
- + " cannot be calculated, because plugin configuration updates are currently in progress for the following Resources: "
- + resourcesWithPluginConfigUpdatesInProgress);
+ "Current group plugin configuration for "
+ + compatibleGroup
+ + " cannot be calculated, because plugin configuration updates are currently in progress for the following Resources: "
+ + resourcesWithPluginConfigUpdatesInProgress);
}
@SuppressWarnings("unchecked")
private Map<Integer, Configuration> getPersistedResourceConfigurationsForCompatibleGroup(
- ResourceGroup compatibleGroup) {
+ ResourceGroup compatibleGroup) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_ID);
+ Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_ID);
countQuery.setParameter("resourceGroupId", compatibleGroup.getId());
long count = (Long) countQuery.getSingleResult();
if (count != compatibleGroup.getExplicitResources().size())
throw new IllegalStateException("Size of group changed from "
- + compatibleGroup.getExplicitResources().size() + " to " + count + " - please retry the operation.");
+ + compatibleGroup.getExplicitResources().size() + " to " + count + " - please retry the operation.");
// Configurations are very expensive to load, so load 'em in chunks to ease the strain on the DB.
PageControl pageControl = new PageControl(0, 10);
@@ -681,12 +677,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
private Map<Integer, Configuration> getPersistedPluginConfigurationsForCompatibleGroup(ResourceGroup compatibleGroup) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_ID);
+ Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_ID);
countQuery.setParameter("resourceGroupId", compatibleGroup.getId());
long count = (Long) countQuery.getSingleResult();
if (count != compatibleGroup.getExplicitResources().size())
throw new IllegalStateException("Size of group changed from "
- + compatibleGroup.getExplicitResources().size() + " to " + count + " - please retry the operation.");
+ + compatibleGroup.getExplicitResources().size() + " to " + count + " - please retry the operation.");
// Configurations are very expensive to load, so load 'em in chunks to ease the strain on the DB.
PageControl pageControl = new PageControl(0, 20);
@@ -715,12 +711,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public Configuration getLiveResourceConfiguration(Subject subject, int resourceId, boolean pingAgentFirst)
- throws Exception {
+ throws Exception {
return getLiveResourceConfiguration(subject, resourceId, pingAgentFirst, true);
}
public Configuration getLiveResourceConfiguration(Subject subject, int resourceId, boolean pingAgentFirst,
- boolean fromStructured) throws Exception {
+ boolean fromStructured) throws Exception {
Resource resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
@@ -729,7 +725,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!authorizationManager.canViewResource(subject, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration for [" + resource + "]");
+ + "] does not have permission to view resource configuration for [" + resource + "]");
}
// ask the agent to get us the live, most up-to-date configuration for the resource
@@ -749,7 +745,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
private void checkForTimedOutResourceConfigurationUpdateRequests() {
try {
// TODO (ips): Optimize this so the query actually does the timeout check too,
- // i.e. "WHERE cu.createdtime > :maxCreatedTime".
+ // i.e. "WHERE cu.createdtime > :maxCreatedTime".
Query query = entityManager.createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_ALL_IN_STATUS);
query.setParameter("status", ConfigurationUpdateStatus.INPROGRESS);
List<ResourceConfigurationUpdate> requests = query.getResultList();
@@ -760,9 +756,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
long duration = request.getDuration();
if (duration > timeout) {
log.info("Resource configuration update request seems to have been orphaned - timing it out: "
- + request);
+ + request);
request.setErrorMessage("Timed out - did not complete after " + duration + " ms"
- + " (the timeout period was " + timeout + " ms)");
+ + " (the timeout period was " + timeout + " ms)");
request.setStatus(ConfigurationUpdateStatus.FAILURE);
// If it's part of a group update, check if all member updates of the group update have completed,
// and, if so, update the group update's status.
@@ -778,22 +774,22 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
private void checkForTimedOutGroupResourceConfigurationUpdateRequests() {
try {
// TODO (ips): Optimize this so the query actually does the timeout check too,
- // i.e. "WHERE cu.createdtime > :maxCreatedTime".
+ // i.e. "WHERE cu.createdtime > :maxCreatedTime".
Query query = entityManager.createNamedQuery(GroupResourceConfigurationUpdate.QUERY_FIND_ALL_IN_STATUS);
query.setParameter("status", ConfigurationUpdateStatus.INPROGRESS);
List<GroupResourceConfigurationUpdate> requests = query.getResultList();
for (GroupResourceConfigurationUpdate request : requests) {
// Note: Make this a little longer than the timeout used for individual Resource config updates
- // (see checkForTimedOutResourceConfigurationUpdateRequests()), to ensure a group update never
- // gets timed out before one or more of its member updates.
+ // (see checkForTimedOutResourceConfigurationUpdateRequests()), to ensure a group update never
+ // gets timed out before one or more of its member updates.
long timeout = 1000L * 60 * 11; // 11 minutes
long duration = request.getDuration();
if (duration > timeout) {
log.info("Group Resource configuration update request seems to have been orphaned - timing it out: "
- + request);
+ + request);
request.setErrorMessage("Timed out - did not complete after " + duration + " ms"
- + " (the timeout period was " + timeout + " ms)");
+ + " (the timeout period was " + timeout + " ms)");
request.setStatus(ConfigurationUpdateStatus.FAILURE);
}
}
@@ -804,11 +800,11 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public PageList<PluginConfigurationUpdate> findPluginConfigurationUpdates(Subject subject, int resourceId,
- Long beginDate, Long endDate, PageControl pc) {
+ Long beginDate, Long endDate, PageControl pc) {
Resource resource = entityManager.find(Resource.class, resourceId);
if (resource.getResourceType().getPluginConfigurationDefinition() == null
- || resource.getResourceType().getPluginConfigurationDefinition().getPropertyDefinitions().isEmpty()) {
+ || resource.getResourceType().getPluginConfigurationDefinition().getPropertyDefinitions().isEmpty()) {
return new PageList<PluginConfigurationUpdate>(pc);
}
@@ -841,7 +837,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
resource = updates.get(0).getResource();
if (!authorizationManager.canViewResource(subject, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource [" + resource + "]");
+ + "] does not have permission to view resource [" + resource + "]");
}
}
@@ -850,16 +846,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public PageList<ResourceConfigurationUpdate> findResourceConfigurationUpdates(Subject subject, Integer resourceId,
- Long beginDate, Long endDate, boolean suppressOldest, PageControl pc) {
+ Long beginDate, Long endDate, boolean suppressOldest, PageControl pc) {
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_READ, resourceId)) {
throw new PermissionException("User[" + subject.getName()
- + "] does not have permission to view configuration history for resource[id=" + resourceId + "]");
+ + "] does not have permission to view configuration history for resource[id=" + resourceId + "]");
}
// TODO (ips, 04/01/10): Our id's are not guaranteed to be sequential, because our sequences are configured to
- // pre-create and cache blocks of 10 sequence id's, so it may be better to order by
- // "cu.createdTime", rather than "cu.id".
+ // pre-create and cache blocks of 10 sequence id's, so it may be better to order by
+ // "cu.createdTime", rather than "cu.id".
pc.initDefaultOrderingField("cu.id", PageOrdering.DESC);
String queryName = ResourceConfigurationUpdate.QUERY_FIND_ALL_BY_RESOURCE_ID;
@@ -899,7 +895,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!authorizationManager.canViewResource(subject, update.getResource().getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view plugin configuration update for [" + update.getResource() + "]");
+ + "] does not have permission to view plugin configuration update for [" + update.getResource()
+ + "]");
}
update.getConfiguration(); // this is EAGER loaded, so this really doesn't do anything
@@ -909,11 +906,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public ResourceConfigurationUpdate getResourceConfigurationUpdate(Subject subject, int configurationUpdateId) {
ResourceConfigurationUpdate update = entityManager.find(ResourceConfigurationUpdate.class,
- configurationUpdateId);
+ configurationUpdateId);
if (!authorizationManager.canViewResource(subject, update.getResource().getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration update for [" + update.getResource() + "]");
+ + "] does not have permission to view resource configuration update for [" + update.getResource()
+ + "]");
}
update.getConfiguration(); // this is EAGER loaded, so this really doesn't do anything
@@ -923,7 +921,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public void purgePluginConfigurationUpdate(Subject subject, int configurationUpdateId, boolean purgeInProgress) {
PluginConfigurationUpdate doomedRequest = entityManager.find(PluginConfigurationUpdate.class,
- configurationUpdateId);
+ configurationUpdateId);
if (doomedRequest == null) {
log.debug("Asked to purge a non-existing config update request [" + configurationUpdateId + "]");
@@ -932,16 +930,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if ((doomedRequest.getStatus() == ConfigurationUpdateStatus.INPROGRESS) && !purgeInProgress) {
throw new IllegalStateException(
- "The update request is still in the in-progress state. Please wait for it to complete: "
- + doomedRequest);
+ "The update request is still in the in-progress state. Please wait for it to complete: "
+ + doomedRequest);
}
// make sure the user has the proper permissions to do this
Resource resource = doomedRequest.getResource();
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_WRITE, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to purge a plugin configuration update audit trail for resource ["
- + resource + "]");
+ + "] does not have permission to purge a plugin configuration update audit trail for resource ["
+ + resource + "]");
}
resource.getPluginConfigurationUpdates().remove(doomedRequest);
@@ -953,7 +951,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public void purgeResourceConfigurationUpdate(Subject subject, int configurationUpdateId, boolean purgeInProgress) {
ResourceConfigurationUpdate doomedRequest = entityManager.find(ResourceConfigurationUpdate.class,
- configurationUpdateId);
+ configurationUpdateId);
if (doomedRequest == null) {
log.debug("Asked to purge a non-existing config update request [" + configurationUpdateId + "]");
@@ -962,16 +960,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if ((doomedRequest.getStatus() == ConfigurationUpdateStatus.INPROGRESS) && !purgeInProgress) {
throw new IllegalStateException(
- "The update request is still in the in-progress state. Please wait for it to complete: "
- + doomedRequest);
+ "The update request is still in the in-progress state. Please wait for it to complete: "
+ + doomedRequest);
}
// make sure the user has the proper permissions to do this
Resource resource = doomedRequest.getResource();
if (!authorizationManager.hasResourcePermission(subject, Permission.MODIFY_RESOURCE, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to purge a configuration update audit trail for resource [" + resource
- + "]");
+ + "] does not have permission to purge a configuration update audit trail for resource ["
+ + resource + "]");
}
resource.getResourceConfigurationUpdates().remove(doomedRequest);
@@ -995,12 +993,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject subject, int resourceId,
- Configuration newConfiguration, boolean fromStructured) throws ResourceNotFoundException,
- ConfigurationUpdateStillInProgressException {
+ Configuration newConfiguration, boolean fromStructured) throws ResourceNotFoundException,
+ ConfigurationUpdateStillInProgressException {
if (authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_WRITE, resourceId) == false) {
throw new PermissionException("User[name=" + subject.getName()
- + "] does not have the permission to update configuration for resource[id=" + resourceId + "]");
+ + "] does not have the permission to update configuration for resource[id=" + resourceId + "]");
}
Configuration configToUpdate = newConfiguration;
@@ -1010,11 +1008,11 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
try {
Configuration invalidConfig = validateResourceConfiguration(subject, resourceId, newConfiguration,
- fromStructured);
+ fromStructured);
if (null != invalidConfig) {
Resource resource = resourceManager.getResourceById(subject, resourceId);
ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource,
- invalidConfig, subject.getName());
+ invalidConfig, subject.getName());
resourceConfigurationUpdate.setErrorMessage("resource.validation.failed");
resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
@@ -1023,27 +1021,27 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
} catch (PluginContainerException e) {
Resource resource = resourceManager.getResourceById(subject, resourceId);
ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource,
- newConfiguration, subject.getName());
+ newConfiguration, subject.getName());
resourceConfigurationUpdate.setErrorMessage(e.getMessage());
resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
return resourceConfigurationUpdate;
}
ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory(
- subject, resourceId, configToUpdate, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
+ subject, resourceId, configToUpdate, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate, fromStructured);
return newUpdate;
}
private Configuration validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
- boolean isStructured) throws PluginContainerException {
+ boolean isStructured) throws PluginContainerException {
Resource resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
throw new NoResultException("Cannot get live configuration for unknown resource [" + resourceId + "]");
}
if (!authorizationManager.canViewResource(subject, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration for [" + resource + "]");
+ + "] does not have permission to view resource configuration for [" + resource + "]");
}
Agent agent = resource.getAgent();
AgentClient agentClient = this.agentManager.getAgentClient(agent);
@@ -1056,7 +1054,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
ConfigurationDefinition configDef = resource.getResourceType().getResourceConfigurationDefinition();
return (ConfigurationFormat.STRUCTURED_AND_RAW == configDef.getConfigurationFormat() || (ConfigurationFormat.RAW == configDef
- .getConfigurationFormat()));
+ .getConfigurationFormat()));
}
private boolean isStructuredAndRawSupported(int resourceId) {
@@ -1068,19 +1066,19 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@Nullable
public ResourceConfigurationUpdate updateResourceConfiguration(Subject subject, int resourceId,
- @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration newConfiguration)
- throws ResourceNotFoundException {
+ @XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration newConfiguration)
+ throws ResourceNotFoundException {
if (isStructuredAndRawSupported(resourceId)) {
throw new ConfigurationUpdateNotSupportedException("Cannot update a resource configuration that "
- + "supports both structured and raw configuration using this method because there is insufficient "
- + "information. You should instead call updateStructuredOrRawConfiguration() which requires you "
- + "whether the structured or raw was updated.");
+ + "supports both structured and raw configuration using this method because there is insufficient "
+ + "information. You should instead call updateStructuredOrRawConfiguration() which requires you "
+ + "whether the structured or raw was updated.");
}
if (authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_WRITE, resourceId) == false) {
throw new PermissionException("User[name=" + subject.getName()
- + "] does not have the permission to update configuration for resource[id=" + resourceId + "]");
+ + "] does not have the permission to update configuration for resource[id=" + resourceId + "]");
}
// must do this in a separate transaction so it is committed prior to sending the agent request
@@ -1090,7 +1088,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
// here we call ourself, but we do so via the EJB interface so we pick up the REQUIRES_NEW semantics
// this can return null if newConfiguration is not actually different.
newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory(subject, resourceId,
- newConfiguration, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
+ newConfiguration, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate, true);
@@ -1111,11 +1109,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
private void executeResourceConfigurationUpdate(ResourceConfigurationUpdate update, boolean fromStructured) {
try {
AgentClient agentClient = agentManager.getAgentClient(update.getResource().getAgent());
- ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(update.getId(),
- update.getConfiguration(), update.getResource().getId());
+ ConfigurationUpdateRequest request = new ConfigurationUpdateRequest(update.getId(), update
+ .getConfiguration(), update.getResource().getId());
agentClient.getConfigurationAgentService().updateResourceConfiguration(request);
} catch (RuntimeException e) {
- // Any exception means the remote call itself failed - make sure to change the status on the update to FAILURE
+ // Any exception means the remote call itself failed - make sure to change the status on the update to
+ // FAILURE
// and set its error message field.
if (null != update) {
update.setStatus(ConfigurationUpdateStatus.FAILURE);
@@ -1128,13 +1127,13 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public void rollbackResourceConfiguration(Subject subject, int resourceId, int configHistoryId)
- throws ConfigurationUpdateException {
+ throws ConfigurationUpdateException {
ResourceConfigurationUpdate configurationUpdateHistory = entityManager.find(ResourceConfigurationUpdate.class,
- configHistoryId);
+ configHistoryId);
Configuration configuration = configurationUpdateHistory.getConfiguration();
if (configuration == null) {
throw new ConfigurationUpdateException("No configuration history element exists with id = '"
- + configHistoryId + "'");
+ + configHistoryId + "'");
}
if (isStructuredAndRawSupported(resourceId)) {
@@ -1146,15 +1145,15 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public ResourceConfigurationUpdate persistNewResourceConfigurationUpdateHistory(Subject subject, int resourceId,
- Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject,
- boolean isPartofGroupUpdate) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException {
+ Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject,
+ boolean isPartofGroupUpdate) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException {
// get the resource that we will be updating
Resource resource = resourceManager.getResourceById(subject, resourceId);
// make sure the user has the proper permissions to do this
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_WRITE, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to modify configuration for resource [" + resource + "]");
+ + "] does not have permission to modify configuration for resource [" + resource + "]");
}
// see if there was a previous update request and make sure it isn't still in progress
@@ -1171,12 +1170,13 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
newStatus = ConfigurationUpdateStatus.FAILURE;
errorMessage = "Resource configuration Update was aborted because an update request for the Resource was already in progress.";
} else {
- // NOTE: If you change this to another exception, make sure you change getLatestResourceConfigurationUpdate().
+ // NOTE: If you change this to another exception, make sure you change
+ // getLatestResourceConfigurationUpdate().
throw new ConfigurationUpdateStillInProgressException(
- "Resource ["
- + resource
- + "] has a resource configuration update request already in progress - please wait for it to finish: "
- + previousRequest);
+ "Resource ["
+ + resource
+ + "] has a resource configuration update request already in progress - please wait for it to finish: "
+ + previousRequest);
}
}
}
@@ -1187,7 +1187,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
// Get the latest configuration as known to the server (i.e. persisted in the DB).
try {
Query query = entityManager
- .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
+ .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
query.setParameter("resourceId", resourceId);
current = (ResourceConfigurationUpdate) query.getSingleResult();
resource = current.getResource();
@@ -1202,12 +1202,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return null;
}
- //Configuration zeroedConfiguration = newConfiguration.deepCopy(false);
+ // Configuration zeroedConfiguration = newConfiguration.deepCopy(false);
Configuration zeroedConfiguration = newConfiguration.deepCopyWithoutProxies();
// create our new update request and assign it to our resource - its status will initially be "in progress"
ResourceConfigurationUpdate newUpdateRequest = new ResourceConfigurationUpdate(resource, zeroedConfiguration,
- newSubject);
+ newSubject);
newUpdateRequest.setStatus(newStatus);
if (newStatus == ConfigurationUpdateStatus.FAILURE) {
@@ -1245,15 +1245,17 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
log.debug("Received a configuration-update-completed message: " + response);
// find the current update request that is persisted - this is the one that is being reported as being complete
- ResourceConfigurationUpdate update = entityManager.find(ResourceConfigurationUpdate.class,
- response.getConfigurationUpdateId());
+ ResourceConfigurationUpdate update = entityManager.find(ResourceConfigurationUpdate.class, response
+ .getConfigurationUpdateId());
if (update == null) {
throw new IllegalStateException(
- "The completed request passed in does not match any request for any resource in inventory: " + response);
+ "The completed request passed in does not match any request for any resource in inventory: "
+ + response);
}
if (response.getStatus() == ConfigurationUpdateStatus.FAILURE) {
- // TODO [mazz]: what happens if the plugin dorked with the configuration ID? need to assert it hasn't changed
+ // TODO [mazz]: what happens if the plugin dorked with the configuration ID? need to assert it hasn't
+ // changed
if (response.getConfiguration() != null) {
Configuration failedConfiguration = response.getConfiguration();
failedConfiguration = entityManager.merge(failedConfiguration); // merge in any property error messages
@@ -1280,7 +1282,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public void checkForCompletedGroupResourceConfigurationUpdate(int resourceConfigUpdateId) {
ResourceConfigurationUpdate resourceConfigUpdate = entityManager.find(ResourceConfigurationUpdate.class,
- resourceConfigUpdateId);
+ resourceConfigUpdateId);
if (resourceConfigUpdate.getStatus() == ConfigurationUpdateStatus.INPROGRESS)
// If this update isn't done, then, by definition, the group update isn't done either.
return;
@@ -1291,14 +1293,14 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return;
Query inProgressResourcesCountQuery = PersistenceUtility.createCountQuery(this.entityManager,
- ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID_AND_STATUS);
+ ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID_AND_STATUS);
inProgressResourcesCountQuery.setParameter("parentUpdateId", groupConfigUpdate.getId());
inProgressResourcesCountQuery.setParameter("status", ConfigurationUpdateStatus.INPROGRESS);
long inProgressResourcesCount = (Long) inProgressResourcesCountQuery.getSingleResult();
if (inProgressResourcesCount == 0) {
// No more member updates in progress - the group update is complete.
Query failedResourcesQuery = this.entityManager
- .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID_AND_STATUS);
+ .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID_AND_STATUS);
failedResourcesQuery.setParameter("parentUpdateId", groupConfigUpdate.getId());
failedResourcesQuery.setParameter("status", ConfigurationUpdateStatus.FAILURE);
List<Resource> failedResources = failedResourcesQuery.getResultList();
@@ -1308,17 +1310,17 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
} else {
groupStatus = ConfigurationUpdateStatus.FAILURE;
groupConfigUpdate.setErrorMessage("The following Resources failed to update their Configurations: "
- + failedResources);
+ + failedResources);
}
groupConfigUpdate.setStatus(groupStatus);
log.info("Group Resource configuration update [" + groupConfigUpdate.getId() + "] for "
- + groupConfigUpdate.getGroup() + " has completed with status [" + groupStatus + "].");
+ + groupConfigUpdate.getGroup() + " has completed with status [" + groupStatus + "].");
// TODO: Add support for alerting on completion of group resource config updates.
- //notifyAlertConditionCacheManager("checkForCompletedGroupResourceConfigurationUpdate", groupUpdate);
+ // notifyAlertConditionCacheManager("checkForCompletedGroupResourceConfigurationUpdate", groupUpdate);
} else {
log.debug("Group Resource configuration update [" + groupConfigUpdate.getId() + "] for "
- + groupConfigUpdate.getGroup() + " has " + inProgressResourcesCount
- + " member updates still in progress.");
+ + groupConfigUpdate.getGroup() + " has " + inProgressResourcesCount
+ + " member updates still in progress.");
}
return;
}
@@ -1358,7 +1360,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@Nullable
public ConfigurationDefinition getResourceConfigurationDefinitionWithTemplatesForResourceType(Subject subject,
- int resourceTypeId) {
+ int resourceTypeId) {
Query query = entityManager.createNamedQuery(ConfigurationDefinition.QUERY_FIND_RESOURCE_BY_RESOURCE_TYPE_ID);
query.setParameter("resourceTypeId", resourceTypeId);
ConfigurationDefinition configurationDefinition = null;
@@ -1381,7 +1383,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public boolean hasPluginConfiguration(int resourceTypeId) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- ConfigurationDefinition.QUERY_FIND_PLUGIN_BY_RESOURCE_TYPE_ID);
+ ConfigurationDefinition.QUERY_FIND_PLUGIN_BY_RESOURCE_TYPE_ID);
countQuery.setParameter("resourceTypeId", resourceTypeId);
long count = (Long) countQuery.getSingleResult();
@@ -1415,14 +1417,17 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
* Given an actual resource, this asks the agent to return that resource's live configuration. Note that this does
* not perform any authorization checks - it is assumed the caller has permissions to view the configuration. This
* also assumes <code>resource</code> is a non-<code>null</code> and existing resource.
- *
- * <p>If failed to contact the agent or any other communications problem occurred, <code>null</code> will be
- * returned.</p>
- *
- * @param resource an existing resource whose live configuration is to be retrieved
- * @param pingAgentFirst true if the underlying Agent should be pinged successfully before attempting to retrieve
- * the configuration, or false otherwise
- *
+ *
+ * <p>
+ * If failed to contact the agent or any other communications problem occurred, <code>null</code> will be returned.
+ * </p>
+ *
+ * @param resource
+ * an existing resource whose live configuration is to be retrieved
+ * @param pingAgentFirst
+ * true if the underlying Agent should be pinged successfully before attempting to retrieve the configuration, or
+ * false otherwise
+ *
* @return the resource's live configuration or <code>null</code> if it could not be retrieved from the agent
*/
private Configuration getLiveResourceConfiguration(Resource resource, boolean pingAgentFirst, boolean fromStructured) {
@@ -1434,7 +1439,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
boolean agentPingedSuccessfully = false;
// Getting live configuration is mostly for the UI's benefit - as such, do not hang
- // for a long time in the event the agent is down or can't be reached. Let's make the UI
+ // for a long time in the event the agent is down or can't be reached. Let's make the UI
// responsive even in the case of an agent down by pinging it quickly to verify the agent is up.
if (pingAgentFirst)
agentPingedSuccessfully = agentClient.ping(5000L);
@@ -1442,17 +1447,18 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!pingAgentFirst || agentPingedSuccessfully) {
liveConfig = agentClient.getConfigurationAgentService().loadResourceConfiguration(resource.getId());
if (liveConfig == null) {
- // This should really never occur - the PC should never return a null, always at least an empty config.
+ // This should really never occur - the PC should never return a null, always at least an empty
+ // config.
log.debug("ConfigurationAgentService.loadResourceConfiguration() returned a null Configuration.");
liveConfig = new Configuration();
}
} else {
log.warn("Agent is unreachable [" + agent + "] - cannot get live configuration for resource ["
- + resource + "]");
+ + resource + "]");
}
} catch (Exception e) {
log.warn("Could not get live configuration for resource [" + resource + "]"
- + ThrowableUtil.getAllMessages(e, true));
+ + ThrowableUtil.getAllMessages(e, true));
}
return liveConfig;
@@ -1460,7 +1466,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public AbstractResourceConfigurationUpdate mergeConfigurationUpdate(
- AbstractResourceConfigurationUpdate configurationUpdate) {
+ AbstractResourceConfigurationUpdate configurationUpdate) {
return this.entityManager.merge(configurationUpdate);
}
@@ -1473,15 +1479,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public Configuration getConfigurationFromDefaultTemplate(ConfigurationDefinition definition) {
- ConfigurationDefinition managedDefinition = entityManager.find(ConfigurationDefinition.class,
- definition.getId());
+ ConfigurationDefinition managedDefinition = entityManager.find(ConfigurationDefinition.class, definition
+ .getId());
return managedDefinition.getDefaultTemplate().getConfiguration();
}
private void handlePluginConfiguratonUpdateRemoteException(Resource resource, String summary, String detail) {
resource.setConnected(false);
ResourceError invalidPluginConfigError = new ResourceError(resource,
- ResourceErrorType.INVALID_PLUGIN_CONFIGURATION, summary, detail, Calendar.getInstance().getTimeInMillis());
+ ResourceErrorType.INVALID_PLUGIN_CONFIGURATION, summary, detail, Calendar.getInstance()
+ .getTimeInMillis());
this.resourceManager.addResourceError(invalidPluginConfigError);
}
@@ -1498,11 +1505,11 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public int scheduleGroupPluginConfigurationUpdate(Subject subject, int compatibleGroupId,
- Map<Integer, Configuration> memberPluginConfigurations) throws SchedulerException {
+ Map<Integer, Configuration> memberPluginConfigurations) throws SchedulerException {
if (memberPluginConfigurations == null) {
throw new IllegalArgumentException(
- "GroupPluginConfigurationUpdate must have non-null member configurations.");
+ "GroupPluginConfigurationUpdate must have non-null member configurations.");
}
ResourceGroup group = getCompatibleGroupIfAuthorized(subject, compatibleGroupId);
@@ -1510,11 +1517,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
ensureModifyResourcePermission(subject, group);
/*
- * we need to create and persist the group in a new/separate transaction before the rest of the
- * processing of this method; if we try to create and attach the PluginConfigurationUpdate children
- * to the parent group before the group update is actually persisted, we'll get StaleStateExceptions
- * from Hibernate because of our use of flush/clear (we're trying to update it before it actually
- * actually exists)
+ * we need to create and persist the group in a new/separate transaction before the rest of the processing of
+ * this method; if we try to create and attach the PluginConfigurationUpdate children to the parent group before
+ * the group update is actually persisted, we'll get StaleStateExceptions from Hibernate because of our use of
+ * flush/clear (we're trying to update it before it actually actually exists)
*/
GroupPluginConfigurationUpdate groupUpdate = new GroupPluginConfigurationUpdate(group, subject.getName());
int updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
@@ -1524,7 +1530,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Configuration memberResourceConfiguration = memberPluginConfigurations.get(resourceId);
Resource flyWeight = new Resource(resourceId);
PluginConfigurationUpdate memberUpdate = new PluginConfigurationUpdate(flyWeight,
- memberResourceConfiguration, subject.getName());
+ memberResourceConfiguration, subject.getName());
memberUpdate.setGroupConfigurationUpdate(groupUpdate);
entityManager.persist(memberUpdate);
}
@@ -1534,8 +1540,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
jobDataMap.putAsString(AbstractGroupConfigurationUpdateJob.DATAMAP_INT_SUBJECT_ID, subject.getId());
/*
- * acquire quartz objects and schedule the group update, but deferred the execution for 10 seconds
- * because we need this transaction to complete so that the data is available when the quartz job triggers
+ * acquire quartz objects and schedule the group update, but deferred the execution for 10 seconds because we
+ * need this transaction to complete so that the data is available when the quartz job triggers
*/
JobDetail jobDetail = GroupPluginConfigurationUpdateJob.getJobDetail(group, subject, jobDataMap);
Trigger trigger = QuartzUtil.getFireOnceOffsetTrigger(jobDetail, 10000);
@@ -1547,28 +1553,28 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public int scheduleGroupResourceConfigurationUpdate(Subject subject, int compatibleGroupId,//
- @WebParam(targetNamespace = ServerVersion.namespace)//
- @XmlJavaTypeAdapter(WebServiceTypeAdapter.class)//
- Map<Integer, Configuration> newResourceConfigurationMap) {
+ @WebParam(targetNamespace = ServerVersion.namespace)//
+ @XmlJavaTypeAdapter(WebServiceTypeAdapter.class)//
+ Map<Integer, Configuration> newResourceConfigurationMap) {
if (newResourceConfigurationMap == null) {
throw new IllegalArgumentException(
- "GroupResourceConfigurationUpdate must have non-null member configurations.");
+ "GroupResourceConfigurationUpdate must have non-null member configurations.");
}
ResourceGroup group = getCompatibleGroupIfAuthorized(subject, compatibleGroupId);
if (!authorizationManager.hasGroupPermission(subject, Permission.CONFIGURE_WRITE, group.getId())) {
throw new PermissionException("User [" + subject.getName() + "] does not have permission "
- + "to modify Resource configurations for members of group [" + group + "].");
+ + "to modify Resource configurations for members of group [" + group + "].");
}
ensureNoResourceConfigurationUpdatesInProgress(group);
/*
* we need to create and persist the group update in a new/separate transaction before the rest of the
- * processing of this method; if we try to create and attach the PluginConfigurationUpdate children
- * to the parent group before the group update is actually persisted, we'll get StaleStateExceptions
- * from Hibernate because of our use of flush/clear (we're trying to update it before it actually exists)
+ * processing of this method; if we try to create and attach the PluginConfigurationUpdate children to the
+ * parent group before the group update is actually persisted, we'll get StaleStateExceptions from Hibernate
+ * because of our use of flush/clear (we're trying to update it before it actually exists)
*/
GroupResourceConfigurationUpdate groupUpdate = new GroupResourceConfigurationUpdate(group, subject.getName());
int updateId = -1;
@@ -1585,7 +1591,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Configuration memberResourceConfiguration = newResourceConfigurationMap.get(resourceId);
Resource flyWeight = new Resource(resourceId);
ResourceConfigurationUpdate memberUpdate = new ResourceConfigurationUpdate(flyWeight,
- memberResourceConfiguration, subject.getName());
+ memberResourceConfiguration, subject.getName());
memberUpdate.setGroupConfigurationUpdate(groupUpdate);
entityManager.persist(memberUpdate);
}
@@ -1595,8 +1601,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
jobDataMap.putAsString(AbstractGroupConfigurationUpdateJob.DATAMAP_INT_SUBJECT_ID, subject.getId());
/*
- * Acquire Quartz objects and schedule the group update, but defer the execution for 10 seconds,
- * because we need this transaction to complete so that the data is available when the Quartz job triggers.
+ * Acquire Quartz objects and schedule the group update, but defer the execution for 10 seconds, because we need
+ * this transaction to complete so that the data is available when the Quartz job triggers.
*/
JobDetail jobDetail = GroupResourceConfigurationUpdateJob.getJobDetail(group, subject, jobDataMap);
Trigger trigger = QuartzUtil.getFireOnceOffsetTrigger(jobDetail, 10000);
@@ -1609,7 +1615,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
log.debug("Scheduled Resource configuration update against compatible ResourceGroup[id=" + compatibleGroupId
- + "].");
+ + "].");
return updateId;
}
@@ -1622,7 +1628,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
group = resourceGroupManager.getResourceGroupById(subject, compatibleGroupId, GroupCategory.COMPATIBLE);
} catch (ResourceGroupNotFoundException e) {
throw new RuntimeException("Cannot get support operations for unknown group [" + compatibleGroupId + "]: "
- + e, e);
+ + e, e);
}
return group;
@@ -1631,36 +1637,36 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
private void ensureModifyPermission(Subject subject, Resource resource) throws PermissionException {
if (!authorizationManager.hasResourcePermission(subject, Permission.MODIFY_RESOURCE, resource.getId())) {
throw new PermissionException("User [" + subject.getName() + "] does not have permission "
- + "to modify plugin configuration for resource [" + resource + "]");
+ + "to modify plugin configuration for resource [" + resource + "]");
}
}
private void ensureModifyResourcePermission(Subject subject, ResourceGroup group) throws PermissionException {
if (!authorizationManager.hasGroupPermission(subject, Permission.MODIFY_RESOURCE, group.getId())) {
throw new PermissionException("User [" + subject.getName() + "] does not have permission "
- + "to modify plugin configuration for members of group [" + group + "]");
+ + "to modify plugin configuration for members of group [" + group + "]");
}
}
public GroupPluginConfigurationUpdate getGroupPluginConfigurationById(int configurationUpdateId) {
GroupPluginConfigurationUpdate update = entityManager.find(GroupPluginConfigurationUpdate.class,
- configurationUpdateId);
+ configurationUpdateId);
return update;
}
public GroupResourceConfigurationUpdate getGroupResourceConfigurationById(int configurationUpdateId) {
GroupResourceConfigurationUpdate update = entityManager.find(GroupResourceConfigurationUpdate.class,
- configurationUpdateId);
+ configurationUpdateId);
return update;
}
@SuppressWarnings("unchecked")
public PageList<ConfigurationUpdateComposite> findPluginConfigurationUpdateCompositesByParentId(
- int configurationUpdateId, PageControl pageControl) {
+ int configurationUpdateId, PageControl pageControl) {
pageControl.initDefaultOrderingField("cu.modifiedTime");
Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- PluginConfigurationUpdate.QUERY_FIND_COMPOSITE_BY_PARENT_UPDATE_ID, pageControl);
+ PluginConfigurationUpdate.QUERY_FIND_COMPOSITE_BY_PARENT_UPDATE_ID, pageControl);
query.setParameter("groupConfigurationUpdateId", configurationUpdateId);
long count = getPluginConfigurationUpdateCountByParentId(configurationUpdateId);
@@ -1672,14 +1678,14 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public PageList<ConfigurationUpdateComposite> findResourceConfigurationUpdateCompositesByParentId(Subject subject,
- int configurationUpdateId, PageControl pageControl) {
- // will perform CONFIGURE_READ security check for us, no need to save the
+ int configurationUpdateId, PageControl pageControl) {
+ // will perform CONFIGURE_READ security check for us, no need to save the
getGroupResourceConfigurationUpdate(subject, configurationUpdateId);
pageControl.initDefaultOrderingField("cu.modifiedTime");
Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- ResourceConfigurationUpdate.QUERY_FIND_COMPOSITE_BY_PARENT_UPDATE_ID, pageControl);
+ ResourceConfigurationUpdate.QUERY_FIND_COMPOSITE_BY_PARENT_UPDATE_ID, pageControl);
query.setParameter("groupConfigurationUpdateId", configurationUpdateId);
long count = getResourceConfigurationUpdateCountByParentId(configurationUpdateId);
@@ -1694,7 +1700,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
pageControl.initDefaultOrderingField("cu.modifiedTime");
Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- PluginConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID, pageControl);
+ PluginConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID, pageControl);
query.setParameter("groupConfigurationUpdateId", configurationUpdateId);
long count = getPluginConfigurationUpdateCountByParentId(configurationUpdateId);
@@ -1706,18 +1712,18 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public long getPluginConfigurationUpdateCountByParentId(int configurationUpdateId) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- PluginConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID);
+ PluginConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID);
countQuery.setParameter("groupConfigurationUpdateId", configurationUpdateId);
return (Long) countQuery.getSingleResult();
}
@SuppressWarnings("unchecked")
public PageList<Integer> findResourceConfigurationUpdatesByParentId(int groupConfigurationUpdateId,
- PageControl pageControl) {
+ PageControl pageControl) {
pageControl.initDefaultOrderingField("cu.modifiedTime");
Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID, pageControl);
+ ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID, pageControl);
query.setParameter("groupConfigurationUpdateId", groupConfigurationUpdateId);
long count = getResourceConfigurationUpdateCountByParentId(groupConfigurationUpdateId);
@@ -1729,41 +1735,41 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public long getResourceConfigurationUpdateCountByParentId(int groupConfigurationUpdateId) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID);
+ ResourceConfigurationUpdate.QUERY_FIND_BY_PARENT_UPDATE_ID);
countQuery.setParameter("groupConfigurationUpdateId", groupConfigurationUpdateId);
return (Long) countQuery.getSingleResult();
}
@SuppressWarnings("unchecked")
public Map<Integer, Configuration> getResourceConfigurationMapForGroupUpdate(Subject subject,
- Integer groupResourceConfigurationUpdateId) {
+ Integer groupResourceConfigurationUpdateId) {
// this method will perform the CONFIGURE_READ security check for us, no need to keep reference to result
getGroupResourceConfigurationUpdate(subject, groupResourceConfigurationUpdateId);
Tuple<String, Object> groupIdParameter = new Tuple<String, Object>("groupConfigurationUpdateId",
- groupResourceConfigurationUpdateId);
+ groupResourceConfigurationUpdateId);
return executeGetConfigurationMapQuery(Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_UPDATE_ID, 100,
- groupIdParameter);
+ groupIdParameter);
}
@SuppressWarnings("unchecked")
public Map<Integer, Configuration> getPluginConfigurationMapForGroupUpdate(Integer groupPluginConfigurationUpdateId) {
Tuple<String, Object> groupIdParameter = new Tuple<String, Object>("groupConfigurationUpdateId",
- groupPluginConfigurationUpdateId);
+ groupPluginConfigurationUpdateId);
return executeGetConfigurationMapQuery(Configuration.QUERY_GET_PLUGIN_CONFIG_MAP_BY_GROUP_UPDATE_ID, 100,
- groupIdParameter);
+ groupIdParameter);
}
@SuppressWarnings("unchecked")
public Map<Integer, Configuration> getResourceConfigurationMapForCompatibleGroup(ResourceGroup compatibleGroup) {
Tuple<String, Object> groupIdParameter = new Tuple<String, Object>("resourceGroupId", compatibleGroup.getId());
return executeGetConfigurationMapQuery(Configuration.QUERY_GET_RESOURCE_CONFIG_MAP_BY_GROUP_ID, 100,
- groupIdParameter);
+ groupIdParameter);
}
@SuppressWarnings("unchecked")
private Map<Integer, Configuration> executeGetConfigurationMapQuery(String memberQueryName, int maxSize,
- Tuple<String, Object>... parameters) {
+ Tuple<String, Object>... parameters) {
Query countQuery = PersistenceUtility.createCountQuery(entityManager, memberQueryName);
Query query = entityManager.createNamedQuery(memberQueryName);
@@ -1778,7 +1784,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
int resultsSize;
if (count > maxSize) {
log.error("Configuration set contains more than " + maxSize + " members - " + "returning only " + maxSize
- + " Configurations (the maximum allowed).");
+ + " Configurations (the maximum allowed).");
resultsSize = maxSize;
} else {
resultsSize = (int) count;
@@ -1798,9 +1804,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
pc.initDefaultOrderingField("modifiedTime", PageOrdering.DESC);
Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- GroupPluginConfigurationUpdate.QUERY_FIND_BY_GROUP_ID, pc);
+ GroupPluginConfigurationUpdate.QUERY_FIND_BY_GROUP_ID, pc);
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- GroupPluginConfigurationUpdate.QUERY_FIND_BY_GROUP_ID);
+ GroupPluginConfigurationUpdate.QUERY_FIND_BY_GROUP_ID);
query.setParameter("groupId", groupId);
countQuery.setParameter("groupId", groupId);
@@ -1814,18 +1820,18 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public PageList<GroupResourceConfigurationUpdate> findGroupResourceConfigurationUpdates(Subject subject,
- int groupId, PageControl pc) {
+ int groupId, PageControl pc) {
if (authorizationManager.hasGroupPermission(subject, Permission.CONFIGURE_READ, groupId) == false) {
throw new PermissionException("User[name=" + subject.getName()
- + "] does not have permission to view configuration for group[id=" + groupId + "]");
+ + "] does not have permission to view configuration for group[id=" + groupId + "]");
}
pc.initDefaultOrderingField("modifiedTime", PageOrdering.DESC);
Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- GroupResourceConfigurationUpdate.QUERY_FIND_BY_GROUP_ID, pc);
+ GroupResourceConfigurationUpdate.QUERY_FIND_BY_GROUP_ID, pc);
Query countQuery = PersistenceUtility.createCountQuery(entityManager,
- GroupResourceConfigurationUpdate.QUERY_FIND_BY_GROUP_ID);
+ GroupResourceConfigurationUpdate.QUERY_FIND_BY_GROUP_ID);
query.setParameter("groupId", groupId);
countQuery.setParameter("groupId", groupId);
@@ -1839,10 +1845,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@SuppressWarnings("unchecked")
public ConfigurationUpdateStatus updateGroupPluginConfigurationUpdateStatus(int groupConfigurationUpdateId,
- String errorMessages) {
+ String errorMessages) {
GroupPluginConfigurationUpdate groupUpdate = configurationManager
- .getGroupPluginConfigurationById(groupConfigurationUpdateId);
+ .getGroupPluginConfigurationById(groupConfigurationUpdateId);
Query query = entityManager.createNamedQuery(PluginConfigurationUpdate.QUERY_FIND_STATUS_BY_PARENT_UPDATE_ID);
query.setParameter("groupConfigurationUpdateId", groupConfigurationUpdateId);
@@ -1864,21 +1870,21 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public int deleteGroupPluginConfigurationUpdates(Subject subject, Integer resourceGroupId,
- Integer[] groupPluginConfigurationUpdateIds) {
- //TODO: use subject and resourceGroupId to perform security check
+ Integer[] groupPluginConfigurationUpdateIds) {
+ // TODO: use subject and resourceGroupId to perform security check
if (authorizationManager.hasGroupPermission(subject, Permission.MODIFY_RESOURCE, resourceGroupId) == false) {
log.error(subject + " attempted to delete " + groupPluginConfigurationUpdateIds.length
- + " group resource configuration updates for ResourceGroup[id" + resourceGroupId
- + "], but did not have the " + Permission.MODIFY_RESOURCE.name() + " permission for this group");
+ + " group resource configuration updates for ResourceGroup[id" + resourceGroupId
+ + "], but did not have the " + Permission.MODIFY_RESOURCE.name() + " permission for this group");
return 0;
}
int removed = 0;
for (Integer apcuId : groupPluginConfigurationUpdateIds) {
/*
- * use this strategy instead of GroupPluginConfigurationUpdate.QUERY_DELETE_BY_ID because removing via
- * the entityManager will respect cascading rules, using a JPQL DELETE statement will not
+ * use this strategy instead of GroupPluginConfigurationUpdate.QUERY_DELETE_BY_ID because removing via the
+ * entityManager will respect cascading rules, using a JPQL DELETE statement will not
*/
try {
// break the plugin configuration update links in order to preserve individual change history
@@ -1898,20 +1904,20 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public int deleteGroupResourceConfigurationUpdates(Subject subject, Integer resourceGroupId,
- Integer[] groupResourceConfigurationUpdateIds) {
+ Integer[] groupResourceConfigurationUpdateIds) {
if (authorizationManager.hasGroupPermission(subject, Permission.MODIFY_RESOURCE, resourceGroupId) == false) {
log.error(subject + " attempted to delete " + groupResourceConfigurationUpdateIds.length
- + " group resource configuration updates for ResourceGroup[id" + resourceGroupId
- + "], but did not have the " + Permission.MODIFY_RESOURCE.name() + " permission for this group");
+ + " group resource configuration updates for ResourceGroup[id" + resourceGroupId
+ + "], but did not have the " + Permission.MODIFY_RESOURCE.name() + " permission for this group");
return 0;
}
int removed = 0;
for (Integer arcuId : groupResourceConfigurationUpdateIds) {
/*
- * use this strategy instead of GroupResourceConfigurationUpdate.QUERY_DELETE_BY_ID because removing via
- * the entityManager will respect cascading rules, using a JPQL DELETE statement will not
+ * use this strategy instead of GroupResourceConfigurationUpdate.QUERY_DELETE_BY_ID because removing via the
+ * entityManager will respect cascading rules, using a JPQL DELETE statement will not
*/
try {
// break the resource configuration update links in order to preserve individual change history
@@ -1943,15 +1949,15 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
boolean supportsCascade = DatabaseTypeFactory.getDefaultDatabaseType().supportsSelfReferringCascade();
if (supportsCascade == false) {
Query breakPropertyRecursionQuery = entityManager
- .createNamedQuery(Configuration.QUERY_BREAK_PROPERTY_RECURSION_BY_CONFIGURATION_IDS);
+ .createNamedQuery(Configuration.QUERY_BREAK_PROPERTY_RECURSION_BY_CONFIGURATION_IDS);
breakPropertyRecursionQuery.setParameter("configurationIds", configurationIds);
breakPropertyRecursionQuery.executeUpdate();
}
Query rawConfigurationsQuery = entityManager
- .createNamedQuery(Configuration.QUERY_DELETE_RAW_CONFIGURATIONS_CONFIGURATION_IDS);
+ .createNamedQuery(Configuration.QUERY_DELETE_RAW_CONFIGURATIONS_CONFIGURATION_IDS);
Query configurationsQuery = entityManager
- .createNamedQuery(Configuration.QUERY_DELETE_CONFIGURATIONS_BY_CONFIGURATION_IDs);
+ .createNamedQuery(Configuration.QUERY_DELETE_CONFIGURATIONS_BY_CONFIGURATION_IDs);
rawConfigurationsQuery.setParameter("configurationIds", configurationIds);
configurationsQuery.setParameter("configurationIds", configurationIds);
@@ -1974,33 +1980,34 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
GroupPluginConfigurationUpdate update = getGroupPluginConfigurationById(configurationUpdateId);
int groupId = update.getGroup().getId();
- if (authorizationManager.hasGroupPermission(subject, Permission.MODIFY_RESOURCE, groupId) == false) {
- throw new PermissionException("User[" + subject.getName()
- + "] does not have permission to view group resourceConfiguration[id=" + configurationUpdateId + "]");
+ if (!authorizationManager.canViewGroup(subject, groupId)) {
+ throw new PermissionException("User [" + subject.getName()
+ + "] does not have permission to view group Resource configuration for [" + update.getGroup() + "]");
}
return update;
}
public GroupResourceConfigurationUpdate getGroupResourceConfigurationUpdate(Subject subject,
- int configurationUpdateId) {
+ int configurationUpdateId) {
GroupResourceConfigurationUpdate update = getGroupResourceConfigurationById(configurationUpdateId);
int groupId = update.getGroup().getId();
if (authorizationManager.hasGroupPermission(subject, Permission.CONFIGURE_READ, groupId) == false) {
throw new PermissionException("User[" + subject.getName()
- + "] does not have permission to view group resourceConfiguration[id=" + configurationUpdateId + "]");
+ + "] does not have permission to view group resourceConfiguration[id=" + configurationUpdateId
+ + "]");
}
return update;
}
public Configuration translateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
- boolean fromStructured) {
+ boolean fromStructured) {
if (!isStructuredAndRawSupported(resourceId)) {
throw new TranslationNotSupportedException("The translation operation is only supported for "
- + "configurations that support both structured and raw.");
+ + "configurations that support both structured and raw.");
}
Resource resource = entityManager.find(Resource.class, resourceId);
@@ -2011,7 +2018,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_READ, resource.getId())) {
throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to view resource configuration for [" + resource + "]");
+ + "] does not have permission to view resource configuration for [" + resource + "]");
}
try {
@@ -2032,4 +2039,4 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return out;
}
-}
+}
\ No newline at end of file
commit 3b7d1a901f61e5bd87a7cbe9d9d0d1c9cd5e5222
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Tue Nov 16 23:36:03 2010 +0100
BZ-550046 (httpd) new virtual host creation fails if Resource Name is string.
- Resource name format for created virtual hosts is Address:Port.
- updated error messages
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index 719d9cb..95b8a54 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -25,6 +25,7 @@ import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.Set;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -35,6 +36,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+
import org.rhq.augeas.AugeasProxy;
import org.rhq.augeas.config.AugeasModuleConfig;
import org.rhq.augeas.node.AugeasNode;
@@ -400,6 +402,12 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
ApacheParser parser = new ApacheParserImpl(parserTree,getServerRoot().getAbsolutePath());
ApacheConfigReader.buildTree(getHttpdConfFile().getAbsolutePath(), parser);
+
+ Pattern virtualHostPattern = Pattern.compile(".+:([\\d]+|\\*)");
+ Matcher matcher = virtualHostPattern.matcher(vhostDefs[0]);
+ if (!matcher.matches())
+ throw new Exception("Wrong format of virtual host resource name. The right format is Address:Port.");
+
addr = getAddressUtility().getVirtualHostSampleAddress(parserTree, vhostDefs[0], serverName, false);
} catch (Exception e) {
report.setStatus(CreateResourceStatus.FAILURE);
@@ -905,4 +913,4 @@ public class ApacheServerComponent implements AugeasRHQComponent<PlatformCompone
return false;
}
}
-}
+}
\ No newline at end of file
13 years, 7 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java | 43 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 46 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 10 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 76 ++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java | 17 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java | 28 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 52 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java | 9 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java | 18 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java | 16 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java | 38 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java | 82 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 27 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 17 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 17 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 70 ++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 9 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java | 32 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java | 34 ++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 10 -
35 files changed, 418 insertions(+), 296 deletions(-)
New commits:
commit 1957616d40a17eccb9221463720c876eaea8c4ab
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 17 22:52:54 2010 -0500
I18N work -
Refactor of VIEW_ID from string to ViewName to allow separation between
the name, used in view paths, and the title, used for display in the section
trees. Previously the name was used everywhere, with deCamelCase logic for
display.
Also, packages:
org.rhq.core.client
org.rhq.core.domain.measurement
org.rhq.core.rebind
org.rhq.enterprise.gui.coregui.client
org.rhq.enterprise.gui.coregui.client.admin
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java
index f084ec0..64eea4a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java
@@ -29,10 +29,14 @@ import com.google.gwt.i18n.client.NumberFormat;
import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
import org.rhq.core.domain.measurement.util.MeasurementConversionException;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
public class MeasurementConverterClient {
+ private static final Messages MSG = CoreGUI.getMessages();
+
private static final int MAX_PRECISION_DIGITS = 4;
- private static final String NULL_OR_NAN_FORMATTED_VALUE = "--no data available--";
+ private static final String NULL_OR_NAN_FORMATTED_VALUE = MSG.view_measure_nan();
private static NumberFormat getDefaultNumberFormat() {
NumberFormat nf = NumberFormat.getFormat("0.0");
@@ -122,7 +126,6 @@ public class MeasurementConverterClient {
targetUnits = fittedUnits;
}
- @SuppressWarnings("unused")
Set<String> existingStrings; // technically this *is* unused because
int precisionDigits = 0;
boolean scaleWithMorePrecision = true;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java
index 1196b78..940b7de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java
@@ -18,6 +18,10 @@
*/
package org.rhq.core.rebind;
+import java.io.PrintWriter;
+
+import javax.persistence.Entity;
+
import com.google.gwt.core.ext.Generator;
import com.google.gwt.core.ext.GeneratorContext;
import com.google.gwt.core.ext.TreeLogger;
@@ -29,10 +33,6 @@ import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
-import javax.persistence.Entity;
-
-import java.io.PrintWriter;
-
/**
* This is the start to a rebinder for our domain entities to allow for the
* easy generation of Smart's Record objects.
@@ -57,7 +57,8 @@ public class RecordBuilderGenerator extends Generator {
* Create a new type that satisfies the rebind request.
*/
@Override
- public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {
+ public String generate(TreeLogger logger, GeneratorContext context, String typeName)
+ throws UnableToCompleteException {
System.out.println("classType " + typeName);
@@ -83,11 +84,8 @@ public class RecordBuilderGenerator extends Generator {
return typeOracle;
}
- @SuppressWarnings("unused")
protected void writeSource() throws UnableToCompleteException {
-
-
JField[] fields = requestedClass.getFields();
writeBuildRecordMethod(fields, sourceWriter);
@@ -100,24 +98,22 @@ public class RecordBuilderGenerator extends Generator {
return "__" + baseClass.getSimpleSourceName() + "_RecordBuilder";
}
- private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext ctx,
- String packageName, String className, String superclassName) {
+ private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext ctx, String packageName, String className,
+ String superclassName) {
PrintWriter printWriter = ctx.tryCreate(logger, packageName, className);
if (printWriter == null) {
return null;
}
- ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(
- packageName, className);
+ ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.setSuperclass(superclassName);
return composerFactory.createSourceWriter(ctx, printWriter);
}
- private boolean init(TreeLogger logger, GeneratorContext context,
- String typeName) throws UnableToCompleteException {
+ private boolean init(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {
this.logger = logger;
typeOracle = context.getTypeOracle();
assert typeOracle != null;
@@ -125,12 +121,8 @@ public class RecordBuilderGenerator extends Generator {
try {
requestedClass = typeOracle.getType(typeName);
} catch (NotFoundException e) {
- logger.log(
- TreeLogger.ERROR,
- "Could not find type '"
- + typeName
- + "'; please see the log, as this usually indicates a previous error ",
- e);
+ logger.log(TreeLogger.ERROR, "Could not find type '" + typeName
+ + "'; please see the log, as this usually indicates a previous error ", e);
throw new UnableToCompleteException();
}
@@ -139,7 +131,7 @@ public class RecordBuilderGenerator extends Generator {
return false;
}
- System.out.println("$$$$$$$$Making a record builder for: "+ typeName);
+ System.out.println("$$$$$$$$Making a record builder for: " + typeName);
// Get the stub class name, and see if its source file exists.
//
@@ -147,20 +139,21 @@ public class RecordBuilderGenerator extends Generator {
packageName = requestedClass.getPackage().getName();
qualifiedStubClassName = packageName + "." + simpleStubClassName;
- sourceWriter = getSourceWriter(logger, context, packageName,
- simpleStubClassName, requestedClass.getQualifiedSourceName());
+ sourceWriter = getSourceWriter(logger, context, packageName, simpleStubClassName, requestedClass
+ .getQualifiedSourceName());
return sourceWriter != null;
}
private void writeBuildRecordMethod(JField[] fields, SourceWriter sw) {
sw.println();
- sw.println("protected final com.smartgwt.client.data.Record buildRecord(" + requestedClass.getQualifiedSourceName() + " entity) throws Throwable {");
+ sw.println("protected final com.smartgwt.client.data.Record buildRecord("
+ + requestedClass.getQualifiedSourceName() + " entity) throws Throwable {");
sw.indent();
sw.println("com.smartgwt.client.data.Record record = new com.smartgwt.client.data.Record();");
- for (JField field :fields) {
+ for (JField field : fields) {
sw.println("record.setAttribute(\"" + field.getName() + "\", " + field.getName() + ");");
}
sw.println("return record;");
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 dae9e37..6b56f11 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
@@ -41,9 +41,9 @@ import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
+import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupTopView;
-import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTopView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
@@ -63,7 +63,9 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
* @author Ian Springer
*/
public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
- private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID;
+ private static final Messages MSG = CoreGUI.getMessages();
+
+ private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID.getName();
// just to avoid constructing this over and over
private static final String TREE_NAV_VIEW_PATTERN = "(" + ResourceTopView.VIEW_ID + "|"
@@ -120,7 +122,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
- getErrorHandler().handleError("Globally uncaught exception", e);
+ getErrorHandler().handleError(MSG.view_core_uncaught(), e);
}
});
@@ -191,31 +193,31 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
public Canvas createContent(String breadcrumbName) {
Canvas canvas;
- if (breadcrumbName.equals(AdministrationView.VIEW_ID)) {
+ if (breadcrumbName.equals(AdministrationView.VIEW_ID.getName())) {
canvas = new AdministrationView();
- } else if (breadcrumbName.equals(InventoryView.VIEW_ID)) {
+ } else if (breadcrumbName.equals(InventoryView.VIEW_ID.getName())) {
canvas = new InventoryView();
- } else if (breadcrumbName.equals(ResourceTopView.VIEW_ID)) {
- canvas = new ResourceTopView("Resource");
- } else if (breadcrumbName.equals(ResourceGroupTopView.VIEW_ID)) {
- canvas = new ResourceGroupTopView("Group");
- } else if (breadcrumbName.equals(DashboardsView.VIEW_ID)) {
- canvas = new DashboardsView("Dashboard");
- } else if (breadcrumbName.equals(BundleTopView.VIEW_ID)) {
- canvas = new BundleTopView("Bundle");
+ } else if (breadcrumbName.equals(ResourceTopView.VIEW_ID.getName())) {
+ canvas = new ResourceTopView(breadcrumbName);
+ } else if (breadcrumbName.equals(ResourceGroupTopView.VIEW_ID.getName())) {
+ canvas = new ResourceGroupTopView(breadcrumbName);
+ } else if (breadcrumbName.equals(DashboardsView.VIEW_ID.getName())) {
+ canvas = new DashboardsView(breadcrumbName);
+ } else if (breadcrumbName.equals(BundleTopView.VIEW_ID.getName())) {
+ canvas = new BundleTopView(breadcrumbName);
} else if (breadcrumbName.equals("LogOut")) {
// TODO: don't make LogOut a history event, just perform the logout action by responding to click event
- LoginView logoutView = new LoginView();
+ LoginView logoutView = new LoginView("Login");
canvas = logoutView;
UserSessionManager.logout();
logoutView.showLoginDialog();
- } else if (breadcrumbName.equals(TaggedView.VIEW_ID)) {
- canvas = new TaggedView("Tag");
+ } else if (breadcrumbName.equals(TaggedView.VIEW_ID.getName())) {
+ canvas = new TaggedView(breadcrumbName);
} else if (breadcrumbName.equals("Subsystems")) {
canvas = new AlertHistoryView("Alert");
- } else if (breadcrumbName.equals(ReportTopView.VIEW_ID)) {
+ } else if (breadcrumbName.equals(ReportTopView.VIEW_ID.getName())) {
canvas = new ReportTopView();
- } else if (breadcrumbName.equals(TestTopView.VIEW_ID)) {
+ } else if (breadcrumbName.equals(TestTopView.VIEW_ID.getName())) {
canvas = new TestTopView();
} else {
canvas = null;
@@ -329,12 +331,12 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
if (this.currentCanvas instanceof BookmarkableView) {
if (this.currentCanvas instanceof InitializableView) {
- final InitializableView initializableView = (InitializableView)this.currentCanvas;
+ final InitializableView initializableView = (InitializableView) this.currentCanvas;
final long startTime = System.currentTimeMillis();
final Timer timer = new Timer() {
public void run() {
if (initializableView.isInitialized()) {
- ((BookmarkableView)currentCanvas).renderView(viewPath.next());
+ ((BookmarkableView) currentCanvas).renderView(viewPath.next());
} else {
long elapsedMillis = System.currentTimeMillis() - startTime;
if (elapsedMillis < 5000) {
@@ -345,12 +347,12 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
}
};
if (initializableView.isInitialized()) {
- ((BookmarkableView)currentCanvas).renderView(viewPath.next());
+ ((BookmarkableView) currentCanvas).renderView(viewPath.next());
} else {
timer.schedule(100);
}
} else {
- ((BookmarkableView)currentCanvas).renderView(viewPath.next());
+ ((BookmarkableView) currentCanvas).renderView(viewPath.next());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index 87520b7..1c9e15b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -119,11 +119,11 @@ public class Footer extends LocatableToolStrip {
}
public void refreshLoggedIn() {
- setContents("Logged in as " + UserSessionManager.getSessionSubject().getName());
+ setContents(MSG.view_core_loggedInAs(UserSessionManager.getSessionSubject().getName()));
}
public void refreshLoggedOut() {
- setContents("Logged out");
+ setContents(MSG.view_core_loggedOut());
}
}
@@ -158,15 +158,15 @@ public class Footer extends LocatableToolStrip {
GWTServiceLookup.getAlertService().findAlertsByCriteria(alertCriteria,
new AsyncCallback<PageList<Alert>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Latest alerts lookup failed", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_core_error_1(), caught);
}
public void onSuccess(PageList<Alert> result) {
if (result.isEmpty()) {
- setContents("no recent alerts");
+ setContents(MSG.view_core_recentAlerts("0"));
setIcon("subsystems/alert/Alert_LOW_16.png");
} else {
- setContents(result.getTotalSize() + " recent alerts");
+ setContents(MSG.view_core_recentAlerts(Integer.toString(result.getTotalSize())));
setIcon("subsystems/alert/Alert_HIGH_16.png");
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index 841d8e0..ae10b19 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -35,7 +35,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.FormErrorOrientation;
import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Img;
@@ -68,12 +67,15 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
/**
* @author Greg Hinkle
* @author Joseph Marques
*/
-public class LoginView extends Canvas {
+public class LoginView extends LocatableCanvas {
private static boolean loginShowing = false;
@@ -83,7 +85,8 @@ public class LoginView extends Canvas {
private SubmitItem loginButton;
private ValuesManager valuesManager = new ValuesManager();
- public LoginView() {
+ public LoginView(String locatorId) {
+ super(locatorId);
}
//registration fields
@@ -111,7 +114,7 @@ public class LoginView extends Canvas {
loginShowing = true;
UserSessionManager.logout();
- form = new DynamicForm();
+ form = new LocatableDynamicForm("LoginView");
form.setMargin(25);
form.setAutoFocus(true);
form.setShowErrorText(true);
@@ -122,17 +125,17 @@ public class LoginView extends Canvas {
logo.setShowTitle(false);
HeaderItem header = new HeaderItem();
- header.setValue("Please Login");
+ header.setValue(MSG.view_login_prompt());
- TextItem user = new TextItem("user", "User");
+ TextItem user = new TextItem("user", MSG.common_title_user());
user.setRequired(true);
user.setAttribute("autoComplete", "native");
- final PasswordItem password = new PasswordItem("password", "Password");
+ final PasswordItem password = new PasswordItem("password", MSG.dataSource_users_field_password());
password.setRequired(true);
password.setAttribute("autoComplete", "native");
- loginButton = new SubmitItem("login", "Login");
+ loginButton = new SubmitItem("login", MSG.view_login_login());
loginButton.setAlign(Alignment.CENTER);
loginButton.setColSpan(2);
@@ -201,35 +204,33 @@ public class LoginView extends Canvas {
VLayout column = new VLayout();
HeaderItem header = new HeaderItem();
- header
- .setValue("Welcome to JBoss ON! <br/><br/> Enter/update the following fields to complete your registration process."
- + "<br/> Once you click \"OK\" you will be logged in.<br/><br/>");
+ header.setValue(MSG.view_login_welcome());
//build ui elements for registration screen
- first = new TextItem(FIRST, "First Name");
+ first = new TextItem(FIRST, MSG.dataSource_users_field_firstName());
{
first.setRequired(true);
first.setWrapTitle(false);
first.setWidth(fieldWidth);
}
- last = new TextItem(LAST, "Last Name");
+ last = new TextItem(LAST, MSG.dataSource_users_field_lastName());
{
last.setWrapTitle(false);
last.setWidth(fieldWidth);
last.setRequired(true);
}
- final TextItem username = new TextItem(USERNAME, "Username");
+ final TextItem username = new TextItem(USERNAME, MSG.dataSource_users_field_name());
{
username.setValue(user);
username.setDisabled(true);
username.setWidth(fieldWidth);
}
- email = new TextItem(EMAIL, "Email");
+ email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress());
email.setRequired(true);
email.setWidth(fieldWidth);
- phone = new TextItem(PHONE, "Phone");
+ phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber());
phone.setWidth(fieldWidth);
- department = new TextItem(DEPARTMENT, "Department");
+ department = new TextItem(DEPARTMENT, MSG.dataSource_users_field_department());
department.setWidth(fieldWidth);
SpacerItem space = new SpacerItem();
space.setColSpan(1);
@@ -256,7 +257,7 @@ public class LoginView extends Canvas {
.trim().isEmpty()));
//check for session timeout
if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) {
- resetLogin();
+ resetLogin(LoginView.this.extendLocatorId("Register"));
return;
}
@@ -272,7 +273,7 @@ public class LoginView extends Canvas {
form.setValue(DEPARTMENT, String.valueOf(department.getValue()));
form.setValue(SESSIONID, sessionId);
form.setValue(PASSWORD, password);
- registerLdapUser(form, callback);
+ registerLdapUser(LoginView.this.extendLocatorId("RegisterLdap"), form, callback);
}
}
@@ -307,20 +308,20 @@ public class LoginView extends Canvas {
}
public void onFailure(Throwable caught) {
- form.setFieldErrors(FIRST,
- "Note: Optional retrieval of ldap details unsuccessful. Manual entry required.", true);
- Log.debug("Optional LDAP detail retrieval did not succeed. Registration prepopulation will not occur.");
+ form.setFieldErrors(FIRST, MSG.view_login_noLdap(), true);
+ Log
+ .debug("Optional LDAP detail retrieval did not succeed. Registration prepopulation will not occur.");
}
});
- IButton resetButton = new IButton("Reset");
+ IButton resetButton = new LocatableIButton(MSG.common_button_reset());
resetButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
//F5 refresh check? If they've reloaded the form for some reason then bail.
boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password
.trim().isEmpty()));
if (UserSessionManager.isLoggedOut() || credentialsEmpty) {
- resetLogin();
+ resetLogin(LoginView.this.extendLocatorId("Reset"));
return;
}
@@ -341,16 +342,16 @@ public class LoginView extends Canvas {
});
row.addMember(resetButton);
- IButton logout = new IButton("Logout");
+ IButton logout = new LocatableIButton(MSG.view_login_logout());
logout.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
UserSessionManager.logout();
- resetLogin();
+ resetLogin(LoginView.this.extendLocatorId("Reset"));
return;
}
});
row.addMember(logout);
- Label logoutLabel = new Label("(Logout - Complete registration later.)");
+ Label logoutLabel = new Label(MSG.view_login_registerLater());
logoutLabel.setWrap(false);
row.addMember(logoutLabel);
column.addMember(row);
@@ -359,7 +360,7 @@ public class LoginView extends Canvas {
window = new Window();
window.setWidth(800);
window.setHeight(300);
- window.setTitle("Register User");
+ window.setTitle(MSG.view_login_registerUser());
// forced focused, static size, can't close / dismiss
window.setIsModal(true);
@@ -377,11 +378,11 @@ public class LoginView extends Canvas {
/** Go through steps of invalidating this login and piping them back to CoreGUI Login.
*/
- private void resetLogin() {
+ private void resetLogin(String locatorId) {
window.destroy();
loginShowing = false;
UserSessionManager.logout();
- new LoginView().showLoginDialog();
+ new LoginView(locatorId).showLoginDialog();
}
/**Uses the information from the populated form to create the Subject for the new LDAP user.
@@ -389,7 +390,8 @@ public class LoginView extends Canvas {
* @param populatedForm - validated data
* @param callback
*/
- protected void registerLdapUser(DynamicForm populatedForm, final AsyncCallback<Subject> callback) {
+ protected void registerLdapUser(final String locatorId, DynamicForm populatedForm,
+ final AsyncCallback<Subject> callback) {
final Subject newSubject = new Subject();
newSubject.setId(0);//enforce registration element for LDAP processing
@@ -446,14 +448,14 @@ public class LoginView extends Canvas {
Log.debug("Failed to register LDAP subject '" + newSubject.getName() + "' "
+ caught.getMessage());
//TODO: pass in warning message to Login Dialog.
- new LoginView().showLoginDialog();
+ new LoginView(locatorId).showLoginDialog();
}
public void onSuccess(Subject checked) {
Log.trace("Successfully registered LDAP subject '" + checked + "'.");
CoreGUI.getMessageCenter().notify(
- new Message("Succesfully registered the new ldap Subject.", Message.Severity.Info));
+ new Message(MSG.view_login_registerLdapSuccess(), Message.Severity.Info));
Log.trace("Succesfully registered the new ldap Subject.");
window.destroy();
loginShowing = false;
@@ -467,7 +469,7 @@ public class LoginView extends Canvas {
window.destroy();
loginShowing = false;
//TODO: pass informative message to login.
- new LoginView().showLoginDialog();
+ new LoginView(locatorId).showLoginDialog();
}
}
@@ -492,7 +494,7 @@ public class LoginView extends Canvas {
}
if (name.equals(EMAIL)) {
RegExpValidator emailValidator = new RegExpValidator();
- emailValidator.setErrorMessage("Invalid email address");
+ emailValidator.setErrorMessage(MSG.view_login_invalidEmail());
emailValidator.setExpression("^([a-zA-Z0-9_.\\-+])+(a)(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$");
item.setValidators(emailValidator);
}
@@ -545,9 +547,9 @@ public class LoginView extends Canvas {
private void handleError(int statusCode) {
if (statusCode == 401) {
- form.setFieldErrors("login", "The username or password provided does not match our records", true);
+ form.setFieldErrors("login", MSG.view_login_noUser(), true);
} else {
- form.setFieldErrors("login", "The backend data source is unavailable", true);
+ form.setFieldErrors("login", MSG.view_login_noBackend(), true);
}
loginButton.setDisabled(false);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java
index 0932e6f..97d784e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java
@@ -29,6 +29,7 @@ import org.rhq.enterprise.gui.coregui.client.search.SearchBar;
* @author Joseph Marques
*/
public class SearchGUI implements EntryPoint {
+ private static final Messages MSG = CoreGUI.getMessages();
public static SearchGUI singleton = new SearchGUI();
private SearchBar searchBar;
@@ -49,7 +50,7 @@ public class SearchGUI implements EntryPoint {
UserSessionManager.checkLoginStatus(null, null, new AsyncCallback<Subject>() {
@Override
public void onFailure(Throwable caught) {
- SC.say("Unable to determine login status, check server status");
+ SC.say(MSG.view_searchGUI_loginStatus());
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java
index fbf32a9..acbb575 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java
@@ -44,6 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
* @author Ian Springer
*/
public class UserPermissionsManager {
+ private static final Messages MSG = CoreGUI.getMessages();
private static final UserPermissionsManager INSTANCE = new UserPermissionsManager();
private static final AuthorizationGWTServiceAsync AUTHORIZATION_SERVICE = GWTServiceLookup
@@ -179,8 +180,8 @@ public class UserPermissionsManager {
private void loadGlobalPermissions() {
AUTHORIZATION_SERVICE.getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
public void onFailure(Throwable throwable) {
- MESSAGE_CENTER.notify(new Message("Failed to load your global permissions - assuming none for now.",
- throwable, Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult)));
+ MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailGlobal(), throwable,
+ Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult)));
UserPermissionsManager.this.globalPermissions.clear();
UserPermissionsManager.this.globalCacheDirty = true;
notifyGlobalPermissionsLoadedListener();
@@ -204,9 +205,9 @@ public class UserPermissionsManager {
private void loadCurrentResourcePermissions() {
AUTHORIZATION_SERVICE.getExplicitResourcePermissions(this.currentId, new AsyncCallback<Set<Permission>>() {
public void onFailure(Throwable throwable) {
- MESSAGE_CENTER.notify(new Message("Failed to load your permissions for Resource with id ["
- + UserPermissionsManager.this.currentId + "] - assuming none for now.", throwable,
- Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult)));
+ MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailResource(Integer
+ .toString(UserPermissionsManager.this.currentId)), throwable, Message.Severity.Error, EnumSet
+ .of(Message.Option.BackgroundJobResult)));
UserPermissionsManager.this.resourcePermissions.clear();
UserPermissionsManager.this.resourceCacheDirty = true;
notifyResourcePermissionsLoadedListener();
@@ -223,9 +224,9 @@ public class UserPermissionsManager {
private void loadCurrentGroupPermissions() {
AUTHORIZATION_SERVICE.getExplicitGroupPermissions(this.currentId, new AsyncCallback<Set<Permission>>() {
public void onFailure(Throwable throwable) {
- MESSAGE_CENTER.notify(new Message("Failed to load your permissions for group with id ["
- + UserPermissionsManager.this.currentId + "] - assuming none for now.", throwable,
- Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult)));
+ MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailGroup(Integer
+ .toString(UserPermissionsManager.this.currentId)), throwable, Message.Severity.Error, EnumSet
+ .of(Message.Option.BackgroundJobResult)));
UserPermissionsManager.this.resourcePermissions.clear();
UserPermissionsManager.this.resourceCacheDirty = true;
notifyResourcePermissionsLoadedListener();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
index 759d3e3..179ecbe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java
@@ -57,12 +57,16 @@ import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
* @author Joseph Marques
*/
public class UserSessionManager {
+ private static final Messages MSG = CoreGUI.getMessages();
+
public static int SESSION_TIMEOUT = 29 * 60 * 1000; // 29 mins, just shorter than the 30-min web session timeout
private static int LOGOUT_DELAY = 5 * 1000; // wait 5 seconds for in-flight requests to complete before logout
public static final String SESSION_NAME = "RHQ_Session";
private static final UserPermissionsManager USER_PERMISSIONS_MANAGER = UserPermissionsManager.getInstance();
+ private static final String LOCATOR_ID = "SessionManagerLogin";
+
private static Subject sessionSubject;
private static UserPreferences userPreferences;
@@ -78,7 +82,7 @@ public class UserSessionManager {
public void run() {
Log.info("Session timer expired.");
sessionState = State.IS_LOGGED_OUT;
- new LoginView().showLoginDialog(); // log user out, show login dialog
+ new LoginView(LOCATOR_ID).showLoginDialog(); // log user out, show login dialog
}
};
private static Timer logoutTimer = new Timer() {
@@ -156,7 +160,7 @@ public class UserSessionManager {
Log
.trace("Unable to locate information critical to ldap registration/account lookup. Log back in.");
sessionState = State.IS_LOGGED_OUT;
- new LoginView().showLoginDialog();
+ new LoginView(LOCATOR_ID).showLoginDialog();
return;
}
@@ -185,8 +189,8 @@ public class UserSessionManager {
if (results.size() == 0) {//no case insensitive matches found, launch registration
Log.trace("Proceeding with registration for ldap user '" + user + "'.");
sessionState = State.IS_REGISTERING;
- new LoginView().showRegistrationDialog(subject.getName(), sessionId,
- password, callback);
+ new LoginView(LOCATOR_ID).showRegistrationDialog(subject.getName(),
+ sessionId, password, callback);
return;
} else {//launch case sensitive code handling
Subject locatedSubject = results.get(0);
@@ -204,7 +208,7 @@ public class UserSessionManager {
Log.debug("Failed to complete ldap processing for subject:"
+ caught.getMessage());
//TODO: pass message to login dialog.
- new LoginView().showLoginDialog();
+ new LoginView(LOCATOR_ID).showLoginDialog();
return;
}
@@ -232,11 +236,11 @@ public class UserSessionManager {
GWTServiceLookup.getSubjectService().findSubjectsByCriteria(criteria,
new AsyncCallback<PageList<Subject>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- "UserSessionManager: Failed to load user's subject", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.util_userSession_loadFailSubject(),
+ caught);
Log.info("Failed to load user's subject");
//TODO: pass message to login ui.
- new LoginView().showLoginDialog();
+ new LoginView(LOCATOR_ID).showLoginDialog();
return;
}
@@ -277,7 +281,7 @@ public class UserSessionManager {
}//end of server side session check;
} else {//invalid client session. Back to login
sessionState = State.IS_LOGGED_OUT;
- new LoginView().showLoginDialog();
+ new LoginView(LOCATOR_ID).showLoginDialog();
return;
}
}
@@ -369,7 +373,7 @@ public class UserSessionManager {
sessionState = State.IS_LOGGED_OUT;
Log.info("Destroying session timer...");
sessionTimer.cancel();
-
+
USER_PERMISSIONS_MANAGER.clearCache();
// log out the web session on the server-side in a delayed fashion,
@@ -383,7 +387,7 @@ public class UserSessionManager {
GWTServiceLookup.getSubjectService().logout(UserSessionManager.getSessionSubject(),
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to logout.", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.util_userSession_logoutFail(), caught);
}
public void onSuccess(Void result) {
@@ -392,7 +396,7 @@ public class UserSessionManager {
});
}
} catch (Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to logout.", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.util_userSession_logoutFail(), caught);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index a439288..c253fda 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -33,6 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/**
* The Administration top-level view.
@@ -41,27 +42,32 @@ import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
* @author Ian Springer
*/
public class AdministrationView extends AbstractSectionedLeftNavigationView {
- public static final String VIEW_ID = "Administration";
+ public static final ViewName VIEW_ID = new ViewName("Administration", MSG.view_admin_administration());
- public static final String SECTION_SECURITY_VIEW_ID = "Security";
- public static final String SECTION_TOPOLOGY_VIEW_ID = "Topology";
- public static final String SECTION_CONFIGURATION_VIEW_ID = "Configuration";
+ public static final ViewName SECTION_SECURITY_VIEW_ID = new ViewName("Security", MSG.view_admin_security());
+ public static final ViewName SECTION_TOPOLOGY_VIEW_ID = new ViewName("Topology", MSG.view_admin_topology());
+ public static final ViewName SECTION_CONFIGURATION_VIEW_ID = new ViewName("Configuration", MSG
+ .view_admin_configuration());
// TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available
- private static final String PAGE_SERVERS_VIEW_ID = "Servers";
- private static final String PAGE_AGENTS_VIEW_ID = "Agents";
- private static final String PAGE_AFFINITY_GROUPS_VIEW_ID = "AffinityGroups";
- private static final String PAGE_PARTITION_EVENTS_VIEW_ID = "PartitionEvents";
+ private static final ViewName PAGE_SERVERS_VIEW_ID = new ViewName("Servers", MSG.view_adminTopology_servers());
+ private static final ViewName PAGE_AGENTS_VIEW_ID = new ViewName("Agents", MSG.view_adminTopology_agents());
+ private static final ViewName PAGE_AFFINITY_GROUPS_VIEW_ID = new ViewName("AffinityGroups", MSG
+ .view_adminTopology_affinityGroups());
+ private static final ViewName PAGE_PARTITION_EVENTS_VIEW_ID = new ViewName("PartitionEvents", MSG
+ .view_adminTopology_partitionEvents());
- private static final String PAGE_SYSTEM_SETTINGS_VIEW_ID = "SystemSettings";
- private static final String PAGE_TEMPLATES_VIEW_ID = "Templates";
- private static final String PAGE_DOWNLOADS_VIEW_ID = "Downloads";
- private static final String PAGE_LICENSE_VIEW_ID = "License";
- private static final String PAGE_PLUGINS_VIEW_ID = "Plugins";
+ // TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available
+ private static final ViewName PAGE_SYSTEM_SETTINGS_VIEW_ID = new ViewName("SystemSettings", MSG
+ .view_adminConfig_systemSettings());
+ private static final ViewName PAGE_TEMPLATES_VIEW_ID = new ViewName("Templates", MSG.view_adminConfig_templates());
+ private static final ViewName PAGE_DOWNLOADS_VIEW_ID = new ViewName("Downloads", MSG.view_adminConfig_downloads());
+ private static final ViewName PAGE_LICENSE_VIEW_ID = new ViewName("License", MSG.view_adminConfig_license());
+ private static final ViewName PAGE_PLUGINS_VIEW_ID = new ViewName("Plugins", MSG.view_adminConfig_plugins());
public AdministrationView() {
// This is a top level view, so our locator id can simply be our view id.
- super(VIEW_ID);
+ super(VIEW_ID.getName());
}
@Override
@@ -108,28 +114,28 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildTopologySection() {
NavigationItem serversItem = new NavigationItem(PAGE_SERVERS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_SERVERS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_SERVERS_VIEW_ID.getName()),
"/rhq/ha/listServers-plain.xhtml?nomenu=true");
}
});
NavigationItem agentsItem = new NavigationItem(PAGE_AGENTS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_AGENTS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_AGENTS_VIEW_ID.getName()),
"/rhq/ha/listAgents-plain.xhtml?nomenu=true");
}
});
NavigationItem affinityGroupsItem = new NavigationItem(PAGE_AFFINITY_GROUPS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_AFFINITY_GROUPS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_AFFINITY_GROUPS_VIEW_ID.getName()),
"/rhq/ha/listAffinityGroups-plain.xhtml?nomenu=true");
}
});
NavigationItem partitionEventsItem = new NavigationItem(PAGE_PARTITION_EVENTS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_PARTITION_EVENTS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_PARTITION_EVENTS_VIEW_ID.getName()),
"/rhq/ha/listPartitionEvents-plain.xhtml?nomenu=true");
}
});
@@ -148,35 +154,35 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildConfigurationSection() {
NavigationItem systemSettingsItem = new NavigationItem(PAGE_SYSTEM_SETTINGS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID.getName()),
"/admin/config/Config.do?mode=edit&nomenu=true");
}
});
NavigationItem templatesItem = new NavigationItem(PAGE_TEMPLATES_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new ResourceTypeTreeView(extendLocatorId(PAGE_TEMPLATES_VIEW_ID));
+ return new ResourceTypeTreeView(extendLocatorId(PAGE_TEMPLATES_VIEW_ID.getName()));
}
});
templatesItem.setRefreshRequired(true); // we always need a new page
NavigationItem downloadsItem = new NavigationItem(PAGE_DOWNLOADS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_DOWNLOADS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_DOWNLOADS_VIEW_ID.getName()),
"/rhq/admin/downloads-body.xhtml?nomenu=true");
}
});
NavigationItem licenseItem = new NavigationItem(PAGE_LICENSE_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_LICENSE_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_LICENSE_VIEW_ID.getName()),
"/admin/license/LicenseAdmin.do?mode=view&nomenu=true");
}
});
NavigationItem pluginsItem = new NavigationItem(PAGE_PLUGINS_VIEW_ID, null, new ViewFactory() {
public Canvas createView() {
- return new FullHTMLPane(extendLocatorId(PAGE_PLUGINS_VIEW_ID),
+ return new FullHTMLPane(extendLocatorId(PAGE_PLUGINS_VIEW_ID.getName()),
"/rhq/admin/plugin/plugin-list-plain.xhtml?nomenu=true");
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
index eb07c45..86e7f11 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java
@@ -48,6 +48,7 @@ import org.rhq.core.domain.install.remote.RemoteAccessInfo;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.RemoteInstallGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -58,7 +59,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
*/
public class RemoteAgentInstallView extends LocatableVLayout {
- public static final String VIEW_ID = "RemoteAgentInstall";
+ public static final ViewName VIEW_ID = new ViewName("RemoteAgentInstall", MSG
+ .view_adminTopology_remoteAgentInstall());
private RemoteInstallGWTServiceAsync remoteInstallService = GWTServiceLookup.getRemoteInstallService();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index dbf0f76..393293c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -26,6 +26,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/**
* A table that lists all roles and provides the ability to view details of or delete those roles and to create new
@@ -35,7 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
* @author Ian Springer
*/
public class RolesView extends TableSection implements BookmarkableView {
- public static final String VIEW_ID = "Roles";
+ public static final ViewName VIEW_ID = new ViewName("Roles", MSG.view_adminSecurity_roles());
private static final int ID_SUPERUSER = 1;
private static final int ID_ALL_RESOURCES = 2;
@@ -44,7 +45,7 @@ public class RolesView extends TableSection implements BookmarkableView {
private static final String HEADER_ICON = "global/Role_16.png";
public RolesView(String locatorId) {
- super(locatorId, "Roles");
+ super(locatorId, MSG.view_adminSecurity_roles());
final RolesDataSource datasource = RolesDataSource.getInstance();
setDataSource(datasource);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 905abbc..7118d31 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableActio
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
@@ -39,12 +40,10 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*/
public class UsersView extends TableSection {
- public static final String VIEW_ID = "Users";
+ public static final ViewName VIEW_ID = new ViewName("Users", MSG.view_adminSecurity_users());
public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
+ AdministrationView.SECTION_SECURITY_VIEW_ID + "/" + VIEW_ID;
- private static final String TITLE = "Users";
-
private static final int ID_OVERLORD = 1;
private static final int ID_RHQADMIN = 2;
@@ -53,7 +52,7 @@ public class UsersView extends TableSection {
private static Message message;
public UsersView(String locatorId) {
- super(locatorId, TITLE);
+ super(locatorId, MSG.view_adminSecurity_users());
final UsersDataSource dataSource = UsersDataSource.getInstance();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index deb6727..b6f34ca 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -40,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableActio
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -57,8 +58,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*/
public class AlertHistoryView extends TableSection {
// TODO: Create a subclass for the subsystem view.
- public static final String SUBSYSTEM_VIEW_ID = "RecentAlerts";
- private static final String SUBSYSTEM_VIEW_TITLE = "Recent Alerts";
+ public static final ViewName SUBSYSTEM_VIEW_ID = new ViewName("RecentAlerts", MSG.common_title_recent_alerts());
private static SortSpecifier DEFAULT_SORT_SPECIFIER = new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME,
SortDirection.DESCENDING);
@@ -67,7 +67,7 @@ public class AlertHistoryView extends TableSection {
// for subsystem views
public AlertHistoryView(String locatorId) {
- this(locatorId, SUBSYSTEM_VIEW_TITLE, EntityContext.forSubsystemView(), false);
+ this(locatorId, SUBSYSTEM_VIEW_ID.getTitle(), EntityContext.forSubsystemView(), false);
}
protected AlertHistoryView(String locatorId, String tableTitle, EntityContext context, boolean hasWriteAccess) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index fa823e3..e08a373 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -31,6 +31,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleView;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
import org.rhq.enterprise.gui.coregui.client.bundle.tree.BundleTreeView;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.content.repository.tree.ContentRepositoryTreeView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
@@ -39,7 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack
* @author Greg Hinkle
*/
public class BundleTopView extends LocatableHLayout implements BookmarkableView {
- public static final String VIEW_ID = "Bundles";
+ public static final ViewName VIEW_ID = new ViewName("Bundles", MSG.view_bundle_bundles());
private BundleTreeView bundleTreeView;
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 13c8835..db654e7 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
@@ -99,7 +99,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
this.bundle = bundle;
- addMember(new BackButton(extendLocatorId("BackButton"), "Back to All Bundles", BundleTopView.VIEW_ID));
+ addMember(new BackButton(extendLocatorId("BackButton"), "Back to All Bundles", BundleTopView.VIEW_ID.getTitle()));
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
index a2b8b37..ec81e48 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java
@@ -44,6 +44,15 @@ public class EnhancedTreeNode extends TreeNode {
}
}
+ public EnhancedTreeNode(String name, String title, TreeNode... children) {
+ super(name, children);
+ if (!(null == title || "".equals(title.trim()))) {
+ setTitle(title);
+ } else if (name != null) {
+ setTitle(StringUtils.deCamelCase(name));
+ }
+ }
+
@Override
public void setName(String name) {
super.setName(name);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
index 46ddd52..bee3bb6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
@@ -121,13 +121,13 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo
TreeNode[] treeNodes = new TreeNode[navigationItems.size()];
for (int i = 0, navigationItemsSize = navigationItems.size(); i < navigationItemsSize; i++) {
NavigationItem item = navigationItems.get(i);
- final TreeNode treeNode = new EnhancedTreeNode(item.getName());
+ final TreeNode treeNode = new EnhancedTreeNode(item.getName(), item.getTitle());
treeNode.setIcon(item.getIcon());
treeNode.setEnabled(item.isEnabled());
treeNodes[i] = treeNode;
}
- TreeNode rootNode = new EnhancedTreeNode(navigationSection.getName(), treeNodes);
+ TreeNode rootNode = new EnhancedTreeNode(navigationSection.getName(), navigationSection.getTitle(), treeNodes);
Tree tree = new Tree();
tree.setRoot(rootNode);
treeGrid.setData(tree);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java
index 90339d3..2319d4d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java
@@ -23,26 +23,34 @@ package org.rhq.enterprise.gui.coregui.client.components.view;
* @author Ian Springer
*/
public class NavigationItem {
- private final String name;
+ private final ViewName viewName;
private final String icon;
private final ViewFactory viewFactory;
private final boolean enabled;
private boolean refreshRequired = false;
- public NavigationItem(String name, String icon, ViewFactory viewFactory) {
+ public NavigationItem(ViewName name, String icon, ViewFactory viewFactory) {
this(name, icon, viewFactory, true);
}
- public NavigationItem(String name, String icon, ViewFactory viewFactory, boolean enabled) {
+ public NavigationItem(ViewName name, String icon, ViewFactory viewFactory, boolean enabled) {
this.icon = icon;
- this.name = name;
+ this.viewName = name;
this.viewFactory = viewFactory;
this.enabled = enabled;
}
+ public ViewName getViewName() {
+ return viewName;
+ }
+
public String getName() {
- return name;
+ return viewName.getName();
+ }
+
+ public String getTitle() {
+ return viewName.getTitle();
}
public String getIcon() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java
index f4d04fb..31e9567 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java
@@ -28,12 +28,12 @@ import java.util.Map;
* @author Ian Springer
*/
public class NavigationSection {
- private String name;
+ private ViewName viewName;
private List<NavigationItem> navigationItems;
private Map<String, NavigationItem> navigationItemsByName;
- public NavigationSection(String name, NavigationItem ... navigationItems) {
- this.name = name;
+ public NavigationSection(ViewName name, NavigationItem... navigationItems) {
+ this.viewName = name;
this.navigationItems = Arrays.asList(navigationItems);
this.navigationItemsByName = new LinkedHashMap<String, NavigationItem>(navigationItems.length);
for (NavigationItem navigationItem : navigationItems) {
@@ -41,8 +41,16 @@ public class NavigationSection {
}
}
+ public ViewName getViewName() {
+ return viewName;
+ }
+
public String getName() {
- return name;
+ return viewName.getName();
+ }
+
+ public String getTitle() {
+ return viewName.getTitle();
}
public List<NavigationItem> getNavigationItems() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java
new file mode 100644
index 0000000..ebececd
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java
@@ -0,0 +1,38 @@
+package org.rhq.enterprise.gui.coregui.client.components.view;
+
+import org.rhq.core.domain.util.StringUtils;
+
+public class ViewName {
+
+ private String name;
+ private String title;
+
+ public ViewName(String name) {
+ this(name, null);
+ }
+
+ public ViewName(String name, String title) {
+ super();
+ this.name = name;
+ this.title = (null == title || "".equals(title.trim())) ? StringUtils.deCamelCase(name) : title;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ /*
+ * Return just the name so String construction of view path works as expected
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index 9592684..ad5550d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -49,6 +49,7 @@ import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView;
@@ -69,7 +70,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
*/
public class DashboardsView extends LocatableVLayout implements BookmarkableView {
- public static final String VIEW_ID = MSG.view_dashboards_title();
+ public static final ViewName VIEW_ID = new ViewName("Dashboard", MSG.view_dashboards_title());
private TabSet tabSet;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
index e7fa7fa..4a563c7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
@@ -46,6 +46,7 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
@@ -59,7 +60,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
* @author Greg Hinkle
*/
public class PlatformPortletView extends LocatableListGrid implements Portlet {
- public static final String VIEW_ID = "CpuAndMemoryUtilization";
+ public static final ViewName VIEW_ID = new ViewName("CpuAndMemoryUtilization", MSG.view_reports_platforms());
private MeasurementDataGWTServiceAsync measurementService = GWTServiceLookup.getMeasurementDataService();
private ResourceTypeGWTServiceAsync typeService = GWTServiceLookup.getResourceTypeGWTService();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
index af5518a..fb4b084 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java
@@ -37,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
@@ -53,32 +54,37 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.Resour
* @author Ian Springer
*/
public class InventoryView extends AbstractSectionedLeftNavigationView {
- public static final String VIEW_ID = "Inventory";
+ public static final ViewName VIEW_ID = new ViewName("Inventory", MSG.common_title_inventory());
// view IDs for Resources section
- private static final String RESOURCES_SECTION_VIEW_ID = "Resources";
+ private static final ViewName RESOURCES_SECTION_VIEW_ID = new ViewName("Resources", MSG
+ .view_inventory_resources_title());
- private static final String PAGE_AUTODISCOVERY_QUEUE = "AutodiscoveryQueue";
- private static final String PAGE_ALL_RESOURCES = "AllResources";
- private static final String PAGE_PLATFORMS = "Platforms";
- private static final String PAGE_SERVERS = "Servers";
- private static final String PAGE_SERVICES = "Services";
- private static final String PAGE_DOWN_SERVERS = "DownServers";
+ private static final ViewName PAGE_AUTODISCOVERY_QUEUE = new ViewName("AutodiscoveryQueue", MSG
+ .view_inventory_adq());
+ private static final ViewName PAGE_ALL_RESOURCES = new ViewName("AllResources", MSG.view_inventory_allResources());
+ private static final ViewName PAGE_PLATFORMS = new ViewName("Platforms", MSG.view_inventory_platforms());
+ private static final ViewName PAGE_SERVERS = new ViewName("Servers", MSG.view_inventory_servers());
+ private static final ViewName PAGE_SERVICES = new ViewName("Services", MSG.view_inventory_services());
+ private static final ViewName PAGE_DOWN_SERVERS = new ViewName("DownServers", MSG.view_inventory_downServers());
// view IDs for Groups section
- private static final String GROUPS_SECTION_VIEW_ID = "Groups";
+ private static final ViewName GROUPS_SECTION_VIEW_ID = new ViewName("Groups", MSG.view_inventory_groups());
- private static final String PAGE_DYNAGROUP_DEFINITIONS = "DynagroupDefinitions";
- private static final String PAGE_ALL_GROUPS = "AllGroups";
- private static final String PAGE_COMPATIBLE_GROUPS = "CompatibleGroups";
- private static final String PAGE_MIXED_GROUPS = "MixedGroups";
- private static final String PAGE_PROBLEM_GROUPS = "ProblemGroups";
+ private static final ViewName PAGE_DYNAGROUP_DEFINITIONS = new ViewName("DynagroupDefinitions", MSG
+ .view_inventory_dynagroupDefs());
+ private static final ViewName PAGE_ALL_GROUPS = new ViewName("AllGroups", MSG.view_inventory_allGroups());
+ private static final ViewName PAGE_COMPATIBLE_GROUPS = new ViewName("CompatibleGroups", MSG
+ .common_title_compatibleGroups());
+ private static final ViewName PAGE_MIXED_GROUPS = new ViewName("MixedGroups", MSG.common_title_mixedGroups());
+ private static final ViewName PAGE_PROBLEM_GROUPS = new ViewName("ProblemGroups", MSG
+ .view_inventory_problemGroups());
private Set<Permission> globalPermissions;
public InventoryView() {
// This is a top level view, so our locator id can simply be our view id.
- super(VIEW_ID);
+ super(VIEW_ID.getName());
}
@Override
@@ -123,40 +129,40 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
NavigationItem autodiscoveryQueueItem = new NavigationItem(PAGE_AUTODISCOVERY_QUEUE, "global/Recent_16.png",
new ViewFactory() {
public Canvas createView() {
- return new ResourceAutodiscoveryView(extendLocatorId(PAGE_AUTODISCOVERY_QUEUE));
+ return new ResourceAutodiscoveryView(extendLocatorId(PAGE_AUTODISCOVERY_QUEUE.getName()));
}
}, this.globalPermissions.contains(Permission.MANAGE_INVENTORY));
// TODO: Specify an icon for this item.
NavigationItem allResourcesItem = new NavigationItem(PAGE_ALL_RESOURCES, null, new ViewFactory() {
public Canvas createView() {
- return new ResourceSearchView(extendLocatorId(PAGE_ALL_RESOURCES), null, PAGE_ALL_RESOURCES,
- "types/Platform_up_24.png", "types/Server_up_24.png", "types/Service_up_24.png");
+ return new ResourceSearchView(extendLocatorId(PAGE_ALL_RESOURCES.getName()), null, PAGE_ALL_RESOURCES
+ .getTitle(), "types/Platform_up_24.png", "types/Server_up_24.png", "types/Service_up_24.png");
}
});
NavigationItem platformsItem = new NavigationItem(PAGE_PLATFORMS, "types/Platform_up_16.png",
new ViewFactory() {
public Canvas createView() {
- return new ResourceSearchView(extendLocatorId(PAGE_PLATFORMS), new Criteria(
+ return new ResourceSearchView(extendLocatorId(PAGE_PLATFORMS.getName()), new Criteria(
ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.PLATFORM.name()),
- PAGE_PLATFORMS, "types/Platform_up_24.png");
+ PAGE_PLATFORMS.getTitle(), "types/Platform_up_24.png");
}
});
NavigationItem serversItem = new NavigationItem(PAGE_SERVERS, "types/Server_up_16.png", new ViewFactory() {
public Canvas createView() {
- return new ResourceSearchView(extendLocatorId(PAGE_SERVERS), new Criteria(
- ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER.name()), PAGE_SERVERS,
- "types/Server_up_24.png");
+ return new ResourceSearchView(extendLocatorId(PAGE_SERVERS.getName()), new Criteria(
+ ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER.name()), PAGE_SERVERS
+ .getTitle(), "types/Server_up_24.png");
}
});
NavigationItem servicesItem = new NavigationItem(PAGE_SERVICES, "types/Service_up_16.png", new ViewFactory() {
public Canvas createView() {
- return new ResourceSearchView(extendLocatorId(PAGE_SERVICES), new Criteria(
- ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVICE.name()), PAGE_SERVICES,
- "types/Service_up_24.png");
+ return new ResourceSearchView(extendLocatorId(PAGE_SERVICES.getName()), new Criteria(
+ ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVICE.name()), PAGE_SERVICES
+ .getTitle(), "types/Service_up_24.png");
}
});
@@ -168,7 +174,7 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
criteria.addCriteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER
.name());
// TODO (ips, 10/28/10): Should we include down platforms too?
- return new ResourceSearchView(extendLocatorId(PAGE_DOWN_SERVERS), criteria, MSG
+ return new ResourceSearchView(extendLocatorId(PAGE_DOWN_SERVERS.getName()), criteria, MSG
.view_inventory_downServers());
}
});
@@ -182,33 +188,33 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
"types/GroupDefinition_16.png", new ViewFactory() {
public Canvas createView() {
// TODO: Do we have a 24x24 groupdef icon?
- return new GroupDefinitionListView(extendLocatorId(PAGE_DYNAGROUP_DEFINITIONS),
+ return new GroupDefinitionListView(extendLocatorId(PAGE_DYNAGROUP_DEFINITIONS.getName()),
"types/GroupDefinition_16.png");
}
}, this.globalPermissions.contains(Permission.MANAGE_INVENTORY));
NavigationItem allGroupsItem = new NavigationItem(PAGE_ALL_GROUPS, "types/Group_up_16.png", new ViewFactory() {
public Canvas createView() {
- return new ResourceGroupListView(extendLocatorId(PAGE_ALL_GROUPS), null,
- MSG.view_inventory_allGroups(), "types/Cluster_up_24.png", "types/Group_up_24.png");
+ return new ResourceGroupListView(extendLocatorId(PAGE_ALL_GROUPS.getName()), null, PAGE_ALL_GROUPS
+ .getTitle(), "types/Cluster_up_24.png", "types/Group_up_24.png");
}
});
NavigationItem compatibleGroupsItem = new NavigationItem(PAGE_COMPATIBLE_GROUPS, "types/Cluster_up_16.png",
new ViewFactory() {
public Canvas createView() {
- return new ResourceGroupListView(extendLocatorId(PAGE_COMPATIBLE_GROUPS), new Criteria(
- ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.COMPATIBLE.name()), MSG
- .common_title_compatibleGroups(), "types/Cluster_up_24.png");
+ return new ResourceGroupListView(extendLocatorId(PAGE_COMPATIBLE_GROUPS.getName()), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.COMPATIBLE.name()),
+ PAGE_COMPATIBLE_GROUPS.getTitle(), "types/Cluster_up_24.png");
}
});
NavigationItem mixedGroupsItem = new NavigationItem(PAGE_MIXED_GROUPS, "types/Group_up_16.png",
new ViewFactory() {
public Canvas createView() {
- return new ResourceGroupListView(extendLocatorId(PAGE_MIXED_GROUPS), new Criteria(
- ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.MIXED.name()), MSG
- .common_title_mixedGroups(), "types/Group_up_24.png");
+ return new ResourceGroupListView(extendLocatorId(PAGE_MIXED_GROUPS.getName()), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.MIXED.name()),
+ PAGE_MIXED_GROUPS.getTitle(), "types/Group_up_24.png");
}
});
@@ -217,8 +223,8 @@ public class InventoryView extends AbstractSectionedLeftNavigationView {
public Canvas createView() {
// TODO: There is no underlying support for this criteria. Also, there should not be an active New
// button on this page.
- return new ResourceGroupListView(extendLocatorId(PAGE_PROBLEM_GROUPS), new Criteria("availability",
- "down"), MSG.view_inventory_problemGroups(), "types/Cluster_down_16.png");
+ return new ResourceGroupListView(extendLocatorId(PAGE_PROBLEM_GROUPS.getName()), new Criteria(
+ "availability", "down"), PAGE_PROBLEM_GROUPS.getTitle(), "types/Cluster_down_16.png");
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index 5c8670e..874d407 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -26,13 +26,14 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
*/
public class ResourceGroupTopView extends LocatableHLayout implements BookmarkableView {
- public static final String VIEW_ID = "ResourceGroup";
+ public static final ViewName VIEW_ID = new ViewName("ResourceGroup", MSG.common_title_resource_group());
private Canvas contentCanvas;
private ResourceGroupTreeView treeView;
@@ -50,7 +51,7 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
setHeight100();
treeView = new ResourceGroupTreeView(extendLocatorId("Tree"));
- detailView = new ResourceGroupDetailView(extendLocatorId("Detail"), ResourceGroupTopView.VIEW_ID);
+ detailView = new ResourceGroupDetailView(extendLocatorId("Detail"), ResourceGroupTopView.VIEW_ID.getName());
addMember(treeView);
contentCanvas = new Canvas();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 29647f1..b8f8445 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -370,7 +370,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
new Message(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId)),
Message.Severity.Warning));
- CoreGUI.goToView(InventoryView.VIEW_ID);
+ CoreGUI.goToView(InventoryView.VIEW_ID.getName());
}
public void onSuccess(PageList<ResourceComposite> result) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
index 836b35e..09c75e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
@@ -22,6 +22,7 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
@@ -29,7 +30,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
* @author Greg Hinkle
*/
public class ResourceTopView extends LocatableHLayout implements BookmarkableView {
- public static final String VIEW_ID = "Resource";
+ public static final ViewName VIEW_ID = new ViewName("Resource", MSG.common_title_resource());
private Canvas contentCanvas;
private ResourceTreeView treeView;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 1e933ef..767b151 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -35,14 +35,14 @@ import org.rhq.enterprise.gui.coregui.client.components.configuration.Configurat
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/**
* @author Greg Hinkle
*/
public class ConfigurationHistoryView extends TableSection {
-
- public static final String VIEW_ID = "RecentConfigurationChanges";
- private static final String TITLE = MSG.view_configurationHistoryList_title();
+ public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges", MSG
+ .view_configurationHistoryList_title());
private Integer resourceId;
@@ -50,7 +50,7 @@ public class ConfigurationHistoryView extends TableSection {
* Use this constructor to view config histories for all viewable Resources.
*/
public ConfigurationHistoryView(String locatorId) {
- super(locatorId, TITLE);
+ super(locatorId, VIEW_ID.getTitle());
final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
}
@@ -61,7 +61,7 @@ public class ConfigurationHistoryView extends TableSection {
* @param resourceId a Resource ID
*/
public ConfigurationHistoryView(String locatorId, int resourceId) {
- super(locatorId, TITLE, createCriteria(resourceId));
+ super(locatorId, VIEW_ID.getTitle(), createCriteria(resourceId));
this.resourceId = resourceId;
ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
setDataSource(datasource);
@@ -124,15 +124,14 @@ public class ConfigurationHistoryView extends TableSection {
setListGridFields(fields.toArray(new ListGridField[fields.size()]));
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(),
- MSG.common_msg_deleteConfirm(MSG.common_msg_deleteConfirm(MSG.view_configurationHistoryList_itemNamePlural())),
- new AbstractTableAction(
- TableActionEnablement.ANY) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- // TODO: Implement this method.
- CoreGUI.getErrorHandler().handleError("Not implemented");
- }
- });
+ addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_deleteConfirm(MSG
+ .common_msg_deleteConfirm(MSG.view_configurationHistoryList_itemNamePlural())), new AbstractTableAction(
+ TableActionEnablement.ANY) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ // TODO: Implement this method.
+ CoreGUI.getErrorHandler().handleError("Not implemented");
+ }
+ });
addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction(
TableActionEnablement.MULTIPLE) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index 662dff7..3b7accc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -36,6 +36,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -46,15 +47,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
* @author Greg Hinkle
*/
public class OperationHistoryView extends TableSection {
-
- public static final String VIEW_ID = "RecentOperations";
- private static final String TITLE = MSG.view_operationHistoryList_title();
+ public static final ViewName VIEW_ID = new ViewName("RecentOperations", MSG.common_title_recent_operations());
private ResourceComposite composite;
private Resource resource;
public OperationHistoryView(String locatorId) {
- super(locatorId, TITLE);
+ super(locatorId, VIEW_ID.getTitle());
setWidth100();
setHeight100();
@@ -63,9 +62,8 @@ public class OperationHistoryView extends TableSection {
}
public OperationHistoryView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, TITLE, new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID,
- String.valueOf(resourceComposite.getResource()
- .getId())));
+ super(locatorId, VIEW_ID.getTitle(), new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID, String
+ .valueOf(resourceComposite.getResource().getId())));
this.composite = resourceComposite;
this.resource = resourceComposite.getResource();
@@ -134,9 +132,8 @@ public class OperationHistoryView extends TableSection {
}
});
- IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"),
- MSG.view_operationHistoryList_button_runOperation(),
- operationMenu);
+ IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"), MSG
+ .view_operationHistoryList_button_runOperation(), operationMenu);
operationsButton.setShowMenuBelow(false);
operationsButton.setAutoFit(true);
addExtraWidget(operationsButton);
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 212b8e1..38bfba0 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
@@ -34,6 +34,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
@@ -47,10 +48,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
*/
public class MenuBarView extends LocatableVLayout {
- public static final String[] SECTIONS = {DashboardsView.VIEW_ID, InventoryView.VIEW_ID, ReportTopView.VIEW_ID,
- BundleTopView.VIEW_ID, AdministrationView.VIEW_ID};
+ public static final ViewName[] SECTIONS = { DashboardsView.VIEW_ID, InventoryView.VIEW_ID, ReportTopView.VIEW_ID,
+ BundleTopView.VIEW_ID, AdministrationView.VIEW_ID };
- private String currentlySelectedSection = DashboardsView.VIEW_ID;
+ private String currentlySelectedSection = DashboardsView.VIEW_ID.getName();
public MenuBarView(String locatorId) {
super(locatorId);
@@ -111,7 +112,7 @@ public class MenuBarView extends LocatableVLayout {
"<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
headerString.append("<td style=\"width: 1px;\"><img src=\"images/header/header_bg_line.png\"/></td>");
- for (String section : SECTIONS) {
+ for (ViewName section : SECTIONS) {
String styleClass = "TopSectionLink";
if (section.equals(currentlySelectedSection)) {
@@ -119,9 +120,9 @@ public class MenuBarView extends LocatableVLayout {
}
// Set explicit identifiers because the generated scLocator is not getting picked up by Selenium.
- headerString.append("<td id=\"").append(section).append("\" class=\"").append(styleClass)
- .append("\" onclick=\"document.location='#").append(section).append("'\" >");
- headerString.append(section);
+ headerString.append("<td id=\"").append(section).append("\" class=\"").append(styleClass).append(
+ "\" onclick=\"document.location='#").append(section).append("'\" >");
+ headerString.append(section.getTitle());
headerString.append("</td>\n");
headerString.append("<td style=\"width: 1px;\"><img src=\"images/header/header_bg_line.png\"/></td>");
@@ -147,5 +148,5 @@ public class MenuBarView extends LocatableVLayout {
return layout;
}
-
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 57ed643..5e1e957 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
@@ -47,14 +48,14 @@ import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
* @author Ian Springer
*/
public class ReportTopView extends AbstractSectionedLeftNavigationView {
- public static final String VIEW_ID = "Reports";
+ public static final ViewName VIEW_ID = new ViewName("Reports", MSG.view_reportsTop_title());
- private static final String SUBSYSTEMS_SECTION_VIEW_ID = "Subsystems";
- private static final String INVENTORY_SECTION_VIEW_ID = "Inventory";
+ private static final ViewName SUBSYSTEMS_SECTION_VIEW_ID = new ViewName("Subsystems", MSG.view_reports_subsystems());
+ private static final ViewName INVENTORY_SECTION_VIEW_ID = new ViewName("Inventory", MSG.common_title_inventory());
public ReportTopView() {
// This is a top level view, so our locator id can simply be our view id.
- super(VIEW_ID);
+ super(VIEW_ID.getName());
}
@Override
@@ -81,65 +82,64 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildSubsystemsSection() {
NavigationItem tagItem = new NavigationItem(TaggedView.VIEW_ID, "global/Cloud_16.png", new ViewFactory() {
public Canvas createView() {
- return new TaggedView(extendLocatorId("Tag"));
+ return new TaggedView(extendLocatorId(TaggedView.VIEW_ID.getName()));
}
});
NavigationItem suspectMetricsItem = new NavigationItem(MeasurementOOBView.VIEW_ID,
"subsystems/monitor/Monitor_failed_16.png", new ViewFactory() {
- public Canvas createView() {
- return new MeasurementOOBView(extendLocatorId("SuspectMetrics"));
- }
- });
+ public Canvas createView() {
+ return new MeasurementOOBView(extendLocatorId(MeasurementOOBView.VIEW_ID.getName()));
+ }
+ });
NavigationItem recentConfigurationChangesItem = new NavigationItem(ConfigurationHistoryView.VIEW_ID,
"subsystems/configure/Configure_16.png", new ViewFactory() {
- public Canvas createView() {
- return new ConfigurationHistoryView(extendLocatorId("ConfigHistory"));
- }
- });
+ public Canvas createView() {
+ return new ConfigurationHistoryView(extendLocatorId(ConfigurationHistoryView.VIEW_ID.getName()));
+ }
+ });
NavigationItem recentOperationsItem = new NavigationItem(OperationHistoryView.VIEW_ID,
"subsystems/control/Operation_16.png", new ViewFactory() {
- public Canvas createView() {
- return new OperationHistoryView(extendLocatorId("RecentOps"));
- }
- });
+ public Canvas createView() {
+ return new OperationHistoryView(extendLocatorId(OperationHistoryView.VIEW_ID.getName()));
+ }
+ });
NavigationItem recentAlertsItem = new NavigationItem(AlertHistoryView.SUBSYSTEM_VIEW_ID,
"subsystems/alert/Alert_LOW_16.png", new ViewFactory() {
- public Canvas createView() {
- return new AlertHistoryView(extendLocatorId("RecentAlerts"));
- }
- });
+ public Canvas createView() {
+ return new AlertHistoryView(extendLocatorId(AlertHistoryView.SUBSYSTEM_VIEW_ID.getName()));
+ }
+ });
- NavigationItem alertDefinitionsItem = new NavigationItem("AlertDefinitions",
+ NavigationItem alertDefinitionsItem = new NavigationItem(new ViewName("AlertDefinitions"),
"subsystems/alert/Alerts_16.png", new ViewFactory() {
- public Canvas createView() {
- return null; // TODO: mazz
- }
- });
+ public Canvas createView() {
+ return null; // TODO: mazz
+ }
+ });
return new NavigationSection(SUBSYSTEMS_SECTION_VIEW_ID, tagItem, suspectMetricsItem,
recentConfigurationChangesItem, recentOperationsItem, recentAlertsItem, alertDefinitionsItem);
}
private NavigationSection buildInventorySection() {
- NavigationItem
- inventorySummaryItem = new NavigationItem("InventorySummary", "subsystems/inventory/Inventory_16.png",
- new ViewFactory() {
+ NavigationItem inventorySummaryItem = new NavigationItem(new ViewName("InventorySummary", MSG
+ .common_title_inventorySummary()), "subsystems/inventory/Inventory_16.png", new ViewFactory() {
public Canvas createView() {
return new FullHTMLPane(extendLocatorId("InventorySummary"),
"/rhq/admin/report/resourceInstallReport-body.xhtml");
}
});
- NavigationItem platformSystemInfoItem = new NavigationItem(PlatformPortletView.VIEW_ID, "types/Platform_up_16.png",
- new ViewFactory() {
- public Canvas createView() {
- return new PlatformPortletView(extendLocatorId("Platforms"));
- }
- });
+ NavigationItem platformSystemInfoItem = new NavigationItem(PlatformPortletView.VIEW_ID,
+ "types/Platform_up_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return new PlatformPortletView(extendLocatorId(PlatformPortletView.VIEW_ID.getName()));
+ }
+ });
return new NavigationSection(INVENTORY_SECTION_VIEW_ID, inventorySummaryItem, platformSystemInfoItem);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
index 33a706c..e70a673 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
@@ -26,17 +26,17 @@ import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/**
* @author Greg Hinkle
*/
public class MeasurementOOBView extends Table {
- public static final String VIEW_ID = "SuspectMetrics";
- private static final String TITLE = MSG.view_measurementOob_title();
+ public static final ViewName VIEW_ID = new ViewName("SuspectMetrics", MSG.view_measurementOob_title());
public MeasurementOOBView(String locatorId) {
- super(locatorId, TITLE);
+ super(locatorId, VIEW_ID.getTitle());
setDataSource(new MeasurementOOBDataSource());
}
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 1c61a5e..192b0f6 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
@@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.bundle.destination.BundleDestinatio
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
import org.rhq.enterprise.gui.coregui.client.bundle.version.BundleVersionListView;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTileLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -43,7 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class TaggedView extends LocatableVLayout implements BookmarkableView {
- public static final String VIEW_ID = "Tag";
+ public static final ViewName VIEW_ID = new ViewName("Tag", MSG.view_tags_tags());
private TagCloudView tagCloudView;
@@ -103,8 +104,8 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView {
criteria);
tiles.add(bundleDestinationListView);
- ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria,
- MSG.view_taggedResources_title());
+ ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria, MSG
+ .view_taggedResources_title());
tiles.add(resourceView);
for (Table t : tiles) {
@@ -124,5 +125,5 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView {
viewTag(tagString);
}
}
-
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
index d1e1c85..522bc5d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
@@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeView;
import org.rhq.enterprise.gui.coregui.client.test.configuration.TestConfigurationView;
@@ -41,28 +42,27 @@ import org.rhq.enterprise.gui.coregui.client.test.i18n.TestPluralizationView;
* @author Ian Springer
*/
public class TestTopView extends AbstractSectionedLeftNavigationView {
-
- public static final String VIEW_ID = "Test";
+ public static final ViewName VIEW_ID = new ViewName("Test");
// view IDs for Inventory section
- private static final String INVENTORY_SECTION_VIEW_ID = "Inventory";
+ private static final ViewName INVENTORY_SECTION_VIEW_ID = new ViewName("Inventory");
- private static final String PAGE_RESOURCE_SELECTOR = "ResourceSelector";
- private static final String PAGE_TYPE_TREE = "TypeTree";
+ private static final ViewName PAGE_RESOURCE_SELECTOR = new ViewName("ResourceSelector");
+ private static final ViewName PAGE_TYPE_TREE = new ViewName("TypeTree");
// view IDs for Configuration section
- private static final String CONFIGURATION_SECTION_VIEW_ID = "Configuration";
+ private static final ViewName CONFIGURATION_SECTION_VIEW_ID = new ViewName("Configuration");
- private static final String PAGE_CONFIG_EDITOR = "ConfigEditor";
- private static final String PAGE_GROUP_CONFIG_EDITOR = "GroupConfigEditor";
+ private static final ViewName PAGE_CONFIG_EDITOR = new ViewName("ConfigEditor");
+ private static final ViewName PAGE_GROUP_CONFIG_EDITOR = new ViewName("GroupConfigEditor");
// view IDs for Misc section
- private static final String MISC_SECTION_VIEW_ID = "Misc";
- private static final String PAGE_PLURALIZATION_TEST = "PluralizationTest";
+ private static final ViewName MISC_SECTION_VIEW_ID = new ViewName("Misc");
+ private static final ViewName PAGE_PLURALIZATION_TEST = new ViewName("PluralizationTest");
public TestTopView() {
// This is a top level view, so our locator id can simply be our view id.
- super(VIEW_ID);
+ super(VIEW_ID.getName());
}
protected Canvas defaultView() {
@@ -91,13 +91,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildInventorySection() {
NavigationItem resourceSelectorItem = new NavigationItem(PAGE_RESOURCE_SELECTOR, null, new ViewFactory() {
public Canvas createView() {
- return new ResourceSelector(extendLocatorId(PAGE_RESOURCE_SELECTOR));
+ return new ResourceSelector(extendLocatorId(PAGE_RESOURCE_SELECTOR.getName()));
}
});
NavigationItem typeTreeItem = new NavigationItem(PAGE_TYPE_TREE, null, new ViewFactory() {
public Canvas createView() {
- return new ResourceTypeTreeView(extendLocatorId(PAGE_TYPE_TREE));
+ return new ResourceTypeTreeView(extendLocatorId(PAGE_TYPE_TREE.getName()));
}
});
@@ -107,13 +107,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildConfigurationSection() {
NavigationItem configEditorItem = new NavigationItem(PAGE_CONFIG_EDITOR, null, new ViewFactory() {
public Canvas createView() {
- return new TestConfigurationView(extendLocatorId(PAGE_CONFIG_EDITOR));
+ return new TestConfigurationView(extendLocatorId(PAGE_CONFIG_EDITOR.getName()));
}
});
NavigationItem groupConfigEditorItem = new NavigationItem(PAGE_GROUP_CONFIG_EDITOR, null, new ViewFactory() {
public Canvas createView() {
- return new TestGroupConfigurationView(extendLocatorId(PAGE_GROUP_CONFIG_EDITOR));
+ return new TestGroupConfigurationView(extendLocatorId(PAGE_GROUP_CONFIG_EDITOR.getName()));
}
});
@@ -123,7 +123,7 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildMiscSection() {
NavigationItem pluralizationItem = new NavigationItem(PAGE_PLURALIZATION_TEST, null, new ViewFactory() {
public Canvas createView() {
- return new TestPluralizationView(extendLocatorId(PAGE_PLURALIZATION_TEST));
+ return new TestPluralizationView(extendLocatorId(PAGE_PLURALIZATION_TEST.getName()));
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java
new file mode 100644
index 0000000..41e7fa4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java
@@ -0,0 +1,34 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.Canvas;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.Canvas that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableCanvas extends Canvas implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "simpleClassname_locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableCanvas(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ SeleniumUtility.setID(this, locatorId);
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "_" + extension;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index d8c930b..18d2094 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -107,8 +107,9 @@ common_title_recent_alerts = Recent Alerts~
common_title_recent_operations=Recent Operations~
common_title_remove_column=Remove Column~
common_title_resource = Resource~
+common_title_resource_group = Resource Group~
common_title_resource_inventory=Resource Inventory~
-ommon_title_resource_id=Resource ID~
+common_title_resource_id=Resource ID~
common_title_resource_name=Resource Name~
common_title_scheduled_operations=Scheduled Operations~
common_title_selected_resources=Selected Resources~
@@ -571,7 +572,7 @@ view_portlet_operations_config_scheduled_enable=Whether to enable scheduled oper
view_portlet_operations_config_scheduled_maximum=Maximum number of Scheduled operations to display.~
view_portlet_operations_config_completed=completed operations~
view_portlet_operations_config_show_last=show Last~
-view_portlet_operations_config_show_next=show Next~
+view_portlet_operations_config_show_next=show Next~
view_portlet_operations_config_title=OperationsPortlet Configuration~
view_portlet_operations_config_title_desc=The configuration settings for the Operations portlet.~
view_portlet_operations_disabled=(Results currently disabled. Change settings to enable results.~
@@ -592,7 +593,7 @@ view_portlet_recentAlerts_config_members=Select Members~
view_portlet_recentAlerts_config_priority_label = priority Alerts,~
view_portlet_recentAlerts_config_when=within the past~
view_portlet_recentAlerts_help_msg = Displays recent alerts fired on resources visible to the current user login.~
-# dup in common
+// dup in common
view_portlet_recentAlerts_title = Recent Alerts~
view_portlet_recentlyAdded_approved_platforms=recently approved platforms on dashboard.~
view_portlet_recentlyAdded_error1=Failed to load recently added resources~
@@ -962,7 +963,8 @@ view_searchGUI_loginStatus = Unable to determine login status, check server stat
#--------------------------
view_messageCenter_button_messages = Messages~
view_messageCenter_noRecentMessages = No Recent Messages~
-view_messageCenter_messageTitle= Title~
+view_messageCenter_messageTitle= Message Center~
view_messageCenter_messageSeverity= Severity~
view_messageCenter_messageTime= Time~
view_messageCenter_messageDetail= Detail~
+
13 years, 7 months
[rhq] Branch 'delete-agent-plugin' - 3 commits - modules/core modules/enterprise
by John Sanda
modules/core/domain/src/main/java/org/rhq/core/domain/plugin/Plugin.java | 18 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsSessionUIBean.java | 19 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java | 36 ++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionExpressionBuilderLibraryUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml | 36 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java | 105 +++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerLocal.java | 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java | 43 +--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java | 38 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerBean.java | 41 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerLocal.java | 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java | 136 ----------
13 files changed, 348 insertions(+), 154 deletions(-)
New commits:
commit 4ea06192de6ab17f5a9db8b3677f957c081a5f96
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Nov 17 21:25:28 2010 -0500
Refactoring resource and plugin config def updates into separate EJBs
The resource config def update code has been moved out of
ResourceMetadataManagerBean and into
ResourceConfigurationMetadataManagerBean. Likewise, the plugin config
def update code has been moved into
PluginConfigurationMetadataManagerBean.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
new file mode 100644
index 0000000..faa779d
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -0,0 +1,105 @@
+package org.rhq.enterprise.server.resource.metadata;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.configuration.metadata.ConfigurationDefinitionUpdateReport;
+import org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import java.util.Date;
+import java.util.List;
+
+@Stateless
+public class PluginConfigurationMetadataManagerBean implements PluginConfigurationMetadataManagerLocal {
+
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ private EntityManager entityMgr;
+
+ @EJB
+ private ConfigurationMetadataManagerLocal configurationMetadataMgr;
+
+ @EJB
+ private SubjectManagerLocal subjectMgr;
+
+ @EJB
+ private ResourceManagerLocal resourceMgr;
+
+ @Override
+ public void updatePluginConfigurationDefinition(ResourceType existingType, ResourceType newType) {
+ ConfigurationDefinition existingConfigurationDefinition = existingType.getPluginConfigurationDefinition();
+ if (newType.getPluginConfigurationDefinition() != null) {
+ // all new
+ if (existingConfigurationDefinition == null) {
+ entityMgr.persist(newType.getPluginConfigurationDefinition());
+ existingType.setPluginConfigurationDefinition(newType.getPluginConfigurationDefinition());
+ } else // update the configuration
+ {
+ ConfigurationDefinitionUpdateReport updateReport = configurationMetadataMgr
+ .updateConfigurationDefinition(newType.getPluginConfigurationDefinition(),
+ existingConfigurationDefinition);
+
+ if (updateReport.getNewPropertyDefinitions().size() > 0 ||
+ updateReport.getUpdatedPropertyDefinitions().size() > 0) {
+ Subject overlord = subjectMgr.getOverlord();
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterResourceTypeId(existingType.getId());
+ List<Resource> resources = resourceMgr.findResourcesByCriteria(overlord, criteria);
+
+ for (Resource resource : resources) {
+ updateResourcePluginConfiguration(resource, updateReport);
+ }
+ }
+ }
+ } else {
+ // resourceType.getPlu... is null -> remove the existing config
+ if (existingConfigurationDefinition != null) {
+ existingType.setPluginConfigurationDefinition(null);
+ entityMgr.remove(existingConfigurationDefinition);
+ }
+ }
+ }
+
+ private void updateResourcePluginConfiguration(Resource resource, ConfigurationDefinitionUpdateReport updateReport) {
+ Configuration pluginConfiguration = resource.getPluginConfiguration();
+ boolean modified = false;
+ int numberOfProperties = pluginConfiguration.getProperties().size();
+ ConfigurationTemplate template = updateReport.getConfigurationDefinition().getDefaultTemplate();
+ Configuration templateConfiguration = template.getConfiguration();
+
+ for (PropertyDefinition propertyDef : updateReport.getNewPropertyDefinitions()) {
+ if (propertyDef.isRequired()) {
+ Property templateProperty = templateConfiguration.get(propertyDef.getName());
+ pluginConfiguration.put(templateProperty.deepCopy(false));
+ modified = true;
+ }
+ }
+
+ for (PropertyDefinition propertyDef : updateReport.getUpdatedPropertyDefinitions()) {
+ if (propertyDef.isRequired()) {
+ String propertyValue = pluginConfiguration.getSimpleValue(propertyDef.getName(), null);
+ if (propertyValue == null) {
+ Property templateProperty = templateConfiguration.get(propertyDef.getName());
+ pluginConfiguration.put(templateProperty.deepCopy(false));
+ modified = true;
+ }
+ }
+ }
+
+ if (modified) {
+ resource.setMtime(new Date().getTime());
+ }
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerLocal.java
new file mode 100644
index 0000000..6d6bd75
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerLocal.java
@@ -0,0 +1,13 @@
+package org.rhq.enterprise.server.resource.metadata;
+
+
+import org.rhq.core.domain.resource.ResourceType;
+
+import javax.ejb.Local;
+
+@Local
+public interface PluginConfigurationMetadataManagerLocal {
+
+ void updatePluginConfigurationDefinition(ResourceType existingType, ResourceType newType);
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerBean.java
new file mode 100644
index 0000000..c6788c6
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerBean.java
@@ -0,0 +1,41 @@
+package org.rhq.enterprise.server.resource.metadata;
+
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Stateless
+public class ResourceConfigurationMetadataManagerBean implements ResourceConfigurationMetadataManagerLocal {
+
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ private EntityManager entityMgr;
+
+ @EJB
+ private ConfigurationMetadataManagerLocal configurationMetadataMgr;
+
+ @Override
+ public void updateResourceConfigurationDefinition(ResourceType existingType, ResourceType newType) {
+ ConfigurationDefinition newResourceConfigurationDefinition = newType.getResourceConfigurationDefinition();
+ if (newResourceConfigurationDefinition != null) {
+ if (existingType.getResourceConfigurationDefinition() == null) {
+ entityMgr.persist(newResourceConfigurationDefinition);
+ existingType.setResourceConfigurationDefinition(newResourceConfigurationDefinition);
+ } else {
+ ConfigurationDefinition existingDefinition = existingType.getResourceConfigurationDefinition();
+ configurationMetadataMgr.updateConfigurationDefinition(newResourceConfigurationDefinition,
+ existingDefinition);
+ }
+ } else { // newDefinition == null
+ if (existingType.getResourceConfigurationDefinition() != null) {
+ existingType.setResourceConfigurationDefinition(null);
+ }
+ }
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerLocal.java
new file mode 100644
index 0000000..05c34c3
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceConfigurationMetadataManagerLocal.java
@@ -0,0 +1,13 @@
+package org.rhq.enterprise.server.resource.metadata;
+
+
+import org.rhq.core.domain.resource.ResourceType;
+
+import javax.ejb.Local;
+
+@Local
+public interface ResourceConfigurationMetadataManagerLocal {
+
+ void updateResourceConfigurationDefinition(ResourceType existingType, ResourceType newType);
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index 88ca488..63a62ef 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@ -20,35 +20,19 @@ package org.rhq.enterprise.server.resource.metadata;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph;
import org.rhq.core.clientapi.agent.metadata.PluginMetadataManager;
import org.rhq.core.clientapi.agent.metadata.SubCategoriesMetadataParser;
-import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil;
-import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
-import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
-import org.rhq.core.domain.configuration.definition.PropertyDefinition;
-import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.plugin.Plugin;
-import org.rhq.core.domain.resource.*;
+import org.rhq.core.domain.resource.ProcessScan;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceSubCategory;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
-import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.RequiredPermission;
-import org.rhq.enterprise.server.configuration.metadata.ConfigurationDefinitionUpdateReport;
-import org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
-import org.rhq.enterprise.server.event.EventManagerLocal;
-import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
-import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
@@ -59,14 +43,6 @@ import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.*;
-import javax.sql.DataSource;
-import javax.swing.*;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
import java.util.*;
/**
@@ -87,9 +63,6 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
private EntityManager entityManager;
@EJB
- private ConfigurationMetadataManagerLocal configurationMetadataManager;
-
- @EJB
private SubjectManagerLocal subjectManager;
@EJB
@@ -119,6 +92,12 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
@EJB
private AlertMetadataManagerLocal alertMetadataMgr;
+ @EJB
+ private ResourceConfigurationMetadataManagerLocal resourceConfigMetadataMgr;
+
+ @EJB
+ private PluginConfigurationMetadataManagerLocal pluginConfigMetadataMgr;
+
public void updateTypes(Set<ResourceType> resourceTypes) throws Exception {
// Only process the type if it is a non-runs-inside type (i.e. not a child of some other type X at this same
// level in the type hierarchy). runs-inside types which we skip here will get processed at the next level down
@@ -391,10 +370,10 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
// child types which may still be referencing these sub categories
// Update the rest of these related resources
- updatePluginConfiguration(resourceType, existingType);
+ pluginConfigMetadataMgr.updatePluginConfigurationDefinition(existingType, resourceType);
entityManager.flush();
- updateResourceConfiguration(resourceType, existingType);
+ resourceConfigMetadataMgr.updateResourceConfigurationDefinition(existingType, resourceType);
measurementMetadataMgr.updateMetadata(existingType, resourceType);
contentMetadataMgr.updateMetadata(existingType, resourceType);
@@ -598,74 +577,6 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
return result;
}
- /**
- * Update the stuff below a <plugin-configuration>
- */
- private void updatePluginConfiguration(ResourceType resourceType, ResourceType existingType) {
- ConfigurationDefinition existingConfigurationDefinition = existingType.getPluginConfigurationDefinition();
- if (resourceType.getPluginConfigurationDefinition() != null) {
- // all new
- if (existingConfigurationDefinition == null) {
- entityManager.persist(resourceType.getPluginConfigurationDefinition());
- existingType.setPluginConfigurationDefinition(resourceType.getPluginConfigurationDefinition());
- } else // update the configuration
- {
- ConfigurationDefinitionUpdateReport updateReport = configurationMetadataManager
- .updateConfigurationDefinition(resourceType.getPluginConfigurationDefinition(),
- existingConfigurationDefinition);
-
- if (updateReport.getNewPropertyDefinitions().size() > 0 ||
- updateReport.getUpdatedPropertyDefinitions().size() > 0) {
- Subject overlord = subjectManager.getOverlord();
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterResourceTypeId(existingType.getId());
- List<Resource> resources = resourceManager.findResourcesByCriteria(overlord, criteria);
-
- for (Resource resource : resources) {
- updateResourcePluginConfiguration(resource, updateReport);
- }
- }
- }
- } else {
- // resourceType.getPlu... is null -> remove the existing config
- if (existingConfigurationDefinition != null) {
- existingType.setPluginConfigurationDefinition(null);
- entityManager.remove(existingConfigurationDefinition);
- }
- }
- }
-
- private void updateResourcePluginConfiguration(Resource resource, ConfigurationDefinitionUpdateReport updateReport) {
- Configuration pluginConfiguration = resource.getPluginConfiguration();
- boolean modified = false;
- int numberOfProperties = pluginConfiguration.getProperties().size();
- ConfigurationTemplate template = updateReport.getConfigurationDefinition().getDefaultTemplate();
- Configuration templateConfiguration = template.getConfiguration();
-
- for (PropertyDefinition propertyDef : updateReport.getNewPropertyDefinitions()) {
- if (propertyDef.isRequired()) {
- Property templateProperty = templateConfiguration.get(propertyDef.getName());
- pluginConfiguration.put(templateProperty.deepCopy(false));
- modified = true;
- }
- }
-
- for (PropertyDefinition propertyDef : updateReport.getUpdatedPropertyDefinitions()) {
- if (propertyDef.isRequired()) {
- String propertyValue = pluginConfiguration.getSimpleValue(propertyDef.getName(), null);
- if (propertyValue == null) {
- Property templateProperty = templateConfiguration.get(propertyDef.getName());
- pluginConfiguration.put(templateProperty.deepCopy(false));
- modified = true;
- }
- }
- }
-
-// if (pluginConfiguration.getProperties().size() > numberOfProperties) {
- if (modified) {
- resource.setMtime(new Date().getTime());
- }
- }
/**
* Update the set of process scans for a given resource type
@@ -857,27 +768,4 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
}
}
- /**
- * deals with the content of <resource-configuration>
- */
- private void updateResourceConfiguration(ResourceType newType, ResourceType existingType) {
- ConfigurationDefinition newResourceConfigurationDefinition = newType.getResourceConfigurationDefinition();
- if (newResourceConfigurationDefinition != null) {
- if (existingType.getResourceConfigurationDefinition() == null) // everything new
- {
- entityManager.persist(newResourceConfigurationDefinition);
- existingType.setResourceConfigurationDefinition(newResourceConfigurationDefinition);
- } else {
- ConfigurationDefinition existingDefinition = existingType.getResourceConfigurationDefinition();
- configurationMetadataManager.updateConfigurationDefinition(newResourceConfigurationDefinition,
- existingDefinition);
- }
- } else // newDefinition == null
- {
- if (existingType.getResourceConfigurationDefinition() != null) {
- existingType.setResourceConfigurationDefinition(null);
- }
- }
- }
-
}
commit b9cdb81c7c69c3fe96160ccf542cd5b8e975cf40
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Nov 17 20:57:19 2010 -0500
Adding javadocs
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java
index c9f51f2..4c91c67 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java
@@ -65,6 +65,17 @@ public interface PluginManagerLocal {
*/
void deletePlugins(Subject subject, List<Integer> pluginIds) throws Exception;
+ /**
+ * Permanently removes the plugins with the specified ids from the database. This operation first calls
+ * {@link #deletePlugins(Subject, List)} as a safeguard to ensure that the plugins are first deleted. In a HA
+ * deployment however, you should wait at least 5 minutes after deleting a plugin before purging it. Five minutes
+ * is the default interval of the agent plugin scanner. This should be sufficient time for servers in the cluster
+ * to delete the plugin from the file system.
+ *
+ * @param subject The user purging the plugin
+ * @param pluginIds The ids of the plugins to be purged
+ * @throws Exception if an error occurs
+ */
void purgePlugins(Subject subject, List<Integer> pluginIds) throws Exception;
void setPluginEnabledFlag(Subject subject, int pluginId, boolean enabled) throws Exception;
commit 81977d01b6f6f39b684e4809bf8edf3d3e4d21eb
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Nov 17 20:49:54 2010 -0500
Adding support for purging an agent plugin
I have updated the UI for agent plugins to behave similar to how it
behaves for server plugins. There is now a 'SHOW DELETED' button on the
agent plugins tab. When you click it, deleted plugins will be displayed
as well as a 'PURGE' button. Clicking the purge button will result in
the plugin being purged from the database.
The purge operation as a safeguard calls the delete operation on each
plugin before purging them.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/Plugin.java b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/Plugin.java
index 1c4cc1e..61a7211 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/Plugin.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/plugin/Plugin.java
@@ -134,6 +134,23 @@ import javax.persistence.NamedQuery;
+ " FROM Plugin AS p " //
+ " WHERE p.name=:name "), //
+ @NamedQuery(name = Plugin.QUERY_FIND_ALL, query =
+ " SELECT new org.rhq.core.domain.plugin.Plugin( "
+ + " p.id, "
+ + " p.name, "
+ + " p.path, "
+ + " p.displayName, "
+ + " p.enabled, "
+ + " p.status, "
+ + " p.description, "
+ + " p.help, "
+ + " p.md5, "
+ + " p.version, "
+ + " p.ampsVersion, "
+ + " p.ctime, "
+ + " p.mtime) "
+ + " FROM Plugin AS p "),
+
// finds all installed - ignores those plugins marked as deleted
// this query does not load the content blob, but loads everything else
@NamedQuery(name = Plugin.QUERY_FIND_ALL_INSTALLED, query = "" //
@@ -213,6 +230,7 @@ public class Plugin extends AbstractPlugin {
public static final String QUERY_FIND_ALL_BY_IDS = "Plugin.findAllByIds";
public static final String QUERY_FIND_BY_NAME = "Plugin.findByName";
public static final String QUERY_FIND_ANY_BY_NAME = "Plugin.findAnyByName";
+ public static final String QUERY_FIND_ALL = "Plugin.findAll";
public static final String QUERY_FIND_ALL_INSTALLED = "Plugin.findAllInstalled";
public static final String QUERY_FIND_ALL_DELETED = "Plugin.findAllDeleted";
public static final String UPDATE_PLUGINS_ENABLED_BY_IDS = "Plugin.updatePluginsEnabledByIds";
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsSessionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsSessionUIBean.java
index 096671c..a4d62f2 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsSessionUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsSessionUIBean.java
@@ -19,7 +19,8 @@
package org.rhq.enterprise.gui.admin.plugin;
public class InstalledPluginsSessionUIBean {
- private boolean showAllServerPlugins = false;
+ private boolean showAllServerPlugins;
+ private boolean showAllAgentPlugins;
private String selectedTab;
public InstalledPluginsSessionUIBean() {
@@ -33,14 +34,30 @@ public class InstalledPluginsSessionUIBean {
this.showAllServerPlugins = showDeletedServerPlugins;
}
+ public boolean isShowAllAgentPlugins() {
+ return showAllAgentPlugins;
+ }
+
+ public void setShowAllAgentPlugins(boolean showDeletedAgentPlugins) {
+ showAllAgentPlugins = showDeletedAgentPlugins;
+ }
+
public void showUndeployedServerPlugins() {
setShowAllServerPlugins(true);
}
+ public void showDeletedAgentPlugins() {
+ setShowAllAgentPlugins(true);
+ }
+
public void hideUndeployedServerPlugins() {
setShowAllServerPlugins(false);
}
+ public void hideDeletedAgentPlugins() {
+ setShowAllAgentPlugins(false);
+ }
+
public String getSelectedTab() {
return selectedTab;
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java
index e6026d4..a3c4d9f 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginsUIBean.java
@@ -69,11 +69,16 @@ public class InstalledPluginsUIBean {
}
public Collection<Plugin> getInstalledAgentPlugins() {
-
hasPermission();
- List<Plugin> plugins = pluginMgr.getPlugins();
- plugins = sort(plugins);
- return plugins;
+ List<Plugin> plugins;
+
+ InstalledPluginsSessionUIBean session = FacesContextUtility.getManagedBean(InstalledPluginsSessionUIBean.class);
+ if (session.isShowAllAgentPlugins()) {
+ plugins = pluginMgr.getPlugins();
+ } else {
+ plugins = pluginMgr.getInstalledPlugins();
+ }
+ return sort(plugins);
}
public Collection<ServerPlugin> getInstalledServerPlugins() {
@@ -347,6 +352,29 @@ public class InstalledPluginsUIBean {
return;
}
+ public void purgeAgentPlugins() {
+ try {
+ List<Plugin> selectedPlugins = getSelectedAgentPlugins();
+
+ if (selectedPlugins.isEmpty()) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO,
+ "No plugins were selected. Nothing to purge");
+ return;
+ }
+
+ List<String> pluginNames = new ArrayList<String>();
+ for (Plugin plugin : selectedPlugins) {
+ pluginNames.add(plugin.getName());
+ }
+
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ pluginMgr.purgePlugins(subject, getIds(getSelectedAgentPlugins()));
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Purged server plugins: " + pluginNames);
+ } catch (Exception e) {
+ processException("Failed to purge agent plugins", e);
+ }
+ }
+
private List<Integer> getIds(List<? extends AbstractPlugin> plugins) {
ArrayList<Integer> ids = new ArrayList<Integer>(plugins.size());
for (AbstractPlugin plugin : plugins) {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionExpressionBuilderLibraryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionExpressionBuilderLibraryUIBean.java
index 68a95c1..a572f8b 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionExpressionBuilderLibraryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/definition/group/GroupDefinitionExpressionBuilderLibraryUIBean.java
@@ -165,7 +165,7 @@ public class GroupDefinitionExpressionBuilderLibraryUIBean {
// setup the Plugin drop-down
List<String> pluginNames = new ArrayList<String>();
- for (Plugin plugin : LookupUtil.getPluginManager().getPlugins()) {
+ for (Plugin plugin : LookupUtil.getPluginManager().getInstalledPlugins()) {
// TODO: do we want to do this only when plugin.isEnabled() is true?
pluginNames.add(plugin.getName());
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
index 34b7c01..b2f0317 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
@@ -112,9 +112,18 @@
<h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{!agentPlugin.enabled}"/>
</rich:column>
+ <rich:column sortBy="#{agentPlugin.status}" rendered="#{InstalledPluginsSessionUIBean.showAllAgentPlugins}">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Deployed"/>
+ </f:facet>
+
+ <h:graphicImage value="/images/icons/availability_green_16.png" rendered="#{agentPlugin.status eq 'INSTALLED' }"/>
+ <h:graphicImage value="/images/icons/availability_red_16.png" rendered="#{agentPlugin.status ne 'INSTALLED' }"/>
+ </rich:column>
+
<f:facet name="footer">
<rich:columnGroup>
- <rich:column colspan="5" width="100%">
+ <rich:column colspan="#{InstalledPluginsSessionUIBean.showAllAgentPlugins ? 6 : 5}" width="100%">
<onc:selectCommandButton action="#{InstalledPluginsUIBean.enableAgentPlugins}"
value="ENABLE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
</onc:selectCommandButton>
@@ -122,13 +131,28 @@
value="DISABLE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
</onc:selectCommandButton>
<onc:selectCommandButton action="#{InstalledPluginsUIBean.deleteAgentPlugins}"
- value="DELETE" target="selectedPlugin" styleClass="on-pager-button buttonsmall">
- </onc:selectCommandButton>
+ value="DELETE"
+ target="selectedPlugin"
+ styleClass="on-pager-button buttonsmall"/>
+ <onc:selectCommandButton action="#{InstalledPluginsUIBean.purgeAgentPlugins}"
+ rendered="#{InstalledPluginsSessionUIBean.showAllAgentPlugins}"
+ value="PURGE"
+ target="selectedPlugin"
+ styleClass="on-pager-button buttonsmall"/>
</rich:column>
- <rich:column colspan="5" width="100%" breakBefore="true">
+ <rich:column colspan="#{InstalledPluginsSessionUIBean.showAllAgentPlugins ? 6 : 5}"
+ width="100%"
+ breakBefore="true">
<h:commandButton action="#{InstalledPluginsUIBean.scan}"
- value="SCAN FOR UPDATES" styleClass="on-pager-button buttonsmall">
- </h:commandButton>
+ value="SCAN FOR UPDATES" styleClass="on-pager-button buttonsmall"/>
+ <h:commandButton action="#{InstalledPluginsSessionUIBean.showDeletedAgentPlugins}"
+ rendered="#{!InstalledPluginsSessionUIBean.showAllAgentPlugins}"
+ value="SHOW DELETED"
+ styleClass="on-pager-button buttonsmall"/>
+ <h:commandButton action="#{InstalledPluginsSessionUIBean.hideDeletedAgentPlugins}"
+ rendered="#{InstalledPluginsSessionUIBean.showAllAgentPlugins}"
+ value="HIDE DELETED"
+ styleClass="on-pager-button buttonsmall"/>
</rich:column>
</rich:columnGroup>
</f:facet>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java
index 966bd6b..61b5a97 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/ProductPluginDeployer.java
@@ -430,7 +430,7 @@ public class ProductPluginDeployer {
/*
private List<String> getRegisteredPluginNames() {
ResourceMetadataManagerLocal metadataManager = LookupUtil.getResourceMetadataManager();
- Collection<Plugin> plugins = metadataManager.getPlugins();
+ Collection<Plugin> plugins = metadataManager.getInstalledPlugins();
List<String> pluginNames = new ArrayList<String>();
for (Plugin plugin : plugins) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java
index aa0b115..a863cc4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java
@@ -15,7 +15,6 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.RequiredPermission;
-import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean;
import org.rhq.enterprise.server.inventory.InventoryManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
@@ -33,7 +32,6 @@ import javax.sql.DataSource;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -77,8 +75,24 @@ public class PluginManagerBean implements PluginManagerLocal {
return plugin;
}
- @SuppressWarnings("unchecked")
+ @Override
+ public void purgePlugins(Subject subject, List<Integer> pluginIds) throws Exception {
+ deletePlugins(subject, pluginIds);
+
+ for (Integer id : pluginIds) {
+ Plugin plugin = entityManager.find(Plugin.class, id);
+ log.info("Purging [" + plugin + "] from the database");
+ entityManager.remove(plugin);
+ }
+ }
+
+ @Override
public List<Plugin> getPlugins() {
+ return entityManager.createNamedQuery(Plugin.QUERY_FIND_ALL).getResultList();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Plugin> getInstalledPlugins() {
Query q = entityManager.createNamedQuery(Plugin.QUERY_FIND_ALL_INSTALLED);
return q.getResultList();
}
@@ -115,7 +129,7 @@ public class PluginManagerBean implements PluginManagerLocal {
// we need to make sure that if a plugin is enabled, all of its dependencies are enabled
PluginDependencyGraph graph = PLUGIN_METADATA_MANAGER.buildDependencyGraph();
- List<Plugin> allPlugins = getPlugins();
+ List<Plugin> allPlugins = getInstalledPlugins();
Set<String> pluginsThatNeedToBeEnabled = new HashSet<String>();
for (Integer pluginId : pluginIds) {
@@ -153,7 +167,7 @@ public class PluginManagerBean implements PluginManagerLocal {
// we need to make sure that if a plugin is disabled, no other plugins that depend on it are enabled
PluginDependencyGraph graph = PLUGIN_METADATA_MANAGER.buildDependencyGraph();
- List<Plugin> allPlugins = getPlugins();
+ List<Plugin> allPlugins = getInstalledPlugins();
Set<String> pluginsThatNeedToBeDisabled = new HashSet<String>();
for (Integer pluginId : pluginIds) {
@@ -190,12 +204,12 @@ public class PluginManagerBean implements PluginManagerLocal {
}
PluginDependencyGraph graph = PLUGIN_METADATA_MANAGER.buildDependencyGraph();
- List<Plugin> allPlugins = getPlugins();
+ List<Plugin> allPlugins = getInstalledPlugins();
Set<String> pluginsToDelete = new HashSet<String>();
for (Integer pluginId : pluginIds) {
Plugin plugin = getPluginFromListById(allPlugins, pluginId.intValue());
- if (plugin != null) {
+ if (plugin != null && plugin.getStatus().equals(PluginStatusType.INSTALLED)) {
Collection<String> dependentNames = graph.getAllDependents(plugin.getName());
for (String dependentName : dependentNames) {
Plugin dependentPlugin = getPluginFromListByName(allPlugins, dependentName);
@@ -214,10 +228,12 @@ public class PluginManagerBean implements PluginManagerLocal {
List<Plugin> plugins = getAllPluginsById(pluginIds);
for (Plugin plugin : plugins) {
- List<ResourceType> resourceTypes = resourceTypeMgr.getResourceTypesByPlugin(plugin.getName());
- Plugin managedPlugin = entityManager.merge(plugin);
- inventoryMgr.markTypesDeleted(resourceTypes);
- managedPlugin.setStatus(PluginStatusType.DELETED);
+ if (plugin.getStatus().equals(PluginStatusType.INSTALLED)) {
+ List<ResourceType> resourceTypes = resourceTypeMgr.getResourceTypesByPlugin(plugin.getName());
+ Plugin managedPlugin = entityManager.merge(plugin);
+ inventoryMgr.markTypesDeleted(resourceTypes);
+ managedPlugin.setStatus(PluginStatusType.DELETED);
+ }
}
}
@@ -268,11 +284,6 @@ public class PluginManagerBean implements PluginManagerLocal {
if (typesUpdated) {
resourceMetadataManager.removeObsoleteTypes(subject, plugin.getName(), PLUGIN_METADATA_MANAGER);
-
-// Set<ResourceType> removedTypes = new HashSet<ResourceType>();
-// resourceMetadataManager.getPluginTypes(subject, plugin.getName(), new HashSet<ResourceType>(),
-// removedTypes, PLUGIN_METADATA_MANAGER);
-// inventoryMgr.markTypesDeleted(new ArrayList<ResourceType>(removedTypes));
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java
index 29e3374..c9f51f2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerLocal.java
@@ -24,14 +24,26 @@ public interface PluginManagerLocal {
Plugin getPlugin(String name);
/**
+ * @return A list of all plugins deployed in the server, including deleted plugins
+ */
+ List<Plugin> getPlugins();
+
+ /**
* Returns the list of all plugins deployed in the server.
*
* @return list of plugins deployed
*/
- List<Plugin> getPlugins();
+ List<Plugin> getInstalledPlugins();
List<Plugin> findAllDeletedPlugins();
+ /**
+ * Returns a list of plugins with the specified ids. Both installed and deleted plugins will be included in the
+ * results.
+ *
+ * @param pluginIds The ids of the plugins to fetch
+ * @return A list of plugins with the specified ids
+ */
List<Plugin> getAllPluginsById(List<Integer> pluginIds);
List<Plugin> getPluginsByResourceTypeAndCategory(String resourceTypeName, ResourceCategory resourceCategory);
@@ -40,8 +52,21 @@ public interface PluginManagerLocal {
void disablePlugins(Subject subject, List<Integer> pluginIds) throws Exception;
+ /**
+ * This method puts the plugin into a <i>deleted</i> state and removes the plugin JAR file from the file system. It
+ * does not remove the plugin from the database. This method does not purge the plugin from the database in order
+ * to support HA deployments. In a HA deployment, if server A handles the request to delete the plugin and if it
+ * purges the plugin from the database, server B might see the plugin on the file system and not in the database.
+ * Server B would then proceed to try and re-install the plugin, not knowing it was deleted.
+ *
+ * @param subject The user performing the deletion
+ * @param pluginIds The ids of the plugins to be deleted
+ * @throws Exception if an error occurs
+ */
void deletePlugins(Subject subject, List<Integer> pluginIds) throws Exception;
+ void purgePlugins(Subject subject, List<Integer> pluginIds) throws Exception;
+
void setPluginEnabledFlag(Subject subject, int pluginId, boolean enabled) throws Exception;
/**
13 years, 7 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java | 63 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 26 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java | 12 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java | 19 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java | 103 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java | 22 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 6
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 55 ++++-
10 files changed, 195 insertions(+), 122 deletions(-)
New commits:
commit 5369dcf865a26b34927d25cff27ede259b573274
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Nov 17 19:13:30 2010 -0500
i18n - resource operations views
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
index 2190de5..7735f69 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
@@ -44,6 +44,24 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationHistory> {
+ public static abstract class Field {
+ public static final String ID = "id";
+ public static final String OPERATION_NAME = "operationName";
+ public static final String RESOURCE = "resource";
+ public static final String STATUS = "status";
+ public static final String STARTED_TIME = "startedTime";
+ public static final String CREATED_TIME = "createdTime";
+ public static final String DURATION = "duration";
+ public static final String SUBJECT = "subject";
+ public static final String OPERATION_DEFINITION = "operationDefinition";
+ public static final String ERROR_MESSAGE = "errorMessage";
+ public static final String PARAMETERS = "parameters";
+ }
+
+ public static abstract class CriteriaField {
+ public static final String RESOURCE_ID = "resourceId";
+ }
+
private OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
public OperationHistoryDataSource() {
@@ -55,20 +73,20 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField idField = new DataSourceIntegerField("id");
+ DataSourceIntegerField idField = new DataSourceIntegerField(Field.ID);
idField.setPrimaryKey(true);
fields.add(idField);
- DataSourceTextField nameField = new DataSourceTextField("operationName");
+ DataSourceTextField nameField = new DataSourceTextField(Field.OPERATION_NAME);
fields.add(nameField);
- DataSourceTextField resourceField = new DataSourceTextField("resource");
+ DataSourceTextField resourceField = new DataSourceTextField(Field.RESOURCE);
fields.add(resourceField);
- DataSourceTextField statusField = new DataSourceTextField("status");
+ DataSourceTextField statusField = new DataSourceTextField(Field.STATUS);
fields.add(statusField);
- DataSourceTextField startedField = new DataSourceTextField("startedTime");
+ DataSourceTextField startedField = new DataSourceTextField(Field.STARTED_TIME);
startedField.setType(FieldType.DATETIME);
fields.add(startedField);
@@ -79,9 +97,9 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
protected void executeFetch(final DSRequest request, final DSResponse response) {
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
- if (request.getCriteria().getValues().containsKey("resourceId")) {
+ if (request.getCriteria().getValues().containsKey(CriteriaField.RESOURCE_ID)) {
criteria.addFilterResourceIds(Integer
- .parseInt((String) request.getCriteria().getValues().get("resourceId")));
+ .parseInt((String) request.getCriteria().getValues().get(CriteriaField.RESOURCE_ID)));
}
criteria.setPageControl(getPageControl(request));
@@ -89,7 +107,8 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
operationService.findResourceOperationHistoriesByCriteria(criteria,
new AsyncCallback<PageList<ResourceOperationHistory>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure loading operation histories", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.dataSource_operationHistory_error_fetchFailure(),
+ caught);
}
public void onSuccess(PageList<ResourceOperationHistory> result) {
@@ -101,25 +120,25 @@ public class OperationHistoryDataSource extends RPCDataSource<ResourceOperationH
@Override
public ResourceOperationHistory copyValues(Record from) {
- throw new UnsupportedOperationException("ResourceOperationHistory is read only");
+ throw new UnsupportedOperationException("ResourceOperationHistory is read only.");
}
@Override
public ListGridRecord copyValues(ResourceOperationHistory from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getId());
- record.setAttribute("createdTime", from.getCreatedTime());
- record.setAttribute("startedTime", new Date(from.getStartedTime()));
- record.setAttribute("duration", from.getDuration());
- record.setAttribute("resource", from.getResource());
- record.setAttribute("subject", from.getSubjectName());
- record.setAttribute("operationDefinition", from.getOperationDefinition());
- record.setAttribute("operationName", from.getOperationDefinition().getDisplayName());
- record.setAttribute("errorMessage", from.getErrorMessage());
- record.setAttribute("status", from.getStatus().name());
- record.setAttribute("parameters", from.getParameters());
-
- record.setAttribute("entity", from);
+ record.setAttribute(Field.ID, from.getId());
+ record.setAttribute(Field.CREATED_TIME, from.getCreatedTime());
+ record.setAttribute(Field.STARTED_TIME, new Date(from.getStartedTime()));
+ record.setAttribute(Field.DURATION, from.getDuration());
+ record.setAttribute(Field.RESOURCE, from.getResource());
+ record.setAttribute(Field.SUBJECT, from.getSubjectName());
+ record.setAttribute(Field.OPERATION_DEFINITION, from.getOperationDefinition());
+ record.setAttribute(Field.OPERATION_NAME, from.getOperationDefinition().getDisplayName());
+ record.setAttribute(Field.ERROR_MESSAGE, from.getErrorMessage());
+ record.setAttribute(Field.STATUS, from.getStatus().name());
+ record.setAttribute(Field.PARAMETERS, from.getParameters());
+
return record;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index 5e03c44..662dff7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -46,13 +46,15 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
* @author Greg Hinkle
*/
public class OperationHistoryView extends TableSection {
+
public static final String VIEW_ID = "RecentOperations";
+ private static final String TITLE = MSG.view_operationHistoryList_title();
private ResourceComposite composite;
private Resource resource;
public OperationHistoryView(String locatorId) {
- super(locatorId, "Operation History");
+ super(locatorId, TITLE);
setWidth100();
setHeight100();
@@ -61,7 +63,8 @@ public class OperationHistoryView extends TableSection {
}
public OperationHistoryView(String locatorId, ResourceComposite resourceComposite) {
- super(locatorId, "Operation History", new Criteria("resourceId", String.valueOf(resourceComposite.getResource()
+ super(locatorId, TITLE, new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID,
+ String.valueOf(resourceComposite.getResource()
.getId())));
this.composite = resourceComposite;
this.resource = resourceComposite.getResource();
@@ -73,10 +76,10 @@ public class OperationHistoryView extends TableSection {
@Override
protected void configureTable() {
- getListGrid().getField("id").setWidth(40);
- getListGrid().getField("operationName").setWidth("*");
- getListGrid().getField("status").setWidth(100);
- getListGrid().getField("status").setCellFormatter(new CellFormatter() {
+ getListGrid().getField(OperationHistoryDataSource.Field.ID).setWidth(40);
+ getListGrid().getField(OperationHistoryDataSource.Field.OPERATION_NAME).setWidth("*");
+ getListGrid().getField(OperationHistoryDataSource.Field.STATUS).setWidth(100);
+ getListGrid().getField(OperationHistoryDataSource.Field.STATUS).setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
String icon = "";
@@ -99,18 +102,18 @@ public class OperationHistoryView extends TableSection {
}
});
- getListGrid().getField("startedTime").setWidth(120);
+ getListGrid().getField(OperationHistoryDataSource.Field.STARTED_TIME).setWidth(120);
if (this.resource == null) {
- getListGrid().getField("resource").setWidth(300);
- getListGrid().getField("resource").setCellFormatter(new CellFormatter() {
+ getListGrid().getField(OperationHistoryDataSource.Field.RESOURCE).setWidth(300);
+ getListGrid().getField(OperationHistoryDataSource.Field.RESOURCE).setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
Resource res = (Resource) o;
return "<a href=\"#Resource/" + res.getId() + "\">" + res.getName() + "</a>";
}
});
} else {
- getListGrid().hideField("resource");
+ getListGrid().hideField(OperationHistoryDataSource.Field.RESOURCE);
}
if (resource != null && composite.getResourcePermission().isControl()) {
@@ -131,7 +134,8 @@ public class OperationHistoryView extends TableSection {
}
});
- IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"), "Run Operation",
+ IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"),
+ MSG.view_operationHistoryList_button_runOperation(),
operationMenu);
operationsButton.setShowMenuBelow(false);
operationsButton.setAutoFit(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
index 26f7108..47d7dae 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationWizard.java
@@ -28,6 +28,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
/**
* @author Greg Hinkle
*/
+// TODO (ips, 11/17/10): Can this class be deleted?
public class OperationWizard extends VLayout{
private Resource resource;
@@ -38,15 +39,6 @@ public class OperationWizard extends VLayout{
this.operation = operation;
}
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- }
-
-
-
public static void startPopupOperationWizard(Resource resource, String operation) {
final Window dialog = new Window();
dialog.setTitle("Execute Operation");
@@ -64,6 +56,6 @@ public class OperationWizard extends VLayout{
});
dialog.addItem(new OperationWizard(resource, operation));
dialog.show();
-
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
index c471dc7..1f3f517 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/ExecutionSchedule.java
@@ -29,11 +29,14 @@ import com.google.gwt.i18n.client.DateTimeFormat;
*/
public class ExecutionSchedule implements Serializable {
-
public enum Start {
Immediately, Future
};
+ public enum End {
+ Never, EndOn
+ };
+
public enum Recurr {
Once, EveryNMinutes, Hourly, Daily, Weekly, Monthly
};
@@ -274,7 +277,6 @@ public class ExecutionSchedule implements Serializable {
}
-
public String suffix(int num) {
int last = num % 10;
switch (last) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
index e76e2ca..654ed0a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationCreateWizard.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -70,7 +71,7 @@ public class OperationCreateWizard extends AbstractWizard {
steps.add(schedulingStep);
setSteps(steps);
- executeNowButton = new IButton("Execute Immediately");
+ executeNowButton = new IButton(MSG.view_operationCreateWizard_button_executeImmediately());
executeNowButton.setAutoFit(true);
executeNowButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -78,7 +79,7 @@ public class OperationCreateWizard extends AbstractWizard {
}
});
- executeButton = new IButton("Execute");
+ executeButton = new IButton(MSG.view_operationCreateWizard_button_execute());
executeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
execute();
@@ -90,11 +91,11 @@ public class OperationCreateWizard extends AbstractWizard {
}
public String getWindowTitle() {
- return "Operation Wizard";
+ return MSG.view_operationCreateWizard_title();
}
public String getTitle() {
- return "Execute " + operationDefinition.getDisplayName() + " on " + resource.getName();
+ return MSG.view_operationCreateWizard_header(operationDefinition.getDisplayName(), resource.getName());
}
public String getSubtitle() {
@@ -113,7 +114,7 @@ public class OperationCreateWizard extends AbstractWizard {
}
private void execute() {
- com.allen_sauer.gwt.log.client.Log.info("TODO Executed operation!!");
+ Log.info("TODO Executed operation!!");
OperationGWTServiceAsync operationService = GWTServiceLookup.getOperationService();
@@ -123,13 +124,13 @@ public class OperationCreateWizard extends AbstractWizard {
GWTServiceLookup.getOperationService().scheduleResourceOperation(resource.getId(),
operationDefinition.getName(), parameters, schedule, " testing ", 0, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to schedule operation execution", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_operationCreateWizard_error_scheduleOperationFailure(),
+ caught);
}
public void onSuccess(Void result) {
-
- String message = "Schedule operation [" + operationDefinition.getName() + "] on resource ["
- + resource.getId() + "] with cron string [" + schedule.getCronString() + "]";
+ String message = MSG.view_operationCreateWizard_message_scheduleOperationSuccess(
+ operationDefinition.getName(), String.valueOf(resource.getId()), schedule.getCronString());
CoreGUI.getMessageCenter().notify(new Message(message, Message.Severity.Info));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
index e32b2fd..05489c8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationParametersStep.java
@@ -53,7 +53,7 @@ public class OperationParametersStep extends AbstractWizardStep {
}
return configurationEditor;
} else {
- return new HTMLFlow("This operation does not take any parameters.");
+ return new HTMLFlow(MSG.view_operationCreateWizard_parametersStep_noParameters());
}
}
@@ -62,10 +62,11 @@ public class OperationParametersStep extends AbstractWizardStep {
}
public String getName() {
- return "Operation Parameters";
+ return MSG.view_operationCreateWizard_parametersStep_name();
}
public Configuration getParameterConfiguration() {
return configurationEditor != null ? configurationEditor.getConfiguration() : null;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index 674f366..f90fd69 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -18,10 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create;
+import java.util.ArrayList;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.List;
import com.smartgwt.client.types.FormErrorOrientation;
import com.smartgwt.client.types.TimeFormatter;
@@ -70,51 +72,54 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
// form.setColWidths("15%", "35%", "15%", "*");
form.setValidateOnChange(true);
- final RadioGroupItem start = new RadioGroupItem("start", "Start");
+ final RadioGroupItem start = new RadioGroupItem("start",
+ MSG.view_operationCreateWizard_schedulingStep_name());
start.setColSpan(3);
start.setValueMap(enumValueMap(ExecutionSchedule.Start.class)); // "Immediately", "Future"
start.setRedrawOnChange(true);
start.setValue("Immediately");
HeaderItem scheduleHeader = new HeaderItem("scheduleHeader");
- scheduleHeader.setValue("Schedule");
+ scheduleHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_schedule());
scheduleHeader.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
return !"Immediately".equals(form.getValueAsString("start"));
}
});
- RadioGroupItem recurr = new RadioGroupItem("recurr", "Recurrence");
+ RadioGroupItem recurr = new RadioGroupItem("recurr",
+ MSG.view_operationCreateWizard_schedulingStep_label_recurrence());
recurr.setValueMap(enumValueMap(ExecutionSchedule.Recurr.class)); // "Once", "EveryNMinutes", "Hourly", "Daily", "Weekly", "Monthly");
recurr.setRedrawOnChange(true);
- recurr.setValue("Once");
+ recurr.setValue(ExecutionSchedule.Recurr.Once.name());
recurr.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"));
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"));
}
});
- CanvasItem onceForm = new CanvasItem("once", "Run At");
+ CanvasItem onceForm = new CanvasItem("once", MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
onceForm.setShowTitle(false);
onceForm.setCanvas(getOnceForm());
onceForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
&& ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
}
});
- CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm", "NMinutes");
+ CanvasItem everyNMinuteForm = new CanvasItem("everyNMinutesForm",
+ MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
everyNMinuteForm.setShowTitle(false);
everyNMinuteForm.setCanvas(getEveryNMinutesForm());
everyNMinuteForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
&& ExecutionSchedule.Recurr.EveryNMinutes.name().equals(form.getValueAsString("recurr"));
}
});
- CanvasItem hourlyForm = new CanvasItem("hourlyForm", "Hourly");
+ CanvasItem hourlyForm = new CanvasItem("hourlyForm", MSG.view_operationCreateWizard_schedulingStep_label_hourly());
hourlyForm.setShowTitle(false);
hourlyForm.setCanvas(getHourlyForm());
hourlyForm.setShowIfCondition(new FormItemIfFunction() {
@@ -124,73 +129,74 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
}
});
- CanvasItem dailyForm = new CanvasItem("daily", "Days");
+ CanvasItem dailyForm = new CanvasItem("daily", MSG.view_operationCreateWizard_schedulingStep_label_daily());
dailyForm.setShowTitle(false);
dailyForm.setCanvas(getDailyForm());
dailyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && "Daily".equals(form.getValueAsString("recurr"));
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Daily.name().equals(form.getValueAsString("recurr"));
}
});
- CanvasItem weeklyForm = new CanvasItem("weekly", "Weekly");
+ CanvasItem weeklyForm = new CanvasItem("weekly", MSG.view_operationCreateWizard_schedulingStep_label_weekly());
weeklyForm.setShowTitle(false);
weeklyForm.setCanvas(getWeeklyForm());
weeklyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && "Weekly".equals(form.getValueAsString("recurr"));
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Weekly.name().equals(form.getValueAsString("recurr"));
}
});
- CanvasItem monthlyForm = new CanvasItem("monthly", "Monthly");
+ CanvasItem monthlyForm = new CanvasItem("monthly", MSG.view_operationCreateWizard_schedulingStep_label_monthly());
monthlyForm.setShowTitle(false);
monthlyForm.setCanvas(getMonthlyForm());
monthlyForm.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && "Monthly".equals(form.getValueAsString("recurr"));
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && ExecutionSchedule.Recurr.Monthly.name().equals(form.getValueAsString("recurr"));
}
});
HeaderItem rangeHeader = new HeaderItem("timePeriod");
- rangeHeader.setValue("Time Period");
+ rangeHeader.setValue(MSG.view_operationCreateWizard_schedulingStep_label_timePeriod());
rangeHeader.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
- && !"Once".equals(form.getValueAsString("recurr"));
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
+ && !ExecutionSchedule.Recurr.Once.name().equals(form.getValueAsString("recurr"));
}
});
- DateItem startDate = new DateItem("startDate", "Start Date");
+ DateItem startDate = new DateItem("startDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
startDate.setStartRow(true);
startDate.setStartDate(new Date());
startDate.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
&& !"Once".equals(form.getValueAsString("recurr"));
}
});
- final RadioGroupItem end = new RadioGroupItem("endType", "Recurrence End");
+ final RadioGroupItem end = new RadioGroupItem("endType", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
end.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
&& !"Once".equals(form.getValueAsString("recurr"));
}
});
end.setStartRow(true);
+ // TODO: i18n
end.setValueMap("Never", "End On");
end.setRedrawOnChange(true);
end.setValue("Never");
- DateItem endDate = new DateItem("endDate", "End Date");
+ DateItem endDate = new DateItem("endDate", MSG.view_operationCreateWizard_schedulingStep_label_endDate());
endDate.setStartRow(true);
endDate.setStartDate(new Date());
endDate.setShowIfCondition(new FormItemIfFunction() {
public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
- return !"Immediately".equals(form.getValueAsString("start"))
+ return !ExecutionSchedule.Start.Immediately.name().equals(form.getValueAsString("start"))
&& !"Once".equals(form.getValueAsString("recurr"))
&& !"Never".equals(form.getValueAsString("endType"));
}
@@ -203,7 +209,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
});
StaticTextItem messageItem = new StaticTextItem("message");
- messageItem.setValue("Will execute immediately");
+ messageItem.setValue(MSG.view_operationCreateWizard_schedulingStep_label_willExecuteImmediately());
messageItem.setStartRow(true);
messageItem.setColSpan(3);
messageItem.setShowTitle(false);
@@ -223,16 +229,16 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
form.setValuesManager(valuesManager);
form.setPadding(10);
form.setIsGroup(true);
- form.setGroupTitle("Once At");
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_onceAt());
form.addItemChangedHandler(this);
form.setWrapItemTitles(false);
form.setNumCols(2);
- DateItem startDate = new DateItem("onceStartDate", "Date");
+ DateItem startDate = new DateItem("onceStartDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
startDate.setValue(new Date());
- TimeItem startTime = new TimeItem("onceStartDate", "Time");
+ TimeItem startTime = new TimeItem("onceStartDate", MSG.view_operationCreateWizard_schedulingStep_label_startDate());
startTime.setValue(new Date());
startTime.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
startTime.setUseMask(true);
@@ -245,7 +251,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
form.setValuesManager(valuesManager);
form.setPadding(10);
form.setIsGroup(true);
- form.setGroupTitle("Every N Minutes");
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_everyNMinutes());
form.addItemChangedHandler(this);
form.setWrapItemTitles(false);
@@ -253,7 +259,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
IntegerItem everyNMinutes = new IntegerItem();
everyNMinutes.setName("minuteInterval");
- everyNMinutes.setTitle("Minute Interval");
+ everyNMinutes.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteInterval());
everyNMinutes.setValue(60);
form.setItems(everyNMinutes);
@@ -265,7 +271,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
form.setValuesManager(valuesManager);
form.setPadding(10);
form.setIsGroup(true);
- form.setGroupTitle("Hourly At");
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_hourly());
form.addItemChangedHandler(this);
form.setWrapItemTitles(false);
@@ -273,7 +279,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
IntegerItem minuteOfHour = new IntegerItem();
minuteOfHour.setName("minuteOfHour");
- minuteOfHour.setTitle("Minute of Hour");
+ minuteOfHour.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_minuteOfHour());
minuteOfHour.setValue(5);
form.setItems(minuteOfHour);
@@ -286,10 +292,10 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
form.setPadding(10);
form.setWrapItemTitles(false);
form.setIsGroup(true);
- form.setGroupTitle("Daily At");
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_daily());
form.addItemChangedHandler(this);
- TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
timeOfDay.setValue(new Date());
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
@@ -303,21 +309,25 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
form.setValuesManager(valuesManager);
form.setPadding(10);
form.setIsGroup(true);
- form.setGroupTitle("Weekly On");
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_weekly());
form.addItemChangedHandler(this);
form.setWrapItemTitles(false);
- TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ TimeItem timeOfDay = new TimeItem("dayOfWeek", MSG.view_operationCreateWizard_schedulingStep_label_dayOfWeek());
timeOfDay.setValue(new Date());
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
- String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
+ ExecutionSchedule.DayOfWeek[] daysOfWeek = ExecutionSchedule.DayOfWeek.values();
+ List<String> dayList = new ArrayList<String>();
+ for (ExecutionSchedule.DayOfWeek dayOfWeek : daysOfWeek) {
+ dayList.add(dayOfWeek.name());
+ }
FormItem[] items = new FormItem[8];
items[0] = timeOfDay;
int i = 1;
- for (String day : days) {
+ for (String day : dayList) {
CheckboxItem dayItem = new CheckboxItem(day);
dayItem.setShowTitle(false);
items[i++] = dayItem;
@@ -332,15 +342,15 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
form.setPadding(10);
form.setWrapItemTitles(false);
form.setIsGroup(true);
- form.setGroupTitle("Monthly On");
+ form.setGroupTitle(MSG.view_operationCreateWizard_schedulingStep_label_monthly());
form.addItemChangedHandler(this);
IntegerItem dayItem = new IntegerItem();
dayItem.setName("dayOfMonth");
- dayItem.setTitle("Day of Month");
+ dayItem.setTitle(MSG.view_operationCreateWizard_schedulingStep_label_dayOfMonth());
dayItem.setValue(1);
- TimeItem timeOfDay = new TimeItem("timeOfDay", "Time Of Day");
+ TimeItem timeOfDay = new TimeItem("timeOfDay", MSG.view_operationCreateWizard_schedulingStep_label_timeOfDay());
timeOfDay.setValue(new Date());
timeOfDay.setDisplayFormat(TimeFormatter.TOSHORTPADDEDTIME);
timeOfDay.setUseMask(true);
@@ -354,7 +364,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
}
public String getName() {
- return "Schedule";
+ return MSG.view_operationCreateWizard_schedulingStep_name();
}
public void onItemChanged(ItemChangedEvent itemChangeEvent) {
@@ -404,4 +414,5 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
public ExecutionSchedule getExecutionSchedule() {
return executionSchedule;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
index cc3aa63..de6abed 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
@@ -38,6 +38,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryDataSource;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -45,7 +46,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class OperationDetailsView extends LocatableVLayout implements BookmarkableView {
- private int historyId;
private OperationDefinition definition;
private ResourceOperationHistory operationHistory;
@@ -98,19 +98,19 @@ public class OperationDetailsView extends LocatableVLayout implements Bookmarkab
form.setWidth100();
form.setWrapItemTitles(false);
- StaticTextItem operationItem = new StaticTextItem("operation", "Operation");
+ StaticTextItem operationItem = new StaticTextItem(OperationHistoryDataSource.Field.OPERATION_NAME, "Operation");
operationItem.setValue(definition.getName());
- StaticTextItem submittedItem = new StaticTextItem("submitted", "Date Submitted");
+ StaticTextItem submittedItem = new StaticTextItem(OperationHistoryDataSource.Field.STARTED_TIME, "Date Submitted");
submittedItem.setValue(new Date(operationHistory.getStartedTime()));
StaticTextItem completedItem = new StaticTextItem("completed", "Date Completed");
completedItem.setValue(new Date(operationHistory.getStartedTime() + operationHistory.getDuration()));
- StaticTextItem requesterItem = new StaticTextItem("requester", "Requester");
+ StaticTextItem requesterItem = new StaticTextItem(OperationHistoryDataSource.Field.SUBJECT, "Requester");
requesterItem.setValue(operationHistory.getSubjectName());
- StaticTextItem statusItem = new StaticTextItem("status", "Status");
+ StaticTextItem statusItem = new StaticTextItem(OperationHistoryDataSource.Field.STATUS, "Status");
statusItem.setValue(operationHistory.getStatus().name());
/*
@@ -159,7 +159,8 @@ public class OperationDetailsView extends LocatableVLayout implements Bookmarkab
GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(criteria,
new AsyncCallback<PageList<ResourceOperationHistory>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_operationHistoryDetails_error_fetchFailure(),
+ caught);
}
public void onSuccess(PageList<ResourceOperationHistory> result) {
@@ -184,16 +185,13 @@ public class OperationDetailsView extends LocatableVLayout implements Bookmarkab
window.centerInPage();
window.addItem(detailsView);
window.show();
-
}
@Override
public void renderView(ViewPath viewPath) {
-
- historyId = viewPath.getCurrentAsInt();
-
- viewId = viewPath.getCurrent();
-
+ this.viewId = viewPath.getCurrent();
+ int historyId = viewPath.getCurrentAsInt();
lookupDetails(historyId);
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 196d0b5..9f8b723 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -419,8 +419,8 @@ public abstract class RPCDataSource<T> extends DataSource {
int[] intermediates = criteria.getAttributeAsIntArray(paramName);
resultArray = (S[]) new Integer[intermediates.length];
int index = 0;
- for (Integer next : intermediates) {
- resultArray[index++] = (S) next;
+ for (int next : intermediates) {
+ resultArray[index++] = (S) Integer.valueOf(next);
}
} else if (type == String.class) {
String[] intermediates = criteria.getAttributeAsStringArray(paramName);
@@ -440,7 +440,7 @@ public abstract class RPCDataSource<T> extends DataSource {
throw new IllegalArgumentException(MSG.dataSource_rpc_error_unsupportedArrayFilterType(type.getName()));
}
- Log.debug("Result array = " + resultArray);
+ Log.debug("Result array = " + Arrays.toString(resultArray));
return resultArray;
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 367577e..d8c930b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -108,7 +108,7 @@ common_title_recent_operations=Recent Operations~
common_title_remove_column=Remove Column~
common_title_resource = Resource~
common_title_resource_inventory=Resource Inventory~
-common_title_resource_id=Resource ID~
+ommon_title_resource_id=Resource ID~
common_title_resource_name=Resource Name~
common_title_scheduled_operations=Scheduled Operations~
common_title_selected_resources=Selected Resources~
@@ -162,7 +162,6 @@ common_calendar_october_short=oct
common_calendar_november_short=nov
common_calendar_december_short=dec
-
#=================== Widgets =====================
# Record Editor
@@ -311,6 +310,9 @@ dataSource_measurementOob_error_fetchFailure = Failed to load measurement OOB in
dataSource_definitions_loadFailed=Failed to load metric definitions~
dataSource_schedules_loadFailed=Failed to load metric schedules~
dataSource_schedules_field_resourceGroupId=Group ID~
+dataSource_definitions_loadFailed=Failed to load metric definitions~
+dataSource_schedules_loadFailed=Failed to load metric schedules~
+dataSource_schedules_field_resourceGroupId=Group ID~
dataSource_schedules_enableFailure_resource=Failed to enable the collection of [{0}] metrics for resource with ID [{1}]. The metrics were: [{2}]~
dataSource_schedules_enableFailure_group=Failed to enable the collection of [{0}] metrics for group with ID [{1}]. The metrics were: [{2}]~
@@ -569,7 +571,7 @@ view_portlet_operations_config_scheduled_enable=Whether to enable scheduled oper
view_portlet_operations_config_scheduled_maximum=Maximum number of Scheduled operations to display.~
view_portlet_operations_config_completed=completed operations~
view_portlet_operations_config_show_last=show Last~
-view_portlet_operations_config_show_next=show Next~
+view_portlet_operations_config_show_next=show Next~
view_portlet_operations_config_title=OperationsPortlet Configuration~
view_portlet_operations_config_title_desc=The configuration settings for the Operations portlet.~
view_portlet_operations_disabled=(Results currently disabled. Change settings to enable results.~
@@ -590,7 +592,7 @@ view_portlet_recentAlerts_config_members=Select Members~
view_portlet_recentAlerts_config_priority_label = priority Alerts,~
view_portlet_recentAlerts_config_when=within the past~
view_portlet_recentAlerts_help_msg = Displays recent alerts fired on resources visible to the current user login.~
-// dup in common
+# dup in common
view_portlet_recentAlerts_title = Recent Alerts~
view_portlet_recentlyAdded_approved_platforms=recently approved platforms on dashboard.~
view_portlet_recentlyAdded_error1=Failed to load recently added resources~
@@ -839,7 +841,50 @@ view_configurationHistoryDetails_error_loadFailure = Unable to load configuratio
# Operation History List
#---------------------------------
view_operationHistoryList_title = Operation History~
-view_operationHistoryList_button_runOperation = Run Operation
+view_operationHistoryList_button_runOperation = Run Operation~
+
+# Operation History Details
+#--------------------------------------
+view_operationHistoryDetails_error_fetchFailure = Failure loading operation history.~
+
+# Operation Create Wizard
+#-------------------------------------
+view_operationCreateWizard_title = Operation Wizard~
+view_operationCreateWizard_header = Execute {0} on {1}~
+view_operationCreateWizard_button_execute = Execute~
+view_operationCreateWizard_button_executeImmediately = Execute Immediately~
+view_operationCreateWizard_error_scheduleOperationFailure = Failed to schedule operation execution.~
+view_operationCreateWizard_message_scheduleOperationSuccess = Schedule operation [{0}] on Resource [{1}] with cron string [{2}].~
+view_operationCreateWizard_parametersStep_name = Operation Parameters~
+view_operationCreateWizard_parametersStep_noParameters = This operation does not take any parameters.~
+view_operationCreateWizard_schedulingStep_name = Schedule
+view_operationCreateWizard_schedulingStep_label_start = Start
+view_operationCreateWizard_schedulingStep_label_schedule = Schedule
+view_operationCreateWizard_schedulingStep_label_recurrence = Recurrence
+view_operationCreateWizard_schedulingStep_label_runAt = Run At
+view_operationCreateWizard_schedulingStep_label_nMinutes = n Minutes
+view_operationCreateWizard_schedulingStep_label_hourly = Hourly
+view_operationCreateWizard_schedulingStep_label_daily = Daily
+view_operationCreateWizard_schedulingStep_label_weekly = Weekly
+view_operationCreateWizard_schedulingStep_label_monthly = Monthly
+view_operationCreateWizard_schedulingStep_label_timePeriod = Time Period
+view_operationCreateWizard_schedulingStep_label_startDate = Start Date
+view_operationCreateWizard_schedulingStep_label_recurrenceEnd = Recurrence End
+view_operationCreateWizard_schedulingStep_label_endDate = End Date
+view_operationCreateWizard_schedulingStep_label_willExecuteImmediately = Will execute immediately
+view_operationCreateWizard_schedulingStep_label_onceAt = Once At
+view_operationCreateWizard_schedulingStep_label_date = Date
+view_operationCreateWizard_schedulingStep_label_time = Time
+view_operationCreateWizard_schedulingStep_label_everyNMinutes = Every n Minutes
+view_operationCreateWizard_schedulingStep_label_minuteInterval = Minute Interval
+view_operationCreateWizard_schedulingStep_label_hourlyAt = Hourly At
+view_operationCreateWizard_schedulingStep_label_minuteOfHour = Minute of Hour
+view_operationCreateWizard_schedulingStep_label_dailyAt = Daily At
+view_operationCreateWizard_schedulingStep_label_timeOfDay = Time of Day
+view_operationCreateWizard_schedulingStep_label_weeklyOn = Weekly On
+view_operationCreateWizard_schedulingStep_label_dayOfWeek = Day of Week
+view_operationCreateWizard_schedulingStep_label_monthlyOn = Monthly On
+view_operationCreateWizard_schedulingStep_label_dayOfMonth = Day of Month
#==================== Reports ======================
13 years, 7 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit b1537305a30ade59f796b4c54d83c6c39a01fae6
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 17 18:50:04 2010 -0500
i18n for org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java
index 1ec2946..eea99dd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitori
import java.util.List;
import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -41,7 +40,7 @@ public class TraitsDataSource extends AbstractMeasurementDataTraitDataSource {
List<DataSourceField> fields = super.addDataSourceFields();
DataSourceIntegerField resourceIdField = new DataSourceIntegerField(
- MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID, "Resource Id");
+ MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID, MSG.common_title_resource_id());
resourceIdField.setHidden(true);
fields.add(0, resourceIdField);
13 years, 7 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java | 31 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesDataSource.java | 47 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 27 ++++-
4 files changed, 67 insertions(+), 40 deletions(-)
New commits:
commit c5102314ffcf5b443960378d325bd0e2c3943ce0
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 17 18:46:27 2010 -0500
i18n for org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
index eb9da82..902efa7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
@@ -93,17 +93,18 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
@Override
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError(
- MSG.dataSource_schedules_enableFailure(String.valueOf(measurementDefinitionIds.length), String
- .valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString()), throwable);
+ MSG.dataSource_schedules_enableFailure_group(String.valueOf(measurementDefinitionIds.length),
+ String.valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString()), throwable);
}
@Override
public void onSuccess(Void aVoid) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.dataSource_schedules_enableSuccessful_concise(String
- .valueOf(measurementDefinitionIds.length)), MSG.dataSource_schedules_enableSuccessful_full(
- String.valueOf(measurementDefinitionIds.length), String.valueOf(resourceGroupId),
- measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
+ .valueOf(measurementDefinitionIds.length)), MSG
+ .dataSource_schedules_enableSuccessful_full_group(String
+ .valueOf(measurementDefinitionIds.length), String.valueOf(resourceGroupId),
+ measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
measurementScheduleListView.refresh();
}
});
@@ -118,8 +119,8 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
@Override
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError(
- MSG.dataSource_schedules_disableFailure(String.valueOf(measurementDefinitionIds.length), String
- .valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString()), throwable);
+ MSG.dataSource_schedules_disableFailure_group(String.valueOf(measurementDefinitionIds.length),
+ String.valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString()), throwable);
}
@Override
@@ -127,7 +128,7 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
CoreGUI.getMessageCenter().notify(
new Message(MSG.dataSource_schedules_disableSuccessful_concise(String
.valueOf(measurementDefinitionIds.length)), MSG
- .dataSource_schedules_disableSuccessful_full(String
+ .dataSource_schedules_disableSuccessful_full_group(String
.valueOf(measurementDefinitionIds.length), String.valueOf(resourceGroupId),
measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
measurementScheduleListView.refresh();
@@ -145,9 +146,9 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
@Override
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError(
- MSG.dataSource_schedules_updateFailure(String.valueOf(measurementDefinitionIds.length), String
- .valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString(), String
- .valueOf(collectionInterval / 1000)), throwable);
+ MSG.dataSource_schedules_updateFailure_group(String.valueOf(measurementDefinitionIds.length),
+ String.valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString(), String
+ .valueOf(collectionInterval / 1000)), throwable);
}
@Override
@@ -155,10 +156,10 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
String collIntervalStr = String.valueOf(collectionInterval / 1000);
CoreGUI.getMessageCenter().notify(
new Message(MSG.dataSource_schedules_updateSuccessful_concise(collIntervalStr, String
- .valueOf(measurementDefinitionIds.length)), MSG.dataSource_schedules_updateSuccessful_full(
- collIntervalStr, String.valueOf(measurementDefinitionIds.length), String
- .valueOf(resourceGroupId), measurementDefinitionDisplayNames.toString()),
- Message.Severity.Info));
+ .valueOf(measurementDefinitionIds.length)), MSG
+ .dataSource_schedules_updateSuccessful_full_group(collIntervalStr, String
+ .valueOf(measurementDefinitionIds.length), String.valueOf(resourceGroupId),
+ measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
measurementScheduleListView.refresh();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesDataSource.java
index f60147a..c131931 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesDataSource.java
@@ -24,7 +24,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DataSourceField;
-import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -56,7 +55,7 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
List<DataSourceField> fields = super.addDataSourceFields();
DataSourceField resourceIdField = new DataSourceIntegerField(
- MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID, "Resource Id");
+ MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID, MSG.common_title_resource_id());
resourceIdField.setHidden(true);
fields.add(resourceIdField);
@@ -79,21 +78,25 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
@Override
protected void enableSchedules(final AbstractMeasurementScheduleListView measurementScheduleListView,
- int[] measurementDefinitionIds, final List<String> measurementDefinitionDisplayNames) {
+ final int[] measurementDefinitionIds, final List<String> measurementDefinitionDisplayNames) {
this.measurementService.enableSchedulesForResource(this.resourceId, measurementDefinitionIds,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError(
- "Failed to enable collection of metrics " + measurementDefinitionDisplayNames
- + " for Resource with id [" + resourceId + "].", throwable);
+ MSG.dataSource_schedules_enableFailure_resource(
+ String.valueOf(measurementDefinitionIds.length), String.valueOf(resourceId),
+ measurementDefinitionDisplayNames.toString()), throwable);
}
@Override
public void onSuccess(Void aVoid) {
CoreGUI.getMessageCenter().notify(
- new Message("Enabled collection of metrics " + measurementDefinitionDisplayNames
- + " for Resource with id [" + resourceId + "].", Message.Severity.Info));
+ new Message(MSG.dataSource_schedules_enableSuccessful_concise(String
+ .valueOf(measurementDefinitionIds.length)), MSG
+ .dataSource_schedules_enableSuccessful_full_resource(String
+ .valueOf(measurementDefinitionIds.length), String.valueOf(resourceId),
+ measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
measurementScheduleListView.refresh();
}
});
@@ -101,21 +104,25 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
@Override
protected void disableSchedules(final AbstractMeasurementScheduleListView measurementScheduleListView,
- int[] measurementDefinitionIds, final List<String> measurementDefinitionDisplayNames) {
+ final int[] measurementDefinitionIds, final List<String> measurementDefinitionDisplayNames) {
this.measurementService.disableSchedulesForResource(this.resourceId, measurementDefinitionIds,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError(
- "Failed to disable collection of metrics " + measurementDefinitionDisplayNames
- + " for Resource with id [" + resourceId + "].", throwable);
+ MSG.dataSource_schedules_disableFailure_resource(String
+ .valueOf(measurementDefinitionIds.length), String.valueOf(resourceId),
+ measurementDefinitionDisplayNames.toString()), throwable);
}
@Override
public void onSuccess(Void aVoid) {
CoreGUI.getMessageCenter().notify(
- new Message("Disabled collection of metrics " + measurementDefinitionDisplayNames
- + " for Resource with id [" + resourceId + "].", Message.Severity.Info));
+ new Message(MSG.dataSource_schedules_disableSuccessful_concise(String
+ .valueOf(measurementDefinitionIds.length)), MSG
+ .dataSource_schedules_disableSuccessful_full_resource(String
+ .valueOf(measurementDefinitionIds.length), String.valueOf(resourceId),
+ measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
measurementScheduleListView.refresh();
}
});
@@ -123,24 +130,28 @@ public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDat
@Override
protected void updateSchedules(final AbstractMeasurementScheduleListView measurementScheduleListView,
- int[] measurementDefinitionIds, final List<String> measurementDefinitionDisplayNames,
+ final int[] measurementDefinitionIds, final List<String> measurementDefinitionDisplayNames,
final long collectionInterval) {
this.measurementService.updateSchedulesForResource(this.resourceId, measurementDefinitionIds,
collectionInterval, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError(
- "Failed to set collection interval to " + (collectionInterval / 1000) + " seconds for metrics "
- + measurementDefinitionDisplayNames + " for Resource with id [" + resourceId + "].",
+ MSG.dataSource_schedules_updateFailure_resource(
+ String.valueOf(measurementDefinitionIds.length), String.valueOf(resourceId),
+ measurementDefinitionDisplayNames.toString(), String.valueOf(collectionInterval / 1000)),
throwable);
}
@Override
public void onSuccess(Void aVoid) {
+ String collIntervalStr = String.valueOf(collectionInterval / 1000);
CoreGUI.getMessageCenter().notify(
- new Message("Collection interval for metrics " + measurementDefinitionDisplayNames
- + " for Resource with id [" + resourceId + "] set to " + (collectionInterval / 1000)
- + " seconds.", Message.Severity.Info));
+ new Message(MSG.dataSource_schedules_updateSuccessful_concise(collIntervalStr, String
+ .valueOf(measurementDefinitionIds.length)), MSG
+ .dataSource_schedules_updateSuccessful_full_resource(collIntervalStr, String
+ .valueOf(measurementDefinitionIds.length), String.valueOf(resourceId),
+ measurementDefinitionDisplayNames.toString()), Message.Severity.Info));
measurementScheduleListView.refresh();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
index 782b227..813ac07 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
@@ -30,7 +30,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasuremen
*/
public class SchedulesView extends AbstractMeasurementScheduleListView {
- private static final String TITLE = "Metric Collection Schedules";
+ private static final String TITLE = MSG.view_resource_monitor_schedules_title();
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID };
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index a0c5291..367577e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -108,6 +108,7 @@ common_title_recent_operations=Recent Operations~
common_title_remove_column=Remove Column~
common_title_resource = Resource~
common_title_resource_inventory=Resource Inventory~
+common_title_resource_id=Resource ID~
common_title_resource_name=Resource Name~
common_title_scheduled_operations=Scheduled Operations~
common_title_selected_resources=Selected Resources~
@@ -310,15 +311,28 @@ dataSource_measurementOob_error_fetchFailure = Failed to load measurement OOB in
dataSource_definitions_loadFailed=Failed to load metric definitions~
dataSource_schedules_loadFailed=Failed to load metric schedules~
dataSource_schedules_field_resourceGroupId=Group ID~
-dataSource_schedules_enableFailure=Failed to enable the collection of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]~
+
+dataSource_schedules_enableFailure_resource=Failed to enable the collection of [{0}] metrics for resource with ID [{1}]. The metrics were: [{2}]~
+dataSource_schedules_enableFailure_group=Failed to enable the collection of [{0}] metrics for group with ID [{1}]. The metrics were: [{2}]~
+
dataSource_schedules_enableSuccessful_concise=You have enabled the collection of [{0}] measurements~
-dataSource_schedules_enableSuccessful_full=You have enabled the collection of [{0}] measurements for the resource group with ID [{1}]. The enabled measurements are: [{2}]~
-dataSource_schedules_disableFailure=Failed to disable the collection of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]~
+dataSource_schedules_enableSuccessful_full_resource=You have enabled the collection of [{0}] measurements for the resource with ID [{1}]. The enabled measurements are: [{2}]~
+dataSource_schedules_enableSuccessful_full_group=You have enabled the collection of [{0}] measurements for the resource group with ID [{1}]. The enabled measurements are: [{2}]~
+
+dataSource_schedules_disableFailure_resource=Failed to disable the collection of [{0}] metrics for resource with ID [{1}]. The metrics were: [{2}]~
+dataSource_schedules_disableFailure_group=Failed to disable the collection of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]~
+
dataSource_schedules_disableSuccessful_concise=You have disabled the collection of [{0}] measurements~
-dataSource_schedules_disableSuccessful_full=You have disabled the collection of [{0}] measurements for the resource group with ID [{1}]. The disabled measurements are: [{2}]~
-dataSource_schedules_updateFailure=Failed to set the collection interval of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]. The collection interval was to be [{3}] seconds.~
+dataSource_schedules_disableSuccessful_full_resource=You have disabled the collection of [{0}] measurements for the resource with ID [{1}]. The disabled measurements are: [{2}]~
+dataSource_schedules_disableSuccessful_full_group=You have disabled the collection of [{0}] measurements for the resource group with ID [{1}]. The disabled measurements are: [{2}]~
+
+dataSource_schedules_updateFailure_resource=Failed to set the collection interval of [{0}] metrics for resource with ID [{1}]. The metrics were: [{2}]. The collection interval was to be [{3}] seconds.~
+dataSource_schedules_updateFailure_group=Failed to set the collection interval of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]. The collection interval was to be [{3}] seconds.~
+
dataSource_schedules_updateSuccessful_concise=A new collection interval of [{0}] seconds has been set on [{1}] measurements~
-dataSource_schedules_updateSuccessful_full=A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource group with ID [{2}]. The updated measurements are: [{3}]~
+dataSource_schedules_updateSuccessful_full_resource=A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource with ID [{2}]. The updated measurements are: [{3}]~
+dataSource_schedules_updateSuccessful_full_group=A new collection interval of [{0}] seconds has been set on [{1}] measurements for resource group with ID [{2}]. The updated measurements are: [{3}]~
+
# Problem Resources
#------------------------------
@@ -647,6 +661,7 @@ view_resource_monitor_calltime_total=Total~
view_resource_monitor_calltime_loadFailed=Could not load call time data~
view_resource_monitor_calltime_lookupFailed=Could not load resource for call time~
view_resource_monitor_calltime_editFailed=Call time data can not be edited~
+view_resource_monitor_schedules_title=Resource Metric Collection Schedules~
view_tree_common_loadFailed_generic=Failed to load data for tree~
view_tree_common_loadFailed_root=Failed to load root for tree~
view_tree_common_loadFailed_descendants=Failed to load descendants for tree~
13 years, 7 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java | 22 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java | 21 +++++----
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 10 ++++
3 files changed, 34 insertions(+), 19 deletions(-)
New commits:
commit 32b4a6278837805caa9e38670d3af34fd8d143cc
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 17 18:09:13 2010 -0500
i18n for org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.calltime
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java
index 1b36cb0..85bf0f0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeDataSource.java
@@ -53,17 +53,21 @@ public class CallTimeDataSource extends RPCDataSource<CallTimeDataComposite> {
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceTextField callDestination = new DataSourceTextField("callDestination", "Call Destination");
+ DataSourceTextField callDestination = new DataSourceTextField("callDestination", MSG
+ .view_resource_monitor_calltime_destination());
fields.add(callDestination);
- DataSourceIntegerField count = new DataSourceIntegerField("count");
+ DataSourceIntegerField count = new DataSourceIntegerField("count", MSG.view_resource_monitor_calltime_count());
fields.add(count);
- DataSourceIntegerField minimum = new DataSourceIntegerField("minimum");
+ DataSourceIntegerField minimum = new DataSourceIntegerField("minimum", MSG
+ .view_resource_monitor_calltime_minimum());
fields.add(minimum);
- DataSourceIntegerField average = new DataSourceIntegerField("average");
+ DataSourceIntegerField average = new DataSourceIntegerField("average", MSG
+ .view_resource_monitor_calltime_average());
fields.add(average);
- DataSourceIntegerField maximum = new DataSourceIntegerField("maximum");
+ DataSourceIntegerField maximum = new DataSourceIntegerField("maximum", MSG
+ .view_resource_monitor_calltime_maximum());
fields.add(maximum);
- DataSourceIntegerField total = new DataSourceIntegerField("total");
+ DataSourceIntegerField total = new DataSourceIntegerField("total", MSG.view_resource_monitor_calltime_total());
fields.add(total);
return fields;
@@ -80,7 +84,7 @@ public class CallTimeDataSource extends RPCDataSource<CallTimeDataComposite> {
GWTServiceLookup.getMeasurementDataService().findCallTimeDataForResource(scheduleId, eightHoursAgo, now, pc,
new AsyncCallback<PageList<CallTimeDataComposite>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Could not load call time data", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_calltime_loadFailed(), caught);
}
public void onSuccess(PageList<CallTimeDataComposite> result) {
@@ -95,7 +99,7 @@ public class CallTimeDataSource extends RPCDataSource<CallTimeDataComposite> {
@Override
public CallTimeDataComposite copyValues(Record from) {
- throw new UnsupportedOperationException("Calltime not editable");
+ throw new UnsupportedOperationException(MSG.view_resource_monitor_calltime_editFailed());
}
public void setGraphs(Record[] records) {
@@ -111,7 +115,7 @@ public class CallTimeDataSource extends RPCDataSource<CallTimeDataComposite> {
int maxWidth = (int) ((record.getAttributeAsInt("maximum") / maxMaximum) * 100d);
if (record instanceof ListGridRecord) {
- ListGridRecord listGridRecord = (ListGridRecord)record;
+ ListGridRecord listGridRecord = (ListGridRecord) record;
listGridRecord.setBackgroundComponent(new HTMLFlow("<div style=\"width: " + minWidth
+ "%; height: 33%; background-color: #A5B391;\"> </div>" + "<div style=\"width: " + avgWidth
+ "%; height: 33%; background-color: #A5B391;\"> </div>" + "<div style=\"width: " + maxWidth
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
index a8ad454..b13d5ee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
@@ -73,8 +73,8 @@ public class CallTimeView extends LocatableLayout {
GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load resource for call time",
- caught);
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_resource_monitor_calltime_lookupFailed(), caught);
}
public void onSuccess(PageList<Resource> result) {
@@ -112,25 +112,26 @@ public class CallTimeView extends LocatableLayout {
public void setup() {
- Table table = new Table(extendLocatorId("Table"), "Call Time Data", new Criteria("scheduleId", String
- .valueOf(scheduleId)));
+ Table table = new Table(extendLocatorId("Table"), MSG.view_resource_monitor_calltime_title(), new Criteria(
+ "scheduleId", String.valueOf(scheduleId)));
table.getListGrid().setAlternateRecordStyles(false);
table.setDataSource(new CallTimeDataSource());
table.getListGrid().setUseAllDataSourceFields(true);
final NumberFormat format = NumberFormat.getFormat("0");
- ListGridField callDestination = new ListGridField("callDestination", "Call Destination");
- ListGridField count = new ListGridField("count", 70);
- ListGridField minimum = new ListGridField("minimum", 70);
- ListGridField average = new ListGridField("average", 70);
+ ListGridField callDestination = new ListGridField("callDestination", MSG
+ .view_resource_monitor_calltime_destination());
+ ListGridField count = new ListGridField("count", MSG.view_resource_monitor_calltime_count(), 70);
+ ListGridField minimum = new ListGridField("minimum", MSG.view_resource_monitor_calltime_minimum(), 70);
+ ListGridField average = new ListGridField("average", MSG.view_resource_monitor_calltime_average(), 70);
average.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
return format.format(((Number) o).doubleValue());
}
});
- ListGridField maximum = new ListGridField("maximum", 70);
- ListGridField total = new ListGridField("total", 70);
+ ListGridField maximum = new ListGridField("maximum", MSG.view_resource_monitor_calltime_maximum(), 70);
+ ListGridField total = new ListGridField("total", MSG.view_resource_monitor_calltime_total(), 70);
table.getListGrid().setFields(callDestination, count, minimum, average, maximum, total);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index a1bba52..a0c5291 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -637,6 +637,16 @@ view_resource_monitor_graphs_lookupFailed=Failed to find resource for graph~
view_resource_monitor_graph_instructions=Point your mouse to a data point on the chart~
view_resource_monitor_graph_live_tooltip=Click for a live graph of current values~
view_resource_monitor_detailed_graph_label=Detailed Graph~
+view_resource_monitor_calltime_title=Call Time Data~
+view_resource_monitor_calltime_destination=Call Destination~
+view_resource_monitor_calltime_count=Count~
+view_resource_monitor_calltime_minimum=Minimum~
+view_resource_monitor_calltime_average=Average~
+view_resource_monitor_calltime_maximum=Maximum~
+view_resource_monitor_calltime_total=Total~
+view_resource_monitor_calltime_loadFailed=Could not load call time data~
+view_resource_monitor_calltime_lookupFailed=Could not load resource for call time~
+view_resource_monitor_calltime_editFailed=Call time data can not be edited~
view_tree_common_loadFailed_generic=Failed to load data for tree~
view_tree_common_loadFailed_root=Failed to load root for tree~
view_tree_common_loadFailed_descendants=Failed to load descendants for tree~
13 years, 7 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java | 83 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java | 9 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java | 18 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 17 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 28 +++
6 files changed, 91 insertions(+), 71 deletions(-)
New commits:
commit 845b952460943a34ca1663f08d8e7dec6961b8b8
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Nov 17 17:56:32 2010 -0500
i18n for org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
index 0efea7e..835f8e5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java
@@ -19,14 +19,12 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.MouseOutEvent;
import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.events.MouseOverEvent;
import com.smartgwt.client.widgets.events.MouseOverHandler;
import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.AvailabilityType;
@@ -37,6 +35,7 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
@@ -44,10 +43,10 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
*/
public class AvailabilityBarView extends HLayout {
+ Messages MSG = CoreGUI.getMessages();
private Resource resource;
-
public AvailabilityBarView(Resource resource) {
this.resource = resource;
setHeight(28);
@@ -55,56 +54,48 @@ public class AvailabilityBarView extends HLayout {
setMargin(10);
}
-
@Override
protected void onInit() {
super.onInit();
-
PageControl pc = PageControl.getUnlimitedInstance();
pc.initDefaultOrderingField("av.startTime", PageOrdering.ASC);
- GWTServiceLookup.getAvailabilityService().findAvailabilityForResource(
- resource.getId(), pc,
- new AsyncCallback<PageList<Availability>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load availability history", caught);
- }
+ GWTServiceLookup.getAvailabilityService().findAvailabilityForResource(resource.getId(), pc,
+ new AsyncCallback<PageList<Availability>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
+ }
- public void onSuccess(PageList<Availability> result) {
- update(result);
- }
+ public void onSuccess(PageList<Availability> result) {
+ update(result);
}
- );
+ });
}
private void update(PageList<Availability> result) {
long start = result.get(0).getStartTime().getTime();
- long end = result.get(result.size() - 1).getEndTime() != null ? result.get(result.size() - 1).getEndTime().getTime() : System.currentTimeMillis();
+ long end = result.get(result.size() - 1).getEndTime() != null ? result.get(result.size() - 1).getEndTime()
+ .getTime() : System.currentTimeMillis();
long diff = end - start;
-
- Img leftCap = new Img("availBar/leftCap.png",8,28);
+ Img leftCap = new Img("availBar/leftCap.png", 8, 28);
addMember(leftCap);
for (Availability a : result) {
long endTime = a.getEndTime() != null ? a.getEndTime().getTime() : System.currentTimeMillis();
-
double width = (((double) (endTime - a.getStartTime().getTime()) / diff) * 100);
String widthString = width + "%";
if (width == 0) {
widthString = "2px";
}
-
String imagePath = a.getAvailabilityType() == AvailabilityType.UP ? "availBar/up.png" : "availBar/down.png";
-
-
final Img section = new Img(imagePath);
section.setHeight(28);
section.setOpacity(60);
@@ -121,51 +112,47 @@ public class AvailabilityBarView extends HLayout {
}
});
-
long duration = endTime - a.getStartTime().getTime();
- String durationString = MeasurementConverterClient.format((double)duration, MeasurementUnits.MILLISECONDS, true);
-
- section.setTooltip("<div style=\"white-space: nowrap;\"><b>Availability: </b>" + a.getAvailabilityType().name() +
- "<br/><b>Start: </b>" + a.getStartTime() +
- "<br/><b>End: </b>" + a.getEndTime() +
- "<br/><b>Duration: </b>" + durationString);
+ String durationString = MeasurementConverterClient.format((double) duration, MeasurementUnits.MILLISECONDS,
+ true);
+ section.setTooltip("<div style=\"white-space: nowrap;\"><b>" + MSG.common_title_availability() + ": </b>"
+ + a.getAvailabilityType().name() + "<br/><b>" + MSG.common_title_start() + ": </b>" + a.getStartTime()
+ + "<br/><b>" + MSG.common_title_end() + ": </b>" + a.getEndTime() + "<br/><b>"
+ + MSG.common_title_duration() + ": </b>" + durationString);
addMember(section);
}
- Img rightCap = new Img("availBar/rightCap.png",8,28);
+ Img rightCap = new Img("availBar/rightCap.png", 8, 28);
addMember(rightCap);
+ /* StringBuffer buf = new StringBuffer("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr height=\"28\">");
+ buf.append("<td width=\"8px\" class=\"availBarLeftCap\"> </td>");
- /* StringBuffer buf = new StringBuffer("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr height=\"28\">");
+ for (Availability a : result) {
- buf.append("<td width=\"8px\" class=\"availBarLeftCap\"> </td>");
+ long endTime = a.getEndTime() != null ? a.getEndTime().getTime() : System.currentTimeMillis();
- for (Availability a : result) {
-
- long endTime = a.getEndTime() != null ? a.getEndTime().getTime() : System.currentTimeMillis();
+ double width = (((double) (endTime - a.getStartTime().getTime()) / diff) * 100);
+ String widthString = width + "%";
+ if (width == 0) {
+ widthString = "2px";
+ }
-
- double width = (((double) (endTime - a.getStartTime().getTime()) / diff) * 100);
- String widthString = width + "%";
- if (width == 0) {
- widthString = "2px";
- }
-
- buf.append("<td width=\"" + widthString + "\" class=\"" + (a.getAvailabilityType() == AvailabilityType.UP ? "availBarUp" : "availBarDown") + "\"> </td>");
- }
- buf.append("<td width=\"8px\" class=\"availBarRightCap\"> </td>");
- buf.append("</tr></table>");
+ buf.append("<td width=\"" + widthString + "\" class=\"" + (a.getAvailabilityType() == AvailabilityType.UP ? "availBarUp" : "availBarDown") + "\"> </td>");
+ }
+ buf.append("<td width=\"8px\" class=\"availBarRightCap\"> </td>");
+ buf.append("</tr></table>");
- HTMLFlow bar = new HTMLFlow(buf.toString());
+ HTMLFlow bar = new HTMLFlow(buf.toString());
- addMember(bar);*/
+ addMember(bar);*/
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index a503a9e..becbd02 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -49,7 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class GraphListView extends LocatableVLayout implements ResourceSelectListener {
private Resource resource;
- private Label loadingLabel = new Label("Loading...");
+ private Label loadingLabel = new Label(MSG.common_msg_loading());
public GraphListView(String locatorId, Resource resource) {
super(locatorId);
@@ -107,13 +107,14 @@ public class GraphListView extends LocatableVLayout implements ResourceSelectLis
System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load data for graphs", caught);
- loadingLabel.setContents("failed to load graphs");
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_graphs_loadFailed(),
+ caught);
+ loadingLabel.setContents(MSG.view_resource_monitor_graphs_loadFailed());
}
public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> result) {
if (result.isEmpty()) {
- loadingLabel.setContents("No graphs available");
+ loadingLabel.setContents(MSG.view_resource_monitor_graphs_noneAvailable());
} else {
loadingLabel.hide();
int i = 0;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
index 2855a22..6d6f5bc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java
@@ -69,7 +69,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
*/
public class LiveGraphView extends LocatableVLayout {
- private static final String INSTRUCTIONS = "Point your mouse to a data point on the chart";
+ private static final String INSTRUCTIONS = MSG.view_resource_monitor_graph_instructions();
private final Label selectedPointLabel = new Label(INSTRUCTIONS);
private final Label positionLabel = new Label();
@@ -226,7 +226,8 @@ public class LiveGraphView extends LocatableVLayout {
dataService.findLiveData(resourceId, new int[] { definition.getId() },
new AsyncCallback<Set<MeasurementData>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load live data", caught);
+ CoreGUI.getErrorHandler()
+ .handleError(MSG.view_resource_monitor_graphs_loadFailed(), caught);
}
public void onSuccess(Set<MeasurementData> result) {
@@ -271,7 +272,7 @@ public class LiveGraphView extends LocatableVLayout {
public static void displayAsDialog(String locatorId, int resourceId, MeasurementDefinition def) {
final LiveGraphView graph = new LiveGraphView(locatorId, resourceId, def);
final Window graphPopup = new LocatableWindow(locatorId);
- graphPopup.setTitle("Detailed Graph");
+ graphPopup.setTitle(MSG.view_resource_monitor_detailed_graph_label());
graphPopup.setWidth(800);
graphPopup.setHeight(400);
graphPopup.setIsModal(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java
index 10c21fa..b255539 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java
@@ -57,26 +57,26 @@ public class ResourceScheduledMetricDatasource extends RPCDataSource<Measurement
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField id = new DataSourceIntegerField("id");
+ DataSourceIntegerField id = new DataSourceIntegerField("id", MSG.common_title_id());
id.setPrimaryKey(true);
fields.add(id);
- DataSourceTextField name = new DataSourceTextField("name");
+ DataSourceTextField name = new DataSourceTextField("name", MSG.common_title_name());
fields.add(name);
- DataSourceTextField displayName = new DataSourceTextField("displayName");
+ DataSourceTextField displayName = new DataSourceTextField("displayName", MSG.common_title_display_name());
fields.add(displayName);
- DataSourceTextField description = new DataSourceTextField("description");
+ DataSourceTextField description = new DataSourceTextField("description", MSG.common_title_description());
fields.add(description);
- DataSourceTextField units = new DataSourceTextField("units");
+ DataSourceTextField units = new DataSourceTextField("units", MSG.common_title_units());
fields.add(units);
- DataSourceTextField numericType = new DataSourceTextField("numericType");
+ DataSourceTextField numericType = new DataSourceTextField("numericType", MSG.common_title_numeric_type());
fields.add(numericType);
- DataSourceTextField category = new DataSourceTextField("category");
+ DataSourceTextField category = new DataSourceTextField("category", MSG.common_title_category());
fields.add(category);
return fields;
@@ -92,7 +92,7 @@ public class ResourceScheduledMetricDatasource extends RPCDataSource<Measurement
GWTServiceLookup.getMeasurementDataService().findMeasurementDefinitionsByCriteria(criteria,
new AsyncCallback<PageList<MeasurementDefinition>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load metric definitions", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.dataSource_definitions_loadFailed(), caught);
}
public void onSuccess(PageList<MeasurementDefinition> result) {
@@ -110,7 +110,7 @@ public class ResourceScheduledMetricDatasource extends RPCDataSource<Measurement
GWTServiceLookup.getMeasurementDataService().findMeasurementSchedulesByCriteria(criteria,
new AsyncCallback<PageList<MeasurementSchedule>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load metric schedules", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.dataSource_schedules_loadFailed(), caught);
}
public void onSuccess(PageList<MeasurementSchedule> result) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index ef3b3a8..da91f8c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -72,10 +72,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWidgetCanvas
*/
public class SmallGraphView extends LocatableVLayout {
- private static final String INSTRUCTIONS = "Point your mouse to a data point on the chart";
+ private static final String INSTRUCTIONS = MSG.view_resource_monitor_graph_instructions();
- private static final String[] MONTH_NAMES = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct",
- "nov", "dec" };
+ private static final String[] MONTH_NAMES = { MSG.common_calendar_january_short(),
+ MSG.common_calendar_february_short(), MSG.common_calendar_march_short(), MSG.common_calendar_april_short(),
+ MSG.common_calendar_may_short(), MSG.common_calendar_june_short(), MSG.common_calendar_july_short(),
+ MSG.common_calendar_august_short(), MSG.common_calendar_september_short(), MSG.common_calendar_october_short(),
+ MSG.common_calendar_november_short(), MSG.common_calendar_december_short() };
private final Label selectedPointLabel = new Label(INSTRUCTIONS);
private final Label positionLabel = new Label();
@@ -149,7 +152,7 @@ public class SmallGraphView extends LocatableVLayout {
resourceCriteria.addFilterId(resourceId);
resourceService.findResourcesByCriteria(resourceCriteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to find resource for graph", caught);
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_graphs_lookupFailed(), caught);
}
public void onSuccess(PageList<Resource> result) {
@@ -170,7 +173,7 @@ public class SmallGraphView extends LocatableVLayout {
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
- "Failed to load data for graph", caught);
+ MSG.view_resource_monitor_graphs_loadFailed(), caught);
}
public void onSuccess(
@@ -228,7 +231,7 @@ public class SmallGraphView extends LocatableVLayout {
titleLayout.addMember(title);
Img liveGraph = new LocatableImg(getLocatorId(), "subsystems/monitor/Monitor_16.png", 16, 16);
- liveGraph.setTooltip("Click for a live graph of current values");
+ liveGraph.setTooltip(MSG.view_resource_monitor_graph_live_tooltip());
liveGraph.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -371,7 +374,7 @@ public class SmallGraphView extends LocatableVLayout {
private void displayAsDialog(String locatorId) {
SmallGraphView graph = new SmallGraphView(locatorId, resourceId, definition, data);
Window graphPopup = new Window();
- graphPopup.setTitle("Detailed Graph");
+ graphPopup.setTitle(MSG.view_resource_monitor_detailed_graph_label());
graphPopup.setWidth(800);
graphPopup.setHeight(400);
graphPopup.setIsModal(true);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index b211a94..a1bba52 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -75,6 +75,8 @@ common_title_dateCreated=Date Created~
common_title_default=Default~
common_title_description=Description~
common_title_display=Display~
+common_title_display_name=Display Name~
+common_title_duration=Duration~
common_title_edit_mode=Edit Mode~
common_title_enabled=Enabled?~
common_title_end = End~
@@ -94,6 +96,7 @@ common_title_mixedGroups = Mixed Groups~
common_title_mixedGroups_total=Mixed Group Total~
common_title_name = Name~
common_title_new_dashboard=New Dashboard~
+common_title_numeric_type=Numeric Type~
common_title_operations=Operations~
common_title_operations_range=Operation Range~
common_title_over=Over~
@@ -120,6 +123,7 @@ common_title_summary_counts=Summary Counts~
common_title_timestamp =Date/Time~
common_title_total=Total~
common_title_type = Type~
+common_title_units = Units~
common_title_user=User~
common_title_value = Value~
common_title_version = Version~
@@ -142,6 +146,21 @@ common_val_yes_lower = yes~
common_val_never=Never~
common_val_na=N/A~
+# Common Calendar
+#--------------
+common_calendar_january_short=jan
+common_calendar_february_short=feb
+common_calendar_march_short=mar
+common_calendar_april_short=apr
+common_calendar_may_short=may
+common_calendar_june_short=jun
+common_calendar_july_short=jul
+common_calendar_august_short=aug
+common_calendar_september_short=sept
+common_calendar_october_short=oct
+common_calendar_november_short=nov
+common_calendar_december_short=dec
+
#=================== Widgets =====================
@@ -288,6 +307,8 @@ dataSource_measurementOob_error_fetchFailure = Failed to load measurement OOB in
# Measurements
#----------------------
+dataSource_definitions_loadFailed=Failed to load metric definitions~
+dataSource_schedules_loadFailed=Failed to load metric schedules~
dataSource_schedules_field_resourceGroupId=Group ID~
dataSource_schedules_enableFailure=Failed to enable the collection of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]~
dataSource_schedules_enableSuccessful_concise=You have enabled the collection of [{0}] measurements~
@@ -609,6 +630,13 @@ view_inventory_resources_loadFailed=Failed to load resource composite data~
view_inventory_resources_title=Member Resources~
view_inventory_resources_title_children=Child Resources~
view_inventory_resources_title_members=Member Resources~
+view_resource_monitor_availability_loadFailed=Failed to load availability history~
+view_resource_monitor_graphs_noneAvailable=No graphs available~
+view_resource_monitor_graphs_loadFailed=Failed to load graph data~
+view_resource_monitor_graphs_lookupFailed=Failed to find resource for graph~
+view_resource_monitor_graph_instructions=Point your mouse to a data point on the chart~
+view_resource_monitor_graph_live_tooltip=Click for a live graph of current values~
+view_resource_monitor_detailed_graph_label=Detailed Graph~
view_tree_common_loadFailed_generic=Failed to load data for tree~
view_tree_common_loadFailed_root=Failed to load root for tree~
view_tree_common_loadFailed_descendants=Failed to load descendants for tree~
13 years, 7 months