All Packages    This Package  Previous  Next  

Class sqlj.runtime.RuntimeContext

java.lang.Object
   |
   +----sqlj.runtime.RuntimeContext

public abstract class RuntimeContext
extends Object
The runtime context defines system-specific services to be provided by the runtime environment. The runtime context is an abstract class whose implementation may vary according to the Java VM environment.


Variable Index

 o DEFAULT_RUNTIME
The fully qualified class name of the default runtime implementation used when no other implementation has been defined for a VM environment.
 o PROPERTY_KEY
The key under which the RuntimeContext implementation class name is stored in the system properties.

Constructor Index

 o RuntimeContext()

Method Index

 o getDefaultConnection()
Returns the default connection object, if one exists, or null otherwise.
 o getLoaderForClass(Class)
Returns a loader associated with a class.
 o getRuntime()
Returns the runtime context associated with the current java virtual machine instance.

Variables

 o PROPERTY_KEY
 public static final String PROPERTY_KEY
The key under which the RuntimeContext implementation class name is stored in the system properties.

 o DEFAULT_RUNTIME
 public static final String DEFAULT_RUNTIME
The fully qualified class name of the default runtime implementation used when no other implementation has been defined for a VM environment.

See Also:
DefaultRuntime

Constructors

 o RuntimeContext
 public RuntimeContext()

Methods

 o getRuntime
 public static RuntimeContext getRuntime()
Returns the runtime context associated with the current java virtual machine instance. Each java virtual machine instance has a single unique runtime context instance. Subsequent calls to this method within the same VM instace will return the same object. The appropriate runtime context implementation is discovered by examining the value of the RuntimeContext.PROPERTY_KEY System property. If this property is set, it will indicate the full name of a class that is able to be instantiated as a runtime context instance. If no such property is defined or access to this system property is not allowed, the class given by RuntimeContext.DEFAULT_RUNTIME is used.

Note: all runtime implementations must be able to be constructed via the Class.newInstance method. That is, they must have a public no-arg constructor.

Returns:
the runtime instance
See Also:
PROPERTY_KEY, DEFAULT_RUNTIME
 o getLoaderForClass
 public abstract Loader getLoaderForClass(Class forClass)
Returns a loader associated with a class. Resources and classes loaded from this loader will be found in the same location that the passed class was found in. Note that the definition of location may vary depending on class loading and resolution semantics of the runtime implementation.

It is assumed that the passed class argument contains enough information that a java virtual machine implementation will be able to determine the location in which to find related resources. Most VM implementations will be able to use the passed class's class loader (or the system class loader if the class has no loader). However, some VM implementations may need additional information to resolve resources. For example, a VM running in a DB server might use the schema in which the passed class is located to search for related resources.

Parameters:
forClass - the class with which the resulting loader is to be associated.
 o getDefaultConnection
 public abstract Connection getDefaultConnection()
Returns the default connection object, if one exists, or null otherwise. Some enviornments may have an implicit connection object available. For example, a virtual machine running in a DB server might have an implicit connection associated with the current session.

Returns:
the default connection, or null if none exists.

All Packages    This Package  Previous  Next