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

B12155-01

oracle.owb.metadatamgmt.changemgmt
Class SnapshotFactory

java.lang.Object
  |
  +--oracle.owb.metadatamgmt.changemgmt.SnapshotFactory

public class SnapshotFactory
extends java.lang.Object

This is singleton instance to manage Snapshot. This factory provides accessor methods to get to all snapshots currently existing in repository. The Factory also provides methods to create snapshots, for given Snapshotable components existing in repository.

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

Field Summary
static int AFTER_DATE
          Date marker to get Snapshots after certain date.
static int BEFORE_DATE
          Date marker to get Snapshots before certain date.
static int ON_DATE
          Date marker to get Snapshots on certain date.

 

Method Summary
 Snapshot createSnapshot(Snapshotable[] comps, int type, java.lang.String name, java.lang.String desc)
          Creates Snapshot of components, Any invalid component on which Snapshot can not be taken would fail whole operation.
 Snapshot createSnapshot(Snapshotable object, int type, java.lang.String name, java.lang.String desc)
          Creates Snapshot for a given component.
 Snapshot createSnapshotWithDependeeComponents(Snapshotable[] comps, int type, java.lang.String name, java.lang.String desc, int depth)
          This method takes current definition of component and creates a new Snapshot.
static SnapshotFactory getInstance()
          Gets factory instance of snapshot factory.
 Snapshot[] getSnapshot()
          Gets all Snapshot objects existing in repository.
 Snapshot[] getSnapshot(java.util.Date fromDate, java.util.Date toDate, java.lang.String[] userName)
          Gets all Snapshot within a time period, All Snapshot created between fromDate toDate.
 Snapshot[] getSnapshot(java.util.Date date, int action, java.lang.String[] userName)
          Gets all Snapshot with respect to time stamp.
 Snapshot getSnapshot(java.lang.String name)
          Gets Snapshot object with given name This traversal implies Snapshot to Object paradigm.
 Snapshot[] getSnapshot(java.lang.String[] users)
          Gets all Snapshot instances created by specified user.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

BEFORE_DATE

public static final int BEFORE_DATE
Date marker to get Snapshots before certain date.
See Also:
Constant Field Values

AFTER_DATE

public static final int AFTER_DATE
Date marker to get Snapshots after certain date.
See Also:
Constant Field Values

ON_DATE

public static final int ON_DATE
Date marker to get Snapshots on certain date.
See Also:
Constant Field Values
Method Detail

getInstance

public static final SnapshotFactory getInstance()
Gets factory instance of snapshot factory.
Returns:
Singleton instance of this factory.

createSnapshot

public Snapshot createSnapshot(Snapshotable[] comps,
                               int type,
                               java.lang.String name,
                               java.lang.String desc)
                        throws java.lang.IllegalArgumentException,
SnapshotNameConflictException,
SnapshotLockException,
SnapshotCreationException,
MCMException
Creates Snapshot of components, Any invalid component on which Snapshot can not be taken would fail whole operation. This method enables client to take Snapshot on collection of components together as one unit. For e.g. two maps and its dependee diemsnions can be put together in one snapshot. This snapshot would be treated as one collection of all components, which can be restored, deleted as one single unit. Since this method takes in an array of components , then passing in one object handle would make it behave like Snapshotable.createSnapshot which works on one component alone. Snapshot behaves like one label to collect multiple objects in it, or if Snapshot is taken on single component then Snapshot name identifies a history point for that component alone, which is analogous to having a version of that component. These two concepts coexist and can be used interchangbly. To illustrate, this with example, consider a snapshot called PRODUCTION on mapping A, This PRODUCTION label on mapping A behaves like a version of mapping taken at certain point in history. Snapshot with same name PRODUCTION is taken on Table Object B. Then another snapshot is taken on mapping A called SHIPPED. Snapshots can be traversed in two paradigms, namely Component to Snapshot and vice-versa . When object (mapping A for e.g.) traverse to all its snapshot , it can traverse to PRODUCTION and SHIPPED Snapshots. This is called Component to Snapshot traversal.If traversal is made from Snapshot to Component, for e.g. `show contents of snapshot named PRODUCTION` , then two object mapping A and table B act as one collection and all operations on this Snapshot object would be perform on this collection/set of components together. Creating table B with snapshot name PRODUCTION behaves like altering snapshot PRODUCTION and adding object B to this Snapshot (Snapshot to Component paradigm).
Parameters:
comps - Array of Snapshotable instance of components.
type - Type of snapshot, constant defined in Snapshot , The only valid value is Snapshot.FULL and Snapshot.SIGNATURE. Type flag is applied to all components, wherever it is applicable.
name - Name of Snapshot, This name idenfies a history point for a component or collection of components.
desc - Description of snapshot.
Returns:
Snapshot instance representing operation success.
Throws:
java.lang.IllegalArgumentException - When invalid name or type is used.
SnapshotNameConflictException - When Snapshot object with given name already exists.
SnapshotLockException - When lock on component couldnt be obtained.
SnapshotCreationException - When Snapshot couldnt be created.
MCMException - Any other error causing this operation to fail.

createSnapshot

