Java Doc for DynamicLoader.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » common » util » 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 » Workflow Engines » pegasus 2.1.0 » org.griphyn.common.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.griphyn.common.util.DynamicLoader

DynamicLoader
public class DynamicLoader (Code)
This class provides a dynamic class loading facility. It is tightly coupled to the property facility. To dynamically obtain an instance of a class through its constructor:
 Integer i = null;
 DynamicLoader dl = new DynamicLoader( "java.lang.Integer" );
 try {
 // instantiate as Integer("42")
 String arg[] = new String[1];
 arg[0] = "42";
 i = (Integer) dl.instantiate(arg);
 } catch ( Exception e ) {
 System.err.println( dl.convertException(e) );
 System.exit(1);
 }
 
Similarily, to obtain an instance of a class through a static method provided by the same class, or another class:
 Integer i = null;
 DynamicLoader dl = new DynamicLoader( "java.lang.Integer" );
 try {
 // instantiate as Integer("42")
 String arg[] = new String[1];
 arg[0] = "42";
 i = (Integer) dl.static_method( "valueOf", arg );
 } catch ( Exception e ) {
 System.err.println( dl.convertException(e) );
 System.exit(1);
 }
 

author:
   Karan Vahi
author:
   Jens-S. Vöckler
version:
   $Revision: 50 $



Constructor Summary
public  DynamicLoader(String classname)
    

Method Summary
public static  StringconvertException(String classname, Exception e)
     Converts an exception from the class loader into an error message.
Parameters:
  classname - is the name or some other class signifier.
Parameters:
  e - is the exception thrown by the class loader.
public  StringconvertException(Exception e)
     Converts an exception from the class loader into an error message.
Parameters:
  e - is the exception thrown by the class loader.
public static  StringconvertExceptionToString(String classname, Throwable e)
     Converts an exception from the class loader into an error message. Note: It does not convert any cause messages.
Parameters:
  classname - is the name or some other class signifier.
Parameters:
  e - is the exception thrown by the class loader.
public  StringgetClassName()
     Obtains the fully-qualified class name that this instance works with.
public  Objectinstantiate(Object[] arguments)
     Dynamically instantiates a class from a contructor.
public  Objectinstantiate(Class[] classes, Object[] arguments)
     Dynamically instantiates a class from a contructor.
public  voidsetClassName(String classname)
     Sets the fully-qualified class name to load.
public  Objectstatic_method(String method, Object[] arguments)
     Dynamically instantiates a class from a static method which constructs the resulting object.


Constructor Detail
DynamicLoader
public DynamicLoader(String classname)(Code)




Method Detail
convertException
public static String convertException(String classname, Exception e)(Code)
Converts an exception from the class loader into an error message.
Parameters:
  classname - is the name or some other class signifier.
Parameters:
  e - is the exception thrown by the class loader. a string that tries to describe what went wrong.



convertException
public String convertException(Exception e)(Code)
Converts an exception from the class loader into an error message.
Parameters:
  e - is the exception thrown by the class loader. a string that tries to describe what went wrong.



convertExceptionToString
public static String convertExceptionToString(String classname, Throwable e)(Code)
Converts an exception from the class loader into an error message. Note: It does not convert any cause messages.
Parameters:
  classname - is the name or some other class signifier.
Parameters:
  e - is the exception thrown by the class loader. a string that tries to describe what went wrong.



getClassName
public String getClassName()(Code)
Obtains the fully-qualified class name that this instance works with. the class name.
See Also:   DynamicLoader.setClassName(String)



instantiate
public Object instantiate(Object[] arguments) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException(Code)
Dynamically instantiates a class from a contructor. You must have set the class name before invoking this method. Please note that any exceptions thrown by the constructor will be wrapped into a InvocationTargetException.
Parameters:
  arguments - are arguments to the constructor of the classto load. Please use "new Object[0]" for the argumentless defaultconstructor. an instance that must be cast to the correct class.
