com.metamatrix.metadata.runtime.model
Class MetadataCache

java.lang.Object
  extended by com.metamatrix.metadata.runtime.model.MetadataCache
All Implemented Interfaces:
MetadataSourceAPI, java.io.Serializable

public class MetadataCache
extends java.lang.Object
implements MetadataSourceAPI, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
MetadataCache()
          pass true for loadMetadata if the information for the groups and elements are to be loaded.
 
Method Summary
protected  void buildGroupObjects(java.util.Iterator it)
          Bould groups to be displayed in the metadata tree.
 java.util.Collection getAllModels()
          Returns a Collection of Models that represents all the models
 java.util.List getColumns(GroupID groupID)
          Returns all the columns for a group in the VDB
 java.util.Collection getDisplayableModels()
          This returns those models that should be made visible to the console and therefore, only the models from the database are considered for display
 java.util.List getElementsInGroup(GroupID groupID)
          Returns an ordered List of type Element that are contained within the specified key id.
 java.util.List getGroups(ModelID modelID)
          Returns all the groups in the VDB
 java.util.Collection getGroupsInModel(ModelID modelID)
           
 Model getModel(ModelID modelID)
          return the specified model
 java.util.Map getModelMap()
           
 java.util.Collection getModelsForVisibility(boolean isVisible)
          Returns a Collection of type Model that represents all the models that are either visible or not visible
