From: Marcus <the...@us...> - 2004-03-24 16:10:15
|
Update of /cvsroot/junk/junk/WEB-INF/classes/junk/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26090 Added Files: PluginTools.java Log Message: initial import --- NEW FILE: PluginTools.java --- /* * juNK - a file search system for smb shares * * Copyright 2004 by * Marcus Proest (theevilflow at users dot sf dot net) * Uwe van Heesch (tyron_e at users dot sf dot net) * * This file is part of junk (java useful net kollektor). * * junk is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * junk 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 junk; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package junk.plugin; import java.util.HashMap; import org.apache.struts.config.ModuleConfig; import org.apache.struts.config.PlugInConfig; /** * static tools for handling plugins */ public class PluginTools { /** Creates a new instance of PluginTools */ public PluginTools() { } /** * get a pluginconfig * @param plugin the plugin to get the config for * @param m the moduleconfig passed to the plugin * @return the config for <code>plugin</code> */ public static HashMap getPluginConfig(Class plugin, ModuleConfig m) { PlugInConfig[] pluginConfigs = m.findPlugInConfigs(); //get the config... there has to be another way to get it for (int x = 0; x < pluginConfigs.length; x++) { if (pluginConfigs[x].getClassName().equals(plugin.getName())) { return (HashMap) pluginConfigs[x].getProperties(); } } //if there is no pluginconfig for the specified plugin, throw iae throw new IllegalArgumentException("plugin config not found"); } } |