Package org.rhq.modules.plugins.jbossas7

Examples of org.rhq.modules.plugins.jbossas7.ServerGroupComponent


        }
        return results;
    }

    private Result executeRead(ASConnection asConnection) {
        return asConnection.execute(new ReadAttribute(new Address("/"), "product-version"));
    }
View Full Code Here


        Address address = new Address();

        ReadResource op = new ReadResource(address);
        op.includeRuntime(true);

        ComplexResult res = getASConnection().executeComplex(op);
        if (res.isSuccess()) {
            Map<String, Object> props = res.getResult();

            for (MeasurementScheduleRequest request : skmRequests) {
                String requestName = request.getName();
                String realName = requestName.substring(requestName.indexOf(':') + 1);
                String val = null;
                if (props.containsKey(realName)) {
                    val = getStringValue(props.get(realName));
                }

                if ("null".equals(val)) {
                    if (realName.equals("product-name"))
                        val = "JBoss AS";
                    else if (realName.equals("product-version"))
                        val = getStringValue(props.get("release-version"));
                    else if (LOG.isDebugEnabled()) {
                        LOG.debug("Value for " + realName + " was 'null' and no replacement found");
                    }
                }
                MeasurementDataTrait data = new MeasurementDataTrait(request, val);
                report.addData(data);
            }
        } else if (LOG.isDebugEnabled()) {
            LOG.debug("getSKMRequests failed: " + res.getFailureDescription());
        }
    }
View Full Code Here

            if (req.getName().equals("appuid")) {

                Address addr = new Address("core-service=platform-mbean,type=runtime");
                ReadAttribute op = new ReadAttribute(addr,"system-properties");
                ASConnection conn = parent.getASConnection();
                ComplexResult result = conn.executeComplex(op);

                if (result.isSuccess()) {
                    Map<String,Object> data = result.getResult();
                    if (data.containsKey("OPENSHIFT_APP_UUID")) {
                        String uid = (String) data.get("OPENSHIFT_APP_UUID");
                        MeasurementDataTrait res = new MeasurementDataTrait(req,uid);
                 report.addData(res);
                    }
                }
                else {
                    log.warn("Operation failed: " + result.getFailureDescription());
                }
            }
            // TODO add more metrics here
         }
    }
View Full Code Here

            }
        }


        ASConnection conn = getASConnection();
        ComplexResult result = conn.executeComplex(op);

        if (result.isSuccess()) {
            return new OperationResult("ok");
        }
        else {
            OperationResult failure = new OperationResult();
            failure.setErrorMessage(result.getFailureDescription());
            return failure;
        }


    }
View Full Code Here

        Address address= new Address();
        address.add("subsystem","web");
        address.add("connector","http");
        address.add("profile","default");

        CompositeOperation op = new CompositeOperation();

        Operation step1 = new Operation("add", address);
        op.addStep(step1);

        Operation step2 = new Operation("deploy", address);
        op.addStep(step2);

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(op);
View Full Code Here

        Operation step3 = new Operation("remove",serverGroupAddress);

        Operation step4 = new Operation("remove",deploymentsAddress);

        CompositeOperation cop = new CompositeOperation();
        cop.addStep(step1);
        cop.addStep(step2);
        cop.addStep(step3);
        cop.addStep(step4);

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(cop);
        System.out.println(result);
View Full Code Here

            if (reqName == null) {
               reqName = req.getName();
            }

            ComplexRequest request = null;
            Operation op;
            if (reqName.contains(":")) {
               request = ComplexRequest.create(reqName);
               op = new ReadAttribute(getAddress(), request.getProp());
            } else {
               op = new ReadAttribute(getAddress(), reqName); // TODO batching
View Full Code Here

            return report;
        }
        String newName = report.getUserSpecifiedResourceName();
        Address address = new Address(this.getAddress());
        address.add(flavor,newName);
        Operation add = new Operation("add",address);
        for (Property prop: config.getProperties()) {
            if (prop.getName().equals(FLAVOR)) {
                continue;
            }
            PropertySimple ps = (PropertySimple) prop;
            add.addAdditionalProperty(prop.getName(),ps.getStringValue()); // TODO format conversion?

        }
        Result result = getASConnection().execute(add);
        if (result.isSuccess()) {
            report.setResourceKey(address.getPath());
View Full Code Here

    }

    protected boolean waitUntilDown() throws InterruptedException {
        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;
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;
                }
View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.ServerGroupComponent

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.