oracle.sysman.dbTarget.db.changemgr.emo.docaccess
Class XMLAccessor

java.lang.Object
  extended by oracle.sysman.dbTarget.db.changemgr.emo.docaccess.XMLAccessor
Direct Known Subclasses:
XMLColumnAccessor, XMLGranteeAccessor, XMLOnePartitionAccessor, XMLPartitionsAccessor, XMLProfileAccessor, XMLRbSegmentAccessor, XMLSchemaObjAccessor, XMLTableConstraintsAccessor, XMLTablespaceAccessor, XMLTSDatafileAccessor

public abstract class XMLAccessor
extends java.lang.Object

XMLAccessor is the base class for a set of classes that provide access to the contents of SXML documents. An SXML document represents the definition of a specific database object, for example TABLE SCOTT.EMP. You can:


Field Summary
static int DDL_ALTER_LEFT_TO_RIGHT
          Argument to getDDL() requesting DDL that changes the left side to the right side.
static int DDL_ALTER_RIGHT_TO_LEFT
          Argument to getDDL() requesting DDL that changes the right side to the left side.
static int DDL_CREATE_LEFT
          Argument to getDDL() requesting left-side Create DDL.
static int DDL_CREATE_RIGHT
          Argument to getDDL() requesting right-side Create DDL.
static int DDL_DROP
          Argument to getDDL() requesting DDL that drops the object.
static java.lang.String DIFF_NODES_PATTERN
           
static java.lang.String MDAPI_CLUSTER
          DBMS_METADATA name for Cluster objects
static java.lang.String MDAPI_DB_LINK
          DBMS_METADATA name for Database Link objects
static java.lang.String MDAPI_FUNCTION
          DBMS_METADATA name for Function objects
static java.lang.String MDAPI_INDEX
          DBMS_METADATA name for Index objects
static java.lang.String MDAPI_MATERIALIZED_VIEW
          DBMS_METADATA name for Materialized View objects
static java.lang.String MDAPI_MATERIALIZED_VIEW_LOG
          DBMS_METADATA name for Materialized View Log objects
static java.lang.String MDAPI_PACKAGE
          DBMS_METADATA name for Package objects (Specification and Body)
static java.lang.String MDAPI_PACKAGE_BODY
          DBMS_METADATA name for Package Body objects
static java.lang.String MDAPI_PACKAGE_SPEC
          DBMS_METADATA name for Package Specification objects
static java.lang.String MDAPI_PROCEDURE
          DBMS_METADATA name for Procedure objects
static java.lang.String MDAPI_PROFILE
          DBMS_METADATA name for Profile objects
static java.lang.String MDAPI_ROLE
          DBMS_METADATA name for Role objects
static java.lang.String MDAPI_ROLLBACK_SEGMENT
          DBMS_METADATA name for Rollback Segment objects
static java.lang.String MDAPI_SEQUENCE
          DBMS_METADATA name for Sequence objects
static java.lang.String MDAPI_SYNONYM
          DBMS_METADATA name for Synonym objects
static java.lang.String MDAPI_TABLE
          DBMS_METADATA name for Table objects
static java.lang.String MDAPI_TABLESPACE
          DBMS_METADATA name for Tablespace objects
static java.lang.String MDAPI_TRIGGER
          DBMS_METADATA name for Trigger objects
static java.lang.String MDAPI_TYPE
          DBMS_METADATA name for Type objects
static java.lang.String MDAPI_USER
          DBMS_METADATA name for User objects
static java.lang.String MDAPI_VIEW
          DBMS_METADATA name for View objects
 
