modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n/PropertiesGenerator.java
| 18
modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/TimeUtil.java
| 1
modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/units/DurationFormatter.java
| 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
| 4
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/SnapshotGenerator.java
| 7
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
| 5
modules/core/plugin-container/src/main/java/org/rhq/core/pc/operation/OperationServicesAdapter.java
| 2
modules/core/plugin-test-util/src/main/java/org/rhq/core/plugin/testutil/AbstractAgentPluginTest.java
| 4
modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
| 547 ---------
modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
| 552 ++++++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/error/GenericErrorUIBean.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/Portal.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/PortalAction.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsDisplayAction.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsFilterForm.java
| 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartFormPrepareAction.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/beans/OptionItem.java
| 3
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/RemovePrefixTag.java
| 3
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/sql.jsp
| 2
modules/enterprise/gui/portal-war/src/main/webapp/common/Error.jsp
| 2
modules/enterprise/gui/portal-war/src/main/webapp/common/GenericError.jsp
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementPreferences.java
| 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
| 108 +
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SystemSettingsImporterTest.java
| 2
modules/plugins/jboss-as-7/d2d.sh
| 2
modules/plugins/jboss-as-7/pom.xml
| 109 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
| 118 --
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
| 11
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
| 26
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
| 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
| 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
| 4
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
| 6
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
| 8
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
| 3
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
| 4
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
| 2
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 362 +++---
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
| 4
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
| 2
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
| 8
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainSocketBindingTest.java
| 10
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
| 4
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
| 12
modules/plugins/platform/src/main/java/org/rhq/plugins/platform/LinuxPlatformComponent.java
| 51
49 files changed, 1109 insertions(+), 928 deletions(-)
New commits:
commit 049a3a753196661c097d03bdb207687ef9835527
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 30 14:57:58 2012 -0400
put the test methods in another, unique, group - trying to get testng to work the way
we want
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
index 34c247e..b4fdf46 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBeanTest.java
@@ -52,7 +52,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class ResourceMetadataManagerBeanTest extends MetadataBeanTest {
- @Test(groups = { "plugin.metadata", "NewPlugin" })
+ @Test(groups = { "plugin.resource.metadata.test",
"plugin.metadata", "NewPlugin" })
public void testRemovalOfObsoleteBundleAndDriftConfig() throws Exception {
// create the initial type that has bundle and drift definitions
createPlugin("test-plugin.jar", "1.0",
"remove_bundle_drift_config_v1.xml");
@@ -107,7 +107,7 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
}
}
- @Test(groups = { "plugin.metadata", "NewPlugin" })
+ @Test(groups = { "plugin.resource.metadata.test",
"plugin.metadata", "NewPlugin" })
public void registerPluginWithDuplicateDriftDefinitions() {
try {
createPlugin("test-plugin.jar", "1.0",
"dup_drift.xml");
@@ -117,19 +117,20 @@ public class ResourceMetadataManagerBeanTest extends
MetadataBeanTest {
}
}
- @Test(dependsOnMethods = { "registerPluginWithDuplicateDriftDefinitions" },
groups = { "plugin.metadata",
- "NewPlugin" })
+ @Test(dependsOnMethods = { "registerPluginWithDuplicateDriftDefinitions" },
groups = {
+ "plugin.resource.metadata.test", "plugin.metadata",
"NewPlugin" })
public void registerPlugin() throws Exception {
createPlugin("test-plugin.jar", "1.0",
"plugin_v1.xml");
}
- @Test(dependsOnMethods = { "registerPlugin" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "registerPlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistNewTypes() {
List<String> newTypes = asList("ServerA", "ServerB");
assertTypesPersisted("Failed to persist new types", newTypes,
"TestPlugin");
}
- // @Test(dependsOnMethods = {"persistNewTypes"}, groups =
{"plugin.metadata", "NewPlugin"})
+ // @Test(dependsOnMethods = {"persistNewTypes"}, groups =
{"plugin.resource.metadata.test", "plugin.metadata",
"NewPlugin"})
// public void persistSubcategories() throws Exception {
// assertResourceTypeAssociationEquals(
// "ServerA",
@@ -139,29 +140,34 @@ public class ResourceMetadataManagerBeanTest extends
MetadataBeanTest {
// );
// }
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistMeasurementDefinitions() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"metricDefinitions",
asList("metric1", "metric2",
"rhq.availability"));
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistEventDefinitions() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"eventDefinitions",
asList("logAEntry", "logBEntry"));
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistOperationDefinitions() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"operationDefinitions", asList("start", "stop"));
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistProcessScans() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"processScans", asList("serverA"));
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistDriftDefinitionTemplates() throws Exception {
ResourceType type = assertResourceTypeAssociationEquals("ServerA",
"TestPlugin", "driftDefinitionTemplates",
asList("drift-pc", "drift-fs"));
@@ -200,7 +206,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
}
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistBundleTargetConfigurations() throws Exception {
String resourceTypeName = "ServerA";
String plugin = "TestPlugin";
@@ -235,55 +242,64 @@ public class ResourceMetadataManagerBeanTest extends
MetadataBeanTest {
}
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistChildTypes() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"childResourceTypes", asList("Child1", "Child2"));
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistPluginConfigurationDefinition() throws Exception {
assertAssociationExists("ServerA",
"pluginConfigurationDefinition");
}
- @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.metadata", "NewPlugin" })
+ @Test(dependsOnMethods = { "persistNewTypes" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "NewPlugin" })
public void persistPackageTypes() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"packageTypes",
asList("ServerA.Content.1", "ServerA.Content.2"));
}
- @Test(groups = { "plugin.metadata", "UpgradePlugin" },
dependsOnGroups = { "NewPlugin" })
+ @Test(groups = { "plugin.resource.metadata.test",
"plugin.metadata", "UpgradePlugin" }, dependsOnGroups = {
"NewPlugin" })
public void upgradePlugin() throws Exception {
createPlugin("test-plugin.jar", "2.0",
"plugin_v2.xml");
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeOperationDefinitions() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"operationDefinitions",
asList("start", "shutdown", "restart"));
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeChildResources() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"childResourceTypes", asList("Child1", "Child3"));
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeParentTypeOfChild() throws Exception {
assertResourceTypeAssociationEquals("ServerB", "TestPlugin",
"childResourceTypes", asList("Child2"));
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeEventDefinitions() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"eventDefinitions",
asList("logAEntry", "logCEntry"));
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeProcessScans() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"processScans", asList("processA", "processB"));
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeDriftDefinitionTemplates() throws Exception {
ResourceType type = assertResourceTypeAssociationEquals("ServerA",
"TestPlugin", "driftDefinitionTemplates",
asList("drift-rc", "drift-mt"));
@@ -313,7 +329,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
}
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradeBundleTargetConfigurations() throws Exception {
String resourceTypeName = "ServerA";
String plugin = "TestPlugin";
@@ -348,7 +365,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
}
}
- @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.metadata", "UpgradePlugin" })
+ @Test(dependsOnMethods = { "upgradePlugin" }, groups = {
"plugin.resource.metadata.test", "plugin.metadata",
+ "UpgradePlugin" })
public void upgradePackageTypes() throws Exception {
assertResourceTypeAssociationEquals("ServerA", "TestPlugin",
"packageTypes",
asList("ServerA.Content.1", "ServerA.Content.3"));
@@ -367,7 +385,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
createPlugin("remove-types-plugin", "2.0",
"remove_types_v2.xml");
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteOperationDefsForRemovedType() throws Exception {
OperationManagerLocal operationMgr = LookupUtil.getOperationManager();
SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
@@ -382,7 +401,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("The operation definition should have been deleted", 0,
operationDefs.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteEventDefsForRemovedType() throws Exception {
List<?> results = getEntityManager()
.createQuery("from EventDefinition e where e.name = :ename and
e.resourceType.name = :rname")
@@ -391,7 +411,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("The event definition(s) should have been deleted", 0,
results.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteParent() throws Exception {
SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
ResourceTypeManagerLocal resourceTypeMgr = LookupUtil.getResourceTypeManager();
@@ -424,7 +445,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
return null;
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteTypeAndAllItsDescedantTypes() throws Exception {
List<?> typesNotRemoved = getEntityManager()
.createQuery("from ResourceType t where t.plugin = :plugin and t.name in
(:resourceTypes)")
@@ -435,7 +457,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("Failed to delete resource type or one or more of its
descendant types", 0, typesNotRemoved.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteProcessScans() {
List<?> processScans = getEntityManager()
.createQuery("from ProcessScan p where p.name = :name1 or p.name =
:name2").setParameter("name1", "scan1")
@@ -444,7 +467,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("The process scans should have been deleted", 0,
processScans.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteSubcategories() {
List<?> subcategories = getEntityManager()
.createQuery("from ResourceSubCategory r where r.name = :name1 or r.name
= :name2 or r.name = :name3")
@@ -453,7 +477,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("The subcategories should have been deleted", 0,
subcategories.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteResources() {
ResourceManagerLocal resourceMgr = LookupUtil.getResourceManager();
SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
@@ -478,7 +503,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
}
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteBundles() {
List<?> bundles = getEntityManager().createQuery("from Bundle b where
b.bundleType.name = :name")
.setParameter("name", "Test Bundle").getResultList();
@@ -486,7 +512,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("Failed to delete the bundles", 0, bundles.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteBundleTypes() {
List<?> bundleTypes = getEntityManager().createQuery("from BundleType
b where b.name = :name")
.setParameter("name", "Test Bundle").getResultList();
@@ -494,7 +521,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("The bundle type should have been deleted", 0,
bundleTypes.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deletePackages() {
List<?> packages = getEntityManager().createQuery("from Package p
where p.name = :name")
.setParameter("name",
"ServerC::test-package").getResultList();
@@ -502,7 +530,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("All packages should have been deleted", 0,
packages.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deletePackageTypes() {
List<?> packageTypes = getEntityManager().createQuery("from
PackageType p where p.name = :name")
.setParameter("name",
"ServerC.Content").getResultList();
@@ -510,7 +539,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("All package types should have been deleted", 0,
packageTypes.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteResourceGroups() {
List<?> groups = getEntityManager()
.createQuery("from ResourceGroup g where g.name = :name and
g.resourceType.name = :typeName")
@@ -519,7 +549,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("All resource groups should have been deleted", 0,
groups.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteAlertTemplates() {
List<?> templates = getEntityManager()
.createQuery("from AlertDefinition a where a.name = :name and
a.resourceType.name = :typeName")
@@ -528,7 +559,8 @@ public class ResourceMetadataManagerBeanTest extends MetadataBeanTest
{
assertEquals("Alert templates should have been deleted.", 0,
templates.size());
}
- @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.metadata", "RemoveTypes" })
+ @Test(dependsOnMethods = { "upgradePluginWithTypesRemoved" }, groups = {
"plugin.resource.metadata.test",
+ "plugin.metadata", "RemoveTypes" })
public void deleteMeasurementDefinitions() {
List<?> measurementDefs = getEntityManager().createQuery("from
MeasurementDefinition m where m.name = :name")
.setParameter("name",
"ServerC::metric1").getResultList();
commit 26c36e86ccd7895199936cb56ed585a0b5b98fa2
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 30 14:57:09 2012 -0400
[BZ 759615] remove the last duplicate package across multiple jars
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/TimeUtil.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/TimeUtil.java
index cf31a5f..183f8d5 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/TimeUtil.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/TimeUtil.java
@@ -31,6 +31,7 @@ import org.rhq.core.clientapi.util.units.ScaleConstants;
import org.rhq.core.clientapi.util.units.UnitNumber;
import org.rhq.core.clientapi.util.units.UnitsConstants;
import org.rhq.core.clientapi.util.units.UnitsFormat;
+import org.rhq.core.util.StringUtil;
public class TimeUtil {
public static final String DATE_FORMAT = "MM-dd-yy-HH-mm-ss";
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/units/DurationFormatter.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/units/DurationFormatter.java
index 9e9e4de..98c90aa 100644
---
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/units/DurationFormatter.java
+++
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/util/units/DurationFormatter.java
@@ -27,7 +27,7 @@ import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
import org.rhq.core.clientapi.util.ArrayUtil;
-import org.rhq.core.clientapi.util.StringUtil;
+import org.rhq.core.util.StringUtil;
/**
* Format a value into a duration.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/operation/OperationServicesAdapter.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/operation/OperationServicesAdapter.java
index d8ce6d5..5828a04 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/operation/OperationServicesAdapter.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/operation/OperationServicesAdapter.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import org.rhq.core.clientapi.server.operation.OperationServerService;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.operation.OperationDefinition;
@@ -34,6 +33,7 @@ import org.rhq.core.pluginapi.operation.OperationContext;
import org.rhq.core.pluginapi.operation.OperationServices;
import org.rhq.core.pluginapi.operation.OperationServicesResult;
import org.rhq.core.pluginapi.operation.OperationServicesResultCode;
+import org.rhq.core.util.StringUtil;
import org.rhq.core.util.exception.ExceptionPackage;
/**
diff --git a/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
b/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
deleted file mode 100644
index ecfed35..0000000
--- a/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.clientapi.util;
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class StringUtil {
-
- private static final Log log = LogFactory.getLog(StringUtil.class);
-
- /**
- * @param source The source string to perform replacements on.
- * @param find The substring to find in source.
- * @param replace The string to replace 'find' within source
- *
- * @return The source string, with all occurrences of 'find' replaced with
'replace'
- */
- public static String replace(String source, String find, String replace) {
- if ((source == null) || (find == null) || (replace == null)) {
- return source;
- }
-
- int sourceLen = source.length();
- int findLen = find.length();
- if ((sourceLen == 0) || (findLen == 0)) {
- return source;
- }
-
- StringBuilder buffer = new StringBuilder();
-
- int idx;
- int fromIndex;
-
- for (fromIndex = 0; (idx = source.indexOf(find, fromIndex)) != -1; fromIndex =
idx + findLen) {
- buffer.append(source.substring(fromIndex, idx));
- buffer.append(replace);
- }
-
- if (fromIndex == 0) {
- return source;
- }
-
- buffer.append(source.substring(fromIndex));
-
- return buffer.toString();
- }
-
- /**
- * @param source The source string to perform replacements on.
- * @param find The substring to find in source.
- *
- * @return The source string, with all occurrences of 'find' removed
- */
- public static String remove(String source, String find) {
- if ((source == null) || (find == null)) {
- return source;
- }
-
- String retVal = null;
- int sourceLen = source.length();
- int findLen = find.length();
- StringBuilder remove = new StringBuilder(source);
-
- try {
- if ((sourceLen > 0) && (findLen > 0)) {
- int fromIndex;
- int idx;
-
- for (fromIndex = 0, idx = 0; (fromIndex = source.indexOf(find, idx)) !=
-1; idx = fromIndex + findLen) {
- remove.delete(fromIndex, findLen + fromIndex);
- }
-
- retVal = remove.toString();
- }
- } catch (Exception e) {
- log.error("This should not have happened.", e);
- retVal = null;
- }
-
- return retVal;
- }
-
- /**
- * Print out everything in an Iterator in a user-friendly string format.
- *
- * @param i An iterator to print out.
- * @param delim The delimiter to use between elements.
- *
- * @return The Iterator's elements in a user-friendly string format.
- */
- public static String iteratorToString(Iterator i, String delim) {
- return iteratorToString(i, delim, "");
- }
-
- /**
- * Print out everything in an Iterator in a user-friendly string format.
- *
- * @param i An iterator to print out.
- * @param delim The delimiter to use between elements.
- * @param quoteChar The character to quote each element with.
- *
- * @return The Iterator's elements in a user-friendly string format.
- */
- public static String iteratorToString(Iterator i, String delim, String quoteChar) {
- Object elt = null;
- StringBuilder rstr = new StringBuilder();
- String s;
-
- while (i.hasNext()) {
- if (rstr.length() > 0) {
- rstr.append(delim);
- }
-
- elt = i.next();
- if (elt == null) {
- rstr.append("NULL");
- } else {
- s = elt.toString();
- if (quoteChar != null) {
- rstr.append(quoteChar).append(s).append(quoteChar);
- } else {
- rstr.append(s);
- }
- }
- }
-
- return rstr.toString();
- }
-
- /**
- * Print out a List in a user-friendly string format.
- *
- * @param list A List to print out.
- * @param delim The delimiter to use between elements.
- *
- * @return The List in a user-friendly string format.
- */
- public static String listToString(List list, String delim) {
- if (list == null) {
- return "NULL";
- }
-
- Iterator i = list.iterator();
- return iteratorToString(i, delim, null);
- }
-
- public static String collectionToString(Collection collection, String delim) {
- if (collection == null) {
- return "NULL";
- }
-
- Iterator i = collection.iterator();
- return iteratorToString(i, delim, null);
- }
-
- /**
- * Print out a List in a user-friendly string format.
- *
- * @param list A List to print out.
- *
- * @return The List in a user-friendly string format.
- */
- public static String listToString(List list) {
- return listToString(list, ",");
- }
-
- public static String collectionToString(Collection collection) {
- return collectionToString(collection, ",");
- }
-
- /**
- * Print out an array as a String
- */
- public static String arrayToString(Object[] array) {
- return arrayToString(array, ',');
- }
-
- /**
- * Print out an array as a String
- */
- public static String arrayToString(boolean[] array) {
- if (array == null) {
- return "null";
- }
-
- String rstr = "";
- char delim = ',';
- for (int i = 0; i < array.length; i++) {
- if (i > 0) {
- rstr += delim;
- }
-
- rstr += array[i];
- }
-
- return rstr;
- }
-
- /**
- * Print out an array as a String
- *
- * @param array The array to print out
- * @param delim The delimiter to use between elements.
- */
- public static String arrayToString(Object[] array, char delim) {
- if (array == null) {
- return "null";
- }
-
- StringBuilder rstr = new StringBuilder();
- for (int i = 0; i < array.length; i++) {
- if (i > 0) {
- rstr.append(delim);
- }
-
- rstr.append(array[i]);
- }
-
- return rstr.toString();
- }
-
- /**
- * Print out an array as a String
- */
- public static String arrayToString(int[] array) {
- if (array == null) {
- return "null";
- }
-
- StringBuilder rstr = new StringBuilder();
- for (int i = 0; i < array.length; i++) {
- if (i > 0) {
- rstr.append(",");
- }
-
- rstr.append(array[i]);
- }
-
- return rstr.toString();
- }
-
- /**
- * Create a string formulated by inserting a delimiter in between consecutive array
elements.
- *
- * @param objs List of objects to implode (elements may not be null)
- * @param delim String to place inbetween elements
- *
- * @return A string with objects in the list seperated by delim
- */
- public static String implode(List objs, String delim) {
- StringBuilder buf = new StringBuilder();
- int size = objs.size();
-
- for (int i = 0; i < (size - 1); i++) {
- buf.append(objs.get(i).toString());
- buf.append( delim);
- }
-
- if (size != 0) {
- buf.append(objs.get(size - 1).toString());
- }
-
- return buf.toString();
- }
-
- /**
- * Split a string on delimiter boundaries, and place each element into a List.
- *
- * @param s String to split up
- * @param delim Delimiting token, ala StringTokenizer
- *
- * @return a List comprised of elements split by the tokenizing
- */
-
- public static List<String> explode(String s, String delim) {
- List<String> res = new ArrayList<String>();
- if (s == null)
- return res;
-
- StringTokenizer tok = new StringTokenizer(s, delim);
-
- while (tok.hasMoreTokens()) {
- res.add(tok.nextToken());
- }
-
- return res;
- }
-
- /**
- * Split a string on delimiter boundaries, and place each element into an Array.
- *
- * @param toExplode String to split up
- * @param delim Delimiting token, ala StringTokenizer
- *
- * @return an Array comprised of elements split by the tokenizing
- */
- public static String[] explodeToArray(String toExplode, String delim) {
- List<String> strings = explode(toExplode, delim);
- String[] ret;
- ret = strings.toArray(new String[strings.size()]);
- return ret;
- }
-
- /**
- * Split a string up by whitespace, taking into account quoted subcomponents. If
there is an uneven number of
- * quotes, a parse error will be thrown.
- *
- * @param arg String to parse
- *
- * @return an array of elements, the argument was split into
- *
- * @throws IllegalArgumentException indicating there was a quoting error
- */
-
- public static String[] explodeQuoted(String arg) throws IllegalArgumentException {
- List<String> res = new ArrayList<String>();
- StringTokenizer quoteTok;
- boolean inQuote = false;
-
- arg = arg.trim();
- quoteTok = new StringTokenizer(arg, "\"", true);
-
- while (quoteTok.hasMoreTokens()) {
- String elem = (String) quoteTok.nextElement();
-
- if (elem.equals("\"")) {
- inQuote = !inQuote;
- continue;
- }
-
- if (inQuote) {
- res.add(elem);
- } else {
- StringTokenizer spaceTok = new StringTokenizer(elem.trim());
-
- while (spaceTok.hasMoreTokens()) {
- res.add(spaceTok.nextToken());
- }
- }
- }
-
- if (inQuote) {
- throw new IllegalArgumentException("Unbalanced quotation marks");
- }
-
- return res.toArray(new String[res.size()]);
- }
-
- /**
- * Remove a prefix from a string. If value starts with prefix, it will be removed,
the resultant string is trimmed
- * and returned.
- *
- * @return If value starts with prefix, then this method returns value with the
prefix removed, and the resultant
- * string trimmed. If value does not start with prefix, value is returned
as-is.
- */
- public static String removePrefix(String value, String prefix) {
- if (!value.startsWith(prefix)) {
- return value;
- }
-
- return value.substring(prefix.length()).trim();
- }
-
- /**
- * @return the plural of word. This is done by applying a few rules. These cover most
(but not all) cases: 1. If the
- * word ends in s, ss, x, o, or ch, append es 2. If the word ends in a
consonant followed by y, drop the y
- * and add ies 3. Append an s and call it a day. The ultimate references is
at
- *
http://en.wikipedia.org/wiki/English_plural
- */
- public static String pluralize(String word) {
- if (word.endsWith("s") || word.endsWith("x") ||
word.endsWith("o") || word.endsWith("ch")) {
- return word + "es";
- }
-
- if (word.endsWith("y")) {
- // Odd case to avoid StringIndexOutOfBounds later
- if (word.length() == 1) {
- return word;
- }
-
- // Check next-to-last letter
- char next2last = word.charAt(word.length() - 2);
- if ((next2last != 'a') && (next2last != 'e')
&& (next2last != 'i') && (next2last != 'o')
- && (next2last != 'u') && (next2last !=
'y')) {
- return word.substring(0, word.length() - 1) + "ies";
- }
- }
-
- return word + "s";
- }
-
- /**
- * @return The stack trace for the given Throwable as a String.
- */
- public static String getStackTrace(Throwable t) {
- if (t == null) {
- return "THROWABLE-WAS-NULL (at " + getStackTrace(new Exception()) +
")";
- }
-
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- t.printStackTrace(pw);
-
- Throwable cause = t.getCause();
- if (cause != null) {
- return sw.toString() + getStackTrace(cause);
- }
-
- return sw.toString();
- } catch (Exception e) {
- return "\n\nStringUtil.getStackTrace " + "GENERATED EXCEPTION:
'" + e.toString() + "' \n\n";
- }
- }
-
- /**
- * @return The stack trace for the given Throwable as a String.
- */
- public static String getFirstStackTrace(Throwable t) {
- if (t == null) {
- return null;
- }
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
-
- return sw.toString();
- }
-
- /**
- * @param s A string that might contain unix-style path separators.
- *
- * @return The correct path for this platform (i.e, if win32, replace / with \).
- */
- public static String normalizePath(String s) {
- return StringUtil.replace(s, "/", File.separator);
- }
-
- public static String formatDuration(long duration) {
- return formatDuration(duration, 0, false);
- }
-
- public static String formatDuration(long duration, int scale, boolean minDigits) {
- long hours;
- long mins;
- int digits;
- double millis;
-
- hours = duration / 3600000;
- duration -= hours * 3600000;
-
- mins = duration / 60000;
- duration -= mins * 60000;
-
- millis = (double) duration / 1000;
-
- StringBuilder buf = new StringBuilder();
-
- if ((hours > 0) || (minDigits == false)) {
- buf.append(((hours < 10) && (minDigits == false)) ? ("0"
+ hours) : String.valueOf(hours)).append(':');
- minDigits = false;
- }
-
- if ((mins > 0) || (minDigits == false)) {
- buf.append(((mins < 10) && (minDigits == false)) ? ("0"
+ mins) : String.valueOf(mins)).append(':');
- minDigits = false;
- }
-
- // Format seconds and milliseconds
- NumberFormat fmt = NumberFormat.getInstance();
- digits = (((minDigits == false) || ((scale == 0) && (millis >= 9.5)))
? 2 : 1);
- fmt.setMinimumIntegerDigits(digits);
- fmt.setMaximumIntegerDigits(2); // Max of 2
- fmt.setMinimumFractionDigits(0); // Don't need any
- fmt.setMaximumFractionDigits(scale);
-
- buf.append(fmt.format(millis));
-
- return buf.toString();
- }
-
- public static String repeatChars(char c, int nTimes) {
- char[] arr = new char[nTimes];
-
- for (int i = 0; i < nTimes; i++) {
- arr[i] = c;
- }
-
- return new String(arr);
- }
-
- /**
- * Capitalizes the first letter of str.
- *
- * @param str The string to capitalize.
- *
- * @return A new string that is <code>str</code> capitalized. Returns
<code>null</code> if str is null.
- */
- public static String capitalize(String str) {
- if (str == null) {
- return null;
- } else if (str.trim().equals("")) {
- return str;
- }
-
- String result = str.substring(0, 1).toUpperCase() + str.substring(1,
str.length());
-
- return result;
- }
-
- public static String truncate(String s, int truncLength, boolean removeWhiteSpace) {
- String temp = ((s.length() > truncLength) ? (s.substring(0, truncLength) +
"...") : s);
- if (removeWhiteSpace) {
- temp = temp.replaceAll("\\s+", " ");
- }
-
- return temp;
- }
-}
\ No newline at end of file
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
b/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
new file mode 100644
index 0000000..7944bbd
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
@@ -0,0 +1,552 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.util;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class StringUtil {
+
+ private static final Log log = LogFactory.getLog(StringUtil.class);
+
+ /**
+ * @param source The source string to perform replacements on.
+ * @param find The substring to find in source.
+ * @param replace The string to replace 'find' within source
+ *
+ * @return The source string, with all occurrences of 'find' replaced with
'replace'
+ */
+ public static String replace(String source, String find, String replace) {
+ if ((source == null) || (find == null) || (replace == null)) {
+ return source;
+ }
+
+ int sourceLen = source.length();
+ int findLen = find.length();
+ if ((sourceLen == 0) || (findLen == 0)) {
+ return source;
+ }
+
+ StringBuilder buffer = new StringBuilder();
+
+ int idx;
+ int fromIndex;
+
+ for (fromIndex = 0; (idx = source.indexOf(find, fromIndex)) != -1; fromIndex =
idx + findLen) {
+ buffer.append(source.substring(fromIndex, idx));
+ buffer.append(replace);
+ }
+
+ if (fromIndex == 0) {
+ return source;
+ }
+
+ buffer.append(source.substring(fromIndex));
+
+ return buffer.toString();
+ }
+
+ /**
+ * @param source The source string to perform replacements on.
+ * @param find The substring to find in source.
+ *
+ * @return The source string, with all occurrences of 'find' removed
+ */
+ public static String remove(String source, String find) {
+ if ((source == null) || (find == null)) {
+ return source;
+ }
+
+ String retVal = null;
+ int sourceLen = source.length();
+ int findLen = find.length();
+ StringBuilder remove = new StringBuilder(source);
+
+ try {
+ if ((sourceLen > 0) && (findLen > 0)) {
+ int fromIndex;
+ int idx;
+
+ for (fromIndex = 0, idx = 0; (fromIndex = source.indexOf(find, idx)) !=
-1; idx = fromIndex + findLen) {
+ remove.delete(fromIndex, findLen + fromIndex);
+ }
+
+ retVal = remove.toString();
+ }
+ } catch (Exception e) {
+ log.error("This should not have happened.", e);
+ retVal = null;
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Print out everything in an Iterator in a user-friendly string format.
+ *
+ * @param i An iterator to print out.
+ * @param delim The delimiter to use between elements.
+ *
+ * @return The Iterator's elements in a user-friendly string format.
+ */
+ public static String iteratorToString(Iterator i, String delim) {
+ return iteratorToString(i, delim, "");
+ }
+
+ /**
+ * Print out everything in an Iterator in a user-friendly string format.
+ *
+ * @param i An iterator to print out.
+ * @param delim The delimiter to use between elements.
+ * @param quoteChar The character to quote each element with.
+ *
+ * @return The Iterator's elements in a user-friendly string format.
+ */
+ public static String iteratorToString(Iterator i, String delim, String quoteChar) {
+ Object elt = null;
+ StringBuilder rstr = new StringBuilder();
+ String s;
+
+ while (i.hasNext()) {
+ if (rstr.length() > 0) {
+ rstr.append(delim);
+ }
+
+ elt = i.next();
+ if (elt == null) {
+ rstr.append("NULL");
+ } else {
+ s = elt.toString();
+ if (quoteChar != null) {
+ rstr.append(quoteChar).append(s).append(quoteChar);
+ } else {
+ rstr.append(s);
+ }
+ }
+ }
+
+ return rstr.toString();
+ }
+
+ /**
+ * Print out a List in a user-friendly string format.
+ *
+ * @param list A List to print out.
+ * @param delim The delimiter to use between elements.
+ *
+ * @return The List in a user-friendly string format.
+ */
+ public static String listToString(List list, String delim) {
+ if (list == null) {
+ return "NULL";
+ }
+
+ Iterator i = list.iterator();
+ return iteratorToString(i, delim, null);
+ }
+
+ public static String collectionToString(Collection collection, String delim) {
+ if (collection == null) {
+ return "NULL";
+ }
+
+ Iterator i = collection.iterator();
+ return iteratorToString(i, delim, null);
+ }
+
+ /**
+ * Print out a List in a user-friendly string format.
+ *
+ * @param list A List to print out.
+ *
+ * @return The List in a user-friendly string format.
+ */
+ public static String listToString(List list) {
+ return listToString(list, ",");
+ }
+
+ public static String collectionToString(Collection collection) {
+ return collectionToString(collection, ",");
+ }
+
+ /**
+ * Print out an array as a String
+ */
+ public static String arrayToString(Object[] array) {
+ return arrayToString(array, ',');
+ }
+
+ /**
+ * Print out an array as a String
+ */
+ public static String arrayToString(boolean[] array) {
+ if (array == null) {
+ return "null";
+ }
+
+ String rstr = "";
+ char delim = ',';
+ for (int i = 0; i < array.length; i++) {
+ if (i > 0) {
+ rstr += delim;
+ }
+
+ rstr += array[i];
+ }
+
+ return rstr;
+ }
+
+ /**
+ * Print out an array as a String
+ *
+ * @param array The array to print out
+ * @param delim The delimiter to use between elements.
+ */
+ public static String arrayToString(Object[] array, char delim) {
+ if (array == null) {
+ return "null";
+ }
+
+ StringBuilder rstr = new StringBuilder();
+ for (int i = 0; i < array.length; i++) {
+ if (i > 0) {
+ rstr.append(delim);
+ }
+
+ rstr.append(array[i]);
+ }
+
+ return rstr.toString();
+ }
+
+ /**
+ * Print out an array as a String
+ */
+ public static String arrayToString(int[] array) {
+ if (array == null) {
+ return "null";
+ }
+
+ StringBuilder rstr = new StringBuilder();
+ for (int i = 0; i < array.length; i++) {
+ if (i > 0) {
+ rstr.append(",");
+ }
+
+ rstr.append(array[i]);
+ }
+
+ return rstr.toString();
+ }
+
+ /**
+ * Create a string formulated by inserting a delimiter in between consecutive array
elements.
+ *
+ * @param objs List of objects to implode (elements may not be null)
+ * @param delim String to place inbetween elements
+ *
+ * @return A string with objects in the list seperated by delim
+ */
+ public static String implode(List objs, String delim) {
+ StringBuilder buf = new StringBuilder();
+ int size = objs.size();
+
+ for (int i = 0; i < (size - 1); i++) {
+ buf.append(objs.get(i).toString());
+ buf.append( delim);
+ }
+
+ if (size != 0) {
+ buf.append(objs.get(size - 1).toString());
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * Split a string on delimiter boundaries, and place each element into a List.
+ *
+ * @param s String to split up
+ * @param delim Delimiting token, ala StringTokenizer
+ *
+ * @return a List comprised of elements split by the tokenizing
+ */
+
+ public static List<String> explode(String s, String delim) {
+ List<String> res = new ArrayList<String>();
+ if (s == null)
+ return res;
+
+ StringTokenizer tok = new StringTokenizer(s, delim);
+
+ while (tok.hasMoreTokens()) {
+ res.add(tok.nextToken());
+ }
+
+ return res;
+ }
+
+ /**
+ * Split a string on delimiter boundaries, and place each element into an Array.
+ *
+ * @param toExplode String to split up
+ * @param delim Delimiting token, ala StringTokenizer
+ *
+ * @return an Array comprised of elements split by the tokenizing
+ */
+ public static String[] explodeToArray(String toExplode, String delim) {
+ List<String> strings = explode(toExplode, delim);
+ String[] ret;
+ ret = strings.toArray(new String[strings.size()]);
+ return ret;
+ }
+
+ /**
+ * Split a string up by whitespace, taking into account quoted subcomponents. If
there is an uneven number of
+ * quotes, a parse error will be thrown.
+ *
+ * @param arg String to parse
+ *
+ * @return an array of elements, the argument was split into
+ *
+ * @throws IllegalArgumentException indicating there was a quoting error
+ */
+
+ public static String[] explodeQuoted(String arg) throws IllegalArgumentException {
+ List<String> res = new ArrayList<String>();
+ StringTokenizer quoteTok;
+ boolean inQuote = false;
+
+ arg = arg.trim();
+ quoteTok = new StringTokenizer(arg, "\"", true);
+
+ while (quoteTok.hasMoreTokens()) {
+ String elem = (String) quoteTok.nextElement();
+
+ if (elem.equals("\"")) {
+ inQuote = !inQuote;
+ continue;
+ }
+
+ if (inQuote) {
+ res.add(elem);
+ } else {
+ StringTokenizer spaceTok = new StringTokenizer(elem.trim());
+
+ while (spaceTok.hasMoreTokens()) {
+ res.add(spaceTok.nextToken());
+ }
+ }
+ }
+
+ if (inQuote) {
+ throw new IllegalArgumentException("Unbalanced quotation marks");
+ }
+
+ return res.toArray(new String[res.size()]);
+ }
+
+ /**
+ * Remove a prefix from a string. If value starts with prefix, it will be removed,
the resultant string is trimmed
+ * and returned.
+ *
+ * @return If value starts with prefix, then this method returns value with the
prefix removed, and the resultant
+ * string trimmed. If value does not start with prefix, value is returned
as-is.
+ */
+ public static String removePrefix(String value, String prefix) {
+ if (!value.startsWith(prefix)) {
+ return value;
+ }
+
+ return value.substring(prefix.length()).trim();
+ }
+
+ /**
+ * @return the plural of word. This is done by applying a few rules. These cover most
(but not all) cases: 1. If the
+ * word ends in s, ss, x, o, or ch, append es 2. If the word ends in a
consonant followed by y, drop the y
+ * and add ies 3. Append an s and call it a day. The ultimate references is
at
+ *
http://en.wikipedia.org/wiki/English_plural
+ */
+ public static String pluralize(String word) {
+ if (word.endsWith("s") || word.endsWith("x") ||
word.endsWith("o") || word.endsWith("ch")) {
+ return word + "es";
+ }
+
+ if (word.endsWith("y")) {
+ // Odd case to avoid StringIndexOutOfBounds later
+ if (word.length() == 1) {
+ return word;
+ }
+
+ // Check next-to-last letter
+ char next2last = word.charAt(word.length() - 2);
+ if ((next2last != 'a') && (next2last != 'e')
&& (next2last != 'i') && (next2last != 'o')
+ && (next2last != 'u') && (next2last !=
'y')) {
+ return word.substring(0, word.length() - 1) + "ies";
+ }
+ }
+
+ return word + "s";
+ }
+
+ /**
+ * @return The stack trace for the given Throwable as a String.
+ */
+ public static String getStackTrace(Throwable t) {
+ if (t == null) {
+ return "THROWABLE-WAS-NULL (at " + getStackTrace(new Exception()) +
")";
+ }
+
+ try {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+
+ t.printStackTrace(pw);
+
+ Throwable cause = t.getCause();
+ if (cause != null) {
+ return sw.toString() + getStackTrace(cause);
+ }
+
+ return sw.toString();
+ } catch (Exception e) {
+ return "\n\nStringUtil.getStackTrace " + "GENERATED EXCEPTION:
'" + e.toString() + "' \n\n";
+ }
+ }
+
+ /**
+ * @return The stack trace for the given Throwable as a String.
+ */
+ public static String getFirstStackTrace(Throwable t) {
+ if (t == null) {
+ return null;
+ }
+
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+
+ return sw.toString();
+ }
+
+ /**
+ * @param s A string that might contain unix-style path separators.
+ *
+ * @return The correct path for this platform (i.e, if win32, replace / with \).
+ */
+ public static String normalizePath(String s) {
+ return StringUtil.replace(s, "/", File.separator);
+ }
+
+ public static String formatDuration(long duration) {
+ return formatDuration(duration, 0, false);
+ }
+
+ public static String formatDuration(long duration, int scale, boolean minDigits) {
+ long hours;
+ long mins;
+ int digits;
+ double millis;
+
+ hours = duration / 3600000;
+ duration -= hours * 3600000;
+
+ mins = duration / 60000;
+ duration -= mins * 60000;
+
+ millis = (double) duration / 1000;
+
+ StringBuilder buf = new StringBuilder();
+
+ if ((hours > 0) || (minDigits == false)) {
+ buf.append(((hours < 10) && (minDigits == false)) ? ("0"
+ hours) : String.valueOf(hours)).append(':');
+ minDigits = false;
+ }
+
+ if ((mins > 0) || (minDigits == false)) {
+ buf.append(((mins < 10) && (minDigits == false)) ? ("0"
+ mins) : String.valueOf(mins)).append(':');
+ minDigits = false;
+ }
+
+ // Format seconds and milliseconds
+ NumberFormat fmt = NumberFormat.getInstance();
+ digits = (((minDigits == false) || ((scale == 0) && (millis >= 9.5)))
? 2 : 1);
+ fmt.setMinimumIntegerDigits(digits);
+ fmt.setMaximumIntegerDigits(2); // Max of 2
+ fmt.setMinimumFractionDigits(0); // Don't need any
+ fmt.setMaximumFractionDigits(scale);
+
+ buf.append(fmt.format(millis));
+
+ return buf.toString();
+ }
+
+ public static String repeatChars(char c, int nTimes) {
+ char[] arr = new char[nTimes];
+
+ for (int i = 0; i < nTimes; i++) {
+ arr[i] = c;
+ }
+
+ return new String(arr);
+ }
+
+ /**
+ * Capitalizes the first letter of str.
+ *
+ * @param str The string to capitalize.
+ *
+ * @return A new string that is <code>str</code> capitalized. Returns
<code>null</code> if str is null.
+ */
+ public static String capitalize(String str) {
+ if (str == null) {
+ return null;
+ } else if (str.trim().equals("")) {
+ return str;
+ }
+
+ String result = str.substring(0, 1).toUpperCase() + str.substring(1,
str.length());
+
+ return result;
+ }
+
+ public static String truncate(String s, int truncLength, boolean removeWhiteSpace) {
+ String temp = ((s.length() > truncLength) ? (s.substring(0, truncLength) +
"...") : s);
+ if (removeWhiteSpace) {
+ temp = temp.replaceAll("\\s+", " ");
+ }
+
+ return temp;
+ }
+}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/error/GenericErrorUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/error/GenericErrorUIBean.java
index a13e89a..2c4c7b8 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/error/GenericErrorUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/error/GenericErrorUIBean.java
@@ -28,7 +28,7 @@ import javax.faces.context.FacesContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.rhq.core.clientapi.util.StringUtil;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.server.alert.engine.internal.Tuple;
/**
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/Portal.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/Portal.java
index 203c929..88b434d 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/Portal.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/Portal.java
@@ -23,7 +23,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.rhq.core.clientapi.util.StringUtil;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.gui.legacy.util.DashboardUtils;
/**
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
index 5d317b0..6c31434 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/WebUserPreferences.java
@@ -8,12 +8,12 @@ import java.util.List;
import java.util.ListIterator;
import java.util.StringTokenizer;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.composite.ResourceIdFlyWeight;
import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.core.util.StringUtil;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.legacy.action.resource.hub.HubView;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
index df45f52..470975b 100755
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
@@ -30,7 +30,6 @@ import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.clientapi.util.TimeUtil;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.common.EntityContext;
@@ -38,6 +37,7 @@ import org.rhq.core.domain.event.EventSeverity;
import org.rhq.core.domain.event.composite.EventComposite;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.gui.legacy.AttrConstants;
import org.rhq.enterprise.gui.legacy.DefaultConstants;
import org.rhq.enterprise.gui.legacy.ParamConstants;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/PortalAction.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/PortalAction.java
index cb1e04e..e516033 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/PortalAction.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/PortalAction.java
@@ -30,7 +30,6 @@ import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
@@ -38,6 +37,7 @@ import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.gui.legacy.AttrConstants;
import org.rhq.enterprise.gui.legacy.Constants;
import org.rhq.enterprise.gui.legacy.ParamConstants;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
index f134028..2aefb23 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
@@ -32,12 +32,12 @@ import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.gui.legacy.Constants;
import org.rhq.enterprise.gui.legacy.Portal;
import org.rhq.enterprise.gui.legacy.Portlet;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsDisplayAction.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsDisplayAction.java
index a1970ba..83afbd8 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsDisplayAction.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsDisplayAction.java
@@ -29,9 +29,9 @@ import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.gui.legacy.Constants;
import org.rhq.enterprise.gui.legacy.ParamConstants;
import org.rhq.enterprise.gui.legacy.WebUser;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsFilterForm.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsFilterForm.java
index 1055210..a6b3230 100755
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsFilterForm.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/MetricsFilterForm.java
@@ -21,7 +21,8 @@ package
org.rhq.enterprise.gui.legacy.action.resource.common.monitor.visibility;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.ImageButtonBean;
-import org.rhq.core.clientapi.util.StringUtil;
+
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.server.legacy.measurement.MeasurementConstants;
/**
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartFormPrepareAction.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartFormPrepareAction.java
index 9ec74ee..3f9f998 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartFormPrepareAction.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/visibility/ViewChartFormPrepareAction.java
@@ -35,7 +35,6 @@ import org.apache.struts.action.ActionMapping;
import org.apache.struts.tiles.ComponentContext;
import org.rhq.core.clientapi.util.ArrayUtil;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.MeasurementBaseline;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -51,6 +50,7 @@ import org.rhq.core.domain.resource.group.Group;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.server.MeasurementConverter;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.gui.common.servlet.HighLowMetricValue;
import org.rhq.enterprise.gui.legacy.AttrConstants;
import org.rhq.enterprise.gui.legacy.DefaultConstants;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/beans/OptionItem.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/beans/OptionItem.java
index 28e1f8d..d4c86e1 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/beans/OptionItem.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/beans/OptionItem.java
@@ -28,7 +28,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.struts.util.LabelValueBean;
-import org.rhq.core.clientapi.util.StringUtil;
+
+import org.rhq.core.util.StringUtil;
/**
* This bean is for use with html:options.
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/RemovePrefixTag.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/RemovePrefixTag.java
index 261af53..cf2fe2c 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/RemovePrefixTag.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/RemovePrefixTag.java
@@ -24,7 +24,8 @@ import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.taglibs.standard.tag.common.core.NullAttributeException;
import org.apache.taglibs.standard.tag.el.core.ExpressionUtil;
-import org.rhq.core.clientapi.util.StringUtil;
+
+import org.rhq.core.util.StringUtil;
public class RemovePrefixTag extends TagSupport {
private String prefix = null;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/sql.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/sql.jsp
index 2699f8e..7a0f490 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/sql.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/sql.jsp
@@ -13,7 +13,7 @@ $Header$
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="javax.naming.NamingException" %>
<%@ page import="javax.servlet.ServletRequest" %>
-<%@ page import="org.rhq.core.clientapi.util.StringUtil" %>
+<%@ page import="org.rhq.core.util.StringUtil" %>
<%@ page import="org.rhq.enterprise.server.RHQConstants"%>
<%@ page import="org.rhq.enterprise.server.util.LookupUtil" %>
<%@ page import="org.rhq.core.db.DatabaseTypeFactory" %>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/common/Error.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/common/Error.jsp
index 915510d..cc2f790 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/common/Error.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/common/Error.jsp
@@ -1,7 +1,7 @@
<%@ page language="java" %>
<%@ page isErrorPage="true" %>
<%@ page import="javax.servlet.ServletException" %>
-<%@ page import="org.rhq.core.clientapi.util.StringUtil" %>
+<%@ page import="org.rhq.core.util.StringUtil" %>
<%@ page
import="org.rhq.enterprise.server.auth.SessionNotFoundException"%>
<%@ page
import="org.rhq.enterprise.server.auth.SessionTimeoutException"%>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/common/GenericError.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/common/GenericError.jsp
index 5f05378..eafb2e1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/common/GenericError.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/common/GenericError.jsp
@@ -1,7 +1,7 @@
<%@ page language="java" %>
<%@ page isErrorPage="true" %>
<%@ page import="java.util.Enumeration"%>
-<%@ page import="org.rhq.core.clientapi.util.StringUtil" %>
+<%@ page import="org.rhq.core.util.StringUtil" %>
<%@ page import="org.rhq.enterprise.gui.legacy.WebUser" %>
<%@ page import="org.rhq.enterprise.gui.legacy.WebUserPreferences" %>
<%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %>
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
index d92e7ba..5b1b980 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java
@@ -27,9 +27,9 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.util.StringUtil;
public abstract class SubjectPreferencesBase {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementPreferences.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementPreferences.java
index 2e47466..fe59053 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementPreferences.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementPreferences.java
@@ -3,8 +3,8 @@ package org.rhq.enterprise.server.measurement;
import java.util.Arrays;
import java.util.List;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.server.auth.prefs.SubjectPreferencesBase;
import org.rhq.enterprise.server.measurement.util.MeasurementUtils;
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SystemSettingsImporterTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SystemSettingsImporterTest.java
index 711fb75..7935e5f 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SystemSettingsImporterTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/sync/test/SystemSettingsImporterTest.java
@@ -27,11 +27,11 @@ import java.util.Properties;
import org.jmock.Expectations;
import org.testng.annotations.Test;
-import org.rhq.core.clientapi.util.StringUtil;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.sync.entity.SystemSettings;
+import org.rhq.core.util.StringUtil;
import org.rhq.enterprise.server.sync.importers.SystemSettingsImporter;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.test.JMockTest;
commit 711a4a70a5e582ceaee488189f0cbdc3355e3c03
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 14:47:02 2012 -0400
include the IOE in the call to log.error() when logging 500 errors, so the stack trace
will get logged; the stack trace of the IOE will help us track down which classes the
requests returning errors originate from
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 088bc9a..10610fc 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -277,7 +277,8 @@ public class ASConnection {
} catch (IOException ioe) {
responseCodeString = "unknown response code";
}
- log.error(operation + " failed with " + responseCodeString + "
- response body was [" + responseBody + "].");
+ log.error(operation + " failed with " + responseCodeString + "
- response body was [" + responseBody + "].",
+ e);
Result failure = new Result();
failure.setFailureDescription(e.getMessage());
commit f15c5981f086d0f2f1ca5912840486a5cd5506c6
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 14:24:22 2012 -0400
add support for EAP 6.0.0.ER4
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 49bbd0a..e3cf3c8 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -229,10 +229,25 @@
</activation>
<properties>
- <as7.url>Please set the as7.url system property to the location of the EAP
6.0.0.Beta distribution zipfile.</as7.url>
+ <as7.url>Please set the as7.url system property to the location of the EAP
6.0.0.Beta1 distribution zipfile.</as7.url>
<jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
</properties>
+ </profile>
+
+ <profile>
+ <id>eap600ER4.itest.setup</id>
+
+ <activation>
+ <property>
+ <name>as7.version</name>
+ <value>6.0.0.ER4</value>
+ </property>
+ </activation>
+ <properties>
+ <as7.url>Please set the as7.url system property to the location of the EAP
6.0.0.ER4 distribution zipfile.</as7.url>
+
<jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
+ </properties>
</profile>
<!-- Activate this profile to run the integration tests (these can take a while to
complete). -->
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
index 0cd1e01..3c143fd 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
@@ -39,6 +39,8 @@ public abstract class AbstractServerComponentTest extends
AbstractJBossAS7Plugin
private static final Map<String, String> EAP6_VERSION_TO_AS7_VERSION_MAP = new
HashMap<String, String>();
static {
EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.Beta1",
"7.1.0.Final-redhat-1");
+ EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER4",
"7.1.1.Final-redhat-1");
+ EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.CR1",
"7.1.1.Final-redhat-1");
}
private static final String RELEASE_VERSION_TRAIT_NAME =
"_skm:release-version";
commit 7390597117edfdb6528afa6630aa91443b761aad
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Mar 30 11:43:21 2012 -0500
Update properties for security subsystem and moved the subsystem from server to
service.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 87a14af..1580f48 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1776,71 +1776,6 @@ working area for individual server
instances</li></ul>"/>
</server>
- <server name="Security"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- >
-
- <runs-inside>
- <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
- <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
- </runs-inside>
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="subsystem=security"/>
- </plugin-configuration>
-
-
-
- <resource-configuration>
- <c:simple-property name="authentication-manager-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="Specifies the AuthenticationManager
implementation class name to use. To use the container default set the value to
'default'"/>
- <c:simple-property name="deep-copy-subject-mode"
required="false" type="boolean" readOnly="true"
defaultValue="false"
- description="Sets the copy mode of subjects done by
the security managers to be deep copies that makes copies of the subject principals and
credentials if they are cloneable. It should be set to true if subject include mutable
content that can be corrupted when multiple threads have the same identity and cache
flushes/logout clearing the subject in one thread results in subject references affecting
other threads."/>
- <c:simple-property name="default-callback-handler-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="A global class name for the
CallbackHandler implementation to be used with login modules. To use the container default
set the value to 'default'"/>
- <c:simple-property name="subject-factory-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="Sets the class name for the
SubjectFactory implementation to be used. To use the container default set the value to
'default'."/>
- <c:simple-property name="authorization-manager-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="Specifies the AuthorizationManager
implementation class name to use. To use the container default set the value to
'default'."/>
- <c:simple-property name="audit-manager-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="Specifies the AuditManager
implementation class name to use. To use the container default set the value to
'default'."/>
- <c:simple-property name="identity-trust-manager-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="Specifies the IdentityTrustManager
implementation class name to use. To use the container default set the value to
'default'."/>
- <c:simple-property name="mapping-manager-class-name"
required="false" type="string" readOnly="true"
defaultValue="default"
- description="Specifies the MappingManager
implementation class name to use. To use the container default set the value to
'default''."/>
- </resource-configuration>
-
- <service name="SecurtityDomain"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- >
-
- <runs-inside>
- <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
- <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
- </runs-inside>
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="security-domain"/>
- </plugin-configuration>
-
-
-
- <resource-configuration>
- <c:simple-property name="extends" required="false"
type="string" readOnly="true" description="The parent security
domain"/>
- <c:simple-property name="cache-type"
required="false" type="string" readOnly="true"
- description="Adds a cache to speed up
authentication checks. Allowed values are 'default' to use simple map as the cache
and 'infinispan' to use an Infinispan cache.">
- <c:property-options>
- <c:option value="default"/>
- <c:option value="infinispan"/>
- </c:property-options>
- </c:simple-property>
- </resource-configuration>
- </service>
-
- </server>
<server name="Infinispan"
discovery="SubsystemDiscovery"
@@ -2988,4 +2923,49 @@ working area for individual server
instances</li></ul>"/>
</service>
+
+ <service name="Security"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ singleton="true">
+
+ <runs-inside>
+ <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="subsystem=security"/>
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="deep-copy-subject-mode"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Sets the copy mode of subjects done by
the security managers to be deep copies that makes copies of the subject principals and
credentials if they are cloneable. It should be set to true if subject include mutable
content that can be corrupted when multiple threads have the same identity and cache
flushes/logout clearing the subject in one thread results in subject references affecting
other threads. The default value is false."/>
+ </resource-configuration>
+
+ <service name="SecurtityDomain"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent">
+
+ <runs-inside>
+ <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="security-domain"/>
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="extends" required="false"
type="string" readOnly="true" description="The parent security
domain"/>
+ <c:simple-property name="cache-type"
required="false" type="string" readOnly="true"
description="Adds a cache to speed up authentication checks. Allowed values are
'default' to use simple map as the cache and 'infinispan' to use an
Infinispan cache.">
+ <c:property-options>
+ <c:option value="default"/>
+ <c:option value="infinispan"/>
+ </c:property-options>
+ </c:simple-property>
+ </resource-configuration>
+ </service>
+
+ </service>
+
</plugin>
commit 5f21ea8f447bff7d0b9375f71a0b21ef2afd14aa
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Mar 30 11:33:29 2012 -0500
Add rhq-core-util to the classpath for d2d tool.
diff --git a/modules/plugins/jboss-as-7/d2d.sh b/modules/plugins/jboss-as-7/d2d.sh
index 577c3f7..2300cbb 100755
--- a/modules/plugins/jboss-as-7/d2d.sh
+++ b/modules/plugins/jboss-as-7/d2d.sh
@@ -6,4 +6,4 @@ RHQ_VERSION='4.4.0-SNAPSHOT'
OPTS=""
#OPTS="-agentlib:jdwp=transport=dt_socket,address=8790,server=y,suspend=y"
-java $OPTS -cp
target/rhq-jboss-as-7-plugin-${RHQ_VERSION}.jar:${M2_REPO}/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar:${M2_REPO}/org/codehaus/jackson/jackson-core-asl/1.7.4/jackson-core-asl-1.7.4.jar:${M2_REPO}/org/codehaus/jackson/jackson-mapper-asl/1.7.4/jackson-mapper-asl-1.7.4.jar:${M2_REPO}/org/rhq/rhq-core-plugin-api/${RHQ_VERSION}/rhq-core-plugin-api-${RHQ_VERSION}.jar
org.rhq.modules.plugins.jbossas7.Domain2Descriptor $*
+java $OPTS -cp
target/rhq-jboss-as-7-plugin-${RHQ_VERSION}.jar:${M2_REPO}/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar:${M2_REPO}/org/codehaus/jackson/jackson-core-asl/1.7.4/jackson-core-asl-1.7.4.jar:${M2_REPO}/org/codehaus/jackson/jackson-mapper-asl/1.7.4/jackson-mapper-asl-1.7.4.jar:${M2_REPO}/org/rhq/rhq-core-plugin-api/${RHQ_VERSION}/rhq-core-plugin-api-${RHQ_VERSION}.jar:${M2_REPO}/org/rhq/rhq-core-util/${RHQ_VERSION}/rhq-core-util-${RHQ_VERSION}.jar
org.rhq.modules.plugins.jbossas7.Domain2Descriptor $*
commit 8faa9a3ab209551b783d92bb6719e82bf87b38c8
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Mar 30 10:49:03 2012 -0500
Add support resource-adapter sub-subsystems. Also moved resource-adapters from server
to service.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 497a38b..87a14af 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1452,23 +1452,6 @@
</server>
- <server name="ResourceAdapters"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- >
-
- <runs-inside>
- <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
- <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
- </runs-inside>
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="subsystem=resource-adapters"/>
- </plugin-configuration>
- </server>
-
-
<server name="Logging"
discovery="SubsystemDiscovery"
class="LoggerComponent"
@@ -2965,4 +2948,44 @@ working area for individual server
instances</li></ul>"/>
</resource-configuration>
</service>
+
+ <service name="ResourceAdapters"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ singleton="true">
+
+ <runs-inside>
+ <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="subsystem=resource-adapters"/>
+ </plugin-configuration>
+
+ <service name="ResourceAdapter"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="The configuration of the resource adapter.">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="resource-adapter"/>
+ </plugin-configuration>
+
+ <operation name="activate" description="Force the resource
adapter config activation without server reload">
+ <results>
+ <c:simple-property name="operationResult"/>
+ </results>
+ </operation>
+
+ <resource-configuration>
+ <c:simple-property name="archive" required="true"
type="string" readOnly="false" description="Specifies the
resource adapter archive"/>
+ <c:simple-property name="beanvalidationgroups"
required="false" type="string" readOnly="false"
description="Specifies the bean validation groups that should be used"/>
+ <c:simple-property name="bootstrapcontext"
required="false" type="string" readOnly="false"
description="Specifies the unique name of the bootstrap context that should be
used"/>
+ <c:simple-property name="transaction-support"
required="true" type="string" readOnly="false"
description="Specifies the transaction support level of the resource
adapter"/>
+ </resource-configuration>
+ </service>
+
+ </service>
+
</plugin>
commit 94e8bed5e4ba3bdff7265c1775fb1ef190d0765c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 12:19:41 2012 -0400
replace calls to Throwable.printStackTrace() with logging
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n/PropertiesGenerator.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n/PropertiesGenerator.java
index 3c9d64f..a0a947d 100644
---
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n/PropertiesGenerator.java
+++
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n/PropertiesGenerator.java
@@ -25,7 +25,6 @@ package org.rhq.core.clientapi.agent.metadata.i18n;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.HashMap;
@@ -37,14 +36,14 @@ import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
/**
* Generates localization properties files for a plugin descriptor. Can update existing
files by appending properties
@@ -53,7 +52,10 @@ import org.xml.sax.SAXException;
* @author Greg Hinkle
*/
public class PropertiesGenerator {
- private Map<String, String> properties = new LinkedHashMap();
+
+ private final Log log = LogFactory.getLog(PropertiesGenerator.class);
+
+ private Map<String, String> properties = new LinkedHashMap<String,
String>();
private boolean update;
private File xmlFile;
@@ -126,12 +128,8 @@ public class PropertiesGenerator {
FileOutputStream fos = new FileOutputStream(propertiesFile, this.update);
this.contentWriter = new PrintWriter(fos);
generateNode(doc.getDocumentElement(), "");
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (SAXException e) {
- e.printStackTrace();
+ } catch (Exception e) {
+ log.error("Failed to generate i18n properties file.", e);
} finally {
if (this.contentWriter != null) {
this.contentWriter.close();
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
index 4447b9f..51735ab 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationCheckExecutor.java
@@ -42,7 +42,7 @@ import java.util.concurrent.Callable;
*/
public class ConfigurationCheckExecutor implements Runnable, Callable {
- private Log log = LogFactory.getLog(ConfigurationCheckExecutor.class);
+ private final Log log = LogFactory.getLog(ConfigurationCheckExecutor.class);
private ConfigurationManager configurationManager;
private ConfigurationServerService configurationServerService;
@@ -128,7 +128,7 @@ public class ConfigurationCheckExecutor implements Runnable, Callable
{
try {
checkConfigurations(child, true);
} catch (Exception e) {
- e.printStackTrace();
+ log.error("Failed to check Resource configuration for "
+ child + ".", e);
}
}
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/SnapshotGenerator.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/SnapshotGenerator.java
index 2867bb9..e6c4d07 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/SnapshotGenerator.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/SnapshotGenerator.java
@@ -3,6 +3,8 @@ package org.rhq.core.pc.drift;
import org.apache.commons.io.DirectoryWalker;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -19,12 +21,15 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import org.rhq.core.pc.configuration.ConfigurationCheckExecutor;
import org.rhq.core.util.MessageDigestGenerator;
import static java.io.File.separator;
public class SnapshotGenerator extends DirectoryWalker {
+ private final Log log = LogFactory.getLog(ConfigurationCheckExecutor.class);
+
private MessageDigestGenerator digestGenerator = new
MessageDigestGenerator(MessageDigestGenerator.SHA_256);
private File snapshotDir;
@@ -65,7 +70,7 @@ public class SnapshotGenerator extends DirectoryWalker {
zos.putNextEntry(entry);
IOUtils.copy(istream, zos);
} catch (IOException e) {
- e.printStackTrace();
+ log.error("Failed to add file " + file + " to zipfile
" + zipFile + ".", e);
} finally {
if (istream != null) {
istream.close();
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 9245d3c..078d7ef 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1222,9 +1222,10 @@ public class InventoryManager extends AgentService implements
ContainerService,
// TODO REMOVE THIS IF STATEMENT - IT IS JUST FOR TESTING
if
(!resource.getChildResources().getClass().getName().contains("Collections$SetFromMap"))
{
- new Exception("BAD CHILD SET - IF YOU SEE THIS, LOG IT IN BZ
801432:"
+ Exception e = new Exception("BAD CHILD SET - IF YOU SEE THIS, LOG IT
IN BZ 801432:"
+ resource.getChildResources().getClass().getName() + ":" +
resource.getId() + ":"
- + resource.getName()).printStackTrace();
+ + resource.getName());
+ log.fatal("[BZ 801432]", e);
}
for (Resource child : resource.getChildResources()) {
diff --git a/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
b/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
index 789d9a0..ecfed35 100644
--- a/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
+++ b/modules/core/util/src/main/java/org/rhq/core/clientapi/util/StringUtil.java
@@ -32,7 +32,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
public class StringUtil {
+
+ private static final Log log = LogFactory.getLog(StringUtil.class);
+
/**
* @param source The source string to perform replacements on.
* @param find The substring to find in source.
@@ -98,8 +104,7 @@ public class StringUtil {
retVal = remove.toString();
}
} catch (Exception e) {
- // XXX This should never happen
- e.printStackTrace();
+ log.error("This should not have happened.", e);
retVal = null;
}
commit 622f72a64f2e89c7c9c07ebe5c9c6bb003f5dc0a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 11:54:08 2012 -0400
upgrade jboss-sasl from 1.0.0.Beta9 to 1.0.0.Final; only pass options specific to
java7 or 64-bit java on as7 java command line when appropriate
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 6aa58df..49bbd0a 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -21,10 +21,12 @@
<properties>
<json.version>${project.json.version}</json.version>
<jackson.version>1.9.5</jackson.version>
- <jboss.sasl.version>1.0.0.Beta9</jboss.sasl.version>
+ <jboss.sasl.version>1.0.0.Final</jboss.sasl.version>
<as7.version>7.1.2.Final-SNAPSHOT</as7.version>
<
as7.url>https://hudson.jboss.org/hudson/view/JBoss%20AS/job/JBoss-AS-7...
<jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
+ <java.tieredCompilation>-Dxxx</java.tieredCompilation>
+ <java.useCompressedOOPS>-Dxxx</java.useCompressedOOPS>
</properties>
@@ -42,6 +44,8 @@
<!-- === Compile Deps === -->
+ <!-- NOTE: jackson 2.0.0 has moved to a new groupId - artifacts are under
+
http://repo1.maven.org/maven2/com/fasterxml/jackson/ -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
@@ -121,6 +125,36 @@
<profiles>
<profile>
+ <id>java7</id>
+ <activation>
+ <property>
+ <name>java.specification.version</name>
+ <value>1.7</value>
+ </property>
+ </activation>
+
+ <properties>
+
<java.tieredCompilation>-XX:+TieredCompilation</java.tieredCompilation>
+ </properties>
+
+ </profile>
+
+ <profile>
+ <id>java64bit</id>
+
+ <activation>
+ <property>
+ <name>sun.arch.data.model</name>
+ <value>64</value>
+ </property>
+ </activation>
+
+ <properties>
+
<java.useCompressedOOPS>-XX:+UseCompressedOops</java.useCompressedOOPS>
+ </properties>
+ </profile>
+
+ <profile>
<id>as700Final.itest.setup</id>
<activation>
@@ -368,8 +402,8 @@
<!-- Process Controller Java options -->
<argument>-D[Standalone]</argument>
<argument>-server</argument>
- <argument>-XX:+UseCompressedOops</argument>
- <argument>-XX:+TieredCompilation</argument>
+ <argument>${java.useCompressedOOPS}</argument>
+ <argument>${java.tieredCompilation}</argument>
<argument>-Xms64m</argument>
<argument>-Xmx512m</argument>
<argument>-XX:MaxPermSize=256m</argument>
commit 2d7c2be0cddaebba3adfbb43f57688f0fb775b9e
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 11:16:16 2012 -0400
when we receive 500 (Internal Server Error) responses, include the response body in
the error message we log, since it often includes valuable details
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 39c3bd9..088bc9a 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -67,8 +67,7 @@ public class ASConnection {
private int port;
/**
- * Construct an ASConnection object. The real "physical" connection is done
in
- * {@link #executeRaw(Operation)}.
+ * Construct an ASConnection object. The real "physical" connection is done
in {@link #executeRaw(Operation)}.
*
* @param host Host of the DomainController or standalone server
* @param port Port of the JSON api.
@@ -135,7 +134,7 @@ public class ASConnection {
* @see #executeComplex(org.rhq.modules.plugins.jbossas7.json.Operation)
*/
public JsonNode executeRaw(Operation operation, int timeoutSec) {
- long t1 = System.currentTimeMillis();
+ long requestStartTime = System.currentTimeMillis();
HttpURLConnection conn;
OutputStream out;
@@ -169,12 +168,9 @@ public class ASConnection {
return ret;
}
- InputStream inputStream;
- BufferedReader inputReader = null;
- InputStream errorStream = null;
try {
- //add additional request property to include-defaults=true to all requests.
- //if it's already set we leave it alone and assume that Operation creator
is taking over control.
+ // Add additional request property to include-defaults=true to all requests.
+ // If it's already set, we leave it alone and assume that Operation
creator is taking over control.
if (operation.getAdditionalProperties().isEmpty()
|| !operation.getAdditionalProperties().containsKey(INCLUDE_DEFAULT)) {
operation.addAdditionalProperty("include-defaults",
"true");
@@ -182,13 +178,12 @@ public class ASConnection {
String json_to_send = mapper.writeValueAsString(operation);
- //check for spaces in the path which the AS7 server will reject. Log verbose
error and
+ // Check for spaces in the path which the AS7 server will reject. Log verbose
error and
// generate failure indicator.
if ((operation != null) && (operation.getAddress() != null)
&& operation.getAddress().getPath() != null) {
if (containsSpaces(operation.getAddress().getPath())) {
Result noResult = new Result();
- String outcome = "- Path '" +
operation.getAddress().getPath()
- + "' is invalid as it contains spaces -";
+ String outcome = "- Path '" +
operation.getAddress().getPath() + "' is invalid as it contains spaces -";
if (verbose) {
log.error(outcome);
}
@@ -208,15 +203,11 @@ public class ASConnection {
out.flush();
out.close();
- int responseCode = conn.getResponseCode();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = conn.getInputStream();
- } else {
- inputStream = conn.getErrorStream();
- }
+ InputStream inputStream = (conn.getInputStream() != null) ?
conn.getInputStream() : conn.getErrorStream();
if (inputStream != null) {
- inputReader = new BufferedReader(new InputStreamReader(inputStream));
+ BufferedReader inputReader = new BufferedReader(new
InputStreamReader(inputStream));
+ // Note: slurp() will close the stream once it's done slurping it.
String responseBody = StreamUtil.slurp(inputReader);
String outcome;
@@ -240,18 +231,20 @@ public class ASConnection {
return operationResult;
} else {
- //if not properly authorized sends plugin exception for visual indicator
in the ui.
- if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED
- || responseCode == HttpURLConnection.HTTP_BAD_METHOD) {
+ // Empty response body - probably some sort of error - check the response
code.
+ int responseCode = conn.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
if (log.isDebugEnabled()) {
log.debug("Response to " + operation + " was empty
and response code was " + responseCode + " "
- + conn.getResponseMessage() + ".");
+ + conn.getResponseMessage() + " - throwing
InvalidPluginConfigurationException...");
}
+ // Throw a InvalidPluginConfigurationException, so the user will get
a yellow plugin connection
+ // warning message in the GUI.
throw new InvalidPluginConfigurationException(
- "Credentials for plugin to connect to AS7 management
interface are invalid. Update Connection Settings with valid credentials.");
+ "Credentials for plugin to connect to AS7 management
interface are invalid - update Connection Settings with valid credentials.");
} else {
- log.error("Response to " + operation + " was empty and
response code was " + responseCode + " ("
- + conn.getResponseMessage() + ").");
+ log.warn("Response body for " + operation + " was
empty and response code was " + responseCode + " ("
+ + conn.getResponseMessage() + ").");
}
}
} catch (IllegalArgumentException iae) {
@@ -267,25 +260,24 @@ public class ASConnection {
JsonNode ret = mapper.valueToTree(failure);
return ret;
} catch (IOException e) {
- log.error("Failed to get data: " + e);
-
- //the following code is in place to help keep-alive http connection re-use to
occur.
- if (conn != null) {//on error conditions it's still necessary to read the
response so JDK knows can reuse
- //the http connections behind the scenes.
- errorStream = conn.getErrorStream();
- if (errorStream != null) {
- BufferedReader dr = new BufferedReader(new
InputStreamReader(errorStream));
- String ignore = null;
- try {
- while ((ignore = dr.readLine()) != null) {
- //already reported error. just empty stream.
- }
- errorStream.close();
- } catch (IOException e1) {
- // ignore
- }
- }
+ // On error conditions, it's still necessary to slurp the response stream
so the JDK knows it can reuse the
+ // persistent HTTP connection behind the scenes.
+ String responseBody;
+ if (conn.getErrorStream() != null) {
+ BufferedReader errorReader = new BufferedReader(new
InputStreamReader(conn.getErrorStream()));
+ // Note: slurp() will close the stream once it's done slurping it.
+ responseBody = StreamUtil.slurp(errorReader);
+ } else {
+ responseBody = "";
+ }
+
+ String responseCodeString;
+ try {
+ responseCodeString = conn.getResponseCode() + " (" +
conn.getResponseMessage() + ")";
+ } catch (IOException ioe) {
+ responseCodeString = "unknown response code";
}
+ log.error(operation + " failed with " + responseCodeString + "
- response body was [" + responseBody + "].");
Result failure = new Result();
failure.setFailureDescription(e.getMessage());
@@ -294,27 +286,11 @@ public class ASConnection {
JsonNode ret = mapper.valueToTree(failure);
return ret;
-
} finally {
- if (inputReader != null) {
- try {
- inputReader.close();
- } catch (IOException e) {
- log.error("Failed to close HTTP connection input stream: "
+ e.getMessage());
- }
- }
- if (errorStream != null) {
- try {
- errorStream.close();
- } catch (IOException e) {
- log.error("Failed to close HTTP connection error stream: "
+ e.getMessage());
- }
- }
-
- long t2 = System.currentTimeMillis();
+ long requestEndTime = System.currentTimeMillis();
PluginStats stats = PluginStats.getInstance();
stats.incrementRequestCount();
- stats.addRequestTime(t2 - t1);
+ stats.addRequestTime(requestEndTime - requestStartTime);
}
return null;
commit dabdfcff99f5c0a9a8fedbc5b6085838cc2e5de5
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Mar 30 09:51:38 2012 -0500
Added support for EE subsystem. Update CMP subsystems to allow multiple Hilo
Keygenerators. Added support for JDNI bindings in the naming subsystem.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index cec63da..497a38b 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -2387,11 +2387,10 @@ working area for individual server
instances</li></ul>"/>
</resource-configuration>
</server>
- <server name="Naming"
+ <service name="Naming"
discovery="SubsystemDiscovery"
class="NamingComponent"
- singleton="true"
- >
+ singleton="true">
<runs-inside>
<parent-resource-type name="Host"
plugin="jboss-as-7"/>
@@ -2420,67 +2419,85 @@ working area for individual server
instances</li></ul>"/>
</c:list-property>
</results>
</operation>
- </server>
+ <service name="Binding"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="JNDI bindings for primitive types"
+ singleton="true">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="binding"/>
+ </plugin-configuration>
- <service name="Transactions Subsystem"
- discovery="SubsystemDiscovery"
- class="BaseComponent"
- singleton="true"
- description="The transactions subsystem."
- >
-
- <runs-inside>
- <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
- <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
- </runs-inside>
-
- <plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="subsystem=transactions"/>
- </plugin-configuration>
-
- <metric property="number-of-nested-transactions" description="The
total number of nested (sub) transactions created."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
- <metric property="number-of-timed-out-transactions"
description="The number of transactions that have rolled back due to timeout."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
- <metric property="number-of-committed-transactions"
description="The number of committed transactions."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
- <metric property="number-of-transactions" description="The total
number of transactions (top-level and nested) created"
- measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
- <metric property="number-of-heuristics" description="The number of
transactions which have terminated with heuristic outcomes."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
- <metric property="number-of-aborted-transactions" description="The
number of aborted (i.e. rolledback) transactions."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
- <metric property="number-of-inflight-transactions"
description="The number of transactions that have begun but not yet
terminated."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
- <metric property="number-of-application-rollbacks"
description="The number of transactions that have been rolled back by application
request. This includes those that timeout, since the timeout behaviour is considered an
attribute of the application configuration."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
- <metric property="number-of-resource-rollbacks" description="The
number of transactions that rolled back due to resource (participant) failure."
- measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
-
- <resource-configuration>
- <c:simple-property name="relative-to" required="false"
type="string" readOnly="false"
defaultValue="jboss.server.data.dir"
- description="References a global path configuration in the domain
model, defaulting to the JBoss Application Server data directory (jboss.server.data.dir).
The value of the 'path' attribute will treated as relative to this path. Use an
empty string to disable the default behavior and force the value of the 'path'
attribute to be treated as an absolute path."/>
- <c:simple-property name="process-id-uuid" required="false"
type="boolean" readOnly="false" description="Indicates whether
the transaction manager should use a UUID based process id."/>
- <c:simple-property name="socket-binding" required="false"
type="string" readOnly="false" description="Used to reference the
correct socket binding to use for the recovery environment."/>
- <c:simple-property name="jts" required="false"
type="boolean" readOnly="false" defaultValue="false"
description="If true this enables the Java Transaction Service"/>
- <c:simple-property name="object-store-path"
required="false" type="string" readOnly="false"
defaultValue="tx-object-store"
- description="Denotes a relative or absolute filesystem path
denoting where the transaction manager object store should store data. By default the
value is treated as relative to the path denoted by the 'relative-to'
attribute."/>
- <c:simple-property name="path" required="false"
type="string" readOnly="false" defaultValue="var"
description="Denotes a relative or absolute filesystem path denoting where the
transaction manager core should store data. By default the value is treated as relative to
the path denoted by the 'relative-to' attribute."/>
- <c:simple-property name="process-id-socket-binding"
required="false" type="string" readOnly="false"
description="The name of the socket binding configuration to use if the transaction
manager should use a socket-based process id. Will be 'undefined' if
'process-id-uuid' is 'true'; otherwise must be set."/>
- <c:simple-property name="default-timeout" required="false"
type="integer" readOnly="false" defaultValue="300"
description="The default timeout."/>
- <c:simple-property name="process-id-socket-max-ports"
required="false" type="integer" readOnly="false"
defaultValue="10" description="The maximum number of ports to search for an
open port if the transaction manager should use a socket-based process id. If the port
specified by the socket binding referenced in 'process-id-socket-binding' is
occupied, the next higher port will be tried until an open port is found or the number of
ports specified by this attribute have been tried. Will be 'undefined' if
'process-id-uuid' is 'true'."/>
- <c:simple-property name="recovery-listener"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Used to specify if the recovery system
should listen on a network socket or not."/>
- <c:simple-property name="status-socket-binding"
required="false" type="string" readOnly="false"
description="Used to reference the correct socket binding to use for the transaction
status manager."/>
- <c:simple-property name="node-identifier" required="false"
type="string" readOnly="false" defaultValue="1"
description="Used to set the node identifier on the core environment."/>
- <c:simple-property name="enable-tsm-status"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Whether the transaction status manager
(TSM) service, needed for out of process recovery, should be provided or not.."/>
- <c:simple-property name="object-store-relative-to"
required="false" type="string" readOnly="false"
defaultValue="jboss.server.data.dir"
- description="References a global path configuration in the domain
model, defaulting to the JBoss Application Server data directory (jboss.server.data.dir).
The value of the 'path' attribute will treated as relative to this path. Use an
empty string to disable the default behavior and force the value of the 'path'
attribute to be treated as an absolute path."/>
- <c:simple-property name="enable-statistics"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Whether statistics should be
enabled."/>
- </resource-configuration>
-
- </service>
+ <resource-configuration>
+ <c:simple-property name="binding-type"
required="false" type="string" readOnly="false"
description="The type of binding to create, may be simple, lookup or
object-factory"/>
+ <c:simple-property name="class" required="false"
type="string" readOnly="false" description="The object factory
class name for object factory bindings"/>
+ <c:simple-property name="lookup" required="false"
type="string" readOnly="false" description="The entry to lookup
in JNDI for lookup bindings"/>
+ <c:simple-property name="module" required="false"
type="string" readOnly="false" description="The module to load
the object factory from for object factory bindings"/>
+ <c:simple-property name="type" required="false"
type="string" readOnly="false" description="The type of the value
to bind for simple bindings, this must be a primitive type"/>
+ <c:simple-property name="value" required="false"
type="string" readOnly="false" description="The value to bind for
simple bindings"/>
+ </resource-configuration>
+ </service>
+ </service>
+
+ <service name="Transactions Subsystem"
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ singleton="true"
+ description="The transactions subsystem.">
+
+ <runs-inside>
+ <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="subsystem=transactions"/>
+ </plugin-configuration>
+
+ <metric property="number-of-nested-transactions" description="The
total number of nested (sub) transactions created."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
+ <metric property="number-of-timed-out-transactions"
description="The number of transactions that have rolled back due to timeout."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
+ <metric property="number-of-committed-transactions"
description="The number of committed transactions."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
+ <metric property="number-of-transactions" description="The total
number of transactions (top-level and nested) created"
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
+ <metric property="number-of-heuristics" description="The number of
transactions which have terminated with heuristic outcomes."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
+ <metric property="number-of-aborted-transactions" description="The
number of aborted (i.e. rolledback) transactions."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
+ <metric property="number-of-inflight-transactions" description="The
number of transactions that have begun but not yet terminated."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="false"/>
+ <metric property="number-of-application-rollbacks" description="The
number of transactions that have been rolled back by application request. This includes
those that timeout, since the timeout behaviour is considered an attribute of the
application configuration."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
+ <metric property="number-of-resource-rollbacks" description="The
number of transactions that rolled back due to resource (participant) failure."
+ measurementType="trendsup" defaultInterval="300000"
defaultOn="true"/>
+
+ <resource-configuration>
+ <c:simple-property name="relative-to" required="false"
type="string" readOnly="false"
defaultValue="jboss.server.data.dir"
+ description="References a global path configuration in the domain
model, defaulting to the JBoss Application Server data directory (jboss.server.data.dir).
The value of the 'path' attribute will treated as relative to this path. Use an
empty string to disable the default behavior and force the value of the 'path'
attribute to be treated as an absolute path."/>
+ <c:simple-property name="process-id-uuid" required="false"
type="boolean" readOnly="false" description="Indicates whether
the transaction manager should use a UUID based process id."/>
+ <c:simple-property name="socket-binding" required="false"
type="string" readOnly="false" description="Used to reference the
correct socket binding to use for the recovery environment."/>
+ <c:simple-property name="jts" required="false"
type="boolean" readOnly="false" defaultValue="false"
description="If true this enables the Java Transaction Service"/>
+ <c:simple-property name="object-store-path"
required="false" type="string" readOnly="false"
defaultValue="tx-object-store"
+ description="Denotes a relative or absolute filesystem path denoting
where the transaction manager object store should store data. By default the value is
treated as relative to the path denoted by the 'relative-to'
attribute."/>
+ <c:simple-property name="path" required="false"
type="string" readOnly="false" defaultValue="var"
description="Denotes a relative or absolute filesystem path denoting where the
transaction manager core should store data. By default the value is treated as relative to
the path denoted by the 'relative-to' attribute."/>
+ <c:simple-property name="process-id-socket-binding"
required="false" type="string" readOnly="false"
description="The name of the socket binding configuration to use if the transaction
manager should use a socket-based process id. Will be 'undefined' if
'process-id-uuid' is 'true'; otherwise must be set."/>
+ <c:simple-property name="default-timeout" required="false"
type="integer" readOnly="false" defaultValue="300"
description="The default timeout."/>
+ <c:simple-property name="process-id-socket-max-ports"
required="false" type="integer" readOnly="false"
defaultValue="10" description="The maximum number of ports to search for an
open port if the transaction manager should use a socket-based process id. If the port
specified by the socket binding referenced in 'process-id-socket-binding' is
occupied, the next higher port will be tried until an open port is found or the number of
ports specified by this attribute have been tried. Will be 'undefined' if
'process-id-uuid' is 'true'."/>
+ <c:simple-property name="recovery-listener"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Used to specify if the recovery system
should listen on a network socket or not."/>
+ <c:simple-property name="status-socket-binding"
required="false" type="string" readOnly="false"
description="Used to reference the correct socket binding to use for the transaction
status manager."/>
+ <c:simple-property name="node-identifier" required="false"
type="string" readOnly="false" defaultValue="1"
description="Used to set the node identifier on the core environment."/>
+ <c:simple-property name="enable-tsm-status"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Whether the transaction status manager
(TSM) service, needed for out of process recovery, should be provided or not.."/>
+ <c:simple-property name="object-store-relative-to"
required="false" type="string" readOnly="false"
defaultValue="jboss.server.data.dir"
+ description="References a global path configuration in the domain
model, defaulting to the JBoss Application Server data directory (jboss.server.data.dir).
The value of the 'path' attribute will treated as relative to this path. Use an
empty string to disable the default behavior and force the value of the 'path'
attribute to be treated as an absolute path."/>
+ <c:simple-property name="enable-statistics"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Whether statistics should be
enabled."/>
+ </resource-configuration>
+
+ </service>
<service name="Network Interface"
discovery="SubsystemDiscovery"
@@ -2498,16 +2515,16 @@ working area for individual server
instances</li></ul>"/>
</plugin-configuration>
</service>
+
<service name="SocketBindingGroup"
discovery="SubsystemDiscovery"
- class="SocketBindingGroupComponent"
- >
+ class="SocketBindingGroupComponent">
+
<runs-inside>
<parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
<parent-resource-type name="JBossAS7 Host Controller"
plugin="jboss-as-7"/>
</runs-inside>
-
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="socket-binding-group"/>
</plugin-configuration>
@@ -2897,8 +2914,16 @@ working area for individual server
instances</li></ul>"/>
<c:simple-property name="path" default="subsystem=cmp"
readOnly="true"/>
</plugin-configuration>
- <resource-configuration>
- <c:group name="child:hilo-keygenerator=hilo-keygenerator"
displayName="HiLo based key generators.">
+ <service name="HiloKeygenerator"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="HiLo based key generators.">
+
+ <plugin-configuration>
+ <c:simple-property name="path" readOnly="true"
default="hilo-keygenerator"/>
+ </plugin-configuration>
+
+ <resource-configuration>
<c:simple-property name="block-size"
required="false" type="long" readOnly="true"
description="The block size"/>
<c:simple-property name="create-table"
required="false" type="boolean" readOnly="true"
description="Boolean to determine whether to create create the tables"/>
<c:simple-property name="create-table-ddl"
required="false" type="string" readOnly="true"
description="The DDL used to create the table"/>
@@ -2909,9 +2934,35 @@ working area for individual server
instances</li></ul>"/>
<c:simple-property name="sequence-column"
required="false" type="string" readOnly="true"
description="The sequence column name"/>
<c:simple-property name="sequence-name"
required="false" type="string" readOnly="true"
description="The name of the sequence"/>
<c:simple-property name="table-name"
required="false" type="string" readOnly="true"
description="The table name"/>
- </c:group>
- </resource-configuration>
+ </resource-configuration>
+ </service>
+
+ </service>
+
+ <service name="EE"
+ class="BaseComponent"
+ discovery="SubsystemDiscovery"
+ description="The configuration of the EE subsystem."
+ singleton="true">
+ <runs-inside>
+ <parent-resource-type name="Profile"
plugin="jboss-as-7"/>
+ <parent-resource-type name="JBossAS7 Standalone Server"
plugin="jboss-as-7"/>
+ </runs-inside>
+
+ <plugin-configuration>
+ <c:simple-property name="path" default="subsystem=ee"
readOnly="true"/>
+ </plugin-configuration>
+
+ <resource-configuration>
+ <c:simple-property name="ear-subdeployments-isolated"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="Flag indicating whether each of the
subdeployments within a .ear can access classes belonging to another subdeployment within
the same .ear. A value of false means the subdeployments can see classes belonging to
other subdeployments within the .ear. The default value is false."/>
+ <c:list-property name="global-modules" description="A list of
modules that should be made available to all deployments." >
+ <c:map-property name="globalmodule" displayName="Global
module">
+ <c:simple-property name="name" type="string"
displayName="Name" required="true"/>
+ <c:simple-property name="slot" type="string"
displayName="Slot" required="true"/>
+ </c:map-property>
+ </c:list-property>
+ </resource-configuration>
</service>
</plugin>
commit b08d84b76985ca4d0cbbfa05435d401fdbe0068d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 10:27:52 2012 -0400
make sure itests run in desired order; use exec plugin, rather than arquillian plugin,
in pom to start as7 standalone instance; various minor tweaks; turn down some logging to
make log less cluttered
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 2c6a98e..6aa58df 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -297,9 +297,9 @@
</execution>
</executions>
</plugin>
-
+<!--
<plugin>
- <!-- use the arquillian plugin to start/stop the standalone server -->
+ <!- - use the arquillian plugin to start/stop the standalone server -
->
<groupId>org.jboss.arquillian.maven</groupId>
<artifactId>arquillian-maven-plugin</artifactId>
<version>1.0.0.Alpha2</version>
@@ -343,15 +343,63 @@
</dependencies>
</plugin>
-
+-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1.jbossorg-3</version>
<executions>
+
+ <execution>
+ <id>start-as7-standalone</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <background>true</background>
+ <!-- test blocks until the port at backgroundPollingAddress is
available (waiting for starting) -->
+ <!-- when maven jvm exits, this plugin will kill the running servers
-->
+
<backgroundPollingAddress>${jboss.standalone.bindAddress}:${jboss.standalone.nativeManagementPort}
+ </backgroundPollingAddress>
+ <executable>${java.home}/bin/java</executable>
+ <arguments>
+ <!-- Process Controller Java options -->
+ <argument>-D[Standalone]</argument>
+ <argument>-server</argument>
+ <argument>-XX:+UseCompressedOops</argument>
+ <argument>-XX:+TieredCompilation</argument>
+ <argument>-Xms64m</argument>
+ <argument>-Xmx512m</argument>
+ <argument>-XX:MaxPermSize=256m</argument>
+ <argument>-Djava.net.preferIPv4Stack=true</argument>
+ <argument>-Dorg.jboss.resolver.warning=true</argument>
+
<argument>-Dsun.rmi.dgc.client.gcInterval=3600000</argument>
+
<argument>-Dsun.rmi.dgc.server.gcInterval=3600000</argument>
+
<argument>-Djboss.modules.system.pkgs=org.jboss.byteman</argument>
+ <argument>-Djava.awt.headless=true</argument>
+
<argument>-Djboss.server.default.config=standalone.xml</argument>
+
<argument>-Dorg.jboss.boot.log.file=${jboss7.home}/standalone/log/boot.log</argument>
+
<argument>-Dlogging.configuration=file:${jboss7.home}/standalone/configuration/logging.properties</argument>
+ <argument>-jar</argument>
+ <argument>${jboss7.home}/jboss-modules.jar</argument>
+ <argument>-mp</argument>
+ <argument>${jboss7.home}/modules</argument>
+ <argument>-jaxpmodule</argument>
+ <argument>javax.xml.jaxp-provider</argument>
+ <argument>org.jboss.as.standalone</argument>
+ <argument>-Djboss.home.dir=${jboss7.home}</argument>
+
<argument>-Djboss.bind.address.management=${jboss.standalone.bindAddress}</argument>
+
<argument>-Djboss.bind.address=${jboss.standalone.bindAddress}</argument>
+
<argument>-Djboss.bind.address.unsecure=${jboss.standalone.bindAddress}</argument>
+
<argument>-Djboss.socket.binding.port-offset=${jboss.standalone.portOffset}</argument>
+ </arguments>
+ </configuration>
+ </execution>
+
<execution>
- <id>start-jboss7-host-controller</id>
+ <id>start-as7-domain</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index 5c1356a..39c3bd9 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -38,6 +38,7 @@ import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.util.stream.StreamUtil;
import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
import org.rhq.modules.plugins.jbossas7.json.Operation;
import org.rhq.modules.plugins.jbossas7.json.Result;
@@ -114,7 +115,7 @@ public class ASConnection {
* @see #executeComplex(org.rhq.modules.plugins.jbossas7.json.Operation)
*/
public JsonNode executeRaw(Operation operation) {
- return executeRaw(operation, 10);
+ return executeRaw(operation, 20);
}
/**
@@ -169,8 +170,8 @@ public class ASConnection {
}
InputStream inputStream;
- BufferedReader br = null;
- InputStream es = null;
+ BufferedReader inputReader = null;
+ InputStream errorStream = null;
try {
//add additional request property to include-defaults=true to all requests.
//if it's already set we leave it alone and assume that Operation creator
is taking over control.
@@ -215,17 +216,13 @@ public class ASConnection {
}
if (inputStream != null) {
- br = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- StringBuilder builder = new StringBuilder();
- while ((line = br.readLine()) != null) {
- builder.append(line);
- }
+ inputReader = new BufferedReader(new InputStreamReader(inputStream));
+ String responseBody = StreamUtil.slurp(inputReader);
String outcome;
JsonNode operationResult;
- if (builder.length() > 0) {
- outcome = builder.toString();
+ if (responseBody.length() > 0) {
+ outcome = responseBody;
operationResult = mapper.readTree(outcome);
if (verbose) {
ObjectMapper om2 = new ObjectMapper();
@@ -240,26 +237,27 @@ public class ASConnection {
noResult.setOutcome("failure");
operationResult = mapper.valueToTree(noResult);
}
+
return operationResult;
} else {
//if not properly authorized sends plugin exception for visual indicator
in the ui.
if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED
|| responseCode == HttpURLConnection.HTTP_BAD_METHOD) {
if (log.isDebugEnabled()) {
- log.debug("[" + url + "] Response was empty and
response code was " + responseCode + " "
+ log.debug("Response to " + operation + " was empty
and response code was " + responseCode + " "
+ conn.getResponseMessage() + ".");
}
throw new InvalidPluginConfigurationException(
"Credentials for plugin to connect to AS7 management
interface are invalid. Update Connection Settings with valid credentials.");
} else {
- log.error("[" + url + "] Response was empty and
response code was " + responseCode + " "
- + conn.getResponseMessage() + ".");
+ log.error("Response to " + operation + " was empty and
response code was " + responseCode + " ("
+ + conn.getResponseMessage() + ").");
}
}
} catch (IllegalArgumentException iae) {
- log.error("Illegal argument " + iae + "\n\t for input " +
operation);
+ log.error("Illegal argument for input " + operation + ":
" + iae.getMessage());
} catch (SocketTimeoutException ste) {
- log.error("Request to AS timed out " + ste.getMessage());
+ log.error(operation + " timed out: " + ste.getMessage());
conn.disconnect();
Result failure = new Result();
failure.setFailureDescription(ste.getMessage());
@@ -269,20 +267,20 @@ public class ASConnection {
JsonNode ret = mapper.valueToTree(failure);
return ret;
} catch (IOException e) {
- log.error("Failed to get data: " + e.getMessage());
+ log.error("Failed to get data: " + e);
//the following code is in place to help keep-alive http connection re-use to
occur.
if (conn != null) {//on error conditions it's still necessary to read the
response so JDK knows can reuse
//the http connections behind the scenes.
- es = conn.getErrorStream();
- if (es != null) {
- BufferedReader dr = new BufferedReader(new InputStreamReader(es));
+ errorStream = conn.getErrorStream();
+ if (errorStream != null) {
+ BufferedReader dr = new BufferedReader(new
InputStreamReader(errorStream));
String ignore = null;
try {
while ((ignore = dr.readLine()) != null) {
//already reported error. just empty stream.
}
- es.close();
+ errorStream.close();
} catch (IOException e1) {
// ignore
}
@@ -298,20 +296,21 @@ public class ASConnection {
return ret;
} finally {
- if (br != null) {
+ if (inputReader != null) {
try {
- br.close();
+ inputReader.close();
} catch (IOException e) {
- log.error(e.getMessage());
+ log.error("Failed to close HTTP connection input stream: "
+ e.getMessage());
}
}
- if (es != null) {
+ if (errorStream != null) {
try {
- es.close();
+ errorStream.close();
} catch (IOException e) {
- log.error(e.getMessage());
+ log.error("Failed to close HTTP connection error stream: "
+ e.getMessage());
}
}
+
long t2 = System.currentTimeMillis();
PluginStats stats = PluginStats.getInstance();
stats.incrementRequestCount();
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
index c4c5c03..c225406 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASUploadConnection.java
@@ -115,8 +115,10 @@ public class ASUploadConnection {
os.flush();
int code = connection.getResponseCode();
- log.info("Response code for file upload: " + code);
- if (code==500)
+ if (code != 200) {
+ log.warn("Response code for file upload: " + code + "
" + connection.getResponseMessage());
+ }
+ if (code == 500)
is = connection.getErrorStream();
else
is = connection.getInputStream();
@@ -208,7 +210,6 @@ public class ASUploadConnection {
String reason = reasonNode.getTextValue();
return true;
}
-
} catch (Exception e) {
log.error(e);
return true;
@@ -217,12 +218,12 @@ public class ASUploadConnection {
return false;
}
-
private void closeQuietly(final Closeable closeable) {
if(closeable != null) {
try {
closeable.close();
- } catch (final IOException e) {}
+ } catch (final IOException ignore) {
+ }
}
}
}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
index a1993bc..aaa688a 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
@@ -92,12 +92,12 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
* @see #readStandaloneOrHostXmlFromFile(String) for how to obtain the parsed xml
* @param commandLine Command line arguments of the process to
*/
- protected HostPort getManagementPortFromHostXml(String[] commandLine) {
+ protected HostPort getManagementHostPortFromHostXml(String[] commandLine) {
if (hostXml == null)
throw new IllegalArgumentException(CALL_READ_STANDALONE_OR_HOST_XML_FIRST);
String portString;
- String interfaceExpession;
+ String interfaceExpression;
String socketBindingName;
@@ -106,10 +106,10 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
String portOffset = null;
if (!socketInterface.isEmpty()) {
- interfaceExpession =
obtainXmlPropertyViaXPath("//interfaces/interface[@name='" +
socketInterface
+ interfaceExpression =
obtainXmlPropertyViaXPath("//interfaces/interface[@name='" +
socketInterface
+ "']/inet-address/@value");
- if (interfaceExpession.isEmpty()) {
- interfaceExpession =
obtainXmlPropertyViaXPath("//interfaces/interface[@name='" +
socketInterface
+ if (interfaceExpression.isEmpty()) {
+ interfaceExpression =
obtainXmlPropertyViaXPath("//interfaces/interface[@name='" +
socketInterface
+ "']/loopback-address/@value");
}
portString =
obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/socket/@port");
@@ -117,10 +117,10 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
// old AS7.0, early 7.1 style
portString =
obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/@port");
String interfaceName =
obtainXmlPropertyViaXPath("//management/management-interfaces/http-interface/@interface");
- interfaceExpession =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ interfaceExpression =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ "']/inet-address/@value");
- if (interfaceExpession.isEmpty()) {
- interfaceExpession =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ if (interfaceExpression.isEmpty()) {
+ interfaceExpression =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ "']/loopback-address/@value");
}
} else {
@@ -136,17 +136,17 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
portOffset = obtainXmlPropertyViaXPath(xpathExpression);
// TODO the next may also be expressed differently
- interfaceExpession =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ interfaceExpression =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ "']/inet-address/@value");
- if (interfaceExpession.isEmpty()) {
- interfaceExpession =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ if (interfaceExpression.isEmpty()) {
+ interfaceExpression =
obtainXmlPropertyViaXPath("/server/interfaces/interface[@name='" +
interfaceName
+ "']/loopback-address/@value");
}
}
HostPort hp = new HostPort();
- if (!interfaceExpession.isEmpty())
- hp.host = replaceDollarExpression(interfaceExpession, commandLine,
"localhost");
+ if (!interfaceExpression.isEmpty())
+ hp.host = replaceDollarExpression(interfaceExpression, commandLine,
"localhost");
else
hp.host = "localhost"; // Fallback
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index 590da14..cea3ee6 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -163,7 +163,7 @@ public class BaseComponent<T extends ResourceComponent<?>>
implements AS7Compone
String reqName = req.getName();
ComplexRequest request = null;
- Operation op = null;
+ Operation op;
if (reqName.contains(":")) {
request = ComplexRequest.create(reqName);
op = new ReadAttribute(address, request.getProp());
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
index 2eec0d5..bffac1c 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
@@ -116,7 +116,7 @@ public abstract class BaseProcessDiscovery extends
AbstractBaseDiscovery
fillUserPassFromFile(pluginConfig, getMode(), baseDir);
File logFile = getLogFile(getLogDir(process, baseDir));
initLogEventSourcesConfigProp(logFile.getPath(), pluginConfig);
- HostPort managementHostPort = getManagementPortFromHostXml(commandLine);
+ HostPort managementHostPort = getManagementHostPortFromHostXml(commandLine);
pluginConfig.put(new PropertySimple("hostname",
managementHostPort.host));
pluginConfig.put(new PropertySimple("port", managementHostPort.port));
pluginConfig.put(new PropertySimple("realm",
getManagementSecurityRealmFromHostXml()));
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 20e5518..79fc444 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -357,8 +357,8 @@ public class BaseServerComponent<T extends
ResourceComponent<?>> extends BaseCom
Result res = getASConnection().execute(op);
if (res.isSuccess()) {
- Long startTime= (Long) res.getResult();
- MeasurementDataTrait data = new MeasurementDataTrait(request,new
Date(startTime).toString());
+ Long startTime = (Long) res.getResult();
+ MeasurementDataTrait data = new MeasurementDataTrait(request, new
Date(startTime).toString());
report.addData(data);
}
}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
index c578607..d07ebeb 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
@@ -40,10 +40,8 @@ public class HornetQComponent extends BaseComponent {
targetAddress.add(targetType.as7name,resourceName);
List<String> entries;
- Operation op;
-
Result res;
- op = new Operation("read-operation-description",targetAddress);
+ Operation op = new
Operation("read-operation-description",targetAddress);
op.addAdditionalProperty("name","add");
ComplexResult cres = getASConnection().executeComplex(op);
Map<String,Map<String,Object>> definitions;
@@ -205,7 +203,7 @@ public class HornetQComponent extends BaseComponent {
/**
* Create a Type
* @param descriptorName type name as it is listed in the plugin descriptor
- * @param as7name the type undder which as7 knows it.
+ * @param as7name the type by which as7 knows it.
*/
CreationType(String descriptorName, String as7name) {
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
index a7e684d..140cef6 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
@@ -82,14 +82,16 @@ public class HostControllerDiscovery extends BaseProcessDiscovery {
@Override
protected String buildDefaultResourceName(HostPort hostPort, String configName,
JBossProductType productType) {
- String suffix = (hostPort.isLocal) ? "Domain Controller" : "Host
Controller";
+ boolean isDomainController = hostPort.isLocal;
+ String suffix = (isDomainController) ? "Domain Controller" : "Host
Controller";
return configName + " " + productType.NAME + " " + suffix;
}
@Override
protected String buildDefaultResourceDescription(HostPort hostPort, JBossProductType
productType) {
- String prefix = (hostPort.isLocal) ? "Domain controller" : "Host
controller";
- String suffix = (hostPort.isLocal) ? "domain" : "host";
+ boolean isDomainController = hostPort.isLocal;
+ String prefix = (isDomainController) ? "Domain controller" : "Host
controller";
+ String suffix = (isDomainController) ? "domain" : "host";
return prefix + " for a " + productType.FULL_NAME + " " +
suffix;
}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
index 69bd8d4..0308fd1 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
@@ -45,8 +45,7 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
*
* @author Heiko W. Rupp
*/
-public class ManagedASDiscovery extends
AbstractBaseDiscovery<HostControllerComponent<?>>
- {
+public class ManagedASDiscovery extends
AbstractBaseDiscovery<HostControllerComponent<?>> {
private HostControllerComponent parentComponent;
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
index 2075385..848f0e7 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
@@ -97,8 +97,8 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
}
@Override
- protected HostPort getManagementPortFromHostXml(String[] commandLine) {
- HostPort managementPort = super.getManagementPortFromHostXml(commandLine);
+ protected HostPort getManagementHostPortFromHostXml(String[] commandLine) {
+ HostPort managementPort = super.getManagementHostPortFromHostXml(commandLine);
if (!managementPort.withOffset) {
managementPort = checkForSocketBindingOffset(managementPort, commandLine);
}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
index 504be88..9fbe31b 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/Address.java
@@ -49,7 +49,7 @@ public class Address {
}
/**
- * Construct an Addres by cloning another
+ * Construct an Address by cloning another
* @param other Address to clone
*/
public Address(Address other) {
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 47ad52d..cec63da 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -118,8 +118,7 @@
<metric property="_internal:mgmtRequests"
category="performance" dataType="measurement"
defaultInterval="120000"
displayType="summary" measurementType="trendsup"
description="Number of requests sent to the controller"
- displayName="Number of management requests"
- />
+ displayName="Number of management requests"/>
<metric property="_internal:requestTime"
category="performance" dataType="measurement"
defaultInterval="120000"
displayType="summary" measurementType="trendsup"
description="Total time for requests" units="milliseconds"
displayName="Time used for management requests"/>
@@ -424,6 +423,7 @@
</service>
</server>
+
<server name="JBossAS7 Standalone Server"
discovery="StandaloneASDiscovery"
class="StandaloneASComponent"
@@ -495,10 +495,10 @@
displayType="summary" measurementType="dynamic"
description="Max time for a request since last metric get"
units="milliseconds"
displayName="Maximum request time"/>
- <metric property="server-state" dataType="trait"
displayName="Server state" description="Detailed server state"
+ <metric property="server-state" dataType="trait"
displayName="Server State" description="Detailed server state"
displayType="summary"/>
&serverKindMetrics;
- <metric property="startTime" dataType="trait"
displayName="Start time of the server" defaultOn="true"/>
+ <metric property="startTime" dataType="trait"
displayName="Server Start Time" defaultOn="true"/>
<event name="logEntry" description="an entry in a log
file"/>
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
index 7c7c70f..243574e 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/XmlFileReadingTest.java
@@ -17,7 +17,7 @@ public class XmlFileReadingTest {
URL url = getClass().getClassLoader().getResource("standalone70.xml");
bd.readStandaloneOrHostXmlFromFile(url.getFile());
- AbstractBaseDiscovery.HostPort hp = bd.getManagementPortFromHostXml(new
String[]{});
+ AbstractBaseDiscovery.HostPort hp = bd.getManagementHostPortFromHostXml(new
String[]{});
System.out.println(hp);
assert hp.host.equals("127.0.0.70") : "Host is " + hp.host;
assert hp.port==19990 : "Port is " + hp.port;
@@ -29,7 +29,7 @@ public class XmlFileReadingTest {
URL url = getClass().getClassLoader().getResource("standalone71.xml");
bd.readStandaloneOrHostXmlFromFile(url.getFile());
- AbstractBaseDiscovery.HostPort hp = bd.getManagementPortFromHostXml(new
String[]{});
+ AbstractBaseDiscovery.HostPort hp = bd.getManagementHostPortFromHostXml(new
String[]{});
System.out.println(hp);
// hp : HostPort{host='localhost', port=9990, isLocal=true}
assert hp.host.equals("127.0.0.71") : "Host is " + hp.host;
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
index 5400e57..a4b6123 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
@@ -57,7 +57,7 @@ public class DomainServerComponentTest extends
AbstractServerComponentTest {
return "jboss.domain.portOffset";
}
- @Test(priority = 20, groups = "discovery")
+ @Test(priority = 1000, groups = "discovery")
@RunDiscovery
public void testDomainServerDiscovery() throws Exception {
super.testAutoDiscovery();
@@ -65,20 +65,20 @@ public class DomainServerComponentTest extends
AbstractServerComponentTest {
// ******************************* METRICS ******************************* //
@Override
- @Test(priority = 21, enabled = true)
+ @Test(priority = 1001, enabled = true)
public void testMetricsHaveNonNullValues() throws Exception {
super.testMetricsHaveNonNullValues();
}
@Override
- @Test(priority = 21, enabled = true)
+ @Test(priority = 1002, enabled = true)
public void testReleaseVersionTrait() throws Exception {
super.testReleaseVersionTrait();
}
// ******************************* OPERATIONS ******************************* //
// TODO: Re-enable this once "shutdown" operation has been fixed.
- @Test(priority = 22, enabled = false)
+ @Test(priority = 1003, enabled = false)
public void testDomainServerShutdownAndStartOperations() throws Exception {
super.testShutdownAndStartOperations();
}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainSocketBindingTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainSocketBindingTest.java
index 0dd5d0c..f7730c8 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainSocketBindingTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainSocketBindingTest.java
@@ -54,7 +54,7 @@ public class DomainSocketBindingTest extends AbstractJBossAS7PluginTest
{
public static final ResourceType RESOURCE_TYPE = new
ResourceType("SocketBindingGroup", PLUGIN_NAME, ResourceCategory.SERVICE,
null);
private static final String RESOURCE_KEY =
"socket-binding-group=standard-sockets";
- @Test(priority = 10,groups = "discovery")
+ @Test(priority = 1010,groups = "discovery")
@RunDiscovery(discoverServices = true, discoverServers = true)
public void runDiscovery() throws Exception {
Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
@@ -68,13 +68,13 @@ public class DomainSocketBindingTest extends
AbstractJBossAS7PluginTest {
}
- @Test(priority = 11)
+ @Test(priority = 1011)
public void loadBindings() throws Exception {
loadConfig();
}
- @Test(priority = 11)
+ @Test(priority = 1011)
public void addBinding() throws Exception {
Configuration configuration = loadConfig();
@@ -104,7 +104,7 @@ public class DomainSocketBindingTest extends
AbstractJBossAS7PluginTest {
assert pl.getList().size() == count+1 : "Got only " +
pl.getList().size() + " items, expected "+ (count+1);
}
- @Test(priority = 11)
+ @Test(priority = 1011)
public void addModifyBinding() throws Exception {
Configuration configuration = loadConfig();
@@ -146,7 +146,7 @@ public class DomainSocketBindingTest extends
AbstractJBossAS7PluginTest {
}
- @Test(priority = 11)
+ @Test(priority = 1011)
public void addRemoveBinding() throws Exception {
Configuration configuration = loadConfig();
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
index 99f8347..279efdf 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SocketBindingTest.java
@@ -56,13 +56,13 @@ public class SocketBindingTest extends AbstractJBossAS7PluginTest {
private static final String RESOURCE_KEY =
"socket-binding-group=standard-sockets";
@Test(priority = 10,groups = "discovery")
- @RunDiscovery(discoverServices = true, discoverServers = true) public void
doSomeDiscovery() throws Exception {
+ @RunDiscovery(discoverServices = true, discoverServers = true)
+ public void doSomeDiscovery() throws Exception {
Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
assertNotNull(platform);
assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
Thread.sleep(20*1000L); // delay so that PC gets a chance to scan for resources
-
}
@Test(priority = 11)
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
index a221a27..9bd1d56 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
@@ -64,7 +64,7 @@ public class StandaloneServerComponentTest extends
AbstractServerComponentTest {
return "jboss.standalone.portOffset";
}
- @Test(priority = 10, groups = "discovery")
+ @Test(priority = 1, groups = "discovery")
@RunDiscovery
public void testStandaloneServerDiscovery() throws Exception {
super.testAutoDiscovery();
@@ -72,31 +72,31 @@ public class StandaloneServerComponentTest extends
AbstractServerComponentTest {
// ******************************* METRICS ******************************* //
@Override
- @Test(priority = 11, enabled = true)
+ @Test(priority = 2, enabled = true)
public void testMetricsHaveNonNullValues() throws Exception {
super.testMetricsHaveNonNullValues();
}
@Override
- @Test(priority = 11, enabled = true)
+ @Test(priority = 3, enabled = true)
public void testReleaseVersionTrait() throws Exception {
super.testReleaseVersionTrait();
}
// ******************************* OPERATIONS ******************************* //
- @Test(priority = 12)
+ @Test(priority = 4)
public void testReloadOperation() throws Exception {
invokeOperationAndAssertSuccess(getServerResource(), RELOAD_OPERATION_NAME,
null);
}
// TODO: Re-enable this once "shutdown" operation has been fixed.
- @Test(priority = 13, enabled = false)
+ @Test(priority = 5, enabled = false)
public void testStandaloneServerShutdownAndStartOperations() throws Exception {
super.testShutdownAndStartOperations();
}
// TODO: Re-enable once fixed.
- @Test(priority = 13, dependsOnMethods =
"testStandaloneServerShutdownAndStartOperations", enabled = false)
+ @Test(priority = 5, dependsOnMethods =
"testStandaloneServerShutdownAndStartOperations", enabled = false)
public void testRestartOperation() throws Exception {
AvailabilityType avail = getAvailability(getServerResource());
assertEquals(avail, AvailabilityType.UP);
commit bc36e3a0e0596c527c6c272901453edcefcd3f97
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Mar 30 09:51:54 2012 -0400
use longs, not ints, for timeout vars
diff --git
a/modules/core/plugin-test-util/src/main/java/org/rhq/core/plugin/testutil/AbstractAgentPluginTest.java
b/modules/core/plugin-test-util/src/main/java/org/rhq/core/plugin/testutil/AbstractAgentPluginTest.java
index 8a28883..05e1578 100644
---
a/modules/core/plugin-test-util/src/main/java/org/rhq/core/plugin/testutil/AbstractAgentPluginTest.java
+++
b/modules/core/plugin-test-util/src/main/java/org/rhq/core/plugin/testutil/AbstractAgentPluginTest.java
@@ -151,7 +151,7 @@ public abstract class AbstractAgentPluginTest extends Arquillian {
protected AvailabilityType getAvailability(Resource resource)
throws PluginContainerException {
ResourceContainer resourceContainer =
this.pluginContainer.getInventoryManager().getResourceContainer(resource);
- int timeoutMillis = 5000;
+ long timeoutMillis = 5000;
AvailabilityFacet availFacet =
resourceContainer.createResourceComponentProxy(AvailabilityFacet.class,
FacetLockType.READ, timeoutMillis, false, false);
AvailabilityType avail;
@@ -292,7 +292,7 @@ public abstract class AbstractAgentPluginTest extends Arquillian {
+ "] is defined for ResourceType {" + resourceType.getPlugin()
+ "}" + resourceType.getName() + ".");
ResourceContainer resourceContainer =
this.pluginContainer.getInventoryManager().getResourceContainer(resource);
- int timeoutMillis = 7000;
+ long timeoutMillis = 5000;
MeasurementFacet measurementFacet =
resourceContainer.createResourceComponentProxy(MeasurementFacet.class,
FacetLockType.READ, timeoutMillis, false, false);
MeasurementReport report = new MeasurementReport();
commit 398398905dbe479a06866ce4834fb0e8f7413b8c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Mar 29 16:41:34 2012 -0400
don't attempt to do any yum stuff if the internal yum server is disabled
diff --git
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/LinuxPlatformComponent.java
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/LinuxPlatformComponent.java
index 38833eb..1f336fa 100644
---
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/LinuxPlatformComponent.java
+++
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/LinuxPlatformComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -57,6 +57,7 @@ import org.rhq.plugins.platform.content.yum.YumProxy;
import org.rhq.plugins.platform.content.yum.YumServer;
public class LinuxPlatformComponent extends PosixPlatformComponent implements
ContentFacet {
+
// the prefix for all distro trait names
private static final String DISTRO_TRAIT_NAME_PREFIX = "distro.";
@@ -66,15 +67,12 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
private final Log log = LogFactory.getLog(LinuxPlatformComponent.class);
- private ContentContext contentContext;
-
- private YumServer yumServer = new YumServer();
- private YumProxy yumProxy = new YumProxy();
+ private YumServer yumServer;
+ private YumProxy yumProxy;
private boolean enableContentDiscovery = false;
private boolean enableInternalYumServer = false;
-
@Override
public void start(ResourceContext context) {
super.start(context);
@@ -106,17 +104,17 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
startWithContentContext(context.getContentContext());
-
return;
}
@Override
public void stop() {
-
- try {
- yumServer.halt();
- } catch (Exception e) {
- log.warn("Failed to shutdown the yum server", e);
+ if (yumServer != null) {
+ try {
+ yumServer.halt();
+ } catch (Exception e) {
+ log.warn("Failed to shutdown the yum server.", e);
+ }
}
super.stop();
@@ -124,17 +122,18 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
private void startWithContentContext(ContentContext context) {
if (this.enableInternalYumServer) {
+ yumServer = new YumServer();
+ yumProxy = new YumProxy();
+
int port = yumPort();
log.debug("yum port=[" + port + "]");
- this.contentContext = context;
try {
YumContext yumContext = new PluginContext(port, this.resourceContext,
context);
yumServer.start(yumContext);
yumProxy.init(this.resourceContext);
-
} catch (Exception e) {
- log.error("Start failed:", e);
+ log.error("Failed to start yum server.", e);
}
} else {
log.info("Internal yum server is disabled.");
@@ -163,6 +162,10 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
}
public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails>
packages, ContentServices contentServices) {
+ if (!this.enableInternalYumServer) {
+ throw new UnsupportedOperationException("Internal yum server is disabled
- this operation is a no-op.");
+ }
+
try {
DeployPackagesResponse result = new
DeployPackagesResponse(ContentResponseResult.SUCCESS);
List<String> pkgs = new ArrayList<String>();
@@ -188,6 +191,10 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
}
public RemovePackagesResponse removePackages(Set<ResourcePackageDetails>
packages) {
+ if (!this.enableInternalYumServer) {
+ throw new UnsupportedOperationException("Internal yum server is disabled
- this operation is a no-op.");
+ }
+
try {
RemovePackagesResponse result = new
RemovePackagesResponse(ContentResponseResult.SUCCESS);
List<String> pkgs = new ArrayList<String>();
@@ -223,14 +230,13 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
@Override
public OperationResult invokeOperation(String name, Configuration parameters) throws
Exception {
if ("cleanYumMetadataCache".equals(name)) {
- if (this.yumServer.isStarted()) {
- log.info("Cleaning yum metadata");
- yumServer.cleanMetadata();
- yumProxy.cleanMetadata();
- return new OperationResult();
- } else {
- throw new UnsupportedOperationException("Internal yum server is
disabled, this operation is a no-op");
+ if (!this.enableInternalYumServer) {
+ throw new UnsupportedOperationException("Internal yum server is
disabled - this operation is a no-op.");
}
+ log.info("Cleaning yum metadata...");
+ yumServer.cleanMetadata();
+ yumProxy.cleanMetadata();
+ return new OperationResult();
}
return super.invokeOperation(name, parameters);
@@ -253,4 +259,5 @@ public class LinuxPlatformComponent extends PosixPlatformComponent
implements Co
PropertySimple p =
this.resourceContext.getPluginConfiguration().getSimple("yumPort");
return ((p != null) ? p.getIntegerValue() : 9080);
}
+
}
\ No newline at end of file