PDFGGlobalCache.java 1.72 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.pdfg.exception.JobOptionsParseException
 *  com.adobe.pdfg.logging.PDFGLogger
 */
package com.adobe.pdfg.common;

import com.adobe.pdfg.common.FiniteSizedCache;
import com.adobe.pdfg.common.IObjectRetriever;
import com.adobe.pdfg.common.JobConfiguration;
import com.adobe.pdfg.common.JobConfigurationRetriever;
import com.adobe.pdfg.common.JobOptionsRetriever;
import com.adobe.pdfg.exception.JobOptionsParseException;
import com.adobe.pdfg.logging.PDFGLogger;
import java.util.Map;
import javax.xml.bind.JAXBException;

public class PDFGGlobalCache {
    private static final int JOB_OPTIONS_CACHE_SIZE = 20;
    private static final int JOB_CONFIG_CACHE_SIZE = 20;
    private static FiniteSizedCache s_JobOptionsCache = new FiniteSizedCache(20, new JobOptionsRetriever());
    private static FiniteSizedCache s_JobConfigCache = new FiniteSizedCache(20, new JobConfigurationRetriever());
    private static PDFGLogger pdfgLogger = PDFGLogger.getPDFGLogger(PDFGGlobalCache.class);

    private PDFGGlobalCache() {
    }

    public static Map getJobOptionsMap(String jobOptions) throws JobOptionsParseException {
        try {
            return (Map)s_JobOptionsCache.retrieve(jobOptions);
        }
        catch (Exception e) {
            pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
            throw new JobOptionsParseException(e.getMessage());
        }
    }

    public static JobConfiguration getJobConfiguration(String configString) throws JAXBException {
        try {
            return (JobConfiguration)s_JobConfigCache.retrieve(configString);
        }
        catch (Exception e) {
            throw new JAXBException(e);
        }
    }
}