org.norther.tammi.root.db
Interface PersisterFactory

All Superinterfaces:
CacheClient, Configurable, ConfigurableFactory, KeyCacheClient, ObjectFactory, Refreshable
All Known Subinterfaces:
HibernatePersisterFactory, OJBPersisterFactory, XMLPersisterFactory
All Known Implementing Classes:
AbstractPersisterFactory, DefaultHibernatePersisterFactory, DefaultOJBPersisterFactory, DefaultXMLPersisterFactory

public interface PersisterFactory
extends ConfigurableFactory, KeyCacheClient

An interface to Persister factories. The default constructor returns a persister to the default repository. Constructors with a connection alias key of type java.lang.String as the first parameter return a persister to the corresponding repository.

The factory is configured through an implementation specific property file. In addition, attribute types for dynamic variables, i.e. subclasses of the default Variable implementation defined automatically for missing classes declared in class descriptors, can be specified using the following syntax:

 ##
 # Primitive JDBC types (default is objects).
 #jdbc.type.TINYINT: byte
 #jdbc.type.SMALLINT: short
 #jdbc.type.INTEGER: int
 #jdbc.type.BIGINT: long
 #jdbc.type.REAL: float
 #jdbc.type.FLOAT: double
 #jdbc.type.DOUBLE: double
 


Field Summary
static String ANY_ALIAS
          The wildcard expression.
static String EXT_BASE_CLASS_NAME
          The external super class attribute.
static String EXT_BEGIN_CLASS
          The external begin class attribute.
static String EXT_BEGIN_FIELD
          The external begin field attribute.
static String EXT_BLANK_ACCEPTED
          The external blank accepted attribute.
static String EXT_CLONEABLE
          The external cloneable attribute.
static String EXT_COLLECTION
          The external collection attribute.
static String EXT_COMPARATOR_CLASS_NAME
          The external comparator attribute.
static String EXT_CORRELATIVE
          The external correlative attribute.
static String EXT_DESCENDING
          The external descending attribute.
static String EXT_DESCRIPTION
          The external description attribute.
static String EXT_DETAIL
          The external detail attribute.
static String EXT_DISABLED
          The external disabled attribute.
static String EXT_EMPTY_ACCEPTED
          The external empty accepted attribute.
static String EXT_END_CLASS
          The external end class attribute.
static String EXT_END_FIELD
          The external end field attribute.
static String EXT_ENUM_NAME
          The external enum name attribute.
static String EXT_ENUM_VALUE
          The external enum value attribute.
static String EXT_ENUMERATED
          The external enumeration attribute.
static String EXT_EXPORTER_CLASS_NAME
          The external exporter attribute.
static String EXT_GROUP
          The external group attribute.
static String EXT_IMPORTER_CLASS_NAME
          The external importer attribute.
static String EXT_INDEX
          The external index attribute.
static String EXT_INTERACTIVE
          The external interactive attribute.
static String EXT_LOCAL
          The external local attribute.
static String EXT_LOCALIZED
          The external localized attribute.
static String EXT_MANDATORY
          The external mandatory attribute.
static String EXT_MAX_VALUE
          The external max value attribute.
static String EXT_MIN_VALUE
          The external min value attribute.
static String EXT_NAME_PATTERN
          The external name pattern attribute.
static String EXT_OPTIONS
          The external options attribute.
static String EXT_ORDER_BY
          The external order-by attribute.
static String EXT_ORDERED
          The external ordered attribute.
static String EXT_PATTERN
          The external pattern attribute.
static String EXT_PRIMARY
          The external primary attribute.
static String EXT_READABLE
          The external readable attribute.
static String EXT_REFERENCE
          The external reference attribute.
static String EXT_SERIALIZED
          The external serialized attribute.
static String EXT_SHADOW
          The external shadow attribute.
static String EXT_SORTED
          The external sorted attribute.
static String EXT_TRACEABLE
          The external traceable attribute.
