Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.1.0)

E13403-02

oracle.javatools.db
Class SchemaObjectManager

java.lang.Object
  extended by oracle.javatools.db.SchemaObjectManager

public class SchemaObjectManager
extends java.lang.Object

Manager class which caches SchemaObjects and maintains dependency links between them. For example: registering tables will allow the query of any table that is referenced by a FK from another table.

This uses the getOwnedObjects() and getReferenceIDs() methods on DBObject.

Since:
10.1.3

Constructor Summary
SchemaObjectManager(DBObjectProvider provider)
           
 
Method Summary
 SchemaObject cascadeDelete(DBObject deleted, SchemaObject referer)
          Cascades the delete of the given object to the given referer by taking a copy of the referer and performing any necessary updates.
 SchemaObject cascadeDelete(DBObject deleted, SchemaObject referer, boolean copyIfCascadeRequired)
          Cascades the delete of the given object to the given referer by taking a copy of the referer and performing any necessary updates.
protected  void checkInit()
           
protected  void clearAllCaches()
           
protected  boolean couldFixUnresolvedReferences(DBObject obj)
          If the provider supports unresolved references this method must return for an object that could resolve them.
 void doCascadeDelete(SchemaObject deleted, SchemaObject referer)
           
static SchemaObject[] getDependencies(SchemaObject obj, DBObjectProvider pro, boolean recurse)
          Returns the SchemaObjects that this SchemaObject, or any of its children, are dependent on.
protected  DBObjectProvider getProvider()
           
 DBObjectID[] getReferers(DBObject obj)
          Returns the DBObjects who directly reference the given DBObject.
 DBObjectID[] getSchemaObjectReferers(SchemaObject obj, boolean deep)
          Returns the SchemaObjects who reference (either directly or via their children) the given SchemaObject (or one of its children).
 boolean hasUnresolvedReference(SchemaObject obj, java.lang.String refType)
          Returns true if the given schema object (or any of its children) has an unresolved reference to an object of the given type.
protected  boolean haveRegisteredAll()
           
 boolean isUnresolvedReference(DBObjectID id)
          Returns true if the given id is an "unresolved reference".
protected  java.lang.String[] listObjectTypes()
           
protected  Schema[] listSchemas()
           
protected  boolean needsInitialization(SchemaObject obj)
          Returns true if the given schema object isn't built yet (i.e.
protected  void registerAllObjects()
          Registers all objects in the underlying DBObjectProvider with this manager.
 void registerObject(SchemaObject obj)
          Register the given SchemaObject with this manager.
 void registerObject(SchemaObject obj, boolean loadOnly)
          Registers an object on the understanding that this is a load of the object, not a create or update.
protected  boolean resolvesUnresolvedReference(DBObjectID id, DBObjectID unresolved)
          Returns true if the given id resolves the given id that is unresolved.
protected  void setRegisterProgress(int objN, int objT, int schemaN, int schemaT, java.lang.String schemaName)
           
