Extension SDK 10.1.3.36.73

oracle.javatools.db.validators
Class AbstractValidator

java.lang.Object
  extended byoracle.javatools.db.validators.AbstractValidator
All Implemented Interfaces:
DBObjectValidator
Direct Known Subclasses:
ColumnValidator, ConstraintValidator, IndexValidator, ObjectTypeValidator, PackageValidator, PlSqlValidator, RelationValidator, SchemaValidator, SequenceValidator, SynonymValidator

public abstract class AbstractValidator
extends java.lang.Object
implements DBObjectValidator

Provides an abstract implementation of the DBOBjectValidator interface. Implementors can use this class as a starting point for validation logic as validation of name, schema name (if appropriate) and duplication of name are provided by this abstract class.

Since:
9.0.5

Constructor Summary
protected AbstractValidator(DBObjectProvider pro)
           
 
Method Summary
protected  boolean canChangeSchema()
          By default an object's schema can be changed (only applies to SchemaObjects).
protected  boolean canHaveEmptyName()
          By default names cannot be empty (or null).
protected  boolean canRename()
          Default name validation is to allow rename on update.
protected  DBObject findExistingObject(DBObject object)
          Finds an existing object for the given object.
protected  DBObjectProvider getProvider()
           
protected  void validateName(DBObject obj)
          Validates a name to see if it is a legal identifier.
protected  void validateNameInUse(DBObject object)
          Validates whether the given name is already in use.
 void validateObject(DBObject object)
          Finds an existing object for the object in question (by ID) and calls updateObject(DBObject original, DBObject updated) with that original object (null if none).
 void validateObject(DBObject original, DBObject updated)
          Used for validation of both new and existing objects.
 void validateObject(DBObject original, DBObject updated, java.lang.String childType)
          Default implementation simply throws a MissingValidatorException.
 void validateObject(DBObject object, java.lang.String childType)
          Tries to find an existing object for the given object and calls validateObject( DBObject original, DBObject updated, String childType ).
protected  void validateSchema(SchemaObject object)
           
static void validateUniqueNames(DBObject[] objs)
          Validates that the given set of objects does not contain a duplicate name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractValidator

protected AbstractValidator(DBObjectProvider pro)
Method Detail

validateName

protected void validateName(DBObject obj)
                     throws InvalidNameException
Validates a name to see if it is a legal identifier. Does not check for existing objects so that it can be used for update as well as create. Use isNameInUse().

Throws:
InvalidNameException

canHaveEmptyName

protected boolean canHaveEmptyName()
By default names cannot be empty (or null).


canRename

protected boolean canRename()
Default name validation is to allow rename on update.


canChangeSchema

protected boolean canChangeSchema()
By default an object's schema can be changed (only applies to SchemaObjects).


getProvider

protected DBObjectProvider getProvider()

validateObject

public final void validateObject(DBObject object)
                          throws ValidationException
Finds an existing object for the object in question (by ID) and calls updateObject(DBObject original, DBObject updated) with that original object (null if none). This is final - all subclasses should extend validateObject( DBObject original, DBObject updated ) and findExistingObject( DBObject object ) as appropriate.

Specified by:
validateObject in interface DBObjectValidator
Parameters:
object - the DBObject to validate
Throws:
ValidationException - if the object is not valid.

validateObject

public final void validateObject(DBObject object,
                                 java.lang.String childType)
                          throws ValidationException
Tries to find an existing object for the given object and calls validateObject( DBObject original, DBObject updated, String childType ). This is final - all subclasses should implement validateObject(DBObject original, DBObject updated, String childType)

Specified by:
validateObject in interface DBObjectValidator
Parameters:
object - the DBObject to validate
childType - the DBObject type for the children to be validated
Throws:
ValidationException - if the object is not valid.

validateSchema

protected void validateSchema(SchemaObject object)
                       throws ValidationException
Throws:
ValidationException

validateNameInUse

protected void validateNameInUse(DBObject object)
                          throws NameInUseException
Validates whether the given name is already in use. The object should have a valid Schema and Type for this to work.

Throws:
NameInUseException

validateObject

public void validateObject(DBObject original,
                           DBObject updated)
                    throws ValidationException
Used for validation of both new and existing objects. If new original will be null. This superclass's implementation provides name validation (including "name in use") and schema validation.

Specified by:
validateObject in interface DBObjectValidator
Throws:
ValidationException - if the object is not valid.

validateUniqueNames

public static void validateUniqueNames(DBObject[] objs)
                                throws ValidationException
Validates that the given set of objects does not contain a duplicate name.

Parameters:
objs - set of objects to check for all having unique names
Throws:
ValidationException - if a name is duplicated

validateObject

public void validateObject(DBObject original,
                           DBObject updated,
                           java.lang.String childType)
                    throws ValidationException
Default implementation simply throws a MissingValidatorException. Subclasses that validate child objects should override.

Specified by:
validateObject in interface DBObjectValidator
Parameters:
childType - the DBObject type for the children to be validated
Throws:
ValidationException - if the object is not valid.

findExistingObject

protected DBObject findExistingObject(DBObject object)
                               throws ValidationException
Finds an existing object for the given object. Default implementation finds by ID.

Parameters:
object - the object to look for an existing version of
Returns:
the version of the given object that already exists in the provider.
Throws:
ValidationException - if the types of the given object and existing object don't match.

Extension SDK 10.1.3.36.73

 

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