com.threerings.config
Class ManagedConfig

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.config.ManagedConfig
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Exportable, com.threerings.resource.ResourceManager.ModificationObserver, Copyable, Cloneable
Direct Known Subclasses:
CursorConfig, FontConfig, ParameterizedConfig, RenderQueueConfig, RenderSchemeConfig

public abstract class ManagedConfig
extends DeepObject
implements Exportable, ConfigUpdateListener<ManagedConfig>, com.threerings.resource.ResourceManager.ModificationObserver

Represents a configuration managed by the ConfigManager.


Constructor Summary
ManagedConfig()
           
 
Method Summary
 void addListener(ConfigUpdateListener listener)
          Adds a listener to notify on updates.
 void configUpdated(ConfigEvent<ManagedConfig> event)
          Called when a configuration has been updated.
 ConfigManager getConfigManager()
          Returns a reference to the config manager to use when resolving references within this config.
 ManagedConfig getInstance(ArgumentMap args)
          Returns the derived instance with the supplied arguments.
 ManagedConfig getInstance(Scope scope)
          Returns the derived instance in the specified scope.
 ManagedConfig getInstance(Scope scope, ArgumentMap args)
          Returns the derived instance in the specified scope with the supplied arguments.
 ManagedConfig getInstance(Scope scope, String firstKey, Object firstValue, Object... otherArgs)
          Returns the derived instance in the specified scope with the supplied arguments.
 ManagedConfig getInstance(String firstKey, Object firstValue, Object... otherArgs)
          Returns the derived instance with the supplied arguments.
 String getName()
          Returns the name of this configuration.
 ConfigReference<? extends ManagedConfig> getReference()
          Returns a reference to this configuration based on its name and arguments.
 void init(ConfigManager cfgmgr)
          Initializes this config with a reference to the config manager that it should use to resolve references.
 void removeListener(ConfigUpdateListener listener)
          Removes a listener from the list.
 void resourceModified(String path, long lastModified)
           
 void setName(String name)
          Sets the name of this configuration.
 void updateFromSource(EditorContext ctx, boolean force)
          Updates this configuration from its external source, if any.
 void validateOuters(String where)
          Validates the outer object references in this config.
 boolean validateReferences(String where, PrintStream out)
          Validates the references in this config.
 void wasUpdated()
          Notes that this configuration has been updated.
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedConfig

public ManagedConfig()
Method Detail

setName

public void setName(String name)
Sets the name of this configuration.


getName

public String getName()
Returns the name of this configuration.


getReference

public ConfigReference<? extends ManagedConfig> getReference()
Returns a reference to this configuration based on its name and arguments.


getConfigManager

public ConfigManager getConfigManager()
Returns a reference to the config manager to use when resolving references within this config.


getInstance

public ManagedConfig getInstance(String firstKey,
                                 Object firstValue,
                                 Object... otherArgs)
Returns the derived instance with the supplied arguments.


getInstance

public ManagedConfig getInstance(Scope scope,
                                 String firstKey,
                                 Object firstValue,
                                 Object... otherArgs)
Returns the derived instance in the specified scope with the supplied arguments.


getInstance

public ManagedConfig getInstance(Scope scope)
Returns the derived instance in the specified scope.


getInstance

public ManagedConfig getInstance(ArgumentMap args)
Returns the derived instance with the supplied arguments.


getInstance

public ManagedConfig getInstance(Scope scope,
                                 ArgumentMap args)
Returns the derived instance in the specified scope with the supplied arguments.


addListener

public void addListener(ConfigUpdateListener listener)
Adds a listener to notify on updates.


removeListener

public void removeListener(ConfigUpdateListener listener)
Removes a listener from the list.


init

public void init(ConfigManager cfgmgr)
Initializes this config with a reference to the config manager that it should use to resolve references.


updateFromSource

public void updateFromSource(EditorContext ctx,
                             boolean force)
Updates this configuration from its external source, if any.

Parameters:
force - if true, reload the source data even if it has already been loaded.

wasUpdated

public void wasUpdated()
Notes that this configuration has been updated.


validateReferences

public boolean validateReferences(String where,
                                  PrintStream out)
Validates the references in this config.

Returns:
true if the references are valid

validateOuters

public void validateOuters(String where)
Validates the outer object references in this config.


configUpdated

public void configUpdated(ConfigEvent<ManagedConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<ManagedConfig>

resourceModified

public void resourceModified(String path,
                             long lastModified)
Specified by:
resourceModified in interface com.threerings.resource.ResourceManager.ModificationObserver


Copyright © 2011. All Rights Reserved.