Method Summary
 ApplyOneDiffResult[] applyDiffs(oracle.xml.parser.v2.XMLDocument diffDoc)
          Applies the differences contained in a Diff SXML document to the SXML document contained in the XMLAccessor object.
 void applySchemaMap(java.util.HashMap schemaMap)
           
 void applySchemaMap(java.util.HashMap schemaMap, int changeMode)
           
 boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn)
          Compares an XML document to the XML document contained in the accessor.
 boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn, boolean mutateDefn)
          Compares an XML document to the XML document contained in the accessor.
 boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn, boolean mutateDefn, java.util.HashMap schemaMap)
          Compares an XML document to the XML document contained in the accessor.
 boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn, java.util.HashMap schemaMap)
          Compares an XML document to the XML document contained in the accessor.
static CMXSLTransformInfo createXslTransformInfo(int transform, int objType, java.lang.String xslRoot, javax.servlet.ServletContext context)
           
 java.lang.String generateDDL(int transform, int transformParams)
          Methods for transforming XML - primarily XML-to-DDL.
 java.lang.String generateDDL(int transform, int transformParams, java.lang.String xslRoot)
           
 java.lang.String generateDDL(int transform, int transformParams, oracle.xml.parser.v2.XMLDocument theDoc)
           
 java.lang.String[] generateDDLs(int transformParams)
           
 boolean getAppendStatistics()
          Indicates whether statistics DBMS_STATS calls are appended to create and alter DDL for objects that have statistics.
 int getChangeMode()
          Returns the "change mode", which determines whether changes are made in place (by replacing values, removing or inserting nodes etc.) or in the form of Diff SXML (by annotating nodes as added or modified, saving old values and deleted nodes, etc.
static java.lang.String getColumnName(org.w3c.dom.Node col)
           
 java.lang.String getDDL(int ddlType)
          Returns DDL for the object.
 java.lang.String getDDL(int ddlType, java.util.HashMap schemaMap)
           
 java.lang.String getDDL(int ddlType, java.util.HashMap schemaMap, boolean forExecution)
          Returns DDL for the object.
 java.lang.String getDDLForExecution(int ddlType)
           
 java.lang.String getDDLForExecution(int ddlType, java.util.HashMap schemaMap)
           
 oracle.xml.parser.v2.XMLDocument getDifferencesDocument()
          Returns the differences document produced by the most recent compareDefinition() call, or null if there has been no compareDefinition() call.
 oracle.xml.parser.v2.XMLDocument getDocument()
          Provides public access to the XMLDocument for objects that contain top-level definitions.
 java.lang.String getDropDDL()
           
 java.lang.String getName()
           
 java.lang.String getQuotedFullName()
           
 java.lang.String getQuotedName()
           
 oracle.xml.parser.v2.XMLDocument getSXMLDocFromDB(CMConnection dbConn, java.lang.String mdapiType, java.lang.String objSchema, java.lang.String objName, boolean forDiffing)
          Methods for retrieving XML metadata definitions from databases and baselines.
static XMLAccessor getXMLAccessorForType(int type, XMLAccessorClient client)
          Returns an uninitialized accessor for the specified database object type.
static XMLAccessor getXMLAccessorForType(int type, oracle.xml.parser.v2.XMLNode xmlNode)
          Returns an accessor for the specified database object type, initialized with the XMLNode provided.
static XMLAccessor getXMLAccessorForType(int type, oracle.xml.parser.v2.XMLNode xmlNode, XMLAccessorClient client)
          Returns an accessor for the specified database object type, initialized with the XMLNode provided
static boolean hasDiffs(oracle.xml.parser.v2.XMLDocument doc)
          Indicates whether an SXML or CMXML document contains difference information.
 void initFromDatabase(CMConnection dbConn, java.lang.String objSchema, java.lang.String objName)
          Initializes an accessor from the database.
 void initFromDatabase(CMConnection dbConn, java.lang.String objSchema, java.lang.String objName, boolean forDiffing)
          Initializes an accessor from the database.
 void initialize(oracle.xml.parser.v2.XMLNode xmlNode)
          Initializes an XMLAccessor object from the contents of a supplied XMLNode.
 void initializeAll()
          Fully initializes the accessor.
static java.lang.String intTypeToMDAPIType(int oType)
          Returns the MDAPI type name corresponding to the XMLAccessorClient.CM_OBJTYPE code
static boolean isAlterable(oracle.xml.parser.v2.XMLDocument alterDoc)
          Indicates whether all the changes in the Alter XML document can be done with ALTER statements.
static int MDAPITypeToIntType(java.lang.String tName)
           
 void printXmlRoot(java.io.PrintStream ps)
          Prints the objects root XML node to a print stream.
 void registerApplyDiffListener(ApplyDiffListener adl)
          Sets an ApplyDiffListener instance to resolve conflicts that arise during applyDiff() processing.
 void releaseXML()
          Releases references to the XMLDocument upon which the XMLAccesor is based.
 void revert()
          Reverts the SXML document to its state before changes were made.
 void setAppendStatistics(boolean appendStats)
          Indicates whether statistics DBMS_STATS calls should be appended to create and alter DDL for objects that have statistics.
 void setObjectName(java.lang.String newName)
           
static void setTransformParams(oracle.xml.parser.v2.XSLProcessor proc, int paramsFlags, java.lang.String versionStr)
          Sets stylesheet transform parameters and the database version on an XSLProcessor.
 void setXmlDoc(oracle.xml.parser.v2.XMLNode xmlDoc)
          Establishes the base node for relative xpaths.
 boolean sxmlSupported()
          Indicates whether this object is supported by SXML.
static boolean sxmlSupported(int objType)
          Indicates whether an object type is supported by SXML.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MDAPI_TABLE

public static final java.lang.String MDAPI_TABLE
DBMS_METADATA name for Table objects

See Also:
Constant Field Values

MDAPI_INDEX

public static final java.lang.String MDAPI_INDEX
DBMS_METADATA name for Index objects

See Also:
Constant Field Values

MDAPI_VIEW

public static final java.lang.String MDAPI_VIEW
DBMS_METADATA name for View objects

See Also:
Constant Field Values

MDAPI_TRIGGER

public static final java.lang.String MDAPI_TRIGGER
DBMS_METADATA name for Trigger objects

See Also:
Constant Field Values

MDAPI_SYNONYM

public static final java.lang.String MDAPI_SYNONYM
DBMS_METADATA name for Synonym objects

See Also:
Constant Field Values

MDAPI_PACKAGE

public static final java.lang.String MDAPI_PACKAGE
DBMS_METADATA name for Package objects (Specification and Body)

See Also:
Constant Field Values

MDAPI_PACKAGE_SPEC

public static final java.lang.String MDAPI_PACKAGE_SPEC
DBMS_METADATA name for Package Specification objects

See Also:
Constant Field Values

MDAPI_PACKAGE_BODY

public static final java.lang.String MDAPI_PACKAGE_BODY
DBMS_METADATA name for Package Body objects

See Also:
Constant Field Values

MDAPI_PROCEDURE

public static final java.lang.String MDAPI_PROCEDURE
DBMS_METADATA name for Procedure objects

See Also:
Constant Field Values

MDAPI_FUNCTION

public static final java.lang.String MDAPI_FUNCTION
DBMS_METADATA name for Function objects

See Also:
Constant Field Values

MDAPI_SEQUENCE

public static final java.lang.String MDAPI_SEQUENCE
DBMS_METADATA name for Sequence objects

See Also:
Constant Field Values

MDAPI_DB_LINK

public static final java.lang.String MDAPI_DB_LINK
DBMS_METADATA name for Database Link objects

See Also:
Constant Field Values

MDAPI_MATERIALIZED_VIEW

public static final java.lang.String MDAPI_MATERIALIZED_VIEW
DBMS_METADATA name for Materialized View objects

See Also:
Constant Field Values

MDAPI_MATERIALIZED_VIEW_LOG

public static final java.lang.String MDAPI_MATERIALIZED_VIEW_LOG
DBMS_METADATA name for Materialized View Log objects

See Also:
Constant Field Values

MDAPI_CLUSTER

public static final java.lang.String MDAPI_CLUSTER
DBMS_METADATA name for Cluster objects

See Also:
Constant Field Values

MDAPI_TABLESPACE

public static final java.lang.String MDAPI_TABLESPACE
DBMS_METADATA name for Tablespace objects

See Also:
Constant Field Values

MDAPI_ROLLBACK_SEGMENT

public static final java.lang.String MDAPI_ROLLBACK_SEGMENT
DBMS_METADATA name for Rollback Segment objects

See Also:
Constant Field Values

MDAPI_USER

public static final java.lang.String MDAPI_USER
DBMS_METADATA name for User objects

See Also:
Constant Field Values

MDAPI_ROLE

public static final java.lang.String MDAPI_ROLE
DBMS_METADATA name for Role objects

See Also:
Constant Field Values

MDAPI_PROFILE

public static final java.lang.String MDAPI_PROFILE
DBMS_METADATA name for Profile objects

See Also:
Constant Field Values

MDAPI_TYPE

public static final java.lang.String MDAPI_TYPE
DBMS_METADATA name for Type objects

See Also:
Constant Field Values

DDL_CREATE_LEFT

public static final int DDL_CREATE_LEFT
Argument to getDDL() requesting left-side Create DDL.

See Also:
Constant Field Values

DDL_CREATE_RIGHT

public static final int DDL_CREATE_RIGHT
Argument to getDDL() requesting right-side Create DDL.

See Also:
Constant Field Values

DDL_ALTER_LEFT_TO_RIGHT

public static final int DDL_ALTER_LEFT_TO_RIGHT
Argument to getDDL() requesting DDL that changes the left side to the right side.

See Also:
Constant Field Values

DDL_ALTER_RIGHT_TO_LEFT

public static final int DDL_ALTER_RIGHT_TO_LEFT
Argument to getDDL() requesting DDL that changes the right side to the left side.

See Also:
Constant Field Values

DDL_DROP

public static final int DDL_DROP
Argument to getDDL() requesting DDL that drops the object.

See Also:
Constant Field Values

DIFF_NODES_PATTERN

public static final java.lang.String DIFF_NODES_PATTERN
See Also:
Constant Field Values
Method Detail

getChangeMode

public int getChangeMode()
Returns the "change mode", which determines whether changes are made in place (by replacing values, removing or inserting nodes etc.) or in the form of Diff SXML (by annotating nodes as added or modified, saving old values and deleted nodes, etc.

Returns:
  • XMLAccessorClient.CHANGE_IN_PLACE_MODE
  • XMLAccessorClient.DIFF_SXML_MODE

setXmlDoc

public void setXmlDoc(oracle.xml.parser.v2.XMLNode xmlDoc)
               throws XMLAccessorException
Establishes the base node for relative xpaths. Subclasses can override to get what they need from the document at the time it is set.

Parameters:
xmlDoc - the node from which the base node for relative xpath attribute lookups in this object is derived
Throws:
XMLAccessorException - if it is not possible to derive a base node from xmlNode

printXmlRoot

public void printXmlRoot(java.io.PrintStream ps)
Prints the objects root XML node to a print stream.

Parameters:
ps - the print stream to which the node is printed.

getDocument

public oracle.xml.parser.v2.XMLDocument getDocument()
Provides public access to the XMLDocument for objects that contain top-level definitions.

Returns:
an XMLDocument containing the full SXML definition of a database object if the XMLAccessor subclass represents an entire object; null if the subclass represents only part of an object

getXMLAccessorForType

public static XMLAccessor getXMLAccessorForType(int type,
                                                XMLAccessorClient client)
Returns an uninitialized accessor for the specified database object type.

Parameters:
type - one of the CM_OBJTYPE codes defined in the XMLAccessorClient interface
client - an instance of a class that implements XMLAccessorClient
Returns:
an uninitialized instance of the appropriate XMLAccessor subclass

getXMLAccessorForType

public static XMLAccessor getXMLAccessorForType(int type,
                                                oracle.xml.parser.v2.XMLNode xmlNode)
                                         throws XMLAccessorException
Returns an accessor for the specified database object type, initialized with the XMLNode provided. This method should be used by callers that do not require the services supported by an XMLAccessorClient.

Parameters:
type - one of the CM_OBJTYPE codes defined in the XMLAccessorClient interface
xmlNode - an XMLNode that will be used to initialize the XMLAccessor subclass
Returns:
an instance of the appropriate XMLAccessor subclass, initialized from xmlNode
Throws:
XMLAccessorException - if the XMLAccessor subclass cannot be initialized from xmlNode

getXMLAccessorForType

public static XMLAccessor getXMLAccessorForType(int type,
                                                oracle.xml.parser.v2.XMLNode xmlNode,
                                                XMLAccessorClient client)
                                         throws XMLAccessorException
Returns an accessor for the specified database object type, initialized with the XMLNode provided

Parameters:
type - one of the CM_OBJTYPE codes defined in the XMLAccessorClient interface
xmlNode - an XMLNode that will be used to initialize the XMLAccessor subclass
client - an instance of a class that implements XMLAccessorClient
Returns:
an instance of the appropriate XMLAccessor subclass, initialized from xmlNode
Throws:
XMLAccessorException - if the XMLAccessor subclass cannot be initialized from xmlNode

MDAPITypeToIntType

public static int MDAPITypeToIntType(java.lang.String tName)

intTypeToMDAPIType

public static java.lang.String intTypeToMDAPIType(int oType)
Returns the MDAPI type name corresponding to the XMLAccessorClient.CM_OBJTYPE code

Parameters:
oType - an XMLAccessorClient.CM_OBJTYPE code
Returns:
an MDAPI type name

sxmlSupported

public static boolean sxmlSupported(int objType)
Indicates whether an object type is supported by SXML.

Parameters:
objType - One of the object types defined by CM_OBJTYPE constants in XMLAccessorClient
Returns:
true if objType is supported by SXML, false otherwise

sxmlSupported

public boolean sxmlSupported()
Indicates whether this object is supported by SXML.

Returns:
true if this object is supported by SXML, false otherwise

setTransformParams

public static void setTransformParams(oracle.xml.parser.v2.XSLProcessor proc,
                                      int paramsFlags,
                                      java.lang.String versionStr)
                               throws oracle.xml.parser.v2.XSLException
Sets stylesheet transform parameters and the database version on an XSLProcessor. Transform parameters control various aspects of the translation of an SXML document into DDL.

Parameters:
proc - an XSLProcessor (stylesheet processor)
paramsFlags - bitwise-OR of XMLAccessorClient.XFORM_PARAM values. If a flag is specified, the corresponding parameter is set to its non-default value.
versionStr - A normalized version string as returned by DDLUtils.canonizeDBVersion().
Throws:
oracle.xml.parser.v2.XSLException

initialize

public void initialize(oracle.xml.parser.v2.XMLNode xmlNode)
                throws XMLAccessorException
Initializes an XMLAccessor object from the contents of a supplied XMLNode.

Parameters:
xmlNode - XMLNode containing the SXML document or portion from which to initialize the XMLAccessor subclass.
Throws:
XMLAccessorException - if the XMLAccessor subclass cannot be initialized from xmlNode.

initializeAll

public void initializeAll()
                   throws XMLAccessorException
Fully initializes the accessor. For most types, this is unnecessary, but some types (notably Table) access much of their information using separate accessors. Such types should override this method to fully initialize their accessors.

Throws:
XMLAccessorException - if the XMLAccessor subclass cannot be initialized.

initFromDatabase

public void initFromDatabase(CMConnection dbConn,
                             java.lang.String objSchema,
                             java.lang.String objName)
                      throws java.sql.SQLException,
                             XMLAccessorException
Initializes an accessor from the database. Does not prepare the SXML document for diffing.

Parameters:
dbConn - connection to the database containing the object
objSchema - schema that contains the object; null for non-schema objects
objName - name of the object
Throws:
java.sql.SQLException
XMLAccessorException

initFromDatabase

public void initFromDatabase(CMConnection dbConn,
                             java.lang.String objSchema,
                             java.lang.String objName,
                             boolean forDiffing)
                      throws java.sql.SQLException,
                             XMLAccessorException
Initializes an accessor from the database. Optionally prepares the SXML document for diffing.

Parameters:
dbConn - connection to the database containing the object
objSchema - schema that contains the object; null for non-schema objects
objName - name of the object
forDiffing - true if the SXML document will be compared to another to create a Diff SXML document; false if this preparation is not required
Throws:
java.sql.SQLException
XMLAccessorException

releaseXML

public void releaseXML()
Releases references to the XMLDocument upon which the XMLAccesor is based.


revert

public void revert()
Reverts the SXML document to its state before changes were made. Note that this method only undoes changes that were made in DIFF_SXML_MODE. Changes made in CHANGE_IN_PLACE_MODE cannot be reverted.


applySchemaMap

public final void applySchemaMap(java.util.HashMap schemaMap)

applySchemaMap

public void applySchemaMap(java.util.HashMap schemaMap,
                           int changeMode)

applyDiffs

public ApplyOneDiffResult[] applyDiffs(oracle.xml.parser.v2.XMLDocument diffDoc)
                                throws XMLAccessorException
Applies the differences contained in a Diff SXML document to the SXML document contained in the XMLAccessor object. The accessor's document may itself be a Diff SXML document. The result of the operation in the accessor is a Diff SXML document that contains the changes from the diffDoc.

Parameters:
diffDoc - an XMLDocument containing Diff SXML
Returns:
array of ApplyOneDiffResult objects, each of which details the results of applying a single diff from diffDoc to the SXML document contained in the XMLAccessor
Throws:
XMLAccessorException - if a problem occurs during the operation.

hasDiffs

public static boolean hasDiffs(oracle.xml.parser.v2.XMLDocument doc)
Indicates whether an SXML or CMXML document contains difference information.

Parameters:
doc - An SXML or CMXML document
Returns:
true if the document has difference information, false otherwise.

isAlterable

public static boolean isAlterable(oracle.xml.parser.v2.XMLDocument alterDoc)
Indicates whether all the changes in the Alter XML document can be done with ALTER statements.

Parameters:
alterDoc - An Alter XML document
Returns:
true if all changes in the document can be done with ALTER statements

compareDefinition

public boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn)
                          throws XMLAccessorException
Compares an XML document to the XML document contained in the accessor. The resulting Diff SXML or Diff CMXML document is stored in the accessor and can be retrieved using the getDifferencesDocument() method. It is generally appropriate to think of the definition contained in the accessor as the "original definition" and the definition passed in as the "revised definition"; for SXML types, the resulting Diff SXML will contain the changes that, when rendered into ALTER statements, will change an object with the original definition into one with the revised definition. The original SXML document is not modified.

Parameters:
defn - an XMLDocument that is compared to the document contained in the accessor.
Returns:
true if differences were found, false otherwise
Throws:
XMLAccessorException - if a problem occurs during the operation

compareDefinition

public boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn,
                                 boolean mutateDefn)
                          throws XMLAccessorException
