Examples of Distribution


Examples of org.rhq.core.domain.content.Distribution

            log.info("TODO: create index.html listing all the distribution labels for this repo: " + repo.getName());
            renderDistributionLabels(request, response, repo);
            return;
        }
        // Get Distribution
        Distribution dist = distroMgr.getDistributionByLabel(distLabel);
        if (dist == null) {
            log.info("Unable to find Distribution by label '" + distLabel + "'");
            renderErrorPage(request, response);
            return;
        }
        String fileRequest = getDistFilePath(request.getRequestURI());
        if (StringUtils.isEmpty(fileRequest)) {
            log.info("no distribution file was found in request, so render list of all distribution files");
            renderDistributionFileList(request, response, dist);
            return;
        }
        log.debug("Parsed DistributionFile request is for: " + fileRequest);
        // Looks like a request for a distribution file
        List<DistributionFile> distFiles = distroMgr.getDistributionFilesByDistId(dist.getId());
        if (distFiles.isEmpty()) {
            log.info("Unable to find any distribution files for dist: " + dist.getLabel());
            renderErrorPage(request, response);
            return;
        }
        for (DistributionFile dFile : distFiles) {
            //log.info("Compare: " + dFile.getRelativeFilename() + " to " + fileRequest);
            if (StringUtils.equalsIgnoreCase(dFile.getRelativeFilename(), fileRequest)) {
                log.info("Sending back package bytes for: " + dFile.getRelativeFilename());

                writeDistributionFileBits(request, response, dFile);
                return;
            }
        }
        // This isn't a DistributionFile
        // This could be a request for a package.  Package requests will come in as:
        // ..../distributions/{Server,Cluster,Packages,etc}/a2ps-XXXXX.rpm 

        String possiblePkgName = getLastPiece(request.getRequestURI());
        log.debug("Looking up : " + possiblePkgName + ", it might be a package request");
        PackageVersion pv = getPackageVersionFromFileName(repo, possiblePkgName);
        if (pv != null) {
            log.info(possiblePkgName + " resolved to a package, will send package bytes back as response");
            //response.setContentType("application/octet-stream");
            writePackageVersionBits(request, response, pv);
            return;
        }
        log.info("Searched through DistributionFiles and Packages, unable to find: " + fileRequest
            + ", in Distribution: " + dist.getLabel());

        renderErrorPage(request, response);

    }
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

        DistributionManagerLocal distManager = LookupUtil.getDistributionManagerLocal();
        Subject overlord = LookupUtil.getSubjectManager().getOverlord();

        // remove all distributions that are no longer available on the remote repository
        for (DistributionDetails doomedDetails : report.getDeletedDistributions()) {
            Distribution doomedDist = distManager.getDistributionByLabel(doomedDetails.getLabel());
            distManager.deleteDistributionByDistId(overlord, doomedDist.getId());
            distManager.deleteDistributionFilesByDistId(overlord, doomedDist.getId());
            progress.append("Removed distribution & distribution files for: " + doomedDetails.getLabel());
            syncResults.setResults(progress.toString());
            syncResults = repoManager.mergeRepoSyncResults(syncResults);
        }
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

        for (DistributionDetails detail : newDetails) {
            try {

                log.debug("Attempting to create new distribution based off of: " + detail);
                DistributionType distType = distManager.getDistributionTypeByName(detail.getDistributionType());
                Distribution newDist = distManager.createDistribution(overlord, detail.getLabel(), detail
                    .getDistributionPath(), distType);
                log.debug("Created new distribution: " + newDist);
                Repo repo = repoManager.getRepo(overlord, report.getRepoId());
                RepoDistribution repoDist = new RepoDistribution(repo, newDist);
                log.debug("Created new mapping of RepoDistribution repoId = " + repo.getId() + ", distId = "
                    + newDist.getId());
                entityManager.persist(repoDist);
                List<DistributionFileDetails> files = detail.getFiles();
                for (DistributionFileDetails f : files) {
                    log.debug("Creating DistributionFile for: " + f);
                    DistributionFile df = new DistributionFile(newDist, f.getRelativeFilename(), f.getMd5sum());
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

    public long outputDistributionFileBits(DistributionFile distFile, OutputStream outputStream) {

        long numBytes = 0L;
        InputStream bitStream = null;
        try {
            Distribution dist = distFile.getDistribution();
            log.info("Distribution has a basePath of " + dist.getBasePath());
            String distFilePath = dist.getBasePath() + "/" + distFile.getRelativeFilename();
            File f = getDistributionFileBitsLocalFilesystemFile(dist.getLabel(), distFilePath);
            log.info("Fetching: " + distFilePath + " on local file store from: " + f.getAbsolutePath());
            bitStream = new FileInputStream(f);
            numBytes = StreamUtil.copy(bitStream, outputStream);

        } catch (Exception e) {
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

        DistributionType loaded = distributionManager.getDistributionTypeByName(disttype.getName());
        if (loaded != null) {
            disttype = loaded;
        }

        Distribution kstree = new Distribution(kslabel, basepath, disttype);

        validateDistTree(kstree);
        entityManager.persist(kstree);

        return kstree;
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

        entityManager.clear();

        entityManager.createNamedQuery(Distribution.QUERY_DELETE_BY_DIST_ID).setParameter("distid", distId)
            .executeUpdate();

        Distribution kstree = entityManager.find(Distribution.class, distId);
        if (kstree != null) {
            entityManager.remove(kstree);
            log.debug("User [" + user + "] deleted kstree [" + kstree + "]");
        } else {
            log.debug("Distribution tree ID [" + distId + "] doesn't exist - nothing to delete");
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

        if (kstree.getLabel() == null || kstree.getLabel().trim().equals("")) {
            throw new DistributionException("A valid Distribution tree is required");
        }

        Distribution kstreeobj = getDistributionByLabel(kstree.getLabel());
        if (kstreeobj != null) {
            throw new DistributionException("There is already a kstree with the name of [" + kstree.getLabel() + "]");
        }

    }
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

            // Delete all distributions
            distroManager.deleteDistributionMappingsForRepo(overlord, repoToSync.getId());

            for (String distroLabel : TestContentProvider.DISTRIBUTIONS.keySet()) {
                Distribution distro = distroManager.getDistributionByLabel(distroLabel);
                if (distro != null) {
                    // Delete the files
                    query = entityManager.createNamedQuery(DistributionFile.DELETE_BY_DIST_ID);
                    query.setParameter("distId", distro.getId());
                    query.executeUpdate();

                    // Delete the actual distro
                    distroManager.deleteDistributionByDistId(overlord, distro.getId());
                }
            }

            // Delete all package version <-> content source mappings
            for (ContentSource source : repoContentSources) {
View Full Code Here

Examples of org.rhq.core.domain.content.Distribution

    }

    private int countDistroFiles(EntityManager entityManager, String label) {
        Query query = entityManager.createNamedQuery(Distribution.QUERY_FIND_BY_DIST_LABEL);
        query.setParameter("label", label);
        Distribution distro = (Distribution) query.getSingleResult();

        query = entityManager.createNamedQuery(DistributionFile.SELECT_BY_DIST_ID);
        query.setParameter("distId", distro.getId());
        List distroFiles = query.getResultList();

        if (distroFiles == null) {
            return 0;
        } else {
View Full Code Here

Examples of redis.clients.johm.models.Distribution

import redis.clients.johm.models.User;

public class CollectionsDataTypeTest extends JOhmTestBase {
    @Test
    public void testMapDataTypeCombinations() {
        Distribution distro = new Distribution();
        distro.setDistroScope("World");
        JOhm.save(distro);

        // K = Primitive, V = Primitive
        distro.getAgeNameDistribution().put(10, "John");
        distro.getAgeNameDistribution().put(35, "Doe");

        Distribution savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(2, savedDistro.getAgeNameDistribution().size());

        assertEquals("John", savedDistro.getAgeNameDistribution().get(10));
        assertEquals("Doe", savedDistro.getAgeNameDistribution().get(35));

        distro.getAgeNameDistribution().remove(10);
        distro.getAgeNameDistribution().remove(35);
        savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(0, savedDistro.getAgeNameDistribution().size());

        // K = Model, V = Primitive
        Country country1 = new Country();
        country1.setName("FriendlyCountry");
        JOhm.save(country1);
        Country country2 = new Country();
        country2.setName("AngryCountry");
        JOhm.save(country2);

        distro.getCountryAverageAgeDistribution().put(country1, 30);
        distro.getCountryAverageAgeDistribution().put(country2, 90);
        savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(2, savedDistro.getCountryAverageAgeDistribution().size());

        assertTrue(30 == savedDistro.getCountryAverageAgeDistribution().get(
                country1));
        assertTrue(90 == savedDistro.getCountryAverageAgeDistribution().get(
                country2));

        distro.getCountryAverageAgeDistribution().remove(country1);
        distro.getCountryAverageAgeDistribution().remove(country2);
        savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(0, savedDistro.getCountryAverageAgeDistribution().size());

        // K = Primitive, V = Model
        distro.getNameCountryDistribution().put("John", country1);
        distro.getNameCountryDistribution().put("Doe", country2);

        savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(2, savedDistro.getNameCountryDistribution().size());

        assertEquals(country1, savedDistro.getNameCountryDistribution().get(
                "John"));
        assertEquals(country2, savedDistro.getNameCountryDistribution().get(
                "Doe"));

        distro.getNameCountryDistribution().remove("John");
        distro.getNameCountryDistribution().remove("Doe");
        savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(0, savedDistro.getNameCountryDistribution().size());

        // K = Model, V = Model
        User user1 = new User();
        user1.setName("Happy");
        JOhm.save(user1);
        User user2 = new User();
        user2.setName("Frightened");
        JOhm.save(user2);

        distro.getUserCitizenshipDistribution().put(user1, country1);
        distro.getUserCitizenshipDistribution().put(user2, country2);

        savedDistro = JOhm.get(Distribution.class, distro.getId());
        assertEquals(2, savedDistro.getUserCitizenshipDistribution().size());

        assertEquals(country1, savedDistro.getUserCitizenshipDistribution()
                .get(user1));
        assertEquals(country2, savedDistro.getUserCitizenshipDistribution()
                .get(user2));

        savedDistro.getUserCitizenshipDistribution().remove(user1);
        savedDistro.getUserCitizenshipDistribution().remove(user2);
        assertEquals(0, savedDistro.getUserCitizenshipDistribution().size());
    }
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.