com.ibm.oti.shared
Class SharedClassURLHelperImpl

java.lang.Object
  extended by com.ibm.oti.shared.SharedClassAbstractHelper
      extended by com.ibm.oti.shared.SharedClassURLHelperImpl
All Implemented Interfaces:
SharedClassHelper, SharedClassURLHelper

public class SharedClassURLHelperImpl
extends SharedClassAbstractHelper
implements SharedClassURLHelper

Implementation of SharedClassURLHelper.

Version:
initial
Author:
OTI
See Also:
SharedClassTokenHelper, SharedClassHelperFactory

Method Summary
 byte[] findSharedClass(java.lang.String partition, java.net.URL path, java.lang.String className)
          Find a class in the shared cache using a specific URL, class name and user-defined partition (see "Partitions" above).
 byte[] findSharedClass(java.net.URL path, java.lang.String className)
          Find a class in the shared cache using a specific URL and class name.
 boolean storeSharedClass(java.lang.String partition, java.net.URL path, java.lang.Class clazz)
          Store a class in the shared cache using the URL location it was loaded from and a user-defined partition (see "Partitions" above).
 boolean storeSharedClass(java.net.URL path, java.lang.Class clazz)
          Store a class in the shared cache using the URL location it was loaded from.
 
Methods inherited from class com.ibm.oti.shared.SharedClassAbstractHelper
getClassLoader, isSharedClassCookie
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.oti.shared.SharedClassHelper
getClassLoader
 

Method Detail

findSharedClass

public byte[] findSharedClass(java.net.URL path,
                              java.lang.String className)
Description copied from interface: SharedClassURLHelper
Find a class in the shared cache using a specific URL and class name.

A class will be returned if it was stored against the same URL.
Null is returned if the class cannot be found or if it is stale (see "Dynamic Cache Updates" above).
To obtain an instance of the class, the byte[] returned must be passed to defineClass by the caller ClassLoader.
Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
findSharedClass in interface SharedClassURLHelper
Parameters:
path - URL A URL path. Cannot be null.
className - String The name of the class to be found
Returns:
byte[] A byte array describing the class found, or null.

findSharedClass

public byte[] findSharedClass(java.lang.String partition,
                              java.net.URL path,
                              java.lang.String className)
Description copied from interface: SharedClassURLHelper
Find a class in the shared cache using a specific URL, class name and user-defined partition (see "Partitions" above).

A class will only be returned if it was stored against the same URL and using the same partition. Null is returned if the class cannot be found or if it is stale (see "Dynamic Cache Updates" above).
To obtain an instance of the class, the byte[] returned must be passed to defineClass by the caller ClassLoader.
Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
findSharedClass in interface SharedClassURLHelper
Parameters:
partition - String. User-defined partition if finding modified bytecode (see "Partitions" above). Passing null is equivalent of calling non-partition findSharedClass call.
path - URL. A URL path. Cannot be null.
className - String. The name of the class to be found
Returns:
byte[]. A byte array describing the found class, or null.

storeSharedClass

public boolean storeSharedClass(java.net.URL path,
                                java.lang.Class clazz)
Description copied from interface: SharedClassURLHelper
Store a class in the shared cache using the URL location it was loaded from.

The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified. Returns true if the class is stored successfully or false otherwise.
Will return false if the class being stored was not defined by the caller ClassLoader.
Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
storeSharedClass in interface SharedClassURLHelper
Parameters:
path - URL. The URL path that the class was loaded from. Cannot be null.
clazz - Class. The class to store in the shared cache
Returns:
boolean. True if the class was stored successfully, false otherwise.

storeSharedClass

public boolean storeSharedClass(java.lang.String partition,
                                java.net.URL path,
                                java.lang.Class clazz)
Description copied from interface: SharedClassURLHelper
Store a class in the shared cache using the URL location it was loaded from and a user-defined partition (see "Partitions" above).

The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified. Returns true if the class is stored successfully or false otherwise.
Will return false if the class being stored was not defined by the caller ClassLoader.
Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.

Specified by:
storeSharedClass in interface SharedClassURLHelper
Parameters:
partition - String. User-defined partition if storing modified bytecode (see "Partitions" above). Passing null is equivalent of calling non-partition storeSharedClass call.
path - URL. The URL path that the class was loaded from. Cannot be null.
clazz - Class. The class to store in the shared cache
Returns:
boolean. True if the class was stored successfully, false otherwise.