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

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


            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

            String path = getPath();
            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());
View Full Code Here

        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


        Address deploymentsAddress = new Address();
        String TEST_WAR = "test.war";
        deploymentsAddress.add("deployment", TEST_WAR);
        Operation step1 = new Operation("add",deploymentsAddress);
        String bytes_value = "123";
        step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
        step1.addAdditionalProperty("name", TEST_WAR);

        Address serverGroupAddress = new Address();
        serverGroupAddress.add("server-group","main-server-group");
        serverGroupAddress.add("deployment", TEST_WAR);
        Operation step2 = new Operation("add",serverGroupAddress);
        step2.addAdditionalProperty("enabled","true");


        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);
View Full Code Here

        return resultNode.get("BYTES_VALUE").getTextValue();
    }

    Operation addDeployment(String deploymentName, String bytes_value) {
        Address deploymentsAddress = new Address("deployment", deploymentName);
        Operation op = new Operation("add", deploymentsAddress);
        List<Object> content = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
        content.add(contentValues);
        op.addAdditionalProperty("content", content);
        op.addAdditionalProperty("name", deploymentName); // this needs to be unique per upload
        op.addAdditionalProperty("runtime-name", deploymentName);

        return op;
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public OperationResult invokeOperation(String name,
                                           Configuration parameters) throws  Exception {

        if (name.equals("get-all-thread-ids")) {
            Operation op = new ReadAttribute(getAddress(), "all-thread-ids");
            Result res = getASConnection().execute(op);
            OperationResult operationResult;
            if (res.isSuccess()) {
                List<Long> ids = (List<Long>) res.getResult();
                operationResult = new OperationResult(ids.toString());
View Full Code Here

    @Override
    public OperationResult invokeOperation(String name,
                                           Configuration parameters) throws InterruptedException, Exception {

        Operation op = new Operation(name,address);

        Map<String,Property> propertyMap = parameters.getAllProperties();
        for (Map.Entry<String,Property> entry : propertyMap.entrySet()) {
            if (entry.getValue() instanceof PropertySimple) {
                PropertySimple ps = (PropertySimple) entry.getValue();
                op.addAdditionalProperty(entry.getKey(),ps.getStringValue());
            } else if (entry.getValue() instanceof PropertyList) {
                PropertyList pl = (PropertyList) entry.getValue();
                List<Property> props = pl.getList();
                List<String> objects = new ArrayList<String>(props.size());
                for (Property p : props) {
                    PropertySimple ps = (PropertySimple) p;
                    objects.add(ps.getStringValue());
                }
                op.addAdditionalProperty(entry.getKey(),objects);
            }
        }


        ASConnection conn = getASConnection();
View Full Code Here

TOP

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

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.