modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java | 4 modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataRequest.java | 61 + modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java | 8 modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java | 13 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 13 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 14 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java | 85 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 14 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 8 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java | 12 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 10 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java | 12 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 8 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 1 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 14 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 14 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java | 8 modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/proxy/ResourceClientProxy.java | 4 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 30 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java | 25 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/TemporarySessionPasswordGenerator.java | 259 ------- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java | 14 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/jaas/TempSessionLoginModule.java | 100 -- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java | 17 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java | 23 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerLocal.java | 3 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java | 8 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java | 7 modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java | 358 ---------- modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml | 17 modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml | 79 -- modules/plugins/jboss-as-5/testsuite/src/main/java/org/rhq/plugins/jbossas5/JBossServerTest.java | 13 35 files changed, 272 insertions(+), 991 deletions(-)
New commits: commit 58c4c2c16107e05136cddbb8322731dd12146892 Merge: 28acd40... 74c6ac2... Author: Heiko W. Rupp hwr@redhat.com Date: Thu Oct 14 12:40:28 2010 +0200
Merge branch 'master' into perftest
commit 74c6ac20bd7ff5f12842f6a2c5962f8a3b179fee Author: John Mazzitelli mazz@redhat.com Date: Wed Oct 13 15:15:08 2010 -0400
need to populate the operations drop down when changing the descendant selection
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java index b2e9c05..e1bad9b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java @@ -172,7 +172,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio ancestorTypeSelectItem.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { - populateRelativeDescendantsDropDownMenu(null); + populateRelativeDescendantsDropDownMenu(null, null, null); } });
@@ -186,6 +186,12 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio descendantTypeSelectItem .setTooltip("The resource type to search for under the root type defined in the Start Search From selection."); descendantTypeSelectItem.setShowIfCondition(new ShowIfModeFunction(ResourceSelectionMode.RELATIVE)); + descendantTypeSelectItem.addChangedHandler(new ChangedHandler() { + @Override + public void onChanged(ChangedEvent event) { + setOperationDropDownMenuValues(Integer.valueOf(event.getItem().getValue().toString()), null, null); + } + });
descendantNameTextItem = new TextItem("descendantNameTextItem"); descendantNameTextItem.setStartRow(false); @@ -229,7 +235,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio descendantTypeSelectItem.clearValue(); descendantNameTextItem.clearValue(); hideOperationDropDownMenu(); - populateRelativeDropDownMenus(null, null); + populateRelativeDropDownMenus(null, null, null, null); break; } } @@ -260,7 +266,8 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio break; } case RELATIVE: { - populateRelativeDropDownMenus(notifInfo.getAncestorTypeId(), notifInfo.getDescendantTypeId()); + populateRelativeDropDownMenus(notifInfo.getAncestorTypeId(), notifInfo.getDescendantTypeId(), notifInfo + .getOperationId(), notifInfo.getOperationArguments()); if (notifInfo.getDescendantName() != null) { descendantNameTextItem.setValue(notifInfo.getDescendantName()); } @@ -274,7 +281,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio }
private void populateRelativeDropDownMenus(final Integer selectedResourceTypeId, - final Integer descendantResourceTypeId) { + final Integer descendantResourceTypeId, final Integer selectedOpId, final Configuration opArgs) {
if (ancestorTypeSelectItem.getValue() == null) { AsyncCallback<ArrayList<ResourceType>> callback = new AsyncCallback<ArrayList<ResourceType>>() { @@ -290,7 +297,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio } else { ancestorTypeSelectItem.setValue(String.valueOf(results.get(0).getId())); } - populateRelativeDescendantsDropDownMenu(descendantResourceTypeId); + populateRelativeDescendantsDropDownMenu(descendantResourceTypeId, selectedOpId, opArgs); }
@Override @@ -306,10 +313,13 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio GWTServiceLookup.getResourceTypeGWTService().getAllResourceTypeAncestors(this.resourceType.getId(), callback); } + } else { + populateRelativeDescendantsDropDownMenu(descendantResourceTypeId, selectedOpId, opArgs); } }
- private void populateRelativeDescendantsDropDownMenu(final Integer selectedDescendantResourceTypeId) { + private void populateRelativeDescendantsDropDownMenu(final Integer selectedDescendantResourceTypeId, + final Integer selectedOpId, final Configuration opArgs) { Object rootResourceTypeIdObj = ancestorTypeSelectItem.getValue(); final int rootResourceTypeId;
@@ -331,9 +341,13 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio descendantTypeSelectItem.setValueMap(map); if (selectedDescendantResourceTypeId != null) { descendantTypeSelectItem.setValue(selectedDescendantResourceTypeId.toString()); + setOperationDropDownMenuValues(selectedDescendantResourceTypeId.intValue(), selectedOpId, + opArgs); } else { descendantTypeSelectItem.setValue(String.valueOf(rootResourceTypeId)); + setOperationDropDownMenuValues(rootResourceTypeId, selectedOpId, opArgs); } + }
@Override @@ -394,10 +408,10 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio * If args is non-null (and if opId is non-null), this will pre-populate the argument config editor. * * @param resourceTypeId the type whose operation definitions are to be shown in the operation drop down menu - * @param opId if not-null, the selected operation + * @param selectedOpId if not-null, the selected operation * @param args if not-null (and opId is not null), this will prepopulate the argument config */ - private void setOperationDropDownMenuValues(int resourceTypeId, final Integer opId, final Configuration args) { + private void setOperationDropDownMenuValues(int resourceTypeId, final Integer selectedOpId, final Configuration args) { ResourceTypeCriteria criteria = new ResourceTypeCriteria(); criteria.addFilterId(resourceTypeId); criteria.fetchOperationDefinitions(true); @@ -423,9 +437,10 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio } operationSelectItem.setAttribute(OPERATION_DEFS_ATTRIBUTE, (Object) opDefs); operationSelectItem.setValueMap(valueMap); - if (opId != null && opId > 0 && opDefs.containsKey(opId)) { - operationSelectItem.setValue(String.valueOf(opId)); - showOperationArguments(opDefs.get(opId).getParametersConfigurationDefinition(), args); + if (selectedOpId != null && selectedOpId > 0 && opDefs.containsKey(selectedOpId)) { + operationSelectItem.setValue(String.valueOf(selectedOpId)); + showOperationArguments(opDefs.get(selectedOpId).getParametersConfigurationDefinition(), + args); } else { operationSelectItem.clearValue(); // sets it to the default hideOperationArguments();
commit 3b9b30f9582b0255ba2425b91dfa60735e8184b1 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Oct 13 14:18:04 2010 -0400
Changes to let selenium locators properly identify the nodes. I'm not sure why we were passing the "new TreeNode[0]" as a child in the constructors, it doesn't seem right, does not seem to adversely affect our tree creation (perhaps it will help?) and removal seems to solve the selenium issue.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java index 41e70c6..f4b69ae 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java @@ -27,11 +27,16 @@ import org.rhq.core.domain.util.StringUtils; */ public class EnhancedTreeNode extends TreeNode { public EnhancedTreeNode() { - this(null); + super(); + // this(null); }
public EnhancedTreeNode(String name) { - this(name, new TreeNode[0]); + //this(name, new TreeNode[0]); + super(name); + if (name != null) { + setTitle(StringUtils.deCamelCase(name)); + } }
public EnhancedTreeNode(String name, TreeNode... children) { @@ -65,8 +70,7 @@ public class EnhancedTreeNode extends TreeNode { String className = this.getClass().getName(); String simpleClassName = className.substring(className.lastIndexOf(".") + 1); innerClassName = simpleClassName.substring(simpleClassName.lastIndexOf("$") + 1); - } - catch (RuntimeException e) { + } catch (RuntimeException e) { innerClassName = "EnhancedTreeNode"; }
commit 3e90719a317d577fc6fc90c0efae8b840aa8cc99 Author: Joseph Marques joseph@redhat.com Date: Wed Oct 13 11:45:13 2010 -0400
remove legacy TempSessionLoginModule and all related classes
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java index 6359a23..3b125e1 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java @@ -93,11 +93,6 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe private SessionManager sessionManager = SessionManager.getInstance();
/** - * This is used to generate temporary session passwords and to validate those passwords. - */ - private TemporarySessionPasswordGenerator m_sessionPasswordGenerator = new TemporarySessionPasswordGenerator(); - - /** * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#loadUserConfiguration(Integer) */ public Subject loadUserConfiguration(Integer subjectId) { @@ -253,31 +248,6 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe }
/** - * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#generateTemporarySessionPassword(int) - */ - public String generateTemporarySessionPassword(int sessionId) { - return m_sessionPasswordGenerator.generateSessionPassword(sessionId); - } - - /** - * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#authenticateTemporarySessionPassword(java.lang.String) - */ - public boolean authenticateTemporarySessionPassword(String password) throws Exception { - Integer sessionId = m_sessionPasswordGenerator.authenticateSessionPassword(password); - boolean validPassword = false; - - if (sessionId != null) { - // If the password was valid, sessionId will be the ID to its associated session. We now have to make - // sure that session is still valid - this just makes sure the session hasn't timed out or was invalidated - if (sessionManager.getSubject(sessionId.intValue()) != null) { - validPassword = true; - } - } - - return validPassword; - } - - /** * @see org.rhq.enterprise.server.auth.SubjectManagerLocal#login(String, String) */ public Subject login(String username, String password) throws LoginException { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java index b4b7d55..d62096b 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java @@ -72,31 +72,6 @@ public interface SubjectManagerLocal { PageList<Subject> findAllSubjects(PageControl pageControl);
/** - * Generates a one-time temporary session password for the given session. This can be used to authenticate the user - * of that session for one time and one time only (i.e. to login as the user this temporary password can be used as - * opposed to the user's real password). - * - * <p>Note that this method should only be available on this EJB's local interface.</p> - * - * @param sessionId the session to assign a temporary password to - * - * @return a temporary password that can be used once to login as the user - */ - String generateTemporarySessionPassword(int sessionId); - - /** - * Tests the validity of the given session password. Returns <code>true</code> if the password is valid and the - * session is still valid. - * - * @param password a temporary session password that was created by {@link #generateTemporarySessionPassword(int)}. - * - * @return <code>true</code> if the given <code>password</code> is valid and its associated session is still valid - * - * @throws Exception if the password was valid but its associated session has either timed out or was invalidated - */ - boolean authenticateTemporarySessionPassword(String password) throws Exception; - - /** * Logs in a user without performing any authentication. This method should be used with care and not available to * remote clients. Because of the unauthenticated nature of this login, the new login session will have a session * timeout of only a few seconds. However, if you pass in <code>true</code> for the "reattach", this method will diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/TemporarySessionPasswordGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/TemporarySessionPasswordGenerator.java deleted file mode 100644 index fc82ce2..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/TemporarySessionPasswordGenerator.java +++ /dev/null @@ -1,259 +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 as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.server.auth; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import org.jboss.security.Util; - -/** - * Provides a random password generator and a storage area that helps temporarily authenticate users even though their - * true passwords are not known. This is necessary when a scheduled action is triggered and we want to run as the user, - * but we don't know the user's true password. In other words, these temporary passwords should only be used if we have - * previously validated the user for a given session ID. Session passwords generated by this object can only be used - * once, and they must be validated fairly quickly after being generated. - * - * <p>This object is thread-safe.</p> - * - * @author John Mazzitelli - */ -public class TemporarySessionPasswordGenerator { - /** - * This is a separator character that will appear between the session ID and a random set of characters in a - * generated session password. This character must NOT be in {@link #SESSION_PASSWORD_PREFIX}. - */ - private static final char SESSION_PASSWORD_SEPARATOR = '$'; - - /** - * A prefix to all generated session passwords; this makes it possible to quickly identify a possible session - * password. While this doesn't exclusively identify only session passwords, it helps eliminate most passwords from - * being recognized as a session password. None of the characters in this string will be the same as - * {@link #SESSION_PASSWORD_SEPARATOR}. - */ - private static final String SESSION_PASSWORD_PREFIX = "_x|=~"; - - /** - * Map keyed on session Integers whose values are Longs indicating when the session's password was created. - */ - private final Map<Integer, Long> m_sessionPasswordCreationDates; - - /** - * Map keyed on session Integers whose values are the MD5 strings of the generated passwords. - */ - private final Map<Integer, String> m_sessionPasswordMD5Strings; - - /** - * The amount of milliseconds that a temporary password is guaranteed to remain valid (a password may actually live - * longer than this, but it is not guaranteed to do so) - */ - private final int m_timeoutMillis; - - /** - * Constructor for {@link TemporarySessionPasswordGenerator}. - */ - public TemporarySessionPasswordGenerator() { - this(60 * 60 * 1000); // be default, give a copious 60 minutes - this is easily enough for what we need to use this class for - } - - /** - * Constructor for {@link TemporarySessionPasswordGenerator}. - * - * @param timeoutMillis the amount of milliseconds that a temporary password is guaranteed to remain valid (a - * password may actually live longer than this, but it is not guaranteed to do so) - */ - public TemporarySessionPasswordGenerator(int timeoutMillis) { - m_sessionPasswordCreationDates = new HashMap<Integer, Long>(); - m_sessionPasswordMD5Strings = new HashMap<Integer, String>(); - m_timeoutMillis = timeoutMillis; - - return; - } - - /** - * Given a session identifier, this will generate a temporary password that can be used to identify the user whose - * session that is. Use {@link #authenticateSessionPassword(String)} to later check for this password's - * authenticity. This session password can only be authenticated once. - * - * @param sessionId the session of a user who needs a temporary password assigned - * - * @return a password that can be used to associate a session with a user - * - * @see #authenticateSessionPassword(String) - */ - public String generateSessionPassword(int sessionId) { - StringBuffer pwBuf = new StringBuffer(SESSION_PASSWORD_PREFIX); - - pwBuf.append(sessionId); - pwBuf.append(SESSION_PASSWORD_SEPARATOR); - pwBuf.append(generateRandomPassword()); - - String pw = pwBuf.toString(); - - storeSessionPassword(new Integer(sessionId), pw); - - return pw; - } - - /** - * Returns the session's ID if the given session's password was one that was generated by this object. Returns - * <code>null</code> if the password was invalid and thus the user attempting to log in should be denied access. - * Once authenticated, the password will no longer be valid and can not be used to validate the session again. - * - * @param password the password to test - * - * @return session's ID if the session's <code>password</code> was one that was generated by this object; <code> - * null</code> otherwise - * - * @throws IllegalStateException if the password was in a valid format but the password's MD5 does not match; this - * exception will only be thrown when it looks like someone is trying to hack a - * session password - * - * @see #generateSessionPassword(int) - */ - public Integer authenticateSessionPassword(String password) throws IllegalStateException { - int separator = (password != null) ? password.indexOf(SESSION_PASSWORD_SEPARATOR) : -1; - - // let's quickly eliminate most passwords - if ((separator == -1) || !password.startsWith(SESSION_PASSWORD_PREFIX)) { - return null; - } - - String sessionStr = password.substring(SESSION_PASSWORD_PREFIX.length(), separator); - Integer sessionId; - - try { - sessionId = new Integer(sessionStr); - } catch (NumberFormatException e) { - // kinda looked like our password, but it can't be since this should have been a valid session ID number - return null; - } - - String passwordMD5 = generateMD5(password); - String sessionMD5; - - synchronized (this) { - purgeOldSessionPasswords(); // let's do this cleanup now; must do this inside the sychronized block - - // we only allow a session password to be authenticated once, so remove all traces of it while retrieving it - sessionMD5 = m_sessionPasswordMD5Strings.remove(sessionId); - m_sessionPasswordCreationDates.remove(sessionId); - } - - // the session password was either already authenticated or was removed because it was too old - if (sessionMD5 == null) { - return null; - } - - // the password was wrong, if we got this far and the password was wrong, someone is trying to hack - if (!sessionMD5.equals(passwordMD5)) { - throw new IllegalStateException( - "WARNING! A session was attempted to be reattached but the login password was invalid"); - } - - return sessionId; - } - - /** - * Stores the generated session password in our internal data structures so we can authenticate the session using - * the password. - * - * @param sessionId the session identifier - * @param pw the password to store - */ - private void storeSessionPassword(Integer sessionId, String pw) { - synchronized (this) { - purgeOldSessionPasswords(); // let's do this cleanup now; must do this inside the sychronized block - - m_sessionPasswordCreationDates.put(sessionId, new Long(System.currentTimeMillis())); - m_sessionPasswordMD5Strings.put(sessionId, generateMD5(pw)); - } - - return; - } - - /** - * Looks at the current set of session passwords and removes those that are old. Not sure why these passwords would - * be hanging around, since usually generated session passwords are authenticated fairly quickly thereafter. But - * just in case something went wrong between the time the password was generated and the time it was to be - * authenticated, this method is used to clean up. - * - * <p>To avoid having to enter another synchronized block and again attempt to aquire a lock, make sure you call - * this method from within a sychronized block - this method requires "this" object's lock.</p> - */ - private void purgeOldSessionPasswords() { - long earliestAllowed = System.currentTimeMillis() - m_timeoutMillis; - List<Integer> doomedSessions = new ArrayList<Integer>(); - - for (Map.Entry<Integer, Long> entry : m_sessionPasswordCreationDates.entrySet()) { - Long creationTime = entry.getValue(); - - if (creationTime.longValue() < earliestAllowed) { - doomedSessions.add(entry.getKey()); - } - } - - for (Integer doomedSession : doomedSessions) { - m_sessionPasswordCreationDates.remove(doomedSession); - m_sessionPasswordMD5Strings.remove(doomedSession); - } - - return; - } - - /** - * Generates a random password that will be used as part of the session password. - * - * @return a random password - */ - private String generateRandomPassword() { - // generate a random password - this will usually be used as part of a Basic Authentication to our WebDAV server - // make sure these can be encoded in a URL (no + signs - don't ask - see UrlUtil.encodeMore) - // make sure SESSION_PASSWORD_SEPARATOR character is NOT in the chars variable! - StringBuffer password = new StringBuffer(); - String chars = "0a3X1bWd-2VeU*fTgH7sGtF6YS^KpJqI4rh7RiQj_5P.kOZlNm|0Mn~Lou!9EvD4wACxB8yz"; - Random random = new Random(System.currentTimeMillis()); - int passwordLength = 0; - - while (passwordLength < 64) { - passwordLength = random.nextInt(129); - } - - random = new Random(System.currentTimeMillis() + passwordLength); - - for (int i = 0; i < passwordLength; i++) { - password.append(chars.charAt(random.nextInt(chars.length()))); - } - - return password.toString(); - } - - /** - * Given a password string, this will return its MD5. - * - * @param password the string whose MD5 is to be calculated - * - * @return the MD5 string - */ - private String generateMD5(String password) { - return Util.createPasswordHash("MD5", "base64", null, null, password); - } -} \ No newline at end of file diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java index caec439..7787dba 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CustomJaasDeploymentService.java @@ -113,20 +113,6 @@ public class CustomJaasDeploymentService implements CustomJaasDeploymentServiceM this.log.info("Enabling RHQ JDBC JAAS Provider"); configEntries.add(ace);
- /* - * NOT USED ANYMORE - // to support the need for authenticating temporary session passwords, add a login module that can do that - // we set an empty set of config options, but if we need to, we can store the config items - // in the RHQ_config_props table, which would allow the GUI to modify them (just in case we want to add that capability) - // the "conf" Properties value has all RHQ_config_props values, so we have that now - // for now, there are no config properties we need in this login module, so just create an empty map - ace = new AppConfigurationEntry(TempSessionLoginModule.class.getName(), - AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT, new HashMap<String, String>()); - this.log.info("Enabled the temporary session login module"); - configEntries.add(ace); - * - */ - String provider = conf.getProperty(RHQConstants.JAASProvider);
if ((provider != null) && provider.equals(RHQConstants.LDAPJAASProvider)) { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/jaas/TempSessionLoginModule.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/jaas/TempSessionLoginModule.java deleted file mode 100644 index a58f275..0000000 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/jaas/TempSessionLoginModule.java +++ /dev/null @@ -1,100 +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 as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.server.core.jaas; - -import java.security.acl.Group; -import java.util.Map; -import javax.security.auth.Subject; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.login.LoginException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jboss.security.SimpleGroup; -import org.jboss.security.auth.spi.UsernamePasswordLoginModule; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * A "special" JAAS login module that checks to see if the password is a valid temporary session password. If it is, the - * user is authenticated; if not, the user is denied access. - * - * <p>This is used mainly to support the use-case where a server component needs to submit a request that needs to again - * be authenticated. In this case, the server doesn't know the user's true password; instead a temporary session - * password was created for the user. - * - * @author John Mazzitelli - */ -public class TempSessionLoginModule extends UsernamePasswordLoginModule { - /** - * Logger - */ - private static final Log LOG = LogFactory.getLog(TempSessionLoginModule.class); - - /** - * A place where this login module can initialize itself. - * - * @param theSubject - * @param theHandler - * @param theSharedState - * @param theOptions - */ - public void initialize(Subject theSubject, CallbackHandler theHandler, Map theSharedState, Map theOptions) { - super.initialize(theSubject, theHandler, theSharedState, theOptions); - } - - /** - * We don't know the user's true password, so we don't know the expected password; therefore, this returns an empty - * string. This class overrides {@link #validatePassword(String, String)} so it can validate on the input password - * that was entered by the client, since it is all we need to check validity. - * - * @return empty string - */ - protected String getUsersPassword() { - return ""; - } - - /** - * Authenticates the user by seeing if the <code>inputPassword</code> is a valid temporary session password. <code> - * expectedPassword</code> is ignored. - * - * @see UsernamePasswordLoginModule#validatePassword(String, String) - */ - protected boolean validatePassword(String inputPassword, String expectedPassword) { - boolean validPassword = false; - - // call into the JON authentication subsystem to see if the input password was valid. - try { - validPassword = LookupUtil.getSubjectManager().authenticateTemporarySessionPassword(inputPassword); - } catch (Exception e) { - LOG.error("Failed to authenticate a session password for user [" + getUsername() + "]", e); - } - - return validPassword; - } - - /** - * @see org.jboss.security.auth.spi.AbstractServerLoginModule#getRoleSets() - */ - protected Group[] getRoleSets() throws LoginException { - SimpleGroup roles = new SimpleGroup("Roles"); - - //roles.addMember( new SimplePrincipal( "some role" ) ); - - return new Group[] { roles }; - } -} \ No newline at end of file
commit fa51b77cce5f9e3d5af5d72099d93fa7c9efc0c2 Author: Joseph Marques joseph@redhat.com Date: Wed Oct 13 10:31:09 2010 -0400
don't show id fields in grids
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java index eb7175b..7c6aaf9 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java @@ -105,6 +105,7 @@ public class ResourceSearchView extends Table { protected void configureTable() { ListGridField idField = new ListGridField("id", "Id", 55); idField.setType(ListGridFieldType.INTEGER); + idField.setHidden(true); ListGridField iconField = new ListGridField("icon", "", 40); ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(), 250); nameField.setCellFormatter(new CellFormatter() {
commit 08566cc2f400a51b1c81f7a8be6b7e405d47eb26 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Oct 12 17:40:26 2010 -0400
Fix issues with sticky tab navigation between different resources or resources and autogroups.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java index cf9e470..3544941 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java @@ -40,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView; import org.rhq.enterprise.gui.coregui.client.alert.AlertsView; import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView; import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView; +import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView; import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupTopView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTopView; @@ -60,6 +61,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; public class CoreGUI implements EntryPoint, ValueChangeHandler<String> { private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID;
+ // just to avoid constructing this over and over + private static final String TREE_NAV_VIEW_PATTERN = "(" + ResourceTopView.VIEW_ID + "|" + + ResourceGroupTopView.VIEW_ID + "|" + ResourceGroupDetailView.AUTO_GROUP_VIEW_PATH + ")/[^/]*"; + public static final String CONTENT_CANVAS_ID = "BaseContent";
private static ErrorHandler errorHandler = new ErrorHandler(); @@ -255,8 +260,8 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> { // We're already there - just refresh the view. refresh(); } else { - if (viewPath.matches("(" + ResourceTopView.VIEW_ID + "|" + ResourceGroupTopView.VIEW_ID + ")/[^/]*")) { - // e.g. "Resource/10001" + if (viewPath.matches(TREE_NAV_VIEW_PATTERN)) { + // e.g. "Resource/10001" or "Resource/AutoGroup/10003" if (!currentViewPath.startsWith(viewPath)) { // The Node that was selected is not the same Node that was previously selected - it // may not even be the same node type. For example, the user could have moved from a @@ -265,6 +270,10 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> { // history URL and append it to the new history URL. The suffix is assumed to follow the // ID (numeric) portion of the currentViewPath. String suffix = currentViewPath.replaceFirst("\D*[^/]*", ""); + // make sure we're not *too* sticky, stop no deeper than the subtab level. This prevents + // trying to render non-applicable detail views. We'll do this by chopping at the start + // of any other numeric in the path + suffix = suffix.replaceFirst("\d.*", ""); viewPath += suffix; } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java index f63e185..79606f6 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java @@ -208,7 +208,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo // Do *not* select the tab and trigger the tab selected event until the subtab has been selected first.
SubTab subtab = (subtabTitle != null) ? tab.getSubTabByTitle(subtabTitle) : tab.getDefaultSubTab(); - if (subtab == null || tab.getLayout().isDisabled()) { + if (subtab == null || tab.getLayout().isSubTabDisabled(subtab)) { CoreGUI.getErrorHandler().handleError("Invalid subtab name: " + subtabTitle); // TODO: Should we fire a history event here to redirect to a valid bookmark? subtab = tab.getLayout().getDefaultSubTab();
commit bc08fd4b21cdde7b5bde37a5cdd73ce47647e035 Author: John Mazzitelli mazz@redhat.com Date: Tue Oct 12 17:00:19 2010 -0400
no longer need the DELETEME jsf tab - gwt ui should now be able to do everything the jsf alert def ui was able to do
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java index 159a679..0e22ac2 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java @@ -100,7 +100,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo private SubTab opSched; private SubTab alertHistory; private SubTab alertDef; - private SubTab alertDelete; private SubTab configCurrent; private SubTab configHistory; private SubTab eventHistory; @@ -157,8 +156,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo alertsTab = new TwoLevelTab(getTabSet().extendLocatorId("Alerts"), "Alerts", "/images/icons/Alert_grey_16.png"); this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), "History", null); this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), "Definitions", null); - this.alertDelete = new SubTab(alertsTab.extendLocatorId("DELETEME"), "DELETEME", null); - alertsTab.registerSubTabs(alertHistory, alertDef, alertDelete); + alertsTab.registerSubTabs(alertHistory, alertDef); tabs.add(alertsTab);
configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), "Configuration", @@ -269,8 +267,6 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo "/rhq/resource/alert/listAlertHistory-plain.xhtml?id=" + resource.getId()), true, true); updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab .extendLocatorId("AlertDefView"), this.resourceComposite), true, true); - updateSubTab(this.alertsTab, this.alertDelete, new FullHTMLPane( - "/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id=" + resource.getId()), true, true);
if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions .isConfigureRead())) {
commit c8cd1d264fb1f59d19e2016e35ac2d271c2022f8 Author: John Mazzitelli mazz@redhat.com Date: Tue Oct 12 16:49:35 2010 -0400
monumental commit. I think this finishes the initial coding of the entire resource alert definition UI. this commit completes the relative resource operation notification. lots-o-testing and lots-o-bug-fixing is still required.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java index 1b7b233..b2e9c05 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java @@ -24,8 +24,10 @@ package org.rhq.enterprise.gui.coregui.client.alert.definitions;
import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; +import java.util.Map; import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback; @@ -167,6 +169,12 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio ancestorTypeSelectItem .setTooltip("Select the top of the type hierarchy from which to search its descedant tree for the Filter By type"); ancestorTypeSelectItem.setShowIfCondition(new ShowIfModeFunction(ResourceSelectionMode.RELATIVE)); + ancestorTypeSelectItem.addChangedHandler(new ChangedHandler() { + @Override + public void onChanged(ChangedEvent event) { + populateRelativeDescendantsDropDownMenu(null); + } + });
descendantTypeSelectItem = new SelectItem("descendantTypeSelectItem", "Then Filter By"); descendantTypeSelectItem.setStartRow(true); @@ -221,8 +229,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio descendantTypeSelectItem.clearValue(); descendantNameTextItem.clearValue(); hideOperationDropDownMenu(); - populateRelativeAncestorDropDownMenu(null); - // TODO + populateRelativeDropDownMenus(null, null); break; } } @@ -253,9 +260,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio break; } case RELATIVE: { - populateRelativeAncestorDropDownMenu(notifInfo.getAncestorTypeId()); - // TODO - descendantTypeSelectItem.setValue(notifInfo.getDescendantTypeId()); + populateRelativeDropDownMenus(notifInfo.getAncestorTypeId(), notifInfo.getDescendantTypeId()); if (notifInfo.getDescendantName() != null) { descendantNameTextItem.setValue(notifInfo.getDescendantName()); } @@ -268,7 +273,9 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio } }
- private void populateRelativeAncestorDropDownMenu(final Integer selectedResourceTypeId) { + private void populateRelativeDropDownMenus(final Integer selectedResourceTypeId, + final Integer descendantResourceTypeId) { + if (ancestorTypeSelectItem.getValue() == null) { AsyncCallback<ArrayList<ResourceType>> callback = new AsyncCallback<ArrayList<ResourceType>>() { @Override @@ -283,6 +290,7 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio } else { ancestorTypeSelectItem.setValue(String.valueOf(results.get(0).getId())); } + populateRelativeDescendantsDropDownMenu(descendantResourceTypeId); }
@Override @@ -301,6 +309,40 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio } }
+ private void populateRelativeDescendantsDropDownMenu(final Integer selectedDescendantResourceTypeId) { + Object rootResourceTypeIdObj = ancestorTypeSelectItem.getValue(); + final int rootResourceTypeId; + + if (rootResourceTypeIdObj == null) { + rootResourceTypeId = this.resourceType.getId(); + } else { + rootResourceTypeId = Integer.parseInt(rootResourceTypeIdObj.toString()); + } + GWTServiceLookup.getResourceTypeGWTService().getResourceTypeDescendantsWithOperations(rootResourceTypeId, + new AsyncCallback<HashMap<Integer, String>>() { + + @Override + public void onSuccess(HashMap<Integer, String> results) { + LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(results.size() + 1); + map.put(String.valueOf(rootResourceTypeId), "Root Ancestor Type"); + for (Map.Entry<Integer, String> entry : results.entrySet()) { + map.put(entry.getKey().toString(), entry.getValue()); + } + descendantTypeSelectItem.setValueMap(map); + if (selectedDescendantResourceTypeId != null) { + descendantTypeSelectItem.setValue(selectedDescendantResourceTypeId.toString()); + } else { + descendantTypeSelectItem.setValue(String.valueOf(rootResourceTypeId)); + } + } + + @Override + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError("Cannot get type descendants", caught); + } + }); + } + /** * This assumes the user or our code selected a specific operation from the drop down list. * This will show the operation arguments as appropriate for the selected operation. diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java index 2b2bd45..e2eeb96 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java @@ -1,6 +1,7 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import java.util.ArrayList; +import java.util.HashMap;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @@ -18,5 +19,5 @@ public interface ResourceTypeGWTService extends RemoteService {
ArrayList<ResourceType> getAllResourceTypeAncestors(int resourceTypeId);
- ArrayList<ResourceType> getResourceTypeDescendantsWithOperations(int resourceTypeId); + HashMap<Integer, String> getResourceTypeDescendantsWithOperations(int resourceTypeId); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java index e99d65d..be25a0b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java @@ -1,6 +1,7 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import java.util.ArrayList; +import java.util.HashMap; import java.util.List;
import org.rhq.core.domain.criteria.ResourceTypeCriteria; @@ -61,13 +62,12 @@ public class ResourceTypeGWTServiceImpl extends AbstractGWTServiceImpl implement }
@Override - public ArrayList<ResourceType> getResourceTypeDescendantsWithOperations(int resourceTypeId) { + public HashMap<Integer, String> getResourceTypeDescendantsWithOperations(int resourceTypeId) { try { ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager(); - List<ResourceType> list = typeManager.getResourceTypeDescendantsWithOperations(getSessionSubject(), + HashMap<Integer, String> map = typeManager.getResourceTypeDescendantsWithOperations(getSessionSubject(), resourceTypeId); - return SerialUtility.prepare(new ArrayList<ResourceType>(list), - "ResourceTypes.getResourceTypeDescendantsWithOperations"); + return SerialUtility.prepare(map, "ResourceTypes.getResourceTypeDescendantsWithOperations"); } catch (Exception e) { throw new RuntimeException(ThrowableUtil.getAllMessages(e)); } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java index 9dc348c..1837023 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -44,6 +45,7 @@ import org.jboss.annotation.IgnoreDependency;
import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.criteria.ResourceTypeCriteria; +import org.rhq.core.domain.operation.OperationDefinition; import org.rhq.core.domain.resource.InventoryStatus; import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceCategory; @@ -426,20 +428,25 @@ public class ResourceTypeManagerBean implements ResourceTypeManagerLocal, Resour return results; }
- public List<ResourceType> getResourceTypeDescendantsWithOperations(Subject subject, int resourceTypeId) { + public HashMap<Integer, String> getResourceTypeDescendantsWithOperations(Subject subject, int resourceTypeId) { List<ResourceType> types = getAllResourceTypeDescendants(subject, resourceTypeId); - List<ResourceType> results = excludeThoseWithoutOperations(types); + excludeThoseWithoutOperations(types); + HashMap<Integer, String> results = new HashMap<Integer, String>(types.size()); + for (ResourceType type : types) { + results.put(type.getId(), type.getName()); + } return results; }
- private List<ResourceType> excludeThoseWithoutOperations(List<ResourceType> types) { - List<ResourceType> results = new ArrayList<ResourceType>(); - for (ResourceType next : types) { - if (next.getOperationDefinitions() != null && next.getOperationDefinitions().size() != 0) { - results.add(next); + private void excludeThoseWithoutOperations(List<ResourceType> types) { + Iterator<ResourceType> iterator = types.iterator(); + while (iterator.hasNext()) { + ResourceType next = iterator.next(); + Set<OperationDefinition> operations = next.getOperationDefinitions(); + if (operations == null || operations.isEmpty()) { + iterator.remove(); } } - return results; }
public List<ResourceType> getAllResourceTypeAncestors(Subject subject, int resourceTypeId) { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerLocal.java index 6cd3639..6886944 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerLocal.java @@ -18,6 +18,7 @@ */ package org.rhq.enterprise.server.resource;
+import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.SortedSet; @@ -133,7 +134,7 @@ public interface ResourceTypeManagerLocal {
ResourceType getResourceTypeByNameAndPlugin(Subject subject, String name, String plugin);
- List<ResourceType> getResourceTypeDescendantsWithOperations(Subject subject, int resourceTypeId); + HashMap<Integer, String> getResourceTypeDescendantsWithOperations(Subject subject, int resourceTypeId);
List<ResourceType> getAllResourceTypeAncestors(Subject subject, int resourceTypeId);
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java deleted file mode 100644 index 2d85548..0000000 --- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java +++ /dev/null @@ -1,358 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.server.plugins.alertOperations; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.rhq.core.domain.alert.AlertDefinition; -import org.rhq.core.domain.auth.Subject; -import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.configuration.Property; -import org.rhq.core.domain.configuration.PropertySimple; -import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; -import org.rhq.core.domain.operation.OperationDefinition; -import org.rhq.core.domain.resource.Resource; -import org.rhq.core.domain.resource.ResourceType; -import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean; -import org.rhq.enterprise.server.plugins.alertOperations.OperationInfo.ResourceSelectionMode; -import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException; -import org.rhq.enterprise.server.util.LookupUtil; - -/** - * Backing bean for the operations alert sender - * @author Joseph Marques - */ -public class OperationsBackingBean extends CustomAlertSenderBackingBean { - - private Map<String, String> selectionModeOptions = new LinkedHashMap<String, String>(); - private Map<String, String> ancestorTypeOptions = new LinkedHashMap<String, String>(); - private Map<String, String> descendantTypeOptions = new LinkedHashMap<String, String>(); - private Map<String, String> operationNameOptions = new LinkedHashMap<String, String>(); - - private String selectionMode = ""; - private String resourceId; - private String ancestorTypeId; - private String descendantName; - private String descendantTypeId; - private String operationDefinitionId; - - private String effectiveResourceTypeName; - private String effectiveResourceTypeId; - - private ConfigurationDefinition argumentsConfigurationDefinition; - private Configuration argumentsConfiguration; - - private Subject overlord; - - private Subject getOverlord() { - if (overlord == null) { - overlord = LookupUtil.getSubjectManager().getOverlord(); - } - return overlord; - } - - @Override - public void loadView() { - selectionMode = get(OperationInfo.Constants.SELECTION_MODE, "none"); - - // always load first list - for (ResourceSelectionMode mode : ResourceSelectionMode.values()) { - selectionModeOptions.put(mode.displayString, mode.name()); - } - - Configuration previousArguments = extraParameters; - - // load secondList if currentType is selected - if (selectionMode.equals("none")) { - return; - } - - if (selectionMode.equals(ResourceSelectionMode.SPECIFIC.name())) { - resourceId = get(OperationInfo.Constants.SPECIFIC_RESOURCE_ID, ""); - } else if (selectionMode.equals(ResourceSelectionMode.RELATIVE.name())) { - ancestorTypeId = get(OperationInfo.Constants.RELATIVE_ANCESTOR_TYPE_ID, "none"); - descendantName = get(OperationInfo.Constants.RELATIVE_DESCENDANT_NAME, "Name (optional)"); - descendantTypeId = get(OperationInfo.Constants.RELATIVE_DESCENDANT_TYPE_ID, "none"); - - ResourceType contextType = computeResourceTypeFromContext(); // should not be null - List<ResourceType> ancestors = null; - if (context.equals("resource")) { - try { - List<Resource> ancestry = LookupUtil.getResourceManager().getResourceLineage( - Integer.parseInt(contextSubId)); - ancestors = new ArrayList<ResourceType>(); - for (Resource next : ancestry) { - ancestors.add(next.getResourceType()); - } - } catch (Throwable t) { - // ignore, we'll default to a different loading style below - } - } - - if (ancestors == null) { // if not in the resource content or fallback if resource ancestry loading bombs - // mazz was here - I replaced getResourceTypeAcestorsWithOperations - this entire backing bean - // will be deleted soon, so we don't care - i just needed to get this to compile again - ancestors = LookupUtil.getResourceTypeManager().getAllResourceTypeAncestors(getOverlord(), - contextType.getId()); - } - load(ancestorTypeOptions, ancestors); - - if (ancestorTypeId.equals("none") == false) { - List<ResourceType> descendants = LookupUtil.getResourceTypeManager() - .getResourceTypeDescendantsWithOperations(getOverlord(), Integer.parseInt(ancestorTypeId)); - load(descendantTypeOptions, descendants); - } else { - List<ResourceType> descendants = LookupUtil.getResourceTypeManager() - .getResourceTypeDescendantsWithOperations(getOverlord(), contextType.getId()); - load(descendantTypeOptions, descendants); - } - } - - // compute effectiveResourceTypeId from given info - ResourceType type = null; - if (selectionMode.equals(ResourceSelectionMode.SELF.name())) { - type = computeResourceTypeFromContext(); - - } else if (selectionMode.equals(ResourceSelectionMode.SPECIFIC.name())) { - if (resourceId.equals("") == false) { - Resource resource = LookupUtil.getResourceManager().getResource(getOverlord(), - Integer.parseInt(resourceId)); - type = resource.getResourceType(); - } - - } else if (selectionMode.equals(ResourceSelectionMode.RELATIVE.name())) { - try { - if (descendantTypeId.equals("none") == false) { - type = LookupUtil.getResourceTypeManager().getResourceTypeById(getOverlord(), - Integer.parseInt(descendantTypeId)); - } else if (ancestorTypeId.equals("none") == false) { - type = LookupUtil.getResourceTypeManager().getResourceTypeById(getOverlord(), - Integer.parseInt(ancestorTypeId)); - } - } catch (ResourceTypeNotFoundException rtnfe) { - // debugging message - } - } - - if (type == null) { - return; - } - - effectiveResourceTypeId = String.valueOf(type.getId()); - effectiveResourceTypeName = type.getName(); - - operationDefinitionId = get(OperationInfo.Constants.OPERATION_ID, "none"); - List<OperationDefinition> definitions = LookupUtil.getOperationManager().findSupportedResourceTypeOperations( - getOverlord(), Integer.valueOf(effectiveResourceTypeId), false); - for (OperationDefinition nextDefinition : definitions) { - operationNameOptions.put(nextDefinition.getDisplayName(), String.valueOf(nextDefinition.getId())); - } - - if (operationDefinitionId.equals("none")) { - return; - } - - try { - OperationDefinition operation = LookupUtil.getOperationManager().getOperationDefinition(getOverlord(), - Integer.parseInt(operationDefinitionId)); - argumentsConfigurationDefinition = operation.getParametersConfigurationDefinition(); - - if (argumentsConfigurationDefinition == null) { - return; - } - - if (previousArguments == null) { - // create it for the first time or if this was previous removed due to switching form options - Configuration emptyConfiguration = LookupUtil.getConfigurationManager() - .getConfigurationFromDefaultTemplate(argumentsConfigurationDefinition); - argumentsConfiguration = emptyConfiguration.deepCopy(false); - } else { - argumentsConfiguration = previousArguments; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void load(Map<String, String> resourceTypeOptions, List<ResourceType> types) { - for (ResourceType nextType : types) { - resourceTypeOptions.put(nextType.getName(), String.valueOf(nextType.getId())); - } - } - - private ResourceType computeResourceTypeFromContext() { - AlertDefinition definition = LookupUtil.getAlertDefinitionManager().getAlertDefinitionById(getOverlord(), - Integer.parseInt(contextId)); - - ResourceType type = null; - if (definition.getResource() != null) { - type = definition.getResource().getResourceType(); - } else if (definition.getResourceGroup() != null) { - type = definition.getResourceGroup().getResourceType(); - } else { - type = definition.getResourceType(); - } - return type; - } - - private String get(OperationInfo.Constants operationInfoConstant, String defaultValue) { - return alertParameters.getSimpleValue(operationInfoConstant.propertyName, defaultValue); - } - - @Override - public void saveView() { - set(selectionMode, OperationInfo.Constants.SELECTION_MODE); - set(resourceId, OperationInfo.Constants.SPECIFIC_RESOURCE_ID); - set(ancestorTypeId, OperationInfo.Constants.RELATIVE_ANCESTOR_TYPE_ID); - set("Name (optional)".equals(descendantName) ? null : descendantName, - OperationInfo.Constants.RELATIVE_DESCENDANT_NAME); - set(descendantTypeId, OperationInfo.Constants.RELATIVE_DESCENDANT_TYPE_ID); - set(operationDefinitionId, OperationInfo.Constants.OPERATION_ID); - - // persist the updates to the argumentsConfiguration - if (operationDefinitionId != null && !operationDefinitionId.equals("none") && argumentsConfiguration != null) { - extraParameters = persistConfiguration(argumentsConfiguration); - } else { - extraParameters = null; - //deleteExtraParameters(); - } - - alertParameters = persistConfiguration(alertParameters); - } - - private boolean set(String value, OperationInfo.Constants operationInfoConstant) { - String propertyName = operationInfoConstant.propertyName; - if (value == null) { - Property previous = alertParameters.remove(propertyName); - if (previous == null) { - return false; // removing a non-existence property, no change - } - return ((PropertySimple) previous).getStringValue() != null; - } - PropertySimple property = alertParameters.getSimple(propertyName); - if (property == null) { - property = new PropertySimple(propertyName, value); - alertParameters.put(property); - return true; // adding a property that previously didn't exist - } else { - String oldStringValue = property.getStringValue(); - property.setStringValue(value); - return !value.equals(oldStringValue); - } - } - - public Map<String, String> getSelectionModeOptions() { - return selectionModeOptions; - } - - public Map<String, String> getAncestorTypeOptions() { - return ancestorTypeOptions; - } - - public Map<String, String> getDescendantTypeOptions() { - return descendantTypeOptions; - } - - public Map<String, String> getOperationNameOptions() { - return operationNameOptions; - } - - public String getSelectionMode() { - return selectionMode; - } - - public void setSelectionMode(String selectionMode) { - this.selectionMode = selectionMode; - } - - public String getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - public String getAncestorTypeId() { - return ancestorTypeId; - } - - public void setAncestorTypeId(String ancestorTypeId) { - this.ancestorTypeId = ancestorTypeId; - } - - public String getDescendantName() { - return descendantName; - } - - public void setDescendantName(String descendantName) { - this.descendantName = descendantName; - } - - public String getDescendantTypeId() { - return descendantTypeId; - } - - public void setDescendantTypeId(String descendantTypeId) { - this.descendantTypeId = descendantTypeId; - } - - public String getOperationDefinitionId() { - return operationDefinitionId; - } - - public void setOperationDefinitionId(String operationDefinitionId) { - this.operationDefinitionId = operationDefinitionId; - } - - public String getEffectiveResourceTypeId() { - return effectiveResourceTypeId; - } - - public String getEffectiveResourceTypeName() { - return effectiveResourceTypeName; - } - - public ConfigurationDefinition getArgumentsConfigurationDefinition() { - return argumentsConfigurationDefinition; - } - - public void setArgumentsConfigurationDefinition(ConfigurationDefinition argumentsConfigurationDefinition) { - this.argumentsConfigurationDefinition = argumentsConfigurationDefinition; - } - - public Configuration getArgumentsConfiguration() { - return argumentsConfiguration; - } - - public void setArgumentsConfiguration(Configuration argumentsConfiguration) { - this.argumentsConfiguration = argumentsConfiguration; - } - - public String getNoParametersMessage() { - return "This operation does not take any parameters."; - } - - public String getNotInitializedMessage() { - return "This operation parameters definition has not been initialized."; - } -} diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml index 752f5b3..9c5debe 100644 --- a/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml +++ b/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml @@ -14,19 +14,18 @@ Used to execute known operations on resources currently in inventory. </serverplugin:help>
- <!-- startup & tear down listener, + scheduled jobs - <serverplugin:plugin-component class="Foo" /> - --> - <!-- How does this sender show up in drop downs etc --> <short-name>Resource Operations</short-name>
<!-- Class that does the actual sending --> <plugin-class>OperationsSender</plugin-class>
- <custom-ui> - <ui-snippet-name>operations.xhtml</ui-snippet-name> - <backing-bean-class>OperationsBackingBean</backing-bean-class> - <backing-bean-name>operationsBean</backing-bean-name> - </custom-ui> + <alert-configuration> + <c:simple-property name="selection-mode" type="string" required="true" description="How the resource is to be identified: SELF, SPECIFIC or RELATIVE"/> + <c:simple-property name="selection-specific-resource-id" type="integer" required="true" description="If SPECIFIC mode, identifies the resource"/> + <c:simple-property name="selection-relative-ancestor-type-id" type="integer" required="true" description="If RELATIVE, the type at the top of the hierarchy"/> + <c:simple-property name="selection-relative-descendant-type-id" type="integer" required="true" description="If RELATIVE, the type at the bottom of the hierarchy to identify the resource by its type"/> + <c:simple-property name="selection-relative-descendant-name" type="integer" required="false" description="If RELATIVE and not-null, this further helps identify the resource by its name"/> + <c:simple-property name="operation-definition-id" type="integer" required="true" description="Identifies the operation to be invoked"/> + </alert-configuration> </alert-plugin> \ No newline at end of file diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml deleted file mode 100644 index 0502e73..0000000 --- a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:c="http://java.sun.com/jstl/core" - xmlns:a4j="https://richfaces.org/a4j" - xmlns:rich="http://richfaces.ajax4jsf.org/rich" - xmlns:onc="http://jboss.org/on/component" > - -<body> - - <h:panelGrid columns="2"> - <h:outputText value="Resource Selection Mode:" style="width: 150px;" /> - <h:selectOneMenu value="#{operationsBean.selectionMode}" > - <f:selectItem itemValue="none" itemLabel="Select..." /> - <f:selectItems value="#{operationsBean.selectionModeOptions}" /> - </h:selectOneMenu> - - <h:outputText value="Resource ID:" rendered="#{operationsBean.selectionMode eq 'SPECIFIC'}" /> - <h:panelGroup rendered="#{operationsBean.selectionMode eq 'SPECIFIC'}"> - <h:inputText value="#{operationsBean.resourceId}" id="resourceId" /> - <a href="#" - onclick="window.open('/rhq/inventory/resourcePicker.xhtml?nomenu=true&fieldId=customContentForm:resourceId', 'ResourcePicker','width=1000,height=700,scrollbars=yes,toolbar=no,resizable=yes,location=no,status=no,left=100,top=100'); return false;" - class="buttonmed">Pick</a> - </h:panelGroup> - - <h:outputText value="Start Search From:" style="width: 200px;" rendered="#{operationsBean.selectionMode eq 'RELATIVE'}" /> - <h:selectOneMenu value="#{operationsBean.ancestorTypeId}" rendered="#{operationsBean.selectionMode eq 'RELATIVE'}"> - <f:selectItem itemValue="none" itemLabel="Select..." /> - <f:selectItems value="#{operationsBean.ancestorTypeOptions}" /> - </h:selectOneMenu> - - <h:outputText value="Then Filter By:" style="width: 200px;" rendered="#{operationsBean.selectionMode eq 'RELATIVE'}"/> - <h:panelGroup rendered="#{operationsBean.selectionMode eq 'RELATIVE'}"> - <h:selectOneMenu value="#{operationsBean.descendantTypeId}"> - <f:selectItem itemValue="none" itemLabel="Select..." /> - <f:selectItems value="#{operationsBean.descendantTypeOptions}" /> - </h:selectOneMenu> - <h:inputText value="#{operationsBean.descendantName}" id="nameFilter" - onfocus="if (this.value == 'Name (optional)') { this.value = ''; this.style.color = 'black'; } " - onblur="if (this.value == '') { this.value = 'Name (optional)'; this.style.color = 'gray'; } "/> - </h:panelGroup> - - <h:outputText value="Operation Name:" rendered="#{!empty operationsBean.effectiveResourceTypeId}"/> - <h:selectOneMenu value="#{operationsBean.operationDefinitionId}" - rendered="#{!empty operationsBean.effectiveResourceTypeId}" > - <f:selectItem itemValue="none" itemLabel="Select..." /> - <f:selectItems value="#{operationsBean.operationNameOptions}"/> - </h:selectOneMenu> - </h:panelGrid> - - <h:panelGroup rendered="#{!empty operationsBean.operationDefinitionId and operationsBean.operationDefinitionId ne 'none'}"> - <onc:config configurationDefinition="#{operationsBean.argumentsConfigurationDefinition}" - configuration="#{operationsBean.argumentsConfiguration}" - nullConfigurationDefinitionMessage="#{operationsBean.noParametersMessage}" - nullConfigurationMessage="#{operationsBean.notInitializedMessage}" - nullConfigurationStyle="InfoBlock" - readOnly="false" /> - </h:panelGroup> - - <script> - addWindowOnLoadEvent(function() { - var nameFilterElement = getElementCrossBrowser('customContentForm:nameFilter') - if (nameFilterElement.value == 'Name (optional)') { - nameFilterElement.style.color = 'gray'; - } - }); - </script> - -<rich:modalPanel id="ResourcePicker"> - <h:outputLink>Hello World</h:outputLink> - <p/> - <a onclick="Richfaces.hideModalPanel('ResourcePicker');" href="#">Hide</a> -</rich:modalPanel> - - -</body> -</html>
commit 63f55447f31e96dfdf6bc0459069634b248f0549 Author: John Mazzitelli mazz@redhat.com Date: Tue Oct 12 16:45:54 2010 -0400
we can't assume our server will be able to respond within 10s for every request. increase to 60s just to be safe (a slow UI is better than a broken UI)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java index d0760d2..ebd0ab5 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java @@ -139,7 +139,7 @@ public class GWTServiceLookup {
public static class SessionRpcRequestBuilder extends RpcRequestBuilder {
- private static int RPC_TIMEOUT = 10000; + private static int RPC_TIMEOUT = 60000;
@Override protected RequestBuilder doCreate(String serviceEntryPoint) {
commit a59dda22140b5b001fdc1d91cfaec59d44827e21 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Oct 12 14:17:25 2010 -0400
Fix issue with empty condition and notif alert def tabs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java index bdaff67..bea63ba 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java @@ -136,6 +136,8 @@ public abstract class AbstractAlertDefinitionsView extends TableSection { final AlertDefinitionCriteria criteria = new AlertDefinitionCriteria(); criteria.addFilterId(id); criteria.fetchGroupAlertDefinition(true); + criteria.fetchConditions(true); + criteria.fetchAlertNotifications(true); GWTServiceLookup.getAlertDefinitionService().findAlertDefinitionsByCriteria(criteria, new AsyncCallback<PageList<AlertDefinition>>() { public void onFailure(Throwable caught) {
commit df34ecb6adae45dfcc15c60b216d3454eca4d6c5 Author: John Mazzitelli mazz@redhat.com Date: Tue Oct 12 12:26:30 2010 -0400
build form in constructor - for some reason, onInit was also getting called during destroy which in turn caused "global exception" to occur
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java index 2519e6e..1b7b233 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceOperationNotificationSenderForm.java @@ -94,11 +94,11 @@ public class ResourceOperationNotificationSenderForm extends AbstractNotificatio super(locatorId, notif, sender); this.resourceType = resourceType; this.theResource = res; + + buildUI(); }
- @Override - protected void onInit() { - super.onInit(); + private void buildUI() {
dynamicForm = new LocatableDynamicForm(extendLocatorId("resOpForm")); dynamicForm.setNumCols(3);
commit d12d99072c8fba68ddc2cbffc93df618c7733e91 Author: John Sanda jsanda@redhat.com Date: Tue Oct 12 11:11:48 2010 -0400
[BZ 614251] Forgot to include updated interface in previous commit
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java index 66a5524..786e60f 100644 --- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java +++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java @@ -22,11 +22,13 @@ */ package org.rhq.core.clientapi.agent.measurement;
+import java.util.List; import java.util.Map; import java.util.Set;
import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementDataRequest; import org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest;
/** @@ -74,7 +76,7 @@ public interface MeasurementAgentService { * @param measurementNames the names of the numeric metrics or traits to be collected * @return the set of collected measurements with their data values collected */ - Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, DataType dataType, String... measurementNames); + Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, List<MeasurementDataRequest> requests);
Map<String, Object> getMeasurementScheduleInfoForResource(int resourceId); } \ No newline at end of file
commit e4530b09fd5e37ebca580153107090e4a10e06a8 Merge: ca28918... 04f6d32... Author: John Sanda jsanda@redhat.com Date: Tue Oct 12 11:03:19 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit ca289182efed696e10cbda5c8ad2b53ff2bc5acb Author: John Sanda jsanda@redhat.com Date: Tue Oct 12 10:55:23 2010 -0400
[BZ 614251] Making multiple changes so that live metric data can be fetched and displayed
There are two changes with this commit. First, in the CLI the ResourceProxy class was using a criteria query that is too broad, at least when the jboss-as and jboss-as-5 plugins are involved.
Secondly, the server/agent API used to get the metric data is inadequate. It accepts a variable number of measurement names but only a single data type for those measurements. This is problematic because there is nothing to guarantee that all of the metrics are of the same type. On the server side, we were using a hard-coded value of METRIC for the data type argument. The method(s) MeasurementManagerLocal.findLiveData and MeasurementManagerRemote.findLiveData will fail any time one of the measurement definitions has a data type other than METRIC. MeasurementManager.getRealTimeMeasurementValue has been refactored to take a list of MeasurementDataRequest objects. Each request specifies the metric name along with its corresponding data type.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataRequest.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataRequest.java new file mode 100644 index 0000000..3417777 --- /dev/null +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataRequest.java @@ -0,0 +1,61 @@ +package org.rhq.core.domain.measurement; + +import java.io.Serializable; + +public class MeasurementDataRequest implements Serializable { + private static final long serialVersionUID = 1L; + + /** The meausurement name */ + private String name; + + /** The meausurement's data type */ + private DataType type; + + public MeasurementDataRequest(MeasurementDefinition definition) { + name = definition.getName(); + type = definition.getDataType(); + } + + public MeasurementDataRequest(String metricName, DataType type) { + name = metricName; + this.type = type; + } + + /** + * @return The requested measurement's name + */ + public String getName() { + return name; + } + + /** + * @return The requested measurement's data type + */ + public DataType getType() { + return type; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + + if (obj == this) { + return true; + } + + if (obj instanceof MeasurementDataRequest) { + MeasurementDataRequest that = (MeasurementDataRequest) obj; + return this.name.equals(that.name) && this.type.equals(that.name); + } + + return false; + } + + @Override + public int hashCode() { + return 41 * (name.hashCode() + type.hashCode()); + } + +} diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java index e8c1c05..c777284 100644 --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java @@ -43,6 +43,7 @@ import org.rhq.core.clientapi.server.discovery.InventoryReport; import org.rhq.core.domain.measurement.Availability; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementDataRequest; import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.pc.inventory.InventoryManager; @@ -613,8 +614,13 @@ public class StandaloneContainer { String[] metricNames = new String[tokens.length - 2]; System.arraycopy(tokens, 2, metricNames, 0, tokens.length - 2);
+ List<MeasurementDataRequest> requests = new ArrayList<MeasurementDataRequest>(); + for (String metric : metricNames) { + requests.add(new MeasurementDataRequest(metric, dataType)); + } + MeasurementManager mm = pc.getMeasurementManager(); - Set<MeasurementData> dataset = mm.getRealTimeMeasurementValue(resourceId, dataType, metricNames); + Set<MeasurementData> dataset = mm.getRealTimeMeasurementValue(resourceId, requests); if (dataset == null) { System.err.println("No data returned"); return; diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java index b58f607..2cf62d1 100644 --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java @@ -27,6 +27,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.PriorityQueue; import java.util.Set; @@ -46,6 +47,7 @@ import org.rhq.core.clientapi.agent.measurement.MeasurementAgentService; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementData; import org.rhq.core.domain.measurement.MeasurementDataNumeric; +import org.rhq.core.domain.measurement.MeasurementDataRequest; import org.rhq.core.domain.measurement.MeasurementReport; import org.rhq.core.domain.measurement.MeasurementSchedule; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; @@ -398,9 +400,8 @@ public class MeasurementManager extends AgentService implements MeasurementAgent // corresponding metric defs - one for the raw value and one for the derived per-minute value. There's no // way to tell which value the caller wants. For now, it assumes the caller wants the raw value. // (ips, 09/05/08) - public Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, DataType dataType, - String... measurementName) { - if (measurementName.length == 0) { + public Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, List<MeasurementDataRequest> requests) { + if (requests.size() == 0) { // There's no need to even call getValues() on the ResourceComponent if the list of metric names is empty. return Collections.emptySet(); } @@ -426,9 +427,9 @@ public class MeasurementManager extends AgentService implements MeasurementAgent
MeasurementReport report = new MeasurementReport(); Set<MeasurementScheduleRequest> allMeasurements = new HashSet<MeasurementScheduleRequest>(); - for (String name : measurementName) { - MeasurementScheduleRequest request = new MeasurementScheduleRequest(1, name, 0, true, dataType); - allMeasurements.add(request); + for (MeasurementDataRequest dataRequest : requests) { + allMeasurements.add(new MeasurementScheduleRequest(1, dataRequest.getName(), 0, true, + dataRequest.getType())); }
try { diff --git a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/proxy/ResourceClientProxy.java b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/proxy/ResourceClientProxy.java index d1ff605..a76a0ad 100644 --- a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/proxy/ResourceClientProxy.java +++ b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/proxy/ResourceClientProxy.java @@ -222,7 +222,9 @@ public class ResourceClientProxy {
private void initMeasurements() { MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria(); - criteria.addFilterResourceTypeName(resource.getResourceType().getName()); + criteria.addFilterResourceTypeId(resource.getResourceType().getId()); +// criteria.addFilterResourceTypeName(resource.getResourceType().getName()); +// criteria.setStrict(true);
this.measurementDefinitions = remoteClient.getMeasurementDefinitionManagerRemote() .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java index c65cc8c..df006e8 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java @@ -61,6 +61,7 @@ import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.DisplayType; import org.rhq.core.domain.measurement.MeasurementData; import org.rhq.core.domain.measurement.MeasurementDataNumeric; +import org.rhq.core.domain.measurement.MeasurementDataRequest; import org.rhq.core.domain.measurement.MeasurementDataTrait; import org.rhq.core.domain.measurement.MeasurementDefinition; import org.rhq.core.domain.measurement.MeasurementReport; @@ -783,19 +784,21 @@ public class MeasurementDataManagerBean implements MeasurementDataManagerLocal, q.setParameter("ids", ArrayUtils.wrapInList(definitionIds)); List<MeasurementDefinition> definitions = q.getResultList();
- String[] names = new String[definitions.size()]; - int i = 0; - for (MeasurementDefinition def : definitions) { - names[i++] = def.getName(); - } - AgentClient ac = agentClientManager.getAgentClient(agent); Set<MeasurementData> values = ac.getMeasurementAgentService().getRealTimeMeasurementValue(resourceId, - DataType.MEASUREMENT, names); + createRequests(definitions));
return values; }
+ private List<MeasurementDataRequest> createRequests(List<MeasurementDefinition> definitions) { + List<MeasurementDataRequest> requests = new ArrayList<MeasurementDataRequest>(); + for (MeasurementDefinition definition : definitions) { + requests.add(new MeasurementDataRequest(definition)); + } + return requests; + } + /** * Return all known trait data for the passed schedule, defined by resourceId and definitionId * diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java index b279a5a..d8effb3 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/metadata/test/UpdateSubsytemTestBase.java @@ -50,6 +50,7 @@ import org.rhq.core.domain.criteria.ResourceCriteria; import org.rhq.core.domain.criteria.ResourceTypeCriteria; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementDataRequest; import org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest; import org.rhq.core.domain.plugin.Plugin; import org.rhq.core.domain.resource.Agent; @@ -266,10 +267,9 @@ public class UpdateSubsytemTestBase extends AbstractEJB3Test { */ public class MockAgentService implements MeasurementAgentService {
- public Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, DataType dataType, - String... measurementNames) { - // TODO Auto-generated method stub - return null; + @Override + public Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, List<MeasurementDataRequest> requests) { + return null; //To change body of implemented methods use File | Settings | File Templates. }
public void scheduleCollection(Set<ResourceMeasurementScheduleRequest> resourceSchedules) { diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java index a02e6cf..2c08880 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java @@ -57,6 +57,7 @@ import org.rhq.core.domain.discovery.ResourceSyncInfo; import org.rhq.core.domain.measurement.Availability; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementDataRequest; import org.rhq.core.domain.measurement.ResourceMeasurementScheduleRequest; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.resource.Resource; @@ -124,9 +125,9 @@ public class TestAgentClient implements AgentClient, BundleAgentService, Content
// provide no-ops for all agent services
- public Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, DataType dataType, - String... measurementNames) { - return null; + + public Set<MeasurementData> getRealTimeMeasurementValue(int resourceId, List<MeasurementDataRequest> requests) { + return null; //To change body of implemented methods use File | Settings | File Templates. }
public void scheduleCollection(Set<ResourceMeasurementScheduleRequest> resourceSchedules) { diff --git a/modules/plugins/jboss-as-5/testsuite/src/main/java/org/rhq/plugins/jbossas5/JBossServerTest.java b/modules/plugins/jboss-as-5/testsuite/src/main/java/org/rhq/plugins/jbossas5/JBossServerTest.java index 0a09f56..6192478 100644 --- a/modules/plugins/jboss-as-5/testsuite/src/main/java/org/rhq/plugins/jbossas5/JBossServerTest.java +++ b/modules/plugins/jboss-as-5/testsuite/src/main/java/org/rhq/plugins/jbossas5/JBossServerTest.java @@ -460,16 +460,13 @@ public class JBossServerTest extends ServletTestCase PluginContainer pc = PluginContainer.getInstance(); Set<MeasurementDefinition> definitions = defaultDS.getResourceType().getMetricDefinitions();
- List<String> defNames = new ArrayList<String>(); - for (MeasurementDefinition definition : definitions) - { - defNames.add(definition.getName()); + List<MeasurementDataRequest> requests = new ArrayList<MeasurementDataRequest>(); + for (MeasurementDefinition definition : definitions) { + requests.add(new MeasurementDataRequest(definition)); } - String[] stringArray = new String[definitions.size()]; - defNames.toArray(stringArray); - Set<MeasurementData> data = pc.getMeasurementAgentService().getRealTimeMeasurementValue(defaultDS.getId(), null, stringArray); + Set<MeasurementData> data = pc.getMeasurementAgentService().getRealTimeMeasurementValue(defaultDS.getId(), + requests); assert data.size() > 0 : "We should be getting some kind of measurement data back"; - }
commit 04f6d32e9f68614cb913085211d8393d6cf63d83 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Oct 12 10:02:15 2010 -0400
Fixed some Selenium Locator issues
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java index 84ccc47..f63e185 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java @@ -126,15 +126,13 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo if (getSelectedItemId() == null) { CoreGUI.goToView(History.getToken()); } else { - - // selectSubTabByTitle(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId()); String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId(); String path = this.baseViewPath + "/" + getSelectedItemId() + tabPath;
// If the tab that was selected is not already the current history item, the user clicked on the tab, rather // than going directly to the tab's URL. In this case, fire a history event to go to the tab and make it the // current history item. - if (!History.getToken().equals(path)) { + if (!History.getToken().equals(path) && !History.getToken().startsWith(path)) { CoreGUI.goToView(path); } } @@ -223,10 +221,10 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo // Handle any remaining view items (e.g. id of a selected item in a subtab that contains a Master-Details view). Canvas subView = subtab.getCanvas(); if (subView instanceof RefreshableView) { - ((RefreshableView)subView).refresh(); + ((RefreshableView) subView).refresh(); } if (subView instanceof BookmarkableView) { - ((BookmarkableView)subView).renderView(viewPath); + ((BookmarkableView) subView).renderView(viewPath); }
this.tabSet.markForRedraw(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java index 28e91f6..4bdfdd4 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java @@ -56,22 +56,22 @@ public class EventCompositeHistoryView extends TableSection { private EntityContext context; private boolean hasWriteAccess;
- public static EventCompositeHistoryView get(ResourceGroupComposite composite) { + public static EventCompositeHistoryView get(String locatorId, ResourceGroupComposite composite) { String tableTitle = "Group Event History"; EntityContext context = EntityContext.forGroup(composite.getResourceGroup().getId()); boolean hasWriteAccess = composite.getResourcePermission().isEvent(); - return new EventCompositeHistoryView(tableTitle, context, hasWriteAccess); + return new EventCompositeHistoryView(locatorId, tableTitle, context, hasWriteAccess); }
- public static EventCompositeHistoryView get(ResourceComposite composite) { + public static EventCompositeHistoryView get(String locatorId, ResourceComposite composite) { String tableTitle = "Resource Event History"; EntityContext context = EntityContext.forResource(composite.getResource().getId()); boolean hasWriteAccess = composite.getResourcePermission().isEvent(); - return new EventCompositeHistoryView(tableTitle, context, hasWriteAccess); + return new EventCompositeHistoryView(locatorId, tableTitle, context, hasWriteAccess); }
- private EventCompositeHistoryView(String tableTitle, EntityContext context, boolean hasWriteAccess) { - super("EventCompositeHistoryTable", tableTitle, new SortSpecifier[] { DEFAULT_SORT_SPECIFIER }); + private EventCompositeHistoryView(String locatorId, String tableTitle, EntityContext context, boolean hasWriteAccess) { + super(locatorId, tableTitle, new SortSpecifier[] { DEFAULT_SORT_SPECIFIER }); this.context = context; this.hasWriteAccess = hasWriteAccess;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java index b41d7f0..4f71441 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java @@ -253,16 +253,16 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource if (updateTab(this.configurationTab, visible, visible && this.permissions.isConfigureRead())) { //updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane( // "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true); - updateSubTab(this.configurationTab, this.configCurrent, - new GroupResourceConfigurationEditView(this.configCurrent.extendLocatorId("View"), - this.groupComposite), true, true); + updateSubTab(this.configurationTab, this.configCurrent, new GroupResourceConfigurationEditView( + this.configCurrent.extendLocatorId("View"), this.groupComposite), true, true); updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane( "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true, true); }
if (updateTab(this.eventsTab, groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.EVENT), true)) { - updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(groupComposite), true, true); + updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab + .extendLocatorId("CompositeHistView"), groupComposite), true, true); }
this.show(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java index 05c37b6..159a679 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java @@ -276,13 +276,13 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo .isConfigureRead())) { updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this .extendLocatorId("ResourceConfigView"), resourceComposite), true, true); - updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf( - resource.getId()), true, true); + updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf(this + .extendLocatorId("ConfigHistView"), resource.getId()), true, true); }
if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) { - updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(resourceComposite), true, - true); + updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab + .extendLocatorId("CompositeHistoryView"), resourceComposite), true, true); }
if (updateTab(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT), true)) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java index aa11b05..8b84889 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java @@ -40,7 +40,6 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; */ public class ConfigurationHistoryView extends TableSection { public static final String VIEW_ID = "RecentConfigurationChanges"; - private static final String LOCATOR_ID = "ConfigurationHistory"; private static final String TITLE = "Configuration History";
private Integer resourceId; @@ -48,8 +47,8 @@ public class ConfigurationHistoryView extends TableSection { /** * Use this constructor to view config histories for all viewable Resources. */ - public ConfigurationHistoryView() { - super(LOCATOR_ID, TITLE); + public ConfigurationHistoryView(String locatorId) { + super(locatorId, TITLE); final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource(); setDataSource(datasource); } @@ -59,8 +58,8 @@ public class ConfigurationHistoryView extends TableSection { * * @param resourceId a Resource ID */ - public ConfigurationHistoryView(int resourceId) { - super(LOCATOR_ID, TITLE, createCriteria(resourceId)); + public ConfigurationHistoryView(String locatorId, int resourceId) { + super(locatorId, TITLE, createCriteria(resourceId)); this.resourceId = resourceId; ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource(); setDataSource(datasource); @@ -157,11 +156,10 @@ public class ConfigurationHistoryView extends TableSection {
}
- // -------- Static Utility loaders ------------
- public static ConfigurationHistoryView getHistoryOf(int resourceId) { - return new ConfigurationHistoryView(resourceId); + public static ConfigurationHistoryView getHistoryOf(String locatorId, int resourceId) { + return new ConfigurationHistoryView(locatorId, resourceId); }
} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java index 0a9359e..4970242 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java @@ -216,7 +216,7 @@ public class ReportTopView extends LocatableHLayout implements BookmarkableView } else if (MeasurementOOBView.VIEW_ID.equals(pageName)) { content = new MeasurementOOBView(this.extendLocatorId("SuspectMetrics")); } else if (ConfigurationHistoryView.VIEW_ID.equals(pageName)) { - content = new ConfigurationHistoryView(); + content = new ConfigurationHistoryView(this.extendLocatorId("ConfigHistory")); } else if (OperationHistoryView.VIEW_ID.equals(pageName)) { content = new OperationHistoryView(this.extendLocatorId("RecentOps")); } else if (AlertsView.VIEW_ID.equals(pageName)) {
commit f1000879c9f75dfa1153919ca5ca335ef6bf0286 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Oct 12 10:01:52 2010 -0400
Fix an issue where an F5 refresh while viewing a details page messed up the history and rendering. The problem seemed due to an assumption in the master-details impl that the master (list view) would always be rendered prior to a details page.
Also, fix an issue with null protection for RefreshableViews. Removed a showDetails() override in AbstractAlertDefinitionsView as the default behavior seems adequate.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java index 89a6c8b..bdaff67 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java @@ -18,7 +18,6 @@ */ package org.rhq.enterprise.gui.coregui.client.alert.definitions;
-import com.google.gwt.user.client.History; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.widgets.Canvas; @@ -102,17 +101,6 @@ public abstract class AbstractAlertDefinitionsView extends TableSection { }
@Override - public void showDetails(ListGridRecord record) { - Canvas canvas = getDetailsView(record); - setDetailsView(canvas); - - Integer id = record.getAttributeAsInt("id"); - History.newItem(getBasePath() + "/" + id.intValue(), false); - - switchToDetailsView(); - } - - @Override public Canvas getDetailsView(ListGridRecord record) { if (record == null) { return getDetailsView(0); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java index fe69ec7..b4aff2b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java @@ -437,14 +437,18 @@ public class Table extends LocatableHLayout implements RefreshableView { private ArrayList<Integer> fieldSizes = new ArrayList<Integer>();
public void refresh(Criteria criteria) { - this.listGrid.invalidateCache(); - this.listGrid.setCriteria(criteria); - this.listGrid.markForRedraw(); + if (null != this.listGrid) { + this.listGrid.invalidateCache(); + this.listGrid.setCriteria(criteria); + this.listGrid.markForRedraw(); + } }
public void refresh() { - this.listGrid.invalidateCache(); - this.listGrid.markForRedraw(); + if (null != this.listGrid) { + this.listGrid.invalidateCache(); + this.listGrid.markForRedraw(); + } }
public void setTableTitle(String titleString) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java index c8ab12b..f5118f7 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java @@ -85,6 +85,12 @@ public abstract class TableSection extends Table implements BookmarkableView { detailsHolder.hide();
addMember(detailsHolder); + + // if the detailsView is already defined it means we want the details view to be rendered prior to + // the master view, probably due to a direct navigation or refresh (like F5 when sitting on the details page) + if (null != detailsView) { + switchToDetailsView(); + } }
@Override @@ -222,6 +228,8 @@ public abstract class TableSection extends Table implements BookmarkableView { */ protected void switchToDetailsView() { Canvas contents = getTableContents(); + + // If the Table has not yet been initialized then ignore if (contents != null) { if (contents.isVisible()) { contents.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
rhq-commits@lists.fedorahosted.org