|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.core.ClassBundle
public class ClassBundle
ClassBundle provides a mechanism to define the resources needed to load and instantiate a class.
| Constructor Summary | |
|---|---|
ClassBundle()
Create a new ClassBundle |
|
ClassBundle(String className)
Create a new ClassBundle |
|
ClassBundle(String className,
String[] jarNames,
Map<String,String[]> shComponents,
String codebase)
Create a new ClassBundle |
|
| Method Summary | |
|---|---|
void |
addJAR(String jar)
Add a JAR to the Collection of JAR resources. |
void |
addJARs(String... jars)
Add JARs to the ClassBundle. |
void |
addMethod(String methodName,
Object[] parameters)
Add a method name and the parameters to use for when reflecting on specified public member method of the class or interface represented by this ClassBundle object. |
void |
addSharedComponents(Map<String,String[]> m)
Add a Map of shared components |
boolean |
equals(Object obj)
Override equals |
String |
getArtifact()
Get the artifact associated with the className |
String |
getClassName()
Get the className |
String |
getCodebase()
Get the codebase used to load the class. |
String[] |
getJARNames()
Get the JAR names. |
URL[] |
getJARs()
Get the JAR resources |
Class[] |
getMethodClasses(String methodName)
Get the corresponding Class[] parameters to reflect on a method |
String[] |
getMethodNames()
Get all method names to reflect on |
Object[] |
getMethodObjects(String methodName)
Get the corresponding Class[] parameters to reflect on a method |
String |
getRawCodebase()
Get the codebase without any translation |
Map<String,String[]> |
getRawSharedComponents()
Get raw shared component information |
Map<String,URL[]> |
getSharedComponents()
Get shared component information |
int |
hashCode()
Override hashCode |
Class |
loadClass()
Load the class using the provided JAR resources. |
Class |
loadClass(ClassLoader parent)
Load the class using the provided JAR resources. |
static ClassBundle |
merge(ClassBundle... bundles)
Merge two ClassBundles |
void |
runKnownMethods(Object object)
Utility method to reflect on all added methods using an object instantiated from the Class loaded by the ClassBundle |
void |
setArtifact(String artifact)
Set the artifact |
void |
setClassName(String className)
Set the className |
void |
setCodebase(String codebase)
Set the codebase used to load the class. |
void |
setJARs(String... jars)
Set JARs to the ClassBundle. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ClassBundle()
public ClassBundle(String className)
className - The className
public ClassBundle(String className,
String[] jarNames,
Map<String,String[]> shComponents,
String codebase)
className - The classNamejarNames - Array of Strings identifyng resource names used to load
the classNameshComponents - Map of class names and jar names to load the class
from. A shared component will be loaded by the common loader for all
services making it (and the resources it uses) available to all servicescodebase - The URL path used to load the class. The path will be
applied to all JARs in this ClassBundle| Method Detail |
|---|
public void setCodebase(String codebase)
codebase - The codebase to setpublic String getCodebase()
public String getRawCodebase()
public void setClassName(String className)
className - The className, suitable for use with Class.forName()public String getClassName()
public String getArtifact()
public void setArtifact(String artifact)
artifact - The artifact associated with the classNamepublic void setJARs(String... jars)
jars - Jar names to addpublic void addJARs(String... jars)
jars - Jar names to add.public void addJAR(String jar)
jar - Name of the JAR to addpublic void addSharedComponents(Map<String,String[]> m)
m - Map of shared components to add
public Class loadClass()
throws ClassNotFoundException,
MalformedURLException
ClassNotFoundException - If the class cannot be loaded
MalformedURLException - If URLs cannot be created
public Class loadClass(ClassLoader parent)
throws ClassNotFoundException,
MalformedURLException
parent - Parent Classloader to use for delegation.
ClassNotFoundException - If the class cannot be loaded
MalformedURLException - If URLs cannot be createdpublic String[] getJARNames()
public URL[] getJARs()
throws MalformedURLException
MalformedURLException - if the codebase has not been set, or if
the provided codebase contains an invalid protocol
public Map<String,URL[]> getSharedComponents()
throws MalformedURLException
MalformedURLException - If URLs cannot be createdpublic Map<String,String[]> getRawSharedComponents()
public void addMethod(String methodName,
Object[] parameters)
methodName - The public member method of the Class or interface
represented by this ClassBundleparameters - Array of Object parameters for use when reflecting on
the methodpublic String[] getMethodNames()
public Class[] getMethodClasses(String methodName)
methodName - The name of the public method to reflect on
public Object[] getMethodObjects(String methodName)
methodName - The name of the public method to reflect on
public void runKnownMethods(Object object)
throws Exception
object - An instantiated Object from the Class loaded by the
ClassBundle
Exception - If there are errors running the known methodspublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Objectpublic static ClassBundle merge(ClassBundle... bundles)
bundles - ClassBundle instances to merge
IllegalArgumentException - For all ClassBundles that have a
non-null classname, that classname must be equal. If this is not the
case then an IllegalArgumentException is thrown.
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||