Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ojb.broker.metadata
Class MetadataManager  view MetadataManager download MetadataManager.java

java.lang.Object
  extended byorg.apache.ojb.broker.metadata.MetadataManager

public class MetadataManager
extends java.lang.Object

Central class for metadata operations - manages all OJB's DescriptorRepository and ConnectionRepository instances.
Allow a bunch of different repository handling possibilities - allows a transparent flexible metadata manipulation at runtime.

Per default the manager handle one global DescriptorRepository for all calling threads, but you could enable a per thread 55 handling. This enables to set a different DescriptorRepository for each calling thread. This allows a per thread manipulation of the persistent object metadata at runtime.

Version:
$Id: MetadataManager.java,v 1.5 2003/01/31 17:55:55 arminw Exp $

Field Summary
private  ConnectionRepository connectionRepository
           
private  boolean enablePerThreadChanges
           
private  DescriptorRepository globalRepository
           
private static org.apache.ojb.broker.util.logging.Logger log
           
private static MetadataManager singleton
           
private static java.lang.ThreadLocal threadedRepository
           
 
Constructor Summary
private MetadataManager()
           
 
Method Summary
 ConnectionRepository connectionRepository()
          Returns the ConnectionRepository.
 DescriptorRepository copyOfGlobalRepository()
          Returns a copy of the current global DescriptorRepository
 DescriptorRepository getGlobalRepository()
          Returns explicit the global DescriptorRepository - use with care, because it ignores the per thread mode 55 .
static MetadataManager getInstance()
          Returns an instance of this class.
 DescriptorRepository getRepository()
          Returns the current valid DescriptorRepository for the caller.
private  void init()
           
 boolean isEnablePerThreadChanges()
          If returns true runtime (per thread) changes of the DescriptorRepository will take effect.
 void setDescriptor(DescriptorRepository repository, boolean global)
          Set the DescriptorRepository - if global was true, the given descriptor aquire global availability (use with care!), else the given descriptor was associated with the calling thread.
 void setEnablePerThreadChanges(boolean enablePerThreadChanges)
          Enable the possibility of making per thread runtime changes of the DescriptorRepository.
 void setPerThreadDescriptor(DescriptorRepository repository)
          Convenience method for setDescriptor(repository, false) 55 .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.ojb.broker.util.logging.Logger log

threadedRepository

private static java.lang.ThreadLocal threadedRepository

singleton

private static MetadataManager singleton

globalRepository

private DescriptorRepository globalRepository

connectionRepository

private ConnectionRepository connectionRepository

enablePerThreadChanges

private boolean enablePerThreadChanges
Constructor Detail

MetadataManager

private MetadataManager()
Method Detail

init

private void init()

getInstance

public static MetadataManager getInstance()
Returns an instance of this class.


getRepository

public DescriptorRepository getRepository()
Returns the current valid DescriptorRepository for the caller. This is the provided way to obtain the DescriptorRepository.
When per thread descriptor handling 55 is enabled we first search for a DescriptorRepository for the calling thread, if not found the global descriptor was returned.


getGlobalRepository

public DescriptorRepository getGlobalRepository()
Returns explicit the global DescriptorRepository - use with care, because it ignores the per thread mode 55 .


connectionRepository

public ConnectionRepository connectionRepository()
Returns the ConnectionRepository.


setDescriptor

public void setDescriptor(DescriptorRepository repository,
                          boolean global)
Set the DescriptorRepository - if global was true, the given descriptor aquire global availability (use with care!), else the given descriptor was associated with the calling thread.


setPerThreadDescriptor

public void setPerThreadDescriptor(DescriptorRepository repository)
Convenience method for setDescriptor(repository, false) 55 .


copyOfGlobalRepository

public DescriptorRepository copyOfGlobalRepository()
Returns a copy of the current global DescriptorRepository


isEnablePerThreadChanges

public boolean isEnablePerThreadChanges()
If returns true runtime (per thread) changes of the DescriptorRepository will take effect.
If returns false all made and further runtime (per thread) changes will be ignored.


setEnablePerThreadChanges

public void setEnablePerThreadChanges(boolean enablePerThreadChanges)
Enable the possibility of making per thread runtime changes of the DescriptorRepository.