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.

Since:
1.1
Version:
$Revision: 1.24 $
See Also:
Serialized Form

Field Summary
static int ANNOTATIONS
          annotations
protected  java.lang.String catalog
          Catalog name for all classes in this file
protected  java.util.Collection fetchPlans
          Named FetchPlans in this file.
protected  java.lang.String filename
          Name of file
static int JDO_FILE
          JDO file
static int JDOQUERY_FILE
          JDOQUERY file
static int JPA_FILE
          JPA file
protected  java.util.List listeners
          List of event listeners defined for this file.
protected  MetaDataManager metaDataManager
          Manager for this MetaData object.
static int ORM_FILE
          ORM file
protected  java.util.List packages
          List of packages in this file (uses List to retain file positioning)
protected  java.util.Collection queries
          Named queries defined in this file.
protected  java.util.Collection queryResultMetaData
          List of query result MetaData defined for this file.
protected  java.lang.String schema
          Schema name for all classes in this file
protected  int 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(java.lang.String filename, MetaDataManager metaDataManager, java.lang.String catalog, java.lang.String schema)
          Constructor.
 
Method Summary
 void addFetchPlan(FetchPlanMetaData fpmd)
          Method to add a named fetch plan to this class.
 void addListener(EventListenerMetaData listener)
          Add a listener class name
 void addPackage(PackageMetaData pkg)
          Method to add a package
 void addQuery(QueryMetaData qmd)
          Method to add a named query to this class.
 void addQueryResultMetaData(QueryResultMetaData resultMetaData)
          Method to register a query-result MetaData.
 java.lang.String getCatalog()
          Accessor for the catalog name for all classes in this file
 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()
          Accessor for the filename
 java.util.List getListeners()
          Get the event listeners registered against the file.
 MetaDataManager getMetaDataManager()
          Accessor for the MetaDataManager for this 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()
          Accessor for the schema name for all classes in this file
 int getType()
          Accessor for the file type (JDO, ORM, etc)
 void setCatalog(java.lang.String catalog)
          Mutator for the catalog for all classes in this file
 void setFilename(java.lang.String filename)
          Mutator for the filename for this MetaData file.
 void setSchema(java.lang.String schema)
          Mutator for the schema for all classes in this file
 void setType(int type)
          Mutator for the file 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, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, removeExtension, setInitialised, setParent, setPopulated, setUsed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JDO_FILE

public static final int JDO_FILE
JDO file

See Also:
Constant Field Values

ORM_FILE

public static final int ORM_FILE
ORM file

See Also:
Constant Field Values

JDOQUERY_FILE

public static final int JDOQUERY_FILE
JDOQUERY file

See Also:
Constant Field Values

ANNOTATIONS

public static final int ANNOTATIONS
annotations

See Also:
Constant Field Values

JPA_FILE

public static final int JPA_FILE
JPA file

See Also:
Constant Field Values

metaDataManager

protected final transient MetaDataManager metaDataManager
Manager for this MetaData object.


type

protected int 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 queries
Named queries defined in this file.


queryResultMetaData

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


fetchPlans

protected java.util.Collection fetchPlans
Named FetchPlans in this file.


packages

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


listeners

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

Constructor Detail

FileMetaData

public FileMetaData(java.lang.String filename,
                    MetaDataManager metaDataManager,
                    java.lang.String catalog,
                    java.lang.String schema)
Constructor.

Parameters:
filename - The file where this is stored (or null).
metaDataManager - the manager for this MetaData object.
catalog - Name of the catalog for all classes in this file
schema - Name of the schema for all classes in this file
Method Detail

getType

public int getType()
Accessor for the file type (JDO, ORM, etc)

Returns:
The file 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.

getMetaDataManager

public MetaDataManager getMetaDataManager()
Accessor for the MetaDataManager for this file.

Returns:
The MetaDataManager for this file.

getFilename

public java.lang.String getFilename()
Accessor for the filename

Returns:
The filename of this MetaData file.

getCatalog

public java.lang.String getCatalog()
Accessor for the catalog name for all classes in this file

Returns:
Name of the catalog to use.

getSchema

public java.lang.String getSchema()
Accessor for the schema name for all classes in this file

Returns:
Name of the schema to use

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

setType

public void setType(int type)
Mutator for the file type.

Parameters:
type - The file type

addQuery

public void addQuery(QueryMetaData qmd)
Method to add a named query to this class. Rejects the addition of duplicate named queries.

Parameters:
qmd - Meta-Data for the query.

addFetchPlan

public void addFetchPlan(FetchPlanMetaData fpmd)
Method to add a named fetch plan to this class. Rejects the addition of duplicate named fetch plans.

Parameters:
fpmd - Meta-Data for the fetch plan.

setFilename

public void setFilename(java.lang.String filename)
Mutator for the filename for this MetaData file.

Parameters:
filename - The filename of this MetaData file.

setCatalog

public void setCatalog(java.lang.String catalog)
Mutator for the catalog for all classes in this file

Parameters:
catalog - Catalog name to use

setSchema

public void setSchema(java.lang.String schema)
Mutator for the schema for all classes in this file

Parameters:
schema - Schema name to use

addPackage

public void addPackage(PackageMetaData pkg)
Method to add a package

Parameters:
pkg - The PackageMetaData to add.

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.

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

getQueryResultMetaData

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

Returns:
Query Result MetaData


Copyright © 2009. All Rights Reserved.