public interface ProfileContext
ProfileContext
interface provides a Profile object with access
to SLEE-managed state that is dependent on the Profile objects's currently executing
context.
A ProfileContext
object is given to a Profile object after the Profile
object is created via the setProfileContext
method.
The ProfileContext
object remains associated with the Profile object for
the lifetime of that Profile object. Note that the information that the Profile object
obtains from the ProfileContext
object may change as the SLEE assigns the
Profile object to different profiles during the Profile object's lifecycle.
Modifier and Type | Method and Description |
---|---|
ProfileLocalObject |
getProfileLocalObject()
Get a
ProfileLocalObject which represents the profile that the Profile
object owning this ProfileContext is currently assigned to. |
String |
getProfileName()
Get the name of the profile that the Profile object owning this
ProfileContext
is currently assigned to. |
ProfileTable |
getProfileTable()
Get an object that implements the Profile Table Interface of the profile table that
this
ProfileContext is associated with. |
ProfileTable |
getProfileTable(String profileTableName)
Get a
ProfileTable object for a profile table. |
String |
getProfileTableName()
Get the name of the profile table in which the profile that this Profile object is
assigned to exists.
|
boolean |
getRollbackOnly()
Test if the current transaction has been marked for rollback only.
|
Tracer |
getTracer(String tracerName)
Get a tracer for the specified tracer name.
|
void |
setRollbackOnly()
Mark the current transaction for rollback.
|
ProfileLocalObject getProfileLocalObject() throws IllegalStateException, SLEEException
ProfileLocalObject
which represents the profile that the Profile
object owning this ProfileContext
is currently assigned to.
This method is a non-transactional method. The Profile object must be in the Ready state when it invokes this method as otherwise it is not assigned to any particular profile.
ProfileLocalObject
which represents the profile that the Profile
object owning this ProfileContext
is currently assigned to.IllegalStateException
- if the Profile object invoking this method is not in
the Ready state.SLEEException
- if the local object reference could not be obtained due to a
system-level failure.String getProfileTableName() throws SLEEException
This method is a non-transactional method.
SLEEException
- if the profile table name could not be obtained due to a
system-level failure.String getProfileName() throws IllegalStateException, SLEEException
ProfileContext
is currently assigned to.
This method is a non-transactional method. The Profile object must be in the Ready
state when it invokes this method as otherwise it is not assigned to any particular
profile, with the exception that this method may also be successfully called by a
profile object during Profile.profilePostCreate()
.
null
if the Profile object is associated
with the profile table's default profile.IllegalStateException
- if the Profile object invoking this method is not in
the Ready state, with the exception of the Profile.profilePostCreate()
method.SLEEException
- if the profile name could not be obtained due to a
system-level failure.ProfileTable getProfileTable() throws SLEEException
ProfileContext
is associated with. If the profile specification of
the profile table has defined a Profile Table Interface that extends ProfileTable
then the object returned from this method may be safely typecast to the subinterface
declared in the Profile Specification.
This method is a non-transactional method.
SLEEException
- if the Profile Table Interface object could not be obtained
due to a system-level failure.ProfileTable getProfileTable(String profileTableName) throws NullPointerException, UnrecognizedProfileTableNameException, SLEEException
ProfileTable
object for a profile table. The object returned
by this method may be safely typecast to the Profile Table interface defined by
the profile specification of the profile table if the profile specification of the
profile that this ProfileContext
is associated with has the appropriate
classes in its classloader to do so, for example by declaring a profile-spec-ref
in its deployment descriptor for the profile specification of the Profile Table.
This method is a non-transactional method.
profileTableName
- the name of the profile table.ProfileTable
object for the profile table.NullPointerException
- if profileTableName
is null
.UnrecognizedProfileTableNameException
- if a profile table with the
specified name does not exist.SLEEException
- if the ProfileTable
object could not be
obtained due to a system-level-failure.void setRollbackOnly() throws TransactionRequiredLocalException, SLEEException
A Profile object invokes this method when it does not want the current transaction to commit.
This method is a mandatory transactional method.
TransactionRequiredLocalException
- if this method is invoked without a valid
transaction context.SLEEException
- if the current transaction could not be marked for rollback due
to a system-level failure.boolean getRollbackOnly() throws TransactionRequiredLocalException, SLEEException
This method is a mandatory transactional method.
true
if the current transaction has been marked for rollback,
false
otherwise.TransactionRequiredLocalException
- if this method is invoked without a valid
transaction context.SLEEException
- if the current state of the transaction could not be obtained
due to a system-level failure.Tracer getTracer(String tracerName) throws NullPointerException, IllegalArgumentException, SLEEException
ProfileTableNotification
that contains the profile table
name as identified by getProfileTableName()
.
Refer Tracer
for a complete discussion on tracers and
tracer names.
Trace notifications generated by a tracer obtained using this method are of the type
ProfileTableNotification.TRACE_NOTIFICATION_TYPE
.
This method is a non-transactional method.
tracerName
- the name of the tracer.ProfileTableNotification
object containing a profile table name equal to that obtained from the
getProfileTableName()
method on this ProfileContext
.NullPointerException
- if tracerName
is null
.IllegalArgumentException
- if tracerName
is an invalid name. Name
components within a tracer name must have at least one character. For example,
"com.mycompany"
is a valid tracer name, whereas "com..mycompany"
is not.SLEEException
- if the Tracer could not be obtained due to a system-level failure.