Examples of PluginContainerException


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

            // note that we only ever unpacked the plugin jar itself
            if (!processedPluginJar && unpackNestedJars) {
                try {
                    unpackedDirectory = unpackEmbeddedJars(pluginJarName, pluginUrl, classpathUrlList, tmpDirectory);
                } catch (Exception e) {
                    throw new PluginContainerException("Failed to unpack embedded JARs within: " + pluginUrl, e);
                }
            }

            processedPluginJar = true;
        }
View Full Code Here

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

    public CreateResourceResponse executeCreateResourceImmediately(CreateResourceRequest request)
        throws PluginContainerException {
        // Load the actual resource type instance to be passed to the facet
        ResourceType resourceType = metadataManager.getType(request.getResourceTypeName(), request.getPluginName());
        if (resourceType == null) {
            throw new PluginContainerException("Could not retrieve resource type for request: " + request);
        }

        String creationType = (request.getResourceConfiguration() != null) ? "configuration" : "package";
        {
            log.debug("Creating " + creationType + "-based resource of type '" + request.getResourceTypeName()
                + "' and with parent with id " + request.getParentResourceId() + "...");
        }

        // Create the report to send the plugin
        CreateResourceReport report = new CreateResourceReport(request.getResourceName(), resourceType, request
            .getPluginConfiguration(), request.getResourceConfiguration(), request.getPackageDetails());

        // Execute the create against the plugin
        CreateChildResourceFacet facet = getCreateChildResourceFacet(request.getParentResourceId(), request
            .getTimeout());

        CreateResourceRunner runner = new CreateResourceRunner(this, request.getParentResourceId(), facet, request
            .getRequestId(), report, configuration.isInsideAgent());

        CreateResourceResponse response;
        try {
            response = (CreateResourceResponse) executor.submit((Callable) runner).get();
        } catch (Exception e) {
            throw new PluginContainerException("Error during create resource callable", e);
        }

        return response;
    }
View Full Code Here

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

    public void createResource(CreateResourceRequest request) throws PluginContainerException {
        // Load the actual resource type instance to be passed to the facet
        ResourceType resourceType = metadataManager.getType(request.getResourceTypeName(), request.getPluginName());
        if (resourceType == null) {
            throw new PluginContainerException("Could not retrieve resource type for request: " + request);
        }

        String creationType = (request.getResourceConfiguration() != null) ? "configuration" : "package";
        {
            log.debug("Creating " + creationType + "-based resource of type '" + request.getResourceTypeName()
View Full Code Here

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

        DeleteResourceResponse response;

        try {
            response = (DeleteResourceResponse) executor.submit((Callable) runner).get();
        } catch (Exception e) {
            throw new PluginContainerException("Error occurred in delete resource thread", e);
        }

        return response;
    }
View Full Code Here

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

            };
        }
        String className = pluginManager.getMetadataManager().getComponentClass(resourceType);
        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resource);
        if (resourceContainer == null) {
            throw new PluginContainerException("Resource container not found for " + resource + " - cannot create ResourceComponent.");
        }
        ClassLoader resourceClassloader = resourceContainer.getResourceClassLoader();
        if (resourceClassloader == null) {
            throw new PluginContainerException("Resource classLoader not found for " + resource + " - cannot create ResourceComponent.");
        }
        ResourceComponent component = (ResourceComponent) instantiateClass(resourceClassloader, className);

        if (log.isDebugEnabled()) {
            log.debug("Created resource component [" + className + "] of resource type [" + resourceType + ']');
View Full Code Here

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

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

        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

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

        ConfigurationFacet configFacet = loadConfigurationFacet(resourceId, lockType);

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

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

        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

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

    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
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.