01: /*
02: * $RCSfile: TileDecoderRegistryMode.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:57:49 $
10: * $State: Exp $
11: */package javax.media.jai.registry;
12:
13: import java.lang.reflect.Method;
14: import javax.media.jai.JAI;
15: import javax.media.jai.RegistryMode;
16: import javax.media.jai.tilecodec.TileCodecDescriptor;
17: import javax.media.jai.tilecodec.TileCodecParameterList;
18: import javax.media.jai.tilecodec.TileDecoderFactory;
19: import javax.media.jai.util.ImagingListener;
20:
21: /**
22: * A class which provides information about the "tileDecoder" registry
23: * mode.
24: *
25: * @since JAI 1.1
26: */
27: public class TileDecoderRegistryMode extends RegistryMode {
28:
29: public static final String MODE_NAME = "tileDecoder";
30:
31: // Method to return the factory method for the "tileDecoder" mode.
32: // The Method used to "create" objects from this factory.
33: private static Method factoryMethod = null;
34:
35: private static Method getThisFactoryMethod() {
36:
37: if (factoryMethod != null)
38: return factoryMethod;
39:
40: // The factory Class that this registry mode represents.
41: Class factoryClass = TileDecoderFactory.class;
42:
43: try {
44: Class[] paramTypes = new Class[] {
45: java.io.InputStream.class,
46: TileCodecParameterList.class };
47:
48: factoryMethod = factoryClass.getMethod("createDecoder",
49: paramTypes);
50:
51: } catch (NoSuchMethodException e) {
52: ImagingListener listener = JAI.getDefaultInstance()
53: .getImagingListener();
54: String message = JaiI18N.getString("RegistryMode0") + " "
55: + factoryClass.getName() + ".";
56: listener.errorOccurred(message, e,
57: TileDecoderRegistryMode.class, false);
58: // e.printStackTrace();
59: }
60:
61: return factoryMethod;
62: }
63:
64: /**
65: * Creates a <code>TileDecoderRegistryMode</code> for describing
66: * the "tileDecoder" registry mode.
67: */
68: public TileDecoderRegistryMode() {
69: super (MODE_NAME, TileCodecDescriptor.class,
70: getThisFactoryMethod().getReturnType(),
71: getThisFactoryMethod(), // factoryMethod
72: true, // arePreferencesSupported
73: false); // arePropertiesSupported,
74: }
75: }
|