IJagServerResults interface  IObjectControl interface

Chapter 2: ActiveX C++ Interface Reference

IObjectContext interface

Description

Provides methods that allow your component to influence the transaction outcome. Nontransactional components can call the IObjectContext methods to cause early deactivation of an instance.

Methods

The following methods are not supported and always return an HRESULT status of DISP_E_NOTIMPLEMENTED:

Usage

The IObjectContext interface contains methods that allow your component to influence the transaction outcome.

Call the GetObjectContext routine to obtain an IObjectContext interface pointer.

See also

GetObjectContext routine, IObjectControl interface




IObjectContext::DisableCommit

Description

Indicates that the current transaction cannot be committed because the component’s work has not been completed; the instance remains active after the current method returns.

Syntax

#include <jagctx.h>

HRESULT IObjectContext::DisableCommit (void);

Returns

Return value

To indicate

S_OK

Successfully set transactional state.

CONTEXT_E_NOCONTEXT

DisableCommit was called from code that was not executing as part of a component method invocation.

Usage

DisableCommit specifies that the component instance should not be automatically deactivated after the current method completes. If the instance is deactivated before the next method invocation, the current transaction is rolled back.

When a method calls DisableCommit, the component instance is not deactivated until one of the following happens:

EnableCommit and DisableCommit allow a component maintain state between method calls. If a component is not transactional, these two methods have the same effect: both prevent immediate deactivation of the component.

If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.

See also

EnableCommit, SetAbort, SetComplete

Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide




IObjectContext::EnableCommit

Description

Indicates that the component should not be deactivated after the current method invocation; allow the current transaction to be committed if the component instance is deactivated.

Syntax

#include <jagctx.h>

HRESULT IObjectContext::EnableCommit (void);

Returns

Return value

To indicate

S_OK

Successfully set transactional state.

CONTEXT_E_NOCONTEXT

EnableCommit was called from code that was not executing as part of a component method invocation.

Usage

EnableCommit specifies that the component instance should not be automatically deactivated after the current method completes. If the instance is deactivated before the next method invocation, the current transaction is committed.

When a method calls EnableCommit, the component instance is not deactivated until one of the following happens:

EnableCommit and DisableCommit allow a component maintain state between method calls. If a component is not transactional, these two methods have the same effect: both prevent immediate deactivation of the component.

If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.

See also

DisableCommit, SetAbort, SetComplete

Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide




IObjectContext::IsInTransaction

Description

Determines whether the current method is executing in a transaction.

Syntax

#include <jagctx.h>

BOOL IObjectContext::IsInTransaction (void);

Returns

Return value

To indicate

TRUE

The current method invocation is executing within a EAServer transaction.

FALSE

The current method invocation is not executing within a EAServer transaction.

Usage

Methods can call IsInTransaction to determine whether they are executing within a transaction. Methods in components that are declared to be transactional always execute as part of a transaction.

See also

Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide




IObjectContext::IsSecurityEnabled

Description

Determines whether login security and component authorization are enabled for the server.

Syntax

#include <jagctx.h>

BOOL IObjectContext::IsSecurityEnabled (void);

Returns

Return value

To indicate

TRUE

Security is enabled.

FALSE

Security is not enabled.

Usage

By default, login security and component authorization are disabled for newly installed servers.

NoteNote In the current release, IsSecurityEnabled returns TRUE regardless of whether security has been enabled in the server configuration.




IObjectContext::SetAbort

Description

Indicates that the component cannot complete its work for the current transaction and that the transaction should be rolled back. The component instance will be deactivated when the method returns.

Syntax

#include <jagctx.h>

HRESULT IObjectContext::SetAbort (void);

Returns

Return value

To indicate

S_OK

Successfully set transactional state.

CONTEXT_E_NOCONTEXT

SetAbort was called from code that was not executing as part of a component method invocation.

Usage

SetAbort specifies that the component cannot complete its work for the current transaction. The transaction will be rolled back when the initiating component is deactivated.

If a component is not transactional, then SetAbort and SetComplete have the same effect: both cause the component instance to deactivate after the currently executing method returns.

If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.

See also

DisableCommit, EnableCommit, IsInTransaction, SetComplete

Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide




IObjectContext::SetComplete

Description

Indicates that the component’s work for the current transaction was successfully finished and that this component instance should be deactivated when the method returns.

Syntax

#include <jagctx.h>

HRESULT IObjectContext::SetComplete (void);

Returns

Return value

To indicate

S_OK

Successfully set transactional state.

CONTEXT_E_NOCONTEXT

SetComplete was called from code that was not executing as part of a component method invocation.

Usage

SetComplete specifies that the component has successfully completed its contribution to the current transaction. The component instance deactivates when control returns from the current component method invocation.

If the component instance is the initiator of the transaction (that is, it was instantiated directly by a base client), then EAServer attempts to commit the transaction. The transaction commits unless the commit is disallowed or vetoed; depending on the components that are participating, this can happen in any of the following ways:

If a component is not transactional, then SetAbort and SetComplete have the same effect: both cause the component instance to deactivate after the currently executing method returns.

If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.

See also

DisableCommit, EnableCommit, IsInTransaction, SetAbort

Chapter 2, “Understanding Transactions and Component Lifecycles,” in the EAServer Programmer’s Guide





Copyright © 2005. Sybase Inc. All rights reserved. IObjectControl interface