protected  com.metamatrix.connector.metadata.internal.ObjectQueryProcessor getObjectQueryProcessor()
           
 java.util.List getProcedures(ModelID modelID)
          Returns all the procedures in the VDB
 java.util.Collection getProceduresInModel(ModelID modelID)
          /** Returns a Collection of type Procedure for the specified model id.
 VirtualDatabase getVirtualDatabase()
          Returns the VirtualDatabase based on the virtual database id.
 VirtualDatabaseID getVirtualDatabaseID()
          Returns the VirtualDatabaseID.
 void init(java.lang.String vdbName, java.lang.String vdbVersion, java.lang.String vdbFileName, byte[] vdbcontents)
          Call to initialize the adapter by providing a specific VDB defintion content to use when querying the metadata *** NOTE: This is used for UnitTest only
 void init(VirtualDatabase vdb, java.util.Collection modelList, boolean loadMetadata, byte[] vdbcontents, java.util.Map systemModels)
          Call to initialize the adapter by providing a specific VDB defintion content to use when querying the metadata
 void initSystemVDB(java.lang.String vdbName, java.lang.String vdbVersion, byte[] systemvdb)
          used for loading the SystemVDB models.
 boolean isModelDetailsLoaded()
          Returns true if the metadata for the groups and elements have been loaded.
 boolean isVisible(java.lang.String resourcePath)
          Returns the visibility for a resource path that exist this vdb
 void loadModelDetails()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataCache

public MetadataCache()
pass true for loadMetadata if the information for the groups and elements are to be loaded. The use of no metadata is used by the RMCHelper for creating a new VDB prior to being added to the repository.

Parameters:
loadMetadata -
Since:
4.2
Method Detail

isModelDetailsLoaded

public boolean isModelDetailsLoaded()
Returns true if the metadata for the groups and elements have been loaded. The loading of the details are only used when the metadata tree is beind displayed. So to cut down on the overhead when it's never been asked for, the details are not loaded when only the models are needed by query processing.

Specified by:
isModelDetailsLoaded in interface MetadataSourceAPI
Returns:
Throws:
VirtualDatabaseException
Since:
4.2

initSystemVDB

public void initSystemVDB(java.lang.String vdbName,
                          java.lang.String vdbVersion,
                          byte[] systemvdb)
                   throws VirtualDatabaseException
used for loading the SystemVDB models.

Parameters:
vdbName -
vdbVersion -
systemvdb -
Throws:
VirtualDatabaseException
Since:
4.2

init

public void init(java.lang.String vdbName,
                 java.lang.String vdbVersion,
                 java.lang.String vdbFileName,
                 byte[] vdbcontents)
          throws java.lang.Exception
Call to initialize the adapter by providing a specific VDB defintion content to use when querying the metadata *** NOTE: This is used for UnitTest only

Parameters:
vdbName -
vdbVersion -
vdbFileName -
vdbcontents -
Throws:
java.lang.Exception

init

public void init(VirtualDatabase vdb,
                 java.util.Collection modelList,
                 boolean loadMetadata,
                 byte[] vdbcontents,
                 java.util.Map systemModels)
          throws VirtualDatabaseException
Call to initialize the adapter by providing a specific VDB defintion content to use when querying the metadata

Parameters:
vdb - contains vdb specific information in the database
modelList - is a collection of Models from the database, providing properties not currently stored in the vdbcontents.
vdbcontents - is the vdb to queried
systemModels - are the system models preload incase metadata is not used
systemvdb - is the system vdb byte array
Throws:
java.lang.Exception
VirtualDatabaseException

loadModelDetails

public void loadModelDetails()
                      throws VirtualDatabaseException
Throws:
VirtualDatabaseException

getObjectQueryProcessor

protected com.metamatrix.connector.metadata.internal.ObjectQueryProcessor getObjectQueryProcessor()
                                                                                           throws VirtualDatabaseException
Throws:
VirtualDatabaseException

getVirtualDatabase

public VirtualDatabase getVirtualDatabase()
                                   throws VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
Returns the VirtualDatabase based on the virtual database id.

Specified by:
getVirtualDatabase in interface MetadataSourceAPI
Returns:
VirtualDatabase
Throws:
VirtualDatabaseException - if an error occurs while trying to read the data.

getVirtualDatabaseID

public VirtualDatabaseID getVirtualDatabaseID()
                                       throws VirtualDatabaseDoesNotExistException,
                                              VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
Returns the VirtualDatabaseID. This method does validate the existance of the virtual database by reading from the persistance storage before creating the id.

Specified by:
getVirtualDatabaseID in interface MetadataSourceAPI
Returns:
VirtualDatabaseID
Throws:
VirtualDatabaseDoesNotExistException - exception if the virtual database does not exist
VirtualDatabaseException - if an error occurs while trying to read the data.

getAllModels

public java.util.Collection getAllModels()
                                  throws VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
Returns a Collection of Models that represents all the models

Specified by:
getAllModels in interface MetadataSourceAPI
Returns:
Collection of type Model
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.

getDisplayableModels

public java.util.Collection getDisplayableModels()
                                          throws VirtualDatabaseException
This returns those models that should be made visible to the console and therefore, only the models from the database are considered for display

Specified by:
getDisplayableModels in interface MetadataSourceAPI
Returns:
Collection of type Model
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.
Since:
4.2
See Also:
MetadataSourceAPI.getDisplayableModels()

isVisible

public boolean isVisible(java.lang.String resourcePath)
Description copied from interface: MetadataSourceAPI
Returns the visibility for a resource path that exist this vdb

Specified by:
isVisible in interface MetadataSourceAPI
Returns:
true if the resource is visible.

getModelMap

public java.util.Map getModelMap()
                          throws VirtualDatabaseException
Throws:
VirtualDatabaseException

getModel

public Model getModel(ModelID modelID)
               throws VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
return the specified model

Specified by:
getModel in interface MetadataSourceAPI
Parameters:
modelID - is the unique id for the model
Returns:
Model
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.
Since:
4.2
See Also:
MetadataSourceAPI.getModel(com.metamatrix.metadata.runtime.api.ModelID)

getModelsForVisibility

public java.util.Collection getModelsForVisibility(boolean isVisible)
                                            throws VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
Returns a Collection of type Model that represents all the models that are either visible or not visible

Specified by:
getModelsForVisibility in interface MetadataSourceAPI
Returns:
Collection of type Model
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.
Since:
4.2
See Also:
MetadataSourceAPI.getModelsForVisibility(boolean)

getGroupsInModel

public java.util.Collection getGroupsInModel(ModelID modelID)
                                      throws VirtualDatabaseException
Specified by:
getGroupsInModel in interface MetadataSourceAPI
Throws:
VirtualDatabaseException

getGroups

public java.util.List getGroups(ModelID modelID)
                         throws VirtualDatabaseException
Returns all the groups in the VDB

Returns:
Throws:
java.lang.Exception
VirtualDatabaseException

getElementsInGroup

public java.util.List getElementsInGroup(GroupID groupID)
                                  throws VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
Returns an ordered List of type Element that are contained within the specified key id.

Specified by:
getElementsInGroup in interface MetadataSourceAPI
Parameters:
groupID - is the group from which the elements are contained
Returns:
List of type Element
Throws:
VirtualDatabaseException

getColumns

public java.util.List getColumns(GroupID groupID)
                          throws VirtualDatabaseException
Returns all the columns for a group in the VDB

Returns:
Throws:
java.lang.Exception
VirtualDatabaseException

getProceduresInModel

public java.util.Collection getProceduresInModel(ModelID modelID)
                                          throws VirtualDatabaseException
Description copied from interface: MetadataSourceAPI
/** Returns a Collection of type Procedure for the specified model id.

Specified by:
getProceduresInModel in interface MetadataSourceAPI
Returns:
Collection of type Procedure
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.

getProcedures

public java.util.List getProcedures(ModelID modelID)
                             throws VirtualDatabaseException
Returns all the procedures in the VDB

Returns:
Throws:
java.lang.Exception
VirtualDatabaseException

buildGroupObjects

protected void buildGroupObjects(java.util.Iterator it)
Bould groups to be displayed in the metadata tree.

Parameters:
objectList - List of Lists of Objects: List of objects to add to the cache. Each element in objectList represents a row containing data about one group. See GROUP_COLUMNS regarding the order and meaning of the column in the row..


Copyright © 2009. All Rights Reserved.