Ableverse™
Platform 6.0

av.msg
Class MsgManager

java.lang.Object
  extended by av.msg.MsgManager

public class MsgManager
extends Object

Manages Messager instances.

You only need to concern with this class when you want to load message contents from a different repository or configure messagers by a different repository.

The default contents repository loads XML resources with ".msg.xml" extension, from the java classpath. This repository covers automatic generated resources by Message Facility according to message definitions in java source files those annotated with Msg.

The default configuration repository is MetaBundle.defaultRepository.

If you really need different contents repositories or messagers configured by different repositories, construct a instance of this class with these two repositories, and obtain Messagers with getMessager() series methods.

Otherwise, you can simply obtains Messagers with Messager.get() series methods of Messager.

Author:
Compl

Field Summary
 MetaRepository confRepository
          Repository used to load messager configurations.
 MetaRepository msgRepository
          Repository used to load message contents.
 
Constructor Summary
MsgManager(MetaRepository confRepository, MetaRepository msgRepository)
          Construct a new instance.
 
Method Summary
 Messager getMessager()
          Get a messager with the same name of the calling class, managed by this manager.
 Messager getMessager(Class<?> klass)
          Get a messager with the same name of the specified class, managed by this manager.
 Messager getMessager(Package pkg)
          Get a messager with the same name of the specified class, managed by this manager.
 Messager getMessager(String name)
          Get a messager with specified name managed by this manager.
 void reload()
          Reload all Messagers, reconfigure them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

confRepository

public final MetaRepository confRepository
Repository used to load messager configurations.


msgRepository

public final MetaRepository msgRepository
Repository used to load message contents.

Constructor Detail

MsgManager

public MsgManager(MetaRepository confRepository,
                  MetaRepository msgRepository)
Construct a new instance.

Parameters:
confRepository - repository used to configure new Messagers.
msgRepository - used by new Messagers to load message contents.
Method Detail

reload

public void reload()
Reload all Messagers, reconfigure them. After all Handlers and Formatters reloaded due to new configuration.


getMessager

public Messager getMessager(String name)
Get a messager with specified name managed by this manager.

Parameters:
name - the messager's name
Returns:
messager with name

getMessager

public Messager getMessager(Class<?> klass)
Get a messager with the same name of the specified class, managed by this manager.

Parameters:
klass - a class
Returns:
a messager with the same name of klass

getMessager

public Messager getMessager(Package pkg)
Get a messager with the same name of the specified class, managed by this manager.

Parameters:
pkg - a package
Returns:
a messager with the same name of pkg

getMessager

public Messager getMessager()
Get a messager with the same name of the calling class, managed by this manager.

Returns:
a messager with the same name of the calling class

Ableverse™
Platform 6.0

Copyright© 2006 Ableverse Platform. All rights reserved.