org.apache.openjpa.meta
Class AbstractMetaDataFactory

java.lang.Object
  extended by org.apache.openjpa.meta.AbstractMetaDataFactory
All Implemented Interfaces:
MetaDataFactory, MetaDataModes
Direct Known Subclasses:
AbstractCFMetaDataFactory

public abstract class AbstractMetaDataFactory
extends Object
implements MetaDataFactory

Abstract MetaDataFactory that provides default implementations of many methods.

Author:
Abe White

Field Summary
protected  File dir
           
protected  Log log
           
protected  MetaDataRepository repos
           
protected  int store
           
protected  boolean strict
           
protected  Set types
           
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataFactory
STORE_DEFAULT, STORE_PER_CLASS, STORE_VERBOSE
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
 
Constructor Summary
AbstractMetaDataFactory()
           
 
Method Summary
 void addClassExtensionKeys(Collection exts)
          Add any extension keys used by this instance to the given set.
 void addFieldExtensionKeys(Collection exts)
          Add any extension keys used by this instance to the given set.
 void clear()
          Clear any internal caches.
 boolean drop(Class[] cls, int mode, ClassLoader envLoader)
          Drop the metadata for the given classes in the given mode(s).
 Set getPersistentTypeNames(boolean devpath, ClassLoader envLoader)
          Return all persistent class names, using the metadata locations supplied in configuration, optionally scanning the classpath.
 Class getQueryScope(String queryName, ClassLoader loader)
          Return the type defining the given query name, if any.
 Class getResultSetMappingScope(String resultSetMappingName, ClassLoader loader)
          Return the type defining the given result set mapping name, if any.
 ClassArgParser newClassArgParser()
          Return a properly-configured class arg parser for our expected metadata format.
 void setRepository(MetaDataRepository repos)
          Set the repository to load metadata into.
 void setStoreDirectory(File dir)
          Base directory for storing metadata.
 void setStoreMode(int store)
          Storage mode.
 void setStrict(boolean strict)
          If true, I/O's must exactly obey the mode directives given, and may not load additional information.
 void setTypes(Set types)
          Set of persistent type names supplied by user.
 void setTypes(String types)
          Set of semicolon-separated persistent type names supplied by user via auto-configuration.
 boolean store(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map output)
          Store the given metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.meta.MetaDataFactory
getDefaults, load, loadXMLMetaData
 

Field Detail

repos

protected MetaDataRepository repos

log

protected transient Log log

dir

protected File dir

store

protected int store

strict

protected boolean strict

types

protected Set types
Constructor Detail

AbstractMetaDataFactory

public AbstractMetaDataFactory()
Method Detail

setTypes

public void setTypes(Set types)
Set of persistent type names supplied by user.


setTypes

public void setTypes(String types)
Set of semicolon-separated persistent type names supplied by user via auto-configuration.


setRepository

public void setRepository(MetaDataRepository repos)
Description copied from interface: MetaDataFactory
Set the repository to load metadata into. This method will be called before use.

Specified by:
setRepository in interface MetaDataFactory

setStoreDirectory

public void setStoreDirectory(File dir)
Description copied from interface: MetaDataFactory
Base directory for storing metadata. May not be called.

Specified by:
setStoreDirectory in interface MetaDataFactory

setStoreMode

public void setStoreMode(int store)
Description copied from interface: MetaDataFactory
Storage mode. May not be called.

Specified by:
setStoreMode in interface MetaDataFactory

setStrict

public void setStrict(boolean strict)
Description copied from interface: MetaDataFactory
If true, I/O's must exactly obey the mode directives given, and may not load additional information.

Specified by:
setStrict in interface MetaDataFactory

store

public boolean store(ClassMetaData[] metas,
                     QueryMetaData[] queries,
                     SequenceMetaData[] seqs,
                     int mode,
                     Map output)
Description copied from interface: MetaDataFactory
Store the given metadata.

Specified by:
store in interface MetaDataFactory
mode - hint about what aspects of the metadata have changed
output - if non-null, rather than storing metadata directly, add entries mapping each output destination such as a File to the planned output for that destination in string form
Returns:
false if this factory is unable to store metadata

drop

public boolean drop(Class[] cls,
                    int mode,
                    ClassLoader envLoader)
Description copied from interface: MetaDataFactory
Drop the metadata for the given classes in the given mode(s).

Specified by:
drop in interface MetaDataFactory
Returns:
false if any metadata could not be dropped

getPersistentTypeNames

public Set getPersistentTypeNames(boolean devpath,
                                  ClassLoader envLoader)
Description copied from interface: MetaDataFactory
Return all persistent class names, using the metadata locations supplied in configuration, optionally scanning the classpath. Return null if no types are supplied and this factory is unable to scan the classpath. This method should not be used directly by outside code; use MetaDataRepository.getPersistentTypeNames(boolean, java.lang.ClassLoader) instead.

Specified by:
getPersistentTypeNames in interface MetaDataFactory
See Also:
MetaDataRepository.getPersistentTypeNames(boolean, java.lang.ClassLoader), MetaDataRepository.loadPersistentTypes(boolean, java.lang.ClassLoader)

getQueryScope

public Class getQueryScope(String queryName,
                           ClassLoader loader)
Description copied from interface: MetaDataFactory
Return the type defining the given query name, if any.

Specified by:
getQueryScope in interface MetaDataFactory

getResultSetMappingScope

public Class getResultSetMappingScope(String resultSetMappingName,
                                      ClassLoader loader)
Description copied from interface: MetaDataFactory
Return the type defining the given result set mapping name, if any.

Specified by:
getResultSetMappingScope in interface MetaDataFactory

newClassArgParser

public ClassArgParser newClassArgParser()
Description copied from interface: MetaDataFactory
Return a properly-configured class arg parser for our expected metadata format.

Specified by:
newClassArgParser in interface MetaDataFactory

clear

public void clear()
Description copied from interface: MetaDataFactory
Clear any internal caches.

Specified by:
clear in interface MetaDataFactory

addClassExtensionKeys

public void addClassExtensionKeys(Collection exts)
Description copied from interface: MetaDataFactory
Add any extension keys used by this instance to the given set.

Specified by:
addClassExtensionKeys in interface MetaDataFactory

addFieldExtensionKeys

public void addFieldExtensionKeys(Collection exts)
Description copied from interface: MetaDataFactory
Add any extension keys used by this instance to the given set.

Specified by:
addFieldExtensionKeys in interface MetaDataFactory


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.