public Snapshot createSnapshot(Snapshotable object,
                               int type,
                               java.lang.String name,
                               java.lang.String desc)
                        throws java.lang.IllegalArgumentException,
SnapshotNameConflictException,
SnapshotLockException,
SnapshotCreationException,
MCMException
Creates Snapshot for a given component.
Parameters:
object - Snapshotable Component.
type - Type of snapshot, constant defined in Snapshot , The only valid value is Snapshot.FULL and Snapshot.SIGNATURE.
name - Name of Snapshot, This name idenfies a history point for a component.
desc - Description of snapshot, can be null also.
Returns:
Snapshot instance representing operation success.
Throws:
java.lang.IllegalArgumentException - When invalid name or type is used.
SnapshotNameConflictException - When Snapshot object with given name already exists.
SnapshotLockException - When lock on component couldnt be obtained.
SnapshotCreationException - When Snapshot couldnt be created.
MCMException - Any other error causing this operation to fail.

createSnapshotWithDependeeComponents

public Snapshot createSnapshotWithDependeeComponents(Snapshotable[] comps,
                                                     int type,
                                                     java.lang.String name,
                                                     java.lang.String desc,
                                                     int depth)
                                              throws java.lang.IllegalArgumentException,
SnapshotNameConflictException,
SnapshotLockException,
SnapshotCreationException,
MCMException
This method takes current definition of component and creates a new Snapshot. This method also traverse the cross component associations, and takes all dependee components of this component to be part of Snapshot. For e.g. Mapping component operators points to real entities. So this method along with Mapping , takes all operator's bound real entities to be included in this Snapshot Pre-Requisites : Component available to lock with in this method, And Component's dependee's also should be available to lock.
Parameters:
comps - Array of Snapshotable instance of components.
type - - Type of snapshot, constant defined in Snapshot Only valid options are Snapshot.FULL or Snapshot.SIGNATURE
name - Name of Snapshot.
desc - Description of snapshot.
depth - - terminal binding level. For e.g. Table A's FK points to another Table B's UK and B has FK pointing to C's UK, and C's FK points to D's UK Then Snapshot on A with depth 2 will include A, B, C Snapshot on A with depth 1 with include A, B Max depth allowed is Snapshotable.MAX_DEPENDENCY_DEPTH . To sepecify all depdendencies Snapshotable.MAX_DEPENDENCY_DEPTH constant should be used.
Returns:
the created Snapshot object.
Throws:
java.lang.IllegalArgumentException - When invalid name or type is used.
SnapshotNameConflictException - When Snapshot object with given name already exists.
SnapshotLockException - When lock on component couldnt be obtained.
SnapshotCreationException - When Snapshot couldnt be created.
MCMException - Any other error causing this operation to fail.

getSnapshot

public Snapshot[] getSnapshot()
                       throws MCMException
Gets all Snapshot objects existing in repository. This implies Snapshot to Object paradigm traversal. If Snapshot name exist on multiple components then single Snapshot object is returned and its contents will be all those components.
Returns:
Snapshot[] All Snapshot instances currently existing in repository
Throws:
MCMException - When this operation can not be completed.

getSnapshot

public Snapshot getSnapshot(java.lang.String name)
                     throws MCMException
Gets Snapshot object with given name This traversal implies Snapshot to Object paradigm. If Snapshot name exist on multiple components then single Snapshot object is returned and its contents will be all those components.
Parameters:
name - Name of Snapshot.
Returns:
Snapshot instance for given name, currently existing in repository
Throws:
MCMException - When this operation can not be completed.

getSnapshot

public Snapshot[] getSnapshot(java.lang.String[] users)
                       throws MCMException
Gets all Snapshot instances created by specified user.
Parameters:
users - All Snapshots created by specified users are returned.
Returns:
All Snapshot created by given list of users.
Throws:
MCMException - When this operation can not be completed.

getSnapshot

public Snapshot[] getSnapshot(java.util.Date date,
                              int action,
                              java.lang.String[] userName)
                       throws java.lang.IllegalArgumentException,
MCMException
Gets all Snapshot with respect to time stamp.
Parameters:
date - Date object represent a point in time.
action - takes SnapshotFactory.BEFORE_DATE or SnapshotFactory.AFTER_DATE
userName - Along with time stamp, userName becomes another filter. if userName is null , then all users Snapshots are returned.
Returns:
Snapshot instances
Throws:
java.lang.IllegalArgumentException - When invalid date action is used to filter Snapshots.
MCMException - When this operation can not be completed.

getSnapshot

public Snapshot[] getSnapshot(java.util.Date fromDate,
                              java.util.Date toDate,
                              java.lang.String[] userName)
                       throws MCMException
Gets all Snapshot within a time period, All Snapshot created between fromDate toDate.
Parameters:
fromDate - Date object representing FROM point in time.
toDate - Date object representing TO point in time
userName - Along with time stamp, userName becomes another filter. if userName is null , then userName is ignored.
Returns:
Snapshot All snapshot between FROM and TO time period.
Throws:
MCMException - When this operation can not be completed.

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

B12155-01

Copyright © 2003, Oracle. All Rights Reserved.