Package edu.isi.karma.controller.command

Examples of edu.isi.karma.controller.command.CommandFactory


      KarmaException, CommandException {
    ExecutionController ctrl = WorkspaceRegistry.getInstance()
        .getExecutionController(workspace.getId());
    JSONArray inputParamArr = this.createMultiCellCmd(rvco, selectedPath
        .getLeaf().getId());
    CommandFactory cf = ctrl.getCommandFactoryMap().get(
        MultipleValueEditColumnCommand.class.getSimpleName());
    JSONInputCommandFactory scf = (JSONInputCommandFactory) cf;

    // TODO handle exceptions intelligently
    Command comm = scf.createCommand(inputParamArr, workspace);
View Full Code Here


    // add a new column
    JSONArray inputParamArr0 = this.creatNewColumnCommand(worksheetId,
        hTableId, colnameString);
    ExecutionController ctrl = WorkspaceRegistry.getInstance()
        .getExecutionController(workspace.getId());
    CommandFactory cf0 = ctrl.getCommandFactoryMap().get(
        AddColumnCommand.class.getSimpleName());
    JSONInputCommandFactory scf1 = (JSONInputCommandFactory) cf0;
    Command comm1 = null;

    // TODO handle exceptions intelligently
View Full Code Here

          JSONObject obj = new JSONObject(array.get(j).toString());
          newOutputColumns.add(obj.get("value").toString());
        }
      }
      System.out.println(inputParamArr.toString(4));
      CommandFactory cf = commandFactoryMap.get(commObject.get(HistoryArguments.commandName.name()));
      if(cf != null) {
        try { // This is sort of a hack the way I did this, but could not think of a better way to get rid of the dependency
          Command comm = cf.createCommand(inputParamArr, workspace);
          comm.setOutputColumns(newOutputColumns);
          if(comm != null){
            commands.add(comm);
            //TODO consolidate update
            uc.append(workspace.getCommandHistory().doCommand(comm, workspace, true));
View Full Code Here

      {
        String tag = tags.getString(j);
        if(null != tag && tag.equals(CommandTag.Transformation.name()))
        {
          JSONArray inputParamArr = (JSONArray) commObject.get(HistoryArguments.inputParameters.name());
          CommandFactory cf = commandFactoryMap.get(commObject.get(HistoryArguments.commandName.name()));
          if(cf != null && cf instanceof JSONInputCommandFactory) {

            JSONInputCommandFactory scf = (JSONInputCommandFactory)cf;
            Command comm = null;
            try {
View Full Code Here

          ExecutionController ctrl = WorkspaceRegistry.getInstance().getExecutionController(workspace.getId());
          HashMap<String, CommandFactory> commandFactoryMap = ctrl.getCommandFactoryMap();
          JSONArray inputParamArr = (JSONArray)rco.historyObject.get(HistoryArguments.inputParameters.name());
          String commandName = (String)rco.historyObject.get(HistoryArguments.commandName.name());
          executor.normalizeCommandHistoryJsonInput(workspace, worksheetId, inputParamArr, commandName, true);
          CommandFactory cf = commandFactoryMap.get(rco.historyObject.get(HistoryArguments.commandName.name()));
          Command comm = cf.createCommand(inputParamArr, workspace);
          effects.append(comm.doIt(workspace));
          history.add(comm);
        }catch(Exception e) {
          history.add(rco.command);
          effects.append(rco.command.doIt(workspace));
View Full Code Here

      }
      if(!Modifier.isAbstract(subType.getModifiers()) && !subType.isInterface())
        try
      {

          CommandFactory commandFactory = subType.newInstance();
          Class<? extends Command> command = commandFactory.getCorrespondingCommand();

          commandFactoryMap.put(command.getSimpleName(), commandFactory);
      } catch (InstantiationException e)
      {
        logger.error("Error instantiating {} -- likely does not have no-arg constructor", subType);
View Full Code Here

  public HashMap<String, CommandFactory> getCommandFactoryMap() {
    return commandFactoryMap;
  }

  public Command getCommand(HttpServletRequest request) {
    CommandFactory cf = commandFactoryMap.get(request.getParameter("command"));
    if (cf != null) {
      if (cf instanceof JSONInputCommandFactory) {
        String newInfo = request.getParameter("newInfo");
        try {
          return cf.createCommand(newInfo == null ? null : new JSONArray(newInfo), workspace);
        } catch (Exception e) {
          logger.error("Error getting command!!", e);
          return null;
        }
      }
      else {
        return cf.createCommand(request, workspace);
      }
    } else {
      logger.error("Command " + request.getParameter("command")
          + " not found!");
      return null;
View Full Code Here

      UpdateContainer uc = normalizeCommandHistoryJsonInput(workspace, worksheetId, inputParamArr, commandName, true);
      // Invoke the command
      if (uc == null) {
        uc = new UpdateContainer();
      }
      CommandFactory cf = commandFactoryMap.get(commObject.get(HistoryArguments.commandName.name()));
      if(cf != null) {
        try { // This is sort of a hack the way I did this, but could not think of a better way to get rid of the dependency
          Command comm = cf.createCommand(inputParamArr, workspace);
          if(comm != null){
            try {
              comm.setExecutedInBatch(true);
              logger.info("Executing command: " + commandName);
              uc.append(workspace.getCommandHistory().doCommand(comm, workspace, saveToHistory));
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.command.CommandFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.