01: /*
02: * $RCSfile: RemoteRenderedRegistryMode.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.util.ImagingListener;
17: import javax.media.jai.remote.RemoteDescriptor;
18:
19: /**
20: * A class which provides information about the "remoteRendered" registry
21: * mode.
22: *
23: * @since JAI 1.1
24: */
25: public class RemoteRenderedRegistryMode extends RegistryMode {
26:
27: public static final String MODE_NAME = "remoteRendered";
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.RemoteRIF.class;
39:
40: try {
41: Class[] paramTypes = new Class[] { java.lang.String.class,
42: java.lang.String.class,
43: java.awt.image.renderable.ParameterBlock.class,
44: java.awt.RenderingHints.class };
45:
46: factoryMethod = factoryClass
47: .getMethod("create", paramTypes);
48: } catch (NoSuchMethodException e) {
49: ImagingListener listener = JAI.getDefaultInstance()
50: .getImagingListener();
51: String message = JaiI18N.getString("RegistryMode0") + " "
52: + factoryClass.getName() + ".";
53: listener.errorOccurred(message, e,
54: RemoteRenderedRegistryMode.class, false);
55: // e.printStackTrace();
56: }
57:
58: return factoryMethod;
59: }
60:
61: /**
62: * Creates a <code>RemoteRenderedRegistryMode</code> for describing
63: * the "remoteRendered" registry mode.
64: */
65: public RemoteRenderedRegistryMode() {
66: super (MODE_NAME, RemoteDescriptor.class, getThisFactoryMethod()
67: .getReturnType(), getThisFactoryMethod(), false, false);
68: }
69: }
|