01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.vfny.geoserver.wms.responses.legend.jai;
06:
07: import org.vfny.geoserver.wms.GetLegendGraphicProducer;
08: import org.vfny.geoserver.wms.GetLegendGraphicProducerSpi;
09: import org.vfny.geoserver.wms.responses.helpers.JAISupport;
10: import java.util.Map;
11: import java.util.Set;
12:
13: /**
14: * WMS GetLegendGraphic image producer for the formats supported by the
15: * available JAI library.
16: *
17: * @author Gabriel Roldan, Axios Engineering
18: * @version $Id: JaiLegendGraphicProducerFactory.java 6326 2007-03-15 18:36:40Z jdeolive $
19: */
20: public class JaiLegendGraphicProducerFactory implements
21: GetLegendGraphicProducerSpi {
22: /**
23: *
24: */
25: public JaiLegendGraphicProducerFactory() {
26: super ();
27: }
28:
29: /**
30: * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#getName()
31: */
32: public String getName() {
33: return "Legend graphic producer factory for JAI formats";
34: }
35:
36: /**
37: * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#getSupportedFormats()
38: */
39: public Set getSupportedFormats() {
40: return JAISupport.getSupportedFormats();
41: }
42:
43: /**
44: * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#isAvailable()
45: */
46: public boolean isAvailable() {
47: return JAISupport.isJaiAvailable();
48: }
49:
50: /**
51: * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#canProduce(java.lang.String)
52: */
53: public boolean canProduce(String mimeType) {
54: return JAISupport.getSupportedFormats().contains(mimeType);
55: }
56:
57: /**
58: * @see org.vfny.geoserver.wms.responses.GetLegendGraphicProducerSpi#createLegendProducer(java.lang.String)
59: */
60: public GetLegendGraphicProducer createLegendProducer(String format)
61: throws IllegalArgumentException {
62: if (!canProduce(format)) {
63: throw new IllegalArgumentException(format
64: + " not supported by this legend producer");
65: }
66:
67: return new JaiLegendGraphicProducer(format);
68: }
69:
70: /* (non-Javadoc)
71: * @see org.geotools.factory.Factory#getImplementationHints()
72: * This just returns java.util.Collections.EMPTY_MAP
73: */
74: public Map getImplementationHints() {
75: return java.util.Collections.EMPTY_MAP;
76: }
77: }
|