Package org.rhq.modules.plugins.jbossas7.json

Examples of org.rhq.modules.plugins.jbossas7.json.ComplexResult


     */
    private void addDiscoveredResource(ResourceDiscoveryContext context, Set<DiscoveredResourceDetails> details,
        ASConnection connection, String path, String name, Address address) {
        //ping the resource to determine if it's enabled and available.
        ReadResource op = new ReadResource(address);
        Result result = connection.execute(op);
        if (result.isSuccess()) {

            //include the config entry for the discovered node.
            Configuration config2 = context.getDefaultPluginConfiguration();
            //add path component to config as well.
            PropertySimple pathProp = new PropertySimple("path", path);
View Full Code Here


        boolean notAnswering = false;
        while (!notAnswering) {
            Operation op = new ReadAttribute(new Address(), "release-version");

            try {
                Result res = getASConnection().execute(op);
                if (!res.isSuccess()) { // If op succeeds, server is not down
                    notAnswering = true;
                }
            } catch (Exception e) {
                notAnswering = true;
            }
View Full Code Here

    private boolean waitForServerToStart() throws InterruptedException {
        boolean up = false;
        while (!up) {
            Operation op = new ReadAttribute(new Address(), "release-version");
            try {
                Result res = getASConnection().execute(op);
                if (res.isSuccess()) { // If op succeeds, server is not down
                    up = true;
                }
            } catch (Exception e) {
                //do absolutely nothing
                //if an exception is thrown that means the server is still down, so consider this
View Full Code Here

     * @return name current host within EAP domain or null if we failed to read it
     */
    public static String findASDomainHostName(ASConnection connection) {
        ReadAttribute op = new ReadAttribute(new Address(), "local-host-name");
        op.includeDefaults(true);
        Result result = connection.execute(op);
        if (result.isSuccess()) {
            return result.getResult().toString();
        }
        return null;
    }
View Full Code Here

        } else {
            String json = results.getCapturedOutput();

            ObjectMapper mapper = new ObjectMapper();

            Result result;
            try {
                result = mapper.readValue(json, Result.class);
            } catch (IOException e) {
                LOG.warn("Failed to parse the output of the 'patch info' command with message '" + e.getMessage() +
                    "'.", e);
                return null;
            }

            if (!result.isSuccess()) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("'patch info' command didn't succeed: " + result);
                }

                return null;
            }

            if (!(result.getResult() instanceof Map)) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Unexpected patch info results. Expected map but found " +
                        (result.getResult() == null ? "null" : result.getResult().getClass().toString()));
                }

                return null;
            }

            @SuppressWarnings("unchecked")
            Map<String, Object> info = (Map<String, Object>) result.getResult();

            if (info.isEmpty()) {
                return null;
            }
View Full Code Here

            path = path.replace("server-config","server");
            Address address = new Address(path);
            address.add("core-service","platform-mbean");
            address.add("type","runtime");
            Operation op = new ReadAttribute(address,"start-time");
            Result res = getASConnection().execute(op);

            if (res.isSuccess()) {
               Long startTime= (Long) res.getResult();
               MeasurementDataTrait data = new MeasurementDataTrait(request,new Date(startTime).toString());
               report.addData(data);
            }
         }
         else {
View Full Code Here

    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
        Set<MeasurementScheduleRequest> leftovers = new HashSet<MeasurementScheduleRequest>(metrics.size());
        for (MeasurementScheduleRequest request : metrics) {
            if (request.getName().equals("_aliases")) {
                ReadAttribute op = new ReadAttribute(getAddress(), "alias");
                Result res = getASConnection().execute(op);
                if (res.isSuccess()) {
                    List<String> aliases = (List<String>) res.getResult();
                    MeasurementDataTrait data;
                    if (aliases != null) {
                        Collections.sort(aliases);
                        String trait = aliases.toString();
                        data = new MeasurementDataTrait(request, trait);
                    } else {
                        data = new MeasurementDataTrait(request, "-none-");
                    }
                    report.addData(data);
                } else
                    getLog().warn("Could not get aliases for " + getAddress() + ": " + res.getFailureDescription());
            } else {
                leftovers.add(request);
            }
        }
        super.getValues(report, leftovers);
View Full Code Here

            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
            .thenReturn(mockConfigurationWriteDelegate);

        ASConnection mockASConnection = mock(ASConnection.class);
        when(mockASConnection.execute(any(ReadResource.class))).thenReturn(new Result());


        //create object to test and inject required dependencies
        TemplatedComponent objectUnderTest = new TemplatedComponent();
View Full Code Here

            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
            .thenReturn(mockConfigurationWriteDelegate);

        ASConnection mockASConnection = mock(ASConnection.class);
        when(mockASConnection.execute(any(ReadResource.class))).thenReturn(new Result());

        //create object to test and inject required dependencies
        TemplatedComponent objectUnderTest = new TemplatedComponent();

        objectUnderTest.context = mockResourceContext;
View Full Code Here

        if (verbose) {
            log.info("total path: [" + path + "]");
        }

        Address addr = new Address(parentPath);
        Result result = connection.execute(new ReadChildrenNames(addr, confPath));

        if (result.isSuccess()) {

            @SuppressWarnings("unchecked")
            List<String> deployments = (List<String>) result.getResult();

            // There may be multiple children of the given type
            for (String val : deployments) {

                String newPath = confPath + "=" + val;
View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.json.ComplexResult

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.