Package org.rhq.core.pluginapi.inventory

Examples of org.rhq.core.pluginapi.inventory.ResourceContext


        ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance();

        EventContext eventContext = new EventContextImpl(resource, eventManager);
        AvailabilityContext availContext = new AvailabilityContextImpl(resource, pluginContainer.getInventoryManager());
        InventoryContext inventoryContext = new InventoryContextImpl(resource, pluginContainer.getInventoryManager());
        ResourceContext context = new ResourceContext(cresource, parentComponent, parentContext,
            resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
            eventContext, operationContext, contentContext, availContext, inventoryContext, pluginContainerDeployment);

        component.start(context);
        components.put(component, cresource);
View Full Code Here


        ResourceDiscoveryContext<ApplicationServerComponent<?>> discoveryContext)
        throws InvalidPluginConfigurationException {

        File path = new File(pluginConfig.getSimple(ScriptComponent.PATH_CONFIG_PROP).getStringValue());
        validatePath(path);
        ResourceContext parentResourceContext = discoveryContext.getParentResourceContext();
        File binDir = getServerBinDirectory(parentResourceContext);
        DiscoveredResourceDetails resource = createResourceDetails(discoveryContext, pluginConfig, binDir);
        log.debug("Manually added script service: " + resource);

        return resource;
View Full Code Here

    @Override
    public ResourceUpgradeReport upgrade(ResourceUpgradeContext<JBossASServerComponent<?>> upgradeContext) {
        String inventoriedResourceKey = upgradeContext.getResourceKey();

        ResourceContext parentResourceContext = upgradeContext.getParentResourceContext();
        File binDir = getServerBinDirectory(parentResourceContext);

        // The new format is to use paths relative to the server bin dir for scripts in that dir and to otherwise
        // use absolute paths, so we only need to upgrade existing keys that start with the bin dir path.
        if (!inventoriedResourceKey.startsWith(binDir.getPath())) {
View Full Code Here

            : scriptPath;
    }

    private void processAutoDiscoveredResources(ResourceDiscoveryContext<JBossASServerComponent<?>> discoveryContext,
        Set<DiscoveredResourceDetails> resources) {
        ResourceContext parentResourceContext = discoveryContext.getParentResourceContext();
        File binDir = getServerBinDirectory(parentResourceContext);
        log.debug("Searching for scripts beneath JBossAS server bin directory (" + binDir + ")...");
        ScriptFileFinder scriptFileFinder = new ScriptFileFinder(discoveryContext.getSystemInformation(), binDir);
        List<File> scriptFiles = scriptFileFinder.findScriptFiles();
        for (File scriptFile : scriptFiles) {
View Full Code Here

        }
    }

    private void processManuallyAddedResources(ResourceDiscoveryContext<JBossASServerComponent<?>> discoveryContext,
        Set<DiscoveredResourceDetails> resources, List<Configuration> pluginConfigs) {
        ResourceContext parentResourceContext = discoveryContext.getParentResourceContext();
        File binDir = getServerBinDirectory(parentResourceContext);
        for (Configuration pluginConfig : pluginConfigs) {
            File path = new File(pluginConfig.getSimple(ScriptComponent.PATH_CONFIG_PROP).getStringValue());
            validatePath(path);
            DiscoveredResourceDetails resource = createResourceDetails(discoveryContext, pluginConfig, binDir);
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public List<URL> getAdditionalClasspathUrls(ResourceDiscoveryContext context, DiscoveredResourceDetails details) {
        ResourceComponent parentComponent = context.getParentResourceComponent();
        ResourceContext parentContext = context.getParentResourceContext();

        System.out.println("+ plugin1-1B cl-facet parent context resource key=" + parentContext.getResourceKey());
        System.out.println("+ plugin1-1B cl-facet parent context resource type=" + parentContext.getResourceType());
        System.out.println("+ plugin1-1B cl-facet parent component=" + parentComponent);
        System.out.println("+ plugin1-1B cl-facet parent component CL=" + parentComponent.getClass().getClassLoader());
        System.out.println("+ plugin1-1B cl-facet ctx CL=" + Thread.currentThread().getContextClassLoader());
        System.out.println("~~~~~~~~~~");
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public List<URL> getAdditionalClasspathUrls(ResourceDiscoveryContext context, DiscoveredResourceDetails details) {
        ResourceComponent parentComponent = context.getParentResourceComponent();
        ResourceContext parentContext = context.getParentResourceContext();

        System.out.println("* plugin2-2B cl-facet parent context resource key=" + parentContext.getResourceKey());
        System.out.println("* plugin2-2B cl-facet parent context resource type=" + parentContext.getResourceType());
        System.out.println("* plugin2-2B cl-facet parent component=" + parentComponent);
        System.out.println("* plugin2-2B cl-facet parent component CL=" + parentComponent.getClass().getClassLoader());
        System.out.println("* plugin2-2B cl-facet ctx CL=" + Thread.currentThread().getContextClassLoader());
        System.out.println("~~~~~~~~~~");

View Full Code Here

    public void testWriteNewAppBitsToTimpFile() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        File mockResourceTemporaryDir = mock(File.class);

        ResourceContext mockResourceContext = mock(ResourceContext.class);
        when(mockResourceContext.getTemporaryDirectory()).thenReturn(mockResourceTemporaryDir);

        ContentServices mockContentServices = mock(ContentServices.class);
        ResourcePackageDetails mockResourcePackageDetails = mock(ResourcePackageDetails.class);

        File mockTempDir = mock(File.class);
View Full Code Here

    @SuppressWarnings("rawtypes")
    private OperationResult prepareForBootstrap(Configuration params) {
        log.info("Preparing " + this + " for bootstrap...");

        ResourceContext context = getResourceContext();
        OperationResult result = new OperationResult();

        log.info("Stopping storage node");
        OperationResult shutdownResult = shutdownIfNecessary();
        if (shutdownResult.getErrorMessage() != null) {
            log.error("Failed to stop storage node " + getResourceContext().getResourceKey() + ". The storage node " +
                "must be shut down in order for the changes made by this operation to take effect.");
            result.setErrorMessage("Failed to stop the storage node. The storage node must be shut down in order " +
                "for the changes made by this operation to take effect. The attempt to stop shut down the storage " +
                "node failed with this error: " + shutdownResult.getErrorMessage());
            return result;
        }

        Configuration pluginConfig = context.getPluginConfiguration();
        ConfigEditor configEditor = getYamlConfigEditor();

        try {
            configEditor.load();
View Full Code Here

        }
        return false;
    }

    private OperationResult moveDataFiles(Configuration params) {
        ResourceContext context = getResourceContext();
        OperationResult result = new OperationResult();

        log.info("Preparing to move " + this + "'s datafiles to new locations");

        String newCommitLogDirectory = params.getSimpleValue("CommitLogLocation");
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.inventory.ResourceContext

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.