com.threerings.admin.server
Class ConfigRegistry.ObjectRecord

java.lang.Object
  extended by com.threerings.admin.server.ConfigRegistry.ObjectRecord
All Implemented Interfaces:
AttributeChangeListener, ChangeListener, ElementUpdateListener, SetListener<DSet.Entry>
Direct Known Subclasses:
DatabaseConfigRegistry.DatabaseObjectRecord, PrefsConfigRegistry.PrefsObjectRecord
Enclosing class:
ConfigRegistry

protected abstract class ConfigRegistry.ObjectRecord
extends Object
implements AttributeChangeListener, SetListener<DSet.Entry>, ElementUpdateListener

Contains all necessary info for a configuration object registration.


Field Summary
 DObject object
           
 
Constructor Summary
ConfigRegistry.ObjectRecord(DObject obj)
           
 
Method Summary
 void attributeChanged(AttributeChangedEvent event)
          Called when an attribute changed event has been dispatched on an object.
protected  Object deserialize(String value)
          Deserializes the object contained in the specified string.
 void elementUpdated(ElementUpdatedEvent event)
          Called when an element updated event has been dispatched on an object.
 void entryAdded(EntryAddedEvent<DSet.Entry> event)
          Called when an entry added event has been dispatched on an object.
 void entryRemoved(EntryRemovedEvent<DSet.Entry> event)
          Called when an entry removed event has been dispatched on an object.
 void entryUpdated(EntryUpdatedEvent<DSet.Entry> event)
          Called when an entry updated event has been dispatched on an object.
protected abstract  boolean getValue(String field, boolean defval)
           
protected abstract  byte getValue(String field, byte defval)
           
protected abstract  float getValue(String field, float defval)
           
protected abstract  float[] getValue(String field, float[] defval)
           
protected abstract  int getValue(String field, int defval)
           
protected abstract  int[] getValue(String field, int[] defval)
           
protected abstract  long getValue(String field, long defval)
           
protected abstract  long[] getValue(String field, long[] defval)
           
protected abstract  short getValue(String field, short defval)
           
protected abstract  String getValue(String field, String defval)
           
protected abstract  String[] getValue(String field, String[] defval)
           
 void init()
           
protected  void initField(Field field)
          Initializes a single field of a config distributed object from its corresponding value in the associated config repository.
protected  String nameToKey(String attributeName)
          Converts a config object field name (someConfigMember) to a configuration key (some_config_member).
protected  void serialize(String name, String key, Object value)
          Save the specified object as serialized data associated with the specified key.
protected  void serializeAttribute(String attributeName)
          Get the specified attribute from the configuration object, and serialize it.
protected abstract  void setValue(String field, boolean value)
           
protected abstract  void setValue(String field, byte value)
           
protected abstract  void setValue(String field, float value)
           
protected abstract  void setValue(String field, float[] value)
           
protected abstract  void setValue(String field, int value)
           
protected abstract  void setValue(String field, int[] value)
           
protected abstract  void setValue(String field, long value)
           
protected abstract  void setValue(String field, long[] value)
           
protected abstract  void setValue(String field, short value)
           
protected abstract  void setValue(String field, String value)
           
protected abstract  void setValue(String field, String[] value)
           
protected  void updateValue(String name, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

object

public DObject object
Constructor Detail

ConfigRegistry.ObjectRecord

public ConfigRegistry.ObjectRecord(DObject obj)
Method Detail

init

public void init()

entryAdded

public void entryAdded(EntryAddedEvent<DSet.Entry> event)
Description copied from interface: SetListener
Called when an entry added event has been dispatched on an object. This will be called after the event has been applied to the object.

Specified by:
entryAdded in interface SetListener<DSet.Entry>
Parameters:
event - The event that was dispatched on the object.

entryUpdated

public void entryUpdated(EntryUpdatedEvent<DSet.Entry> event)
Description copied from interface: SetListener
Called when an entry updated event has been dispatched on an object. This will be called after the event has been applied to the object.

Specified by:
entryUpdated in interface SetListener<DSet.Entry>
Parameters:
event - The event that was dispatched on the object.

entryRemoved

public void entryRemoved(EntryRemovedEvent<DSet.Entry> event)
Description copied from interface: SetListener
Called when an entry removed event has been dispatched on an object. This will be called after the event has been applied to the object.

Specified by:
entryRemoved in interface SetListener<DSet.Entry>
Parameters:
event - The event that was dispatched on the object.

elementUpdated

public void elementUpdated(ElementUpdatedEvent event)
Description copied from interface: ElementUpdateListener
Called when an element updated event has been dispatched on an object. This will be called after the event has been applied to the object. So fetching the element during this call will provide the new value for the element.

Specified by:
elementUpdated in interface ElementUpdateListener
Parameters:
event - The event that was dispatched on the object.

attributeChanged

public void attributeChanged(AttributeChangedEvent event)
Description copied from interface: AttributeChangeListener
Called when an attribute changed event has been dispatched on an object. This will be called after the event has been applied to the object. So fetching the attribute during this call will provide the new value for the attribute.

Specified by:
attributeChanged in interface AttributeChangeListener
Parameters:
event - The event that was dispatched on the object.

updateValue

protected void updateValue(String name,
                           Object value)

initField

protected void initField(Field field)
Initializes a single field of a config distributed object from its corresponding value in the associated config repository.


serializeAttribute

protected void serializeAttribute(String attributeName)
Get the specified attribute from the configuration object, and serialize it.


serialize

protected void serialize(String name,
                         String key,
                         Object value)
Save the specified object as serialized data associated with the specified key.


deserialize

protected Object deserialize(String value)
                      throws Exception
Deserializes the object contained in the specified string.

Throws:
Exception

nameToKey

protected String nameToKey(String attributeName)
Converts a config object field name (someConfigMember) to a configuration key (some_config_member).


getValue

protected abstract boolean getValue(String field,
                                    boolean defval)

getValue

protected abstract byte getValue(String field,
                                 byte defval)

getValue

protected abstract short getValue(String field,
                                  short defval)

getValue

protected abstract int getValue(String field,
                                int defval)

getValue

protected abstract long getValue(String field,
                                 long defval)

getValue

protected abstract float getValue(String field,
                                  float defval)

getValue

protected abstract String getValue(String field,
                                   String defval)

getValue

protected abstract int[] getValue(String field,
                                  int[] defval)

getValue

protected abstract float[] getValue(String field,
                                    float[] defval)

getValue

protected abstract long[] getValue(String field,
                                   long[] defval)

getValue

protected abstract String[] getValue(String field,
                                     String[] defval)

setValue

protected abstract void setValue(String field,
                                 boolean value)

setValue

protected abstract void setValue(String field,
                                 byte value)

setValue

protected abstract void setValue(String field,
                                 short value)

setValue

protected abstract void setValue(String field,
                                 int value)

setValue

protected abstract void setValue(String field,
                                 long value)

setValue

protected abstract void setValue(String field,
                                 float value)

setValue

protected abstract void setValue(String field,
                                 String value)

setValue

protected abstract void setValue(String field,
                                 int[] value)

setValue

protected abstract void setValue(String field,
                                 float[] value)

setValue

protected abstract void setValue(String field,
                                 long[] value)

setValue

protected abstract void setValue(String field,
                                 String[] value)