Compares an XML document to the XML document contained in the accessor. The resulting Diff SXML or Diff CMXML document is stored in the accessor and can be retrieved using the getDifferencesDocument() method.

It is generally appropriate to think of the definition contained in the accessor as the "original definition" and the definition passed in as the "revised definition"; for SXML types, the resulting Diff SXML will contain the changes that, when rendered into ALTER statements, will change an object with the original definition into one with the revised definition. The original SXML document is not modified.

Parameters:
defn - an XMLDocument that is compared to the document contained in the accessor.
mutateDefn - if true, mutates the SXML document passed in to a Diff SXML document; if false, the SXML document is not changed
Returns:
true if differences were found, false otherwise
Throws:
XMLAccessorException - if a problem occurs during the operation

compareDefinition

public boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn,
                                 java.util.HashMap schemaMap)
                          throws XMLAccessorException
Compares an XML document to the XML document contained in the accessor. The resulting Diff SXML or Diff CMXML document is stored in the accessor and can be retrieved using the getDifferencesDocument() method.

It is generally appropriate to think of the definition contained in the accessor as the "original definition" and the definition passed in as the "revised definition"; for SXML types, the resulting Diff SXML will contain the changes that, when rendered into ALTER statements, will change an object with the original definition into one with the revised definition. The original SXML document is not modified.

