Author: rmorgan Date: 2007-03-22 08:35:47 -0800 (Thu, 22 Mar 2007) New Revision: 3816 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3816 Removed: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_sigar.java trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_args.java trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_result.java Modified: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell.java trunk/src/org/hyperic/hq/bizapp/server/session/MeasurementBossEJBImpl.java trunk/src/org/hyperic/hq/measurement/agent/MeasurementCommandsAPI.java trunk/src/org/hyperic/hq/measurement/agent/client/MeasurementCommandsClient.java trunk/src/org/hyperic/hq/measurement/agent/server/MeasurementCommandsServer.java Log: Remove old sigar measurement commands. Replaced by livedata. Modified: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -133,7 +133,6 @@ registerCommandHandler("resourcetype", new ClientShell_resourcetype(this)); registerCommandHandler("set", new ClientShell_set(this)); registerCommandHandler("scheduler", new ClientShell_scheduler(this)); - registerCommandHandler("sigar", new ClientShell_sigar(this)); registerCommandHandler("time", new ClientShell_time(this)); registerCommandHandler("transfer", new ClientShell_transfer(this)); registerCommandHandler("trigger", new ClientShell_trigger(this)); @@ -144,7 +143,6 @@ this.setHandlerHidden(".", true); this.setHandlerHidden("exit", true); this.setHandlerHidden("scheduler", true); - this.setHandlerHidden("sigar", true); this.setHandlerHidden("transfer", true); this.setHandlerHidden("trigger", true); this.setHandlerHidden("vacuum", true); Deleted: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_sigar.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_sigar.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_sigar.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -1,119 +0,0 @@ -/* - * NOTE: This copyright does *not* cover user programs that use HQ - * program services by normal system calls through the application - * program interfaces provided as part of the Hyperic Plug-in Development - * Kit or the Hyperic Client Development Kit - this is merely considered - * normal use of the program, and does *not* fall under the heading of - * "derived work". - * - * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. - * This file is part of HQ. - * - * HQ is free software; you can redistribute it and/or modify - * it under the terms version 2 of the GNU General Public License as - * published by the Free Software Foundation. This program is distributed - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -package org.hyperic.hq.bizapp.client.shell; - -import java.io.PrintStream; -import java.util.Iterator; -import java.util.List; - -import org.hyperic.hq.appdef.shared.AppdefEntityID; -import org.hyperic.hq.bizapp.shared.MeasurementBoss; -import org.hyperic.util.PrintfFormat; -import org.hyperic.util.StringUtil; -import org.hyperic.util.shell.ShellCommandBase; -import org.hyperic.util.shell.ShellCommandExecException; -import org.hyperic.util.shell.ShellCommandUsageException; - -public class ClientShell_sigar - extends ShellCommandBase -{ - private static final int[] PARAM_VALID_RESOURCE = { - ClientShell_resource.PARAM_PLATFORM, - }; - - private ClientShellEntityFetcher entityFetcher; - private ClientShell shell= null; - - public ClientShell_sigar(ClientShell shell){ - this.shell = shell; - this.entityFetcher = - new ClientShellEntityFetcher(shell.getBossManager(), - shell.getAuthenticator()); - } - - public void processCommand(String[] args) - throws ShellCommandUsageException, ShellCommandExecException - { - PrintStream out = getOutStream(); - PrintStream err = getErrStream(); - AppdefEntityID id; - int type; - - if(args.length != 3) - throw new ShellCommandUsageException(this.getSyntaxEx()); - - type = ClientShell_resource.paramToEntityType(args[0]); - - try { - id = this.entityFetcher.getID(type, args[1]); - } catch(Exception exc){ - throw new ShellCommandExecException(exc); - } - - int authToken = this.shell.getAuthenticator().getAuthToken(); - - try { - MeasurementBoss boss; - - out.println("Running command " + args[2]); - - boss = this.shell.getBossManager().getMeasurementBoss(); - List res = boss.sigarCmd(authToken, id, args[2]); - - for (Iterator i = res.iterator(); i.hasNext(); ) { - List row = (List)i.next(); - for (Iterator j = row.iterator(); j.hasNext(); ) { - String item = (String)j.next(); - out.print(item); - out.print(" "); - } - out.print("\n"); - } - - } catch (Exception e) { - throw new ShellCommandExecException(e); - } - } - - public String getSyntaxEx(){ - return "Use 'help " + this.getCommandName() + "' for details"; - } - - public String getUsageShort(){ - return "Run a sigar command on a remote agent"; - } - - public String getUsageHelp(String[] args) { - String cmdSpace; - - cmdSpace = StringUtil.repeatChars(' ', this.getCommandName().length()); - return " " + this.getUsageShort() + ".\n\n" + - " Command syntax:\n" + - " " + this.getCommandName() + " <" + - ClientShell_resource.generateArgList(PARAM_VALID_RESOURCE) + ">" + - " <resource> <cmd>\n\n"; - } -} Modified: trunk/src/org/hyperic/hq/bizapp/server/session/MeasurementBossEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/server/session/MeasurementBossEJBImpl.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/bizapp/server/session/MeasurementBossEJBImpl.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -3954,20 +3954,6 @@ } - /** - * Invoke a sigar cmd on a remote agent - * - * @ejb:interface-method - */ - public List sigarCmd(int sessionId, AppdefEntityID id, String cmd) - throws SessionTimeoutException, SessionNotFoundException, - PermissionException, AgentNotFoundException, - AgentRemoteException, AgentConnectionException - { - MeasurementCommandsClient client = getClient(id); - return client.sigarCmd(cmd); - } - /** @ejb:create-method */ public void ejbCreate() throws CreateException {} public void ejbActivate() throws EJBException, RemoteException {} Modified: trunk/src/org/hyperic/hq/measurement/agent/MeasurementCommandsAPI.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/agent/MeasurementCommandsAPI.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/measurement/agent/MeasurementCommandsAPI.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -64,11 +64,6 @@ public static final String command_trackRemove = trackPrefix + "trackRemove"; - // Sigar commands - public static final String command_sigarCmd = - "sigar:sigarCmd"; - - public static final String[] commandSet = { command_scheduleMeasurements, command_unscheduleMeasurements, @@ -76,8 +71,7 @@ command_setProperties, command_deleteProperties, command_trackAdd, - command_trackRemove, - command_sigarCmd + command_trackRemove }; public MeasurementCommandsAPI(){ Modified: trunk/src/org/hyperic/hq/measurement/agent/client/MeasurementCommandsClient.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/agent/client/MeasurementCommandsClient.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/measurement/agent/client/MeasurementCommandsClient.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -25,8 +25,6 @@ package org.hyperic.hq.measurement.agent.client; -import java.util.List; - import org.hyperic.hq.agent.AgentConnectionException; import org.hyperic.hq.agent.AgentRemoteException; import org.hyperic.hq.agent.AgentRemoteValue; @@ -36,12 +34,8 @@ import org.hyperic.hq.measurement.agent.commands.DeleteProperties_result; import org.hyperic.hq.measurement.agent.commands.GetMeasurements_args; import org.hyperic.hq.measurement.agent.commands.GetMeasurements_result; -import org.hyperic.hq.measurement.agent.commands.SigarCmd_args; -import org.hyperic.hq.measurement.agent.commands.SigarCmd_result; import org.hyperic.hq.measurement.agent.commands.TrackPluginAdd_args; -import org.hyperic.hq.measurement.agent.commands.TrackPluginAdd_result; import org.hyperic.hq.measurement.agent.commands.TrackPluginRemove_args; -import org.hyperic.hq.measurement.agent.commands.TrackPluginRemove_result; import org.hyperic.hq.measurement.agent.commands.ScheduleMeasurements_args; import org.hyperic.hq.measurement.agent.commands.ScheduleMeasurements_result; import org.hyperic.hq.measurement.agent.commands.SetProperties_args; @@ -193,23 +187,4 @@ this.verAPI.command_trackRemove, this.verAPI.getVersion(), args); } - - public List sigarCmd(String cmd) - throws AgentRemoteException, - AgentConnectionException - { - SigarCmd_args args; - SigarCmd_result res; - AgentRemoteValue rval; - - args = new SigarCmd_args(); - args.setCmd(cmd); - - rval = this.agentConn.sendCommand(this.verAPI.command_sigarCmd, - this.verAPI.getVersion(), args); - - res = new SigarCmd_result(rval); - - return res.getList(); - } } Deleted: trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_args.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_args.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_args.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -1,60 +0,0 @@ -/* - * NOTE: This copyright does *not* cover user programs that use HQ - * program services by normal system calls through the application - * program interfaces provided as part of the Hyperic Plug-in Development - * Kit or the Hyperic Client Development Kit - this is merely considered - * normal use of the program, and does *not* fall under the heading of - * "derived work". - * - * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. - * This file is part of HQ. - * - * HQ is free software; you can redistribute it and/or modify - * it under the terms version 2 of the GNU General Public License as - * published by the Free Software Foundation. This program is distributed - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -package org.hyperic.hq.measurement.agent.commands; - -import org.hyperic.hq.agent.AgentRemoteException; -import org.hyperic.hq.agent.AgentRemoteValue; - -public class SigarCmd_args extends AgentRemoteValue { - - private static final String PARAM_CMD = "cmd"; // Command - - public SigarCmd_args() - { - super(); - } - - public SigarCmd_args(AgentRemoteValue args) - throws AgentRemoteException - { - String cmd = args.getValue(PARAM_CMD); - - if (cmd == null) { - throw new AgentRemoteException("No command given"); - } - - setCmd(cmd); - } - - public void setCmd(String cmd) { - super.setValue(PARAM_CMD, cmd); - } - - public String getCmd() - { - return this.getValue(PARAM_CMD); - } -} Deleted: trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_result.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_result.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/measurement/agent/commands/SigarCmd_result.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -1,96 +0,0 @@ -/* - * NOTE: This copyright does *not* cover user programs that use HQ - * program services by normal system calls through the application - * program interfaces provided as part of the Hyperic Plug-in Development - * Kit or the Hyperic Client Development Kit - this is merely considered - * normal use of the program, and does *not* fall under the heading of - * "derived work". - * - * Copyright (C) [2004, 2005, 2006], Hyperic, Inc. - * This file is part of HQ. - * - * HQ is free software; you can redistribute it and/or modify - * it under the terms version 2 of the GNU General Public License as - * published by the Free Software Foundation. This program is distributed - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -package org.hyperic.hq.measurement.agent.commands; - -import java.util.List; - -import java.io.IOException; -import java.io.ByteArrayOutputStream; -import java.io.ByteArrayInputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; - -import org.hyperic.util.encoding.Base64; - -import org.hyperic.hq.agent.AgentRemoteException; -import org.hyperic.hq.agent.AgentRemoteValue; - -public class SigarCmd_result extends AgentRemoteValue { - - private static final String PROP_LIST = "list"; - - public SigarCmd_result() - { - super(); - } - - public void setList(List list) - throws AgentRemoteException - { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bs); - String propStr; - - os.writeObject(list); - propStr = Base64.encode(bs.toByteArray()); - - super.setValue(PROP_LIST, propStr); - - } catch (IOException e) { - throw new AgentRemoteException("Unable to set list: " + e); - } - } - - public List getList() - throws AgentRemoteException - { - String propStr = this.getValue(PROP_LIST); - List res; - - try { - byte[] data = Base64.decode(propStr); - ByteArrayInputStream bs = new ByteArrayInputStream(data); - ObjectInputStream os = new ObjectInputStream(bs); - - res = (List)os.readObject(); - return res; - } catch (IOException e) { - throw new AgentRemoteException("Unable to get list: " + e); - } catch (ClassNotFoundException e) { - throw new AgentRemoteException("Unable to get list: " + e); - } - } - - public SigarCmd_result(AgentRemoteValue args) - throws AgentRemoteException - { - String res = args.getValue(PROP_LIST); - - // XXX: should validate the list (e.g. all have the same # of cols) - super.setValue(PROP_LIST, res); - } -} Modified: trunk/src/org/hyperic/hq/measurement/agent/server/MeasurementCommandsServer.java =================================================================== --- trunk/src/org/hyperic/hq/measurement/agent/server/MeasurementCommandsServer.java 2007-03-22 16:35:19 UTC (rev 3815) +++ trunk/src/org/hyperic/hq/measurement/agent/server/MeasurementCommandsServer.java 2007-03-22 16:35:47 UTC (rev 3816) @@ -61,8 +61,6 @@ import org.hyperic.hq.measurement.agent.commands.ScheduleMeasurements_result; import org.hyperic.hq.measurement.agent.commands.SetProperties_args; import org.hyperic.hq.measurement.agent.commands.SetProperties_result; -import org.hyperic.hq.measurement.agent.commands.SigarCmd_args; -import org.hyperic.hq.measurement.agent.commands.SigarCmd_result; import org.hyperic.hq.measurement.agent.commands.TrackPluginAdd_args; import org.hyperic.hq.measurement.agent.commands.TrackPluginAdd_result; import org.hyperic.hq.measurement.agent.commands.TrackPluginRemove_args; @@ -439,39 +437,6 @@ return new TrackPluginRemove_result(); } - //XXX: Needs to be hooked up with sigar. - private SigarCmd_result sigarCmd(SigarCmd_args args) - throws AgentRemoteException - { - - ArrayList table = new ArrayList(); - String cmd = args.getCmd(); - - this.log.info("Invoking sigar cmd=" + cmd); - - // Headers - ArrayList headers = new ArrayList(); - headers.add("Col1"); - headers.add("Col2"); - headers.add("Col3"); - - table.add(headers); - - // Add row data - for (int i = 0; i < 10; i++) { - ArrayList row = new ArrayList(); - row.add("row" + i); - row.add("row" + i); - row.add("row" + i); - table.add(row); - } - - SigarCmd_result res = new SigarCmd_result(); - res.setList(table); - - return res; - } - public AgentRemoteValue dispatchCommand(String cmd, AgentRemoteValue args, InputStream in, OutputStream out) throws AgentRemoteException @@ -509,11 +474,6 @@ TrackPluginRemove_args ta = new TrackPluginRemove_args(args); return this.trackPluginRemove(ta); - } else if(cmd.equals(this.verAPI.command_sigarCmd)) { - SigarCmd_args sa = - new SigarCmd_args(args); - - return this.sigarCmd(sa); } else { throw new AgentRemoteException("Unknown command: " + cmd); } |