001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 */
015
016package org.nuxeo.ecm.platform.preview.restlet;
017
018import java.util.Calendar;
019
020import org.nuxeo.ecm.platform.preview.api.HtmlPreviewAdapter;
021
022/**
023 * Manage cache entry for computed previews.
024 * <p>
025 * This avoids the needs of rebuilding the preview on each access. This is particularly important when the generated
026 * HTML references images
027 *
028 * @author tiry
029 */
030public class PreviewCacheEntry {
031
032    protected Calendar modified;
033
034    protected HtmlPreviewAdapter adapter;
035
036    protected final long timeStamp;
037
038    protected String xpath;
039
040    public PreviewCacheEntry(Calendar modified, HtmlPreviewAdapter adapter, String xpath) {
041        this.modified = modified;
042        this.adapter = adapter;
043        this.xpath = xpath;
044        timeStamp = System.currentTimeMillis();
045    }
046
047    public long getTimeStamp() {
048        return timeStamp;
049    }
050
051    public Calendar getModified() {
052        return modified;
053    }
054
055    public void setModified(Calendar modified) {
056        this.modified = modified;
057    }
058
059    public HtmlPreviewAdapter getAdapter() {
060        return adapter;
061    }
062
063    public void setAdapter(HtmlPreviewAdapter adapter) {
064        this.adapter = adapter;
065    }
066
067    public String getXpath() {
068        return xpath;
069    }
070
071    public void setXpath(String xpath) {
072        this.xpath = xpath;
073    }
074
075}