obixserver.watch
Class WatchManager

java.lang.Object
  extended by obix.Obj
      extended by obix.Ref
          extended by obixserver.core.InvocationObj
              extended by obixserver.watch.WatchManager
All Implemented Interfaces:
obix.IObj, InvocationTarget

public class WatchManager
extends InvocationObj

Manages watch and feed lifecycle, including watch and feed creation, removal, deletion. Represents a facade between the obix server engine and the watch subsystem.


Field Summary
private  Map feedMap
          Maps feeds to objects that will be fed.
private  Map feedObjMap
          Maps an obj to feed.
private static Logger logger
           
private  Map watchedObjMap
          One obj can map to several watches.
private  Map watchMap
          watchId -> watch map
 
Fields inherited from class obixserver.core.InvocationObj
objBroker
 
Constructor Summary
WatchManager()
           
 
Method Summary
 void add(String watchId, List objList)
          Adds obj to watched list.
 void addFeed(obix.Feed feed, List feedList)
          Adds a set of objs to a feed.
 void addToFeed(obix.Feed feedObj, obix.Obj obj)
          Adds obj to all feeds associated with given feed obj.
private  void addToWatchedObjMap(obix.Obj obj, Watch watch)
           
 void clearFeed(obix.Feed feed)
          Clears the feed so that it doesn't contains any Objs.
private  obix.Op createOp(String name, obix.Contract in, obix.Contract out)
           
private  void deleteObjFromWatchesInWatchedObjMap(obix.Obj obj)
           
 void deleteWatch(String watchId)
           
private  void deleteWatchFromWatchedObjMap(Watch watch)
           
 List getFeed(obix.Feed feed)
          Return feed set for the given feed.
 int getWatchCount()
           
 Watch getWatchForId(String watchId)
           
 obix.Obj invoke(String name, obix.Obj arg)
          Invokes operation on this Obj.
 Watch makeWatch()
           
 void notifyDelete(obix.Obj obj)
           
 void notifyStatusChange(List objList)
          Notify about status change for a list.
 void notifyStatusChange(obix.Obj obj)
          Notify status changed for obj.
 List pollChanges(String watchId)
           
 List pollRefresh(String watchId)
           
 void remove(String watchId, List objList)
          Removes obj from watched list.
private  void removeFromWatchedObjMap(obix.Obj obj, Watch watch)
           
 obix.Obj watchToObj(Watch watch)
           
 
Methods inherited from class obixserver.core.InvocationObj
getOp, setObjBroker
 
Methods inherited from class obix.Ref
getElement, getResolved, isResolved, toString
 
Methods inherited from class obix.Obj
add, add, addAll, dump, get, getBool, getChildHref, getDisplay, getDisplayName, getHref, getIcon, getInt, getIs, getName, getNormalizedHref, getParent, getReal, getRoot, getStatus, getStr, has, is, is, isAbstime, isBool, isEnum, isErr, isFeed, isInt, isList, isNull, isOp, isReal, isRef, isReltime, isStr, isUri, isVal, isWritable, list, list, remove, removeThis, replace, setBool, setDisplay, setDisplayName, setHref, setIcon, setInt, setIs, setName, setNull, setReal, setStatus, setStr, setWritable, setWritable, size, toClass, toDisplayName, toDisplayString, toObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface obix.IObj
add, addAll, get, getBool, getDisplay, getDisplayName, getHref, getIcon, getInt, getIs, getName, getNormalizedHref, getParent, getReal, getRoot, getStatus, getStr, isAbstime, isBool, isEnum, isErr, isFeed, isInt, isList, isNull, isOp, isReal, isRef, isReltime, isStr, isUri, isVal, isWritable, list, remove, removeThis, replace, setBool, setDisplay, setDisplayName, setHref, setIcon, setInt, setIs, setNull, setReal, setStatus, setStr, setWritable, setWritable, size, toDisplayName, toDisplayString
 

Field Detail

logger

private static final Logger logger

watchMap

private Map watchMap
watchId -> watch map


watchedObjMap

private Map watchedObjMap
One obj can map to several watches. obj -> watchList map


feedMap

private Map feedMap
Maps feeds to objects that will be fed. feedObj -> set of obj


feedObjMap

private Map feedObjMap
Maps an obj to feed. obj -> feedObj

Constructor Detail

WatchManager

public WatchManager()
Method Detail

add

public void add(String watchId,
                List objList)
Adds obj to watched list.

Parameters:
watchId -
objList - list of obj's to watch. May contain Err obj which should be ignored.

remove

public void remove(String watchId,
                   List objList)
Removes obj from watched list.

Parameters:
watchId -
objList - list of objects to remove

notifyStatusChange

public void notifyStatusChange(obix.Obj obj)
Notify status changed for obj.

Parameters:
obj -

notifyStatusChange

public void notifyStatusChange(List objList)
Notify about status change for a list. All objects in the list have changed and should be updated. This is supported only for a feed watch and all objects in the list must belong to a single feed, previously set up via a call to addFeed.

Parameters:
objList -

notifyDelete

public void notifyDelete(obix.Obj obj)

getWatchForId

public Watch getWatchForId(String watchId)

makeWatch

public Watch makeWatch()

deleteWatch

public void deleteWatch(String watchId)

pollChanges

public List pollChanges(String watchId)

pollRefresh

public List pollRefresh(String watchId)
Parameters:
watchId -
Returns:
set of all watched Objs

getWatchCount

public int getWatchCount()

addFeed

public void addFeed(obix.Feed feed,
                    List feedList)
Adds a set of objs to a feed. Current limitation to be removed in the future: Two feeds can't overlap, that is you can't add a second feed that contains a URL specified in an existing feed.

Parameters:
feed -
feedList -

addToFeed

public void addToFeed(obix.Feed feedObj,
                      obix.Obj obj)
Adds obj to all feeds associated with given feed obj.

Parameters:
feedObj -
obj -

clearFeed

public void clearFeed(obix.Feed feed)
Clears the feed so that it doesn't contains any Objs.

Parameters:
feed - feed to be cleared.

getFeed

public List getFeed(obix.Feed feed)
Return feed set for the given feed.

Parameters:
feed -
Returns:
feed set or null if there is no feedset associated with the feed.

invoke

public obix.Obj invoke(String name,
                       obix.Obj arg)
Invokes operation on this Obj.

Specified by:
invoke in interface InvocationTarget
Overrides:
invoke in class InvocationObj

watchToObj

public obix.Obj watchToObj(Watch watch)

createOp

private obix.Op createOp(String name,
                         obix.Contract in,
                         obix.Contract out)

deleteObjFromWatchesInWatchedObjMap

private void deleteObjFromWatchesInWatchedObjMap(obix.Obj obj)

deleteWatchFromWatchedObjMap

private void deleteWatchFromWatchedObjMap(Watch watch)

addToWatchedObjMap

private void addToWatchedObjMap(obix.Obj obj,
                                Watch watch)

removeFromWatchedObjMap

private void removeFromWatchedObjMap(obix.Obj obj,
                                     Watch watch)


Copyright © 2006-2008 Peter Michalek All Rights Reserved.