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

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


     *
     * @throws Exception
     */
    public void getParent4() throws Exception {
        String path = "/subsystem=modcluster,mod-cluster-config=configuration/";
        Address a = new Address(path);
        //extract parent portion. Penultimate.
        Address b = a.getParent();
        assert a.size() == 2 : "A.size was not 2, but " + a.size();
        assert b != null;
        assert b.size() == 1 : "B.size was not 1, but " + b.size();
        assert b.get(0).equals("subsystem=modcluster");
    }
View Full Code Here


        assert b.get(0).equals("subsystem=modcluster");
    }

    public void pathWithColon() throws Exception {
        String path = "subsystem=mail,jndi=java:/mail";
        Address a = new Address(path);
        assert a.size() == 2: "A.size was not 2, but " + a.size();

        Address b = a.getParent();
        assert b.size() == 1: "B.size was not 1, but " + b.size();
        assert b.get(0).equals("subsystem=mail");

        String segment = a.get(1);
        assert !segment.isEmpty();
        assert segment.equals("jndi=java:/mail") : "Segment is " + segment;
    }
View Full Code Here

        assert segment.equals("jndi=java:/mail") : "Segment is " + segment;
    }

    public void pathWithColon2() throws Exception {
//        String path = "subsystem=mail,jndi=java:/mail";
        Address a = new Address();
        a.addSegment("subsystem=mail");
        a.addSegment("jndi=java:/mail");
        assert a.size() == 2: "A.size was not 2, but " + a.size();

        Address b = a.getParent();
        assert b.size() == 1: "B.size was not 1, but " + b.size();
        assert b.get(0).equals("subsystem=mail");

        String segment = a.get(1);
        assert !segment.isEmpty();
        assert segment.equals("jndi=java:/mail") : "Segment is " + segment;
    }
View Full Code Here

        assert segment.equals("jndi=java:/mail") : "Segment is " + segment;
    }

    public void pathWithColon3() throws Exception {
//        String path = "subsystem=mail,jndi=java:/mail";
        Address a = new Address();
        a.add("subsystem","mail");
        a.add("jndi","java:/mail");
        assert a.size() == 2: "A.size was not 2, but " + a.size();

        Address b = a.getParent();
        assert b.size() == 1: "B.size was not 1, but " + b.size();
        assert b.get(0).equals("subsystem=mail");

        String segment = a.get(1);
        assert !segment.isEmpty();
        assert segment.equals("jndi=java:/mail") : "Segment is " + segment;
    }
View Full Code Here

    }


    public void pathWithSpecial2() throws Exception {
        String path = "subsystem=mail,jndi=java:\"mail";
        Address a = new Address(path);
        assert a.size() == 2: "A.size was not 2, but " + a.size();

        Address b = a.getParent();
        assert b.size() == 1: "B.size was not 1, but " + b.size();
        assert b.get(0).equals("subsystem=mail");

        String segment = a.get(1);
        assert !segment.isEmpty();
        assert segment.equals("jndi=java:\"mail") : "Segment is " + segment;
    }
View Full Code Here

        this.hash = hash;
        this.connection = connection;
    }

    boolean deploymentExists() {
        Result deploymentResources = connection.execute(new ReadChildrenResources(new Address(), "deployment"));
        for (Map.Entry<?, ?> deploymentResource : ((Map<?, ?>) deploymentResources.getResult()).entrySet()) {
            @SuppressWarnings("unchecked")
            Map<String, Object> deploymentResourceDetails = (Map<String, Object>) deploymentResource.getValue();
            if (runtimeName.equals(deploymentResourceDetails.get("runtime-name"))) {
                return true;
View Full Code Here

        }
        return false;
    }

    Result redeployOnServer() {
        Operation op = new Operation("full-replace-deployment", new Address());
        op.addAdditionalProperty("name", runtimeName);
        List<Object> content = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
        content.add(contentValues);
View Full Code Here

        if (path == null || path.isEmpty()) {
            log.error("Path plugin config is null for ResourceType [" + context.getResourceType().getName() + "].");
            return entities;
        }

        Address addr = new Address(path);
        Operation op = new Operation(PROXY_INFO_OPERATION, addr);
        Result result = connection.execute(op);
        //get ProxyInfo and parse
        rawProxyInfo = extractRawProxyInfo(result);
        ProxyInfo proxyInfo = new ProxyInfo(rawProxyInfo);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
        Exception {
        OperationResult operationResult = new OperationResult();
        Address address = new Address(path);
        Operation operation = new Operation(name, address);
        Result asResult = getASConnection().execute(operation, false, JdrReportRunner.JDR_OPERATION_TIMEOUT);

        if (!asResult.isSuccess()) {
            operationResult.setErrorMessage(asResult.getFailureDescription());
View Full Code Here

            } else
                subTypes.add(confPath);

            for (String cpath : subTypes) {

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

                if (result.isSuccess()) {

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

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

                        String newPath = cpath + "=" + val;
                        Configuration config2 = context.getDefaultPluginConfiguration();

                        String resKey;

                        if (path == null || path.isEmpty())
                            resKey = newPath;
                        else {
                            if (path.startsWith(","))
                                path = path.substring(1);
                            resKey = path + "," + cpath + "=" + val;
                        }

                        PropertySimple pathProp = new PropertySimple("path", resKey);
                        config2.put(pathProp);

                        DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // DataType
                            resKey, // Key
                            val, // Name
                            null, // Version
                            context.getResourceType().getDescription(), // subsystem.description
                            config2, null);
                        details.add(detail);
                    }
                }
            }
        } else {
            // Single subsystem
            path += "," + confPath;
            if (path.startsWith(","))
                path = path.substring(1);
            Result result = connection.execute(new ReadResource(new Address(path)));
            if (result.isSuccess()) {

                String resKey = path;
                String name = resKey.substring(resKey.lastIndexOf("=") + 1);
                Configuration config2 = context.getDefaultPluginConfiguration();
View Full Code Here

TOP

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

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.