Oracle Warehouse Builder Java API Reference
10g Release 1 (10.1)

B12155-01

oracle.owb.metadatamgmt.changemgmt
Interface Snapshot


public interface Snapshot

Snapshot This interface represent a instance of Snapshot. Snapshot has two paradigms to traverse, one, Snapshot to Component and another Component to Snapshot Component to Snapshots traversal actually immitates version tree of component (All histories for a component). That traversal is realised in Snapshotable. Snapshot to Object actually realises a label concept of conventional versioing systems A repository may have multiple histories of projects containing ETL or Dimension models User can pick a label (Snapshot) and invoke operations on it or can traverse contents of this Snapshot. This interface realizes Snapshot to Object traversals. Snapshot to Object traversal entry point is Snapshot itself. Snapshot has many properties assciated with it, for e.g.time stamp, user who created this Snapshot. All these properties can be fetched. Furthermore, all actions on Snapshot are invoked through this interface. Some examples of Snapshot actions include Restore, Delete, Compare ...

Version:
1.0
Author:
Arun Manchanda (arun.manchanda@oracle.com)

Field Summary
static int FULL
          Snapshot Type constant, for component's entire metadata to be included in snapshot.
static int SIGNATURE
          Snapshot type constant, for components signature only to be included in snapshot.

 

Method Summary
 boolean add(Snapshotable comp)
          Alters Snapshot and enables users to add current definition component to this Snapshot.
 boolean add(Snapshotable[] comps)
          Alters Snapshot and enables users to add current definition of components to this Snapshot.
 void compare(Snapshot tgtSnap, java.lang.String diffFileName)
          This method computes difference between (tgtSnap - thisSnap) This method by default applies MCMServiceHandler.COMPARE_FILTER_CHANGED_OBJECT_ONLY for compare filter and MCMServiceHandler.OBJECTS_TYPE_FILTER_ANY_OBJECTS for object type filter.
 void compare(Snapshot tgtSnap, java.lang.String diffFileName, int compareFilter, int objTypeFilter)
          This method computes difference between (tgtSnap - thisSnap).
 boolean delete()
          Deletes this Snapshot.
 SnapshotComponentImage getComponentImageByUOID(java.lang.String uoid)
          Gets SnapshotComponentImage searched by UOID.
 SnapshotComponentImage[] getComponentImages()
          Gets components in this snapshot.
 java.util.Date getCreationDate()
          Gets this snapshot creation time stamp.
 java.lang.String getDescription()
          Gets the description of snapshot.
 java.lang.String getName()
          Gets snapshot name.
 java.lang.String getUOID()
          Gets snapshot UOID.
 boolean isModelConsistent()
          Checks if current state of repository model is consistent with snapshot.
 boolean isOfTypeFull()
          checks snapshot type.
 boolean isRestorableWithoutCascade()
          This method checks if this Snapshot would have valid legal container.
 boolean remove(SnapshotComponentImage comp)
          Alters Snapshot and enables users to remove component from this Snapshot.
 boolean remove(SnapshotComponentImage[] comps)
          Alters Snapshot and enables users to remove found components from this Snapshot.
 boolean replace(Snapshotable comp)
          Alters Snapshot and enables users to replace components in this Snapshot.
 boolean replace(Snapshotable[] comps)
          Alters Snapshot and enables users to replace components in this Snapshot.
 boolean restore()
          Restores this Snapshot and replaces current definition of components in repository with components contained in this Snapshot.
 boolean restore(SnapshotComponentImage[] comps)
          This perform partial restore action, and restores only specified components from this Snapshot.
 boolean restoreCascadeUp()
          Restores this Snapshot and replaces current definition of components in repository with components contained in this Snapshot.
 boolean restoreCascadeUp(SnapshotComponentImage[] comps)
          This perform partial restore action, and restores only specified components from this Snapshot.
 void setDescription(java.lang.String description)
          Specify the description of this snapshot.
 boolean shrink()
          Shrinks FULL Snapshot to SIGNATURE Snapshot.
 int size()
          Gets size of this snapshot.

 

Field Detail

FULL

public static final int FULL
Snapshot Type constant, for component's entire metadata to be included in snapshot.
See Also:
Constant Field Values

SIGNATURE

