obixserver.watch
Class Watch

java.lang.Object
  extended by obixserver.watch.Watch

public class Watch
extends Object

Watch implementation: it maintains information about watch such as watched list, changed list and provides an inteface for updating watched list and changed list

Changed list is updated at poll refresh (call originating outside of system) and via update calls from module (call originating in module).

It has a a pseudo unique id - unique in the context of all watches within the running program.


Field Summary
private  Map changedMap
          Map of objects that are watched and changed.
private  boolean feed
          Indicates if this watch is on a feed.
private  List feedList
          List of Obj's associated with this feed.
private  String id
          Watch id.
private  int lastPollListOffset
          Offset to a feed at last poll.
private  long leaseTime
          Watch lease time.
private static Logger logger
           
private  obix.Feed theFeed
          If this is a feed watch, specified the associated feed.
private  boolean useTimestamp
          Determines if timestamp should be used in wrapping Objs in feed
private  Map watchedMap
          Map of objects that are watched.
private static long watchIdCounter
          Used to generate pseudo unique ids.
 
Constructor Summary
Watch()
          Can be created only by WatchManager.
 
Method Summary
 void addToFeed(obix.Obj obj)
          For a feed, add obj to the feed.
 void addWatched(obix.Obj obj)
          Add an obj to watched list.
 void clear()
           
(package private)  void clearChanged()
          Invoked after the client has performed pollRefresh and the information about updates needs to be cleared.
private static String generateId()
          Generates an id.
 List getChangedList()
          Returns a set of changed objs.
 String getId()
           
 long getLeasetime()
           
 obix.Feed getTheFeed()
           
 List getWatchedList()
          Returns a set of watched objs.
 boolean isFeed()
           
 void removeWatched(obix.Obj obj)
          Remove an obj from watched list.
 void setFeed(boolean feed)
           
 int size()
           
 void update(List objList)
           
 void update(obix.Obj obj)
          Update watch for an updated object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logger logger

leaseTime

private long leaseTime
Watch lease time.


id

private String id
Watch id.


watchedMap

private Map watchedMap
Map of objects that are watched. objUri, obj


changedMap

private Map changedMap
Map of objects that are watched and changed. objUri, obj


theFeed

private obix.Feed theFeed
If this is a feed watch, specified the associated feed.


feedList

private List feedList
List of Obj's associated with this feed.


feed

private boolean feed
Indicates if this watch is on a feed.


lastPollListOffset

private int lastPollListOffset
Offset to a feed at last poll.


useTimestamp

private boolean useTimestamp
Determines if timestamp should be used in wrapping Objs in feed


watchIdCounter

private static long watchIdCounter
Used to generate pseudo unique ids.

Constructor Detail

Watch

Watch()
Can be created only by WatchManager.

Method Detail

generateId

private static String generateId()
Generates an id. This implementation will change when stop/restart session persistence is implemented.

Returns:
generated id

getId

public String getId()

size

public int size()

clear

public void clear()

clearChanged

void clearChanged()
Invoked after the client has performed pollRefresh and the information about updates needs to be cleared. Should only be invoked by WatchManager.


update

public void update(obix.Obj obj)
Update watch for an updated object.

Parameters:
obj -

update

public void update(List objList)

addToFeed

public void addToFeed(obix.Obj obj)
For a feed, add obj to the feed.

Parameters:
obj -

addWatched

public void addWatched(obix.Obj obj)
Add an obj to watched list.

Parameters:
obj -

removeWatched

public void removeWatched(obix.Obj obj)
Remove an obj from watched list.

Parameters:
obj - object to be removed

getChangedList

public List getChangedList()
Returns a set of changed objs.


getWatchedList

public List getWatchedList()
Returns a set of watched objs.


getLeasetime

public long getLeasetime()

isFeed

public boolean isFeed()

setFeed

public void setFeed(boolean feed)

getTheFeed

public obix.Feed getTheFeed()


Copyright © 2006-2008 Peter Michalek All Rights Reserved.