static String EXT_TRANSIENT
          The external transient attribute.
static String EXT_TRIMMED
          The external trimmed attribute.
static String EXT_TYPE
          The external type attribute.
static String EXT_VALIDATOR_CLASS_NAME
          The external validator attribute.
static String EXT_VALUE
          The external value attribute.
static String EXT_VISIBLE
          The external visible attribute.
static String EXT_WRITABLE
          The external writable attribute.
static String JDBC_TYPE_PROPERTY
          The JDBC type property.
 
Method Summary
 void addClassDescriptor(String descriptor)
          Adds a new class descriptor for all connections in the repository.
 void addClassDescriptor(String expr, String descriptor)
          Adds a new class descriptor for the specified connections in the repository.
 void addClassDescriptor(String expr, String descriptor, Map types)
          Adds a new class descriptor for the specified connections in the repository.
 void clearClassDescriptors()
          Clears all class decriptors.
 void clearConnectionDescriptors()
          Clears all connection decriptors.
 boolean containsClassDescriptor(String expr, String className)
          Checks whether the specified class descriptor is mapped.
 boolean containsConnectionDescriptor(String key)
          Checks whether the specified connection descriptor is mapped.
 String getAttributeType(String jdbcType)
          Gets the Java attribute type corresponding to the specified JDBC type.
 String getConnectionDTD()
          Gets the connection DTD.
 String getConnectionURL(String key)
          Gets the URL of the specified connection.
 String getConnectionUsername(String key)
          Gets the username of the specified connection.
 String getDefaultConnectionKey()
          Gets the key of the default connection.
 long getLastModified(String key)
          Gets the last modification time of the specified connection.
 String getRepositoryDTD()
          Gets the repository DTD.
 ObjectName getVariableRegistryName()
          Gets the the variable registry of this factory.
 boolean isCombinedFactoryCache()
          Checks whether objects from all connections should be cached in only one combined factory cache.
 boolean isRefreshReferencesEnabled()
          Checks whether automatic refresh of references is enabled.
 boolean isTraceReferencesDisabled()
          Checks whether traced refresh of references is disabled.
 Set jdbcTypeSet()
          Returns a read-only set of JDBC types mapped either to a default type or to a specified attribute type.
 Collection query(String className, String expr, boolean sql)
          Queries for instances of the specified class by applying a query language.
 Collection query(String key, String className, String expr, boolean sql)
          Queries for instances of the specified class through the named connection by applying a query language.
 void removeAttributeType(String jdbcType)
          Removes the Java attribute type corresponding to the specified JDBC type and restores the default mapping of the corresponding JDBC type.
 void removeConnectionDescriptor(String key)
          Removes the default connection descriptor from the repository.
 void removeConnectionDescriptor(String key, String user, String pswd)
          Removes the specified connection descriptor from the repository.
 void setAttributeType(String jdbcType, String attributeType)
          Sets the Java attribute type corresponding to the specified JDBC type.
 void setCombinedFactoryCache(boolean flag)
          Sets whether objects from all connections should be cached in only one combined factory cache.
 void setConnectionDescriptor(String descriptor)
          Sets a connection descriptor in the repository.
 void setConnectionDescriptor(String descriptor, Object[] params)
          Sets a connection descriptor in the repository.
 void setConnectionDTD(String path)
          Sets the connection DTD.
 void setConnectionPassword(String key, String pswd)
          Sets the password of the specified connection.
 void setConnectionURL(String key, String url)
          Sets the URL of the specified connection.
 void setConnectionUsername(String key, String user)
          Gets the username of the specified connection.
 void setDefaultConnectionKey(String key)
          Sets the key of the default connection.
 void setDefaultConnectionKey(String key, String user, String pswd)
          Sets the key, username and password of the default connection.
 void setRefreshReferencesEnabled(boolean flag)
          Sets whether automatic refresh of references is enabled.
 void setRepositoryDTD(String path)
          Sets the repository DTD.
 void setTraceReferencesDisabled(boolean flag)
          Sets whether traced refresh of references is disabled.
 void setVariableRegistryName(ObjectName registry)
          Sets the variable registry of this factory.
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance, getInstance, isLoaderSupported
 