public static final int SIGNATURE
Snapshot type constant, for components signature only to be included in snapshot.
See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Gets snapshot name.
Returns:
Snapshot Name

getUOID

public java.lang.String getUOID()
Gets snapshot UOID.
Returns:
UOID of this Snapshot object.

restore

public boolean restore()
                throws SnapshotLockException,
RestoreException,
MCMException
Restores this Snapshot and replaces current definition of components in repository with components contained in this Snapshot. If this Snapshot contains multiple components, then if a component's restore action cannot find its parent in the repository, then whole operation fails and operation is undone, Atomicity of this action is entire restore completion
Returns:
true , if restore could be completed for all contained components, false otherwise
Throws:
SnapshotLockException - When components getting restored can not be locked or snapshot lock failed.
RestoreException - When Restore action can not be completed. One reason of restore failture could be illegal state of component's container, or component container can not be travered to. For e.g. if a Table's Snapshot is being restored, then its container module/project doesnt exist in repository.
MCMException - Any other error causing this operation to fail.

restoreCascadeUp

public boolean restoreCascadeUp()
                         throws SnapshotLockException,
RestoreException,
MCMException
Restores this Snapshot and replaces current definition of components in repository with components contained in this Snapshot. If this Snapshot contains multiple components, then if a component's restore action cannot find its container in the repository, then container objects are also restore by cascading up, Traversing up is stopped, when system detects restored component can be traserved.
Returns:
true , if restore could be completed for all contained components, false otherwise
Throws:
SnapshotLockException - When components getting restored can not be locked or snapshot lock failed.
RestoreException - When Restore action can not be completed.
MCMException - Any other error causing this operation to fail.

restore

public boolean restore(SnapshotComponentImage[] comps)
                throws SnapshotLockException,
RestoreException,
MCMException
This perform partial restore action, and restores only specified components from this Snapshot. It replaces components in repository with components from this Snapshot.
Parameters:
comps - partial list of snapshot components contained in this Snapshot, which needs to be restored.
Returns:
true, if partial list of components could be restored, false otherwise.
Throws:
SnapshotLockException - When components getting restored can not be locked or snapshot lock failed.
RestoreException - When Restore action can not be completed. One reason of restore failture could be illegal state of component's container, or component container can not be traversed to. For e.g. if a Table's Snapshot is being restored, then if its container module/project does not exist in repository, this exception is thrown.
MCMException - Any other error causing this operation to fail.

restoreCascadeUp

public boolean restoreCascadeUp(SnapshotComponentImage[] comps)
                         throws SnapshotLockException,
RestoreException,
MCMException
This perform partial restore action, and restores only specified components from this Snapshot. It replaces components in repository with components from this Snapshot. If components getting restore can not find their container in repository, it restore container object
Parameters:
comps - partial list of component contained in this Snapshot, which needs to be restored.
Returns:
true, if partial list of components could be restored, false otherwise.
Throws:
SnapshotLockException - When components getting restored can not be locked or snapshot lock failed.
RestoreException - When Restore action can not be completed.
MCMException - Any other error causing this operation to fail.

isRestorableWithoutCascade

public boolean isRestorableWithoutCascade()
                                   throws MCMException
This method checks if this Snapshot would have valid legal container. This state can be illegal, for restore action, since even after restore, if component's container is not found in repository then there is no way, this restored component can be navigated to. This is also referred to as an orphan child, which is Illegal state in repository. For e.g. If Oracle Schema has Table T1 and there is snapshot on T1 labeled as PRODUCTION, if T1 is deleted, then it is okay, since restore PRODUCTION version will have valid container, Module in this case. In different scenario, if Module is deleted, then table T1 is also deleted from repository Deleting a component, does not delete its Snapshots, since it represents History point in time, But restoring PRODUCTION snapshot of T1 would have container less components, which is not legal state in repository, If a Snapshot exist for Module, then PRODUCTION of T1 can actually be restored, if Module is restore from another Snapshot. This method provides sanity check, whether Snapshot restore would have valid container or not, infact this is called internally by Restore action also, and in case of Illegal Container State, Restore action throws Exception. If this Snapshot has multiple components, then each component's container validity checked.
Returns:
true, if Snapshot's components has valid container in repository, false otherwise.
Throws:
MCMException - Any other error causing this operation to fail.

