| ResetConfigAction.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: ResetConfigAction.java,v 1.2 2003/01/08 02:31:55 pcs_org Exp $
*/
package de.spieleck.pcs.action.base;
import de.spieleck.pcs.conf.ConfigAdmin;
import de.spieleck.pcs.action.ActionResult;
import de.spieleck.pcs.action.ActionException;
/**
* This Action is used for resetting the configuration of various objects used
* within pcs
* @author Patrick Carl
*/
public class ResetConfigAction implements de.spieleck.pcs.action.Action {
/** Creates a new instance of ResetConfigAction */
public ResetConfigAction() {
super();
}
/** performs the Action
* @param parameters a Hashtable for information needed to perform the Action
* @throws ActionException if an exception occurrs during processing
* @return an instance of ActionResult as result of the Action
*/
public ActionResult perform(java.util.Hashtable parameters) throws ActionException {
int n = ConfigAdmin.getInstance().resetConfig();
String[] reset = ConfigAdmin.getInstance().getConfigUserNames();
StringBuffer sb = new StringBuffer("<resetconfig number=\"" +n + "\">\n");
int l = reset.length;
for(int i=0;i<l;i++)
sb = sb.append("<configuser>" + reset[i] + "</configuser>\n");
sb = sb.append("</resetconfig>");
java.util.Hashtable h = new java.util.Hashtable();
return new ActionResult(sb.toString(), h);
}
}
| ResetConfigAction.java |