Package org.apache.geronimo.obr.model

Examples of org.apache.geronimo.obr.model.Repository


        generateOBR(obrName, artifacts, geronimoRepository, obrFile);
    }

    public static void generateOBR(String obrName, Set<Artifact> artifacts, org.apache.geronimo.kernel.repository.Repository geronimoRepository, File obrFile) throws IOException, JAXBException {
        Repository repo = generateOBRModel(obrName, geronimoRepository, artifacts);
        marshallOBRModel(repo, obrFile);
    }
View Full Code Here


        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        marshaller.marshal(repo, obrFile);
    }

    public static Repository generateOBRModel(String obrName, org.apache.geronimo.kernel.repository.Repository geronimoRepository, Set<Artifact> artifacts) throws IOException {
        Repository repo = new Repository();
        repo.setName(obrName);
        for (Artifact artifact : artifacts) {
            File location = geronimoRepository.getLocation(artifact);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Generating OBR Metadata for " + location.getAbsolutePath());
            }
            Manifest mf = null;
            if (location.isFile()) {
                JarFile file = new JarFile(location);
                try {
                    mf = file.getManifest();
                } finally {
                    try { file.close(); } catch (IOException ignore) {}
                }

            } else if (location.isDirectory()) {
                File mfFile = new File(location, JarFile.MANIFEST_NAME);
                FileInputStream in = new FileInputStream(mfFile);
                try {
                    mf = new Manifest(in);
                } finally {
                    try { in.close(); } catch (IOException ignore) {}
                }
            } else {
                continue;
            }

            if (mf == null) {
                continue;
            }

            BundleDescription desc = new BundleDescription(mf);
            ResourceBuilder builder = new ResourceBuilder(desc);

            Resource resource = null;
            try {
                resource = builder.createResource();
            } catch (RuntimeException e) {
                LOG.debug("Failed to generate OBR information for " + artifact + " artifact", e);
                continue;
            }

            if (resource != null) {
                resource.setUri(getURL(artifact));
                if (location.isFile()) {
                    resource.setSize(location.length());
                }
                repo.getResource().add(resource);
            } else {
                LOG.debug("Did not generate OBR information for {} artifact. It is not a bundle.", artifact);
            }
        }
        return repo;
View Full Code Here

        generateOBR(REPOSITORY_NAME, artifacts, geronimoRepository, obrFile);
    }

    public static void generateOBR(String obrName, Set<Artifact> artifacts, org.apache.geronimo.kernel.repository.Repository geronimoRepository, File obrFile) throws IOException, JAXBException {
        Repository repo = generateOBRModel(obrName, geronimoRepository, artifacts);
        marshallOBRModel(repo, obrFile);
    }
View Full Code Here

        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        marshaller.marshal(repo, obrFile);
    }

    public static Repository generateOBRModel(String obrName, org.apache.geronimo.kernel.repository.Repository geronimoRepository, Set<Artifact> artifacts) throws IOException {
        Repository repo = new Repository();
        repo.setName(obrName);
        for (Artifact artifact : artifacts) {
            File location = geronimoRepository.getLocation(artifact);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Generating OBR Metadata for " + location.getAbsolutePath());
            }
            Manifest mf = null;
            if (location.isFile()) {
                JarFile file = new JarFile(location);
                try {
                    mf = file.getManifest();
                } finally {
                    try { file.close(); } catch (IOException ignore) {}
                }

            } else if (location.isDirectory()) {
                File mfFile = new File(location, JarFile.MANIFEST_NAME);
                FileInputStream in = new FileInputStream(mfFile);
                try {
                    mf = new Manifest(in);
                } finally {
                    try { in.close(); } catch (IOException ignore) {}
                }
            } else {
                continue;
            }

            if (mf == null) {
                continue;
            }

            BundleDescription desc = new BundleDescription(mf);
            ResourceBuilder builder = new ResourceBuilder(desc);

            Resource resource = null;
            try {
                resource = builder.createResource();
            } catch (RuntimeException e) {
                LOG.debug("Failed to generate OBR information for " + artifact + " artifact", e);
                continue;
            }

            if (resource != null) {
                resource.setUri(getURL(artifact));
                if (location.isFile()) {
                    resource.setSize(location.length());
                }
                repo.getResource().add(resource);
            } else {
                LOG.debug("Did not generate OBR information for {} artifact. It is not a bundle.", artifact);
            }
        }
        return repo;
View Full Code Here

        Set<Artifact> artifacts = repository.list();
        generateOBR(obrName, artifacts, geronimoRepository, obrFile);
    }

    public static void generateOBR(String obrName, Set<Artifact> artifacts, org.apache.geronimo.kernel.repository.Repository geronimoRepository, File obrFile) throws IOException, JAXBException {
        Repository repo = generateOBRModel(obrName, geronimoRepository, artifacts);
        marshallOBRModel(repo, obrFile);
    }
View Full Code Here

        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        marshaller.marshal(repo, obrFile);
    }

    public static Repository generateOBRModel(String obrName, org.apache.geronimo.kernel.repository.Repository geronimoRepository, Set<Artifact> artifacts) throws IOException {
        Repository repo = new Repository();
        repo.setName(obrName);
        for (Artifact artifact : artifacts) {
            File location = geronimoRepository.getLocation(artifact);
            Manifest mf = null;
            if (location.isFile()) {
                JarFile file = new JarFile(location);
                try {
                    mf = file.getManifest();
                } finally {
                    try { file.close(); } catch (IOException ignore) {}
                }

            } else if (location.isDirectory()) {
                File mfFile = new File(location, JarFile.MANIFEST_NAME);
                FileInputStream in = new FileInputStream(mfFile);
                try {
                    mf = new Manifest(in);
                } finally {
                    try { in.close(); } catch (IOException ignore) {}
                }
            } else {
                continue;
            }

            if (mf == null) {
                continue;
            }

            BundleDescription desc = new BundleDescription(mf);
            ResourceBuilder builder = new ResourceBuilder(desc);

            Resource resource = builder.createResource();
            if (resource != null) {
                resource.setUri(getURL(artifact));
                if (location.isFile()) {
                    resource.setSize(location.length());
                }
                repo.getResource().add(resource);
            } else {
                LOG.debug("Artifact {} is not a bundle.", artifact);
            }
        }
        return repo;
View Full Code Here

TOP

Related Classes of org.apache.geronimo.obr.model.Repository

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.