delete

public boolean delete()
               throws SnapshotDelException,
MCMException
Deletes this Snapshot. This action deletes entire Snapshot contents, and deletes this Snapshot from history.
Returns:
true, if Snapshot is deleted, false otherwise.
Throws:
SnapshotDelException - When snapshot deletion couldnt be completed.
MCMException - Any other error causing this operation to fail.

compare

public void compare(Snapshot tgtSnap,
                    java.lang.String diffFileName,
                    int compareFilter,
                    int objTypeFilter)
             throws CompareException,
MCMException
This method computes difference between (tgtSnap - thisSnap).
Parameters:
tgtSnap - Target Snapshot with which this Snapshot will be compared
diffFileName - File name where diff XML would be stored
compareFilter - Valid filter values are defined in MCMServiceHandler for example MCMServiceHandler.COMPARE_FILTER_FOUND_OBJECTS_IN_TARGET_ONLY , MCMServiceHandler.COMPARE_FILTER_FOUND_OBJECTS_IN_SOURCE_ONLY ... All compare filters are prefixed with COMPARE_FILTER
objTypeFilter - - This filters is on object types in diff, Using this filter only Logical or Physical objects can be put in generated diff file. for e.g. MCMServiceHandler.OBJECT_TYPE_FILTER_LOGICAL_OBJECT_ONLY All object type filters are prefixed with OBJECT_TYPE_FILTER
Throws:
CompareException - When snapshots couldnt be compared.
MCMException - Any other error causing this operation to fail.

compare

public void compare(Snapshot tgtSnap,
                    java.lang.String diffFileName)
             throws CompareException,
MCMException
This method computes difference between (tgtSnap - thisSnap) This method by default applies MCMServiceHandler.COMPARE_FILTER_CHANGED_OBJECT_ONLY for compare filter and MCMServiceHandler.OBJECTS_TYPE_FILTER_ANY_OBJECTS for object type filter. Applying these default filters would imply, diff report will contain all changed objects and will include all logical and physical objects.
Parameters:
tgtSnap - Target Snapshot with which this Snapshot will be compared
diffFileName - File name where diff XML would be stored
Throws:
CompareException - When snapshots couldnt be compared.
MCMException - Any other error causing this operation to fail.

size

public int size()
Gets size of this snapshot.
Returns:
count of components contained in this Snapshot

getCreationDate

public java.util.Date getCreationDate()
Gets this snapshot creation time stamp.
Returns:
Date, when this Snapshot was created

isOfTypeFull

public boolean isOfTypeFull()
checks snapshot type.
Returns:
true if it is FULL Snapshot type, containing entire metadata of component, false if is of type SIGNATURE.

getComponentImages

public SnapshotComponentImage[] getComponentImages()
                                            throws MCMException,
ClassDefNotFoundException
Gets components in this snapshot.
Returns:
component containted in this snapshot.
Throws:
ClassDefNotFoundException - When MetaModel can not find class of a component.
MCMException - Any other error causing this operation to fail.

getComponentImageByUOID

public SnapshotComponentImage getComponentImageByUOID(java.lang.String uoid)
                                               throws MCMException,
ClassDefNotFoundException
Gets SnapshotComponentImage searched by UOID.
Parameters:
uoid - UOID of component.
Returns:
component contents of this snapshot.
Throws:
ClassDefNotFoundException - When MetaModel can not find class of a component.
MCMException - Any other error causing this operation to fail.

shrink

public boolean shrink()
               throws SnapshotConvertException,
MCMException
Shrinks FULL Snapshot to SIGNATURE Snapshot. This is one way operation, should be done with care since this conversion is irreversible. Once Snapshot is converted to light, Snapshot can neither be restored, nor can be exported. This method is only for admin functions, when admin wants to reduce repository size and only wants to keep history for comparison purposes
Returns:
true, if this Snapshot is FULL type and can be converted into SIGNATURE, false otherwise.
Throws:
SnapshotConvertException - When Snapshot.shrink action can not be completed.
MCMException - Any other error causing this operation to fail.

add

public boolean add(Snapshotable[] comps)
            throws SnapshotLockException,
