Executes the action
@param arg the argument to use to execute the action
@return the result of the action
@throws E if an error occurs while executing the action
519790
protected R execute(A... arg) throws E
   {
      if (arg == null || arg.length == 0)
      {
         return execute((A)null);
      }
      return execute(arg[0]);
   }
444819
@SuppressWarnings("unchecked")
        public static void executeCommand(String[] args) throws IOException {

            OptionParser parser = getParser();

            // declare parameters
            List<String> metaKeys = null;
            String url = null;
            String dir = null;
            List<Integer> nodeIds = null;
            Boolean allNodes = true;
            Boolean verbose = false;

            // parse command-line input
            args = AdminToolUtils.copyArrayAddFirst(args, "--" + OPT_HEAD_META_GET);
            OptionSet options = parser.parse(args);
            if(options.has(AdminParserUtils.OPT_HELP)) {
                printHelp(System.out);
                return;
            }

            // check required options and/or conflicting options
            AdminParserUtils.checkRequired(options, OPT_HEAD_META_GET);
            AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);
            AdminParserUtils.checkOptional(options,
                                           AdminParserUtils.OPT_NODE,
                                           AdminParserUtils.OPT_ALL_NODES);

            // load parameters
            metaKeys = (List<String>) options.valuesOf(OPT_HEAD_META_GET);
            url = (String) options.valueOf(AdminParserUtils.OPT_URL);
            if(options.has(AdminParserUtils.OPT_DIR)) {
                dir = (String) options.valueOf(AdminParserUtils.OPT_DIR);
            }
            if(options.has(AdminParserUtils.OPT_NODE)) {
                nodeIds = (List<Integer>) options.valuesOf(AdminParserUtils.OPT_NODE);
                allNodes = false;
            }
            if(options.has(OPT_VERBOSE)) {
                verbose = true;
            }

            // execute command
            File directory = AdminToolUtils.createDir(dir);
            AdminClient adminClient = AdminToolUtils.getAdminClient(url);

            if(allNodes) {
                nodeIds = AdminToolUtils.getAllNodeIds(adminClient);
            }

            if(metaKeys.size() == 1 && metaKeys.get(0).equals(METAKEY_ALL)) {
                metaKeys = Lists.newArrayList();
                for(Object key: MetadataStore.METADATA_KEYS) {
                    metaKeys.add((String) key);
                }
            }

            doMetaGet(adminClient, nodeIds, metaKeys, directory, verbose);
        }
437095
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("async-job")) {
            AdminCommandAsyncJob.executeCommand(args);
        } else if(subCmd.equals("scheduled")) {
            AdminCommandScheduled.executeCommand(args);
        } else if(subCmd.equals("cleanup")) {
            AdminCommandCleanup.executeCommand(args);
        } else if(subCmd.equals("debug")) {
            AdminCommandDebug.executeCommand(args);
        } else if(subCmd.equals("meta")) {
            AdminCommandMeta.executeCommand(args);
        } else if(subCmd.equals("quota")) {
            AdminCommandQuota.executeCommand(args);
        } else if(subCmd.equals("store")) {
            AdminCommandStore.executeCommand(args);
        } else if(subCmd.equals("stream")) {
            AdminCommandStream.executeCommand(args);
        } else if(subCmd.equals("help") || subCmd.equals("--help") || subCmd.equals("-h")) {
            executeHelp(args, System.out);
        } else {
            args = AdminToolUtils.copyArrayAddFirst(args, subCmd);
            AdminCommandOther.executeCommand(args);
        }
    }
1355971
public Object send( String... args ) throws Exception
    {
        assertArgumentsCount( args );
        return field.get( target );
    }
416366
private Object execute(Object o, Method m, Object... args) throws CommandActionExecutionException {
        Object result = null;
        try {
            m.setAccessible(true); // suppress Java language access
            if (isCompileWeaving() && metaHolder.getAjcMethod() != null) {
                result = invokeAjcMethod(metaHolder.getAjcMethod(), o, metaHolder, args);
            } else {
                result = m.invoke(o, args);
            }
        } catch (IllegalAccessException e) {
            propagateCause(e);
        } catch (InvocationTargetException e) {
            propagateCause(e);
        }
        return result;
    }
395184
public <T> T execute(final String methodName, final Class<T> clazz, final Object... args) {
        return execute(methodName, clazz, true, args);
    }