Methods inherited from interface org.norther.tammi.core.config.Configurable
addProperty, addProperty, clearProperties, containsProperty, getConfigKey, getProperties, getProperty, getPropertyFilePath, indexOfProperty, propertyMap, propertyMap, removeProperty, removeProperty, setConfigKey, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, storeProperties
 
Methods inherited from interface org.norther.tammi.core.cache.KeyCacheClient
cacheKeySet, clearCaches, getCache, removeCache
 
Methods inherited from interface org.norther.tammi.core.cache.CacheClient
clearCached, expireCached, expireFraction, getCache, isCachingDisabled, removeCache, setCachingDisabled
 
Methods inherited from interface org.norther.tammi.core.base.Refreshable
getRefreshed, refresh
 

Field Detail

ANY_ALIAS

static final String ANY_ALIAS
The wildcard expression.

See Also:
Constant Field Values

EXT_BEGIN_CLASS

static final String EXT_BEGIN_CLASS
The external begin class attribute.

See Also:
Constant Field Values

EXT_END_CLASS

static final String EXT_END_CLASS
The external end class attribute.

See Also:
Constant Field Values

EXT_BASE_CLASS_NAME

static final String EXT_BASE_CLASS_NAME
The external super class attribute.

See Also:
Constant Field Values

EXT_IMPORTER_CLASS_NAME

static final String EXT_IMPORTER_CLASS_NAME
The external importer attribute.

See Also:
Constant Field Values

EXT_EXPORTER_CLASS_NAME

static final String EXT_EXPORTER_CLASS_NAME
The external exporter attribute.

See Also:
Constant Field Values

EXT_VALIDATOR_CLASS_NAME

static final String EXT_VALIDATOR_CLASS_NAME
The external validator attribute.

See Also:
Constant Field Values

EXT_COMPARATOR_CLASS_NAME

static final String EXT_COMPARATOR_CLASS_NAME
The external comparator attribute.

See Also:
Constant Field Values

EXT_NAME_PATTERN

static final String EXT_NAME_PATTERN
The external name pattern attribute.

See Also:
Constant Field Values

EXT_BEGIN_FIELD

static final String EXT_BEGIN_FIELD
The external begin field attribute.

See Also:
Constant Field Values

EXT_END_FIELD

static final String EXT_END_FIELD
The external end field attribute.

See Also:
Constant Field Values

EXT_INDEX

static final String EXT_INDEX
The external index attribute.

See Also:
Constant Field Values

EXT_VALUE

static final String EXT_VALUE
The external value attribute.

See Also:
Constant Field Values

EXT_TYPE

static final String EXT_TYPE
The external type attribute.

See Also:
Constant Field Values

EXT_DESCRIPTION

static final String EXT_DESCRIPTION
The external description attribute.

See Also:
Constant Field Values

EXT_GROUP

static final String EXT_GROUP
The external group attribute.

See Also:
Constant Field Values

EXT_DETAIL

static final String EXT_DETAIL
The external detail attribute.

See Also:
Constant Field Values

EXT_VISIBLE

static final String EXT_VISIBLE
The external visible attribute.

See Also:
Constant Field Values

EXT_READABLE

static final String EXT_READABLE
The external readable attribute.

See Also:
Constant Field Values

EXT_WRITABLE

static final String EXT_WRITABLE
The external writable attribute.

See Also:
Constant Field Values

EXT_CLONEABLE

static final String EXT_CLONEABLE
The external cloneable attribute.

See Also:
Constant Field Values

EXT_MANDATORY

static final String EXT_MANDATORY
The external mandatory attribute.

See Also:
Constant Field Values

EXT_TRANSIENT

static final String EXT_TRANSIENT
The external transient attribute.

See Also:
Constant Field Values

