org.datanucleus.metadata
Class FileMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.FileMetaData
All Implemented Interfaces:
java.io.Serializable

public class FileMetaData
extends MetaData

Representation of a Meta-Data file. Contains a list of package meta-data, together with any named queries and fetch plans etc.

See Also:
Serialized Form

Field Summary
protected  java.lang.String catalog
          Catalog name for all classes in this file
protected  java.util.Collection<FetchPlanMetaData> fetchPlans
          Named FetchPlans in this file.
protected  java.lang.String filename
          Name of file
protected  java.util.List<EventListenerMetaData> listeners
          List of event listeners defined for this file.
protected  MetaDataManager metaDataManager
          Manager for this MetaData object.
protected  java.util.List<PackageMetaData> packages
          List of packages in this file (uses List to retain file positioning)
protected  java.util.Collection<QueryMetaData> queries
          Named queries defined in this file.
protected  java.util.Collection<QueryResultMetaData> queryResultMetaData
          List of query result MetaData defined for this file.
protected  java.lang.String schema
          Schema name for all classes in this file
protected  MetadataFileType type
          Type of file (JDO, ORM, JDOQUERY, etc)
 
Fields inherited from class org.datanucleus.metadata.MetaData
extensions, LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME, VENDOR_NAME_OLD
 
Constructor Summary
FileMetaData()
          Constructor.
 
Method Summary
 void addListener(EventListenerMetaData listener)
          Add a listener class name
 void addQueryResultMetaData(QueryResultMetaData resultMetaData)
          Method to register a query-result MetaData.
 java.lang.String getCatalog()
           
 ClassMetaData getClass(java.lang.String pkg_name, java.lang.String class_name)
          Utility method to check if the MetaData for a class is contained in this file.
 FetchPlanMetaData[] getFetchPlans()
          Accessor for the metadata of the named fetch plans.
 java.lang.String getFilename()
           
 java.util.List getListeners()
          Get the event listeners registered against the file.
 int getNoOfFetchPlans()
          Accessor for the number of named fetch plans.
 int getNoOfPackages()
          Accessor for the number of packages.
 int getNoOfQueries()
          Accessor for the number of named queries.
 PackageMetaData getPackage(int i)
          Accessor for the meta-data of a package.
 PackageMetaData getPackage(java.lang.String name)
          Accessor for the Meta-Data of a package with a given name.
 QueryMetaData[] getQueries()
          Accessor for the metadata of the named queries.
 QueryResultMetaData[] getQueryResultMetaData()
          Get the query result MetaData.
 java.lang.String getSchema()
           
 MetadataFileType getType()
           
 FetchPlanMetaData newFetchPlanMetadata(java.lang.String name)
           
 PackageMetaData newPackageMetadata(java.lang.String name)
          Method to create and return a package metadata for the specified package name.
 QueryMetaData newQueryMetadata(java.lang.String queryName)
          Method to create a new QueryMetadata, add it to the registered queries and return it.
 QueryResultMetaData newQueryResultMetadata(java.lang.String name)
          Method to create a new query result metadata, add it, and return it.
 FileMetaData setCatalog(java.lang.String catalog)
           
 FileMetaData setFilename(java.lang.String filename)
           
 void setMetaDataManager(MetaDataManager mmgr)
          Method to set the MetaDataManager in use.
 FileMetaData setSchema(java.lang.String schema)
           
 FileMetaData setType(MetadataFileType type)
           
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object.
 
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtension, assertIfInitialised, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, newExtensionMetaData, removeExtension, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

metaDataManager

protected transient MetaDataManager metaDataManager
Manager for this MetaData object. Used in AbstractMemberMetaData.setRelation process.


type

protected MetadataFileType type
Type of file (JDO, ORM, JDOQUERY, etc)


filename

protected java.lang.String filename
Name of file


catalog

protected java.lang.String catalog
Catalog name for all classes in this file


schema

protected java.lang.String schema
Schema name for all classes in this file


queries

protected java.util.Collection<QueryMetaData> queries
Named queries defined in this file.


queryResultMetaData

