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

## com.ibm.oti.shared
Class SharedClassURLClasspathHelperImpl

    java.lang.Object
      com.ibm.oti.shared.SharedAbstractHelper
          com.ibm.oti.shared.SharedClassAbstractHelper
              com.ibm.oti.shared.SharedClassURLClasspathHelperImpl

All Implemented Interfaces:
  SharedClassHelper, SharedClassURLClasspathHelper, SharedHelper

    public class SharedClassURLClasspathHelperImpl

extends SharedClassAbstractHelper
implements SharedClassURLClasspathHelper

Implementation of SharedClassURLClasspathHelper.

Version:
  initial
Author:
  OTI
See Also:
  `SharedClassURLClasspathHelper`, `SharedClassHelperFactory`, `SharedClassAbstractHelper`

Nested Class Summary

Nested classes/interfaces inherited from interface com.ibm.oti.shared.SharedClassURLClasspathHelper
`SharedClassURLClasspathHelper.IndexHolder`

Method Summary
`void` | `addClasspathEntry(java.net.URL cpe)` Update the helper's classpath by appending a URL (see "Usage" above).
`void` | `confirmAllEntries()` Confirms all entries in the current classpath.
`byte[]` | `findSharedClass(java.lang.String className, SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)` Find a class in the shared cache using the class name given (implicitly using the caller's classpath).
`byte[]` | `findSharedClass(java.lang.String partition, java.lang.String className, SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)` Find a class in the shared cache using the class name and partition given (implicitly using the caller's classpath).
`void` | `setClasspath(java.net.URL[] newClasspath)` Update the helper's classpath with a new classpath.
`boolean` | `storeSharedClass(java.lang.Class clazz, int foundAtIndex)` Store a class in the shared cache using the caller's URL classpath.
`boolean` | `storeSharedClass(java.lang.String partition, java.lang.Class clazz, int foundAtIndex)` Store a class in the shared cache using the caller's URL classpath and with a user-defined partition.

Methods inherited from class com.ibm.oti.shared.SharedClassAbstractHelper
`getSharingFilter, isSharedClassCookie, setSharingFilter`

Methods inherited from class com.ibm.oti.shared.SharedAbstractHelper
`getClassLoader`

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
`getSharingFilter, setSharingFilter`

Methods inherited from interface com.ibm.oti.shared.SharedHelper
`getClassLoader`

Method Detail

### findSharedClass

    public byte[] findSharedClass(java.lang.String className,
                                  SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)

  Description copied from interface: `SharedClassURLClasspathHelper`
  Find a class in the shared cache using the class name given (implicitly using the caller's classpath).

  See "Using Classpaths" above for rules on when a class will be found
  Null is returned if the class cannot be found, if it is stale (see "Dynamic Cache Updates" above) or if it is found for an unconfirmed entry (see "Using Classpaths" above).

  Specified by:
    `findSharedClass` in interface `SharedClassURLClasspathHelper`
  Parameters:
    `className` - String. The name of the class to be found
    `indexFoundAtHolder` - IndexHolder. The index in the caller ClassLoader's classpath at which the class was found. This parameter can be null if this data is not needed.
  Returns:
    byte[]. A byte array describing the class found, or null.

### findSharedClass

    public byte[] findSharedClass(java.lang.String partition,
                                  java.lang.String className,
                                  SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)

  Description copied from interface: `SharedClassURLClasspathHelper`
  Find a class in the shared cache using the class name and partition given (implicitly using the caller's classpath).

  See "Finding Classes" above for rules on when a class will be found
  Null is returned if the class cannot be found, if it is stale (see "Dynamic Cache Updates" above) or if it is found for an unconfirmed entry (see "Using Classpaths" above).

  Specified by:
    `findSharedClass` in interface `SharedClassURLClasspathHelper`
  Parameters:
    `partition` - String. User-defined partition if finding modified bytecode (see "Partitions" above). Passing null is equivalent of calling non-partition findSharedClass call.
    `className` - String. The name of the class to be found
    `indexFoundAtHolder` - IndexHolder. The index in the caller ClassLoader's classpath at which the class was found. This parameter can be null if this data is not needed.
  Returns:
    byte[]. A byte array describing the class found, or null.

### storeSharedClass

    public boolean storeSharedClass(java.lang.Class clazz,
                                    int foundAtIndex)

  Description copied from interface: `SharedClassURLClasspathHelper`
  Store a class in the shared cache using the caller's URL classpath.

  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 `SharedClassURLClasspathHelper`
  Parameters:
    `clazz` - Class. The class to store in the shared cache
    `foundAtIndex` - int. The index in the caller's classpath where the class was loaded from (first entry is 0).
  Returns:
    boolean. True if the class was stored successfully, false otherwise.

### storeSharedClass

    public boolean storeSharedClass(java.lang.String partition,
                                    java.lang.Class clazz,
                                    int foundAtIndex)

  Description copied from interface: `SharedClassURLClasspathHelper`
  Store a class in the shared cache using the caller's URL classpath and with a user-defined partition.

  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 `SharedClassURLClasspathHelper`
  Parameters:
    `partition` - String. User-defined partition if storing modified bytecode (see "Partitions" above). Passing null is equivalent of calling non-partition storeSharedClass call.
    `clazz` - Class. The class to store in the shared cache
    `foundAtIndex` - int. The index in the caller's classpath where the class was loaded from (first entry is 0).
  Returns:
    boolean. True if the class was stored successfully, false otherwise.

### addClasspathEntry

    public void addClasspathEntry(java.net.URL cpe)

  Description copied from interface: `SharedClassURLClasspathHelper`
  Update the helper's classpath by appending a URL (see "Usage" above).

  Note: It is ESSENTIAL that the helper's classpath is kept up-to-date with the classloader's.

  Specified by:
    `addClasspathEntry` in interface `SharedClassURLClasspathHelper`
  Parameters:
    `cpe` - URL. The classpath entry to append to the classpath

### confirmAllEntries

    public void confirmAllEntries()

  Description copied from interface: `SharedClassURLClasspathHelper`
  Confirms all entries in the current classpath. Any new entries added will not automatically be confirmed.

  Note that if all entries are confirmed, setClasspath cannot be used to modify the classpath, only to append new entries. (see "Efficient use..." above).

  Specified by:
    `confirmAllEntries` in interface `SharedClassURLClasspathHelper`

### setClasspath

    public void setClasspath(java.net.URL[] newClasspath)
                      throws CannotSetClasspathException

  Description copied from interface: `SharedClassURLClasspathHelper`
  Update the helper's classpath with a new classpath.

  This function is useful for ClassLoaders that compute their classpath lazily. The initial classpath is passed to the constructor optimistically, but if the classloader discovers a change while reading an entry, it can update the classpath using this function.
  Note: It is ESSENTIAL that the helper's classpath is kept up-to-date with the classloader's.

  The classpath passed to this function must be exactly the same as the original classpath upto and including the rightmost entry that classes have been loaded from (the righmost "confirmed" entry).
  Throws a CannotSetClasspathException if this is not the case (see "Modifying Classpaths" above).

  Once the classpath has been updated, any indexes passed to storeSharedClass and returned from findSharedClass correspond to the new classpath.

  Specified by:
    `setClasspath` in interface `SharedClassURLClasspathHelper`
  Parameters:
    `newClasspath` - The new URL classpath array
  Throws:
    `CannotSetClasspathException`

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