Java Doc for BshClassManager.java in  » Scripting » beanshell » bsh » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » beanshell » bsh 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   bsh.BshClassManager

All known Subclasses:   bsh.NameSpace,  bsh.BSHType,  bsh.classpath.ClassManagerImpl,
BshClassManager
public class BshClassManager (Code)
BshClassManager manages all classloading in BeanShell. It also supports a dynamically loaded extension (bsh.classpath package) which allows classpath extension and class file reloading. Currently the extension relies on 1.2 for BshClassLoader and weak references. See http://www.beanshell.org/manual/classloading.html for details on the bsh classloader architecture.

Bsh has a multi-tiered class loading architecture. No class loader is used unless/until the classpath is modified or a class is reloaded.


Inner Class :public static interface Listener
Inner Class :static class SignatureKey

Field Summary
protected transient  HashtableabsoluteClassCache
     Global cache for things we know are classes.
protected transient  HashtableabsoluteNonClasses
     Global cache for things we know are *not* classes.
protected transient  HashtableassociatedClasses
    
protected transient  HashtabledefiningClasses
    
protected transient  HashtabledefiningClassesBaseNames
    
protected  ClassLoaderexternalClassLoader
     An external classloader supplied by the setClassLoader() command.
protected transient  HashtableresolvedObjectMethods
     Caches for resolved object and static methods.
protected transient  HashtableresolvedStaticMethods
    


Method Summary
public  voidaddClassPath(URL path)
    
public  voidaddListener(Listener l)
    
public  voidassociateClass(Class clas)
     Associate a persistent generated class implementation with this interpreter.
public  voidcacheClassInfo(String name, Class value)
     Cache info about whether name is a class or not.
public  voidcacheResolvedMethod(Class clas, Class[] types, Method method)
     Cache a resolved (possibly overloaded) method based on the argument types used to invoke it, subject to classloader change.
public  booleanclassExists(String name)
    
public  ClassclassForName(String name)
     Load the specified class by name, taking into account added classpath and reloaded classes, etc. Note: Again, this is just a trivial implementation.
protected  voidclassLoaderChanged()
    
protected  voidclearCaches()
    
protected static  UtilEvalErrorcmUnavailable()
    
public static  BshClassManagercreateClassManager(Interpreter interpreter)
     Create a new instance of the class manager.
public  ClassdefineClass(String name, byte[] code)
    
protected  voiddefiningClass(String className)
     Flag the class name as being in the process of being defined.
protected  voiddoSuperImport()
     Support for "import *;" Hide details in here as opposed to NameSpace.
protected  voiddoneDefiningClass(String className)
     Indicate that the specified class name has been defined and may be loaded normally.
public  voiddump(PrintWriter pw)
    
public  ClassgetAssociatedClass(String name)
    
protected  StringgetClassBeingDefined(String className)
     This method is a temporary workaround used with definingClass.
protected  StringgetClassNameByUnqName(String name)
     Return the name or null if none is found, Throw an ClassPathException containing detail if name is ambigous.
protected  MethodgetResolvedMethod(Class clas, String methodName, Class[] types, boolean onlyStatic)
     Return a previously cached resolved method.
Parameters:
  onlyStatic - specifies that only a static method may be returned.
public  URLgetResource(String path)
    
public  InputStreamgetResourceAsStream(String path)
    
protected  booleanhasSuperImport()
     A "super import" ("import *") operation has been performed.
protected  booleanisClassBeingDefined(String className)
    
protected  ClassloadSourceClass(String name)
    
protected static  ErrornoClassDefFound(String className, Error e)
     Annotate the NoClassDefFoundError with some info about the class we were trying to load.
public  ClassplainClassForName(String name)
     Perform a plain Class.forName() or call the externally provided classloader.
public  voidreloadAllClasses()
     Overlay the entire path with a new class loader.
public  voidreloadClasses(String[] classNames)
     Reloading classes means creating a new classloader and using it whenever we are asked for classes in the appropriate space.
public  voidreloadPackage(String pack)
     Reload all classes in the specified package: e.g.
public  voidremoveListener(Listener l)
    
public  voidreset()
     Clear all loaders and start over.
public  voidsetClassLoader(ClassLoader externalCL)
     Set an external class loader.
public  voidsetClassPath(URL[] cp)
     Set a new base classpath and create a new base classloader. This means all types change.

Field Detail
absoluteClassCache
protected transient Hashtable absoluteClassCache(Code)
Global cache for things we know are classes. Note: these should probably be re-implemented with Soft references. (as opposed to strong or Weak)



absoluteNonClasses
protected transient Hashtable absoluteNonClasses(Code)
Global cache for things we know are *not* classes. Note: these should probably be re-implemented with Soft references. (as opposed to strong or Weak)



associatedClasses
protected transient Hashtable associatedClasses(Code)

See Also:   BshClassManager.associateClass(Class)
See Also:   



definingClasses
protected transient Hashtable definingClasses(Code)



definingClassesBaseNames
protected transient Hashtable definingClassesBaseNames(Code)



externalClassLoader
protected ClassLoader externalClassLoader(Code)
An external classloader supplied by the setClassLoader() command.



resolvedObjectMethods
protected transient Hashtable resolvedObjectMethods(Code)
Caches for resolved object and static methods. We keep these maps separate to support fast lookup in the general case where the method may be either.



resolvedStaticMethods
protected transient Hashtable resolvedStaticMethods(Code)





Method Detail
addClassPath
public void addClassPath(URL path) throws IOException(Code)