Parameters:
defn - an XMLDocument that is compared to the document contained in the accessor.
schemaMap - identifies corresponding schemas in "defn" and the accessor's definition; the key is the defn schema and the value is the accessor's definitions schema
Returns:
true if differences were found, false otherwise
Throws:
XMLAccessorException - if a problem occurs during the operation

compareDefinition

public boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn,
                                 boolean mutateDefn,
                                 java.util.HashMap schemaMap)
                          throws XMLAccessorException
Compares an XML document to the XML document contained in the accessor. The resulting Diff SXML or Diff CMXML document is stored in the accessor and can be retrieved using the getDifferencesDocument() method.

It is generally appropriate to think of the definition contained in the accessor as the "original definition" and the definition passed in as the "revised definition"; for SXML types, the resulting Diff SXML will contain the changes that, when rendered into ALTER statements, will change an object with the original definition into one with the revised definition. The original SXML document is not modified.

Parameters:
defn - an XMLDocument that is compared to the document contained in the accessor.
mutateDefn - if true, mutates the SXML document passed in to a Diff SXML document; if false, the SXML document is not changed
schemaMap - identifies corresponding schemas in "defn" and the accessor's definition; the key is the defn schema and the value is the accessor's definitions schema
Returns:
true if differences were found, false otherwise
Throws:
XMLAccessorException - if a problem occurs during the operation

