Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.core
Class ClassBundle

    java.lang.Object
      org.jini.rio.core.ClassBundle

All Implemented Interfaces:
  Serializable

    public class ClassBundle

extends Object
implements Serializable

ClassBundle provides a mechanism to define the resources needed to load and instantiate a class.

See Also:
  Serialized Form

Constructor Summary
`ClassBundle()` Create a new ClassBundle
`ClassBundle(String className)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames, Map<String,String[]> shComponents)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames, Map<String,String[]> shComponents, String codebase)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames, Map<String,String[]> shComponents, String algorithm, Map<String,String> httpmdLocations, String codebase)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames, String codebase)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames, String[] methodNames, Object[] methodArgs)` Create a new ClassBundle
`ClassBundle(String className, String[] jarNames, String[] methodNames, Object[] methodArgs, String codebase)` Create a new ClassBundle

Method Summary
`void` | `addJAR(String jar)` Add a JAR to the Collection of JAR resources.
`void` | `addJARHttpmdLocation(String resource, String location)` Add a location for a JAR to compute a message digest.
`void` | `addJARHttpmdLocations(Map<String,String> m)` Add a Map of JAR to location entries
`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` | `addSharedComponent(String name, String[] jarNames)` Add a shared component
`void` | `addSharedComponents(Map<String,String[]> m)` Add a Map of shared components
`boolean` | `equals(Object obj)` Override equals
`String` | `getAlgorithm()` Get the algorithm set for computing message digests
`String` | `getClassName()` Get the className
`String` | `getCodebase()` Get the codebase used to load the class.
`boolean` | `getComputeHttpMD()` Get whether this ClassBundle has been configured to compute HTTP Message Digests
`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` | `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 void` | `main(String[] args)`
`void` | `runKnownMethods(Object object)` Utility method to reflect on all added methods using an object instantiated from the Class loaded by the ClassBundle
`void` | `setAlgorithm(String algorithm)` Set the algorithm to use for computing message digests
`void` | `setClassName(String className)` Set the className
`void` | `setCodebase(String codebase)` Set the codebase used to load the class.
`void` | `setComputeHttpMD(boolean computeHttpmd)` Set whether to compute HTTP Message Digests for this ClassBundle
`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

### ClassBundle

    public ClassBundle()

  Create a new ClassBundle

### ClassBundle

    public ClassBundle(String className)

  Create a new ClassBundle

  Parameters:
    `className` - The className

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames,
                       String codebase)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className
    `codebase` - The URL path used to load the class. The path will be applied to all JARs in this ClassBundle

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames,
                       String[] methodNames,
                       Object[] methodArgs)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className
    `methodNames` - Array of methodNames
    `methodArgs` - Array of method arguments to be used to invoke the method names above. The contents of the array must be suitable for use when using reflection to invoke the method. The methodNames array and the methodArgs array must be the same length

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames,
                       String[] methodNames,
                       Object[] methodArgs,
                       String codebase)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className
    `methodNames` - Array of methodNames
    `methodArgs` - Array of method arguments to be used to invoke the method names above. The contents of the array must be suitable for use when using reflection to invoke the method. The methodNames array and the methodArgs array must be the same length
    `codebase` - The URL path used to load the class. The path will be applied to all JARs in this ClassBundle

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames,
                       Map<String,String[]> shComponents)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className
    `shComponents` - 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 services

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames,
                       Map<String,String[]> shComponents,
                       String codebase)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className
    `shComponents` - 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 services
    `codebase` - The URL path used to load the class. The path will be applied to all JARs in this ClassBundle

### ClassBundle

    public ClassBundle(String className,
                       String[] jarNames,
                       Map<String,String[]> shComponents,
                       String algorithm,
                       Map<String,String> httpmdLocations,
                       String codebase)

  Create a new ClassBundle

  Parameters:
    `className` - The className
    `jarNames` - Array of Strings identifyng resource names used to load the className
    `shComponents` - 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 services
    `algorithm` - Algorithm used for computing HTTPMD, either "sha" or "md5"
    `httpmdLocations` - A Map of jar names to locations for use when creating message digests
    `codebase` - The URL path used to load the class. The path will be applied to all JARs in this ClassBundle

Method Detail

### setCodebase

    public void setCodebase(String codebase)

  Set the codebase used to load the class. The path will be applied to all JARs in this ClassBundle

  Parameters:
    `codebase` - The codebase to set

### getCodebase

    public String getCodebase()

  Get the codebase used to load the class.

  Returns:
    The codebase that has been set. If the codebase has properties declared (in the form `$[property]`), return a formatted string with the properties expanded. If there are no property elements declared, return the original string.

### getRawCodebase

    public String getRawCodebase()

  Get the codebase without any translation

  Returns:
    The codebase that has been set

### setAlgorithm

    public void setAlgorithm(String algorithm)

  Set the algorithm to use for computing message digests

  Parameters:
    `algorithm` - Algorithm used for computing HTTPMD

### getAlgorithm

    public String getAlgorithm()

  Get the algorithm set for computing message digests

  Returns:
    The algortihm set for the ClassBundle

### getComputeHttpMD

    public boolean getComputeHttpMD()

  Get whether this ClassBundle has been configured to compute HTTP Message Digests

  Returns:
    true if the ClassBundle has been configured to compute HTTP

### setComputeHttpMD

    public void setComputeHttpMD(boolean computeHttpmd)

  Set whether to compute HTTP Message Digests for this ClassBundle

  Parameters:
    `computeHttpmd` - Use true if the ClassBundle compute HTTP for it's jars

### setClassName

    public void setClassName(String className)

  Set the className

  Parameters:
    `className` - The className, suitable for use with Class.forName()

### getClassName

    public String getClassName()

  Get the className

  Returns:
    The className, suitable for use with Class.forName()

### addJARHttpmdLocation

    public void addJARHttpmdLocation(String resource,
                                     String location)

  Add a location for a JAR to compute a message digest. Key, value entries found in this table will be used to recompute a JAR's message digest.

  Parameters:
    `resource` - The resource (jar) name
    `location` - The location to use to compute the message digest for the resource. The location may point to a file system where the resource can be loaded from, or an http:// URL. If a file system location is used, it will most likely not be portable across platforms.

### addJARHttpmdLocations

    public void addJARHttpmdLocations(Map<String,String> m)

  Add a Map of JAR to location entries

  Parameters:
    `m` - Map of JAR locations to compute httpmd

### setJARs

    public void setJARs(String[] jars)

  Set JARs to the ClassBundle. The URL[] will be split into the codebase and the jarNames. The codebase for the ClassBundle will be set to be the path of the URL.

  Parameters:
    `jars` - Array of URLs to add

### addJARs

    public void addJARs(String[] jars)

  Add JARs to the ClassBundle. The URL[] will be split into the codebase and the jarNames. The codebase for the ClassBundle will be set to be the path of the URL.

  Parameters:
    `jars` - Array of URLs to add

### addJAR

    public void addJAR(String jar)

  Add a JAR to the Collection of JAR resources.

  Parameters:
    `jar` - Name of the JAR to add

### addSharedComponents

    public void addSharedComponents(Map<String,String[]> m)

  Add a Map of shared components

  Parameters:
    `m` - Map of shared components to add

### addSharedComponent

    public void addSharedComponent(String name,
                                   String[] jarNames)

  Add a shared component

  Parameters:
    `name` - Class name of the shared component to load
    `jarNames` - String[] of jar names used to load the shared component

### loadClass

    public Class loadClass()
                    throws ClassNotFoundException,
                           MalformedURLException

  Load the class using the provided JAR resources. If there are no JARs resources for the class the curremt contxt ClassLoader will be used to load the class. If there are JAR resources, a new ClassLoader will be created each time this method is invoked, setting the delegating ClassLoader to the contextClassLoader

  Returns:
    A new Class instance each time this method is invoked
  Throws:
    `ClassNotFoundException` - If the class cannot be loaded
    `MalformedURLException` - If URLs cannot be created

### loadClass

    public Class loadClass(ClassLoader parent)
                    throws ClassNotFoundException,
                           MalformedURLException

  Load the class using the provided JAR resources. If there are no JARs resources for the class the parent ClassLoader will be used to load the class. If there are JAR resources, a new ClassLoader will be created each time this method is invoked.

  Parameters:
    `parent` - Parent Classloader to use for delegation.
  Returns:
    A new Class instance each time this method is invoked
  Throws:
    `ClassNotFoundException` - If the class cannot be loaded
    `MalformedURLException` - If URLs cannot be created

### getJARNames

    public String[] getJARNames()

  Get the JAR names

  Returns:
    A String array of the JAR names. This method will return a new array each time. If there are no JAR names, this method will return an empty array

### getJARs

    public URL[] getJARs()
                  throws MalformedURLException

  Get the JAR resources

  Returns:
    An URL array of the JAR resources. This method will return a new array each time. If there are no JAR resources, this method will return an empty array
  Throws:
    `MalformedURLException` - if the codebase has not been set, or if the provided codebase contains an invalid protocol

### getSharedComponents

    public Map getSharedComponents()
                            throws MalformedURLException

  Get shared component information

  Returns:
    A Map of the shared component information. This method will return a new Map each time. If there are no shared components, this method will return an empty Map
  Throws:
    `MalformedURLException` - If URLs cannot be created

### addMethod

    public 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. The array of parameter types will be determined by the Class object for the Object types provided

  Parameters:
    `methodName` - The public member method of the Class or interface represented by this ClassBundle
    `parameters` - Array of Object parameters for use when reflecting on the method

### getMethodNames

    public String[] getMethodNames()

  Get all method names to reflect on

  Returns:
    Array of String method names to reflect on. If there are no method names to reflect on this method will return an empty array

### getMethodClasses

    public Class[] getMethodClasses(String methodName)

  Get the corresponding Class[] parameters to reflect on a method

  Parameters:
    `methodName` - The name of the public method to reflect on
  Returns:
    Array of Class objects to use when reflecting on the public method

### getMethodObjects

    public Object[] getMethodObjects(String methodName)

  Get the corresponding Class[] parameters to reflect on a method

  Parameters:
    `methodName` - The name of the public method to reflect on
  Returns:
    Array of Object objects to use when reflecting on the public method

### runKnownMethods

    public void runKnownMethods(Object object)
                         throws Exception

  Utility method to reflect on all added methods using an object instantiated from the Class loaded by the ClassBundle

  Parameters:
    `object` - An instantiated Object from the Class loaded by the ClassBundle
  Throws:
    `Exception` - If there are errors running the known methods

### hashCode

    public int hashCode()

  Override hashCode

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Override equals

  Overrides:
    `equals` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### main

    public static void main(String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.