org.jboss.dna.repository.rules
Class RuleSetRepositoryMonitor

java.lang.Object
  extended by org.jboss.dna.repository.rules.RuleSetRepositoryMonitor
All Implemented Interfaces:
NodeChangeListener

@ThreadSafe
public class RuleSetRepositoryMonitor
extends Object
implements NodeChangeListener

A component that can listen to a JCR repository and keep the RuleSet instances of a RuleService synchronized with that repository.

This class is a NodeChangeListener that can subscribe to changes in one or more JCR repositories being monitored by an ObservationService. As changes under the rule sets branch are discovered, they are processed asynchronously. This ensure that the processing of the repository contents does not block the other listeners of the ObservationService.

Author:
Randall Hauch

Field Summary
static String DEFAULT_JCR_ABSOLUTE_PATH
           
 
Constructor Summary
RuleSetRepositoryMonitor(RuleService ruleService, String jcrAbsolutePath, JcrExecutionContext executionContext)
          Create an instance that can listen to the RuleSet definitions stored in a JCR repository and ensure that the RuleSet instances of a RuleService reflect the definitions in the repository.
 
Method Summary
 String getAbsolutePathToRuleSets()
           
 Logger getLogger()
           
 RuleService getRuleService()
           
 void onNodeChanges(NodeChanges changes)
          
 void setLogger(Logger logger)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JCR_ABSOLUTE_PATH

public static final String DEFAULT_JCR_ABSOLUTE_PATH
See Also:
Constant Field Values
Constructor Detail

RuleSetRepositoryMonitor

public RuleSetRepositoryMonitor(RuleService ruleService,
                                String jcrAbsolutePath,
                                JcrExecutionContext executionContext)
Create an instance that can listen to the RuleSet definitions stored in a JCR repository and ensure that the RuleSet instances of a RuleService reflect the definitions in the repository.

Parameters:
ruleService - the rule service that should be kept in sync with the JCR repository.
jcrAbsolutePath - the absolute path to the branch where the rule sets are defined; if null or empty, the default path is used
executionContext - the context in which this monitor is to execute
Throws:
IllegalArgumentException - if the rule service or execution context is null, or if the supplied jcrAbsolutePath is invalid
Method Detail

getRuleService

public RuleService getRuleService()
Returns:
ruleService

getAbsolutePathToRuleSets

public String getAbsolutePathToRuleSets()
Returns:
jcrAbsolutePath

getLogger

public Logger getLogger()
Returns:
logger

setLogger

public void setLogger(Logger logger)
Parameters:
logger - Sets logger to the specified value.

onNodeChanges

public void onNodeChanges(NodeChanges changes)

Specified by:
onNodeChanges in interface NodeChangeListener


Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.