modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml | 2 modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 7 + modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/DiscoveredResourceDetails.java | 46 ++++++---- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 5 - 4 files changed, 39 insertions(+), 21 deletions(-)
New commits: commit 08f582bad0e9cbf41aa41f92c1358849c0c6f8f7 Author: Ian Springer ian.springer@redhat.com Date: Thu Sep 16 18:27:40 2010 -0400
increase max length of Resource.version from 50 to 100 chars and make PC more forgiving if a discovery component returns a Resource details with a name, version, or description longer than the max length (fix for https://bugzilla.redhat.com/show_bug.cgi?id=634306)
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml index 3233d47..bf83991 100644 --- a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml +++ b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml @@ -89,7 +89,7 @@ <column name="INVENTORY_STATUS" type="VARCHAR2" size="20"/> <column name="CONNECTED" type="BOOLEAN"/> <column name="DESCRIPTION" type="VARCHAR2" size="1000"/> - <column name="VERSION" type="VARCHAR2" size="50"/> + <column name="VERSION" type="VARCHAR2" size="100"/> <column name="CTIME" type="LONG"/> <column name="MTIME" type="LONG"/> <column name="ITIME" type="LONG"/> diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml index f32e5e3..ddb1974 100644 --- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml +++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml @@ -32,7 +32,7 @@
<schemaSpec version="2.1"> <!-- Keep the columnType VARCHAR2, but increase size; - (see note for RHQ_ALERT_CONDITION table in alert-schema.xml for more ifo) --> + (see note for RHQ_ALERT_CONDITION table in alert-schema.xml for more info) --> <schema-alterColumn table="RHQ_ALERT_CONDITION" column="OPTION_STATUS" columnType="VARCHAR2" precision="256" /> </schemaSpec>
@@ -3210,6 +3210,11 @@ </schema-directSQL> </schemaSpec>
+ <schemaSpec version="2.95"> + <!-- Increase the max length of a Resource's version from 50 to 100. --> + <schema-alterColumn table="RHQ_RESOURCE" column="VERSION" columnType="VARCHAR2" precision="100" /> + </schemaSpec> + </dbupgrade> </target> </project> diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/DiscoveredResourceDetails.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/DiscoveredResourceDetails.java index c175dc3..4181721 100644 --- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/DiscoveredResourceDetails.java +++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/DiscoveredResourceDetails.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. + * Copyright (C) 2005-2010 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -22,6 +22,8 @@ */ package org.rhq.core.pluginapi.inventory;
+import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; import org.rhq.core.domain.configuration.definition.ConfigurationTemplate; @@ -42,9 +44,11 @@ import org.rhq.core.system.ProcessInfo; * @author John Mazzitelli */ public class DiscoveredResourceDetails { + private final Log log = LogFactory.getLog(this.getClass()); + private static final int RESOURCE_KEY_MAX_LENGTH = 500; private static final int RESOURCE_NAME_MAX_LENGTH = 500; - private static final int RESOURCE_VERSION_MAX_LENGTH = 50; + private static final int RESOURCE_VERSION_MAX_LENGTH = 100; private static final int RESOURCE_DESCRIPTION_MAX_LENGTH = 1000;
private ResourceType resourceType; @@ -134,8 +138,9 @@ public class DiscoveredResourceDetails { }
if (resourceKey.length() > RESOURCE_KEY_MAX_LENGTH) { - throw new IllegalArgumentException("Resource key is longer than maximum length (" + RESOURCE_KEY_MAX_LENGTH - + ") [" + resourceKey + "]"); + throw new IllegalArgumentException("Plugin error: Resource key [" + resourceKey + "] specified by [" + + this.resourceType + "] discovery component is longer than the maximum length (" + + RESOURCE_KEY_MAX_LENGTH + ")."); }
this.resourceKey = resourceKey; @@ -166,11 +171,13 @@ public class DiscoveredResourceDetails { }
if (resourceName.length() > RESOURCE_NAME_MAX_LENGTH) { - throw new IllegalArgumentException("Resource name is longer than maximum length (" - + RESOURCE_NAME_MAX_LENGTH + ") [" + resourceName + "]"); + log.warn("Plugin error: Resource name [" + resourceName + "] specified by [" + this.resourceType + + "] discovery component is longer than the maximum length (" + RESOURCE_NAME_MAX_LENGTH + + " - truncating it to " + RESOURCE_NAME_MAX_LENGTH + " characters..."); + this.resourceName = resourceName.substring(0, RESOURCE_NAME_MAX_LENGTH); + } else { + this.resourceName = resourceName; } - - this.resourceName = resourceName; }
/** @@ -198,11 +205,13 @@ public class DiscoveredResourceDetails { }
if (resourceVersion.length() > RESOURCE_VERSION_MAX_LENGTH) { - throw new IllegalArgumentException("Resource version is longer than maximum length (" - + RESOURCE_VERSION_MAX_LENGTH + ") [" + resourceVersion + "]"); + log.warn("Plugin error: Resource version [" + resourceVersion + "] specified by [" + this.resourceType + + "] discovery component is longer than the maximum length (" + RESOURCE_VERSION_MAX_LENGTH + + " - truncating it to " + RESOURCE_VERSION_MAX_LENGTH + " characters..."); + this.resourceVersion = resourceVersion.substring(0, RESOURCE_VERSION_MAX_LENGTH); + } else { + this.resourceVersion = resourceVersion; } - - this.resourceVersion = resourceVersion; }
/** @@ -228,11 +237,13 @@ public class DiscoveredResourceDetails { }
if (resourceDescription.length() > RESOURCE_DESCRIPTION_MAX_LENGTH) { - throw new IllegalArgumentException("Resource description is longer than maximum length (" - + RESOURCE_DESCRIPTION_MAX_LENGTH + ") [" + resourceDescription + "]"); + log.warn("Plugin error: Resource description [" + resourceDescription + "] specified by [" + this.resourceType + + "] discovery component is longer than the maximum length (" + RESOURCE_DESCRIPTION_MAX_LENGTH + + " - truncating it to " + RESOURCE_DESCRIPTION_MAX_LENGTH + " characters..."); + this.resourceDescription = resourceDescription.substring(0, RESOURCE_DESCRIPTION_MAX_LENGTH); + } else { + this.resourceDescription = resourceDescription; } - - this.resourceDescription = resourceDescription; }
/** @@ -339,6 +350,7 @@ public class DiscoveredResourceDetails { } }
- return new Configuration(); // there is no default plugin config available, return an empty one + // There is no default plugin config template defined - return an empty one. + return new Configuration(); } } \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java index 6e62db3..1a5e44a 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java @@ -1,7 +1,8 @@ /* * RHQ Management Platform - * Copyright (C) 2010 Red Hat, Inc. - * All rights reserved. + * Copyright 2010, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. * * 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
rhq-commits@lists.fedorahosted.org