All Frameworks Class Hierarchy This Framework Previous Next Indexes
ObjectModelerBase Class CATOmbWarmStartServices
CATOmbWarmStartServices
Usage: you must use this class as is. You should never derive it.
public class CATOmbWarmStartServices
Services to control the warmstart incremental backup.
Role: The following static methods are meant to be used by CAA applications which
want to benefit from the warmstart system. They will provide basic services to test
the status of the warmstart and interact with it (activate, deactivate, commit
modifications...).
Method Index
- o
Activate(CATUnicodeString&)
- Activates or re-initialises the warmstart incremental backup.
- o
CommitTransaction()
- Commits the transaction into the warmstart backup data.
- o
Deactivate(CATBoolean,CATUnicodeString&)
- Deactivates the warmstart incremental backup.
- o
Deactivate(CATUnicodeString&)
-
- o
IsActive(CATBoolean&)
- Tests if the warmstart is active.
- o
IsAvailable(CATBoolean&)
- Tests if the warmstart is available.
Methods
o Activate
-
Activates or re-initialises the warmstart incremental backup.
Role: This method should be called in commands saving or closing documents.
It will succeed only if none of the open documents is dirty (aka modified and not saved).
If the warmstart was previously:
- deactivated, it will be reactivated: a copy of each loaded V5 documents
will be done, and log files will be created.
- Already activated, it will be re-initialized. A copy of each loaded V5 documents
is done, and the backup data files are emptied.
If successful, the caller should display the returned warning message. Use the following
code to call this service and display the user message:
CATUnicodeString WarningMessage;
HRESULT hr = CATOmbWarmStartServices::Activate(WarningMessage);
if( SUCCEEDED(hr) && (0!=WarningMessage.GetLengthInChar()) )
{
CATApplicationFrame *pFrame = CATApplicationFrame::GetFrame();
if( (NULL!=pFrame) && (NULL!=pFrame->GetMainWindow()) )
{
CATDlgNotify *pNfy = new CATDlgNotify(pFrame->GetMainWindow(),
"AutoSave",
CATDlgNfyInformation|CATDlgNfyOK|CATDlgWndModal);
CATUnicodeString WindowTitle = "..." ;
pNfy->DisplayBlocked(WarningMessage , WindowTitle);
pNfy->RequestDelayedDestruction();
}
}
- Parameters:
-
- oWarningMessageToDisplay
- The warning message to be displayed to the user if successful (S_OK returned).
- Returns:
-
Legal values:
- S_OK
- The warmstart was successfully activated or re-initialized.
- E_FAIL
- The activation failed, either because warmstart is not available, or
some documents were dirty.
o CommitTransaction
public static HRESULT CommitTransaction( | ) |
-
Commits the transaction into the warmstart backup data.
Role: Normally the operations inside a command are validated at the end of
the command for a state command, or at the activation of the next for the others.
That wants to say that as long as the validation is not made, if the V5 session is broken,
the last operations will be not restored at the backup. However, you can force this
validation during a command if it is necessary.
This method should be called to force the
latest modifications on the model to be commited into the backup data. This means that
those modifications will be replayed if a warmstart is needed.
The method should be called only when the
modifications to commit make a coherent transaction up, so that if they are replayed,
the model won't be left in a instable state.
- Returns:
-
Legal values:
- S_OK
- The transaction has been successfully committed.
- E_FAIL
- An internal error prevented the transaction from being committed.
o Deactivate
-
Deactivates the warmstart incremental backup.
Role: This method should be called in the
CATCommand Activate method of a command when it is known that the command is incompatible with incremental backup.
It will stop the warmstart logging and also, when requested, delete all previous logged data.
If successful, the caller should display the returned message warning the user to save his data.
Use the following code to call this service and display the user message:
CATUnicodeString WarningMessage;
int iDeleteLog = 0; // depending user wants to delete or not previously logged data
HRESULT hr = CATOmbWarmStartServices::Deactivate(iDeleteLog, WarningMessage);
if( SUCCEEDED(hr) && (0 !=warningMessage.GetLengthInChar()) )
{
CATApplicationFrame * pFrame = CATApplicationFrame::GetFrame();
if( (NULL!=pFrame) && (NULL!=pFrame->GetMainWindow()) )
{
CATDlgNotify *pNfy = new CATDlgNotify(pFrame->GetMainWindow(),
"AutoSave",
CATDlgNfyInformation|CATDlgNfyOK|CATDlgWndModal);
CATUnicodeString WindowTitle="..";
pNfy->DisplayBlocked(WarningMessage ,WindowTitle);
pNfy->RequestDelayedDestruction();
}
}
- Parameters:
-
- iDeleteLog
- Delete when requested the previously logged data at deactivation time.
- FALSE: Logged data remain until next incremental backup activation.
If a crash occurs after deactivation, all commands preceeding deactivated one will be restored.
- TRUE: Logged data are deleted at deactivation time.
If a crash occurs after deactivation, none of the commands preceeding deactivated one will be restored.
User should save all data before processing deactivated command.
- oWarningMessageToDisplay
- The warning message to be displayed to the user if successful (S_OK returned).
- Returns:
-
Legal values:
- S_OK
- The warmstart was successfully deactivated.
- E_FAIL
- The deactivation failed, either because warmstart is not available, or it was
already deactivated.
o Deactivate
-
- Deprecated:
- V5R18
use HRESULT Deactivate(CATBoolean iDeleteLog, CATUnicodeString& oWarningMessageToDisplay)
Deactivates the warmstart incremental backup.
Role: This method should be called in the
CATCommand Activate method of a command when it is known that the command is incompatible with incremental backup.
It will stop the warmstart logging and delete all previous logged data.
If successful, the caller should display the returned message warning
the user to save his data.
Use the following code to call this service and display the user message:
CATUnicodeString WarningMessage;
HRESULT hr = CATOmbWarmStartServices::Deactivate(WarningMessage);
if( SUCCEEDED(hr) && (0 !=warningMessage.GetLengthInChar()) )
{
CATApplicationFrame * pFrame = CATApplicationFrame::GetFrame();
if( (NULL!=pFrame) && (NULL!=pFrame->GetMainWindow()) )
{
CATDlgNotify *pNfy = new CATDlgNotify(pFrame->GetMainWindow(),
"AutoSave",
CATDlgNfyInformation|CATDlgNfyOK|CATDlgWndModal);
CATUnicodeString WindowTitle="..";
pNfy->DisplayBlocked(WarningMessage ,WindowTitle);
pNfy->RequestDelayedDestruction();
}
}
- Parameters:
-
- oWarningMessageToDisplay
- The warning message to be displayed to the user if successful (S_OK returned).
- Returns:
-
Legal values:
- S_OK
- The warmstart was successfully deactivated.
- E_FAIL
- The deactivation failed, either because warmstart is not available, or it was
already deactivated.
o IsActive
-
Tests if the warmstart is active.
Role: This method should be called to test if the warmstart is
currently saving backup data.
- Parameters:
-
- oActive
- When successful (S_OK returned) : TRUE if the warmstart is active, FALSE otherwise.
- Returns:
-
Legal values:
- S_OK
- The returned status is meaningful.
- E_FAIL
- The warmstart is not available, or an internal error prevents
the status from being retrieved.
o IsAvailable
-
Tests if the warmstart is available.
Role: This method should be called to test if the warmstart can be activated,
depending on environment variables and user settings.
- Parameters:
-
- oAvailable
- When successful (S_OK returned) : TRUE if the warmstart is available, FALSE otherwise.
- Returns:
-
Legal values:
- S_OK
- The returned status is meaningful.
- E_FAIL
- An internal error prevents the status from being retrieved.
This object is included in the file: CATOmbWarmStartServices.h
If needed, your Imakefile.mk should include the module: CATObjectModelerBase