livespace.services
Class PropertiesSynchronizer

java.lang.Object
  extended by livespace.services.PropertiesSynchronizer
All Implemented Interfaces:
PropertyListener, EventListener

public class PropertiesSynchronizer
extends Object
implements PropertyListener


Constructor Summary
PropertiesSynchronizer(EntityRegistry registry, String[] paths, Object[] values)
          Use to wait for a set of properties to go to a set of specified values
 
Method Summary
 void finish()
           
static PropertyPath getPath(IDataObject root, IDataObject descendant, Object descendantProperty)
          Find the first path from the root object to a descendant IDataObject's property
static PropertyPath[] getPaths(IDataObject root, Collection<? extends IDataObject> descendants, Object descendantProperty)
          Returns an array of first paths found from a root IDataObject to collection of descendant IDataObject's properties a specified property
static String[] getPathsStr(IDataObject root, Collection<? extends IDataObject> descendants, Object descendantProperty)
          Returns an array of first paths as strings found from a root IDataObject to collection of descendant IDataObject's properties a specified property
 boolean hasFinished()
          Returns true if the
 void propertyValueChanged(PropertyEvent e)
          Listen for updates and set the finished flag if the property path are all set to their specified end states
 void synchronize(long maxWait)
          Wait for the set of properties to be set to specified value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesSynchronizer

public PropertiesSynchronizer(EntityRegistry registry,
                              String[] paths,
                              Object[] values)
Use to wait for a set of properties to go to a set of specified values

Parameters:
registry - The top level container registry
paths - The set of property paths
values - The set of values
Throws:
IllegalArgumentException - If the length of the paths and values arrays are not the same
Method Detail

synchronize

public void synchronize(long maxWait)
                 throws SynchronizationException
Wait for the set of properties to be set to specified value

Parameters:
maxWait -
Throws:
SynchronizationException

propertyValueChanged

public void propertyValueChanged(PropertyEvent e)
Listen for updates and set the finished flag if the property path are all set to their specified end states

Specified by:
propertyValueChanged in interface PropertyListener

hasFinished

public boolean hasFinished()
Returns true if the


finish

public void finish()

getPaths

public static PropertyPath[] getPaths(IDataObject root,
                                      Collection<? extends IDataObject> descendants,
                                      Object descendantProperty)
Returns an array of first paths found from a root IDataObject to collection of descendant IDataObject's properties a specified property

Parameters:
root - the root IDataObject
descendants - the descendent object to find
descendantProperty - the descendant IDataObject's property
Returns:
an array of PropertyPaths
See Also:
getPath(IDataObject, IDataObject, Object)

getPath

public static PropertyPath getPath(IDataObject root,
                                   IDataObject descendant,
                                   Object descendantProperty)
Find the first path from the root object to a descendant IDataObject's property

Parameters:
root - the root IDataObject
descendant - the descendant IDataObject
descendantProperty - the descendant IDataObject's property
Returns:
the path, returns and empty path if no path is found

getPathsStr

public static String[] getPathsStr(IDataObject root,
                                   Collection<? extends IDataObject> descendants,
                                   Object descendantProperty)
Returns an array of first paths as strings found from a root IDataObject to collection of descendant IDataObject's properties a specified property

Parameters:
root - the root IDataObject
descendants - the descendant object to find
descendantProperty - the descendant IDataObject's property
Returns:
an array of property path strings
See Also:
getPath(IDataObject, IDataObject, Object)


Copyright © 2008 Commonwealth of Australia