|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.config.ConfigManager
public class ConfigManager
Manages the set of loaded configurations.
| Constructor Summary | |
|---|---|
ConfigManager()
No-arg constructor for deserialization. |
|
ConfigManager(com.threerings.resource.ResourceManager rsrcmgr,
com.threerings.util.MessageManager msgmgr,
String configPath)
Creates a new global configuration manager. |
|
| Method Summary | ||
|---|---|---|
void |
addUpdateListener(ConfigUpdateListener listener)
Adds a listener that will be notified on all config updates. |
|
Object |
copy(Object dest)
Creates a copy of this object, (re)populating the supplied destination object if possible. |
|
Object |
copy(Object dest,
Object outer)
Creates a copy of this object, (re)populating the supplied destination object if possible. |
|
|
getConfig(Class<T> clazz,
ConfigReference<T> ref)
Retrieves a configuration by class and reference. |
|
|
getConfig(Class<T> clazz,
ConfigReference<T> ref,
Scope scope)
Retrieves a configuration by class and reference. |
|
|
getConfig(Class<T> clazz,
String name)
Retrieves a configuration by class and name. |
|
|
getConfig(Class<T> clazz,
String name,
ArgumentMap args)
Retrieves a configuration by class, name, and arguments. |
|
|
getConfig(Class<T> clazz,
String name,
Scope scope)
Retrieves a configuration by class, name, and scope. |
|
|
getConfig(Class<T> clazz,
String name,
Scope scope,
ArgumentMap args)
Retrieves a configuration by class, name, scope, and arguments. |
|
|
getConfig(Class<T> clazz,
String name,
Scope scope,
String firstKey,
Object firstValue,
Object... otherArgs)
Retrieves a configuration by class, name, and arguments. |
|
|
getConfig(Class<T> clazz,
String name,
String firstKey,
Object firstValue,
Object... otherArgs)
Retrieves a configuration by class, name, and arguments. |
|
String |
getConfigPath()
Returns the resource path from which configurations are loaded, or null if
configurations aren't loaded directly. |
|
|
getGroup(Class<T> clazz)
Retrieves the group registered for the specified class. |
|
ConfigGroup |
getGroup(String name)
Returns the configuration group with the specified name. |
|
ConfigGroup |
getGroup(String name,
boolean forward)
Returns the configuration group with the specified name. |
|
Collection<ConfigGroup> |
getGroups()
Returns the collection of all registered groups. |
|
|
getGroups(Class<T> clazz)
Retrieves the groups registered for the specified class in this manager and all of its ancestors. |
|
ConfigGroup[] |
getGroups(String name)
Retrieves the groups with the specified name in this manager and all of its ancestors. |
|
com.threerings.util.MessageManager |
getMessageManager()
Returns a reference to the message manager used to load configurations. |
|
ConfigManager |
getParent()
Returns a reference to the parent of this manager, or null if this is the root. |
|
Class<?>[] |
getResourceClasses()
Returns the array of classes representing configurations loaded from individual resources. |
|
ManagedConfig |
getResourceConfig(String name)
Attempts to fetch a resource config through the cache. |
|
com.threerings.resource.ResourceManager |
getResourceManager()
Returns a reference to the resource manager used to load configurations. |
|
ConfigManager |
getRoot()
Returns a reference to the root of the manager hierarchy. |
|
String |
getType()
Returns the type of this manager. |
|
void |
init()
Initialization method for the global configuration manager. |
|
void |
init(String type,
ConfigManager parent)
Initialization method for child configuration managers. |
|
boolean |
isInitialized()
Determines whether the config manager has been initialized. |
|
boolean |
isResourceClass(Class<?> clazz)
Determines whether configurations of the specified class are loaded from individual resources. |
|
void |
readFields(Importer in)
Reads the fields of this object. |
|
void |
refresh(Class<? extends ManagedConfig> clazz)
Refreshes all configurations of the specified class. |
|
void |
removeUpdateListener(ConfigUpdateListener listener)
Removes an update listener. |
|
void |
revertAll()
Reverts the configurations in all groups to their last saved state. |
|
void |
saveAll()
Saves the configurations in all groups. |
|
ManagedConfig |
updateResourceConfig(String name,
ManagedConfig config)
Updates a resource-loaded configuration through the cache. |
|
boolean |
validateReferences(String where,
PrintStream out)
Validates the references of all configs managed by this manager. |
|
void |
writeFields(Exporter out)
Writes the fields of this object. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigManager(com.threerings.resource.ResourceManager rsrcmgr,
com.threerings.util.MessageManager msgmgr,
String configPath)
configPath - the resource path of the configurations.public ConfigManager()
| Method Detail |
|---|
public boolean isInitialized()
public void init()
public void init(String type,
ConfigManager parent)
public String getType()
public ConfigManager getParent()
null if this is the root.
public ConfigManager getRoot()
public com.threerings.resource.ResourceManager getResourceManager()
public com.threerings.util.MessageManager getMessageManager()
public String getConfigPath()
null if
configurations aren't loaded directly.
public boolean isResourceClass(Class<?> clazz)
public Class<?>[] getResourceClasses()
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
ConfigReference<T> ref)
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
ConfigReference<T> ref,
Scope scope)
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
String name,
String firstKey,
Object firstValue,
Object... otherArgs)
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
String name,
Scope scope,
String firstKey,
Object firstValue,
Object... otherArgs)
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
String name,
Scope scope)
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
String name,
ArgumentMap args)
args - the configuration arguments, or null for none.
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
String name,
Scope scope,
ArgumentMap args)
scope - the scope in which to create the config, or null for none.args - the configuration arguments, or null for none.
null if not found.
public <T extends ManagedConfig> T getConfig(Class<T> clazz,
String name)
null if not found.public ManagedConfig getResourceConfig(String name)
public <T extends ManagedConfig> ConfigGroup<T>[] getGroups(Class<T> clazz)
public <T extends ManagedConfig> ConfigGroup<T> getGroup(Class<T> clazz)
public ConfigGroup[] getGroups(String name)
public ConfigGroup getGroup(String name)
public ConfigGroup getGroup(String name,
boolean forward)
forward - if true and there's no such group, forward the request to the parent.public Collection<ConfigGroup> getGroups()
public void addUpdateListener(ConfigUpdateListener listener)
public void removeUpdateListener(ConfigUpdateListener listener)
public void saveAll()
public void revertAll()
public ManagedConfig updateResourceConfig(String name,
ManagedConfig config)
public boolean validateReferences(String where,
PrintStream out)
public void refresh(Class<? extends ManagedConfig> clazz)
public void writeFields(Exporter out)
throws IOException
IOException
public void readFields(Importer in)
throws IOException
IOExceptionpublic Object copy(Object dest)
Copyable
copy in interface Copyable
public Object copy(Object dest,
Object outer)
Copyable
copy in interface Copyableouter - the outer object reference to use for inner object creation, if any.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||