modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/drift/DriftDefinitionsView.java | 10 +- modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java | 35 +++++-- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java | 24 +++-- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 44 +++++----- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/GroupOperationJob.java | 27 ++++-- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java | 41 +++++---- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java | 39 ++++---- 7 files changed, 134 insertions(+), 86 deletions(-)
New commits: commit 2443d109e9823a31d72ef315562bc8a83bc27001 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Oct 21 18:19:00 2013 -0400
Test code work for OperationManagerBeanTest - Add some null protection - Shorten initial sleep time when waiting for a group resource operation history - handle case where operation history is deleted before it is detected by the group operation invoker.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java index d9b03ef..b572ca9 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java @@ -79,7 +79,7 @@ import org.rhq.enterprise.server.util.LookupUtil; public class OperationManagerBeanTest extends AbstractEJB3Test {
private static final boolean ENABLE_TESTS = true; - private static final String PREFIX = OperationManagerBeanTest.class.getSimpleName(); + private static final String PREFIX = OperationManagerBeanTest.class.getSimpleName() + "_";
private ConfigurationManagerLocal configurationManager; private OperationManagerLocal operationManager; @@ -132,8 +132,8 @@ public class OperationManagerBeanTest extends AbstractEJB3Test { try { deleteNewResource(newResource); } finally { - unprepareForTestAgents(); unprepareScheduler(); + unprepareForTestAgents(); } }
@@ -610,10 +610,11 @@ public class OperationManagerBeanTest extends AbstractEJB3Test { Thread.sleep(SECONDS.toMillis(5)); results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(), PageControl.getUnlimitedInstance()); - testOpComplete = results != null && results.size() == 1; + testOpComplete = !results.isEmpty(); } while (!testOpComplete && (nanoTime() - start) < MINUTES.toNanos(2));
assert testOpComplete; + assertEquals(1, results.size()); GroupOperationHistory history = results.get(0); assert history.getId() > 0 : history; assert history.getJobId() != null : history; @@ -1974,20 +1975,30 @@ public class OperationManagerBeanTest extends AbstractEJB3Test { getTransactionManager().begin(); em = getEntityManager();
+ ResourceGroup group = null; Resource res = em.find(Resource.class, resource.getId()); - ResourceGroup group = res.getExplicitGroups().iterator().next(); - + if (null != res) { + if (res.getExplicitGroups().iterator().hasNext()) { + group = res.getExplicitGroups().iterator().next(); + } + } getTransactionManager().commit();
- // then invoke bulk delete on the resource to remove any dependencies not defined in the hibernate entity model - // perform in-band and out-of-band work in quick succession - List<Integer> deletedIds = resourceManager.uninventoryResource(overlord(), resource.getId()); - for (Integer deletedResourceId : deletedIds) { - resourceManager.uninventoryResourceAsyncWork(overlord(), deletedResourceId); + Subject overlord = overlord(); + + // delete the group if necessary + if (null != group) { + resourceGroupManager.deleteResourceGroup(overlord, group.getId()); }
- // then kill the group via the RG manager, it also handles cleanup of non hibernate model info - resourceGroupManager.deleteResourceGroup(overlord(), group.getId()); + // invoke bulk delete on the resource to remove any dependencies not defined in the hibernate entity model + // perform in-band and out-of-band work in quick succession + if (null != res) { + List<Integer> deletedIds = resourceManager.uninventoryResource(overlord, res.getId()); + for (Integer deletedResourceId : deletedIds) { + resourceManager.uninventoryResourceAsyncWork(overlord, deletedResourceId); + } + }
// now dispose of other hibernate entities getTransactionManager().begin(); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/GroupOperationJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/GroupOperationJob.java index 0f3eaac..5dbea68 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/GroupOperationJob.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/GroupOperationJob.java @@ -137,7 +137,7 @@ public class GroupOperationJob extends OperationJob { ResourceOperationSchedule resourceSchedule = createScheduleForResource(schedule, jobDetail.getGroup(), user, nextResourceToOperateOn);
- // crate the resource-level history entity for the newly created non-quartz schedule entity + // create the resource-level history entity for the newly created non-quartz schedule entity // this method also does the persisting ResourceOperationHistory resourceHistory = createOperationHistory(resourceSchedule.getJobName(), resourceSchedule.getJobGroup(), resourceSchedule, groupHistory, operationManager); @@ -171,11 +171,25 @@ public class GroupOperationJob extends OperationJob { invokeOperationOnResource(composite, operationManager);
int resourceHistoryId = composite.history.getId(); - OperationHistory updatedOperationHistory; + OperationHistory updatedOperationHistory = null; + long sleep = 1000L; // quick sleep for fast ops, then slow down + long maxSleep = 5000L; do { - Thread.sleep(5000); - updatedOperationHistory = operationManager.getOperationHistoryByHistoryId( - getUserWithSession(user, true), resourceHistoryId); + Thread.sleep(sleep); + sleep = (sleep == maxSleep) ? sleep : sleep + 1000L; + + // it's unlikely but possible that a client program could actually query for, process, and + // delete the history before this code gets a chance to run. If the record is gone just + // assume things were handled externally. + try { + updatedOperationHistory = operationManager.getOperationHistoryByHistoryId( + getUserWithSession(user, true), resourceHistoryId); + } catch (IllegalArgumentException e) { + if (log.isDebugEnabled()) { + log.debug("Failed to find operation history", e); + } + break; + }
// if the duration was ridiculously long, let's break out of here. this will rarely // be triggered because our operation manager will timeout long running operations for us @@ -189,7 +203,8 @@ public class GroupOperationJob extends OperationJob { } while (updatedOperationHistory.getStatus() == OperationRequestStatus.INPROGRESS);
// halt the rest if we got a failure and were told not to go on - if ((updatedOperationHistory.getStatus() != OperationRequestStatus.SUCCESS) + if (null != updatedOperationHistory + && (updatedOperationHistory.getStatus() != OperationRequestStatus.SUCCESS) && schedule.isHaltOnFailure()) { hadFailure = true; } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java index 6f7b955..e68b824 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java @@ -232,7 +232,8 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
ensureControlPermission(subject, resource);
- OperationDefinition opDef = validateOperationNameAndParameters(resource.getResourceType(), operationName, parameters); + OperationDefinition opDef = validateOperationNameAndParameters(resource.getResourceType(), operationName, + parameters);
String uniqueJobId = createUniqueJobName(resource, operationName);
@@ -289,7 +290,7 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan // we need a copy to avoid constraint violations upon delete parameters == null ? null : parameters.deepCopy(false), schedule.getResource(), null);
- updateOperationHistory(subject,history); + updateOperationHistory(subject, history);
return newSchedule; } @@ -701,7 +702,7 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan OperationHistory history = entityManager.find(OperationHistory.class, historyId);
if (history == null) { - throw new RuntimeException("Cannot get history - it does not exist: " + historyId); + throw new IllegalArgumentException("Cannot get history - it does not exist: " + historyId); }
if (history.getParameters() != null) { @@ -905,21 +906,28 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan ensureControlPermission(subject, history); }
- // The history item may have been created already, so find it in the database and // set the new state from our input - if (history.getId()!=0) { - OperationHistory existingHistoryItem =entityManager.find(OperationHistory.class,history.getId()); + if (history.getId() != 0) { + OperationHistory existingHistoryItem = entityManager.find(OperationHistory.class, history.getId()); + if (null == existingHistoryItem) { + throw new IllegalArgumentException( + "Can not update operation history, history record not found. This call creates a new operation history record only if the supplied history argument has id set to 0. [" + + history + "]"); + } + existingHistoryItem.setStatus(history.getStatus()); existingHistoryItem.setErrorMessage(history.getErrorMessage()); - if (existingHistoryItem.getStartedTime()==0) { + if (existingHistoryItem.getStartedTime() == 0) { existingHistoryItem.setStartedTime(history.getStartedTime()); } if (history instanceof ResourceOperationHistory) { - ((ResourceOperationHistory)existingHistoryItem).setResults(((ResourceOperationHistory) history).getResults()); + ((ResourceOperationHistory) existingHistoryItem).setResults(((ResourceOperationHistory) history) + .getResults()); } history = existingHistoryItem; } + // we do not cascade add the param config (we probably can add that but), so let's persist it now if needed Configuration parameters = history.getParameters(); if ((parameters != null) && (parameters.getId() == 0)) { @@ -2026,8 +2034,8 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan OperationDefinitionCriteria criteria) { CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- CriteriaQueryRunner<OperationDefinition> queryRunner = new CriteriaQueryRunner<OperationDefinition>(criteria, generator, - entityManager); + CriteriaQueryRunner<OperationDefinition> queryRunner = new CriteriaQueryRunner<OperationDefinition>(criteria, + generator, entityManager); return queryRunner.execute(); }
@@ -2039,8 +2047,8 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan subject.getId()); }
- CriteriaQueryRunner<ResourceOperationHistory> queryRunner = new CriteriaQueryRunner<ResourceOperationHistory>(criteria, generator, - entityManager); + CriteriaQueryRunner<ResourceOperationHistory> queryRunner = new CriteriaQueryRunner<ResourceOperationHistory>( + criteria, generator, entityManager); return queryRunner.execute(); }
@@ -2052,8 +2060,8 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan subject.getId()); }
- CriteriaQueryRunner<GroupOperationHistory> queryRunner = new CriteriaQueryRunner<GroupOperationHistory>(criteria, generator, - entityManager); + CriteriaQueryRunner<GroupOperationHistory> queryRunner = new CriteriaQueryRunner<GroupOperationHistory>( + criteria, generator, entityManager); return queryRunner.execute(); }
@@ -2170,9 +2178,8 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan return trigger; }
- private OperationDefinition validateOperationNameAndParameters(ResourceType resourceType, - String operationName, - Configuration parameters) { + private OperationDefinition validateOperationNameAndParameters(ResourceType resourceType, String operationName, + Configuration parameters) { Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions(); OperationDefinition matchingOperationDefinition = null; for (OperationDefinition operationDefinition : operationDefinitions) { diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java index 2d1ea239..9944aca 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java @@ -72,8 +72,7 @@ public interface OperationManagerLocal { * scheduled operation */ int scheduleResourceOperation(Subject subject, ResourceOperationSchedule schedule); - - + /** * Schedules a Resource operation for execution using the cron expression. * @@ -102,7 +101,7 @@ public interface OperationManagerLocal { * 0 11 11 11 11 ? Fire every November 11th at 11:11am. * </pre> * @param timeout the number of seconds before this operation will fail due to timeout. 0 for no timeout. - * @param parameters the names parameters for the operation. + * @param parameters the names parameters for the operation. * @param description user-entered description of the job to be scheduled * * @return the information on the new schedule @@ -229,7 +228,7 @@ public interface OperationManagerLocal { /** * Given a Resource operation job's details, this returns a schedule POJO corresponding to that job. * - * @param subject + * @param subject * @param jobDetail * * @return the object that encapsulates the resource schedule, or null if the specified job is no longer scheduled @@ -240,7 +239,7 @@ public interface OperationManagerLocal { /** * Given a resource job's id, this returns the schedule for that resource job. * - * @param subject + * @param subject * @param jobId * * @return the object that encapsulates the resource schedule @@ -252,7 +251,7 @@ public interface OperationManagerLocal { /** * Given a group operation job's details, this returns a schedule POJO corresponding to that job. * - * @param subject + * @param subject * @param jobDetail * * @return the object that encapsulates the group schedule, , or null if the specified job is no longer scheduled @@ -263,7 +262,7 @@ public interface OperationManagerLocal { /** * Given a group job's id, this returns the schedule for that group job. * - * @param subject + * @param subject * @param jobId * * @return the object that encapsulates the group schedule @@ -326,26 +325,26 @@ public interface OperationManagerLocal { * AlertConditionCacheManager using that corresponding group history element.</p> * * @param subject the user that the job is executing under - * @param history the history with the data to be updated - * - * @return the updated history + * @param history the history with the data to be updated. The history record will be created if id is set to 0. + * Otherwise the record must already exist and will be updated. + * @return the updated or newly created history */ OperationHistory updateOperationHistory(Subject subject, OperationHistory history);
/** * This is, for all intents and purposes, and internal method. It should be called just after updating any * OperationHistory element. To date, this includes two places: - * + * * a) post-processing hook to updateOperationHistory(Subject whoami, OperationHistory history) * b) embedded inside the logic for checkForTimedOutOperations(Subject) - * + * * This method will perform the following logic: - * + * * 1) checks whether the entity corresponding to the passed id is part of a larger GroupOperationHistory * 2) if #1 is true, it will further check whether that entity was the last element from the group to complete * 3) if #2 is true, it will perform the necessary logic to moving the associated GroupOperationHistory entity * to the appropriate termination state - * + * * @param historyId the integer id of the OperationHistory entity that needs to be checked */ void checkForCompletedGroupOperation(int historyId); @@ -635,8 +634,7 @@ public interface OperationManagerLocal { * @return resource scheduled operations * @throws Exception TODO */ - List<ResourceOperationSchedule> findScheduledResourceOperations(Subject subject, int resourceId) - throws Exception; + List<ResourceOperationSchedule> findScheduledResourceOperations(Subject subject, int resourceId) throws Exception;
/** * Returns the definitions of all the operations supported by the given resource. @@ -665,9 +663,9 @@ public interface OperationManagerLocal { * @param operationName the actual operation to invoke * @param delay the number of milliseconds to delay this operation, 0 for immediate start. * @param repeatInterval the number of milliseconds after completion to repeat this operation. 0 for no repeat. - * @param repeatCount the number of times to repeat this operation. -1 infinite, 0 for no repeat. + * @param repeatCount the number of times to repeat this operation. -1 infinite, 0 for no repeat. * @param timeout the number of seconds before this operation will fail due to timeout. 0 for no timeout. - * @param parameters the names parameters for the operation. + * @param parameters the names parameters for the operation. * @param description user-entered description of the job to be scheduled * * @return the information on the new schedule @@ -676,7 +674,7 @@ public interface OperationManagerLocal { ResourceOperationSchedule scheduleResourceOperation(Subject subject, int resourceId, String operationName, long delay, long repeatInterval, int repeatCount, int timeout, Configuration parameters, String description) throws ScheduleException; - + /** * Schedules an operation for execution on members of the given group using the cron expression. * @@ -740,7 +738,8 @@ public interface OperationManagerLocal { */ void unscheduleGroupOperation(Subject subject, String jobId, int resourceGroupId) throws UnscheduleException;
- PageList<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject, OperationDefinitionCriteria criteria); + PageList<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject, + OperationDefinitionCriteria criteria);
PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(Subject subject, ResourceOperationHistoryCriteria criteria);
commit 5c7499fd0e887f0608ca8e53b8abd7922d9ded85 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Oct 21 17:26:32 2013 -0400
Test code work for OperationManagerBeanTest - This change mainy affects test code involving operation execution but is actually a tweak to overlord session handling in general. Ensure that when operations execute as overlord they use the shared overlord session. Furthermore, don't let the shared overlord session be invalidated by a call to logout, only by session expiration.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java index 07da23e..d6b5177 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SessionManager.java @@ -33,20 +33,20 @@ import org.rhq.enterprise.server.util.LookupUtil; * purpose is to provide session IDs to logged in {@link Subject}s. It will timeout those sessions regardless of any * container-provided session-timeout mechanism. * <p> - * Because this is a very security-sensitive class, any public method requires the caller to + * Because this is a very security-sensitive class, any public method requires the caller to * have the {@link AllowEjbAccessPermission} as any other calls to the EJB layer. This is so that the * malicious users can't trick the EJB layer into thinking that some users are logged in or log out other * users. * <p> * Also, for security reasons, this class is final so that malicious code can't subclass it and modify its * behavior. - * + * * <p>This object is a {@link #getInstance() singleton}.</p> */ public final class SessionManager { - + private static final AllowRhqServerInternalsAccessPermission ACCESS_PERMISSION = new AllowRhqServerInternalsAccessPermission(); - + /** * Our source for random session IDs. */ @@ -90,7 +90,7 @@ public final class SessionManager {
/** * Return the singleton object. - * + * * @return the {@link SessionManager} */ public static SessionManager getInstance() { @@ -188,6 +188,13 @@ public final class SessionManager { */ public synchronized void invalidate(int sessionId) { checkPermission(); + + // we currently use a shared session for overlord. don't log it out as it could affect another caller's use + // of the overlord user. The session will expire if unused by any caller for the overlord timeout period. + if (overlordSubject != null && (overlordSubject.getSessionId() == sessionId)) { + return; + } + _cache.remove(new Integer(sessionId));
// while we are here, let's go through the entire session cache and remove expired sessions @@ -292,9 +299,10 @@ public final class SessionManager {
return copy; } - + private static void checkPermission() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) sm.checkPermission(ACCESS_PERMISSION); + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(ACCESS_PERMISSION); } } \ No newline at end of file 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 194a5f9..97d91ca 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 @@ -302,7 +302,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe * @see org.rhq.enterprise.server.auth.SubjectManagerRemote#getSubjectByName(String) */ public Subject getSubjectByName(String username) { - //TODO: this method needs to be modified to require a Subject and probably MANAGE_SECURITY + //TODO: this method needs to be modified to require a Subject and probably MANAGE_SECURITY // permissions to defend against unrestricted access to subjects.
SubjectCriteria c = new SubjectCriteria(); @@ -430,11 +430,11 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe /**This method is applied to Subject instances that may require LDAP auth/authz processing. * Called from both SLSB and SubjectGWTServiceImpl and: * -if Subject passed in has Principal(not LDAP account) then we immediately return Subject as no processing needed. - * -if Subject for LDAP account - * + * -if Subject for LDAP account + * * @param subject Authenticated subject. * @return same or new Subject returned from LDAP processing. - * @throws LoginException + * @throws LoginException */ public Subject processSubjectForLdap(Subject subject, String subjectPassword) throws LoginException { if (subject != null) {//null check @@ -481,7 +481,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe // We've verified that this user has valid session, and is using ldap. Safe to elevate search here. PageList<Subject> subjectsLocated = findSubjectsByCriteria(getOverlord(), subjectCriteria); //if subject variants located then take the first one with a principal otherwise do nothing - //To defend against the case where they create an account with the same name but not + //To defend against the case where they create an account with the same name but not //case as an rhq sysadmin or higher perms, then make them relogin with same creds entered. if ((!subjectsLocated.isEmpty()) && (!subjectsLocated.get(0).getName().equals(subject.getName()))) {//then case insensitive username matches found. Try to use instead. @@ -530,7 +530,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe + "] with LDAP groups [" + groupNames + "]..."); ldapManager.assignRolesToLdapSubject(subject.getId(), groupNames); } - } else {//ldap not configured. Somehow authenticated for LDAP without ldap being configured. Error. Bail + } else {//ldap not configured. Somehow authenticated for LDAP without ldap being configured. Error. Bail throw new LoginException("You are authenticated for LDAP, but LDAP is not configured."); } } @@ -543,7 +543,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe */ public void logout(Subject subject) { try { - // make sure the Subject is valid by pairing the name and sessionId + // make sure the Subject is valid by pairing the name and sessionId Subject s = getSubjectByNameAndSessionId(subject.getName(), subject.getSessionId()); sessionManager.invalidate(s.getSessionId()); } catch (Exception e) { @@ -640,6 +640,12 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe */ public Subject loginUnauthenticated(String username) throws LoginException {
+ // we currently use a shared session for overlord. ensure we use the shared session if the overlord user is + // requested. + if ("admin".equals(username)) { + return getOverlord(); + } + Subject subject = getSubjectByName(username);
if (subject == null) { @@ -650,7 +656,7 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe throw new LoginException("User account has been disabled. [" + username + "]"); }
- // make sure we return the Subject returned from this call, which may differ from the one passed in + // make sure we return the Subject returned from this call, which may differ from the one passed in subject = sessionManager.put(subject, 1000L * 60 * 2); // 2mins only return subject; } @@ -699,7 +705,8 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe if (log.isDebugEnabled()) { log.error("Error deleting owned group " + Arrays.toString(ownedGroupIds), t); } else { - log.error("Error deleting owned group " + Arrays.toString(ownedGroupIds) + ": " + t.getMessage()); + log.error("Error deleting owned group " + Arrays.toString(ownedGroupIds) + ": " + + t.getMessage()); } } } @@ -708,7 +715,8 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe SavedSearchCriteria savedSearchCriteria = new SavedSearchCriteria(); savedSearchCriteria.addFilterSubjectId(doomedSubjectId); savedSearchCriteria.clearPaging(); - PageList<SavedSearch> savedSearches = savedSearchManager.findSavedSearchesByCriteria(subject, savedSearchCriteria); + PageList<SavedSearch> savedSearches = savedSearchManager.findSavedSearchesByCriteria(subject, + savedSearchCriteria); for (SavedSearch savedSearch : savedSearches) { savedSearchManager.deleteSavedSearch(subject, savedSearch.getId()); } @@ -863,23 +871,23 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe // http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=servers/sla... Map<String, String> ldapUserAttributes = ldapManager.findLdapUserDetails(subject.getName());
- String givenName = (ldapUserAttributes.get("givenName") != null) ? - ldapUserAttributes.get("givenName") : ldapUserAttributes.get("gn"); + String givenName = (ldapUserAttributes.get("givenName") != null) ? ldapUserAttributes.get("givenName") + : ldapUserAttributes.get("gn"); subject.setFirstName(givenName);
- String surname = (ldapUserAttributes.get("sn") != null) ? - ldapUserAttributes.get("sn") : ldapUserAttributes.get("surname"); + String surname = (ldapUserAttributes.get("sn") != null) ? ldapUserAttributes.get("sn") : ldapUserAttributes + .get("surname"); subject.setLastName(surname);
String telephoneNumber = ldapUserAttributes.get("telephoneNumber"); subject.setPhoneNumber(telephoneNumber);
- String mail = (ldapUserAttributes.get("mail") != null) ? - ldapUserAttributes.get("mail") : ldapUserAttributes.get("rfc822Mailbox"); + String mail = (ldapUserAttributes.get("mail") != null) ? ldapUserAttributes.get("mail") : ldapUserAttributes + .get("rfc822Mailbox"); subject.setEmailAddress(mail);
- String organizationalUnit = (ldapUserAttributes.get("ou") != null) ? - ldapUserAttributes.get("ou") : ldapUserAttributes.get("organizationalUnitName"); + String organizationalUnit = (ldapUserAttributes.get("ou") != null) ? ldapUserAttributes.get("ou") + : ldapUserAttributes.get("organizationalUnitName"); subject.setDepartment(organizationalUnit);
return;
commit 686ba01de5b5b11a1c3ae7a8d61bb2130ff87772 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Oct 21 15:02:25 2013 -0400
Bug 1021675 - drift's new and detect all button should change Fixed
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/drift/DriftDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/drift/DriftDefinitionsView.java index 7555054..be268af 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/drift/DriftDefinitionsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/drift/DriftDefinitionsView.java @@ -50,8 +50,8 @@ import org.rhq.coregui.client.util.message.Message; /** * A list view that displays a paginated table of {@link org.rhq.core.domain.drift.DriftDefinition}s. It has offers various * options on the list like filtering (maybe) and sorting, add new/delete. Double-click drills down to the carousel view for - * inspecting drift for the definition. Also, allows an edit view for the def's underlying Config. This view full respects - * the user's authorization, and will not allow actions on the drift defs unless the user is either the inventory + * inspecting drift for the definition. Also, allows an edit view for the def's underlying Config. This view full respects + * the user's authorization, and will not allow actions on the drift defs unless the user is either the inventory * manager or has MANAGE_DRIFT permission on every resource corresponding to the drift defs being operated on. * * @author Jay Shaughnessy @@ -135,7 +135,7 @@ public class DriftDefinitionsView extends TableSection<DriftDefinitionDataSource TableActionEnablement detectNowEnablement = hasWriteAccess ? TableActionEnablement.SINGLE : TableActionEnablement.NEVER;
- addTableAction("New", MSG.common_button_new(), null, new TableAction() { + addTableAction(MSG.common_button_new(), null, new TableAction() { public boolean isEnabled(ListGridRecord[] selection) { return hasWriteAccess; } @@ -164,7 +164,7 @@ public class DriftDefinitionsView extends TableSection<DriftDefinitionDataSource } });
- addTableAction("DetectNow", MSG.view_drift_button_detectNow(), null, new AbstractTableAction( + addTableAction(MSG.view_drift_button_detectNow(), null, new AbstractTableAction( detectNowEnablement) { @Override public boolean isEnabled(ListGridRecord[] selection) { @@ -247,7 +247,7 @@ public class DriftDefinitionsView extends TableSection<DriftDefinitionDataSource @Override public void renderView(ViewPath viewPath) { // we have three detail views for drift defs, the carousel, the the config editor, and the initial snapshot. - // Figure out which one we're dealing with. The default is the carousel. + // Figure out which one we're dealing with. The default is the carousel. this.detailsView = DetailView.Carousel;
if (!viewPath.isEnd() && !viewPath.isNextEnd()) {
rhq-commits@lists.fedorahosted.org