exception:
  ClassNotFoundException - if the driver for the databasecannot be loaded. You might want to check your CLASSPATH, too.
exception:
  NoSuchMethodException - if the driver's constructor interfacedoes not comply with the database driver API.
exception:
  InstantiationException - if the driver class is an abstractclass instead of a concrete implementation.
exception:
  IllegalAccessException - if the constructor for the driverclass it not publicly accessible to this package.
exception:
  InvocationTargetException - if the constructor of the driverthrows an exception while being dynamically loaded.
exception:
  SQLException - if the driver for the database can beloaded, but faults when initially accessing the database
See Also:   DynamicLoader.setClassName(String)



instantiate
public Object instantiate(Class[] classes, Object[] arguments) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException(Code)
Dynamically instantiates a class from a contructor. You must have set the class name before invoking this method. Please note that any exceptions thrown by the constructor will be wrapped into a InvocationTargetException.

This method should be invoked, if the constructor declares interface types as formal arguments, but the actual arguments are implementation classes.
Parameters:
  classes - is a vector of the classes involved. Each itemin the classes vector matches the item in the arguments vector.The classes vector will be used to select the correct constructor.Please use "new Class[0]" for the argumentless default ctor.
Parameters:
  arguments - are arguments to the constructor of the classto load. Please use "new Object[0]" for the argumentless defaultconstructor. an instance that must be cast to the correct class.
exception:
  ClassNotFoundException - if the driver for the databasecannot be loaded. You might want to check your CLASSPATH, too.
exception:
  NoSuchMethodException - if the driver's constructor interfacedoes not comply with the database driver API.
exception:
  IllegalArgumentException - is thrown, if the number ofarguments do not match the number of types, ie the vector havemismatching sizes.
exception:
  InstantiationException - if the driver class is an abstractclass instead of a concrete implementation.
exception:
  IllegalAccessException - if the constructor for the driverclass it not publicly accessible to this package.
exception:
  InvocationTargetException - if the constructor of the driverthrows an exception while being dynamically loaded.
exception:
  SQLException - if the driver for the database can beloaded, but faults when initially accessing the database
See Also:   DynamicLoader.setClassName(String)




setClassName
public void setClassName(String classname)(Code)
Sets the fully-qualified class name to load.
Parameters:
  classname - is the new class name.
See Also:   DynamicLoader.getClassName()



static_method
public Object static_method(String method, Object[] arguments) throws ClassNotFoundException, SecurityException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, NullPointerException, IllegalArgumentException(Code)
Dynamically instantiates a class from a static method which constructs the resulting object. You must have set the class name before invoking this method. Please note that any exceptions thrown by the constructor will be wrapped into a InvocationTargetException.
Parameters:
  method - is the name of the static method to call.
Parameters:
  arguments - are arguments to the constructor of the classto load. Please use "new Object[0]" for the argumentless defaultconstructor. an instance that must be cast to the correct class.
exception:
  ClassNotFoundException - if the driver for the databasecannot be loaded. You might want to check your CLASSPATH, too.
exception:
  NoSuchMethodException - if the driver's constructor interfacedoes not comply with the database driver API.
exception:
  InstantiationException - if the driver class is an abstractclass instead of a concrete implementation.
exception:
  IllegalAccessException - if the constructor for the driverclass it not publicly accessible to this package.
exception:
  InvocationTargetException - if the constructor of the driverthrows an exception while being dynamically loaded.
exception:
  SQLException - if the driver for the database can beloaded, but faults when initially accessing the database
exception:
  SecurityException - if you are not permitted to invoke themethod, or even list the methods provided by the class.
exception:
  NullPointerException - if the method name isnull.
exception:
  IllegalArgumentException - if the number of actual andformal parameter differ, unwrapping a primitive type failed, ora parameter value cannot be converted to the formal argument type.
See Also:   DynamicLoader.setClassName(String)



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.