Package org.rhq.core.pluginapi.operation

Examples of org.rhq.core.pluginapi.operation.OperationResult


            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertyList list = new PropertyList("plugins");
        info.getComplexResults().put(list);

        for (String plugin : deploymentOrder) {
            PropertyMap map = new PropertyMap("plugin");
            map.put(new PropertySimple("name", plugin));
            map.put(new PropertySimple("dependencies", dependencies.get(plugin)));
View Full Code Here


            classloaders = clm.getPluginClassLoaders();
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<String, ClassLoader> entry : classloaders.entrySet()) {
            String pluginName = entry.getKey();
            ClassLoader classloader = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
View Full Code Here

            classloaders = clm.getDiscoveryClassLoaders();
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<String, ClassLoader> entry : classloaders.entrySet()) {
            String id = entry.getKey();
            ClassLoader classloader = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
View Full Code Here

            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfResources", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Entry<CanonicalResourceKey, ClassLoader> entry : classloaders.entrySet()) {
            CanonicalResourceKey canonicalId = entry.getKey();
            ClassLoader classloader = entry.getValue();
            String[] data = canonicalIdMap.get(canonicalId);
View Full Code Here

            classloaders.clear(); // don't need this shallow copy anymore, help the GC clean up
        } finally {
            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaderCounts
            .size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<ClassLoader, AtomicInteger> entry : classloaderCounts.entrySet()) {
            ClassLoader classloader = entry.getKey();
            AtomicInteger count = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
View Full Code Here

    private void testServiceSimpleMethodInvocation(Resource resource) throws InterruptedException, Exception {
        ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager()
            .getResourceComponent(resource);

        Configuration config = new Configuration();
        OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("enable", config);
        log.info("Result of operation enable was: " + result.getSimpleResult());
        assert result.getSimpleResult().equals("true") : "The operation execution failed!";

        result = ((OperationFacet) resourceComponent).invokeOperation("disable", config);
        log.info("Result of operation disable was: " + result.getSimpleResult());
        assert result.getSimpleResult().equals("true") : "The operation execution failed!";
    }
View Full Code Here

            .getResourceComponent(resource);

        Configuration config = new Configuration();
        config.put(new PropertySimple("p1", "1"));
        config.put(new PropertySimple("p2", java.util.concurrent.TimeUnit.SECONDS));
        OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("stop", config);
        log.info("Result of operation stop was: " + result.getSimpleResult());
    }
View Full Code Here

        ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager()
            .getResourceComponent(resource);

        if (resourceComponent instanceof OperationFacet) {
            for (String operationName : new String[] { "reset", "refresh" }) {
                OperationResult result = ((OperationFacet) resourceComponent).invokeOperation(operationName,
                    new Configuration());
                log.info("Result of operation " + operationName + " was: " + result);

                //need to wait for the reset to finish, this is a long operation
                Thread.sleep(5000);
View Full Code Here

        ResourceComponent resourceComponent = PluginContainer.getInstance().getInventoryManager()
            .getResourceComponent(resource);

        if (resourceComponent instanceof OperationFacet) {
            try {
                OperationResult result = ((OperationFacet) resourceComponent).invokeOperation("enableContext", null);
                log.info("Result of operation " + "enableContext" + " was: " + result.getSimpleResult());

                Configuration config = new Configuration();
                config.put(new PropertySimple("timeout", "1"));
                config.put(new PropertySimple("unit", java.util.concurrent.TimeUnit.SECONDS));

                result = ((OperationFacet) resourceComponent).invokeOperation("stopContext", config);
                log.info("Result of operation stopContext was: " + result.getSimpleResult());
                assert result.getSimpleResult().equals("true") : "The operation execution failed!";

                result = ((OperationFacet) resourceComponent).invokeOperation("enableContext", null);
                log.info("Result of operation enableContext was: " + result.getSimpleResult());
                assert result.getSimpleResult().equals("true") : "The operation execution failed!";

                result = ((OperationFacet) resourceComponent).invokeOperation("disableContext", null);
                log.info("Result of operation disableContext was: " + result.getSimpleResult());
                assert result.getSimpleResult().equals("true") : "The operation execution failed!";
            } catch (Exception e) {
                log.info("Operation failed. ", e);
            }

        }
View Full Code Here

    public void invokeOperation(ExpectedApacheState desiredState, String operation) throws Exception {
        int i = 0;

        while (i < 10) {
            OperationResult res = serverComponent.invokeOperation(operation, new Configuration());

            LOG.debug("Invoked operation '" + operation + "' on " + resourceContext.getResourceKey() + " (waiting for "
                + desiredState + "), attempt " + i + ": " + res.getComplexResults().getMap().toString());

            //wait for max 30s for the operation to "express" itself
            int w = 0;
            ProcessInfo pi;
            while (w < 30) {
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.operation.OperationResult

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.