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

E13403-04

oracle.javatools.db
Class DBObjectFactory

java.lang.Object
  extended by oracle.javatools.db.DBObjectFactory
Direct Known Subclasses:
OfflineDBObjectFactory

public class DBObjectFactory
extends java.lang.Object

Factory to control the creation of SchemaObjects and ChildDBObjects which may be based on templates and/or have the initial values of properties defined by PropertyInitializers.

The DBObjectFactory supports all SchemaObjects and the following ChildDBObject types

Since:
11.1.1.2.0

Constructor Summary
protected DBObjectFactory(DBObjectProvider pro)
          Constructor has protected access as API users should retrieve a factory from the provider, and not instantiate their own.
 
Method Summary
protected  BaseObjectID createID(DBObject obj)
           
protected  void ensureBaseInfo(BaseObjectID id, DBObject obj, boolean forceName)
           
 DBObjectID ensureID(DBObject obj, boolean recurse, boolean forceNames)
          Checks that the given object has an ID that is set up for the factory's provider.
 void ensureProvider(BaseObjectID id)
          Initialises the given id's provider to be the factory's provider if it wasn't already set.
 void ensureSchema(SchemaObject obj)
          Ensures that the given object's Schema is the same instance that the provider has, and not a copy, or separate instance with the same name.
protected  DBObjectID findParentID(DBObjectID parentID)
           
 java.lang.Object getExternalDefaultValue(DBObject obj, java.lang.String propertyName)
          The target database defined by getProvider() may set properties of objects at generation time if the value of those properties is not defined in the DDL.
 java.lang.Object getInitialValue(DBObject obj, java.lang.String propertyName)
           
protected  java.util.logging.Logger getLogger()
           
protected  DBObjectProvider getProvider()
           
protected  boolean isValidID(DBObjectID id)
           
<T extends DBObject>
T
newObject(java.lang.Class<T> clz)
          Creates a new DBObject of the specified class using the default template if one exists, and with properties initialized according to all registered PropertyInitializers.
<T extends DBObject>
T
newObject(java.lang.Class<T> clz, DBObject parent)
          Creates a new DBObject of the specified class using the default template if one exists, and with properties initialized according to all registered PropertyInitializers.
<T extends DBObject>
T
newObject(java.lang.Class<T> clz, DBObject parent, boolean useDefaultTemplate)
          Creates a new DBObject of the specified class optionally using the default template if one exists, and with properties initialized according to all registered PropertyInitializers.
<T extends DBObject>
T
newObject(T template)
          Creates a new object using the given template with properties initialized according to all registered PropertyInitializers,
<T extends DBObject>
T
newObject(T template, DBObject parent)
          Creates a new object using the given template with properties initialized according to all registered PropertyInitializers,
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBObjectFactory

protected DBObjectFactory(DBObjectProvider pro)
Constructor has protected access as API users should retrieve a factory from the provider, and not instantiate their own.

Method Detail

getProvider

protected DBObjectProvider getProvider()
Returns:
the current DBObjectProvider

getLogger

protected java.util.logging.Logger getLogger()

newObject

public <T extends DBObject> T newObject(T template)
Creates a new object using the given template with properties initialized according to all registered PropertyInitializers,

Returns:
the new object, or null if an object of that class cannot be instantiated.

newObject

public <T extends DBObject> T newObject(T template,
                                        DBObject parent)
Creates a new object using the given template with properties initialized according to all registered PropertyInitializers,

Parameters:
template - the template to use for the new object
parent - the parent of the new object - e.g. a Schema for a new Sequence, a Table for a new column etc.
Returns:
the new object, or null if an object of that class cannot be instantiated.

newObject

public <T extends DBObject> T newObject(java.lang.Class<T> clz)
Creates a new DBObject of the specified class using the default template if one exists, and with properties initialized according to all registered PropertyInitializers.

Parameters:
clz - the class of object to create
Returns:
the new DBObject, or null if an object of that class cannot be instantiated.

newObject

public <T extends DBObject> T newObject(java.lang.Class<T> clz,
                                        DBObject parent)
Creates a new DBObject of the specified class using the default template if one exists, and with properties initialized according to all registered PropertyInitializers.

Parameters:
clz - the class of object to create
parent - the parent of the new object - e.g. a Schema for a new Sequence, a Table for a new column etc.
Returns:
the new DBObject, or null if an object of that class cannot be instantiated.

newObject

public <T extends DBObject> T newObject(java.lang.Class<T> clz,
                                        DBObject parent,
                                        boolean useDefaultTemplate)
Creates a new DBObject of the specified class optionally using the default template if one exists, and with properties initialized according to all registered PropertyInitializers.

Parameters:
clz - the class of object to create
parent - the parent of the new object - e.g. a Schema for a new Sequence, a Table for a new column etc.
useDefaultTempalte - whether to use the default template from the provider for the given object type (if such a template is registered)
Returns:
the new DBObject, or null if an object of that class cannot be instantiated.

getExternalDefaultValue

public java.lang.Object getExternalDefaultValue(DBObject obj,
                                                java.lang.String propertyName)
The target database defined by getProvider() may set properties of objects at generation time if the value of those properties is not defined in the DDL. By using the registered any such "external default values" can be defined.

Returns:
external default value

getInitialValue

public java.lang.Object getInitialValue(DBObject obj,
                                        java.lang.String propertyName)
Returns:
the initial value of the given property on the given object using any registered

ensureSchema

public void ensureSchema(SchemaObject obj)
Ensures that the given object's Schema is the same instance that the provider has, and not a copy, or separate instance with the same name.

It is only anticipated that this method will be needed internally.

Parameters:
obj - the SchemaObject to check the Schema for

ensureID

public DBObjectID ensureID(DBObject obj,
                           boolean recurse,
                           boolean forceNames)
Checks that the given object has an ID that is set up for the factory's provider. This should only be called for existing objects (e.g. on a load operation) and should not be called for new objects that do not yet exist in the provider because the resulting ID will not resolve.

It is only anticipated that this method will be needed internally.

Parameters:
the - object to ensure has a valid ID for this factory's provider
boolean - whether to recurse and process the objects' child objects as well
forceNames - if true this will additionally set the name based information on identifier based IDs. This is a potentially more time consuming operation as it may require dependent objects to be loaded.
Returns:
the id that the given object now has

isValidID

protected boolean isValidID(DBObjectID id)

createID

protected BaseObjectID createID(DBObject obj)

ensureBaseInfo

protected void ensureBaseInfo(BaseObjectID id,
                              DBObject obj,
                              boolean forceName)

findParentID

protected DBObjectID findParentID(DBObjectID parentID)

ensureProvider

public final void ensureProvider(BaseObjectID id)
Initialises the given id's provider to be the factory's provider if it wasn't already set.


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

E13403-04

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