com.metamatrix.metadata.runtime
Class RuntimeMetadataCatalog

java.lang.Object
  extended by com.metamatrix.metadata.runtime.RuntimeMetadataCatalog

public class RuntimeMetadataCatalog
extends java.lang.Object

The RuntimeMetadataCatalog follows the Singleton pattern so there should be only one instance per VM of this class. All consumers of RuntimeMetadata should be calling this class.

In order to get runtime metadata, you must first request a VirtualDatabaseMetadata object based on a specific VirtualDatabase name and version. Therefore, for each different VirtualDatabase you need information, you will need to request a different VirtualDatabaseMetadata. Once you have this object, the metadata for that VirtualDatabase can be interrogated.

However, the VirtualDatabaseMetadata is "READ ONLY". For creating new VirtualDatabases or updating existing ones, there are methods here that provide that functionality.


Method Summary
 void clearCache()
          clear the cache.
 VirtualDatabase createVirtualDatabase(VDBArchive vdbArchive, java.lang.String userName)
          Call to create and return a VirtualDatabase, based on the VDBInfo that contains a list of ModelInfo instances for that virtual database.
 void deleteVirtualDatabase(VirtualDatabaseID vdbID)
          Call to delete a VirtualDatabase from the system.
 VirtualDatabaseID getActiveVirtualDatabaseID(java.lang.String vdbName, java.lang.String vdbVersion)
          Returns the id for the VirtualDatabase that is in an 'Active' state.
 java.util.Collection getDeletedVirtualDatabaseIDs()
          Returns a collection of VirtualDatabaseID's that are marked for deletion.
static RuntimeMetadataCatalog getInstance()
           
 Model getModel(java.lang.String modelName, VirtualDatabaseID vdbID)
          Returns a Collection of type Model that represents all the models that where deployed in the specified virtual database.
 java.util.Collection getModels(VirtualDatabaseID vdbID)
          Returns a Collection of type Model that represents all the models that where deployed in the specified virtual database.
 java.util.List getMutiSourcedModels(VirtualDatabaseID vdbID)
          Returns a Collection of type String that represents all the models that where deployed in the specified virtual database.
 QueryMetadataInterface getQueryMetadata(VirtualDatabaseID vdbID)
           
 QueryMetadataCache getQueryMetadataCache()
           
 byte[] getSystemVDBArchive()
          Returns the System VDB Archive
 byte[] getVDBArchive(VirtualDatabaseID vdbID)
          Returns the VDB Archive specified by the virtual database ID.
 VirtualDatabase getVirtualDatabase(VirtualDatabaseID vdbID)
          Returns the virtual database specified by the virtual database ID.
 VirtualDatabaseID getVirtualDatabaseID(java.lang.String vdbName, java.lang.String vdbVersion)
          Returns the id for the VirtualDatabase that is in the repository.
 VirtualDatabaseMetadata getVirtualDatabaseMetadata(VirtualDatabaseID vdbID)
          Returns a VirtualDatabaseMetadata that contains the VirtualDatabase based on the virtual database name and version.
 java.util.Collection getVirtualDatabases()
          Returns a Collection of all the VirtualDatabase's in the system.
 void init(java.util.Properties runtimeProperties, MessageBus messageBus, CacheFactory factory)
          The init method needs to be called prior to executing any other methods.
 boolean isVisible(java.lang.String resourcePath, VirtualDatabaseID vdbID)
          Returns the visibility for a resource path that exist in a given vdb
static void refreshProperties()
          call to refresh the runtime metadata properties.
 EventObjectListener registerRuntimeMetadataListener(RuntimeMetadataListener listener)
           
 void removeRuntimeMetadataListener(EventObjectListener listener)
           
 void setConnectorBindingNames(VirtualDatabaseID vdbID, java.util.Map modelAndCBNames, java.lang.String userName)
          Set connector binding names for models in a virtual database.
protected  void setTransactionManager(TransactionMgr transactionMgr)
           
 void setVDBStatus(VirtualDatabaseID virtualDBID, short status, java.lang.String userName)
          Updates the VirtualDatabase status.
 void updateVirtualDatabase(VirtualDatabase vdb, java.lang.String userName)
          Update VDB attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static RuntimeMetadataCatalog getInstance()

registerRuntimeMetadataListener

public EventObjectListener registerRuntimeMetadataListener(RuntimeMetadataListener listener)
                                                    throws VirtualDatabaseException
Throws:
VirtualDatabaseException

removeRuntimeMetadataListener

public void removeRuntimeMetadataListener(EventObjectListener listener)
                                   throws VirtualDatabaseException
