org.apache.openjpa.meta
Interface MetaDataFactory

All Superinterfaces:
MetaDataModes
All Known Implementing Classes:
AbstractCFMetaDataFactory, AbstractMetaDataFactory, DelegatingMetaDataFactory, MetaDataPlusMappingFactory, NoneMetaDataFactory, PersistenceMappingFactory, PersistenceMetaDataFactory

public interface MetaDataFactory
extends MetaDataModes

The MetaDataRepository uses implementations of this interface to load and store metadata. Implementations need not be threadsafe.

Author:
Patrick Linskey, Abe White, Pinaki Poddar

Field Summary
static int STORE_DEFAULT
           
static int STORE_PER_CLASS
           
static int 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
 
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).
 MetaDataDefaults getDefaults()
          Return the metadata defaults for this factory.
 Class<?> getManagedClass(Class<?> c)
          Gets the managed class corresponding to the given meta-class.
 String getManagedClassName(String metamodelClassName)
          Gets the name of the managed class for the given fully-qualified meta-model class name.
 String getMetaModelClassName(String managedClassName)
          Gets the name of the meta-model class for the given fully-qualified managed class name.
 Set<String> 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.
 boolean isMetaClass(Class<?> c)
          Affirms if the given class is a meta-class.
 void load(Class<?> cls, int mode, ClassLoader envLoader)
          Load metadata for the given class in the given mode(s).
 void loadXMLMetaData(Class<?> cls)
          Load XMLClassMetadata for the given class.
 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.
 boolean store(ClassMetaData[] metas, QueryMetaData[] queries, SequenceMetaData[] seqs, int mode, Map<File,String> output)
          Store the given metadata.
 

Field Detail

STORE_DEFAULT

static final int STORE_DEFAULT
See Also:
Constant Field Values

STORE_PER_CLASS

static final int STORE_PER_CLASS
See Also:
Constant Field Values

STORE_VERBOSE

static final int STORE_VERBOSE
See Also:
Constant Field Values
Method Detail

setRepository

void setRepository(MetaDataRepository repos)
Set the repository to load metadata into. This method will be called before use.


setStoreDirectory

void setStoreDirectory(File dir)
Base directory for storing metadata. May not be called.


setStoreMode

void setStoreMode(int store)
Storage mode. May not be called.


setStrict

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


load

void load(Class<?> cls,
          int mode,
          ClassLoader envLoader)
Load metadata for the given class in the given mode(s). If loading in MetaDataModes.MODE_QUERY, the class may be null. Loaded metadata should be added directly to the repository. It should have its source mode set appropriately via ClassMetaData.setSourceMode(int).

Parameters:
mode - the mode to load metadata in: if mapping information is stored together with metadata, then you can load mapping data even if this mode only includes MODE_META, so long as the strict property hasn't been set

store

boolean store(ClassMetaData[] metas,
              QueryMetaData[] queries,
              SequenceMetaData[] seqs,
              int mode,
              Map<File,String> output)
Store the given metadata.

Parameters:
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

boolean drop(Class<?>[] cls,
             int mode,
             ClassLoader envLoader)
Drop the metadata for the given classes in the given mode(s).

Returns:
false if any metadata could not be dropped

getDefaults

MetaDataDefaults getDefaults()
Return the metadata defaults for this factory.


getPersistentTypeNames

Set<String> getPersistentTypeNames(boolean devpath,
                                   ClassLoader envLoader)
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.

See Also:
MetaDataRepository.getPersistentTypeNames(boolean, java.lang.ClassLoader), MetaDataRepository.loadPersistentTypes(boolean, java.lang.ClassLoader)

getQueryScope

Class<?> getQueryScope(String queryName,
                       ClassLoader loader)
Return the type defining the given query name, if any.


getResultSetMappingScope

Class<?> getResultSetMappingScope(String resultSetMappingName,
                                  ClassLoader loader)
Return the type defining the given result set mapping name, if any.


newClassArgParser

ClassArgParser newClassArgParser()
Return a properly-configured class arg parser for our expected metadata format.


clear

void clear()
Clear any internal caches.


addClassExtensionKeys

void addClassExtensionKeys(Collection<?> exts)
Add any extension keys used by this instance to the given set.


addFieldExtensionKeys

void addFieldExtensionKeys(Collection<?> exts)
Add any extension keys used by this instance to the given set.


loadXMLMetaData

void loadXMLMetaData(Class<?> cls)
Load XMLClassMetadata for the given class. Loaded metadata should be added directly to the repository.


getMetaModelClassName

String getMetaModelClassName(String managedClassName)
Gets the name of the meta-model class for the given fully-qualified managed class name.

Since:
2.0.0

getManagedClassName

String getManagedClassName(String metamodelClassName)
Gets the name of the managed class for the given fully-qualified meta-model class name.

Since:
2.0.0

isMetaClass

boolean isMetaClass(Class<?> c)
Affirms if the given class is a meta-class.

Since:
2.0.0

getManagedClass

Class<?> getManagedClass(Class<?> c)
Gets the managed class corresponding to the given meta-class.

Returns:
null if the given input is not a meta-class.
Since:
2.0.0


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