413541
private void helpAction(String arg) {
        if (arg == null) {
            printMainUsage();
            return;
        }

        String helpTarget = arg.toLowerCase();

        if (helpTarget.equals(ACTION_VIEW)) {
            printViewUsage();
        } else if (helpTarget.equals(ACTION_COPY)) {
            printCopyUsage();
        } else if (helpTarget.equals(ACTION_LISTINSTANCES)) {
            printListInstancesUsage();
        } else {
            printMainUsage();
        }
    }
744749
public void run(String[] args) {
        String context = args.length > 0 ? args[0] : "";
        String action = args.length > 1 ? args[1] : "";
        String option = args.length > 2 ? args[2] : "";

        switch (context) {
            case "server":
                server(action, option);
                break;
            case "version":
                version();
                break;
            default:
                help();
        }
    }
1037738
@Override
  public void execute(final ActivityExecution execution) throws Exception {
    this.executeWithErrorPropagation(execution, new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        getActivityBehaviorInstance(execution).execute(execution);
        return null;
      }
    });
  }
228391
public void actionPerformed(java.awt.event.ActionEvent e)
    {
        System.out.println("Action Command: " + e.getActionCommand());
        System.out.println("Action Params : " + e.paramString());
        System.out.println("Action Source : " + e.getSource());
        System.out.println("Action SrcCls : " + e.getSource().getClass().getName());
        org.apache.ojb.broker.metadata.ClassDescriptor cld =
            new org.apache.ojb.broker.metadata.ClassDescriptor(rootNode.getRepository());
        // cld.setClassNameOfObject("New Class");
        cld.setTableName("New Table");
        rootNode.addClassDescriptor(cld);
    }
813449
public static JobExecutionResult execute(Program pa, String... args) throws Exception {
		return execute(pa.getPlan(args));
	}
278390
@Override
    public T execute() throws Auth0Exception {
        okhttp3.Request request = createRequest();
        try (Response response = client.newCall(request).execute()) {
            return parseResponse(response);
        } catch (Auth0Exception e) {
            throw e;
        } catch (IOException e) {
            throw new Auth0Exception("Failed to execute request", e);
        }
    }
139546
public boolean run(String... arguments) throws Exception {
        try {
            if (isFlag(HELP, arguments)) {
                parser.printHelp(stdOut);
            } else if (isFlag(VERSION, arguments)) {
                parser.printVersion(stdOut);
            } else {
                final Namespace namespace = parser.parseArgs(arguments);
                final Command command = requireNonNull(commands.get(namespace.getString(COMMAND_NAME_ATTR)),
                    "Command is not found");
                try {
                    command.run(bootstrap, namespace);
                } catch (Throwable e) {
                    // The command failed to run, and the command knows
                    // best how to cleanup / debug exception
                    command.onError(this, namespace, e);
                    return false;
                }
            }
            return true;
        } catch (HelpScreenException ignored) {
            // This exception is triggered when the user passes in a help flag.
            // Return true to signal that the process executed normally.
            return true;
        } catch (ArgumentParserException e) {
            stdErr.println(e.getMessage());
            e.getParser().printHelp(stdErr);
            return false;
        }
    }