EXT_SERIALIZED

static final String EXT_SERIALIZED
The external serialized attribute.

See Also:
Constant Field Values

EXT_CORRELATIVE

static final String EXT_CORRELATIVE
The external correlative attribute.

See Also:
Constant Field Values

EXT_INTERACTIVE

static final String EXT_INTERACTIVE
The external interactive attribute.

See Also:
Constant Field Values

EXT_REFERENCE

static final String EXT_REFERENCE
The external reference attribute.

See Also:
Constant Field Values

EXT_COLLECTION

static final String EXT_COLLECTION
The external collection attribute.

See Also:
Constant Field Values

EXT_PRIMARY

static final String EXT_PRIMARY
The external primary attribute.

See Also:
Constant Field Values

EXT_LOCALIZED

static final String EXT_LOCALIZED
The external localized attribute.

See Also:
Constant Field Values

EXT_ORDERED

static final String EXT_ORDERED
The external ordered attribute.

See Also:
Constant Field Values

EXT_SORTED

static final String EXT_SORTED
The external sorted attribute.

See Also:
Constant Field Values

EXT_TRACEABLE

static final String EXT_TRACEABLE
The external traceable attribute.

See Also:
Constant Field Values

EXT_DISABLED

static final String EXT_DISABLED
The external disabled attribute.

See Also:
Constant Field Values

EXT_TRIMMED

static final String EXT_TRIMMED
The external trimmed attribute.

See Also:
Constant Field Values

EXT_BLANK_ACCEPTED

static final String EXT_BLANK_ACCEPTED
The external blank accepted attribute.

See Also:
Constant Field Values

EXT_EMPTY_ACCEPTED

static final String EXT_EMPTY_ACCEPTED
The external empty accepted attribute.

See Also:
Constant Field Values

EXT_LOCAL

static final String EXT_LOCAL
The external local attribute.

See Also:
Constant Field Values

EXT_OPTIONS

static final String EXT_OPTIONS
The external options attribute.

See Also:
Constant Field Values

EXT_MIN_VALUE

static final String EXT_MIN_VALUE
The external min value attribute.

See Also:
Constant Field Values

EXT_MAX_VALUE

static final String EXT_MAX_VALUE
The external max value attribute.

See Also:
Constant Field Values

EXT_PATTERN

static final String EXT_PATTERN
The external pattern attribute.

See Also:
Constant Field Values

EXT_SHADOW

static final String EXT_SHADOW
The external shadow attribute.

See Also:
Constant Field Values

EXT_ENUMERATED

static final String EXT_ENUMERATED
The external enumeration attribute.

See Also:
Constant Field Values

EXT_ENUM_NAME

static final String EXT_ENUM_NAME
The external enum name attribute.

See Also:
Constant Field Values

EXT_ENUM_VALUE

static final String EXT_ENUM_VALUE
The external enum value attribute.

See Also:
Constant Field Values

EXT_ORDER_BY

static final String EXT_ORDER_BY
The external order-by attribute.

See Also:
Constant Field Values

EXT_DESCENDING

static final String EXT_DESCENDING
The external descending attribute.

See Also:
Constant Field Values

JDBC_TYPE_PROPERTY

static final String JDBC_TYPE_PROPERTY
The JDBC type property.

See Also:
Constant Field Values
Method Detail

getLastModified

long getLastModified(String key)
Gets the last modification time of the specified connection.

Parameters:
key - the connection key.
Returns:
the modification time in msecs.

getDefaultConnectionKey

String getDefaultConnectionKey()
Gets the key of the default connection.

Returns:
the key of the default connection.

setDefaultConnectionKey

void setDefaultConnectionKey(String key)
Sets the key of the default connection.

Parameters:
key - the key of the default connection.

setDefaultConnectionKey

void setDefaultConnectionKey(String key,
                             String user,
                             String pswd)
Sets the key, username and password of the default connection.

Parameters:
key - the key of the default connection.
user - the username of the default connection.
pswd - the password of the default connection.

