shocks.framework.meta.repository
Class CentralMetadataRepository

java.lang.Object
  extended byshocks.framework.meta.repository.CentralMetadataRepository
All Implemented Interfaces:
CentralMetadataRepositoryMBean, MetadataRepository

public class CentralMetadataRepository
extends java.lang.Object
implements MetadataRepository, CentralMetadataRepositoryMBean

The repository handles instance pooling and will return an instance of any MDBean type upon request.


Constructor Summary
CentralMetadataRepository()
           
 
Method Summary
 void addDataSource(DataSource instance)
          Adds the DataSource instance to an InstancePool, sorted by the element's type and name.
 java.util.Set getTypeSet(java.lang.String type)
          Get a Set containing one instance of every bean in the repository corresponding to the specified type.
 DataSource leaseDataSource(java.lang.String type, java.lang.String name)
          Returns an instance of a DataSource of a matching name and type.
 void release(DataSource instance)
          Releases a DataSource back into the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CentralMetadataRepository

public CentralMetadataRepository()
Method Detail

leaseDataSource

public DataSource leaseDataSource(java.lang.String type,
                                  java.lang.String name)
Returns an instance of a DataSource of a matching name and type. Returns null if no instance exists with matching attributes.

Specified by:
leaseDataSource in interface MetadataRepository
Parameters:
type -
name -
Returns:
DataSource

addDataSource

public void addDataSource(DataSource instance)
Adds the DataSource instance to an InstancePool, sorted by the element's type and name. If no InstancePool exists for this type of DataSource, one is created. If there already is an InstancePool with a matching name and type, an error will be logged.

Specified by:
addDataSource in interface MetadataRepository
Parameters:
instance - -- DataSource to be pooled

release

public void release(DataSource instance)
Releases a DataSource back into the pool.

Specified by:
release in interface MetadataRepository
Parameters:
instance - -- DataSource to be released back into the pool

getTypeSet

public java.util.Set getTypeSet(java.lang.String type)
Description copied from interface: MetadataRepository
Get a Set containing one instance of every bean in the repository corresponding to the specified type.

Specified by:
getTypeSet in interface MetadataRepository
Parameters:
type -
Returns:
Set