From: <sc...@hy...> - 2010-04-01 21:25:56
|
Author: scottmf Date: 2010-04-01 14:25:46 -0700 (Thu, 01 Apr 2010) New Revision: 14460 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14460 Modified: trunk/src/org/hyperic/hq/autoinventory/ScanState.java trunk/src/org/hyperic/hq/autoinventory/server/session/AutoinventoryManagerEJBImpl.java trunk/src/org/hyperic/hq/product/util/PluginDiscoverer.java Log: for somereason ScanState.getAllServers() was using a logging object that was passed in from the caller. Removed this in favor of ScanState using its own logger. It is very confusing when reading the server.log file otherwise Modified: trunk/src/org/hyperic/hq/autoinventory/ScanState.java =================================================================== --- trunk/src/org/hyperic/hq/autoinventory/ScanState.java 2010-04-01 16:32:35 UTC (rev 14459) +++ trunk/src/org/hyperic/hq/autoinventory/ScanState.java 2010-04-01 21:25:46 UTC (rev 14460) @@ -26,9 +26,9 @@ package org.hyperic.hq.autoinventory; import java.io.BufferedReader; -import java.io.IOException; import java.io.File; import java.io.FileReader; +import java.io.IOException; import java.io.PrintStream; import java.text.DateFormat; import java.util.ArrayList; @@ -42,19 +42,20 @@ import java.util.Set; import java.util.TreeSet; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.hyperic.hq.appdef.shared.AIPlatformValue; +import org.hyperic.hq.appdef.shared.AIServerExtValue; import org.hyperic.hq.appdef.shared.AIServerValue; -import org.hyperic.hq.appdef.shared.AIServerExtValue; import org.hyperic.hq.product.ServerResource; import org.hyperic.util.StringUtil; import org.hyperic.util.StringifiedException; -import org.apache.commons.logging.Log; - public class ScanState { private static HashMap installdirExcludes = new HashMap(); private static List installdirExcludesPrefixes = new ArrayList(); + private static final Log _log = LogFactory.getLog(ScanState.class); static { loadInstalldirExcludes(); @@ -372,7 +373,6 @@ */ public void printStackTraces () { ScanMethodState[] smStates = _core.getScanMethodStates(); - AIServerValue[] servers; StringifiedException[] exc; for ( int i=0; i<smStates.length; i++ ) { exc = smStates[i].getExceptions(); @@ -513,7 +513,7 @@ * is based on the server autoinventory identifier, which is * usually the same as the install path. */ - public Set getAllServers (Log logger) throws AutoinventoryException { + public Set getAllServers () throws AutoinventoryException { // allServers will guarantee uniqueness on the AIID. Set allServers = new TreeSet(COMPARE_AIID); @@ -544,8 +544,8 @@ if ( servers != null ) { for ( int j=0; j<servers.length; j++ ) { if ( !allServers.add(servers[j]) ) { - if ( logger != null ) { - logger.info("Server not added because another scan " + if ( _log != null ) { + _log.info("Server not added because another scan " + "method already detected it:" + servers[j]); } @@ -594,8 +594,8 @@ //disable metric collection server.unsetMeasurementConfig(); - if (logger != null) { - logger.info("Turning off AutoEnable for server " + + if (_log != null) { + _log.info("Turning off AutoEnable for server " + server.getName() + " [" + server.getInstallPath() + "]" + ", has the same metric connect config as " + @@ -651,8 +651,8 @@ if (!AICompare.compareAIPlatforms(p1, p2)) return false; Set servers1, servers2; - servers1 = getAllServers(null); - servers2 = other.getAllServers(null); + servers1 = getAllServers(); + servers2 = other.getAllServers(); if (!AICompare.compareAIServers(servers1, servers2)) return false; return true; Modified: trunk/src/org/hyperic/hq/autoinventory/server/session/AutoinventoryManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/autoinventory/server/session/AutoinventoryManagerEJBImpl.java 2010-04-01 16:32:35 UTC (rev 14459) +++ trunk/src/org/hyperic/hq/autoinventory/server/session/AutoinventoryManagerEJBImpl.java 2010-04-01 21:25:46 UTC (rev 14460) @@ -698,11 +698,11 @@ _log.info("Received auto-inventory report from " + aiPlatform.getFqdn() + "; IPs -> " + getIps(aiPlatform.getAddedAIIpValues()) + "; CertDN -> " + aiPlatform.getCertdn() + - "; (" + state.getAllServers(_log).size() + " servers)"); + "; (" + state.getAllServers().size() + " servers)"); if (debug) { _log.debug("AutoinventoryManager.reportAIData called, " + "scan state=" + state); - _log.debug("AISERVERS=" + state.getAllServers(_log)); + _log.debug("AISERVERS=" + state.getAllServers()); } // In the future we may want this method to act as // another user besides "admin". It might make sense to have @@ -730,7 +730,7 @@ AIPlatformValue aiPlatform) throws AutoinventoryException { if (stateCore.getAreServersIncluded()) { - Set serverSet = state.getAllServers(_log); + Set serverSet = state.getAllServers(); final ServerManagerLocal svrMan = ServerManagerEJBImpl.getOne(); for (Iterator it = serverSet.iterator(); it.hasNext();) { AIServerValue aiServer = (AIServerValue)it.next(); Modified: trunk/src/org/hyperic/hq/product/util/PluginDiscoverer.java =================================================================== --- trunk/src/org/hyperic/hq/product/util/PluginDiscoverer.java 2010-04-01 16:32:35 UTC (rev 14459) +++ trunk/src/org/hyperic/hq/product/util/PluginDiscoverer.java 2010-04-01 21:25:46 UTC (rev 14460) @@ -122,7 +122,7 @@ public void scanComplete(ScanState state) throws AutoinventoryException, SystemException { - this.servers = state.getAllServers(this.log); + this.servers = state.getAllServers(); } private void addScanners(ScanConfiguration scanConfig, |