registerApplyDiffListener

public void registerApplyDiffListener(ApplyDiffListener adl)
Sets an ApplyDiffListener instance to resolve conflicts that arise during applyDiff() processing.

Parameters:
adl - an ApplyDiffListener whose methods are called each time a difference is applied to a target definition by applyDiff()

getDifferencesDocument

public oracle.xml.parser.v2.XMLDocument getDifferencesDocument()
Returns the differences document produced by the most recent compareDefinition() call, or null if there has been no compareDefinition() call.

Returns:
an XMLDocument containing the Diff SXML produced by compareDefinition()

getColumnName

public static java.lang.String getColumnName(org.w3c.dom.Node col)

getName

public java.lang.String getName()

getQuotedFullName

public java.lang.String getQuotedFullName()

getQuotedName

public java.lang.String getQuotedName()

setObjectName

public void setObjectName(java.lang.String newName)

toString

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

getSXMLDocFromDB

public oracle.xml.parser.v2.XMLDocument getSXMLDocFromDB(CMConnection dbConn,
                                                         java.lang.String mdapiType,
                                                         java.lang.String objSchema,
                                                         java.lang.String objName,
                                                         boolean forDiffing)
                                                  throws java.sql.SQLException,
                                                         XMLAccessorException
Methods for retrieving XML metadata definitions from databases and baselines.