SnapshotUpdateException,
MCMException
Alters Snapshot and enables users to add current definition of components to this Snapshot. If any component can not be added to this Snapshot, for e.g. Component already exist ? then exception is thrown.
Parameters:
comps - Components which needs to be added to this Snapshot
Returns:
true if could add, false otherwise.
Throws:
SnapshotLockException - When components getting added can not be locked or this snapshot lock operation failed.
SnapshotUpdateException - When Snapshot update operation (add components) couldnt be completed.
MCMException - Any other error causing this operation to fail.

add

public boolean add(Snapshotable comp)
            throws SnapshotLockException,
SnapshotUpdateException,
MCMException
Alters Snapshot and enables users to add current definition component to this Snapshot.
Parameters:
comp - Component which needs to be added to this Snapshot
Returns:
true, if component could be added to Snapshot , false otherwise.
Throws:
SnapshotLockException - When component getting added can not be locked or this snapshot lock operation failed.
SnapshotUpdateException - When Snapshot update operation (add a component) couldnt be completed. One reason could be Snapshot already has this component , which is being added.
MCMException - Any other error causing this operation to fail.

remove

public boolean remove(SnapshotComponentImage[] comps)
               throws SnapshotLockException,
SnapshotUpdateException,
MCMException
Alters Snapshot and enables users to remove found components from this Snapshot.
Parameters:
comps - Components which needs to be removed from this Snapshot
Returns:
true if could remove, false otherwise.
Throws:
SnapshotLockException - When components getting removed can not be locked or this snapshot lock operation failed.
SnapshotUpdateException - When Snapshot update operation (remove components) couldnt be completed.
MCMException - Any other error causing this operation to fail.

remove

public boolean remove(SnapshotComponentImage comp)
               throws SnapshotLockException,
SnapshotUpdateException,
MCMException
Alters Snapshot and enables users to remove component from this Snapshot.
Parameters:
comp - Component which needs to be removed from this Snapshot
Returns:
true, if component could be removed from Snapshot , false otherwise.
Throws:
SnapshotLockException - When component getting removed can not be locked or this snapshot lock operation failed.
SnapshotUpdateException - When Snapshot update operation (remove a component) couldnt be completed.
MCMException - Any other error causing this operation to fail.

replace

public boolean replace(Snapshotable[] comps)
                throws SnapshotLockException,
SnapshotUpdateException,
MCMException
Alters Snapshot and enables users to replace components in this Snapshot.
Parameters:
comps - Components which needs to be replaced in this Snapshot
Returns:
true, if could replace, false otherwise.
Throws:
SnapshotLockException - When components getting replaces can not be locked or this snapshot lock operation failed.
SnapshotUpdateException - When Snapshot update operation (replace components) couldnt be completed.
MCMException - Any other error causing this operation to fail.

replace

public boolean replace(Snapshotable comp)
                throws SnapshotLockException,
SnapshotUpdateException,
MCMException
Alters Snapshot and enables users to replace components in this Snapshot.
Parameters:
comp - Component which needs to be added to this Snapshot
Returns:
true, if component could be replaced in this Snapshot , false otherwise.
Throws:
SnapshotLockException - When component getting replaces can not be locked or this snapshot lock operation failed.
SnapshotUpdateException - When Snapshot update operation (replace a component) couldnt be completed.
MCMException - Any other error causing this operation to fail.

getDescription

public java.lang.String getDescription()
Gets the description of snapshot.
Returns:
description of this Snapshot.
See Also:
setDescription(java.lang.String)

setDescription

public void setDescription(java.lang.String description)
                    throws SnapshotUpdateException,
MCMException
Specify the description of this snapshot.
Parameters:
description - for this Snapshot.
Throws:
SnapshotUpdateException - When Snapshot update operation (set a new description) couldnt be completed.
MCMException - Any other error causing this operation to fail.
See Also:
getDescription()

isModelConsistent

public boolean isModelConsistent()
                          throws MCMException
Checks if current state of repository model is consistent with snapshot.
Returns:
true, if snapshot and repository model states are consistent, false otherwise.
Throws:
MCMException - When this operation can not be completed sucessfully.

Oracle Warehouse Builder Java API Reference
10g Release 1 (10.1)

B12155-01

Copyright © 2003, Oracle. All Rights Reserved.