01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20: package com.salmonllc.html;
21:
22: import java.io.IOException;
23: import java.io.OutputStream;
24:
25: /**
26: * This interface is implemented by components that dynamically generate gif images that are sent back to the browser.
27: * The implementing class can use the ImageFactory and GifEncoder to generate an image. The generated images will be served up
28: * and cached by the ObjectStore servlet (Any Image with a dgif extension).
29: * @see com com.salmonllc.util.ImageFactory
30: * @see com com.salmonllc.util.GifEncoder
31: */
32: public interface ImageGenerator {
33: /**
34: * This method should be implemented by any class that generates an image. The implementing class is responsible for actually generating
35: * an image based on the name passed
36: * @param imageName Each implementing class can decide for itself what image to generate based on the passed name.
37: * @param out The output stream to write the generated image to
38: */
39: public void generateImage(String imageName, OutputStream out)
40: throws IOException;
41:
42: /**
43: * This method is called by the Objectstore servlet to decide whether or not an image should be regenerated or loaded from cache. It should return the value set in the setCacheKey method.
44: */
45: public long getCacheKey();
46:
47: /**
48: * This method is called by the Objectstore servlet to decide whether or not to cache generated images.
49: */
50:
51: public boolean getUseCache();
52:
53: /**
54: * This method is used by the framework to decide whether or not to generate the image or get it from cache. The implementing class should store the passed value in an instance variable.
55: */
56: public void setCacheKey(long key);
57: }
|