InfoAction.java |
/* PCS - A Framework For Java Web Applications Copyright (C) 2002 Patrick Carl, patrick.carl@web.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: InfoAction.java,v 1.3 2003/01/08 02:31:55 pcs_org Exp $ */ package de.spieleck.pcs.action.base; import de.spieleck.pcs.action.Action; import de.spieleck.pcs.action.ActionException; import de.spieleck.pcs.action.ActionResult; import java.net.InetAddress; /** * This action is used for testing if pcs is up and running correctly. * @author Patrick Carl */ public class InfoAction implements de.spieleck.pcs.action.Action { private static String pcsVersion = "1.0a"; private String os; private String java; private String hostname; /** Creates a new instance of DefaultAuthorization */ public InfoAction() { try{ hostname = InetAddress.getLocalHost().getHostName(); } catch(Exception e){ hostname = "localhost"; } os = System.getProperty("os.name") + " " + System.getProperty("os.version"); java = System.getProperty("java.vendor") + " " + System.getProperty("java.version"); } /** * This action delievers as Result information about the pcs-Framework */ public ActionResult perform(java.util.Hashtable parameters) throws ActionException{ String xml = "<info>\n" + "<pcs>pcs " + pcsVersion + "</pcs>\n" + "<os>" + os + "</os>\n" + "<java>" + java + "</java>\n" + "<hostname>" + hostname + "</hostname>\n" + "</info>"; java.util.Hashtable h = new java.util.Hashtable(); return new ActionResult(xml, h); } }
InfoAction.java |