Package org.apache.falcon.client

Examples of org.apache.falcon.client.FalconClient


        }
    }

    private void instanceCommand(CommandLine commandLine) throws FalconCLIException, IOException {
        String falconUrl = getFalconEndpoint(commandLine);
        FalconClient client = new FalconClient(falconUrl);

        Set<String> optionsList = new HashSet<String>();
        for (Option option : commandLine.getOptions()) {
            optionsList.add(option.getOpt());
        }

        String result;
        String type = commandLine.getOptionValue(ENTITY_TYPE_OPT);
        String entity = commandLine.getOptionValue(ENTITY_NAME_OPT);
        String start = commandLine.getOptionValue(START_OPT);
        String end = commandLine.getOptionValue(END_OPT);
        String filePath = commandLine.getOptionValue(FILE_PATH_OPT);
        String runid = commandLine.getOptionValue(RUNID_OPT);
        String colo = commandLine.getOptionValue(COLO_OPT);
        String clusters = commandLine.getOptionValue(CLUSTERS_OPT);
        String sourceClusters = commandLine.getOptionValue(SOURCECLUSTER_OPT);

        colo = getColo(colo);

        validateInstanceCommands(optionsList, entity, type, start, colo);

        if (optionsList.contains(RUNNING_OPT)) {
            result = client.getRunningInstances(type, entity, colo);
        } else if (optionsList.contains(STATUS_OPT)) {
            result = client.getStatusOfInstances(type, entity, start, end, colo);
        } else if (optionsList.contains(KILL_OPT)) {
            result = client.killInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(SUSPEND_OPT)) {
            result = client.suspendInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(RESUME_OPT)) {
            result = client.resumeInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(RERUN_OPT)) {
            result = client.rerunInstances(type, entity, start, end, filePath, colo, clusters, sourceClusters);
        } else if (optionsList.contains(CONTINUE_OPT)) {
            result = client.rerunInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(LOG_OPT)) {
            result = client.getLogsOfInstances(type, entity, start, end, colo, runid);
        } else {
            throw new FalconCLIException("Invalid command");
        }

        OUT.get().println(result);
View Full Code Here


    private void entityCommand(CommandLine commandLine)
        throws FalconCLIException, IOException {

        String falconUrl = getFalconEndpoint(commandLine);
        FalconClient client = new FalconClient(falconUrl);

        Set<String> optionsList = new HashSet<String>();
        for (Option option : commandLine.getOptions()) {
            optionsList.add(option.getOpt());
        }

        String result = null;
        String entityType = commandLine.getOptionValue(ENTITY_TYPE_OPT);
        String entityName = commandLine.getOptionValue(ENTITY_NAME_OPT);
        String filePath = commandLine.getOptionValue(FILE_PATH_OPT);
        String colo = commandLine.getOptionValue(COLO_OPT);


        validateEntityType(entityType);

        if (optionsList.contains(SUBMIT_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            result = client.submit(entityType, filePath);
        } else if (optionsList.contains(UPDATE_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.update(entityType, entityName, filePath);
        } else if (optionsList.contains(SUBMIT_AND_SCHEDULE_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            result = client.submitAndSchedule(entityType, filePath);
        } else if (optionsList.contains(VALIDATE_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            result = client.validate(entityType, filePath);
        } else if (optionsList.contains(SCHEDULE_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.schedule(entityType, entityName, colo);
        } else if (optionsList.contains(SUSPEND_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.suspend(entityType, entityName, colo);
        } else if (optionsList.contains(RESUME_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.resume(entityType, entityName, colo);
        } else if (optionsList.contains(DELETE_OPT)) {
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.delete(entityType, entityName);
        } else if (optionsList.contains(STATUS_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.getStatus(entityType, entityName, colo);
        } else if (optionsList.contains(DEFINITION_OPT)) {
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.getDefinition(entityType, entityName);
        } else if (optionsList.contains(DEPENDENCY_OPT)) {
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.getDependency(entityType, entityName);
        } else if (optionsList.contains(LIST_OPT)) {
            validateColo(optionsList);
            result = client.getEntityList(entityType);
        } else if (optionsList.contains(HELP_CMD)) {
            OUT.get().println("Falcon Help");
        } else {
            throw new FalconCLIException("Invalid command");
        }
View Full Code Here

    }

    private void adminCommand(CommandLine commandLine) throws FalconCLIException, IOException {
        String result;
        String falconUrl = getFalconEndpoint(commandLine);
        FalconClient client = new FalconClient(falconUrl);

        Set<String> optionsList = new HashSet<String>();
        for (Option option : commandLine.getOptions()) {
            optionsList.add(option.getOpt());
        }

        if (optionsList.contains(STACK_OPTION)) {
            result = client.getThreadDump();
            OUT.get().println(result);
        }
        if (optionsList.contains(VERSION_OPTION)) {
            result = client.getVersion();
            OUT.get().println("Falcon server build version: " + result);
        } else if (optionsList.contains(HELP_CMD)) {
            OUT.get().println("Falcon Help");
        }
    }
View Full Code Here

        String entity;

        Services.get().register(ConfigurationStore.get());
        ConfigurationStore.get().init();
        CurrentUser.authenticate("testuser");
        FalconClient client = new FalconClient(falconUrl);
        for (int index = 2; index < args.length; index++) {
            entity = args[index];
            String[] deps = client.getDependency(type, entity).split("\n");
            for (String line : deps) {
                String[] fields = line.replace("(", "").replace(")", "").split(" ");
                EntityType eType = EntityType.valueOf(fields[0].toUpperCase());
                if (ConfigurationStore.get().get(eType, fields[1]) != null) {
                    continue;
                }
                String xml = client.getDefinition(eType.name().toLowerCase(), fields[1]);
                System.out.println(xml);
                store(eType, xml);
            }
            String xml = client.getDefinition(type.toLowerCase(), entity);
            System.out.println(xml);
            store(EntityType.valueOf(type.toUpperCase()), xml);
        }

        entity = args[2];
View Full Code Here

        String entity;

        Services.get().register(ConfigurationStore.get());
        ConfigurationStore.get().init();
        CurrentUser.authenticate("testuser");
        FalconClient client = new FalconClient(falconUrl);
        for (int index = 2; index < args.length; index++) {
            entity = args[index];
            EntityList deps = client.getDependency(type, entity);
            for (EntityElement dep : deps.getElements()) {
                EntityType eType = EntityType.valueOf(dep.type.toUpperCase());
                if (ConfigurationStore.get().get(eType, dep.name) != null) {
                    continue;
                }
                String xml = client.getDefinition(eType.name().toLowerCase(), dep.name);
                System.out.println(xml);
                store(eType, xml);
            }
            String xml = client.getDefinition(type.toLowerCase(), entity);
            System.out.println(xml);
            store(EntityType.valueOf(type.toUpperCase()), xml);
        }

        entity = args[2];
View Full Code Here

            if (command.getName().equals(HELP_CMD)) {
                parser.showHelp();
            } else {
                CommandLine commandLine = command.getCommandLine();
                String falconUrl = getFalconEndpoint(commandLine);
                FalconClient client = new FalconClient(falconUrl, clientProperties);

                if (command.getName().equals(ADMIN_CMD)) {
                    exitValue = adminCommand(commandLine, client, falconUrl);
                } else if (command.getName().equals(ENTITY_CMD)) {
                    entityCommand(commandLine, client);
View Full Code Here

        File tmpFile = TestContext.getTempFile();
        EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
        context.scheduleProcess(tmpFile.getAbsolutePath(), overlay);
        OozieTestUtils.waitForBundleStart(context, Status.FAILED, Status.KILLED);

        FalconClient client = new FalconClient(TestContext.BASE_URL);
        EntityList deps = client.getDependency(EntityType.PROCESS.name(), process.getName());
        for (EntityElement dep : deps.getElements()) {
            if (dep.name.equals(process.getInputs().getInputs().get(0).getName())) {
                Assert.assertEquals("Input", dep.tag);
            } else if (dep.name.equals(process.getOutputs().getOutputs().get(0).getName())) {
                Assert.assertEquals("Output", dep.tag);
View Full Code Here

    }

    private void adminCommand(CommandLine commandLine) throws FalconCLIException, IOException {
        String result;
        String falconUrl = getFalconEndpoint(commandLine);
        FalconClient client = new FalconClient(falconUrl);

        Set<String> optionsList = new HashSet<String>();
        for (Option option : commandLine.getOptions()) {
            optionsList.add(option.getOpt());
        }

        if (optionsList.contains(STACK_OPTION)) {
            result = client.getThreadDump();
            OUT.get().println(result);
        }
        if (optionsList.contains(VERSION_OPTION)) {
            result = client.getVersion();
            OUT.get().println("Falcon server build version: " + result);
        } else if (optionsList.contains(HELP_CMD)) {
            OUT.get().println("Falcon Help");
        }
    }
View Full Code Here

        }
    }

    private void instanceCommand(CommandLine commandLine) throws FalconCLIException, IOException {
        String falconUrl = getFalconEndpoint(commandLine);
        FalconClient client = new FalconClient(falconUrl);

        Set<String> optionsList = new HashSet<String>();
        for (Option option : commandLine.getOptions()) {
            optionsList.add(option.getOpt());
        }

        String result;
        String type = commandLine.getOptionValue(ENTITY_TYPE_OPT);
        String entity = commandLine.getOptionValue(ENTITY_NAME_OPT);
        String start = commandLine.getOptionValue(START_OPT);
        String end = commandLine.getOptionValue(END_OPT);
        String filePath = commandLine.getOptionValue(FILE_PATH_OPT);
        String runid = commandLine.getOptionValue(RUNID_OPT);
        String colo = commandLine.getOptionValue(COLO_OPT);
        String clusters = commandLine.getOptionValue(CLUSTERS_OPT);
        String sourceClusters = commandLine.getOptionValue(SOURCECLUSTER_OPT);

        colo = getColo(colo);

        validateInstanceCommands(optionsList, entity, type, start, colo);

        if (optionsList.contains(RUNNING_OPT)) {
            result = client.getRunningInstances(type, entity, colo);
        } else if (optionsList.contains(STATUS_OPT)) {
            result = client.getStatusOfInstances(type, entity, start, end,
                    runid, colo);
        } else if (optionsList.contains(KILL_OPT)) {
            result = client.killInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(SUSPEND_OPT)) {
            result = client.suspendInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(RESUME_OPT)) {
            result = client.resumeInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(RERUN_OPT)) {
            result = client.rerunInstances(type, entity, start, end, filePath, colo, clusters, sourceClusters);
        } else if (optionsList.contains(CONTINUE_OPT)) {
            result = client.rerunInstances(type, entity, start, end, colo, clusters, sourceClusters);
        } else if (optionsList.contains(LOG_OPT)) {
            result = client.getLogsOfInstances(type, entity, start, end, colo, runid);
        } else {
            throw new FalconCLIException("Invalid command");
        }

        OUT.get().println(result);
View Full Code Here

    private void entityCommand(CommandLine commandLine)
        throws FalconCLIException, IOException {

        String falconUrl = getFalconEndpoint(commandLine);
        FalconClient client = new FalconClient(falconUrl);

        Set<String> optionsList = new HashSet<String>();
        for (Option option : commandLine.getOptions()) {
            optionsList.add(option.getOpt());
        }

        String result = null;
        String entityType = commandLine.getOptionValue(ENTITY_TYPE_OPT);
        String entityName = commandLine.getOptionValue(ENTITY_NAME_OPT);
        String filePath = commandLine.getOptionValue(FILE_PATH_OPT);
        String colo = commandLine.getOptionValue(COLO_OPT);


        validateEntityType(entityType);

        if (optionsList.contains(SUBMIT_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            result = client.submit(entityType, filePath);
        } else if (optionsList.contains(UPDATE_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.update(entityType, entityName, filePath);
        } else if (optionsList.contains(SUBMIT_AND_SCHEDULE_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            result = client.submitAndSchedule(entityType, filePath);
        } else if (optionsList.contains(VALIDATE_OPT)) {
            validateFilePath(filePath);
            validateColo(optionsList);
            result = client.validate(entityType, filePath);
        } else if (optionsList.contains(SCHEDULE_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.schedule(entityType, entityName, colo);
        } else if (optionsList.contains(SUSPEND_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.suspend(entityType, entityName, colo);
        } else if (optionsList.contains(RESUME_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.resume(entityType, entityName, colo);
        } else if (optionsList.contains(DELETE_OPT)) {
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.delete(entityType, entityName);
        } else if (optionsList.contains(STATUS_OPT)) {
            validateEntityName(entityName);
            colo = getColo(colo);
            result = client.getStatus(entityType, entityName, colo);
        } else if (optionsList.contains(DEFINITION_OPT)) {
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.getDefinition(entityType, entityName);
        } else if (optionsList.contains(DEPENDENCY_OPT)) {
            validateColo(optionsList);
            validateEntityName(entityName);
            result = client.getDependency(entityType, entityName);
        } else if (optionsList.contains(LIST_OPT)) {
            validateColo(optionsList);
            result = client.getEntityList(entityType);
        } else if (optionsList.contains(HELP_CMD)) {
            OUT.get().println("Falcon Help");
        } else {
            throw new FalconCLIException("Invalid command");
        }
View Full Code Here

TOP

Related Classes of org.apache.falcon.client.FalconClient

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.