|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.config.DefaultConfigurable
org.norther.tammi.core.config.DefaultConfigurableFactory
org.norther.tammi.root.db.AbstractPersisterFactory
public abstract class AbstractPersisterFactory
An abstract implementation of PersisterFactory.
| Field Summary | |
|---|---|
protected static String |
DESCRIPTION_SUFFIX
The description suffix. |
protected static String |
DOCTYPE
The DOCTYPE keyword (XML is case-sensitive). |
protected static String |
PRINCIPAL_CLASS_NAME
The principal class name. |
protected static String |
XML_HEADER
The XML version header. |
| Fields inherited from class org.norther.tammi.core.config.DefaultConfigurable |
|---|
MODIFIED, SYNCHRONIZED, UNMODIFIED |
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
AbstractPersisterFactory()
Constructs a new factory. |
|
| 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. |
Set |
cacheKeySet()
Returns the cache key set. |
void |
clearCached()
Clears all cached entries without notifying. |
void |
clearCaches()
Removes all caches. |
void |
expireCached(long timestamp)
Expires all cached entries notifying them about expiration. |
void |
expireFraction(long timestamp,
float fraction)
Expires the specified fraction of cached entries notifying them about expiration. |
protected VariableAttributeInfo |
getAttributeInfo(String className,
String name,
Configuration config,
MBeanReference owner)
Gets attribute info for an auxiliary attribute. |
protected VariableAttributeInfo |
getAttributeInfo(String name,
String type,
String descr,
Configuration config,
MBeanReference owner)
Gets the default attribute info. |
String |
getAttributeType(String jdbcType)
Gets the Java attribute type corresponding to the specified JDBC type. |
ConcurrentMap |
getCache(boolean create)
Gets and optionally creates the cache. |
ConcurrentMap |
getCache(String key,
boolean create)
Gets and optionally creates the cache for the specified key. |
protected Comparator |
getComparator(Configuration config)
Gets the comparator property, if set. |
String |
getConnectionDTD()
Gets the connection DTD. |
protected abstract String |
getDefaultConnectionDTD()
Gets the default connection DTD. |
protected abstract String |
getDefaultRepositoryDTD()
Gets the default repository DTD. |
protected List |
getEnumeration(Configuration config)
Gets the enumeration property, if set. |
protected static String |
getJdbcTypeName(int type)
Gets the name of the specified JDBC type. |
long |
getLastModified(String key)
Gets the last modification time of the specified connection. |
protected abstract List |
getParsedAttributeInfo(String className,
Object repository,
OrderedMap externals,
Map types)
Gets the parsed attributes of a named class in the repository. |
long |
getRefreshed()
Gets the last refresh timestamp. |
String |
getRepositoryDTD()
Gets the repository DTD. |
protected MBeanReference |
getVariableRegistryMBean()
Gets a reference to the variable registry MBean. |
ObjectName |
getVariableRegistryName()
Gets the the variable registry of this factory. |
boolean |
isCachingDisabled()
Checks whether the caching is disabled. |
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. |
void |
modified(String key,
long msecs)
Invoked when modified. |
void |
postmanaged()
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time. |
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 |
refresh()
Refreshes the MBean. |
protected void |
registerDynamicAttributes(OrderedMap variables,
Object repository,
Map types)
Registers dynamic attributes of the specified variables. |
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 |
removeCache()
Removes the cache. |
void |
removeCache(String key)
Removes the specified cache. |
void |
removeConnectionDescriptor(String key)
Removes the default connection descriptor from the repository. |
protected String |
resolveDescriptor(String descriptor,
String dtd,
String tag)
Resolves the input source of a descriptor. |
protected StringBuilder |
resolveInlineDTD(PathFinder finder,
String key,
String path,
String tag)
Resolves an inline DOCTYPE and DTD. |
protected String |
resolveJdbcAlias(String alias)
Resolves a JDBC alias containing a parametrized local path that must be replaced with a real one. |
void |
setAttributeType(String jdbcType,
String fieldType)
Sets the Java attribute type corresponding to the specified JDBC type. |
void |
setCachingDisabled(boolean flag)
Sets the caching disabled flag. |
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 |
setConnectionDTD(String path)
Sets the connection DTD. |
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. |
void |
unmanaged()
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time. |
| Methods inherited from class org.norther.tammi.core.config.DefaultConfigurableFactory |
|---|
getInstance, getInstance, getInstance, getInstance, isLoaderSupported |
| Methods inherited from class org.norther.tammi.core.config.DefaultConfigurable |
|---|
addProperty, addProperty, clearProperties, containsProperty, getConfigKey, getConfiguration, getModifiedState, getProperties, getProperty, getPropertyFilePath, indexOfProperty, loadConfiguration, loadConfiguration, loadConfiguration, modified, propertyMap, propertyMap, removeProperty, removeProperty, setConfigKey, setModifiedState, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, storeProperties |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.root.db.PersisterFactory |
|---|
addClassDescriptor, clearClassDescriptors, clearConnectionDescriptors, containsClassDescriptor, containsConnectionDescriptor, getConnectionURL, getConnectionUsername, getDefaultConnectionKey, removeConnectionDescriptor, setConnectionDescriptor, setConnectionPassword, setConnectionURL, setConnectionUsername, setDefaultConnectionKey, setDefaultConnectionKey |
| 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 |
| Field Detail |
|---|
protected static final String PRINCIPAL_CLASS_NAME
protected static final String XML_HEADER
protected static final String DOCTYPE
protected static final String DESCRIPTION_SUFFIX
| Constructor Detail |
|---|
public AbstractPersisterFactory()
| Method Detail |
|---|
protected static String getJdbcTypeName(int type)
type - the type code.
public void postmanaged()
Manageable
postmanaged in interface Manageablepostmanaged in class Adaptee
public void unmanaged()
throws Exception
Manageable
unmanaged in interface Manageableunmanaged in class AdapteeException - if the adaptee refused to be unmanaged.public boolean isCachingDisabled()
CacheClient
isCachingDisabled in interface CacheClientpublic void setCachingDisabled(boolean flag)
CacheClient
setCachingDisabled in interface CacheClientflag - the caching disabled flag.public void expireCached(long timestamp)
CacheClient
expireCached in interface CacheClienttimestamp - the timestamp of the expiration.
public void expireFraction(long timestamp,
float fraction)
CacheClient
expireFraction in interface CacheClienttimestamp - the timestamp of the expiration.fraction - the fraction of entries to expire (0.0..1.0).public void clearCached()
CacheClient
clearCached in interface CacheClientpublic ConcurrentMap getCache(boolean create)
CacheClient
getCache in interface CacheClientcreate - true to create a missing cache.
public void removeCache()
CacheClient
removeCache in interface CacheClient
public ConcurrentMap getCache(String key,
boolean create)
KeyCacheClient
getCache in interface KeyCacheClientkey - the cache key.create - true to create a missing cache.
public void removeCache(String key)
KeyCacheClient
removeCache in interface KeyCacheClientkey - the cache key.public Set cacheKeySet()
KeyCacheClient
cacheKeySet in interface KeyCacheClientpublic void clearCaches()
KeyCacheClient
clearCaches in interface KeyCacheClientpublic void refresh()
Refreshable
refresh in interface Refreshablepublic long getRefreshed()
Refreshable
getRefreshed in interface Refreshablepublic long getLastModified(String key)
PersisterFactory
getLastModified in interface PersisterFactorykey - the connection key.
public String getConnectionDTD()
PersisterFactory
getConnectionDTD in interface PersisterFactorypublic void setConnectionDTD(String path)
PersisterFactory
setConnectionDTD in interface PersisterFactorypath - the connection DTD.
public void setConnectionDescriptor(String descriptor)
throws LogException
PersisterFactory
setConnectionDescriptor in interface PersisterFactorydescriptor - the connection descriptor.
LogException - on errors.public void removeConnectionDescriptor(String key)
PersisterFactory
removeConnectionDescriptor in interface PersisterFactorykey - the key i.e. the alias name of the connection.public String getRepositoryDTD()
PersisterFactory
getRepositoryDTD in interface PersisterFactorypublic void setRepositoryDTD(String path)
PersisterFactory
setRepositoryDTD in interface PersisterFactorypath - the repository DTD.
public void addClassDescriptor(String descriptor)
throws LogException
PersisterFactoryDeclared but missing classes are defined and loaded as VariableMBeans containing the declared fields as their attributes.
addClassDescriptor in interface PersisterFactorydescriptor - the class descriptor.
LogException - on errors.
public void addClassDescriptor(String expr,
String descriptor)
throws LogException
PersisterFactoryDeclared but missing classes are defined and loaded as Variables containing the declared fields as their attributes.
addClassDescriptor in interface PersisterFactoryexpr - the expression matching connection aliases.descriptor - the class descriptor.
LogException - on errors.public String getAttributeType(String jdbcType)
PersisterFactory
getAttributeType in interface PersisterFactoryjdbcType - the JDBC type.
public void setAttributeType(String jdbcType,
String fieldType)
PersisterFactory
setAttributeType in interface PersisterFactoryjdbcType - the JDBC type.fieldType - the corresponding Java type name.public void removeAttributeType(String jdbcType)
PersisterFactory
removeAttributeType in interface PersisterFactoryjdbcType - the JDBC type.public Set jdbcTypeSet()
PersisterFactory
jdbcTypeSet in interface PersisterFactorypublic boolean isCombinedFactoryCache()
PersisterFactory
isCombinedFactoryCache in interface PersisterFactorypublic void setCombinedFactoryCache(boolean flag)
PersisterFactoryNote that the factory cache is applied only if explicitly configured.
setCombinedFactoryCache in interface PersisterFactoryflag - true for a combined cache, false otherwise.public boolean isRefreshReferencesEnabled()
PersisterFactory
isRefreshReferencesEnabled in interface PersisterFactorypublic void setRefreshReferencesEnabled(boolean flag)
PersisterFactory
setRefreshReferencesEnabled in interface PersisterFactoryflag - true if enabled, false otherwise.public boolean isTraceReferencesDisabled()
PersisterFactory
isTraceReferencesDisabled in interface PersisterFactorypublic void setTraceReferencesDisabled(boolean flag)
PersisterFactory
setTraceReferencesDisabled in interface PersisterFactoryflag - true if disabled, false otherwise.public ObjectName getVariableRegistryName()
PersisterFactory
getVariableRegistryName in interface PersisterFactorypublic void setVariableRegistryName(ObjectName registry)
PersisterFactory
setVariableRegistryName in interface PersisterFactoryregistry - the object name of the variable registry or a query.
public Collection query(String className,
String expr,
boolean sql)
throws Exception
PersisterFactory
query in interface PersisterFactoryclassName - the class name.expr - the query expression.sql - a flag to apply SQL.
Exception - on errors.
public Collection query(String key,
String className,
String expr,
boolean sql)
throws Exception
PersisterFactory
query in interface PersisterFactorykey - the connection key.className - the class name.expr - the query expression.sql - a flag to apply SQL.
Exception - on errors.
public void modified(String key,
long msecs)
PersisterListener
modified in interface PersisterListenerkey - the connection key.msecs - the timestamp.
protected String resolveDescriptor(String descriptor,
String dtd,
String tag)
descriptor - the descriptor.dtd - the document dtd.tag - the root element tag.
protected StringBuilder resolveInlineDTD(PathFinder finder,
String key,
String path,
String tag)
throws IOException
finder - the path finder to apply.key - the finder key to apply.path - the DTD path to apply.tag - the root element tag.
IOException - on I/O errors.protected String resolveJdbcAlias(String alias)
alias - the original alias.
protected void registerDynamicAttributes(OrderedMap variables,
Object repository,
Map types)
variables - the variables.repository - the class repository.types - optional type mappings.
protected VariableAttributeInfo getAttributeInfo(String className,
String name,
Configuration config,
MBeanReference owner)
className - the class name.name - the attribute name.config - the configuration.owner - the attribute owner.
protected VariableAttributeInfo getAttributeInfo(String name,
String type,
String descr,
Configuration config,
MBeanReference owner)
name - the attribute name.type - the default type.descr - the default description.config - the configuration.owner - the attribute owner.
protected Comparator getComparator(Configuration config)
config - the properties.
protected List getEnumeration(Configuration config)
config - the properties.
protected MBeanReference getVariableRegistryMBean()
protected abstract String getDefaultConnectionDTD()
protected abstract String getDefaultRepositoryDTD()
protected abstract List getParsedAttributeInfo(String className,
Object repository,
OrderedMap externals,
Map types)
className - the name of the class.repository - the class repository.externals - external properties.types - optional type mappings.
| ||||||