Package org.rhq.core.pluginapi.content

Examples of org.rhq.core.pluginapi.content.ContentContext


            //The userSpecifiedName is used in case we renamed the file to add version.
            File contentCopy = new File(tempDir, userSpecifedName);

            os = new BufferedOutputStream(new FileOutputStream(contentCopy));
            ContentContext contentContext = resourceContext.getContentContext();
            ContentServices contentServices = contentContext.getContentServices();
            contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);

            return contentCopy;
        } catch (IOException e) {
            throw new IllegalStateException("Failed to copy the deployed archive to destination.", e);
View Full Code Here


    public void run(ExecutionContext executionContext) {
        try {
            PackageDetailsKey key = (PackageDetailsKey) executionContext
                .getVariable(ContextVariables.PACKAGE_DETAILS_KEY);
            ContentContext contentContext = (ContentContext) executionContext
                .getVariable(ContextVariables.CONTENT_CONTEXT);

            downloadBits(key, contentContext);

            complete(executionContext, "Successfully downloaded file to ["
View Full Code Here

        File temporaryDirectory = temp;
        File dataDirectory = temp;
        String pluginContainerName = "rhq";
        EventContext eventContext = new EventContextImpl(resource, eventManager);
        OperationContext operationContext = new OperationContextImpl(0);
        ContentContext contentContext = new ContentContextImpl(0);
        PluginContainerDeployment pluginContainerDeployment = null;
        AvailabilityContext availContext = new AvailabilityContextImpl(resource, pluginContainer.getInventoryManager());
        InventoryContext inventoryContext = new InventoryContextImpl(resource, pluginContainer.getInventoryManager());
        ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext,
            resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
View Full Code Here

        } catch (FileNotFoundException e) {
            report.setErrorMessage("Could not create the job jar file on the agent: " + e.getMessage());
            return report;
        }
       
        ContentContext contentContext = getResourceContext().getContentContext();
        ContentServices contentServices = contentContext.getContentServices();
        contentServices.downloadPackageBitsForChildResource(contentContext, JobJarComponent.RESOURCE_TYPE_NAME, packageDetails.getKey(), jobJarStream);
       
        try {
            jobJarStream.close();
        } catch (IOException e) {
View Full Code Here

     * Deploy content to the remote server - this is one half of #createResource
     * @param report Create resource report that tells us what to do
     * @return report that tells us what has been done.
     */
    protected CreateResourceReport deployContent(CreateResourceReport report) {
        ContentContext cctx = context.getContentContext();
        ResourcePackageDetails details = report.getPackageDetails();

        ContentServices contentServices = cctx.getContentServices();
        String resourceTypeName = report.getResourceType().getName();

        ASUploadConnection uploadConnection = new ASUploadConnection(getServerComponent().getASConnection(), details
            .getKey().getName());

View Full Code Here

            return;
        }

        File tempDir = getResourceContext().getTemporaryDirectory();
        File tempFile = new File(tempDir.getAbsolutePath(), "tomcat-war.bin");
        ContentContext contentContext = getResourceContext().getContentContext();
        ContentServices contentServices = contentContext.getContentServices();
        OutputStream osForTempDir = null;

        try {
            osForTempDir = new BufferedOutputStream(new FileOutputStream(tempFile));
            contentServices.downloadPackageBitsForChildResource(contentContext, TomcatWarComponent.RESOURCE_TYPE_NAME,
View Full Code Here

            //this is to ensure that we only get the filename part no matter whether the key contains
            //full path or not.
            File contentCopy = new File(tempDir, archiveFile.getName());
       
            os = new BufferedOutputStream(new FileOutputStream(contentCopy));
            ContentContext contentContext = resourceContext.getContentContext();
            ContentServices contentServices = contentContext.getContentServices();
           
            if (resourceExists) {
                contentServices.downloadPackageBits(contentContext, key, os, true);
            } else {
                contentServices.downloadPackageBitsForChildResource(contentContext, resourceType.getName(), key, os);
View Full Code Here

        @SuppressWarnings("unchecked")
        ResourceContext<TomcatServerComponent<?>> mockResourceContext = mock(ResourceContext.class);
        when(objectUnderTest.getResourceContext()).thenReturn(mockResourceContext);
        when(mockResourceContext.getTemporaryDirectory()).thenReturn(tempDirectory);

        ContentContext mockContentContext = mock(ContentContext.class);
        when(mockResourceContext.getContentContext()).thenReturn(mockContentContext);
        ContentServices mockContentServices = mock(ContentServices.class);
        when(mockContentContext.getContentServices()).thenReturn(mockContentServices);

        when(objectUnderTest.isWebApplication(any(File.class))).thenReturn(Boolean.TRUE);

        //run code under test
        when(objectUnderTest.createResource(any(CreateResourceReport.class))).thenCallRealMethod();
View Full Code Here

                + jmxConfig.getSimpleValue(JmxConnectionHelper.CONNECTOR_ADDRESS, "-n/a-"));
        }
    }

    private JBPMWorkflowManager createJbpmWorkflowManager(ResourceContext resourceContext) {
        ContentContext contentContext = resourceContext.getContentContext();
        ControlActionFacade controlActionFacade = initControlActionFacade();
        JBPMWorkflowManager workflowManager = new JBPMWorkflowManager(contentContext, controlActionFacade,
            this.getJBossASPaths());
        return workflowManager;
    }
View Full Code Here

    // TODO I think this package code is not used.
    @Override
    public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails> packages, ContentServices contentServices) {

        ContentContext cctx = context.getContentContext();

        DeployPackagesResponse response = new DeployPackagesResponse();

        for (ResourcePackageDetails details : packages) {
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.content.ContentContext

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.