Throws:
VirtualDatabaseException

createVirtualDatabase

public VirtualDatabase createVirtualDatabase(VDBArchive vdbArchive,
                                             java.lang.String userName)
                                      throws VirtualDatabaseException
Call to create and return a VirtualDatabase, based on the VDBInfo that contains a list of ModelInfo instances for that virtual database.

Parameters:
vdbInfo - contains the VDB information used to create the VDB.
userName - of the person creating the virtual database
vdbIndexFile - the jar file that contains all the index files used by the models in this vdb.
Returns:
VirtualDatabaseID for the created VirtualDatabase
Throws:
VirtualDatabaseException - is thrown if a problem occurs during the creation process.

getVirtualDatabaseMetadata

public VirtualDatabaseMetadata getVirtualDatabaseMetadata(VirtualDatabaseID vdbID)
                                                   throws VirtualDatabaseException
Returns a VirtualDatabaseMetadata that contains the VirtualDatabase based on the virtual database name and version.

Parameters:
vdbID - is the VirtualDatabase to retrieve
Returns:
VirtualDatabaseMetadata
Throws:
VirtualDatabaseException - is thrown if a problem occurs during retrieval process.

getActiveVirtualDatabaseID

public VirtualDatabaseID getActiveVirtualDatabaseID(java.lang.String vdbName,
                                                    java.lang.String vdbVersion)
                                             throws VirtualDatabaseDoesNotExistException,
                                                    VirtualDatabaseException
Returns the id for the VirtualDatabase that is in an 'Active' state. If it is not found or not in an active state, a VirtualDatabaseDoesNotExistException will be thrown.

Parameters:
vdbName - is the name of the VirtualDatabase
vdbVersion - is the version. Default to latest version if it is null.
Returns:
VirtualDatabaseID that is in an 'Active' state
Throws:
VirtualDatabaseDoesNotExistException - is thrown if the VirtualDatabase is not found in an active state
VirtualDatabaseException - is thrown if a problem occurs during retrieval process.

getVirtualDatabaseID

public VirtualDatabaseID getVirtualDatabaseID(java.lang.String vdbName,
                                              java.lang.String vdbVersion)
                                       throws VirtualDatabaseDoesNotExistException,
                                              VirtualDatabaseException
Returns the id for the VirtualDatabase that is in the repository. If it is not found or not in an active state, a VirtualDatabaseDoesNotExistException will be thrown.

Parameters:
vdbName - is the name of the VirtualDatabase
vdbVersion - is the version
Returns:
VirtualDatabaseID that is in an 'Active' state
Throws:
VirtualDatabaseDoesNotExistException - is thrown if the VirtualDatabase is not found in an active state
VirtualDatabaseException - is thrown if a problem occurs during retrieval process.

setVDBStatus

public void setVDBStatus(VirtualDatabaseID virtualDBID,
                         short status,
                         java.lang.String userName)
                  throws VirtualDatabaseException
Updates the VirtualDatabase status. The following four status are valid. They are defined in MetadataConstants:

Incomplete: The virtual database is not fully created yet. Set by runtime metadata during the creation of a new virtual database.

Inactive: Not ready for use.

Active: Ready for use.

Deleted: Ready for deletion.

Parameters:
userName - of the person requesting the change
status - is the state the VirtualDatabase should be set to
Throws:
VirtualDatabaseException - if unable to perform update.

getVirtualDatabases

public java.util.Collection getVirtualDatabases()
                                         throws VirtualDatabaseException
Returns a Collection of all the VirtualDatabase's in the system. This would include all virtual databases flagged as incomplete, active, inactive or deleted.

Returns:
Collection
Throws:
VirtualDatabaseException - is thrown if a problem occurs during the retrieval process.

getVDBArchive

public byte[] getVDBArchive(VirtualDatabaseID vdbID)
                     throws VirtualDatabaseException
Returns the VDB Archive specified by the virtual database ID.

Returns:
byte[] VDB Archive
Throws:
VirtualDatabaseException - is thrown if a problem occurs during the retrieval process.

getSystemVDBArchive

public byte[] getSystemVDBArchive()
                           throws VirtualDatabaseException
Returns the System VDB Archive

Returns:
byte[] VDB Archive
Throws:
VirtualDatabaseException - is thrown if a problem occurs during the retrieval process.

getVirtualDatabase

public VirtualDatabase getVirtualDatabase(VirtualDatabaseID vdbID)
                                   throws VirtualDatabaseException
Returns the virtual database specified by the virtual database ID.