addListener
public void addListener(Listener l)(Code)



associateClass
public void associateClass(Class clas)(Code)
Associate a persistent generated class implementation with this interpreter. An associated class will be used in lieu of generating bytecode when a scripted class of the same name is encountered. When such a class is defined in the script it will cause the associated existing class implementation to be initialized (with the static initializer field). This is utilized by the persistent class generator to allow a generated class to bootstrap an interpreter and rendesvous with its implementation script. Class associations currently last for the life of the class manager.



cacheClassInfo
public void cacheClassInfo(String name, Class value)(Code)
Cache info about whether name is a class or not.
Parameters:
  value - if value is non-null, cache the classif value is null, set the flag that it is *not* a class tospeed later resolution



cacheResolvedMethod
public void cacheResolvedMethod(Class clas, Class[] types, Method method)(Code)
Cache a resolved (possibly overloaded) method based on the argument types used to invoke it, subject to classloader change. Static and Object methods are cached separately to support fast lookup in the general case where either will do.



classExists
public boolean classExists(String name)(Code)



classForName
public Class classForName(String name)(Code)
Load the specified class by name, taking into account added classpath and reloaded classes, etc. Note: Again, this is just a trivial implementation. See bsh.classpath.ClassManagerImpl for the fully functional class management package. the class or null



classLoaderChanged
protected void classLoaderChanged()(Code)



clearCaches
protected void clearCaches()(Code)
Clear the caches in BshClassManager
See Also:    public void #reset() for external usage



cmUnavailable
protected static UtilEvalError cmUnavailable()(Code)



createClassManager
public static BshClassManager createClassManager(Interpreter interpreter)(Code)
Create a new instance of the class manager. Class manager instnaces are now associated with the interpreter.
See Also:    bsh.Interpreter.getClassManager()
See Also:    bsh.Interpreter.setClassLoader( ClassLoader )



defineClass
public Class defineClass(String name, byte[] code)(Code)



definingClass
protected void definingClass(String className)(Code)
Flag the class name as being in the process of being defined. The class manager will not attempt to load it.



doSuperImport
protected void doSuperImport() throws UtilEvalError(Code)
Support for "import *;" Hide details in here as opposed to NameSpace.



doneDefiningClass
protected void doneDefiningClass(String className)(Code)
Indicate that the specified class name has been defined and may be loaded normally.



dump
public void dump(PrintWriter pw)(Code)



getAssociatedClass
public Class getAssociatedClass(String name)(Code)



getClassBeingDefined
protected String getClassBeingDefined(String className)(Code)
This method is a temporary workaround used with definingClass. It is to be removed at some point.



getClassNameByUnqName
protected String getClassNameByUnqName(String name) throws UtilEvalError(Code)
Return the name or null if none is found, Throw an ClassPathException containing detail if name is ambigous.



getResolvedMethod
protected Method getResolvedMethod(Class clas, String methodName, Class[] types, boolean onlyStatic)(Code)
Return a previously cached resolved method.
Parameters:
  onlyStatic - specifies that only a static method may be returned. the Method or null



getResource
public URL getResource(String path)(Code)
Get a resource URL using the BeanShell classpath
Parameters:
  path - should be an absolute path



getResourceAsStream
public InputStream getResourceAsStream(String path)(Code)
Get a resource stream using the BeanShell classpath
Parameters:
  path - should be an absolute path



hasSuperImport
protected boolean hasSuperImport()(Code)
A "super import" ("import *") operation has been performed.



isClassBeingDefined
protected boolean isClassBeingDefined(String className)(Code)



loadSourceClass
protected Class loadSourceClass(String name)(Code)



noClassDefFound
protected static Error noClassDefFound(String className, Error e)(Code)
Annotate the NoClassDefFoundError with some info about the class we were trying to load.



plainClassForName
public Class plainClassForName(String name) throws ClassNotFoundException(Code)
Perform a plain Class.forName() or call the externally provided classloader. If a BshClassManager implementation is loaded the call will be delegated to it, to allow for additional hooks.

This simply wraps that bottom level class lookup call and provides a central point for monitoring and handling certain Java version dependent bugs, etc.
See Also:   BshClassManager.classForName(String) the class




reloadAllClasses
public void reloadAllClasses() throws UtilEvalError(Code)
Overlay the entire path with a new class loader. Set the base path to the user path + base path. No point in including the boot class path (can't reload thos).



reloadClasses
public void reloadClasses(String[] classNames) throws UtilEvalError(Code)
Reloading classes means creating a new classloader and using it whenever we are asked for classes in the appropriate space. For this we use a DiscreteFilesClassLoader



reloadPackage
public void reloadPackage(String pack) throws UtilEvalError(Code)
Reload all classes in the specified package: e.g. "com.sun.tools" The special package name "" can be used to refer to unpackaged classes.



removeListener
public void removeListener(Listener l)(Code)



reset
public void reset()(Code)
Clear all loaders and start over. No class loading.



setClassLoader
public void setClassLoader(ClassLoader externalCL)(Code)
Set an external class loader. BeanShell will use this at the same point it would otherwise use the plain Class.forName(). i.e. if no explicit classpath management is done from the script (addClassPath(), setClassPath(), reloadClasses()) then BeanShell will only use the supplied classloader. If additional classpath management is done then BeanShell will perform that in addition to the supplied external classloader. However BeanShell is not currently able to reload classes supplied through the external classloader.



setClassPath
public void setClassPath(URL[] cp) throws UtilEvalError(Code)
Set a new base classpath and create a new base classloader. This means all types change.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.