protected  boolean shouldRegister(SchemaObject obj, boolean loadOnly)
          Online we register objects as they are loaded because all we care about is keeping our cache up-to-date (i.e.
protected  boolean supportsUnresolvedReferences()
          Returns true if this manager supports its objects having unresolved references.
 void unregisterObject(SchemaObject obj)
          Unregisters the given object from the object manager.
protected  void updateObjects(java.util.List<SchemaObject> originals, java.util.List<SchemaObject> updates, boolean bulkOperation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaObjectManager

public SchemaObjectManager(DBObjectProvider provider)
Method Detail

getProvider

protected final DBObjectProvider getProvider()

haveRegisteredAll

protected final boolean haveRegisteredAll()

clearAllCaches

protected void clearAllCaches()

supportsUnresolvedReferences

protected boolean supportsUnresolvedReferences()
Returns true if this manager supports its objects having unresolved references. Our live database connections don't. Subclasses should override as appropriate.


couldFixUnresolvedReferences

protected boolean couldFixUnresolvedReferences(DBObject obj)
If the provider supports unresolved references this method must return for an object that could resolve them. When registerObject() is called and this method returns true a manager initiliasation will be forced incase this object can resolve unresolved references we have in the provider already.


isUnresolvedReference

public boolean isUnresolvedReference(DBObjectID id)
Returns true if the given id is an "unresolved reference". Subclasses should override as appropriate if they support unresolved references, the default implementation doesn't and will always return false.

See Also:
supportsUnresolvedReferences()

resolvesUnresolvedReference

protected boolean resolvesUnresolvedReference(DBObjectID id,
                                              DBObjectID unresolved)
Returns true if the given id resolves the given id that is unresolved. Subclasses should override as appropriate.

See Also:
supportsUnresolvedReferences()

registerObject

public void registerObject(SchemaObject obj)
Register the given SchemaObject with this manager. The object must have valid IDs setup. If this manager isn't initialised yet (i.e. hasn't parsed the whole provider) then nothing will be done as this object will be registered when that is first done.


registerObject

public void registerObject(SchemaObject obj,
                           boolean loadOnly)
Registers an object on the understanding that this is a load of the object, not a create or update.

See Also:
registerObject(SchemaObject)

shouldRegister

protected boolean shouldRegister(SchemaObject obj,
                                 boolean loadOnly)
Online we register objects as they are loaded because all we care about is keeping our cache up-to-date (i.e. the objects we've already looked at). The database will sort itself out.


needsInitialization

protected final boolean needsInitialization(SchemaObject obj)
Returns true if the given schema object isn't built yet (i.e. is waiting to be lazy loaded).


unregisterObject

public void unregisterObject(SchemaObject obj)
Unregisters the given object from the object manager.


getSchemaObjectReferers

public DBObjectID[] getSchemaObjectReferers(SchemaObject obj,
                                            boolean deep)
Returns the SchemaObjects who reference (either directly or via their children) the given SchemaObject (or one of its children). (e.g. for a Table this would return any Tables, Views or Synonyms (etc) that reference it via FKs, ColumnUsages or Object references).

Parameters:
obj - the object to search for references to
deep - whether to traverse references to the referers etc.

getReferers

public DBObjectID[] getReferers(DBObject obj)
Returns the DBObjects who directly reference the given DBObject. (e.g for a UK this would return any FKs that reference it).


hasUnresolvedReference

public boolean hasUnresolvedReference(SchemaObject obj,
                                      java.lang.String refType)
Returns true if the given schema object (or any of its children) has an unresolved reference to an object of the given type.


updateObjects

protected void updateObjects(java.util.List<SchemaObject> originals,
                             java.util.List<SchemaObject> updates,
                             boolean bulkOperation)
                      throws DBException
Throws:
DBException

doCascadeDelete

public void doCascadeDelete(SchemaObject deleted,
                            SchemaObject referer)
                     throws DBException
Throws:
DBException

cascadeDelete

public SchemaObject cascadeDelete(DBObject deleted,
                                  SchemaObject referer)
Cascades the delete of the given object to the given referer by taking a copy of the referer and performing any necessary updates. The updated object is returned (if any updates were necessary).

Parameters:
deleted - the object that's being deleted. if this is not a SchemaObject, it must still be currently parented by its SchemaObject.
referer - the object that we want to cascade the delete to
Returns:
a copy of the referer with the delete cascaded (if any updates are needed).

cascadeDelete

public SchemaObject cascadeDelete(DBObject deleted,
                                  SchemaObject referer,
                                  boolean copyIfCascadeRequired)
Cascades the delete of the given object to the given referer by taking a copy of the referer and performing any necessary updates. The updated object is returned (if any updates were necessary).

Parameters:
deleted - the object that's being deleted. if this is not a SchemaObject, it must still be currently parented by its SchemaObject.
referer - the object that we want to cascade the delete to
if - there is a change to cascade, optionally take a copy of referer and make the changes to that, or make them to the referer object directly.
Returns:
a copy of the referer with the delete cascaded (if any updates are needed).

checkInit

protected void checkInit()

registerAllObjects

protected final void registerAllObjects()
Registers all objects in the underlying DBObjectProvider with this manager.


listObjectTypes

protected java.lang.String[] listObjectTypes()

listSchemas

protected Schema[] listSchemas()
                        throws DBException
Throws:
DBException

setRegisterProgress

protected void setRegisterProgress(int objN,
                                   int objT,
                                   int schemaN,
                                   int schemaT,
                                   java.lang.String schemaName)

getDependencies

public static final SchemaObject[] getDependencies(SchemaObject obj,
                                                   DBObjectProvider pro,
                                                   boolean recurse)
Returns the SchemaObjects that this SchemaObject, or any of its children, are dependent on. Optionally recurses to include the dependencies of the dependencies, and so on.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.1.0)

E13403-02

Copyright © 1997, 2009, Oracle. All rights reserved.