Examples of OperationResult


Examples of org.rhq.core.pluginapi.operation.OperationResult

    protected OperationResult stopNode() {
        ProcessInfo process = getResourceContext().getNativeProcess();

        if (process == null) {
            log.warn("Failed to obtain process info. It appears Cassandra is already shutdown.");
            return new OperationResult("Failed to obtain process info. It appears Cassandra is already shutdown.");
        }

        long pid = process.getPid();
        try {
            process.kill("KILL");

            Configuration pluginConfig = getResourceContext().getPluginConfiguration();
            File basedir = new File(pluginConfig.getSimpleValue("baseDir"));
            File binDir = new File(basedir, "bin");
            File pidFile = new File(binDir, "cassandra.pid");

            pidFile.delete();

            return new OperationResult("Successfully shut down Cassandra daemon with pid " + pid);
        } catch (SigarException e) {
            log.warn("Failed to shut down Cassandra node with pid " + pid, e);
            OperationResult failure = new OperationResult("Failed to shut down Cassandra node with pid " + pid);
            failure.setErrorMessage(ThrowableUtil.getAllMessages(e));
            return failure;
        }
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

    protected OperationResult startNode() {
        Configuration pluginConfig = getResourceContext().getPluginConfiguration();
        String baseDir = pluginConfig.getSimpleValue("baseDir");
        File binDir = new File(baseDir, "bin");
        if (!startScriptExists(binDir)) {
            OperationResult failure = new OperationResult("Failed to start Cassandra daemon");
            failure.setErrorMessage("Start script does not exists");
            return failure;
        }
        ProcessExecution scriptExe = getProcessExecution(binDir);
        SystemInfo systemInfo = getResourceContext().getSystemInformation();
        ProcessExecutionResults results = systemInfo.executeProcess(scriptExe);
        if (results.getError() == null) {
            return new OperationResult("Successfully started Cassandra daemon");
        } else {
            OperationResult failure = new OperationResult("Failed to start Cassandra daemon");
            failure.setErrorMessage(ThrowableUtil.getAllMessages(results.getError()));
            return failure;
        }
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

        scriptExe.addArguments(asList("-p", "cassandra.pid"));
        return scriptExe;
    }

    protected OperationResult restartNode() {
        OperationResult result = shutdownNode();

        if (result.getErrorMessage() == null) {
            result = startNode();
        }

        return result;
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

    protected OperationResult updateSeedsList(Configuration params) {
        PropertyList list = params.getList("seedsList");
        List<String> addresses = getAddresses(list);

        OperationResult result = new OperationResult();
        try {
            updateSeedsList(addresses);
        catch (Exception e) {
            log.error("An error occurred while updating the seeds list property", e);
            Throwable rootCause = ThrowableUtil.getRootCause(e);
            result.setErrorMessage(ThrowableUtil.getStackAsString(rootCause));
        }
        return result;
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            log.info("The rogue component (op) has finished its sleep of " + sleep + "ms");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        OperationResult result = new OperationResult();

        if (status.equalsIgnoreCase("success")) {
            // do nothing
        } else if (status.equalsIgnoreCase("failure")) {
            result.setErrorMessage("Rogue component was told to fail this operation");
        } else {
            throw new RuntimeException("Rogue component (op) was told to throw an exception (status=[" + status + "])");
        }

        return result;
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

    }

    public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
        Exception {
        OperationResult result = null;

        try {
            EmsBean detailComponent = getEmsConnection().getBean(beanName);

            EmsOperation operation = detailComponent.getOperation(name);

            Object obj = operation.invoke(new Object[] {});

            if (obj != null) {
                result = new OperationResult();
                result.getComplexResults().put(
                    new PropertySimple(OperationResult.SIMPLE_OPERATION_RESULT_NAME, String.valueOf(obj)));
            }
        } catch (Exception e) {
            log.error("Failure to invoke operation " + name + " on bean " + beanName, e);
        }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

            return takeSnapshot(parameters);
        } else if (name.equals("cleanup")) {
            return cleanup();
        }

        OperationResult failedOperation = new OperationResult();
        failedOperation.setErrorMessage("Operation not implemented.");

        return failedOperation;
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

        long start = System.currentTimeMillis();
        keyspaceService.repair(keyspace, columnFamilies);
        long end = System.currentTimeMillis();
        log.info("Finished repair on keyspace [" + keyspace + "] in " + (end - start) + " ms");

        return new OperationResult();
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

        long start = System.currentTimeMillis();
        keyspaceService.repairPrimaryRange(keyspace);
        long end = System.currentTimeMillis();
        log.info("Finished primary range repair on keyspace [" + keyspace + " in (" + (end - start) + " ms");

        return new OperationResult();
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.operation.OperationResult

        keyspaceService.cleanup(keyspace);
        long end = System.currentTimeMillis();

        log.info("Finished cleanup on keyspace [" + keyspace + "] in " + (end - start) + " ms");

        return new OperationResult();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.