Package org.jboss.gravia.resource

Examples of org.jboss.gravia.resource.ResourceContent


        File modulesDir = injectedServerEnvironment.getValue().getModulesDir();
        File moduleDir = new File(modulesDir, symbolicName.replace(".", File.separator) + File.separator + version);
        if (moduleDir.exists())
            throw new IllegalStateException("Module dir already exists: " + moduleDir);

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

        // copy resource content
        moduleDir.mkdirs();
        File resFile = new File(moduleDir, symbolicName + "-" + version + ".jar");
        IOUtils.copyStream(content.getContent(), new FileOutputStream(resFile));

        ModuleIdentifier modid = ModuleIdentifier.create(symbolicName, version.toString());

        // generate module.xml
        File xmlFile = new File(moduleDir, "module.xml");
View Full Code Here


    private ResourceHandle installBundleResource(Resource resource) throws ProvisionException {

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

        Bundle bundle;
        try {
            String location = "resource#" + resid;
            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

    private ResourceHandle installBundleResource(Resource resource) throws ProvisionException {

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

        Bundle bundle;
        try {
            String location = "resource#" + resid;
            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

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

        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

    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

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

            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

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

        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

TOP

Related Classes of org.jboss.gravia.resource.ResourceContent

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.