/* this belongs to the WebRaveler package */ package webraveler.vurl; import java.util.*; import webraveler.http.HTTPRequest; import webraveler.http.HTTPResponse; import webraveler.ravel.Raveler; import webraveler.ravel.RavelerException; import webraveler.ravel.RavelerUser; /** * Disables the plugin for the given user * * @author The Web Raveler Development Squad * @version 1.0 */ public class DisablePluginVURL implements VURL { String pluginName; /** * Constructs a DisablePluginVURL for the given plugin * * @param pluginName a String containing the name of the plugin to be disabled */ public DisablePluginVURL (String pluginName) { this.pluginName = pluginName; } // DisablePluginVURL() /** * Removes the plugin from the user's active plugins and updates the status of the plugin. * Returns a response indicating whether or not the disablement was successful. */ public HTTPResponse resolveVURL(String username, String query, HTTPRequest request, Raveler ravel) { /* Generate response */ String responseString = new String(""); responseString += "
"+Raveler.ravelerCSS; /* Get the RavelerUser for the given username */ RavelerUser user = new RavelerUser(); try { user = ravel.getUser(username); /* Remove the plugin from the user's set of active plugins */ if (user.activePlugins.contains(pluginName)) user.activePlugins.remove(pluginName); /* Set the status of the plugin to disabled */ user.setDefaultStatus(pluginName); responseString += "Web Raveler Configuration for " + username + "
\n"; responseString += "\n"; responseString += "Web Raveler Configuration for " + username + "
\n"; responseString += "\n"; } //else responseString += "\n"; return new HTTPResponse("HTTP/1.0",200,"OK",responseString.getBytes(),new Hashtable()); } // resolveVURL } // class DisablePluginVURL