Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.ide.history
Class HistoryManager

java.lang.Object
  extended by oracle.ide.history.HistoryManager

public abstract class HistoryManager
extends java.lang.Object

The HistoryManager is responsible for keeping a record of local changes for the purpose of later state comparrison and restoration.


Field Summary
static java.lang.String RESTORE_HISTORY_CMD
          Restore history command.
static int RESTORE_HISTORY_CMD_ID
          Restore history command id.
static java.lang.String RESTORE_HISTORY_RENAME_CMD
          Restore history command.
static int RESTORE_HISTORY_RENAME_CMD_ID
          Restore history command id.
 
Constructor Summary
HistoryManager()
           
 
Method Summary
abstract  void clear(java.net.URL[] urls)
          Clear the history for objects located at the given URLs.
abstract  java.lang.Object[] getDeletions(java.net.URL url)
          Get object identifiers of all objects which have been deleted from within the descendant tree of the given root URL.
static HistoryManager getHistoryManager()
          Get the HistoryManager instance.
abstract  LocalState getLastState(java.lang.Object objId)
          Get the last local state for the object identified by the given ID.
abstract  LocalState[] getLocalHistory(java.lang.Object objId)
          Get all local history for the object identified by the given ID.
abstract  LocalState[] getLocalHistory(java.net.URL url)
          Get all local history for the object located at the given URL.
abstract  java.lang.Class getRegisteredHistorian(java.lang.Class objCls)
          Get a registered Historian implementation associated with a given object type.
abstract  boolean hasLocalHistory(java.net.URL url)
          Determine whether any previous history is available for the object located at the given URL.
abstract  void persist(java.net.URL[] urls, java.lang.String description)
          Persist the state of the objects located at the given URLs.
abstract  void persistInitialState(java.net.URL[] urls)
          Persist, as needed, the initial state of the objects located at the given URLs.
abstract  void registerHistorian(java.lang.Class historianCls, java.lang.Class objCls)
          Register a Historian implementation for association with a given object type.
abstract  void restore(LocalState[] states, Context context)
          Restore the given states.
static void setHistoryManager(HistoryManager historyManager)
          Set the HistoryManager instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESTORE_HISTORY_CMD

public static final java.lang.String RESTORE_HISTORY_CMD
Restore history command.

See Also:
Constant Field Values

RESTORE_HISTORY_CMD_ID

public static final int RESTORE_HISTORY_CMD_ID
Restore history command id.


RESTORE_HISTORY_RENAME_CMD

public static final java.lang.String RESTORE_HISTORY_RENAME_CMD
Restore history command.

See Also:
Constant Field Values

RESTORE_HISTORY_RENAME_CMD_ID

public static final int RESTORE_HISTORY_RENAME_CMD_ID
Restore history command id.

Constructor Detail

HistoryManager

public HistoryManager()
Method Detail

getHistoryManager

public static HistoryManager getHistoryManager()
Get the HistoryManager instance.

Returns:
the HistoryManager instance.

setHistoryManager

public static void setHistoryManager(HistoryManager historyManager)
Set the HistoryManager instance.

Parameters:
HistoryManager - the HistoryManager to use for future reference.

hasLocalHistory

public abstract boolean hasLocalHistory(java.net.URL url)
Determine whether any previous history is available for the object located at the given URL.

Parameters:
url - the location of the object for which history is to be queried.
Returns:
true if history is available.

getLocalHistory

public abstract LocalState[] getLocalHistory(java.net.URL url)
Get all local history for the object located at the given URL.

Parameters:
url - the location for which history is desired.
Returns:
an array of LocalState.

getLocalHistory

public abstract LocalState[] getLocalHistory(java.lang.Object objId)
Get all local history for the object identified by the given ID. This method allows for the fetching of local history for an object which has since been deleted and is thus no longer accessible via its former URL.

Parameters:
objId - object identifier as received from getDeletions.
Returns:
an array of LocalState.
See Also:
getDeletions(URL)

getLastState

public abstract LocalState getLastState(java.lang.Object objId)
Get the last local state for the object identified by the given ID.

Parameters:
objId - object identifier as received from getDeletions.
Returns:
the last LocalState available for a deleted object.
See Also:
getDeletions(URL)

getDeletions

public abstract java.lang.Object[] getDeletions(java.net.URL url)
Get object identifiers of all objects which have been deleted from within the descendant tree of the given root URL. If the given URL is null, then all deletions are returned.

Parameters:
url - the root under which descendant deletions are desired.
Returns:
an array of object identifiers.

persistInitialState

public abstract void persistInitialState(java.net.URL[] urls)
                                  throws java.lang.Exception
Persist, as needed, the initial state of the objects located at the given URLs. If no local history yet exists for an object, or if the last persisted state is older than the contents in storage, then a new state will be persisted based on the contents found in storage (i.e. on the file system) and using a descriptive caption such as "external state".

Parameters:
urls - location of objects whose contents are to be conditionally persisted.
Throws:
HistoryPersistenceException - upon failure.
java.lang.Exception

persist

public abstract void persist(java.net.URL[] urls,
                             java.lang.String description)
                      throws java.lang.Exception
Persist the state of the objects located at the given URLs.

This method is intended for use by a history generating operation such that state information for the objects located at the given URLs can be made available for later restoration. The classic example would be a Save command.

Typically this call would be preceded by a call to persistInitialState such that an initial state is assured to exist before persisting the current state.

For example; ... URL urls[] = ... HistoryManager mgr = HistoryManager.getHistoryManager(); mgr.persistInitialState(urls); // Persist initial state ... mgr.persist(urls, "my work"); // Persist changes made ...

Parameters:
urls - location of objects to be persisted.
description - text describing the cause of the persist (e.g. "Save").
Throws:
HistoryPersistenceException - upon failure.
java.lang.Exception

restore

public abstract void restore(LocalState[] states,
                             Context context)
                      throws java.lang.Exception
Restore the given states.

Parameters:
states - the states to restore.
context - the Context in which to restore the states.
Throws:
HistoryPersistenceException - upon failure.
java.lang.Exception

clear

public abstract void clear(java.net.URL[] urls)
Clear the history for objects located at the given URLs.

Parameters:
urls - location of objects whose history will be cleared.

registerHistorian

public abstract void registerHistorian(java.lang.Class historianCls,
                                       java.lang.Class objCls)
                                throws java.lang.IllegalArgumentException
Register a Historian implementation for association with a given object type. Only those object types for which a Historian has been registered will be persistable by the HistoryManager.

Parameters:
historianCls - an implementation of oracle.ide.history.Historian
objCls - an implementation for which history is supported.
Throws:
java.lang.IllegalArgumentException - if either argument is not of the expected type.

getRegisteredHistorian

public abstract java.lang.Class getRegisteredHistorian(java.lang.Class objCls)
                                                throws java.lang.IllegalArgumentException
Get a registered Historian implementation associated with a given object type.

Parameters:
objCls - an implementation for which history is supported.
Returns:
a Historian implementation.
Throws:
java.lang.IllegalArgumentException - if objCls is not of the expected type.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.