List of usage examples for org.apache.commons.logging Log trace
void trace(Object message);
From source file:org.hyperic.hq.ui.action.resource.group.control.ListDetailAction.java
/** * Retrieves details of history event./* www .jav a2 s. com*/ */ public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Log log = LogFactory.getLog(ListDetailAction.class.getName()); log.trace("getting group control history details"); int sessionId = RequestUtils.getSessionId(request).intValue(); AppdefEntityID appdefId = RequestUtils.getEntityId(request); int batchId = RequestUtils.getIntParameter(request, Constants.CONTROL_BATCH_ID_PARAM).intValue(); PageControl pc = RequestUtils.getPageControl(request); PageList<ControlHistory> histList = controlBoss.findGroupJobHistory(sessionId, appdefId, batchId, pc); request.setAttribute(Constants.CONTROL_HST_DETAIL_ATTR, histList); request.setAttribute(Constants.LIST_SIZE_ATTR, new Integer(histList.getTotalSize())); // have set page size by hand b/c of redirects BaseValidatorForm sForm = (BaseValidatorForm) form; try { sForm.setPs(Constants.PAGESIZE_DEFAULT); sForm.setPs(RequestUtils.getIntParameter(request, Constants.PAGESIZE_PARAM)); } catch (NullPointerException npe) { } catch (ParameterNotFoundException pnfe) { } catch (NumberFormatException nfe) { } log.trace("successfully obtained group control history"); return null; }
From source file:org.hyperic.hq.ui.action.resource.group.inventory.AddGroupResourcesFormPrepareAction.java
/** * Retrieve this data and store it in the specified request parameters: * // www. j a v a 2 s .c o m * <ul> * <li><code>GroupValue</code> object identified by * <code>Constants.RESOURCE_PARAM</code> request parameter in * <code>Constants.RESOURCE_ATTR</code></li> * * <li><code>List</code> of available <code>AppdefResourceValue</code> * objects (those not already associated with the group) in * <code>Constants.AVAIL_RESOURCES_ATTR</code></li> * <li><code>Integer</code> number of available roles in * <code>Constants.NUM_AVAIL_RESOURCES_ATTR</code></li> * * <li><code>List</code> of pending <code>OwnedRoleValue</code> objects * (those in queue to be associated with the resource) in * <code>Constants.PENDING_RESOURCES_ATTR</code></li> * <li><code>Integer</code> number of pending resources in * <code>Constants.NUM_PENDING_RESOURCES_ATTR</code></li> * * <li><code>List</code> of pending <code>AppdefResourceValue</code> ids * (those in queue to be associated with the resource) in * <code>Constants.PENDING_RESOURCES_SES_ATTR</code></li> * </ul> * * This Action edits 2 lists of Resources: pending, and available. */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Log log = LogFactory.getLog(getClass().getName()); AddGroupResourcesForm addForm = (AddGroupResourcesForm) form; Integer groupId = addForm.getRid(); PageControl pcPending; if (groupId == null) { groupId = RequestUtils.getResourceId(request); } int sessionId = RequestUtils.getSessionIdInt(request); PageControl pcAvail = RequestUtils.getPageControl(request, "psa", "pna", "soa", "sca"); pcPending = RequestUtils.getPageControl(request, "psp", "pnp", "sop", "scp"); AppdefGroupValue group = (AppdefGroupValue) RequestUtils.getResource(request); if (group == null) { RequestUtils.setError(request, "resource.group.inventory.error.GroupNotFound"); return null; } RequestUtils.setResource(request, group); addForm.setRid(group.getId()); log.trace("available page control: " + pcAvail); log.trace("pending page control: " + pcPending); log.trace("getting group [" + groupId + "]"); // XXX: if group == null, throw AppdefGroupNotFoundException /* * pending resources are those on the right side of the "add to list" * widget- awaiting association with the group when the form's "ok" * button is clicked. */ List<String> pendingResourceIds = SessionUtils.getListAsListStr(request.getSession(), Constants.PENDING_RESOURCES_SES_ATTR); String nameFilter = RequestUtils.getStringParameter(request, "nameFilter", null); log.trace("getting pending resources for group [" + groupId + "]"); List<AppdefEntityID> entities = BizappUtils.buildAppdefEntityIds(pendingResourceIds); AppdefEntityID[] pendingResItems; if (entities.size() > 0) { pendingResItems = new AppdefEntityID[entities.size()]; entities.toArray(pendingResItems); } else { pendingResItems = null; } List<AppdefResourceValue> pendingResources = BizappUtils.buildAppdefResources(sessionId, appdefBoss, pendingResItems); List<AppdefResourceValue> sortedPendingResource = BizappUtils.sortAppdefResource(pendingResources, pcPending); PageList<AppdefResourceValue> pendingList = new PageList<AppdefResourceValue>(); pendingList.setTotalSize(sortedPendingResource.size()); Pager pendingPager = Pager.getDefaultPager(); pendingList = pendingPager.seek(sortedPendingResource, pcPending.getPagenum(), pcPending.getPagesize()); request.setAttribute(Constants.PENDING_RESOURCES_ATTR, pendingList); request.setAttribute(Constants.NUM_PENDING_RESOURCES_ATTR, new Integer(sortedPendingResource.size())); /* * available resources are all resources in the system that are not * associated with the user and are not pending */ log.trace("getting available resources for group [" + groupId + "]"); String filterBy = addForm.getFilterBy(); int appdefType = -1; if (filterBy != null) { appdefType = Integer.parseInt(filterBy); } PrepareResourceGroup p; if (group.isGroupCompat()) p = new PrepareCompatGroup(); else if (group.getGroupType() == AppdefEntityConstants.APPDEF_TYPE_GROUP_ADHOC_APP) p = new PrepareApplicationGroup(); else if (group.getGroupType() == AppdefEntityConstants.APPDEF_TYPE_GROUP_ADHOC_GRP) p = new PrepareGroupOfGroups(); else p = new PrepareMixedGroup(); p.loadGroupMembers(sessionId, addForm, group, appdefBoss, appdefType, nameFilter, pendingResItems, pcAvail); PageList availResources = p.getAvailResources(); request.setAttribute(Constants.AVAIL_RESOURCES_ATTR, availResources); request.setAttribute(Constants.NUM_AVAIL_RESOURCES_ATTR, new Integer(availResources.getTotalSize())); return null; }
From source file:org.hyperic.hq.ui.action.resource.group.monitor.config.EditAvailabilityFormPrepareAction.java
/** * Retrieve this data and store it in the specified request parameters: * /*from ww w .j a v a2 s. c om*/ * <ul> * <li><code>AppdefEntityId</code> object identified by * <code>Constants.RESOURCE_ID_PARAM</code> and * <code>Constants.RESOURCE_TYPE_PARAM</code></li> * <li><code>List</code> of available <code>Metrics</code> objects (those * not already associated with the resource) in * <code>Constants.AVAIL_METRICS_ATTR</code></li> * <li><code>Integer</code> number of available metrics in * <code>Constants.NUM_AVAIL_METRICS_ATTR</code></li> * <li><code>List</code> of pending <code>Metrics</code> objects (those in * queue to be associated with the resource) in * <code>Constants.PENDING_METRICS_ATTR</code></li> * <li><code>Integer</code> number of pending metrics in * <code>Constants.NUM_PENDING_METRICS_ATTR</code></li> * </ul> */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Log log = LogFactory.getLog(EditAvailabilityFormPrepareAction.class.getName()); GroupMonitoringConfigForm addForm = (GroupMonitoringConfigForm) form; Integer resourceId = addForm.getRid(); Integer entityType = addForm.getType(); if (resourceId == null) { resourceId = RequestUtils.getResourceId(request); } if (entityType == null) { entityType = RequestUtils.getResourceTypeId(request); } AppdefResourceValue resource = RequestUtils.getResource(request); if (resource == null) { RequestUtils.setError(request, Constants.ERR_RESOURCE_NOT_FOUND); return null; } log.trace("Getting availability threshold metrics"); // XXX actually set the availability and unavailability thresholds return null; }
From source file:org.hyperic.hq.ui.action.resource.server.inventory.RemoveServiceAction.java
/** * Removes a server identified by the value of the request parameter * <code>Constants.SERVER_PARAM</code> from the BizApp. * @return/* w ww. ja va 2s . c o m*/ */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Log log = LogFactory.getLog(RemoveServiceAction.class.getName()); RemoveResourceForm nwForm = (RemoveResourceForm) form; AppdefEntityID aeid = new AppdefEntityID(nwForm.getEid()); Integer[] resources = nwForm.getResources(); Map<String, Object> params = new HashMap<String, Object>(2); params.put(Constants.ENTITY_ID_PARAM, aeid); if (aeid.isPlatform()) { params.put(Constants.ACCORDION_PARAM, "3"); } else { params.put(Constants.ACCORDION_PARAM, "1"); } if (resources == null || resources.length == 0) { returnSuccess(request, mapping, params); } Integer sessionId = RequestUtils.getSessionId(request); log.trace("removing resource"); for (int i = 0; i < resources.length; i++) { appdefBoss.removeAppdefEntity(sessionId.intValue(), AppdefEntityID.newServiceID(resources[i]), false); } return returnSuccess(request, mapping, params); }
From source file:org.hyperic.hq.ui.util.RequestUtils.java
public static void dumpRequestParams(ServletRequest request, Log log, boolean html) { log.trace(dumpRequestParamsToString(request, html)); }
From source file:org.kuali.kra.logging.BufferedLogger.java
/** * Wraps {@link Log#trace(String)}/* w ww . j a va 2 s .c om*/ * * @param pattern to format against * @param objs an array of objects used as parameters to the <code>pattern</code> */ public static final void trace(Object... objs) { Log log = getLogger(); if (log.isTraceEnabled()) { log.trace(getMessage(objs)); } }
From source file:org.openhie.openempi.matching.fellegisunter.FellegiSunterParameters.java
public void logVectorFrequencies(Log log) { log.trace("Vector Frequencies:"); for (int i = 0; i < vectorCount; i++) { log.trace(i + "=>" + vectorFrequencies[i]); }// w w w .j a v a 2 s .co m }
From source file:org.openspaces.grid.gsm.machines.MachinesSlaUtils.java
public static Collection<GridServiceAgent> sortAndFilterAgents(GridServiceAgent[] agents, ElasticMachineProvisioningConfig machineProvisioningConfig, Log logger) { Set<GridServiceAgent> filteredAgents = new LinkedHashSet<GridServiceAgent>(); //maintain order for (final GridServiceAgent agent : agents) { if (!agent.isDiscovered()) { if (logger.isDebugEnabled()) { logger.debug(//from w ww .ja v a 2 s .c o m "Agent " + MachinesSlaUtils.machineToString(agent.getMachine()) + " has shutdown."); } } else if (!MachinesSlaUtils.isAgentConformsToMachineProvisioningConfig(agent, machineProvisioningConfig)) { if (logger.isDebugEnabled()) { agent.getExactZones().isStasfies(machineProvisioningConfig.getGridServiceAgentZones()); ExactZonesConfig agentZones = agent.getExactZones(); ZonesConfig puZones = machineProvisioningConfig.getGridServiceAgentZones(); boolean isDedicatedManagedmentMachines = machineProvisioningConfig .isDedicatedManagementMachines(); boolean isManagementRunningOnMachine = MachinesSlaUtils .isManagementRunningOnMachine(agent.getMachine()); StringBuilder logMessage = new StringBuilder(); logMessage.append("Agent ").append(MachinesSlaUtils.machineToString(agent.getMachine())) .append(" does not conform to machine provisioning SLA. ").append("Agent zones: ") .append(agentZones).append(",").append("PU zones: ").append(puZones).append(", ") .append("Is dedicated management machines: ").append(isDedicatedManagedmentMachines) .append(", ").append("Is management running on machine: ") .append(isManagementRunningOnMachine); logger.debug(logMessage.toString()); } } else { if (logger.isTraceEnabled()) { logger.trace("Agent " + MachinesSlaUtils.machineToString(agent.getMachine()) + " conforms to machine provisioning SLA."); } filteredAgents.add(agent); } } //TODO: Move this sort into the bin packing solver. It already has the priority of each machine // so it can sort it by itself. final List<GridServiceAgent> sortedFilteredAgents = MachinesSlaUtils.sortManagementFirst(filteredAgents); if (logger.isDebugEnabled()) { logger.debug("Provisioned Agents: " + MachinesSlaUtils.machinesToString(sortedFilteredAgents)); } return sortedFilteredAgents; }
From source file:org.rhq.enterprise.gui.admin.home.AdminHomePortalAction.java
/** * Set up the Admin Home portal.//from www . ja v a2 s .c o m */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Log log = LogFactory.getLog(AdminHomePortalAction.class.getName()); Portal portal = Portal.createPortal(TITLE_HOME, PORTLET_HOME); request.setAttribute(Constants.PORTAL_KEY, portal); String returnPath = ActionUtils.findReturnPath(mapping, null); if (log.isTraceEnabled()) { log.trace("setting return path: " + returnPath); } SessionUtils.setReturnPath(request.getSession(), returnPath); return null; }
From source file:org.rhq.enterprise.gui.admin.role.AddLdapGroupsFormPrepareAction.java
public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Log log = LogFactory.getLog(AddLdapGroupsFormPrepareAction.class.getName()); AddLdapGroupsForm addForm = (AddLdapGroupsForm) form; Integer roleId = addForm.getR(); if (roleId == null) { roleId = RequestUtils.getRoleId(request); }//w w w . j a v a 2 s . com Role role = (Role) request.getAttribute(Constants.ROLE_ATTR); if (role == null) { RequestUtils.setError(request, Constants.ERR_ROLE_NOT_FOUND); return null; } //use cached LDAP group list to avoid hitting ldap server each time ui pref changed. Set<Map<String, String>> cachedAvailableLdapGroups = null; cachedAvailableLdapGroups = (Set<Map<String, String>>) request.getSession().getAttribute(LDAP_GROUP_CACHE); addForm.setR(role.getId()); PageControl pca = WebUtility.getPageControl(request, "a"); PageControl pcp = WebUtility.getPageControl(request, "p"); //BZ-580127 Refactor so that all lists are initialized regardless of ldap server // availability or state of filter params List<String> pendingGroupIds = new ArrayList<String>(); Set<Map<String, String>> allGroups = new HashSet<Map<String, String>>(); PageList<LdapGroup> assignedList = new PageList<LdapGroup>(); Set<Map<String, String>> availableGroupsSet = new HashSet<Map<String, String>>(); Set<Map<String, String>> pendingSet = new HashSet<Map<String, String>>(); PageList<Map<String, String>> pendingGroups = new PageList<Map<String, String>>(pendingSet, 0, pcp); PageList<Map<String, String>> availableGroups = new PageList<Map<String, String>>(availableGroupsSet, 0, pca); /* pending groups are those on the right side of the "add * to list" widget- awaiting association with the role when the form's "ok" button is clicked. */ pendingGroupIds = SessionUtils.getListAsListStr(request.getSession(), Constants.PENDING_RESGRPS_SES_ATTR); log.trace("getting pending groups for role [" + roleId + ")"); String name = "foo"; try { //defend against ldap communication runtime difficulties. if (cachedAvailableLdapGroups == null) { // allGroups = LdapGroupManagerBean.getInstance().findAvailableGroups(); allGroups = ldapManager.findAvailableGroups(); } else {//reuse cached. allGroups = cachedAvailableLdapGroups; } //store unmodified list in session. cachedAvailableLdapGroups = allGroups; //retrieve currently assigned groups assignedList = ldapManager.findLdapGroupsByRole(role.getId(), PageControl.getUnlimitedInstance()); //trim already defined from all groups returned. allGroups = filterExisting(assignedList, allGroups); Set<String> pendingIds = new HashSet<String>(pendingGroupIds); //retrieve pending information pendingSet = findPendingGroups(pendingIds, allGroups); pendingGroups = new PageList<Map<String, String>>(pendingSet, pendingSet.size(), pcp); /* available groups are all groups in the system that are not * associated with the role and are not pending */ log.trace("getting available groups for role [" + roleId + "]"); availableGroupsSet = findAvailableGroups(pendingIds, allGroups); availableGroups = new PageList<Map<String, String>>(availableGroupsSet, availableGroupsSet.size(), pca); //We cannot reuse the PageControl mechanism as there are no database calls to retrieve list // must replicate paging using existing web params, formula etc. PageList<Map<String, String>> sizedAvailableGroups = new PageList<Map<String, String>>(); sizedAvailableGroups = paginateLdapGroupData(sizedAvailableGroups, availableGroups, pca); //make sizedAvailableGroup the new reference to return. availableGroups = sizedAvailableGroups; //populate pagination elements for loaded elements. availableGroups.setTotalSize(availableGroupsSet.size()); availableGroups.setPageControl(pca); //now do the same thing for Pending Groups. PageList<Map<String, String>> pagedPendingGroups = new PageList<Map<String, String>>(); pagedPendingGroups = paginateLdapGroupData(pagedPendingGroups, pendingGroups, pcp); pendingGroups = pagedPendingGroups; //populate pagination elements for loaded elements. pendingGroups.setTotalSize(pendingSet.size()); pendingGroups.setPageControl(pcp); } catch (EJBException ejx) { //this is the exception type thrown now that we use SLSB.Local methods // mine out other exceptions Exception cause = ejx.getCausedByException(); if (cause == null) { ActionMessages actionMessages = new ActionMessages(); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.cam.general")); saveErrors(request, actionMessages); } else { if (cause instanceof LdapFilterException) { ActionMessages actionMessages = new ActionMessages(); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("admin.role.LdapGroupFilterMessage")); saveErrors(request, actionMessages); } else if (cause instanceof LdapCommunicationException) { ActionMessages actionMessages = new ActionMessages(); SystemManagerLocal manager = LookupUtil.getSystemManager(); Properties options = manager .getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord()); String providerUrl = options.getProperty(RHQConstants.LDAPUrl, "(unavailable)"); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("admin.role.LdapCommunicationMessage", providerUrl)); saveErrors(request, actionMessages); } } } catch (LdapFilterException lce) { ActionMessages actionMessages = new ActionMessages(); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("admin.role.LdapGroupFilterMessage")); saveErrors(request, actionMessages); } catch (LdapCommunicationException lce) { ActionMessages actionMessages = new ActionMessages(); SystemManagerLocal manager = LookupUtil.getSystemManager(); Properties options = manager.getSystemConfiguration(LookupUtil.getSubjectManager().getOverlord()); String providerUrl = options.getProperty(RHQConstants.LDAPUrl, "(unavailable)"); actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("admin.role.LdapCommunicationMessage", providerUrl)); saveErrors(request, actionMessages); } //place calculated values into session. request.setAttribute(Constants.PENDING_RESGRPS_ATTR, pendingGroups); request.setAttribute(Constants.NUM_PENDING_RESGRPS_ATTR, new Integer(pendingGroups.getTotalSize())); request.setAttribute(Constants.AVAIL_RESGRPS_ATTR, availableGroups); request.setAttribute(Constants.NUM_AVAIL_RESGRPS_ATTR, new Integer(allGroups.size())); //store cachedAvailableGroups in session so trim down ldap communication chatter. request.getSession().setAttribute(LDAP_GROUP_CACHE, cachedAvailableLdapGroups); return null; }