Examples of ReadAttribute


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

        }
        return results;
    }

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

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

        Address ejb3SubsystemAddress = new Address();
        ejb3SubsystemAddress.add("profile", "full");
        ejb3SubsystemAddress.add("subsystem", "ejb3");
        Result readAttributeResult = getDomainControllerASConnection().execute(
            new ReadAttribute(ejb3SubsystemAddress, "default-singleton-bean-access-timeout"));

        assertTrue(readAttributeResult.isSuccess(), readAttributeResult.getFailureDescription());

        Integer defaultSingletonBeanAccessTimeout = (Integer) readAttributeResult.getResult();
View Full Code Here

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

    }

    private boolean waitUntilReloaded() throws InterruptedException {
        boolean reloaded = false;
        while (!reloaded) {
            Operation op = new ReadAttribute(new Address(), "release-version");
            try {
                Result res = getASConnection().execute(op);
                if (res.isSuccess() && !res.isReloadRequired()) {
                    reloaded = true;
                }
View Full Code Here

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

        assertTrue(response.isSuccess(), getFailureMessage(response));

        Address ejb3SubsystemAddress = new Address();
        ejb3SubsystemAddress.add("subsystem", "ejb3");
        Result readAttributeResult = getStandaloneASConnection().execute(
            new ReadAttribute(ejb3SubsystemAddress, "default-singleton-bean-access-timeout"));

        assertTrue(readAttributeResult.isSuccess(), readAttributeResult.getFailureDescription());

        Integer defaultSingletonBeanAccessTimeout = (Integer) readAttributeResult.getResult();
View Full Code Here

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

    }

    public void testCompositeReadAttribute() throws Exception {
        Address a = new Address("profile=default,subsystem=web,connector=http");
        CompositeOperation cop = new CompositeOperation();
        Operation step1 = new ReadAttribute(a, "maxTime");
        cop.addStep(step1);
        Operation step2 = new ReadAttribute(a, "processingTime");
        cop.addStep(step2);

        ComplexResult res = getDomainControllerASConnection().executeComplex(cop);
        assertNotNull(res);
        assertTrue(res.isSuccess(), "Response outcome was failure.");
View Full Code Here

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

    private static final int MANAGEMENT_QUERY_TIMEOUT = 60;
    private static final String ENABLED_ATTRIBUTE = "enabled";

    @Override
    public Configuration loadResourceConfiguration() throws Exception {
        ReadAttribute readAttributeOp = new ReadAttribute(getAddress(), ENABLED_ATTRIBUTE);
        Result result = getASConnection().execute(readAttributeOp);
        if (!result.isSuccess()) {
            throw new Exception(result.getFailureDescription(), result.getRhqThrowable());
        }
        Configuration configuration = new Configuration();
View Full Code Here

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

            ComplexRequest complexRequest = null;
            Operation op;
            if (reqName.contains(":")) {
                complexRequest = ComplexRequest.create(reqName);
                op = new ReadAttribute(address, complexRequest.getProp());
            } else {
                op = new ReadAttribute(address, reqName);
            }

            Result res = getASConnection().execute(op);
            if (!res.isSuccess()) {
                if (LOG.isDebugEnabled()) {
View Full Code Here

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

    protected <R> R readAttribute(Address address, String name, Class<R> resultType) throws Exception {
        return readAttribute(address, name, resultType, 10);
    }

    protected <R> R readAttribute(Address address, String name, Class<R> resultType, int timeoutSec) throws Exception {
        Operation op = new ReadAttribute(address, name);
        Result res = getASConnection().execute(op, timeoutSec);

        if (!res.isSuccess()) {
            if (res.isTimedout()) {
                throw new TimeoutException("Read attribute operation timed out");
View Full Code Here

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

     * </ul>
     * @return A file object pointing to the deployed file or null if there is no content
     */
    @SuppressWarnings("unchecked")
    private File determineDeploymentFile() {
        Operation op = new ReadAttribute(getAddress(), "content");
        Result result = getASConnection().execute(op);

        List<Map<String, Object>> content = (List<Map<String, Object>>) result.getResult();
        if (content == null || content.isEmpty()) {
            // No content -> check for server group
            if (path.startsWith(("server-group="))) {
                // Server group has no content of its own - use the domain deployment
                String name = path.substring(path.lastIndexOf("=") + 1);
                op = new ReadResource(new Address("deployment", name));
                result = getASConnection().execute(op);
                if (result.isSuccess()) {
                    Map<String, Object> contentMap = (Map<String, Object>) result.getResult();
                    content = (List<Map<String, Object>>) contentMap.get("content");
                    if (content.get(0).containsKey("path")) {
                        String path = (String) content.get(0).get("path");
                        String relativeTo = (String) content.get(0).get("relative-to");
                        deploymentFile = getDeploymentFileFromPath(relativeTo, path);
                    } else if (content.get(0).containsKey("hash")) {
                        String base64Hash = ((Map<String, String>) content.get(0).get("hash")).get("BYTES_VALUE");
                        byte[] hash = Base64.decode(base64Hash);
                        ServerGroupComponent sgc = (ServerGroupComponent) context.getParentResourceComponent();
                        String baseDir = ((HostControllerComponent) sgc.context.getParentResourceComponent()).pluginConfiguration
                            .getSimpleValue("baseDir");
                        String contentPath = new File(baseDir, "/data/content").getAbsolutePath();
                        deploymentFile = getDeploymentFileFromHash(hash, contentPath);
                    }
                    return deploymentFile;
                }
            } else {
                getLog().warn(
                    "Could not determine the location of the deployment - the content descriptor wasn't found for deployment"
                        + getAddress() + ".");
                return null;
            }
        }

        Boolean archive = (Boolean) content.get(0).get("archive");
        if (archive != null && !archive) {
            getLog().debug("Exploded deployments not supported for retrieving the content.");
            return null;
        }

        File deploymentFile = null;
        if (content.get(0).containsKey("path")) {
            String path = (String) content.get(0).get("path");
            String relativeTo = (String) content.get(0).get("relative-to");
            deploymentFile = getDeploymentFileFromPath(relativeTo, path);
        } else if (content.get(0).containsKey("hash")) {
            String base64Hash = ((Map<String, String>) content.get(0).get("hash")).get("BYTES_VALUE");
            byte[] hash = Base64.decode(base64Hash);
            Address contentPathAddress;
            if (context.getParentResourceComponent() instanceof ManagedASComponent) {
                // -> managed server we need to check for host=x/server=y, but the path brings host=x,server-config=y
                String p = ((ManagedASComponent) context.getParentResourceComponent()).getPath();
                p = p.replaceAll("server-config=", "server=");
                contentPathAddress = new Address(p);
                contentPathAddress.add("core-service", "server-environment");
            } else {
                // standalone
                contentPathAddress = new Address("core-service", "server-environment");
            }
            op = new ReadAttribute(contentPathAddress, "content-dir");
            result = getASConnection().execute(op);

            String contentPath;
            if (result.isSuccess()) {
                contentPath = (String) result.getResult();
View Full Code Here

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

            if (relativeTo.startsWith("jboss.server")) {
                relativeTo = relativeTo.substring("jboss.server.".length());
                relativeTo = relativeTo.replace('.', '-');

                //now look for the transformed relativeTo in the server environment
                Operation op = new ReadAttribute(new Address("core-service", "server-environment"), relativeTo);
                Result res = getASConnection().execute(op);

                relativeTo = (String) res.getResult();

                return new File(relativeTo, path);
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.