Examples of ResourceContent


Examples of org.jboss.gravia.resource.ResourceContent

                    }
                }
            }
            if (contentStream != null) {
                final InputStream inputStream = contentStream;
                return new ResourceContent() {
                    @Override
                    public InputStream getContent() {
                        return inputStream;
                    }
                };
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

        for (MavenCoordinates artefact : getCreateOptions().getMavenCoordinates()) {
            Resource resource = mavenRepository.findMavenResource(artefact);
            IllegalStateAssertion.assertNotNull(resource, "Cannot find maven resource: " + artefact);

            ResourceContent content = resource.adapt(ResourceContent.class);
            IllegalStateAssertion.assertNotNull(content, "Cannot obtain resource content for: " + artefact);

            try {
                ArchiveInputStream ais;
                if ("tar.gz".equals(artefact.getType())) {
                    InputStream inputStream = content.getContent();
                    ais = new TarArchiveInputStream(new GZIPInputStream(inputStream));
                } else {
                    InputStream inputStream = content.getContent();
                    ais = new ArchiveStreamFactory().createArchiveInputStream(artefact.getType(), inputStream);
                }
                ArchiveEntry entry = null;
                boolean needContainerHome = homeDir == null;
                while ((entry = ais.getNextEntry()) != null) {
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

    private ResourceHandle installBundleResource(Resource resource) throws ProvisionException {

        // Install the Bundle
        ResourceIdentity identity = resource.getIdentity();
        ResourceContent content = getFirstRelevantResourceContent(resource);
        IllegalStateAssertion.assertNotNull(content.getContent(), "Cannot obtain content from: " + resource);

        Bundle bundle;
        try {
            String location = "resource://" + getRuntimeName(resource, false);
            bundle = context.installBundle(location, content.getContent());
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Start the bundle. This relies on provision ordering.
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

                    }
                }
            }
            if (contentStream != null) {
                final InputStream inputStream = contentStream;
                return new ResourceContent() {
                    @Override
                    public InputStream getContent() {
                        return inputStream;
                    }
                };
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

            LOGGER.warn("Module already exists: " + moduleDir);
        } else {
            File targetFile = new File(moduleDir, symbolicName + "-" + version + ".jar");
            moduleDir.mkdirs();

            ResourceContent content = getFirstRelevantResourceContent(resource);
            IllegalStateAssertion.assertNotNull(content, "Cannot obtain content from: " + resource);
            IOUtils.copyStream(content.getContent(), new FileOutputStream(targetFile));

            // generate module.xml
            File xmlFile = new File(moduleDir, "module.xml");
            Map<Requirement, Resource> mapping = context.getResourceMapping();
            String moduleXML = generateModuleXML(targetFile, resource, modid, mapping);
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

        // copy resource content
        final File targetFile = new File(catalinaLib, symbolicName + "-" + version + ".jar");
        if (targetFile.exists()) {
            LOGGER.warn("Module already exists: " + targetFile);
        } else {
            ResourceContent content = getFirstRelevantResourceContent(resource);
            IOUtils.copyStream(content.getContent(), new FileOutputStream(targetFile));
        }

        // Install the shared module
        final Module module = installSharedResource(resource, targetFile);
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

        String runtimeName = getRuntimeName(resource);

        ContentCapability ccap = (ContentCapability) resource.getCapabilities(ContentNamespace.CONTENT_NAMESPACE).get(0);
        URL contentURL = ccap.getContentURL();
        if (contentURL == null || !contentURL.toExternalForm().startsWith("file:")) {
            ResourceContent content = getFirstRelevantResourceContent(resource);
            tempfile = new File(catalinaTemp, runtimeName);
            IOUtils.copyStream(content.getContent(), new FileOutputStream(tempfile));
            contentURL = tempfile.toURI().toURL();
        }

        // Get contextPath, username, password
        final String contextPath = getContextPath(resource);
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

    @Override
    public ResourceHandle installSharedResource(Resource resource, Map<Requirement, Resource> mapping) throws Exception {
        LOGGER.info("Installing shared resource: {}", resource);

        ResourceIdentity resid = resource.getIdentity();
        ResourceContent content = resource.adapt(ResourceContent.class);
        if (content == null)
            throw new IllegalStateException("Cannot obtain content from: " + resource);

        // copy resource content
        File targetFile = new File(catalinaLib, resid.getSymbolicName() + "-" + resid.getVersion() + ".jar");
        if (targetFile.exists())
            throw new IllegalStateException("Module already exists: " + targetFile);

        IOUtils.copyStream(content.getContent(), new FileOutputStream(targetFile));

        Module module = installSharedResource(resource, targetFile);
        Resource modres = module.adapt(Resource.class);

        return new DefaultResourceHandle(modres, module) {
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

                    }
                }
            }
            if (contentStream != null) {
                final InputStream inputStream = contentStream;
                return new ResourceContent() {
                    @Override
                    public InputStream getContent() {
                        return inputStream;
                    }
                };
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

                    throw new IllegalStateException("Cannot access content URL: " + contentURL, ex);
                }
            }
        }

        ResourceContent resourceContent = null;
        if (contentStream != null) {
            final InputStream inputStream = contentStream;
            resourceContent = new ResourceContent() {
                @Override
                public InputStream getContent() {
                    return inputStream;
                }
            };
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.