Throws:
java.sql.SQLException
XMLAccessorException

getDDL

public java.lang.String getDDL(int ddlType)
                        throws XMLAccessorException
Returns DDL for the object. The DDL is returned as a single string, even when there are multiple statements. As a result, this method is intended primarily for generating display DDL rather than DDL for execution.

Parameters:
ddlType - The type of DDL to generate, one of:
  • DDL_CREATE_LEFT
  • DDL_CREATE_RIGHT
  • DDL_ALTER_LEFT_TO_RIGHT
  • DDL_ALTER_RIGHT_TO_LEFT
  • DDL_DROP
"Left" is MDAPI's "side 1," CM Compare's "left," CM Synch's "destination," and CM Change Plan's "starting state." "Right" is MDAPI's "side 2," CM Compare's "right,", CM Synch's "source," and CM Change Plan's "evolved state." Left and right side Create DDL will be identical if no comparison has been carried out, and left and right Alter DDL will report "no modifications" if there has been no comparison.
Throws:
XMLAccessorException - if there is no object definition in the accessor, or if a problem occurs during the operation.

getDDL

public java.lang.String getDDL(int ddlType,
                               java.util.HashMap schemaMap)
                        throws XMLAccessorException
Throws:
XMLAccessorException

getDDLForExecution

public java.lang.String getDDLForExecution(int ddlType,
                                           java.util.HashMap schemaMap)
                                    throws XMLAccessorException
