sqlj.runtime

Class RuntimeContext

java.lang.Object
  extended by sqlj.runtime.RuntimeContext

public abstract class RuntimeContext
extends Object

This class is for internal use only.

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.


Field Summary
static String DEFAULT_DATA_SOURCE
          The JNDI name of the data source used to create the default Connection object jdbc/defaultDataSource.
static 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.
static String PROPERTY_KEY
          The key under which the RuntimeContext implementation class name is stored in the system properties.
 
Constructor Summary
RuntimeContext()
           
 
Method Summary
abstract  Connection getDefaultConnection()
          Returns the default connection object, if one exists, or null otherwise.
abstract  sqlj.runtime.profile.Loader getLoaderForClass(Class forClass)
          Returns a loader associated with a class.
static RuntimeContext getRuntime()
          Returns the runtime context associated with the current java virtual machine instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_KEY

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

See Also:
Constant Field Values

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:
sqlj.runtime.DefaultRuntime, Constant Field Values

DEFAULT_DATA_SOURCE

public static final String DEFAULT_DATA_SOURCE
The JNDI name of the data source used to create the default Connection object jdbc/defaultDataSource.

Note: Open SQL / SQLJ does not support a default connection context.

See Also:
Constant Field Values
Constructor Detail

RuntimeContext

public RuntimeContext()
Method Detail

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

getLoaderForClass

public abstract sqlj.runtime.profile.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.

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. If the default data source is defined in JNDI, then it is used to establish the default Connection object.

Returns:
if no default Connection object exixts, the null; otherwise the default Connection object.
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] ENGINEAPI [sap.com] opensqldeprecated default BC-JAS-PER-SQL
[sap.com] ENGFACADE [sap.com] tc/je/opensql/api api BC-JAS
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.libdeprecated default BC-JAS


Copyright 2012 SAP AG Complete Copyright Notice