Package info.freelibrary.util

Examples of info.freelibrary.util.PairtreeRoot


    }

    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


        if (LOGGER.isDebugEnabled()) {
            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();
                image.setIdentifier(aReferentID);
                image.setImageFile(file.getAbsolutePath());

                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("JP2 found in Pairtree cache: {}", file.getAbsolutePath());
                }
            } else if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Failed to find a JP2 in Pairtree cache: {}", pairtree.getAbsolutePath());
            }
        } catch (final IOException details) {
            LOGGER.error("Failed to load file from cache", details);
        }
View Full Code Here

     * actually up and ready to respond before any of our functional tests will work.
     */
    @Before
    public void setUp() {
        try {
            final PairtreeRoot ptRoot = new PairtreeRoot(PAIRTREE_ROOT);

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Checking to see if Jetty is ready for functional tests");
            }

            myHTTPConx = (HttpURLConnection) new URL(LOCALHOST + PORT + "/health").openConnection();

            // Check that the Jetty server is responsive
            if (myHTTPConx.getResponseCode() != 200) {
                fail("Jetty is not accepting requests");
            }

            for (int index = 0; index < SOURCE_FILES.length; index++) {
                final PairtreeObject ptObj = ptRoot.getObject(ID[index]);
                final File jp2 = new File(ptObj, PairtreeUtils.encodeID(ID[index]));

                if (ptObj.exists()) {
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("Removing pre-existing tile cache for test image");
View Full Code Here

TOP

Related Classes of info.freelibrary.util.PairtreeRoot

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.