Ableverse™
Platform 6.0

av.meta
Class MetaRepository

java.lang.Object
  extended by av.meta.MetaRepository

public class MetaRepository
extends Object

MetaRepository is the backbone of Ableverse Meta Facility. The MetaBundle class has one static instance of this class of its own to provide the default meta bundle access (via MetaBundle.get() series of methods).

If you want to construct a new meta infrastructure by yourself based on Ableverse Meta Facility, this is the start point. You will first look at existing MetaLoader implementations to see if one meets your resource storage type, and if none, you'll have to implement MetaLoader for your storage type by yourself. And the next is to instanciate such a loader and pass it to MetaRepository(String,MetaLoader) to construct an instance of this class. Finally the get() series methods will give you MetaBundle instances by bundle names.

Author:
Compl

Field Summary
static String DEFAULT_PACKAGE_META_NAME
          The meta bundle name associated with the java default package, the value is: "default"
 
Constructor Summary
MetaRepository(String fileExt, MetaLoader loader)
          Construct a new instance of the repository.
 
Method Summary
 MetaBundle get()
          Get the meta bundle in this repository, with the same name as the calling class
 MetaBundle get(Class<?> klass)
          Get the meta bundle in this repository, with the same canonical name as klass
 MetaBundle get(Package pkg)
          Get the meta bundle in this repository, with the same name as pkg
 MetaBundle get(String name)
          Get the meta bundle with the specified name
 String getFileExtensionName()
          Return the file extension name specified at construction.
 void reload()
          Clear the cache of each bundle loaded from this repository so that subsequent lookups on them will read fresh infromation from the XML file set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PACKAGE_META_NAME

public static final String DEFAULT_PACKAGE_META_NAME
The meta bundle name associated with the java default package, the value is: "default"

See Also:
Constant Field Values
Constructor Detail

MetaRepository

public MetaRepository(String fileExt,
                      MetaLoader loader)
Construct a new instance of the repository.

Parameters:
fileExt - to specify a file extension name for this repository
loader - a valid meta loader
Method Detail

get

public MetaBundle get(Class<?> klass)
Get the meta bundle in this repository, with the same canonical name as klass

Parameters:
klass - any java class
Returns:
meta bundle with the same qualified name as klass

get

public MetaBundle get(Package pkg)
Get the meta bundle in this repository, with the same name as pkg

Parameters:
pkg - any java package
Returns:
the meta bundle in this repository, with the same name as pkg

get

public MetaBundle get()
Get the meta bundle in this repository, with the same name as the calling class

Note this relies on the Throwable.getStackTrace() to determine which class is invoking this method. It is perfectly supported by modern HotSpot™ Java™ Virtual Machines, but not so luckly with legacy JIT JVMs. Programs using this method will malfunction in such legacy JVMs.

Returns:
the meta bundle in this repository, with the same name as the calling class

get

public MetaBundle get(String name)
Get the meta bundle with the specified name

Parameters:
name - name of the meta bundle to get
Returns:
the meta bundle with the specified name

reload

public void reload()
Clear the cache of each bundle loaded from this repository so that subsequent lookups on them will read fresh infromation from the XML file set.

This is useful to refresh the meta information without restart the running program.


getFileExtensionName

public String getFileExtensionName()
Return the file extension name specified at construction.


Ableverse™
Platform 6.0

Copyright© 2006 Ableverse Platform. All rights reserved.