|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.sysman.dbTarget.db.changemgr.emo.docaccess.XMLAccessor
public abstract class XMLAccessor
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 |
---|
public static final java.lang.String MDAPI_TABLE
public static final java.lang.String MDAPI_INDEX
public static final java.lang.String MDAPI_VIEW
public static final java.lang.String MDAPI_TRIGGER
public static final java.lang.String MDAPI_SYNONYM
public static final java.lang.String MDAPI_PACKAGE
public static final java.lang.String MDAPI_PACKAGE_SPEC
public static final java.lang.String MDAPI_PACKAGE_BODY
public static final java.lang.String MDAPI_PROCEDURE
public static final java.lang.String MDAPI_FUNCTION
public static final java.lang.String MDAPI_SEQUENCE
public static final java.lang.String MDAPI_DB_LINK
public static final java.lang.String MDAPI_MATERIALIZED_VIEW
public static final java.lang.String MDAPI_MATERIALIZED_VIEW_LOG
public static final java.lang.String MDAPI_CLUSTER
public static final java.lang.String MDAPI_TABLESPACE
public static final java.lang.String MDAPI_ROLLBACK_SEGMENT
public static final java.lang.String MDAPI_USER
public static final java.lang.String MDAPI_ROLE
public static final java.lang.String MDAPI_PROFILE
public static final java.lang.String MDAPI_TYPE
public static final int DDL_CREATE_LEFT
public static final int DDL_CREATE_RIGHT
public static final int DDL_ALTER_LEFT_TO_RIGHT
public static final int DDL_ALTER_RIGHT_TO_LEFT
public static final int DDL_DROP
public static final java.lang.String DIFF_NODES_PATTERN
Method Detail |
---|
public int getChangeMode()
public void setXmlDoc(oracle.xml.parser.v2.XMLNode xmlDoc) throws XMLAccessorException
xmlDoc
- the node from which the
base node for relative xpath attribute
lookups in this object is derived
XMLAccessorException
- if it is not possible to derive a
base node from xmlNodepublic void printXmlRoot(java.io.PrintStream ps)
ps
- the print stream to which the
node is printed.public oracle.xml.parser.v2.XMLDocument getDocument()
public static XMLAccessor getXMLAccessorForType(int type, XMLAccessorClient client)
type
- one of the CM_OBJTYPE codes defined
in the XMLAccessorClient interfaceclient
- an instance of a class that implements
XMLAccessorClient
public static XMLAccessor getXMLAccessorForType(int type, oracle.xml.parser.v2.XMLNode xmlNode) throws XMLAccessorException
type
- one of the CM_OBJTYPE codes defined
in the XMLAccessorClient interfacexmlNode
- an XMLNode that will be used to
initialize the XMLAccessor subclass
XMLAccessorException
- if the XMLAccessor subclass cannot be
initialized from xmlNodepublic static XMLAccessor getXMLAccessorForType(int type, oracle.xml.parser.v2.XMLNode xmlNode, XMLAccessorClient client) throws XMLAccessorException
type
- one of the CM_OBJTYPE codes defined
in the XMLAccessorClient interfacexmlNode
- an XMLNode that will be used to
initialize the XMLAccessor subclassclient
- an instance of a class that implements
XMLAccessorClient
XMLAccessorException
- if the XMLAccessor subclass cannot be
initialized from xmlNodepublic static int MDAPITypeToIntType(java.lang.String tName)
public static java.lang.String intTypeToMDAPIType(int oType)
oType
- an XMLAccessorClient.CM_OBJTYPE
code
public static boolean sxmlSupported(int objType)
objType
- One of the object types defined by
CM_OBJTYPE constants in
XMLAccessorClient
public boolean sxmlSupported()
public static void setTransformParams(oracle.xml.parser.v2.XSLProcessor proc, int paramsFlags, java.lang.String versionStr) throws oracle.xml.parser.v2.XSLException
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().
oracle.xml.parser.v2.XSLException
public void initialize(oracle.xml.parser.v2.XMLNode xmlNode) throws XMLAccessorException
xmlNode
- XMLNode containing the SXML document or
portion from which to initialize the
XMLAccessor subclass.
XMLAccessorException
- if the XMLAccessor subclass cannot be
initialized from xmlNode.public void initializeAll() throws XMLAccessorException
XMLAccessorException
- if the XMLAccessor subclass cannot be
initialized.public void initFromDatabase(CMConnection dbConn, java.lang.String objSchema, java.lang.String objName) throws java.sql.SQLException, XMLAccessorException
dbConn
- connection to the database containing
the objectobjSchema
- schema that contains the object; null
for non-schema objectsobjName
- name of the object
java.sql.SQLException
XMLAccessorException
public void initFromDatabase(CMConnection dbConn, java.lang.String objSchema, java.lang.String objName, boolean forDiffing) throws java.sql.SQLException, XMLAccessorException
dbConn
- connection to the database containing
the objectobjSchema
- schema that contains the object; null
for non-schema objectsobjName
- name of the objectforDiffing
- true if the SXML document will be compared
to another to create a Diff SXML document;
false if this preparation is not required
java.sql.SQLException
XMLAccessorException
public void releaseXML()
public void revert()
public final void applySchemaMap(java.util.HashMap schemaMap)
public void applySchemaMap(java.util.HashMap schemaMap, int changeMode)
public ApplyOneDiffResult[] applyDiffs(oracle.xml.parser.v2.XMLDocument diffDoc) throws XMLAccessorException
diffDoc
- an XMLDocument containing Diff SXML
XMLAccessorException
- if a problem occurs during the
operation.public static boolean hasDiffs(oracle.xml.parser.v2.XMLDocument doc)
doc
- An SXML or CMXML document
public static boolean isAlterable(oracle.xml.parser.v2.XMLDocument alterDoc)
alterDoc
- An Alter XML document
public boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn) throws XMLAccessorException
defn
- an XMLDocument that is compared to the
document contained in the accessor.
XMLAccessorException
- if a problem occurs during the
operationpublic boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn, boolean mutateDefn) throws XMLAccessorException
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.
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
XMLAccessorException
- if a problem occurs during the
operationpublic boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn, java.util.HashMap schemaMap) throws XMLAccessorException
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.
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
XMLAccessorException
- if a problem occurs during the
operationpublic boolean compareDefinition(oracle.xml.parser.v2.XMLDocument defn, boolean mutateDefn, java.util.HashMap schemaMap) throws XMLAccessorException
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.
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 changedschemaMap
- 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
XMLAccessorException
- if a problem occurs during the
operationpublic void registerApplyDiffListener(ApplyDiffListener adl)
adl
- an ApplyDiffListener whose methods
are called each time a difference
is applied to a target definition
by applyDiff()public oracle.xml.parser.v2.XMLDocument getDifferencesDocument()
public static java.lang.String getColumnName(org.w3c.dom.Node col)
public java.lang.String getName()
public java.lang.String getQuotedFullName()
public java.lang.String getQuotedName()
public void setObjectName(java.lang.String newName)
public java.lang.String toString()
toString
in class java.lang.Object
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
java.sql.SQLException
XMLAccessorException
public java.lang.String getDDL(int ddlType) throws XMLAccessorException
ddlType
- The type of DDL to generate, one of:
XMLAccessorException
- if there is no object definition in
the accessor, or if a problem occurs during the
operation.public java.lang.String getDDL(int ddlType, java.util.HashMap schemaMap) throws XMLAccessorException
XMLAccessorException
public java.lang.String getDDLForExecution(int ddlType, java.util.HashMap schemaMap) throws XMLAccessorException
XMLAccessorException
public java.lang.String getDDLForExecution(int ddlType) throws XMLAccessorException
XMLAccessorException
public java.lang.String getDDL(int ddlType, java.util.HashMap schemaMap, boolean forExecution) throws XMLAccessorException
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().
ddlType
- The type of DDL to generate, one of:
schemaMap
- identifies corresponding schemas in
source (right) and destination (left);
the key is the source schema and the value
is the destination schemaforExecution
- 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
XMLAccessorException
- if there is no object definition in
the accessor, or if a problem occurs during the
operation.public java.lang.String getDropDDL()
public void setAppendStatistics(boolean appendStats)
appendStats
- true if DBMS_STATS calls should
be appendedpublic boolean getAppendStatistics()
public java.lang.String generateDDL(int transform, int transformParams)
public java.lang.String generateDDL(int transform, int transformParams, oracle.xml.parser.v2.XMLDocument theDoc)
public java.lang.String generateDDL(int transform, int transformParams, java.lang.String xslRoot)
public java.lang.String[] generateDDLs(int transformParams)
public static CMXSLTransformInfo createXslTransformInfo(int transform, int objType, java.lang.String xslRoot, javax.servlet.ServletContext context)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |