package de.ugoe.cs.eventbench.commands; import java.security.InvalidParameterException; import java.util.List; import de.ugoe.cs.eventbench.data.GlobalDataContainer; import de.ugoe.cs.util.console.Command; import de.ugoe.cs.util.console.Console; /** *

* Command to delete object from {@link GlobalDataContainer}. *

* * @author Steffen Herbold * @version 1.0 */ public class CMDdeleteObject implements Command { @Override public void help() { Console.println("Usage: deleteObject "); } @Override public void run(List parameters) { String objectName; try { objectName = (String) parameters.get(0); } catch (Exception e) { throw new InvalidParameterException(); } boolean deleted = GlobalDataContainer.getInstance().removeData(objectName); if( !deleted ) { Console.println("Object not found in storage!"); } } }