protected java.util.Collection<QueryResultMetaData> queryResultMetaData
List of query result MetaData defined for this file.


fetchPlans

protected java.util.Collection<FetchPlanMetaData> fetchPlans
Named FetchPlans in this file.


packages

protected java.util.List<PackageMetaData> packages
List of packages in this file (uses List to retain file positioning)


listeners

protected java.util.List<EventListenerMetaData> listeners
List of event listeners defined for this file.

Constructor Detail

FileMetaData

public FileMetaData()
Constructor.

Method Detail

setMetaDataManager

public void setMetaDataManager(MetaDataManager mmgr)
Method to set the MetaDataManager in use. TODO Remove this

Parameters:
mmgr - MetaDataManager to use

getFilename

public java.lang.String getFilename()

setFilename

public FileMetaData setFilename(java.lang.String filename)

getCatalog

public java.lang.String getCatalog()

setCatalog

public FileMetaData setCatalog(java.lang.String catalog)

getSchema

public java.lang.String getSchema()

setSchema

public FileMetaData setSchema(java.lang.String schema)

getType

public MetadataFileType getType()

setType

public FileMetaData setType(MetadataFileType type)

getNoOfQueries

public int getNoOfQueries()
Accessor for the number of named queries.

Returns:
no of named queries

getQueries

public QueryMetaData[] getQueries()
Accessor for the metadata of the named queries.

Returns:
Meta-Data for the named queries.

getNoOfFetchPlans

public int getNoOfFetchPlans()
Accessor for the number of named fetch plans.

Returns:
no of named fetch plans

getFetchPlans

public FetchPlanMetaData[] getFetchPlans()
Accessor for the metadata of the named fetch plans.

Returns:
Meta-Data for the named fetch plans.

getNoOfPackages

public int getNoOfPackages()
Accessor for the number of packages.

Returns:
no of packages.

getPackage

public PackageMetaData getPackage(int i)
Accessor for the meta-data of a package.

Parameters:
i - index number
Returns:
Meta-Data for a package.

getPackage

public PackageMetaData getPackage(java.lang.String name)
Accessor for the Meta-Data of a package with a given name.

Parameters:
name - Name of the package
Returns:
Meta-Data for the package

getClass

public ClassMetaData getClass(java.lang.String pkg_name,
                              java.lang.String class_name)
Utility method to check if the MetaData for a class is contained in this file.

Parameters:
pkg_name - Name of package
class_name - Name of class
Returns:
The MetaData for the class

newQueryMetadata

public QueryMetaData newQueryMetadata(java.lang.String queryName)
Method to create a new QueryMetadata, add it to the registered queries and return it.

Parameters:
queryName - Name of the query
Returns:
The Query metadata

newFetchPlanMetadata

public FetchPlanMetaData newFetchPlanMetadata(java.lang.String name)

newPackageMetadata

public PackageMetaData newPackageMetadata(java.lang.String name)
Method to create and return a package metadata for the specified package name.

Parameters:
name - Name of the package
Returns:
The PackageMetadata

addListener

public void addListener(EventListenerMetaData listener)
Add a listener class name

Parameters:
listener - the listener metadata. Duplicated classes are ignored

getListeners

public java.util.List getListeners()
Get the event listeners registered against the file.

Returns:
the event listeners

addQueryResultMetaData

public void addQueryResultMetaData(QueryResultMetaData resultMetaData)
Method to register a query-result MetaData.

Parameters:
resultMetaData - Query-Result MetaData to register

newQueryResultMetadata

public QueryResultMetaData newQueryResultMetadata(java.lang.String name)
Method to create a new query result metadata, add it, and return it.

Parameters:
name - Name of the result
Returns:
The query result metadata

getQueryResultMetaData

public QueryResultMetaData[] getQueryResultMetaData()
Get the query result MetaData.

Returns:
Query Result MetaData

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object.

Overrides:
toString in class MetaData
Parameters:
prefix - Any prefix for the output
indent - The indent
Returns:
a string representation of the object.


Copyright © 2010. All Rights Reserved.