001: /*
002: * @(#)Beans.java 1.67 06/10/10
003: *
004: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: *
026: */
027:
028: /*
029: * Warning :
030: * Two versions of this file exist in this workspace.
031: * One for Personal Basis, and one for Personal Profile.
032: * Don't edit the wrong one !!!
033: */
034:
035: package java.beans;
036:
037: import java.applet.*;
038: import java.awt.*; //import java.beans.AppletInitializer;
039:
040: //import java.beans.beancontext.BeanContext;
041:
042: import java.io.*;
043: import java.lang.reflect.Constructor;
044: import java.net.URL;
045: import java.lang.reflect.Array;
046:
047: /**
048: * This class provides some general purpose beans control methods.
049: */
050:
051: public class Beans {
052: /**
053: * <p>
054: * Instantiate a JavaBean.
055: * </p>
056: *
057: * @param classLoader the class-loader from which we should create
058: * the bean. If this is null, then the system
059: * class-loader is used.
060: * @param beanName the name of the bean within the class-loader.
061: * For example "sun.beanbox.foobah"
062: *
063: * @exception java.lang.ClassNotFoundException if the class of a serialized
064: * object could not be found.
065: * @exception java.io.IOException if an I/O error occurs.
066: */
067:
068: public static Object instantiate(ClassLoader cls, String beanName)
069: throws java.io.IOException, ClassNotFoundException {
070: java.io.InputStream ins;
071: java.io.ObjectInputStream oins = null;
072: Object result = null;
073: boolean serialized = false;
074: java.io.IOException serex = null;
075: // If the given classloader is null, we check if an
076: // system classloader is available and (if so)
077: // use that instead.
078: // Note that calls on the system class loader will
079: // look in the bootstrap class loader first.
080: if (cls == null) {
081: try {
082: cls = ClassLoader.getSystemClassLoader();
083: } catch (SecurityException ex) {// We're not allowed to access the system class loader.
084: // Drop through.
085: }
086: }
087: // Try to find a serialized object with this name
088: final String serName = beanName.replace('.', '/')
089: .concat(".ser");
090: final ClassLoader loader = cls;
091: ins = (InputStream) java.security.AccessController
092: .doPrivileged(new java.security.PrivilegedAction() {
093: public Object run() {
094: if (loader == null)
095: return ClassLoader
096: .getSystemResourceAsStream(serName);
097: else
098: return loader.getResourceAsStream(serName);
099: }
100: });
101: if (ins != null) {
102: try {
103: if (cls == null) {
104: oins = new ObjectInputStream(ins);
105: } else {
106: oins = new ObjectInputStreamWithLoader(ins, cls);
107: }
108: result = oins.readObject();
109: serialized = true;
110: oins.close();
111: } catch (java.io.IOException ex) {
112: ins.close();
113: // Drop through and try opening the class. But remember
114: // the exception in case we can't find the class either.
115: serex = ex;
116: } catch (ClassNotFoundException ex) {
117: ins.close();
118: throw ex;
119: }
120: }
121: if (result == null) {
122: // No serialized object, try just instantiating the class
123: Class cl;
124: try {
125: if (cls == null) {
126: cl = Class.forName(beanName);
127: } else {
128: cl = cls.loadClass(beanName);
129: }
130: } catch (ClassNotFoundException ex) {
131: // There is no appropriate class. If we earlier tried to
132: // deserialize an object and got an IO exception, throw that,
133: // otherwise rethrow the ClassNotFoundException.
134: if (serex != null) {
135: throw serex;
136: }
137: throw ex;
138: }
139: /*
140: * Try to instantiate the class.
141: */
142:
143: try {
144: result = cl.newInstance();
145: } catch (Exception ex) {
146: // We have to remap the exception to one in our signature.
147: // But we pass extra information in the detail message.
148: throw new ClassNotFoundException("" + cl + " : " + ex);
149: }
150: }
151: if (result != null) {// Ok, if the result is an applet initialize it.
152: AppletStub stub = null;
153:
154: if (result instanceof Applet) {
155: Applet applet = (Applet) result;
156:
157: // Figure our the codebase and docbase URLs. We do this
158: // by locating the URL for a known resource, and then
159: // massaging the URL.
160:
161: // First find the "resource name" corresponding to the bean
162: // itself. So a serialzied bean "a.b.c" would imply a
163: // resource name of "a/b/c.ser" and a classname of "x.y"
164: // would imply a resource name of "x/y.class".
165:
166: final String resourceName;
167:
168: if (serialized) {
169: // Serialized bean
170: resourceName = beanName.replace('.', '/').concat(
171: ".ser");
172: } else {
173: // Regular class
174: resourceName = beanName.replace('.', '/').concat(
175: ".class");
176: }
177:
178: URL objectUrl = null;
179: URL codeBase = null;
180: URL docBase = null;
181:
182: // Now get the URL correponding to the resource name.
183:
184: final ClassLoader cloader = cls;
185: objectUrl = (URL) java.security.AccessController
186: .doPrivileged(new java.security.PrivilegedAction() {
187: public Object run() {
188: if (cloader == null)
189: return ClassLoader
190: .getSystemResource(resourceName);
191: else
192: return cloader
193: .getResource(resourceName);
194: }
195: });
196:
197: // If we found a URL, we try to locate the docbase by taking
198: // of the final path name component, and the code base by taking
199: // of the complete resourceName.
200: // So if we had a resourceName of "a/b/c.class" and we got an
201: // objectURL of "file://bert/classes/a/b/c.class" then we would
202: // want to set the codebase to "file://bert/classes/" and the
203: // docbase to "file://bert/classes/a/b/"
204:
205: if (objectUrl != null) {
206: String s = objectUrl.toExternalForm();
207:
208: if (s.endsWith(resourceName)) {
209: int ix = s.length() - resourceName.length();
210: codeBase = new URL(s.substring(0, ix));
211: docBase = codeBase;
212:
213: ix = s.lastIndexOf('/');
214:
215: if (ix >= 0) {
216: docBase = new URL(s.substring(0, ix + 1));
217: }
218: }
219: }
220:
221: // Setup a default context and stub.
222: BeansAppletContext context = new BeansAppletContext(
223: applet);
224:
225: stub = (AppletStub) new BeansAppletStub(applet,
226: context, codeBase, docBase);
227: applet.setStub(stub);
228:
229: // If it was deserialized then it was already init-ed.
230: // Otherwise we need to initialize it.
231:
232: if (!serialized) {
233: // We need to set a reasonable initial size, as many
234: // applets are unhappy if they are started without
235: // having been explicitly sized.
236: applet.setSize(100, 100);
237: applet.init();
238: }
239: ((BeansAppletStub) stub).active = true;
240: }
241: }
242: return result;
243: }
244:
245: /**
246: * <p>
247: * Instantiate a JavaBean.
248: * </p>
249: *
250: * @param classLoader the class-loader from which we should create
251: * the bean. If this is null, then the system
252: * class-loader is used.
253: * @param beanName the name of the bean within the class-loader.
254: * For example "sun.beanbox.foobah"
255: * @param beanContext The BeanContext in which to nest the new bean
256: *
257: * @exception java.lang.ClassNotFoundException if the class of a serialized
258: * object could not be found.
259: * @exception java.io.IOException if an I/O error occurs.
260: */
261:
262: /* public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException {
263: return Beans.instantiate(cls, beanName, beanContext, null);
264: }
265: */
266:
267: /**
268: * Instantiate a bean.
269: * <p>
270: * The bean is created based on a name relative to a class-loader.
271: * This name should be a dot-separated name such as "a.b.c".
272: * <p>
273: * In Beans 1.0 the given name can indicate either a serialized object
274: * or a class. Other mechanisms may be added in the future. In
275: * beans 1.0 we first try to treat the beanName as a serialized object
276: * name then as a class name.
277: * <p>
278: * When using the beanName as a serialized object name we convert the
279: * given beanName to a resource pathname and add a trailing ".ser" suffix.
280: * We then try to load a serialized object from that resource.
281: * <p>
282: * For example, given a beanName of "x.y", Beans.instantiate would first
283: * try to read a serialized object from the resource "x/y.ser" and if
284: * that failed it would try to load the class "x.y" and create an
285: * instance of that class.
286: * <p>
287: * If the bean is a subtype of java.applet.Applet, then it is given
288: * some special initialization. First, it is supplied with a default
289: * AppletStub and AppletContext. Second, if it was instantiated from
290: * a classname the applet's "init" method is called. (If the bean was
291: * deserialized this step is skipped.)
292: * <p>
293: * Note that for beans which are applets, it is the caller's responsiblity
294: * to call "start" on the applet. For correct behaviour, this should be done
295: * after the applet has been added into a visible AWT container.
296: * <p>
297: * Note that applets created via beans.instantiate run in a slightly
298: * different environment than applets running inside browsers. In
299: * particular, bean applets have no access to "parameters", so they may
300: * wish to provide property get/set methods to set parameter values. We
301: * advise bean-applet developers to test their bean-applets against both
302: * the SDK appletviewer (for a reference browser environment) and the
303: * BDK BeanBox (for a reference bean container).
304: *
305: * @param classLoader the class-loader from which we should create
306: * the bean. If this is null, then the system
307: * class-loader is used.
308: * @param beanName the name of the bean within the class-loader.
309: * For example "sun.beanbox.foobah"
310: * @param beanContext The BeanContext in which to nest the new bean
311: * @param initializer The AppletInitializer for the new bean
312: *
313: * @exception java.lang.ClassNotFoundException if the class of a serialized
314: * object could not be found.
315: * @exception java.io.IOException if an I/O error occurs.
316: */
317:
318: /* public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
319: throws java.io.IOException, ClassNotFoundException {
320:
321: java.io.InputStream ins;
322: java.io.ObjectInputStream oins = null;
323: Object result = null;
324: boolean serialized = false;
325: java.io.IOException serex = null;
326:
327: // If the given classloader is null, we check if an
328: // system classloader is available and (if so)
329: // use that instead.
330: // Note that calls on the system class loader will
331: // look in the bootstrap class loader first.
332: if (cls == null) {
333: try {
334: cls = ClassLoader.getSystemClassLoader();
335: } catch (SecurityException ex) {
336: // We're not allowed to access the system class loader.
337: // Drop through.
338: }
339: }
340:
341: // Try to find a serialized object with this name
342: final String serName = beanName.replace('.','/').concat(".ser");
343: final ClassLoader loader = cls;
344: ins = (InputStream)java.security.AccessController.doPrivileged
345: (new java.security.PrivilegedAction() {
346: public Object run() {
347: if (loader == null)
348: return ClassLoader.getSystemResourceAsStream(serName);
349: else
350: return loader.getResourceAsStream(serName);
351: }
352: });
353: if (ins != null) {
354: try {
355: if (cls == null) {
356: oins = new ObjectInputStream(ins);
357: } else {
358: oins = new ObjectInputStreamWithLoader(ins, cls);
359: }
360: result = oins.readObject();
361: serialized = true;
362: oins.close();
363: } catch (java.io.IOException ex) {
364: ins.close();
365: // Drop through and try opening the class. But remember
366: // the exception in case we can't find the class either.
367: serex = ex;
368: } catch (ClassNotFoundException ex) {
369: ins.close();
370: throw ex;
371: }
372: }
373:
374: if (result == null) {
375: // No serialized object, try just instantiating the class
376: Class cl;
377:
378: try {
379: if (cls == null) {
380: cl = Class.forName(beanName);
381: } else {
382: cl = cls.loadClass(beanName);
383: }
384: } catch (ClassNotFoundException ex) {
385: // There is no appropriate class. If we earlier tried to
386: // deserialize an object and got an IO exception, throw that,
387: // otherwise rethrow the ClassNotFoundException.
388: if (serex != null) {
389: throw serex;
390: }
391: throw ex;
392: }
393:
394: /*
395: * Try to instantiate the class.
396: */
397:
398: /* try {
399: result = cl.newInstance();
400: } catch (Exception ex) {
401: // We have to remap the exception to one in our signature.
402: // But we pass extra information in the detail message.
403: throw new ClassNotFoundException("" + cl + " : " + ex);
404: }
405: }
406:
407: if (result != null) {
408:
409: // Ok, if the result is an applet initialize it.
410:
411: AppletStub stub = null;
412:
413: if (result instanceof Applet) {
414: Applet applet = (Applet) result;
415: boolean needDummies = initializer == null;
416:
417: if (needDummies) {
418:
419: // Figure our the codebase and docbase URLs. We do this
420: // by locating the URL for a known resource, and then
421: // massaging the URL.
422:
423: // First find the "resource name" corresponding to the bean
424: // itself. So a serialzied bean "a.b.c" would imply a
425: // resource name of "a/b/c.ser" and a classname of "x.y"
426: // would imply a resource name of "x/y.class".
427:
428: final String resourceName;
429:
430: if (serialized) {
431: // Serialized bean
432: resourceName = beanName.replace('.','/').concat(".ser");
433: } else {
434: // Regular class
435: resourceName = beanName.replace('.','/').concat(".class");
436: }
437:
438: URL objectUrl = null;
439: URL codeBase = null;
440: URL docBase = null;
441:
442: // Now get the URL correponding to the resource name.
443:
444: final ClassLoader cloader = cls;
445: objectUrl = (URL)
446: java.security.AccessController.doPrivileged
447: (new java.security.PrivilegedAction() {
448: public Object run() {
449: if (cloader == null)
450: return ClassLoader.getSystemResource
451: (resourceName);
452: else
453: return cloader.getResource(resourceName);
454: }
455: });
456:
457: // If we found a URL, we try to locate the docbase by taking
458: // of the final path name component, and the code base by taking
459: // of the complete resourceName.
460: // So if we had a resourceName of "a/b/c.class" and we got an
461: // objectURL of "file://bert/classes/a/b/c.class" then we would
462: // want to set the codebase to "file://bert/classes/" and the
463: // docbase to "file://bert/classes/a/b/"
464:
465: if (objectUrl != null) {
466: String s = objectUrl.toExternalForm();
467:
468: if (s.endsWith(resourceName)) {
469: int ix = s.length() - resourceName.length();
470: codeBase = new URL(s.substring(0,ix));
471: docBase = codeBase;
472:
473: ix = s.lastIndexOf('/');
474:
475: if (ix >= 0) {
476: docBase = new URL(s.substring(0,ix+1));
477: }
478: }
479: }
480:
481: // Setup a default context and stub.
482: BeansAppletContext context = new BeansAppletContext(applet);
483:
484: stub = (AppletStub)new BeansAppletStub(applet, context, codeBase, docBase);
485: applet.setStub(stub);
486: } else {
487: initializer.initialize(applet, beanContext);
488: }
489:
490: // now, if there is a BeanContext, add the bean, if applicable.
491:
492: if (beanContext != null) {
493: beanContext.add(result);
494: }
495:
496: // If it was deserialized then it was already init-ed.
497: // Otherwise we need to initialize it.
498:
499: if (!serialized) {
500: // We need to set a reasonable initial size, as many
501: // applets are unhappy if they are started without
502: // having been explicitly sized.
503: applet.setSize(100,100);
504: applet.init();
505: }
506:
507: if (needDummies) {
508: ((BeansAppletStub)stub).active = true;
509: } else initializer.activate(applet);
510:
511: } else if (beanContext != null) beanContext.add(result);
512: }
513:
514: return result;
515: }
516: */
517:
518: /**
519: * From a given bean, obtain an object representing a specified
520: * type view of that source object.
521: * <p>
522: * The result may be the same object or a different object. If
523: * the requested target view isn't available then the given
524: * bean is returned.
525: * <p>
526: * This method is provided in Beans 1.0 as a hook to allow the
527: * addition of more flexible bean behaviour in the future.
528: *
529: * @param obj Object from which we want to obtain a view.
530: * @param targetType The type of view we'd like to get.
531: *
532: */
533:
534: /* public static Object getInstanceOf(Object bean, Class targetType) {
535: return bean;
536: }
537: */
538:
539: /**
540: * Check if a bean can be viewed as a given target type.
541: * The result will be true if the Beans.getInstanceof method
542: * can be used on the given bean to obtain an object that
543: * represents the specified targetType type view.
544: *
545: * @param bean Bean from which we want to obtain a view.
546: * @param targetType The type of view we'd like to get.
547: * @return "true" if the given bean supports the given targetType.
548: *
549: */
550:
551: /* public static boolean isInstanceOf(Object bean, Class targetType) {
552: return Introspector.isSubclass(bean.getClass(), targetType);
553: }
554: */
555:
556: /**
557: * Test if we are in design-mode.
558: *
559: * @return True if we are running in an application construction
560: * environment.
561: *
562: * @see java.beans.DesignMode
563: */
564: public static boolean isDesignTime() {
565: return designTime;
566: }
567:
568: /**
569: * Determines whether beans can assume a GUI is available.
570: *
571: * @return True if we are running in an environment where beans
572: * can assume that an interactive GUI is available, so they
573: * can pop up dialog boxes, etc. This will normally return
574: * true in a windowing environment, and will normally return
575: * false in a server environment or if an application is
576: * running as part of a batch job.
577: *
578: * @see java.beans.Visibility
579: *
580: */
581: public static boolean isGuiAvailable() {
582: return guiAvailable;
583: }
584:
585: /**
586: * Used to indicate whether of not we are running in an application
587: * builder environment.
588: *
589: * <p>Note that this method is security checked
590: * and is not available to (for example) untrusted applets.
591: * More specifically, if there is a security manager,
592: * its <code>checkPropertiesAccess</code>
593: * method is called. This could result in a SecurityException.
594: *
595: * @param isDesignTime True if we're in an application builder tool.
596: * @exception SecurityException if a security manager exists and its
597: * <code>checkPropertiesAccess</code> method doesn't allow setting
598: * of system properties.
599: * @see SecurityManager#checkPropertiesAccess
600: */
601:
602: /* public static void setDesignTime(boolean isDesignTime)
603: throws SecurityException {
604: SecurityManager sm = System.getSecurityManager();
605: if (sm != null) {
606: sm.checkPropertiesAccess();
607: }
608: designTime = isDesignTime;
609: }
610: */
611:
612: /**
613: * Used to indicate whether of not we are running in an environment
614: * where GUI interaction is available.
615: *
616: * <p>Note that this method is security checked
617: * and is not available to (for example) untrusted applets.
618: * More specifically, if there is a security manager,
619: * its <code>checkPropertiesAccess</code>
620: * method is called. This could result in a SecurityException.
621: *
622: * @param isGuiAvailable True if GUI interaction is available.
623: * @exception SecurityException if a security manager exists and its
624: * <code>checkPropertiesAccess</code> method doesn't allow setting
625: * of system properties.
626: * @see SecurityManager#checkPropertiesAccess
627: */
628:
629: /* public static void setGuiAvailable(boolean isGuiAvailable)
630: throws SecurityException {
631: SecurityManager sm = System.getSecurityManager();
632: if (sm != null) {
633: sm.checkPropertiesAccess();
634: }
635: guiAvailable = isGuiAvailable;
636: }
637: */
638:
639: private static boolean designTime;
640: private static boolean guiAvailable = true;
641: }
642:
643: /**
644: * This subclass of ObjectInputStream delegates loading of classes to
645: * an existing ClassLoader.
646: */
647:
648: class ObjectInputStreamWithLoader extends ObjectInputStream {
649: private ClassLoader loader;
650:
651: /**
652: * Loader must be non-null;
653: */
654:
655: public ObjectInputStreamWithLoader(InputStream in,
656: ClassLoader loader) throws IOException,
657: StreamCorruptedException {
658: super (in);
659: if (loader == null) {
660: throw new IllegalArgumentException(
661: "Illegal null argument to ObjectInputStreamWithLoader");
662: }
663: this .loader = loader;
664: }
665:
666: /**
667: * Make a primitive array class
668: */
669:
670: private Class primitiveType(char type) {
671: switch (type) {
672: case 'B':
673: return byte.class;
674:
675: case 'C':
676: return char.class;
677:
678: case 'D':
679: return double.class;
680:
681: case 'F':
682: return float.class;
683:
684: case 'I':
685: return int.class;
686:
687: case 'J':
688: return long.class;
689:
690: case 'S':
691: return short.class;
692:
693: case 'Z':
694: return boolean.class;
695:
696: default:
697: return null;
698: }
699: }
700:
701: /**
702: * Use the given ClassLoader rather than using the system class
703: */
704: protected Class resolveClass(ObjectStreamClass classDesc)
705: throws IOException, ClassNotFoundException {
706: String cname = classDesc.getName();
707: if (cname.startsWith("[")) {
708: // An array
709: Class component; // component class
710: int dcount; // dimension
711: for (dcount = 1; cname.charAt(dcount) == '['; dcount++)
712: ;
713: if (cname.charAt(dcount) == 'L') {
714: component = loader.loadClass(cname.substring(
715: dcount + 1, cname.length() - 1));
716: } else {
717: if (cname.length() != dcount + 1) {
718: throw new ClassNotFoundException(cname);// malformed
719: }
720: component = primitiveType(cname.charAt(dcount));
721: }
722: int dim[] = new int[dcount];
723: for (int i = 0; i < dcount; i++) {
724: dim[i] = 1;
725: }
726: return Array.newInstance(component, dim).getClass();
727: } else {
728: return loader.loadClass(cname);
729: }
730: }
731: }
732:
733: /**
734: * Package private support class. This provides a default AppletContext
735: * for beans which are applets.
736: */
737:
738: class BeansAppletContext implements AppletContext {
739: Applet target;
740: java.util.Hashtable imageCache = new java.util.Hashtable();
741:
742: BeansAppletContext(Applet target) {
743: this .target = target;
744: }
745:
746: public AudioClip getAudioClip(URL url) {
747: // We don't currently support audio clips in the Beans.instantiate
748: // applet context, unless by some luck there exists a URL content
749: // class that can generate an AudioClip from the audio URL.
750: try {
751: return (AudioClip) url.getContent();
752: } catch (Exception ex) {
753: return null;
754: }
755: }
756:
757: public synchronized Image getImage(URL url) {
758: Object o = imageCache.get(url);
759: if (o != null) {
760: return (Image) o;
761: }
762: try {
763: o = url.getContent();
764: if (o == null) {
765: return null;
766: }
767: if (o instanceof Image) {
768: imageCache.put(url, o);
769: return (Image) o;
770: }
771: // Otherwise it must be an ImageProducer.
772: Image img = target
773: .createImage((java.awt.image.ImageProducer) o);
774: imageCache.put(url, img);
775: return img;
776: } catch (Exception ex) {
777: return null;
778: }
779: }
780:
781: public Applet getApplet(String name) {
782: return null;
783: }
784:
785: public java.util.Enumeration getApplets() {
786: java.util.Vector applets = new java.util.Vector();
787: applets.addElement(target);
788: return applets.elements();
789: }
790:
791: public void showDocument(URL url) {// We do nothing.
792: }
793:
794: public void showDocument(URL url, String target) {// We do nothing.
795: }
796:
797: public void showStatus(String status) {// We do nothing.
798: }
799: }
800:
801: /**
802: * Package private support class. This provides an AppletStub
803: * for beans which are applets.
804: */
805: class BeansAppletStub implements AppletStub {
806: transient boolean active;
807: transient Applet target;
808: transient AppletContext context;
809: transient URL codeBase;
810: transient URL docBase;
811:
812: BeansAppletStub(Applet target, AppletContext context, URL codeBase,
813: URL docBase) {
814: this .target = target;
815: this .context = context;
816: this .codeBase = codeBase;
817: this .docBase = docBase;
818: }
819:
820: public boolean isActive() {
821: return active;
822: }
823:
824: public URL getDocumentBase() {
825: // use the root directory of the applet's class-loader
826: return docBase;
827: }
828:
829: public URL getCodeBase() {
830: // use the directory where we found the class or serialized object.
831: return codeBase;
832: }
833:
834: public String getParameter(String name) {
835: return null;
836: }
837:
838: public AppletContext getAppletContext() {
839: return context;
840: }
841:
842: public void appletResize(int width, int height) {// we do nothing.
843: }
844: }
|