oracle.sysman.dbTarget.db.changemgr.emo.cpapi
Class ChangeItem

java.lang.Object
  extended by oracle.sysman.dbTarget.db.changemgr.emo.cpapi.ChangeItemInfo
      extended by oracle.sysman.dbTarget.db.changemgr.emo.cpapi.ChangeItem

public class ChangeItem
extends ChangeItemInfo

A ChangeItem represents the changes to be made with regard to a single database object at the destination database(s). It includes the defintion of the object or the changes to the object, and the methods that store and update those definitions.

The definitions are stored as SXML documents. SXML is an Oracle-defined XML format for representation of metadata. Diff SXML is SXML that contains attributes to indicate differences between two objects. For Modify change items, Diff SXML indicates the changes to be made to the database object.

See Also:
Functional Specification for Data Pump Metadata API SXML, RDBMS, 11gR2

Field Summary
 
Fields inherited from class oracle.sysman.dbTarget.db.changemgr.emo.cpapi.ChangeItemInfo
CLUSTER, CP_ADD, CP_DROP, CP_MODIFY, CP_MONITOR, CP_NO_ACTION, DB_LINK, FUNCTION, INDEX, MATERIALIZED_VIEW, MATERIALIZED_VIEW_LOG, MAX_DESCRIPTION_LENGTH, PACKAGE, PACKAGE_BODY, PACKAGE_SPEC, PROCEDURE, PROFILE, ROLE, ROLLBACK_SEGMENT, SEQUENCE, SYNONYM, TABLE, TABLESPACE, TRIGGER, TYPE, USER, VIEW
 
Constructor Summary
ChangeItem(int itemAction, java.lang.String typeName, java.lang.String objectName, java.lang.String objectSchema, java.lang.String description, oracle.xml.parser.v2.XMLDocument origDefn, oracle.xml.parser.v2.XMLDocument revisedDefn, XMLAccessorClient client)
          Creates a ChangeItem for a database object.
 
Method Summary
 void convertChangeItem(int newAction, oracle.xml.parser.v2.XMLDocument revisedDefn, XMLAccessorClient client)
          Converts a change item from one action type to another When converting CP_MONITOR to CP_MODIFY, compares the revised definition to the original definition stored with the change item, and stores the resulting Diff SXML document in the change item.
 java.util.Vector getAllowedNewActions()
          Lists the Change Item action types to which this Change Item can be converted.
 java.lang.String getDDL(XMLAccessorClient client)
          Returns DDL that represents the change(s) specified by this change item.
 oracle.xml.parser.v2.XMLDocument getDefinition()
          Gets the SXML document contained in this change item.
 oracle.xml.parser.v2.XMLDocument getOriginalDefinition()
          Gets the SXML document for the original definition of the object that is being modified by this change item.
 oracle.xml.parser.v2.XMLDocument getRevisedDefinition()
          Gets the SXML document for the revised definition of the object that is being modified by this change item.
 boolean newActionAllowed(int newAction)
          Indicates whether this ChangeItem's action can be converted to the specified different Change Item action.
 java.lang.String toString()
           
 ApplyOneDiffResult[] updateDefinition(oracle.xml.parser.v2.XMLDocument revisedDefn, XMLAccessorClient client)
          Updates the object definition associated with this change item, using default conflict resolution rules.
 ApplyOneDiffResult[] updateDefinition(oracle.xml.parser.v2.XMLDocument revisedDefn, XMLAccessorClient client, ApplyDiffListener adl)
          Updates the object definition associated with this change item.
 
Methods inherited from class oracle.sysman.dbTarget.db.changemgr.emo.cpapi.ChangeItemInfo
getClientSourceDatabase, getDescription, getEntMgrSourceDatabase, getGlobalSourceDatabase, getItemAction, getItemDisplayName, getObjectName, getObjectSchema, getObjectType, getObjectTypeCode, setClientSourceDatabase, setDescription, setEntMgrSourceDatabase, setGlobalSourceDatabase, setItemAction, setObjectName, setObjectSchema, setObjectType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChangeItem

public ChangeItem(int itemAction,
                  java.lang.String typeName,
                  java.lang.String objectName,
                  java.lang.String objectSchema,
                  java.lang.String description,
                  oracle.xml.parser.v2.XMLDocument origDefn,
                  oracle.xml.parser.v2.XMLDocument revisedDefn,
                  XMLAccessorClient client)
           throws ChangePlanAccessException
Creates a ChangeItem for a database object.

Parameters:
itemAction - Change item's action. (See the setItemAction method)
typeName - The object type name, one of:
  • CLUSTER
  • DB_LINK
  • FUNCTION
  • INDEX
  • MATERIALIZED_VIEW
  • MATERIALIZED_VIEW_LOG
  • PACKAGE
  • PROCEDURE
  • SEQUENCE
  • SYNONYM
  • TABLE
  • TRIGGER
  • TYPE
  • VIEW
  • PROFILE
  • ROLE
  • TABLESPACE
  • USER
