01: /*
02: * $RCSfile: RemoteRenderableRegistryMode.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:48 $
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.util.ImagingListener;
17: import javax.media.jai.remote.RemoteDescriptor;
18:
19: /**
20: * A class which provides information about the "remoteRenderable" registry
21: * mode.
22: *
23: * @since JAI 1.1
24: */
25: public class RemoteRenderableRegistryMode extends RegistryMode {
26:
27: public static final String MODE_NAME = "remoteRenderable";
28:
29: // The Method used to "create" objects from this factory.
30: private static Method factoryMethod = null;
31:
32: private static Method getThisFactoryMethod() {
33:
34: if (factoryMethod != null)
35: return factoryMethod;
36:
37: // The factory Class that this registry mode represents.
38: Class factoryClass = javax.media.jai.remote.RemoteCRIF.class;
39:
40: try {
41: Class[] paramTypes = new Class[] { java.lang.String.class,
42: java.lang.String.class,
43: java.awt.image.renderable.RenderContext.class,
44: java.awt.image.renderable.ParameterBlock.class };
45:
46: factoryMethod = factoryClass
47: .getMethod("create", paramTypes);
48:
49: } catch (NoSuchMethodException e) {
50: ImagingListener listener = JAI.getDefaultInstance()
51: .getImagingListener();
52: String message = JaiI18N.getString("RegistryMode0") + " "
53: + factoryClass.getName() + ".";
54: listener.errorOccurred(message, e,
55: RemoteRenderableRegistryMode.class, false);
56: // e.printStackTrace();
57: }
58:
59: return factoryMethod;
60: }
61:
62: /**
63: * Creates a <code>RemoteRenderableRegistryMode</code> for describing
64: * the "remoteRenderable" registry mode.
65: */
66: public RemoteRenderableRegistryMode() {
67: super (MODE_NAME, RemoteDescriptor.class, getThisFactoryMethod()
68: .getReturnType(), getThisFactoryMethod(), false, // arePreferencesSupported
69: false); // arePropertiesSupported)
70: }
71: }
|