getConnectionUsername

String getConnectionUsername(String key)
Gets the username of the specified connection.

Parameters:
key - the key of the connection.
Returns:
the username of the connection.

setConnectionUsername

void setConnectionUsername(String key,
                           String user)
Gets the username of the specified connection.

Parameters:
key - the key of the connection.
user - the username of the connection.

setConnectionPassword

void setConnectionPassword(String key,
                           String pswd)
Sets the password of the specified connection.

Parameters:
key - the key of the connection.
pswd - the password of the connection.

getConnectionURL

String getConnectionURL(String key)
Gets the URL of the specified connection.

Parameters:
key - the key of the connection.
Returns:
the URL of the connection.

setConnectionURL

void setConnectionURL(String key,
                      String url)
Sets the URL of the specified connection.

Parameters:
key - the key of the connection.
url - the URL of the connection.

getConnectionDTD

String getConnectionDTD()
Gets the connection DTD.

Returns:
the connection DTD.

setConnectionDTD

void setConnectionDTD(String path)
Sets the connection DTD.

Parameters:
path - the connection DTD.

setConnectionDescriptor

void setConnectionDescriptor(String descriptor)
                             throws LogException
Sets a connection descriptor in the repository. The descriptor may be a file or URL containing one or more connection descriptors, or it may itself contain connection descriptors in XML format.

Parameters:
descriptor - the connection descriptor.
Throws:
LogException - on errors.

setConnectionDescriptor

void setConnectionDescriptor(String descriptor,
                             Object[] params)
                             throws LogException
Sets a connection descriptor in the repository. The descriptor may be a file or URL containing one or more connection descriptors, or it may itself contain connection descriptors in XML format. Parameters are message format parameters for the database connection.

Parameters:
descriptor - the connection descriptor.
params - message format parameters.
Throws:
LogException - on errors.

containsConnectionDescriptor

boolean containsConnectionDescriptor(String key)
Checks whether the specified connection descriptor is mapped.

Parameters:
key - the key i.e. the alias name of the connection.
Returns:
true for a mapped connection descriptor, otherwise false.

removeConnectionDescriptor

void removeConnectionDescriptor(String key)
Removes the default connection descriptor from the repository.

Parameters:
key - the key i.e. the alias name of the connection.

removeConnectionDescriptor

void removeConnectionDescriptor(String key,
                                String user,
                                String pswd)
Removes the specified connection descriptor from the repository.

Parameters:
key - the key i.e. the alias name of the connection.
user - the username of the connection.
pswd - the password of the connection.

clearConnectionDescriptors

void clearConnectionDescriptors()
Clears all connection decriptors.


getRepositoryDTD

String getRepositoryDTD()
Gets the repository DTD.

Returns:
the repository DTD.

setRepositoryDTD

void setRepositoryDTD(String path)
Sets the repository DTD.

Parameters:
path - the repository DTD.

addClassDescriptor

void addClassDescriptor(String descriptor)
                        throws LogException
Adds a new class descriptor for all connections in the repository. The descriptor may be a file or URL containing one or more class descriptors, or it may itself contain class descriptors in XML format.

Declared but missing classes are defined and loaded as VariableMBeans containing the declared fields as their attributes.

Parameters:
descriptor - the class descriptor.
Throws:
LogException - on errors.

addClassDescriptor

void addClassDescriptor(String expr,
                        String descriptor)
                        throws LogException
Adds a new class descriptor for the specified connections in the repository. The descriptor may be a file or URL containing one or more class descriptors, or it may itself contain class descriptors in XML format.

Declared but missing classes are defined and loaded as Variables containing the declared fields as their attributes.

Parameters:
expr - the expression matching connection aliases.
descriptor - the class descriptor.
Throws:
LogException - on errors.

addClassDescriptor

void addClassDescriptor(String expr,
                        String descriptor,
                        Map types)
                        throws LogException
