/* 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; /** * Deactivates the plugin for the given user * * @author The Web Raveler Development Squad * @version 1.0 */ public class DeactivatePluginVURL implements VURL { String pluginName; /** * Constructs a DeativatePluginVURL for the given plugin * * @param pluginName a String containing the name of the plugin to be deactivated */ public DeactivatePluginVURL (String pluginName) { this.pluginName = pluginName; } // DeactivatePluginVURL() /** * Removes the plugin from the user's active plugins and updates the status of the plugin. * Returns a response indicating whether or not the deactivation 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 set of active plugins */ user.removeActivePlugin(pluginName); /* Set the status of the plugin to inactive */ user.setStatus(pluginName,"inactive"); responseString += "Web Raveler Configuration for " + username + "
\n"; responseString += "\n"; responseString += "Web Raveler Configuration for " + username + "
\n"; responseString += "\n"; } //catch responseString += "\n"; return new HTTPResponse("HTTP/1.0",200,"OK",responseString.getBytes(),new Hashtable()); } // resolveVURL } // class DeactivatePluginVURL