Throws:
XMLAccessorException

getDDLForExecution

public java.lang.String getDDLForExecution(int ddlType)
                                    throws XMLAccessorException
Throws:
XMLAccessorException

getDDL

public java.lang.String getDDL(int ddlType,
                               java.util.HashMap schemaMap,
                               boolean forExecution)
                        throws XMLAccessorException
Returns DDL for the object. The DDL is returned as a single string, even when there are multiple statements. As a result, this method is intended primarily for generating display DDL rather than DDL for execution.

The optional schemaMap argument identifies corresponding schemas in the source (right) and destination (left) schemas. Pass this argument for objects that exist on one side only. Objects that exist on both sides are schema mapped by compareDefinition().

Parameters:
ddlType - The type of DDL to generate, one of:
  • DDL_CREATE_LEFT
  • DDL_CREATE_RIGHT
  • DDL_ALTER_LEFT_TO_RIGHT
  • DDL_ALTER_RIGHT_TO_LEFT
  • DDL_DROP
"Left" is MDAPI's "side 1," CM Compare's "left," CM Synch's "destination," and CM Change Plan's "starting state." "Right" is MDAPI's "side 2," CM Compare's "right,", CM Synch's "source," and CM Change Plan's "evolved state." Left and right side Create DDL will be identical if no comparison has been carried out, and left and right Alter DDL will report "no modifications" if there has been no comparison.
schemaMap - identifies corresponding schemas in source (right) and destination (left); the key is the source schema and the value is the destination schema
forExecution - indicates whether DDL should be prepared for execution by doubling single-quotes in comments and appending a slash to CREATE statements for PL/SQL objects
Throws:
XMLAccessorException - if there is no object definition in the accessor, or if a problem occurs during the operation.