Returns:
VirtualDatabase
Throws:
VirtualDatabaseException - is thrown if a problem occurs during the retrieval process.

getDeletedVirtualDatabaseIDs

public java.util.Collection getDeletedVirtualDatabaseIDs()
                                                  throws VirtualDatabaseException
Returns a collection of VirtualDatabaseID's that are marked for deletion.

Returns:
Collection of type VirtualDatabaseID
Throws:
VirtualDatabaseException - is thrown if a problem occurs during retrieval process.

deleteVirtualDatabase

public void deleteVirtualDatabase(VirtualDatabaseID vdbID)
                           throws VirtualDatabaseException
Call to delete a VirtualDatabase from the system. The VirtualDatabase must be marked for deletion, otherwise an InvalidStateException will be thrown.

Parameters:
vdbID - is the VirtualDatabase to be deleted
Throws:
VirtualDatabaseException - is thrown if a problem occurs during the deletion process.

refreshProperties

public static void refreshProperties()
                              throws VirtualDatabaseException
call to refresh the runtime metadata properties.

Throws:
VirtualDatabaseException

getModels

public java.util.Collection getModels(VirtualDatabaseID vdbID)
                               throws VirtualDatabaseException
Returns a Collection of type Model that represents all the models that where deployed in the specified virtual database. This method shoud only used by Admin Console.

Parameters:
vdbID - is the VirtualDatabaseID
Returns:
Collection of type Model
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.

getMutiSourcedModels

public java.util.List getMutiSourcedModels(VirtualDatabaseID vdbID)
                                    throws VirtualDatabaseException
Returns a Collection of type String that represents all the models that where deployed in the specified virtual database. This method shoud only used by Admin Console.

Parameters:
vdbID - is the VirtualDatabaseID
Returns:
Collection of type String (model full name)
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.

isVisible

public boolean isVisible(java.lang.String resourcePath,
                         VirtualDatabaseID vdbID)
                  throws VirtualDatabaseException
Returns the visibility for a resource path that exist in a given vdb

Parameters:
resourcePath -
vdbID - is the id for which the resource must exist
Returns:
true if the resource is visible.
Throws:
VirtualDatabaseException
Since:
4.2

getModel

public Model getModel(java.lang.String modelName,
                      VirtualDatabaseID vdbID)
               throws VirtualDatabaseException
Returns a Collection of type Model that represents all the models that where deployed in the specified virtual database. This method shoud only used by Admin Console.

Parameters:
vdbID - is the VirtualDatabaseID
Returns:
Collection of type Model
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.

setConnectorBindingNames

public void setConnectorBindingNames(VirtualDatabaseID vdbID,
                                     java.util.Map modelAndCBNames,
                                     java.lang.String userName)
                              throws VirtualDatabaseException
Set connector binding names for models in a virtual database. If the names are set for all the models, the virtual database status is changed to Inactive.

Parameters:
vdbID - is the VirtualDatabaseID
modelAndCBNames - contains Model name and connector binding name pare.
userName - of the person setting the connection binding names for the virtual database.
Throws:
VirtualDatabaseException - an error occurs while trying to read the data.

updateVirtualDatabase

public void updateVirtualDatabase(VirtualDatabase vdb,
                                  java.lang.String userName)
                           throws VirtualDatabaseException
Update VDB attributes. Only the attributes defined in VirtualDatabase.ModifiableAttributes can be modefied. Call VirtualDatabase.update(String attribute, Object value) to update each attribute of the VDB before calling this method.

Parameters:
vdb - VDB to be updated.
userName - of the person updating the virtual database.
Throws:
VirtualDatabaseException

init

public void init(java.util.Properties runtimeProperties,
                 MessageBus messageBus,
                 CacheFactory factory)
          throws VirtualDatabaseException,
                 MessagingException
The init method needs to be called prior to executing any other methods.

Throws:
VirtualDatabaseException - if the RuntimeMetadataCatalog cannot be initialized.
MessagingException

getQueryMetadata

public QueryMetadataInterface getQueryMetadata(VirtualDatabaseID vdbID)
                                        throws VirtualDatabaseException
Throws:
VirtualDatabaseException

getQueryMetadataCache

public QueryMetadataCache getQueryMetadataCache()
                                         throws VirtualDatabaseException
Throws:
VirtualDatabaseException

clearCache

public void clearCache()
                throws VirtualDatabaseException
clear the cache. This should be called only from the installer, results in removing the temp files for all vdbs.

Throws:
VirtualDatabaseException

setTransactionManager

protected void setTransactionManager(TransactionMgr transactionMgr)


Copyright © 2009. All Rights Reserved.