Examples of FileCache


Examples of com.lightcrafts.utils.filecache.FileCache

        final int imageWidth = metadata.getImageWidth();
        final int imageHeight = metadata.getImageHeight();

        String cacheKey = null;
        File imageFile = null;
        final FileCache fileCache = RawImageCache.getCacheFor( imageInfo );

        if ( CACHE_CONVERSION && fileCache != null ) {
            System.out.println("Checking cache for: " + imageInfo);
            final long t1 = System.currentTimeMillis();
            cacheKey = RawImageCache.getCacheKeyFor( imageInfo );
View Full Code Here

Examples of com.lightcrafts.utils.filecache.FileCache

        final String cacheKey = getCacheKeyFor( imageInfo );
        return cacheKey != null ? getCachedImageFileFor( cacheKey ) : null;
    }

    static File getCachedImageFileFor( String cacheKey ) {
        final FileCache fileCache = FileCacheFactory.getGlobalCache();
        return fileCache != null ? fileCache.getFileFor( cacheKey ) : null;
    }
View Full Code Here

Examples of com.lightcrafts.utils.filecache.FileCache

            System.out.println("Caching image: " + currentJob.cacheKey);

            long t1 = System.currentTimeMillis();

            final FileCache fileCache = FileCacheFactory.getGlobalCache();
            if (fileCache != null) {
                try {
                    final File cacheFile = fileCache.putToFile(currentJob.cacheKey);

                    try {
                        LCTIFFWriter writer = new LCTIFFWriter(cacheFile.getAbsolutePath(),
                                                               currentJob.image.getWidth(),
                                                               currentJob.image.getHeight());
                        writer.setByteField( TIFFTags.TIFF_ICC_PROFILE, JAIContext.linearProfile.getData());
                        writer.putImageTiled(currentJob.image, null);
                    } catch ( LCImageLibException e) {
                        e.printStackTrace();
                    } finally {
                        fileCache.notifyAboutCloseOf(cacheFile);
                    }
                } catch ( IOException e ) {
                    // nevermind, do without cache...
                    e.printStackTrace();
                }
View Full Code Here

Examples of com.lightcrafts.utils.filecache.FileCache

     */
    void setCachedFile(File file) {
        if (file != null) {
            try {
                String key = ImageTask.getImageKey(file);
                FileCache cache = FileCacheFactory.get(file.getParentFile());
                File cachedFile = cache.getFileFor(key);

                if (cachedFile != null)
                    image = JPEGImageType.getImageFromInputStream(new FileInputStream(cachedFile), null,
                                                                  ImageTask.CacheImageSize, ImageTask.CacheImageSize);
            }
View Full Code Here

Examples of com.lightcrafts.utils.filecache.FileCache

                        );
                        showErrorDialog(e);
                        success = false;
                    }
                    try {
                        FileCache cache = FileCacheFactory.getGlobalCache();
                        if (cache != null) {
                            cache.clear();
                        }
                    }
                    catch (IOException e) {
                        System.err.println(
                            "StartupCrach failed to clear FileCache"
View Full Code Here

Examples of com.lightcrafts.utils.filecache.FileCache

            );
            if (option != 0) {
                return;
            }
            try {
                FileCache cache = FileCacheFactory.getGlobalCache();
                if (cache != null) {
                    cache.clear();
                }
                else {
                    throw new IOException("Global cache does not exist");
                }
            }
View Full Code Here

Examples of com.lightcrafts.utils.filecache.FileCache

    /**
     * Accept a precomputed in-memory image to cache as the preview for
     * an image file.
     */
    public static void cachePreviewForImage(File file, RenderedImage image) {
        final FileCache cache = FileCacheFactory.get(file);
        if (cache == null) {
            return;
        }
        // Write the given preview to the cache
        final String key = getImageKey(file);
        try {
            final OutputStream out = cache.putToStream(key);
            final OutputStreamImageDataReceiver receiver =
                new OutputStreamImageDataReceiver(out);
            try {
                final LCJPEGWriter writer = new LCJPEGWriter(
                    receiver, 32 * 1024,
                    image.getWidth(), image.getHeight(),
                    image.getColorModel().getNumComponents(),
                    CS_RGB, 90
                );
                writer.putImage(image);
                writer.dispose();
            }
            catch (LCImageLibException e) {
                logNonFatalStatic(file, e, "caching preview");
                cache.remove(key);
            }
            out.close();
            receiver.dispose();
        }
        catch (IOException e) {
View Full Code Here

Examples of com.planet_ink.coffee_web.http.FileCache

   
    config.load(props);
   
    final ServletManager servletsManager = new ServletManager(config);
    final SessionManager sessionsManager = new SessionManager(config);
    final FileCache fileCacheManager = new FileCache(config,config.getFileManager());
    final MimeConverterManager mimeConverterManager = new MimeConverter(config);
    final HTTPReqProcessor fileGetter = new HTTPReqProcessor(config);
    config.setSessions(sessionsManager);
    config.setServletMan(servletsManager);
    config.setFileCache(fileCacheManager);
View Full Code Here

Examples of com.sun.enterprise.web.connector.grizzly.FileCache

     * Return an instance of a <code>FileCache</code>
     */
    @Override
    public FileCache getFileCache(){
        if (fileCache == null){
            fileCache = new FileCache(){
               
                @Override
                protected void sendCache(SocketChannel socketChannel, 
                        FileCacheEntry entry,
                    boolean keepAlive) throws IOException{
View Full Code Here

Examples of com.sun.grizzly.config.dom.FileCache

        // Add to the <network-config>
        try {
            ConfigSupport.apply(new SingleConfigCode<Protocol>() {
                public Object run(Protocol param) throws TransactionFailure {
                    Http http = param.createChild(Http.class);
                    final FileCache cache = http.createChild(FileCache.class);
                    cache.setEnabled("false");
                    http.setFileCache(cache);
                    http.setDefaultVirtualServer(defaultVirtualServer);
                    http.setDnsLookupEnabled(dnsLookupEnabled == null ? null : dnsLookupEnabled.toString());
                    http.setMaxConnections(maxConnections);
                    http.setRequestTimeoutSeconds(requestTimeoutSeconds);
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.