getDropDDL

public java.lang.String getDropDDL()

setAppendStatistics

public void setAppendStatistics(boolean appendStats)
Indicates whether statistics DBMS_STATS calls should be appended to create and alter DDL for objects that have statistics. By default, DBMS_STATS calls are not appended.

Parameters:
appendStats - true if DBMS_STATS calls should be appended

getAppendStatistics

public boolean getAppendStatistics()
Indicates whether statistics DBMS_STATS calls are appended to create and alter DDL for objects that have statistics.

Returns:
true if DBMS_STATS calls are appended

generateDDL

public java.lang.String generateDDL(int transform,
                                    int transformParams)
Methods for transforming XML - primarily XML-to-DDL. The methods are named generateDDL for historic reasons but they can be used for any transformation.


generateDDL

public java.lang.String generateDDL(int transform,
                                    int transformParams,
                                    oracle.xml.parser.v2.XMLDocument theDoc)

generateDDL

public java.lang.String generateDDL(int transform,
                                    int transformParams,
                                    java.lang.String xslRoot)

generateDDLs

public java.lang.String[] generateDDLs(int transformParams)

createXslTransformInfo

public static CMXSLTransformInfo createXslTransformInfo(int transform,
                                                        int objType,
                                                        java.lang.String xslRoot,
                                                        javax.servlet.ServletContext context)