All Packages This Package Previous Next
Class sqlj.runtime.profile.ref.ProfileImpl
java.lang.Object
|
+----sqlj.runtime.profile.Profile
|
+----sqlj.runtime.profile.ref.ProfileImpl
- public class ProfileImpl
- extends Profile
The ProfileImpl class provides a concrete implementation of the Profile
class. A profile is a resource which contains the "constant" information
describing a set of sql operations. It also provides a mechanism to add
a JDBC connection to a profile, and in so doing, create a
"ConnectedProfile" which can be used to create executable statement
objects corresponding to the sql statements contained within the
profile.
-
ProfileImpl(String, String, EntryInfo[], Loader, String)
- Creates a new profile instance having the given profile name, context
name, set of entries and loader.
-
deregisterCustomization(Customization)
- Drop a customization from the profile's list.
-
getConnectedProfile(Connection)
- Resolves the contents of this profile with the passed JDBC connection
and returns the result.
-
getContextName()
- Returns the fully qualified name of the connection context for this
profile.
-
getCustomizations()
-
-
getDefaultProfile(Connection, ProfileData)
- Returns a default connected profile object.
-
getProfileData()
-
-
getProfileName()
-
-
getTimestamp()
-
Returns the creation time of the profile, as given by
System.currentTimeMillis.
-
registerCustomization(Customization)
- Registers a customization for this profile instance.
-
registerCustomization(Customization, Customization)
- Registers a customization for this profile instance.
-
replaceCustomization(Customization, Customization)
- Registers a customization for this profile instance.
ProfileImpl
public ProfileImpl(String profileName,
String contextName,
EntryInfo entries[],
Loader loader,
String sourceFile)
- Creates a new profile instance having the given profile name, context
name, set of entries and loader. The profile timestamp is created
based on the current system time.
Note that this method should only be used to create new profiles.
To instantiate an existing profile object, use the
instantiate
method. This constructor is used at
translation time to create a new profile for serialization.
- Parameters:
- profileName - the fully qualified name of the profile
- contextName - the fully qualified name of the connection context
associated with the profile.
- entries - the profile data contents for this profile
- loader - the loader to associate with this instance of the profile
- sourceFile - the name of the source file producing this
profile, null if not available.
- See Also:
- instantiate, currentTimeMillis
getProfileName
public String getProfileName()
- Returns:
- the fully qualified name of the profile.
- Overrides:
- getProfileName in class Profile
getContextName
public String getContextName()
- Returns the fully qualified name of the connection context for this
profile.
- Overrides:
- getContextName in class Profile
- See Also:
- getContextName
getTimestamp
public long getTimestamp()
- Returns the creation time of the profile, as given by
System.currentTimeMillis.
- Returns:
- the timestamp of the profile.
- Overrides:
- getTimestamp in class Profile
- See Also:
- getTimestamp
getProfileData
public ProfileData getProfileData()
- Returns:
- a data object describing each of the sql operations
contained in this profile.
- Overrides:
- getProfileData in class Profile
- See Also:
- getProfileData
getConnectedProfile
public ConnectedProfile getConnectedProfile(Connection conn) throws SQLException
- Resolves the contents of this profile with the passed JDBC connection
and returns the result. The implementation of this method will return
the connected-profile associated with the first registered customization
that accepts the passed connection. If no customization is found that
accepts the connection, a default connected-profile implementation
based on JDBC dynamic sql will be returned.
- Parameters:
- conn - a jdbc Connection over which to perform operations.
- Returns:
- the result of attaching this profile to the given connection.
- Throws: SQLException
- if a connected-profile cannot be
created for the supplied connection.
- Overrides:
- getConnectedProfile in class Profile
- See Also:
- Customization, getDefaultProfile, getConnectedProfile
getDefaultProfile
public static ConnectedProfile getDefaultProfile(Connection conn,
ProfileData data)
- Returns a default connected profile object. The passed JDBC
connection parameter specifies the connection over which to execute
operations. The passed ProfileData parameter specifies the data on
which to operate.
The default connected profile has the following properties:
- The JDBC model of dynamic sql execution is used to create
statement objects; a statement type of PREPARED will be mapped to a
prepareStatement
call on the associated JDBC connection
object, passing the sql string of the appropriate profile entry as an
argument. Any out parameters are registered using
registerOutParameter
calls on the JDBC statement created;
the sql type stored in the type info of the appropriate profile entry
is used during registration.
- Transaction control entries are handled by the connection; when a
statement object is created whose role appears as COMMIT in the
profile entry, the execution of that statement will invoke a
commit
method on the asscoiated JDBC connection;
execution of a statement whose role was ROLLBACK invokes a
rollback
method on the connection; execution of a
statement whose role was SET_TRANSACTION invokes
setReadOnly
and setIsolationLevel
methods on
the connection.
- Statements containing a WHERE CURRENT OF clause (profile entry
role is POSITIONED) are executed by dynamically creating a new
statement object with the runtime name of the cursor parameter
substituted for the '?' in the original sql string.
Note: A profile customization may create and maintain a modified
version of the profile data object associated with a particular
profile instance. In such cases, this method may be used to create a
connected profile which applies the default semantics to custom data.
- Parameters:
- conn - the JDBC connection upon which to create the connected
profile.
- data - the profile data object upon which the resulting connected
profile will operate.
- Returns:
- s a default connected profile object
- See Also:
- JDBCProfile, TransactionControlProfile, PositionedProfile, IterConvertProfile
registerCustomization
public void registerCustomization(Customization customization)
- Registers a customization for this profile instance. The customization is
added after all currently registered customizations.
Generally, a runtime environment will not call this method
directly. Rather, this method may be called by customization
utilities which operate on application profiles during an
"installation" phase.
- Throws: NullPointerException
- if the customization argument is null
- Overrides:
- registerCustomization in class Profile
registerCustomization
public void registerCustomization(Customization newCustomization,
Customization nextCustomization)
- Registers a customization for this profile instance. The new
customization is added to the list just prior to the next
customization argument. If the next customization is not currently
registered, an exception is raised.
Generally, a runtime environment will not call this method
directly. Rather, this method may be called by customization
utilities which operate on application profiles during an
"installation" phase.
- Parameters:
- newCustomization - the customization to register
- nextCustomization - the customization before which to add the new
customization
- Throws: NullPointerException
- if the new customization argument is null
- Throws: IllegalArgumentException
- if the next customization argument is not currently registered
- Overrides:
- registerCustomization in class Profile
replaceCustomization
public void replaceCustomization(Customization newCustomization,
Customization oldCustomization)
- Registers a customization for this profile instance. The new
customization is added to the list in place of the old customization
argument. The new customization retains the position of the old
customization. If the old customization is not currently registered,
an exception is raised.
Generally, a runtime environment will not call this method
directly. Rather, this method may be called by customization
utilities which operate on application profiles during an
"installation" phase.
- Parameters:
- newCustomization - the customization to register
- oldCustomization - the customization to replace
- Throws: NullPointerException
- if the new customization argument is null
- Throws: IllegalArgumentException
- if the old customization argument is not currently registered
- Overrides:
- replaceCustomization in class Profile
deregisterCustomization
public void deregisterCustomization(Customization customization)
- Drop a customization from the profile's list.
- Throws: IllegalArgumentException
- if the customization argument is not currently registered
- Overrides:
- deregisterCustomization in class Profile
getCustomizations
public Enumeration getCustomizations()
- Returns:
- an enumeration of all customizations currently registered with
the profile.
- Overrides:
- getCustomizations in class Profile
All Packages This Package Previous Next