info.magnolia.cms.beans.config
Class ObservedManager

java.lang.Object
  extended by info.magnolia.cms.beans.config.ObservedManager
Direct Known Subclasses:
CommandsManager, VirtualURIManager

public abstract class ObservedManager
extends Object

A lot of "manager" objects are observed. Will mean that they reload the registered content after the content was changed. To centralize this code we use this abstract manager. A subclass will implement onRegister and onClear.


Field Summary
protected  org.slf4j.Logger log
           
protected  Set<String> registeredUUIDs
          UUIDs and paths of the registered main nodes.
 
Constructor Summary
ObservedManager()
           
 
Method Summary
 void clear()
          Clears the registered UUIDs and calls onClear().
protected static javax.jcr.Node getNodeByIdentifierOrPath(javax.jcr.Session session, String uuid, String path)
          Get a node by uuid, or failing that, by its path.
protected abstract  void onClear()
          The implementor should clear everything.
protected abstract  void onRegister(Content node)
          Registers a node.
 void register(Content node)
          Register a node.
 void reload()
          Calls onClear and reregister the nodes by calling onRegister.
protected  void reload(Content node)
          Reload a specific node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.slf4j.Logger log

registeredUUIDs

protected Set<String> registeredUUIDs
UUIDs and paths of the registered main nodes. They will get registered again after a change.

Constructor Detail

ObservedManager

public ObservedManager()
Method Detail

register

public void register(Content node)
Register a node. The uuid and path are cached and then onRegister() called.

Parameters:
node - the node to register

reload

public void reload()
Calls onClear and reregister the nodes by calling onRegister.


getNodeByIdentifierOrPath

protected static javax.jcr.Node getNodeByIdentifierOrPath(javax.jcr.Session session,
                                                          String uuid,
                                                          String path)
                                                   throws javax.jcr.RepositoryException
Get a node by uuid, or failing that, by its path.

Returns:
The node with the specified UUID, or failing that, the specified path.
Throws:
javax.jcr.RepositoryException - if node cannot be located by either UUID or path.

reload

protected void reload(Content node)
Reload a specific node.


clear

public void clear()
Clears the registered UUIDs and calls onClear().


onRegister

protected abstract void onRegister(Content node)
Registers a node.


onClear

protected abstract void onClear()
The implementor should clear everything. If needed the nodes will get registered.



Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.