853578
@SuppressWarnings("unchecked")
        public static void executeCommand(String[] args) throws Exception {

            OptionParser parser = getParser();

            // declare parameters
            List<String> meta = null;
            String url = null;
            List<Integer> nodeIds = null;
            Boolean allNodes = true;
            Boolean confirm = false;

            // parse command-line input
            args = AdminToolUtils.copyArrayAddFirst(args, "--" + OPT_HEAD_META_SET);
            OptionSet options = parser.parse(args);
            if(options.has(AdminParserUtils.OPT_HELP)) {
                printHelp(System.out);
                return;
            }

            // check required options and/or conflicting options
            AdminParserUtils.checkRequired(options, OPT_HEAD_META_SET);
            AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);
            AdminParserUtils.checkOptional(options,
                                           AdminParserUtils.OPT_NODE,
                                           AdminParserUtils.OPT_ALL_NODES);

            // load parameters
            meta = AdminToolUtils.getValueList((List<String>) options.valuesOf(OPT_HEAD_META_SET),
                                               "=");
            if(meta.size() != 2 && meta.size() != 4) {
                throw new VoldemortException("Invalid metakey-metafile pairs.");
            }
            url = (String) options.valueOf(AdminParserUtils.OPT_URL);
            if(options.has(AdminParserUtils.OPT_NODE)) {
                nodeIds = (List<Integer>) options.valuesOf(AdminParserUtils.OPT_NODE);
                allNodes = false;
            }
            if(options.has(AdminParserUtils.OPT_CONFIRM)) {
                confirm = true;
            }

            // print summary
            System.out.println("Set metadata");
            System.out.println("Metadata:");
            for(Integer i = 0; i < meta.size(); i += 2) {
                System.out.println("  set \'" + meta.get(i) + "\' from file \'" + meta.get(i + 1)
                                   + "\'");
            }
            System.out.println("Location:");
            System.out.println("  bootstrap url = " + url);
            if(allNodes) {
                System.out.println("  node = all nodes");
            } else {
                System.out.println("  node = " + Joiner.on(", ").join(nodeIds));
            }

            AdminClient adminClient = AdminToolUtils.getAdminClient(url);

            if(allNodes) {
                nodeIds = AdminToolUtils.getAllNodeIds(adminClient);
            }

            AdminToolUtils.assertServerNotInRebalancingState(adminClient, nodeIds);

            if(meta.size() == 2) {
                String metaKey = meta.get(0), metaValue = meta.get(1);
                String metaFile = metaValue.replace("~", System.getProperty("user.home"));

                if(metaKey.equals(MetadataStore.STORES_KEY)) {
                    if(!Utils.isReadableFile(metaFile)) {
                        throw new VoldemortException("Stores definition xml file path incorrect");
                    }
                    StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
                    List<StoreDefinition> newStoreDefs = mapper.readStoreList(new File(metaFile));
                    StoreDefinitionUtils.validateSchemasAsNeeded(newStoreDefs);

                    // original metadata
                    Integer nodeIdToGetStoreXMLFrom = nodeIds.iterator().next();
                    Versioned<String> storesXML = adminClient.metadataMgmtOps.getRemoteMetadata(nodeIdToGetStoreXMLFrom,
                                                                                                MetadataStore.STORES_KEY);

                    List<StoreDefinition> oldStoreDefs = mapper.readStoreList(new StringReader(storesXML.getValue()));

                    printChangeStoreSummary(oldStoreDefs, newStoreDefs, System.err);
                    if(!AdminToolUtils.askConfirm(confirm, "set metadata")) {
                        return;
                    }

                    // execute command
                    doMetaSet(adminClient, nodeIds, metaKey, mapper.writeStoreList(newStoreDefs));
                    if(!allNodes) {
                        System.err.println("WARNING: Metadata version update of stores goes to all servers, "
                                           + "although this set-metadata oprations only goes to node: ");
                        for(Integer nodeId: nodeIds) {
                            System.err.println(nodeId);
                        }
                    }
                    doMetaUpdateVersionsOnStores(adminClient, oldStoreDefs, newStoreDefs);
                } else {

                    // execute command
                    if(!AdminToolUtils.askConfirm(confirm, "set metadata")) {
                        return;
                    }

                    if(metaKey.equals(MetadataStore.CLUSTER_KEY)
                       || metaKey.equals(MetadataStore.REBALANCING_SOURCE_CLUSTER_XML)) {
                        if(!Utils.isReadableFile(metaFile)) {
                            throw new VoldemortException("Cluster xml file path incorrect");
                        }
                        ClusterMapper mapper = new ClusterMapper();
                        Cluster newCluster = mapper.readCluster(new File(metaFile));
                        doMetaSet(adminClient, nodeIds, metaKey, mapper.writeCluster(newCluster));
                    } else if(metaKey.equals(MetadataStore.SLOP_STREAMING_ENABLED_KEY)
                              || metaKey.equals(MetadataStore.PARTITION_STREAMING_ENABLED_KEY)
                              || metaKey.equals(MetadataStore.READONLY_FETCH_ENABLED_KEY)
                              || metaKey.equals(MetadataStore.QUOTA_ENFORCEMENT_ENABLED_KEY)) {
                        doMetaSet(adminClient, nodeIds, metaKey, metaValue);
                    } else if(metaKey.equals(KEY_OFFLINE)) {
                        boolean setOffline = Boolean.parseBoolean(metaValue);
                        if(setOffline && nodeIds.size() > 1) {
                            throw new VoldemortException("Setting more than one node to offline is not allowed.");
                        }
                        for(Integer nodeId: nodeIds) {
                            adminClient.metadataMgmtOps.setRemoteOfflineState(nodeId, setOffline);
                        }
                    } else if(metaKey.equals(MetadataStore.REBALANCING_STEAL_INFO)) {
                        if(!Utils.isReadableFile(metaFile)) {
                            throw new VoldemortException("Rebalancing steal info file path incorrect");
                        }
                        String rebalancingStealInfoJsonString = FileUtils.readFileToString(new File(metaFile));
                        RebalancerState state = RebalancerState.create(rebalancingStealInfoJsonString);
                        doMetaSet(adminClient, nodeIds, metaKey, state.toJsonString());
                    } else {
                        throw new VoldemortException("Incorrect metadata key");
                    }
                }
            } else if(meta.size() == 4) {
                // set metadata pair cluster.xml, stores.xml
                String clusterFile, storesFile;

                if(meta.get(0).equals(MetadataStore.CLUSTER_KEY)
                   && meta.get(2).equals(MetadataStore.STORES_KEY)) {
                    clusterFile = meta.get(1);
                    storesFile = meta.get(3);
                } else if(meta.get(0).equals(MetadataStore.STORES_KEY)
                          && meta.get(2).equals(MetadataStore.CLUSTER_KEY)) {
                    storesFile = meta.get(1);
                    clusterFile = meta.get(3);
                } else {
                    throw new VoldemortException("meta set-pair keys must be <cluster.xml, stores.xml>");
                }

                clusterFile = clusterFile.replace("~", System.getProperty("user.home"));
                storesFile = storesFile.replace("~", System.getProperty("user.home"));

                ClusterMapper clusterMapper = new ClusterMapper();
                StoreDefinitionsMapper storeDefsMapper = new StoreDefinitionsMapper();

                // original metadata
                Integer nodeIdToGetStoreXMLFrom = nodeIds.iterator().next();
                Versioned<String> storesXML = adminClient.metadataMgmtOps.getRemoteMetadata(nodeIdToGetStoreXMLFrom,
                                                                                            MetadataStore.STORES_KEY);

                List<StoreDefinition> oldStoreDefs = storeDefsMapper.readStoreList(new StringReader(storesXML.getValue()));

                if(!Utils.isReadableFile(clusterFile)) {
                    throw new VoldemortException("Cluster xml file path incorrect");
                }
                Cluster cluster = clusterMapper.readCluster(new File(clusterFile));

                if(!Utils.isReadableFile(storesFile)) {
                    throw new VoldemortException("Stores definition xml file path incorrect");
                }
                List<StoreDefinition> newStoreDefs = storeDefsMapper.readStoreList(new File(storesFile));

                StoreDefinitionUtils.validateSchemasAsNeeded(newStoreDefs);

                printChangeStoreSummary(oldStoreDefs, newStoreDefs, System.err);

                if(!AdminToolUtils.askConfirm(confirm, "set metadata")) {
                    return;
                }

                // execute command
                doMetaSetPair(adminClient,
                              nodeIds,
                              clusterMapper.writeCluster(cluster),
                              storeDefsMapper.writeStoreList(newStoreDefs));
                if(!allNodes) {
                    System.err.println("WARNING: Metadata version update of stores goes to all servers, "
                                       + "although this set-metadata oprations only goes to node: ");
                    for(Integer nodeId: nodeIds) {
                        System.err.println(nodeId);
                    }
                }
                doMetaUpdateVersionsOnStores(adminClient, oldStoreDefs, newStoreDefs);
            }
        }
985499
def execute(args=nil)
      args ||= EMPTY_TASK_ARGS
      if application.options.dryrun then
        Rake::Application.mesg "** Execute (dry run) #{name}"
        return
      end
      if application.options.trace then
        Rake::Application.mesg "** Execute #{name}"
      end
      application.enhance_with_matching_rule(name) if @actions.empty?
      @actions.each do |act|
        case act.arity
        when 1
          act.call(self)
        else
          act.call(self, args)
        end
      end
    end
330288
public static <E> E send(Object o, String methodName, Double arg) {
    return send(o, methodName, (Object) arg);
  }
601523
@Override
    public void actionPerformed(ActionEvent e) {
        String cmd = e.getActionCommand();
        if (cmd.equals("Cut")) {
            consoleTextArea.cut();
        } else if (cmd.equals("Copy")) {
            consoleTextArea.copy();
        } else if (cmd.equals("Paste")) {
            consoleTextArea.paste();
        }
    }