Package org.rhq.core.clientapi.agent

Examples of org.rhq.core.clientapi.agent.PluginContainerException


            ResourceContainer parentContainer;

            if (parentResource != null) {
                parentContainer = inventoryManager.getResourceContainer(parentResource);
                if (parentContainer == null) {
                    throw new PluginContainerException("Missing container for parent " + parentResource + " of "
                            + resource + ".");
                }
            } else if (resource.equals(inventoryManager.getPlatform())) {
                // the given resource is our top platform resource - just use its plugin classloader
                return classLoaderMgr.obtainPluginClassLoader(resourceType.getPlugin());
            } else {
                throw new PluginContainerException("Missing parent resource for resource=" + resource);
            }

            // get the classloader the resource should use
            List<URL> additionalJars = (classLoaderMgr.isCreateResourceClassLoaders()) ?
                askDiscoveryComponentForAdditionalClasspathUrls(resource, parentContainer) :
                Collections.<URL>emptyList();
            ClassLoader cl = classLoaderMgr.obtainResourceClassLoader(resource, parentContainer, additionalJars);
            return cl;
        } catch (Throwable t) {
            throw new PluginContainerException("Failed to obtain classloader for resource: " + resource, t);
        }
    }
View Full Code Here


        if (log.isDebugEnabled()) {
            log.debug("Loading class [" + className + "] via classloader [" + loader + ']');
        }

        if (loader == null) {
            throw new PluginContainerException("Cannot load class [" + className + "] with null classloader");
        }

        try {
            Class<?> clazz = Class.forName(className, true, loader);
            if (log.isDebugEnabled()) {
                log.debug("Loaded class [" + clazz + "] from classloader [" + loader + ']');
            }
            return clazz.newInstance();
        } catch (InstantiationException e) {
            throw new PluginContainerException("Could not instantiate plugin class [" + className
                + "] from classloader [" + loader + "]", e);
        } catch (IllegalAccessException e) {
            throw new PluginContainerException("Could not access plugin class [" + className + "] from classloader ["
                + loader + "]", e);
        } catch (ClassNotFoundException e) {
            throw new PluginContainerException("Could not find plugin class [" + className + "] from classloader ["
                + loader + "]", e);
        } catch (NullPointerException npe) {
            throw new PluginContainerException("Plugin class was 'null' using loader [" + loader + "]", npe);
        }
    }
View Full Code Here

        ConfigurationFacet configFacet = loadConfigurationFacet(resourceId, lockType);

        try {
            return configFacet.loadResourceConfiguration();
        } catch (Exception e) {
            throw new PluginContainerException(e);
        }
    }
View Full Code Here

        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();

        // get the resource container that wraps the given resource
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceId);
        if (resourceContainer == null) {
            throw new PluginContainerException("Resource component container could not be retrieved for resource: "
                + resourceId);
        }

        return resourceContainer.getResource().getResourceType();
    }
View Full Code Here

    public static <T> T getComponent(int resourceId, Class<T> facetInterface, FacetLockType lockType, long timeout,
        boolean daemonThread, boolean onlyIfStarted, boolean transferInterrupt) throws PluginContainerException {
        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceId);
        if (resourceContainer == null) {
            throw new PluginContainerException("Resource component container could not be retrieved for resource: "
                + resourceId);
        }
        return resourceContainer.createResourceComponentProxy(facetInterface, lockType, timeout, daemonThread,
            onlyIfStarted, transferInterrupt);
    }
View Full Code Here

        ResourceComponent parentResourceComponent) throws PluginContainerException {
        Method discoveryCall;
        try {
            discoveryCall = component.getClass().getMethod("discoverResources", ResourceCategory.class);
        } catch (NoSuchMethodException e) {
            throw new PluginContainerException("Resource component doesn't implement resource component interface", e);
        }

        Class<?> componentParameterType = discoveryCall.getParameterTypes()[0];

        TypeVariable<? extends Class<?>>[] types = componentParameterType.getTypeParameters();
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.agent.PluginContainerException

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.