objectName - the object name (for materialized view logs, the master table name)
objectSchema - the object schema
description - description of the change item (limited to MAX_DESCRIPTION_LENGTH characters)
origDefn - the original SXML definition of the object:
  • For CP_ADD change items, the definition of the object to be added at the destination database(s)
  • For CP_MODIFY change items, the starting definition of the object to be modified at the destination database(s)
  • For CP_DROP change items, the definition of the object to be dropped from the destination database(s) (optional; if supplied, used for conflict detection during deployment)
  • For CP_MONITOR change items, the definition of the object to be monitored in the development database.
revisedDefn - the revised SXML definition of the object; optional for CP_MODIFY change items and ignored for other action types. If supplied, revisedDefn is compared to origDefn; the differences between them describe the changes to be made at the destination database(s). If revisedDefn is not supplied for CP_MODIFY change items, the updateDefinition(oracle.xml.parser.v2.XMLDocument, oracle.sysman.dbTarget.db.changemgr.emo.docaccess.XMLAccessorClient) method must be used later to supply a revised definition.
client - XMLAccessorClient object, needed to support object comparison
Throws:
ChangePlanAccessException - if the typeName does not specify one of the schema object types, or if the revisedDefn argument is non-null for the CP_ADD or CP_DROP action type.
Method Detail

getDefinition

public oracle.xml.parser.v2.XMLDocument getDefinition()
Gets the SXML document contained in this change item.

Returns:
an XMLDocument with the SXML for this change item, or null.

getOriginalDefinition

public oracle.xml.parser.v2.XMLDocument getOriginalDefinition()
Gets the SXML document for the original definition of the object that is being modified by this change item. (For CP_ADD and CP_DROP change items, this method is identical to getDefinition().)

Returns:
an XMLDocument with the SXML for this change item, or null.

getRevisedDefinition

public oracle.xml.parser.v2.XMLDocument getRevisedDefinition()
Gets the SXML document for the revised definition of the object that is being modified by this change item. (For CP_ADD, CP_DROP, and CP_MONITOR change items, this method is identical to getDefinition().) The difference between this method and getDefinition is that, for CP_MODIFY change items, this method returns SXML with no difference attributes.

Returns:
an XMLDocument with the SXML for this change item, or null.

updateDefinition

public ApplyOneDiffResult[] updateDefinition(oracle.xml.parser.v2.XMLDocument revisedDefn,
                                             XMLAccessorClient client)
                                      throws ChangePlanAccessException
Updates the object definition associated with this change item, using default conflict resolution rules.

Throws:
ChangePlanAccessException

updateDefinition

public ApplyOneDiffResult[] updateDefinition(oracle.xml.parser.v2.XMLDocument revisedDefn,
                                             XMLAccessorClient client,
                                             ApplyDiffListener adl)
                                      throws ChangePlanAccessException
Updates the object definition associated with this change item. The exact action depends on the type of change item: NOTE: As this class evolves, this method may return a more complex object to represent a conflict. Also, it may become possible to handle conflicts as they arise through a client-supplied conflict resolver that is called each time a conflict is encountered.

Parameters:
revisedDefn - the revised SXML definition of the object
client - XMLAccessorClient object
adl - an ApplyDiffListener instance. If supplied, its applyDiffResult() method is called to report and if necessary, resolve conflicts for each difference applied.
Returns:
an array of messages, each of which describes a conflict. If there are no conflicts, and for all ADD and DROP change items, null is returned.
Throws:
ChangePlanAccessException

convertChangeItem

public void convertChangeItem(int newAction,
                              oracle.xml.parser.v2.XMLDocument revisedDefn,
                              XMLAccessorClient client)
                       throws ChangePlanAccessException
Converts a change item from one action type to another

Parameters:
newAction - One of:
  • CP_MODIFY
  • CP_DROP
  • CP_MONITOR
revisedDefn - the revised SXML definition of the object (ignored when not converting to CP_MODIFY)
client - XMLAccessorClient object
Throws:
ChangePlanAccessException - if the newAction argument is not appropriate for this type of change item.

newActionAllowed

public boolean newActionAllowed(int newAction)
Indicates whether this ChangeItem's action can be converted to the specified different Change Item action.

Parameters:
newAction - One of:
  • CP_ADD
  • CP_MODIFY
  • CP_DROP
  • CP_MONITOR
Returns:
true if this Change Item can be converted to the specified newAction, false otherwise. Drop-type change items can be converted to Monitor only if they they have an associated object definition.

getAllowedNewActions

public java.util.Vector getAllowedNewActions()
Lists the Change Item action types to which this Change Item can be converted.

Returns:
a Vector of Integer objects, each containing the value of a Change Item action (CP_ADD, CP_MODIFY etc.)

getDDL

public java.lang.String getDDL(XMLAccessorClient client)
                        throws ChangePlanAccessException
Returns DDL that represents the change(s) specified by this change item.

Parameters:
client - XMLAccessorClient object
Returns:
  • for an Add or Monitor change item, the CREATE DDL
  • for a Modify change item, one or more ALTER statements; or, if the changes cannot be done with ALTERs, a DROP statement followed by a CREATE statement
  • for a Drop change item, the DROP DDL
Throws:
ChangePlanAccessException - if the Add, Modify or Monitor change item does not have an associated definition, or if no XMLAccessorClient has been set for the owning Change Plan.

toString

public java.lang.String toString()
Overrides:
toString in class ChangeItemInfo