Package info.freelibrary.util

Examples of info.freelibrary.util.PairtreeObject


        try {
            final PairtreeRoot ptRoot = new PairtreeRoot(new File(jp2s));

            if (aID != null && !aID.equals("all")) {
                final PairtreeObject ptObj = ptRoot.getObject(aID);

                if (ptObj.exists()) {
                    if (!FileUtils.delete(ptObj)) {
                        LOGGER.error(BUNDLE.get("PT_TREE_DELETE", ptObj));
                    }
                }
            } else {
View Full Code Here


        try {
            final PairtreeRoot ptCache = new PairtreeRoot(new File(cache));

            if (aID != null && !aID.equals("all")) {
                final PairtreeObject cacheObj = ptCache.getObject(aID);

                if (cacheObj.exists()) {
                    if (!FileUtils.delete(cacheObj)) {
                        LOGGER.error(BUNDLE.get("PT_CACHE_DELETE", cacheObj));
                    }
                }
            } else {
View Full Code Here

                String destFileName = nextDest.getAbsolutePath();

                // Check to see whether we've already converted this file!
                String path = FileUtils.stripExt(nextDest.getAbsolutePath());
                String id = "--" + path.substring(pathIndex);
                PairtreeObject ptDir = ptRoot.getObject(id);
                String ptFileName = PairtreeUtils.encodeID(id);
                File jp2 = new File(ptDir, ptFileName);

                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("INGEST_EXISTS_CHECK", jp2);
View Full Code Here

            }
        }
    }

    private void store(PairtreeRoot aPairtree, String aID, File aFile) throws IOException {
        PairtreeObject ptDir = aPairtree.getObject(aID);
        String ptFileName = PairtreeUtils.encodeID(aID);
        File jp2PtFile = new File(ptDir, ptFileName);

        // Move the file into the Pairtree structure
        aFile.renameTo(jp2PtFile);
View Full Code Here

        return imageCounter++;
    }

    private void storeJP2(final String aID, final File aJP2File, final PairtreeRoot aPairtree) throws IOException {
        final PairtreeObject dir = aPairtree.getObject(aID);
        final String filename = PairtreeUtils.encodeID(aID);
        final File newJP2File = new File(dir, filename);

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(BUNDLE.get("INGEST_COPY", aJP2File, newJP2File));
View Full Code Here

            // If we know it's JP2 at this point, it's because it's been passed
            // in as one of our parsable URLs.
            if (isJp2 && myPtRootDir != null) {
                final PairtreeRoot pairtree = new PairtreeRoot(myPtRootDir);
                final PairtreeObject dir = pairtree.getObject(aReferent);
                final String filename = PairtreeUtils.encodeID(aReferent);
                FileOutputStream destination;
                boolean result;

                file = new File(dir, filename);
View Full Code Here

        }
    }

    private File getPtObject(final String aID) {
        try {
            final PairtreeObject ptObj = new PairtreeRoot(System.getProperty("pairtree.cache")).getObject(aID);
            return new File(ptObj, aID); // This is the actual image file in the Pairtree object
        } catch (final IOException details) {
            fail(details.getMessage());
            return new File(System.getProperty("java.io.tmpdir"), "ptObj-" + new Date().getTime());
        }
View Full Code Here

            OutputStream outStream = null;
            InputStream inStream = null;

            try {
                final PairtreeRoot cacheDir = new PairtreeRoot(new File(myCache));
                final PairtreeObject cacheObject = cacheDir.getObject(id);
                final ServletContext context = getServletContext();
                final String filename = PairtreeUtils.encodeID(id);
                final File xmlFile = new File(cacheObject, filename + ".xml");

                if (xmlFile.exists() && xmlFile.length() > 0) {
View Full Code Here

    private void checkImageCache(final String aID, final String aLevel, final String aScale, final String aRegion,
            final float aRotation, final HttpServletRequest aRequest, final HttpServletResponse aResponse)
            throws IOException, ServletException {
        final PairtreeRoot cacheDir = new PairtreeRoot(new File(myCache));
        final PairtreeObject cacheObject = cacheDir.getObject(aID);
        final String fileName = CacheUtils.getFileName(aLevel, aScale, aRegion, aRotation);
        final File imageFile = new File(cacheObject, fileName);

        if (imageFile.exists()) {
            final ServletOutputStream outStream = aResponse.getOutputStream();
View Full Code Here

            LOGGER.debug("Checking in Pairtree file system for: {}", aReferentID);
        }

        try {
            final PairtreeRoot pairtree = new PairtreeRoot(myJP2Dir);
            final PairtreeObject dir = pairtree.getObject(aReferentID);
            final String filename = PairtreeUtils.encodeID(aReferentID);
            final File file = new File(dir, filename);

            if (file.exists()) {
                image = new ImageRecord();
View Full Code Here

TOP

Related Classes of info.freelibrary.util.PairtreeObject

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.