Adds a new class descriptor for the specified connections in the repository. The descriptor may be a file or URL containing one or more class descriptors, or it may itself contain class descriptors in XML format.

Declared but missing classes are defined and loaded as Variables containing the declared fields as their attributes. The types of the attributes corresponding to the declared JDBC types can be given in a separate type map. Default types are applied to undefined types.

Parameters:
expr - the expression matching connection aliases.
descriptor - the class descriptor.
types - JDBC type mappings.
Throws:
LogException - on errors.

containsClassDescriptor

boolean containsClassDescriptor(String expr,
                                String className)
Checks whether the specified class descriptor is mapped.

Parameters:
expr - the expression matching connection aliases.
className - the name of the class.
Returns:
true for a mapped class descriptor, otherwise false.

clearClassDescriptors

void clearClassDescriptors()
Clears all class decriptors.


getAttributeType

String getAttributeType(String jdbcType)
Gets the Java attribute type corresponding to the specified JDBC type.

Parameters:
jdbcType - the JDBC type.
Returns:
the corresponding Java type name.

setAttributeType

void setAttributeType(String jdbcType,
                      String attributeType)
Sets the Java attribute type corresponding to the specified JDBC type. This setting replaces the default mapping of the corresponding JDBC type.

Parameters:
jdbcType - the JDBC type.
attributeType - the corresponding Java type name.

removeAttributeType

void removeAttributeType(String jdbcType)
Removes the Java attribute type corresponding to the specified JDBC type and restores the default mapping of the corresponding JDBC type.

Parameters:
jdbcType - the JDBC type.

jdbcTypeSet

Set jdbcTypeSet()
Returns a read-only set of JDBC types mapped either to a default type or to a specified attribute type.

Returns:
a set of JDBC types.

isCombinedFactoryCache

boolean isCombinedFactoryCache()
Checks whether objects from all connections should be cached in only one combined factory cache.

Returns:
true for a combined cache, false otherwise.

setCombinedFactoryCache

void setCombinedFactoryCache(boolean flag)
Sets whether objects from all connections should be cached in only one combined factory cache.

Note that the factory cache is applied only if explicitly configured.

Parameters:
flag - true for a combined cache, false otherwise.

isRefreshReferencesEnabled

boolean isRefreshReferencesEnabled()
Checks whether automatic refresh of references is enabled.

Returns:
true if enabled, false otherwise.

setRefreshReferencesEnabled

void setRefreshReferencesEnabled(boolean flag)
Sets whether automatic refresh of references is enabled.

Parameters:
flag - true if enabled, false otherwise.

isTraceReferencesDisabled

boolean isTraceReferencesDisabled()
Checks whether traced refresh of references is disabled.

Returns:
true if disabled, false otherwise.

setTraceReferencesDisabled

void setTraceReferencesDisabled(boolean flag)
Sets whether traced refresh of references is disabled.

Parameters:
flag - true if disabled, false otherwise.

getVariableRegistryName

ObjectName getVariableRegistryName()
Gets the the variable registry of this factory.

Returns:
the object name of the variable registry or a query.

setVariableRegistryName

void setVariableRegistryName(ObjectName registry)
Sets the variable registry of this factory. If it is not set, the default one will be used.

Parameters:
registry - the object name of the variable registry or a query.

query

Collection query(String className,
                 String expr,
                 boolean sql)
                 throws Exception
Queries for instances of the specified class by applying a query language.

Parameters:
className - the class name.
expr - the query expression.
sql - a flag to apply SQL.
Returns:
a collection of instances.
Throws:
Exception - on errors.

query

Collection query(String key,
                 String className,
                 String expr,
                 boolean sql)
                 throws Exception
Queries for instances of the specified class through the named connection by applying a query language.

Parameters:
key - the connection key.
className - the class name.
expr - the query expression.
sql - a flag to apply SQL.
Returns:
a collection of instances.
Throws:
Exception - on errors.


Copyright © 2004 The Norther Organization. All rights reserved.