[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by Thomas Segismont
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java | 45 +++-------
1 file changed, 16 insertions(+), 29 deletions(-)
New commits:
commit 53bd701be867ebbec684a46c5bf2466ae89550a8
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Oct 31 22:14:34 2013 +0100
Bug 1024331 - Storage node does not start in console mode on windows (cherry picked from master 5d4cbc7)
CommandLine object was incorrectly created
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java
index d9fc6d1..46d4d9a 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java
@@ -1,26 +1,20 @@
/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
*
- * * RHQ Management Platform
- * * Copyright (C) 2005-2012 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.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package org.rhq.server.control.command;
@@ -112,15 +106,8 @@ public class Console extends ControlCommand {
File storageBinDir = new File(getStorageBasedir(), "bin");
- String startScript;
- if (isWindows()) {
- startScript = "./cassandra.bat";
- } else {
- startScript = "./cassandra";
- }
-
- org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine(startScript)
- .addArgument("-f");
+ org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine(getCommandLine(false,
+ "cassandra", "-f"));
Executor exeuctor = new DefaultExecutor();
exeuctor.setWorkingDirectory(storageBinDir);
exeuctor.setStreamHandler(new PumpStreamHandler());
10 years, 1 month
[rhq] modules/enterprise
by Thomas Segismont
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java | 45 +++-------
1 file changed, 16 insertions(+), 29 deletions(-)
New commits:
commit 5d4cbc74c9b0519e79359b5a269b4516f6587773
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Oct 31 22:14:34 2013 +0100
Bug 1024331 - Storage node does not start in console mode on windows
CommandLine object was incorrectly created
diff --git a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java
index d9fc6d1..46d4d9a 100644
--- a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java
+++ b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Console.java
@@ -1,26 +1,20 @@
/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
*
- * * RHQ Management Platform
- * * Copyright (C) 2005-2012 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.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package org.rhq.server.control.command;
@@ -112,15 +106,8 @@ public class Console extends ControlCommand {
File storageBinDir = new File(getStorageBasedir(), "bin");
- String startScript;
- if (isWindows()) {
- startScript = "./cassandra.bat";
- } else {
- startScript = "./cassandra";
- }
-
- org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine(startScript)
- .addArgument("-f");
+ org.apache.commons.exec.CommandLine commandLine = new org.apache.commons.exec.CommandLine(getCommandLine(false,
+ "cassandra", "-f"));
Executor exeuctor = new DefaultExecutor();
exeuctor.setWorkingDirectory(storageBinDir);
exeuctor.setStreamHandler(new PumpStreamHandler());
10 years, 1 month
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java | 44 +---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java | 33 +++++--
2 files changed, 31 insertions(+), 46 deletions(-)
New commits:
commit cb023c1565b0dd622e362c4ecdf30d48c6c98ae1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 31 13:00:40 2013 -0400
[BZ 1021929] - Import context menu does not show plugin resource types when accessing by URL
Fix corner case where our implicit platform child types were not being
applied to platform types on initial entry of the type into the type respository.
This also reverts the prior fix which worked for the bug but did not solve
the root problem.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index 42f33d8..e26d94f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -23,7 +23,6 @@
package org.rhq.coregui.client.inventory.resource;
import java.util.ArrayList;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -52,7 +51,6 @@ import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
-import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.coregui.client.util.Log;
import org.rhq.coregui.client.util.RPCDataSource;
import org.rhq.coregui.client.util.TableUtility;
@@ -65,7 +63,6 @@ import org.rhq.coregui.client.util.message.Message.Severity;
public class ResourceCompositeSearchView extends ResourceSearchView {
private final ResourceComposite parentResourceComposite;
- private ResourceType parentResourceType;
private boolean initialized;
private List<Resource> singletonChildren;
private Set<ResourceType> creatableChildTypes;
@@ -89,28 +86,20 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
@Override
protected void onInit() {
- initMenus(true);
- }
-
- private void initMenus(boolean firstCall) {
+
// To properly filter Create Child and Import menus we need existing singleton child resources. If the
// user has create permission and the parent type has singleton child types and creatable or importable child
// types, perform an async call to fetch the singleton children. If we make the async call don't declare this
// instance initialized until after it completes as we must have the children before the menu buttons can be drawn.
final Resource parentResource = parentResourceComposite.getResource();
- if (parentResourceType == null && firstCall) {
- fetchResourceType();
- return;
- } else if (parentResourceType == null) {
- Log.error("Failed to load resources type for resource [" + parentResource + "]");
- return;
- }
- creatableChildTypes = getCreatableChildTypes(parentResourceType);
- importableChildTypes = getImportableChildTypes(parentResourceType);
+ ResourceType parentType = parentResource.getResourceType();
+ creatableChildTypes = getCreatableChildTypes(parentType);
+ importableChildTypes = getImportableChildTypes(parentType);
hasCreatableTypes = !creatableChildTypes.isEmpty();
hasImportableTypes = !importableChildTypes.isEmpty();
refreshSingletons(parentResource, new AsyncCallback<PageList<Resource>>() {
+
public void onFailure(Throwable caught) {
ResourceCompositeSearchView.super.onInit();
initialized = true;
@@ -120,7 +109,9 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
ResourceCompositeSearchView.super.onInit();
initialized = true;
}
+
});
+
}
private void refreshSingletons(final Resource parentResource, final AsyncCallback<PageList<Resource>> callback) {
@@ -176,7 +167,7 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
new AbstractTableAction(TableActionEnablement.ANY) {
// only enabled if all selected are a deletable type and if the user has delete permission
- // on the resources.
+ // on the resources.
public boolean isEnabled(ListGridRecord[] selection) {
boolean isEnabled = super.isEnabled(selection);
@@ -410,23 +401,4 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
});
}
-
- public void fetchResourceType() {
- // make sure we have all the Type information necessary to render the menus
- ResourceType type = parentResourceComposite.getResource().getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- type.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.subCategory,
- ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition,
- ResourceTypeRepository.MetadataType.measurements), new ResourceTypeRepository.TypeLoadedCallback() {
-
- public void onTypesLoaded(ResourceType type) {
- parentResourceType = type;
- initMenus(false);
- }
- });
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 9c591c7..8f5b0be 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -63,8 +63,8 @@ public class ResourceTypeRepository {
/**
* The following MetadadaTypes are subject to change and are always fetched from the database:<br/>
* driftDefinitionTemplates
- *
- * @author Jay Shaughnessy
+ *
+ * @author Jay Shaughnessy
*/
public enum MetadataType {
children, operations, measurements, content, events, pluginConfigurationDefinition, resourceConfigurationDefinition, subCategory, parentTypes, processScans, productVersions, driftDefinitionTemplates(
@@ -78,7 +78,7 @@ public class ResourceTypeRepository {
/**
* @param isFetchAlways if true then the cache for this metadata will be refreshed each time it is requested.
- * Meaning, the db will always be called because this metadata is subject to change.
+ * Meaning, the db will always be called because this metadata is subject to change.
*/
private MetadataType(boolean isFetchAlways) {
this.isFetchAlways = isFetchAlways;
@@ -221,8 +221,8 @@ public class ResourceTypeRepository {
// 2. we have the basic resource type but no additional metadata, but the caller is asking for additional metadata
// 3. we have the resource type and some additional metadata, but the caller is asking for metadata that we don't have
if (!typeCache.containsKey(typeId) // 1.
- || (!metadataTypes.isEmpty() && (!typeCacheLevel.containsKey(typeId) // 2.
- || !typeCacheLevel.get(typeId).containsAll(metadataTypes)))) // 3.
+ || (!metadataTypes.isEmpty() && (!typeCacheLevel.containsKey(typeId) // 2.
+ || !typeCacheLevel.get(typeId).containsAll(metadataTypes)))) // 3.
{
// add this type to the types we need to fetch
typesNeeded.add(typeId);
@@ -297,7 +297,7 @@ public class ResourceTypeRepository {
case bundleConfiguration:
criteria.fetchBundleConfiguration(true);
break;
-
+
default:
Log.error("Metadata type [" + metadataType.name() + "] not incorporated into ResourceType criteria.");
}
@@ -398,8 +398,7 @@ public class ResourceTypeRepository {
cachedType.setParentResourceTypes(type.getParentResourceTypes());
break;
case pluginConfigurationDefinition:
- cachedType
- .setPluginConfigurationDefinition(type.getPluginConfigurationDefinition());
+ cachedType.setPluginConfigurationDefinition(type.getPluginConfigurationDefinition());
break;
case processScans:
cachedType.setProcessScans(type.getProcessScans());
@@ -418,16 +417,30 @@ public class ResourceTypeRepository {
cachedType.setDriftDefinitionTemplates(type.getDriftDefinitionTemplates());
break;
case bundleConfiguration:
- cachedType.setResourceTypeBundleConfiguration(type.getResourceTypeBundleConfiguration());
+ cachedType.setResourceTypeBundleConfiguration(type
+ .getResourceTypeBundleConfiguration());
break;
default:
Log.error("ERROR: metadataType " + metadataType.name()
- + " not merged into cached ResourceType.");
+ + " not merged into cached ResourceType.");
}
}
}
cachedTypes.put(type.getId(), cachedType);
+
} else {
+ if (type.getCategory() == ResourceCategory.PLATFORM && topLevelServerAndServiceTypes != null
+ && metadataTypes.contains(MetadataType.children)) {
+ // Add server and service types with no parent types to the list of child types.
+ // These types are implicitly children of all platform types, even though they
+ // are not included in the platform types' childResourceTypes field.
+ if (null == type.getChildResourceTypes()) {
+ type.setChildResourceTypes(topLevelServerAndServiceTypes);
+ } else {
+ type.getChildResourceTypes().addAll(topLevelServerAndServiceTypes);
+ }
+ }
+
typeCache.put(type.getId(), type);
cachedTypes.put(type.getId(), type);
}
10 years, 1 month
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java | 44 +---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java | 33 +++++--
2 files changed, 31 insertions(+), 46 deletions(-)
New commits:
commit ab61147086e6d184fbd981508e454ac90b6ace11
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 31 13:00:40 2013 -0400
[BZ 1021929] - Import context menu does not show plugin resource types when accessing by URL
Fix corner case where our implicit platform child types were not being
applied to platform types on initial entry of the type into the type respository.
This also reverts the prior fix which worked for the bug but did not solve
the root problem.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index 42f33d8..e26d94f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -23,7 +23,6 @@
package org.rhq.coregui.client.inventory.resource;
import java.util.ArrayList;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -52,7 +51,6 @@ import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
-import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.coregui.client.util.Log;
import org.rhq.coregui.client.util.RPCDataSource;
import org.rhq.coregui.client.util.TableUtility;
@@ -65,7 +63,6 @@ import org.rhq.coregui.client.util.message.Message.Severity;
public class ResourceCompositeSearchView extends ResourceSearchView {
private final ResourceComposite parentResourceComposite;
- private ResourceType parentResourceType;
private boolean initialized;
private List<Resource> singletonChildren;
private Set<ResourceType> creatableChildTypes;
@@ -89,28 +86,20 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
@Override
protected void onInit() {
- initMenus(true);
- }
-
- private void initMenus(boolean firstCall) {
+
// To properly filter Create Child and Import menus we need existing singleton child resources. If the
// user has create permission and the parent type has singleton child types and creatable or importable child
// types, perform an async call to fetch the singleton children. If we make the async call don't declare this
// instance initialized until after it completes as we must have the children before the menu buttons can be drawn.
final Resource parentResource = parentResourceComposite.getResource();
- if (parentResourceType == null && firstCall) {
- fetchResourceType();
- return;
- } else if (parentResourceType == null) {
- Log.error("Failed to load resources type for resource [" + parentResource + "]");
- return;
- }
- creatableChildTypes = getCreatableChildTypes(parentResourceType);
- importableChildTypes = getImportableChildTypes(parentResourceType);
+ ResourceType parentType = parentResource.getResourceType();
+ creatableChildTypes = getCreatableChildTypes(parentType);
+ importableChildTypes = getImportableChildTypes(parentType);
hasCreatableTypes = !creatableChildTypes.isEmpty();
hasImportableTypes = !importableChildTypes.isEmpty();
refreshSingletons(parentResource, new AsyncCallback<PageList<Resource>>() {
+
public void onFailure(Throwable caught) {
ResourceCompositeSearchView.super.onInit();
initialized = true;
@@ -120,7 +109,9 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
ResourceCompositeSearchView.super.onInit();
initialized = true;
}
+
});
+
}
private void refreshSingletons(final Resource parentResource, final AsyncCallback<PageList<Resource>> callback) {
@@ -176,7 +167,7 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
new AbstractTableAction(TableActionEnablement.ANY) {
// only enabled if all selected are a deletable type and if the user has delete permission
- // on the resources.
+ // on the resources.
public boolean isEnabled(ListGridRecord[] selection) {
boolean isEnabled = super.isEnabled(selection);
@@ -410,23 +401,4 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
});
}
-
- public void fetchResourceType() {
- // make sure we have all the Type information necessary to render the menus
- ResourceType type = parentResourceComposite.getResource().getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- type.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.subCategory,
- ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition,
- ResourceTypeRepository.MetadataType.measurements), new ResourceTypeRepository.TypeLoadedCallback() {
-
- public void onTypesLoaded(ResourceType type) {
- parentResourceType = type;
- initMenus(false);
- }
- });
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 9c591c7..8f5b0be 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -63,8 +63,8 @@ public class ResourceTypeRepository {
/**
* The following MetadadaTypes are subject to change and are always fetched from the database:<br/>
* driftDefinitionTemplates
- *
- * @author Jay Shaughnessy
+ *
+ * @author Jay Shaughnessy
*/
public enum MetadataType {
children, operations, measurements, content, events, pluginConfigurationDefinition, resourceConfigurationDefinition, subCategory, parentTypes, processScans, productVersions, driftDefinitionTemplates(
@@ -78,7 +78,7 @@ public class ResourceTypeRepository {
/**
* @param isFetchAlways if true then the cache for this metadata will be refreshed each time it is requested.
- * Meaning, the db will always be called because this metadata is subject to change.
+ * Meaning, the db will always be called because this metadata is subject to change.
*/
private MetadataType(boolean isFetchAlways) {
this.isFetchAlways = isFetchAlways;
@@ -221,8 +221,8 @@ public class ResourceTypeRepository {
// 2. we have the basic resource type but no additional metadata, but the caller is asking for additional metadata
// 3. we have the resource type and some additional metadata, but the caller is asking for metadata that we don't have
if (!typeCache.containsKey(typeId) // 1.
- || (!metadataTypes.isEmpty() && (!typeCacheLevel.containsKey(typeId) // 2.
- || !typeCacheLevel.get(typeId).containsAll(metadataTypes)))) // 3.
+ || (!metadataTypes.isEmpty() && (!typeCacheLevel.containsKey(typeId) // 2.
+ || !typeCacheLevel.get(typeId).containsAll(metadataTypes)))) // 3.
{
// add this type to the types we need to fetch
typesNeeded.add(typeId);
@@ -297,7 +297,7 @@ public class ResourceTypeRepository {
case bundleConfiguration:
criteria.fetchBundleConfiguration(true);
break;
-
+
default:
Log.error("Metadata type [" + metadataType.name() + "] not incorporated into ResourceType criteria.");
}
@@ -398,8 +398,7 @@ public class ResourceTypeRepository {
cachedType.setParentResourceTypes(type.getParentResourceTypes());
break;
case pluginConfigurationDefinition:
- cachedType
- .setPluginConfigurationDefinition(type.getPluginConfigurationDefinition());
+ cachedType.setPluginConfigurationDefinition(type.getPluginConfigurationDefinition());
break;
case processScans:
cachedType.setProcessScans(type.getProcessScans());
@@ -418,16 +417,30 @@ public class ResourceTypeRepository {
cachedType.setDriftDefinitionTemplates(type.getDriftDefinitionTemplates());
break;
case bundleConfiguration:
- cachedType.setResourceTypeBundleConfiguration(type.getResourceTypeBundleConfiguration());
+ cachedType.setResourceTypeBundleConfiguration(type
+ .getResourceTypeBundleConfiguration());
break;
default:
Log.error("ERROR: metadataType " + metadataType.name()
- + " not merged into cached ResourceType.");
+ + " not merged into cached ResourceType.");
}
}
}
cachedTypes.put(type.getId(), cachedType);
+
} else {
+ if (type.getCategory() == ResourceCategory.PLATFORM && topLevelServerAndServiceTypes != null
+ && metadataTypes.contains(MetadataType.children)) {
+ // Add server and service types with no parent types to the list of child types.
+ // These types are implicitly children of all platform types, even though they
+ // are not included in the platform types' childResourceTypes field.
+ if (null == type.getChildResourceTypes()) {
+ type.setChildResourceTypes(topLevelServerAndServiceTypes);
+ } else {
+ type.getChildResourceTypes().addAll(topLevelServerAndServiceTypes);
+ }
+ }
+
typeCache.put(type.getId(), type);
cachedTypes.put(type.getId(), type);
}
10 years, 1 month
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by snegrea
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 84 ++++++----
1 file changed, 55 insertions(+), 29 deletions(-)
New commits:
commit c8f4da3b4219226a28b54c8aa28bedec97321c85
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Oct 31 08:23:50 2013 -0500
[BZ 1024326] The storage node information was not retrieved from the database like all the other store cluster settings. Added code to retrieve the stroge node addresses from the respective table as a comma separated list.
(cherry picked from commit 3ad624245b2655c6af86522e0acd74d6bbd1de59)
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index b4db4e0..3dcaafa 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -70,6 +70,7 @@ import org.rhq.core.db.OracleDatabaseType;
import org.rhq.core.db.PostgresqlDatabaseType;
import org.rhq.core.db.setup.DBSetup;
import org.rhq.core.domain.cloud.StorageNode;
+import org.rhq.core.domain.cloud.StorageNode.OperationMode;
import org.rhq.core.util.PropertiesFileUpdate;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.core.util.file.FileUtil;
@@ -930,7 +931,6 @@ public class ServerInstallUtil {
throw new IllegalArgumentException("Unknown database type, can't continue: " + db);
}
- connection = getDatabaseConnection(dbUrl, userName, password);
queryStatement = connection.createStatement();
resultSet = queryStatement.executeQuery("SELECT count(id) FROM rhq_storage_node");
resultSet.next();
@@ -983,10 +983,11 @@ public class ServerInstallUtil {
public static Map<String, String> fetchStorageClusterSettings(HashMap<String, String> serverProperties,
String password) throws Exception {
- Map<String, String> result = new HashMap<String, String>(4);
+ Map<String, String> result = new HashMap<String, String>(5);
DatabaseType db = null;
Connection connection = null;
PreparedStatement statement = null;
+ ResultSet resultSet = null;
try {
String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
@@ -998,39 +999,64 @@ public class ServerInstallUtil {
throw new IllegalArgumentException("Unknown database type, can't continue: " + db);
}
- connection = getDatabaseConnection(dbUrl, userName, password);
- connection.setAutoCommit(false);
-
- statement = connection.prepareStatement("" //
- + "SELECT property_key, property_value FROM rhq_system_config " //
- + " WHERE property_key LIKE 'STORAGE%' " //
- + " AND NOT property_value IS NULL ");
- ResultSet rs = statement.executeQuery();
-
- while (rs.next()) {
- String key = rs.getString(1);
- String value = rs.getString(2);
-
- if (key.equals("STORAGE_USERNAME")) {
- result.put(ServerProperties.PROP_STORAGE_USERNAME, value);
- } else if (key.equals("STORAGE_PASSWORD")) {
- result.put(ServerProperties.PROP_STORAGE_PASSWORD, value);
- } else if (key.equals("STORAGE_GOSSIP_PORT")) {
- result.put(ServerProperties.PROP_STORAGE_GOSSIP_PORT, value);
- } else if (key.equals("STORAGE_CQL_PORT")) {
- result.put(ServerProperties.PROP_STORAGE_CQL_PORT, value);
+ try {
+ statement = connection.prepareStatement("" //
+ + "SELECT property_key, property_value FROM rhq_system_config " //
+ + " WHERE property_key LIKE 'STORAGE%' " //
+ + " AND NOT property_value IS NULL ");
+ resultSet = statement.executeQuery();
+
+ while (resultSet.next()) {
+ String key = resultSet.getString(1);
+ String value = resultSet.getString(2);
+
+ if (key.equals("STORAGE_USERNAME")) {
+ result.put(ServerProperties.PROP_STORAGE_USERNAME, value);
+ } else if (key.equals("STORAGE_PASSWORD")) {
+ result.put(ServerProperties.PROP_STORAGE_PASSWORD, value);
+ } else if (key.equals("STORAGE_GOSSIP_PORT")) {
+ result.put(ServerProperties.PROP_STORAGE_GOSSIP_PORT, value);
+ } else if (key.equals("STORAGE_CQL_PORT")) {
+ result.put(ServerProperties.PROP_STORAGE_CQL_PORT, value);
+ }
}
+ } finally {
+ db.closeResultSet(resultSet);
+ db.closeStatement(statement);
}
- connection.commit();
+ try {
+ statement = connection.prepareStatement("" //
+ + "SELECT address FROM rhq_storage_node " //
+ + " WHERE operation_mode in " + "('" + OperationMode.NORMAL.name()
+ + "', '"
+ + OperationMode.INSTALLED.name() + "') ");
+ resultSet = statement.executeQuery();
+
+ StringBuffer addressList = new StringBuffer();
+ while (resultSet.next()) {
+ String address = resultSet.getString(1);
+
+ if(address != null && !address.trim().isEmpty()){
+ if (addressList.length() != 0) {
+ addressList.append(',');
+ }
+ addressList.append(address);
+ }
+ }
+ if (addressList.length() != 0) {
+ result.put(ServerProperties.PROP_STORAGE_NODES, addressList.toString());
+ }
+ } finally {
+ db.closeResultSet(resultSet);
+ db.closeStatement(statement);
+ }
} catch (SQLException e) {
- LOG.error("Failed to fetch storage cluster settings. Transaction will be rolled back.", e);
- connection.rollback();
+ LOG.error("Failed to fetch storage cluster settings.", e);
throw e;
} finally {
if (db != null) {
- db.closeStatement(statement);
db.closeConnection(connection);
}
}
@@ -1631,9 +1657,9 @@ public class ServerInstallUtil {
* Create an rhqadmin management user so when discovered, the AS7 plugin can use it to connect
* to the RHQ Server. The password is set in rhq-server.properties. Because the plugin can't guess
* the password, if not set to the default then the AS7 plugin will fail to connect, and the
- * RHQ Server resource connection properties will need to be updated after discovery and import.
+ * RHQ Server resource connection properties will need to be updated after discovery and import.
*
- * @param password the management password
+ * @param password the management password
* @param serverDetails details of the server being installed
* @param configDirStr location of a configuration directory where the mgmt-users.properties file lives
*/
10 years, 1 month
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit ec34b83d33315aa75c6d1fef38745c2441c15e5c
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Oct 31 03:48:39 2013 +0100
Fixing the IllegalStateException (There is no storage node metadata
stored in the relational database) when installing clean dev container
The rhq_storage_node table was empty => exception was thrown preventing
the rhq server to start. Adding the
storageNodeSchemaManager.getStorageNodeAddresses() call to the final
clause should ensure that the storage node info is persisted into
relational db.
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 9dcdbc9..51da755 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -550,23 +550,21 @@ public class InstallerServiceImpl implements InstallerService {
storageNodeSchemaManager.drop();
}
- try{
+ try {
storageNodeSchemaManager.checkCompatibility();
} catch (AuthenticationException e1) {
log("Install RHQ schema along with updates to storage nodes.");
storageNodeSchemaManager.install();
storageNodeSchemaManager.updateTopology();
- storageNodeAddresses = storageNodeSchemaManager.getStorageNodeAddresses();
} catch (SchemaNotInstalledException e2) {
log("Install RHQ schema along with updates to storage nodes.");
storageNodeSchemaManager.install();
storageNodeSchemaManager.updateTopology();
- storageNodeAddresses = storageNodeSchemaManager.getStorageNodeAddresses();
} catch (InstalledSchemaTooOldException e3) {
log("Install RHQ schema updates to storage cluster.");
storageNodeSchemaManager.install();
- storageNodeAddresses = storageNodeSchemaManager.getStorageNodeAddresses();
} finally {
+ storageNodeAddresses = storageNodeSchemaManager.getStorageNodeAddresses();
storageNodeSchemaManager.shutdown();
}
} else {
10 years, 1 month
[rhq] modules/enterprise
by snegrea
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 84 ++++++----
1 file changed, 55 insertions(+), 29 deletions(-)
New commits:
commit 3ad624245b2655c6af86522e0acd74d6bbd1de59
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Oct 30 16:54:35 2013 -0500
[BZ 1024326] The storage node information was not retrieved from the database like all the other store cluster settings. Added code to retrieve the stroge node addresses from the respective table as a comma separated list.
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index b4db4e0..3dcaafa 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -70,6 +70,7 @@ import org.rhq.core.db.OracleDatabaseType;
import org.rhq.core.db.PostgresqlDatabaseType;
import org.rhq.core.db.setup.DBSetup;
import org.rhq.core.domain.cloud.StorageNode;
+import org.rhq.core.domain.cloud.StorageNode.OperationMode;
import org.rhq.core.util.PropertiesFileUpdate;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.core.util.file.FileUtil;
@@ -930,7 +931,6 @@ public class ServerInstallUtil {
throw new IllegalArgumentException("Unknown database type, can't continue: " + db);
}
- connection = getDatabaseConnection(dbUrl, userName, password);
queryStatement = connection.createStatement();
resultSet = queryStatement.executeQuery("SELECT count(id) FROM rhq_storage_node");
resultSet.next();
@@ -983,10 +983,11 @@ public class ServerInstallUtil {
public static Map<String, String> fetchStorageClusterSettings(HashMap<String, String> serverProperties,
String password) throws Exception {
- Map<String, String> result = new HashMap<String, String>(4);
+ Map<String, String> result = new HashMap<String, String>(5);
DatabaseType db = null;
Connection connection = null;
PreparedStatement statement = null;
+ ResultSet resultSet = null;
try {
String dbUrl = serverProperties.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
@@ -998,39 +999,64 @@ public class ServerInstallUtil {
throw new IllegalArgumentException("Unknown database type, can't continue: " + db);
}
- connection = getDatabaseConnection(dbUrl, userName, password);
- connection.setAutoCommit(false);
-
- statement = connection.prepareStatement("" //
- + "SELECT property_key, property_value FROM rhq_system_config " //
- + " WHERE property_key LIKE 'STORAGE%' " //
- + " AND NOT property_value IS NULL ");
- ResultSet rs = statement.executeQuery();
-
- while (rs.next()) {
- String key = rs.getString(1);
- String value = rs.getString(2);
-
- if (key.equals("STORAGE_USERNAME")) {
- result.put(ServerProperties.PROP_STORAGE_USERNAME, value);
- } else if (key.equals("STORAGE_PASSWORD")) {
- result.put(ServerProperties.PROP_STORAGE_PASSWORD, value);
- } else if (key.equals("STORAGE_GOSSIP_PORT")) {
- result.put(ServerProperties.PROP_STORAGE_GOSSIP_PORT, value);
- } else if (key.equals("STORAGE_CQL_PORT")) {
- result.put(ServerProperties.PROP_STORAGE_CQL_PORT, value);
+ try {
+ statement = connection.prepareStatement("" //
+ + "SELECT property_key, property_value FROM rhq_system_config " //
+ + " WHERE property_key LIKE 'STORAGE%' " //
+ + " AND NOT property_value IS NULL ");
+ resultSet = statement.executeQuery();
+
+ while (resultSet.next()) {
+ String key = resultSet.getString(1);
+ String value = resultSet.getString(2);
+
+ if (key.equals("STORAGE_USERNAME")) {
+ result.put(ServerProperties.PROP_STORAGE_USERNAME, value);
+ } else if (key.equals("STORAGE_PASSWORD")) {
+ result.put(ServerProperties.PROP_STORAGE_PASSWORD, value);
+ } else if (key.equals("STORAGE_GOSSIP_PORT")) {
+ result.put(ServerProperties.PROP_STORAGE_GOSSIP_PORT, value);
+ } else if (key.equals("STORAGE_CQL_PORT")) {
+ result.put(ServerProperties.PROP_STORAGE_CQL_PORT, value);
+ }
}
+ } finally {
+ db.closeResultSet(resultSet);
+ db.closeStatement(statement);
}
- connection.commit();
+ try {
+ statement = connection.prepareStatement("" //
+ + "SELECT address FROM rhq_storage_node " //
+ + " WHERE operation_mode in " + "('" + OperationMode.NORMAL.name()
+ + "', '"
+ + OperationMode.INSTALLED.name() + "') ");
+ resultSet = statement.executeQuery();
+
+ StringBuffer addressList = new StringBuffer();
+ while (resultSet.next()) {
+ String address = resultSet.getString(1);
+
+ if(address != null && !address.trim().isEmpty()){
+ if (addressList.length() != 0) {
+ addressList.append(',');
+ }
+ addressList.append(address);
+ }
+ }
+ if (addressList.length() != 0) {
+ result.put(ServerProperties.PROP_STORAGE_NODES, addressList.toString());
+ }
+ } finally {
+ db.closeResultSet(resultSet);
+ db.closeStatement(statement);
+ }
} catch (SQLException e) {
- LOG.error("Failed to fetch storage cluster settings. Transaction will be rolled back.", e);
- connection.rollback();
+ LOG.error("Failed to fetch storage cluster settings.", e);
throw e;
} finally {
if (db != null) {
- db.closeStatement(statement);
db.closeConnection(connection);
}
}
@@ -1631,9 +1657,9 @@ public class ServerInstallUtil {
* Create an rhqadmin management user so when discovered, the AS7 plugin can use it to connect
* to the RHQ Server. The password is set in rhq-server.properties. Because the plugin can't guess
* the password, if not set to the default then the AS7 plugin will fail to connect, and the
- * RHQ Server resource connection properties will need to be updated after discovery and import.
+ * RHQ Server resource connection properties will need to be updated after discovery and import.
*
- * @param password the management password
+ * @param password the management password
* @param serverDetails details of the server being installed
* @param configDirStr location of a configuration directory where the mgmt-users.properties file lives
*/
10 years, 1 month
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by Jiri Kremser
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java | 41 ++++++++--
1 file changed, 34 insertions(+), 7 deletions(-)
New commits:
commit 66494e0742126de409acd97bff9744f18b4de8f4
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Oct 30 19:16:37 2013 +0100
[BZ 1021929] - Import context menu does not show plugin resource types when accessing by URL
Using the ResourceTypeRepository to fetch the resource type (with the
ResourceTypeRepository.MetadataType.children and other metadata set)
(cherry picked from commit 028ca82da5b4125bcc06b141cb2cd0709ac17c80)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index a5b15b4..42f33d8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -23,6 +23,7 @@
package org.rhq.coregui.client.inventory.resource;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -51,6 +52,7 @@ import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
+import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.coregui.client.util.Log;
import org.rhq.coregui.client.util.RPCDataSource;
import org.rhq.coregui.client.util.TableUtility;
@@ -63,6 +65,7 @@ import org.rhq.coregui.client.util.message.Message.Severity;
public class ResourceCompositeSearchView extends ResourceSearchView {
private final ResourceComposite parentResourceComposite;
+ private ResourceType parentResourceType;
private boolean initialized;
private List<Resource> singletonChildren;
private Set<ResourceType> creatableChildTypes;
@@ -86,20 +89,28 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
@Override
protected void onInit() {
-
+ initMenus(true);
+ }
+
+ private void initMenus(boolean firstCall) {
// To properly filter Create Child and Import menus we need existing singleton child resources. If the
// user has create permission and the parent type has singleton child types and creatable or importable child
// types, perform an async call to fetch the singleton children. If we make the async call don't declare this
// instance initialized until after it completes as we must have the children before the menu buttons can be drawn.
final Resource parentResource = parentResourceComposite.getResource();
- ResourceType parentType = parentResource.getResourceType();
- creatableChildTypes = getCreatableChildTypes(parentType);
- importableChildTypes = getImportableChildTypes(parentType);
+ if (parentResourceType == null && firstCall) {
+ fetchResourceType();
+ return;
+ } else if (parentResourceType == null) {
+ Log.error("Failed to load resources type for resource [" + parentResource + "]");
+ return;
+ }
+ creatableChildTypes = getCreatableChildTypes(parentResourceType);
+ importableChildTypes = getImportableChildTypes(parentResourceType);
hasCreatableTypes = !creatableChildTypes.isEmpty();
hasImportableTypes = !importableChildTypes.isEmpty();
refreshSingletons(parentResource, new AsyncCallback<PageList<Resource>>() {
-
public void onFailure(Throwable caught) {
ResourceCompositeSearchView.super.onInit();
initialized = true;
@@ -109,9 +120,7 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
ResourceCompositeSearchView.super.onInit();
initialized = true;
}
-
});
-
}
private void refreshSingletons(final Resource parentResource, final AsyncCallback<PageList<Resource>> callback) {
@@ -401,5 +410,23 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
});
}
+
+ public void fetchResourceType() {
+ // make sure we have all the Type information necessary to render the menus
+ ResourceType type = parentResourceComposite.getResource().getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ type.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.measurements), new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+ parentResourceType = type;
+ initMenus(false);
+ }
+ });
+ }
}
10 years, 1 month
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java | 41 ++++++++--
1 file changed, 34 insertions(+), 7 deletions(-)
New commits:
commit 028ca82da5b4125bcc06b141cb2cd0709ac17c80
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Oct 30 19:16:37 2013 +0100
[BZ 1021929] - Import context menu does not show plugin resource types when accessing by URL
Using the ResourceTypeRepository to fetch the resource type (with the
ResourceTypeRepository.MetadataType.children and other metadata set)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index a5b15b4..42f33d8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -23,6 +23,7 @@
package org.rhq.coregui.client.inventory.resource;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -51,6 +52,7 @@ import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
+import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.coregui.client.util.Log;
import org.rhq.coregui.client.util.RPCDataSource;
import org.rhq.coregui.client.util.TableUtility;
@@ -63,6 +65,7 @@ import org.rhq.coregui.client.util.message.Message.Severity;
public class ResourceCompositeSearchView extends ResourceSearchView {
private final ResourceComposite parentResourceComposite;
+ private ResourceType parentResourceType;
private boolean initialized;
private List<Resource> singletonChildren;
private Set<ResourceType> creatableChildTypes;
@@ -86,20 +89,28 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
@Override
protected void onInit() {
-
+ initMenus(true);
+ }
+
+ private void initMenus(boolean firstCall) {
// To properly filter Create Child and Import menus we need existing singleton child resources. If the
// user has create permission and the parent type has singleton child types and creatable or importable child
// types, perform an async call to fetch the singleton children. If we make the async call don't declare this
// instance initialized until after it completes as we must have the children before the menu buttons can be drawn.
final Resource parentResource = parentResourceComposite.getResource();
- ResourceType parentType = parentResource.getResourceType();
- creatableChildTypes = getCreatableChildTypes(parentType);
- importableChildTypes = getImportableChildTypes(parentType);
+ if (parentResourceType == null && firstCall) {
+ fetchResourceType();
+ return;
+ } else if (parentResourceType == null) {
+ Log.error("Failed to load resources type for resource [" + parentResource + "]");
+ return;
+ }
+ creatableChildTypes = getCreatableChildTypes(parentResourceType);
+ importableChildTypes = getImportableChildTypes(parentResourceType);
hasCreatableTypes = !creatableChildTypes.isEmpty();
hasImportableTypes = !importableChildTypes.isEmpty();
refreshSingletons(parentResource, new AsyncCallback<PageList<Resource>>() {
-
public void onFailure(Throwable caught) {
ResourceCompositeSearchView.super.onInit();
initialized = true;
@@ -109,9 +120,7 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
ResourceCompositeSearchView.super.onInit();
initialized = true;
}
-
});
-
}
private void refreshSingletons(final Resource parentResource, final AsyncCallback<PageList<Resource>> callback) {
@@ -401,5 +410,23 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
});
}
+
+ public void fetchResourceType() {
+ // make sure we have all the Type information necessary to render the menus
+ ResourceType type = parentResourceComposite.getResource().getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ type.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.measurements), new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+ parentResourceType = type;
+ initMenus(false);
+ }
+ });
+ }
}
10 years, 1 month
[rhq] modules/enterprise
by Thomas Segismont
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/factory/ResourceFactoryInfoStep.java | 10 ----------
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_cs.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_de.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ja.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ko.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_pt.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ru.properties | 1 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_zh.properties | 1 -
9 files changed, 18 deletions(-)
New commits:
commit 3cee61d26c5151750a727502fd5c95c4bf715a18
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Oct 30 15:34:28 2013 +0100
Bug 1011095 - Give created resources the name supplied by the user even if the managed object has no "name" attribute
Revert "Bug 886119 - JON is using JNDI when referring to child Datasource resource instead of specified Resource name"
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/factory/ResourceFactoryInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/factory/ResourceFactoryInfoStep.java
index 0f7c810..b93c400 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/factory/ResourceFactoryInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/resource/factory/ResourceFactoryInfoStep.java
@@ -18,8 +18,6 @@
*/
package org.rhq.coregui.client.inventory.resource.factory;
-import static java.lang.Boolean.FALSE;
-
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -32,7 +30,6 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
@@ -102,13 +99,6 @@ public class ResourceFactoryInfoStep extends AbstractWizardStep {
}
});
formItems.add(nameItem);
-
- StaticTextItem commentItem = new StaticTextItem("resourceNameComment");
- commentItem.setWidth(300);
- commentItem.setTextBoxStyle("InlineInfo");
- commentItem.setShowTitle(FALSE);
- commentItem.setValue(MSG.widget_resourceFactoryWizard_nameComment());
- formItems.add(commentItem);
}
if (null != versionPrompt) {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages.properties
index e773d98..030174c 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages.properties
@@ -2322,7 +2322,6 @@ widget_resourceFactoryWizard_importWizardTitle = Import Resource of Type [{0}]
widget_resourceFactoryWizard_importWizardWindowTitle = Resource Import Wizard
widget_resourceFactoryWizard_infoStepName = Resource Information
widget_resourceFactoryWizard_infoStep_loadFail = Failed to get available Architectures
-widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
widget_resourceFactoryWizard_namePrompt = New Resource Name
widget_resourceFactoryWizard_templatePrompt = Connection Settings Template
widget_resourceFactoryWizard_timeoutFailure = Timed out
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_cs.properties
index 7c80bbb..c4e70d6 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_cs.properties
@@ -2337,7 +2337,6 @@ widget_resourceFactoryWizard_importWizardWindowTitle = Průvodce importu zdroje
widget_resourceFactoryWizard_infoStepName = Informace o zdroji
widget_resourceFactoryWizard_infoStep_loadFail = Nepodařilo se získat dostupné architektury
widget_resourceFactoryWizard_namePrompt = Nové jméno zdroje
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
widget_resourceFactoryWizard_templatePrompt = Šablona pro nastavení připojení
##widget_resourceFactoryWizard_timeoutFailure = Timed out
##widget_resourceFactoryWizard_timeoutHelp = A timeout duration that if specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. A higher value may be useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure. Note that if there is a timeout failure, it is still possible that the resource deployment succeeded. In the event of a timeout you may want to execute a discovery scan before attempting to redeploy the resource.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_de.properties
index b5e02cc..513c06e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_de.properties
@@ -2172,7 +2172,6 @@ widget_resourceFactoryWizard_importWizardWindowTitle = Wizard zum Import von Res
widget_resourceFactoryWizard_infoStepName = Information über die Ressource
widget_resourceFactoryWizard_infoStep_loadFail = Konnte die verfügbaren Architekturen nicht ermitteln
widget_resourceFactoryWizard_namePrompt = Name der neuen Ressource
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
widget_resourceFactoryWizard_templatePrompt = Vorlage für die Verbindungseinstellungen
##widget_resourceFactoryWizard_timeoutHelp = A timeout duration that if specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. A higher value may be useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure. Note that if there is a timeout failure, it is still possible that the resource deployment succeeded. In the event of a timeout you may want to execute a discovery scan before attempting to redeploy the resource.
widget_resourceFactoryWizard_uploadFailure = Konnte die Datei nicht hochladen
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ja.properties
index 6a35cd2..d51d2d3 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ja.properties
@@ -2307,7 +2307,6 @@ widget_resourceFactoryWizard_importWizardWindowTitle = リソースインポー
widget_resourceFactoryWizard_infoStepName = リソース情報
widget_resourceFactoryWizard_infoStep_loadFail = アーキテクチャーを利用可能にするのに失敗しました
widget_resourceFactoryWizard_namePrompt = 新規リソース名
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
widget_resourceFactoryWizard_templatePrompt = コネクション設定テンプレート
###widget_resourceFactoryWizard_timeoutFailure = Timed out
##widget_resourceFactoryWizard_timeoutHelp = A timeout duration that if specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. A higher value may be useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure. Note that if there is a timeout failure, it is still possible that the resource deployment succeeded. In the event of a timeout you may want to execute a discovery scan before attempting to redeploy the resource.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ko.properties
index 96d4562..cfda9c4 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ko.properties
@@ -1940,7 +1940,6 @@ widget_resourceFactoryWizard_importFailure2 = 수동으로 리소스를 가져
widget_resourceFactoryWizard_importWizardWindowTitle = 리소스 가져오기 마법사
widget_resourceFactoryWizard_infoStepName = 리소스 정보
widget_resourceFactoryWizard_namePrompt = 새 리소스 이름
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
widget_resourceFactoryWizard_timeoutFailure = 타임 아웃
widget_resourceFactoryWizard_versionPrompt = 패키지 버전
widget_resourceSelector_pleaseSelectMultipleResource = 하나 이상의 리소스를 선택하십시오
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_pt.properties
index 6ab2d30..c4f273a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_pt.properties
@@ -2424,7 +2424,6 @@ widget_resourceFactoryWizard_importWizardWindowTitle = Assistente para Importa\u
widget_resourceFactoryWizard_infoStepName = Informa\u00E7\u00E3o do Recurso
widget_resourceFactoryWizard_infoStep_loadFail = Falha ao recuperar Arquiteturas dispon\u00EDveis.
widget_resourceFactoryWizard_namePrompt = Novo Nome do Recurso
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
widget_resourceFactoryWizard_templatePrompt = Modelo de Propriedades para Conex\u00E3o
##widget_resourceFactoryWizard_timeoutFailure = Timed out
##widget_resourceFactoryWizard_timeoutHelp = A timeout duration that if specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. A higher value may be useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure. Note that if there is a timeout failure, it is still possible that the resource deployment succeeded. In the event of a timeout you may want to execute a discovery scan before attempting to redeploy the resource.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ru.properties
index 6fb04a0..3ac439d 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_ru.properties
@@ -2183,7 +2183,6 @@
#widget_resourceFactoryWizard_infoStepName = Resource Information
#widget_resourceFactoryWizard_infoStep_loadFail = Failed to get available Architectures
#widget_resourceFactoryWizard_namePrompt = New Resource Name
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
#widget_resourceFactoryWizard_templatePrompt = Connection Settings Template
#widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
#widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_zh.properties
index 80614c3..c416115 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/Messages_zh.properties
@@ -2307,7 +2307,6 @@ widget_resourceFactoryWizard_importWizardWindowTitle = \u5bfc\u5165\u8d44\u6e90\
widget_resourceFactoryWizard_infoStepName = \u8d44\u6e90\u6d88\u606f
widget_resourceFactoryWizard_infoStep_loadFail = \u65e0\u6cd5\u53d6\u5f97\u67b6\u6784
widget_resourceFactoryWizard_namePrompt = \u65b0\u8d44\u6e90\u540d
-#widget_resourceFactoryWizard_nameComment = Not all management plug-ins or their managed resources allow the agent to set the name for a new resource. This value will only be used by agent plug-ins that support the capability. For plug-ins that do not support the capability, the resource may receive a generic or different name when it is discovered.
#widget_resourceFactoryWizard_templatePrompt = \u8fde\u63a5\u8bbe\u7f6e\u6a21\u677f
#widget_resourceFactoryWizard_timeoutHelp = A timeout duration that if specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. A higher value may be useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure. Note that if there is a timeout failure, it is still possible that the resource deployment succeeded. In the event of a timeout you may want to execute a discovery scan before attempting to redeploy the resource.
#widget_resourceFactoryWizard_timeoutFailure = Timed out
10 years, 1 month