Package org.jdesktop.wonderland.common.checksums

Examples of org.jdesktop.wonderland.common.checksums.ChecksumList


        // the module definition is located, the name of the module and the
        // asset path
        ModuleURI assetURI = (ModuleURI)getAssetURI();
        String path = assetURI.getRelativePathInModule();

        ChecksumList moduleChecksums = cachedModule.getModuleChecksums();
        if (moduleChecksums == null) {
            logger.warning("Unable to locate checksum information for " +
                    assetURI.toExternalForm());
            return null;
        }

        Checksum checksum = moduleChecksums.getChecksumMap().get(path);
        if (checksum == null) {
            logger.warning("Unable to locate checksum for path " + path +
                    " for " + assetURI.toExternalForm());
            return null;
        }
View Full Code Here


            return Response.noContent().build();
        }

        // Ask the factory for the asset. If it does not exist, then ask it to
        // create the checksum
        ChecksumList checksumList = checksumFactory.getChecksumList(cad, ChecksumAction.GENERATE);
        if (checksumList == null) {
            logger.warning("Unable to generate checksum for " + contentRoot +
                    " " + assetPath);
            return Response.noContent().build();
        }
View Full Code Here

        logger.warning("Fetching checksums for module " + moduleName + " part " +
                modulePart);

        // Create a checksum list from all of the individual module parts and
        // put them into a single map.
        ChecksumList checksumList = new ChecksumList();
        for (DeployedAsset deployedAsset : partMap.keySet()) {
            // Create an proper AssetDeployer using the module name and module
            // part. Add to the master list.
            ModuleAssetDescriptor mad = new ModuleAssetDescriptor(
                    deployedAsset.moduleName, deployedAsset.assetType, null);
            ChecksumFactory factory = checksumManager.getChecksumFactory(mad);
            ChecksumList partList = factory.getChecksumList(mad, ChecksumAction.DO_NOT_GENERATE);
            if (partList != null) {
                logger.info("Adding found part " + deployedAsset.assetType +
                        " with size " + partList.getChecksumMap().size());
                checksumList.putChecksums(partList.getChecksumMap());
            }
        }

        ResponseBuilder rb = Response.ok(checksumList);
        return rb.build();
View Full Code Here

       
        /* Recursively generate checksums, then convert list to an array */
        HashMap<String, Checksum> list = new HashMap<String, Checksum>();
        list.putAll(ChecksumUtils.generateChecksumForDirectory(root, dir, digest, includes, excludes));

        ChecksumList checksumList = new ChecksumList();
        checksumList.setChecksums(list);
        return checksumList;
    }
View Full Code Here

        // Generate the checksum for the file, but put it in the list and
        // return
        try {
            MessageDigest digest = MessageDigest.getInstance(algorithm);
            Checksum checksum = computeChecksum(root, file, digest);
            ChecksumList checksumList = new ChecksumList();
            checksumList.putChecksum(checksum);
            return checksumList;
        } catch (java.io.IOException excp) {
            logger.log(Level.WARNING, "Unable to generate checksum for " +
                    file.getAbsolutePath());
            return null;
View Full Code Here

        // Read in the checksum list and return it. We do not care if a specific
        // asset is given in the asset descriptor.
        FileReader reader = null;
        try {
            reader = new FileReader(modulesDir);
            ChecksumList checksumList = ChecksumList.decode(reader);
            return checksumList;
        } catch (FileNotFoundException excp) {
            logger.log(Level.WARNING, "Unable to find file " +
                    modulesDir.getAbsolutePath(), excp);
            return null;
View Full Code Here

        File parent = root.getParentFile();
        File checksumFile = getChecksumFile(moduleName, modulePart);

        // Generate a checksum for the module part and write out. Overwrite any
        // existing checksum file it is exists.
        ChecksumList checksums = new ChecksumList();
        try {
            // Generate the checksums based upon the files present
            String sha = ChecksumUtils.SHA1_CHECKSUM_ALGORITHM;
            checksums = ChecksumUtils.generate(parent, root, sha, null, null);
        } catch (NoSuchAlgorithmException excp) {
            // Log an error, although this exception should never happen
            logger.log(Level.WARNING, "Unable to generate checksums for" +
                    " module " + moduleName + " and part " + modulePart, excp);
            return;
        }

        // Generate all of the necessary directories for the checksum file
        File checksumParent = checksumFile.getParentFile();
        checksumParent.mkdirs();
       
        // Write out the newly generated checksums to the file. If we cannot
        // then log an error. Make sure the writer is closed under any event
        // however.
        FileWriter writer = null;
        try {
            // Write the checksums out to a checksums file
            writer = new FileWriter(checksumFile);
            checksums.encode(writer);
        } catch (java.lang.Exception excp) {
            logger.log(Level.WARNING, "Unable to write checksums.xml to " +
                    checksumFile.getAbsolutePath() + " for module name " +
                    moduleName + " and part " + modulePart, excp);
        } finally {
View Full Code Here

        // Read in the checksum file as a list and return
        FileReader reader = null;
        try {
            reader = new FileReader(checksumFile);
            ChecksumList checksumList = ChecksumList.decode(reader);
            return checksumList;
        } catch (FileNotFoundException excp) {
            logger.log(Level.WARNING, "Unable to find file " +
                    checksumFile.getAbsolutePath(), excp);
            return null;
View Full Code Here

        File contentFile = getContentFile(rootName, assetPath);
        File contentRoot = getContentRoot(rootName);

        // Generate a checksum for the content file using its root and file
        // and an SHA1 algorithm
        ChecksumList checksumList = null;
        try {
            // Generate the checksums based upon the files present
            String sha = ChecksumUtils.SHA1_CHECKSUM_ALGORITHM;
            checksumList = ChecksumUtils.generate(contentRoot, contentFile, sha);
        } catch (NoSuchAlgorithmException excp) {
            // Log an error, although this exception should never happen
            logger.log(Level.WARNING, "Unable to generate checksums for " +
                    contentFile.getAbsolutePath());
            return;
        }

        // Generate all of the necessary directories for the checksum file
        File checksumFile = getChecksumFile(rootName, assetPath);
        File checksumParent = checksumFile.getParentFile();
        checksumParent.mkdirs();

        // Write out the newly generated checksums to the file. If we cannot
        // then log an error. Make sure the writer is closed under any event
        // however.
        FileWriter writer = null;
        try {
            // Write the checksums out to a checksums file
            writer = new FileWriter(checksumFile);
            checksumList.encode(writer);
        } catch (java.lang.Exception excp) {
            logger.log(Level.WARNING, "Unable to write checksums.xml to " +
                    checksumFile.getAbsolutePath() + " for content " +
                    contentFile.getAbsolutePath(), excp);
        } finally {
View Full Code Here

                // checksum for the asset, the go onto the next deployed asset
                // part
                ModuleAssetDescriptor mad = new ModuleAssetDescriptor(moduleName, asset.assetType, null);
                ChecksumManager checksumManager = ChecksumManager.getChecksumManager();
                ChecksumFactory factory = checksumManager.getChecksumFactory(mad);
                ChecksumList checksumList = factory.getChecksumList(mad, ChecksumAction.DO_NOT_GENERATE);
                if (checksumList == null) {
                    continue;
                }

                for (Map.Entry<String, Checksum> e : checksumList.getChecksumMap().entrySet()) {
                    String assetName = e.getKey();
                    Checksum assetChecksum = e.getValue();

                    try {
                        URL assetURL = getAssetURL(builder, moduleName, assetName);
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.checksums.ChecksumList

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.