org.jboss.dna.repository.rules
Class RuleSet

java.lang.Object
  extended by org.jboss.dna.common.component.ComponentConfig
      extended by org.jboss.dna.repository.rules.RuleSet
All Implemented Interfaces:
Cloneable, Comparable<ComponentConfig>

@Immutable
public class RuleSet
extends ComponentConfig
implements Cloneable

A description of a set of rules compatible with a JSR-94 rule engine.

Author:
Randall Hauch

Constructor Summary
RuleSet(String name, String description, String classname, String[] classpath, String providerUri, String ruleSetUri, String rules, Map<String,Object> properties)
          Create a JSR-94 rule set definition.
 
Method Summary
 RuleSet clone()
          
 Map<Object,Object> getExecutionSetProperties()
          Get the properties for this rule set that can be passed to an RuleExecutionSetProvider's createRuleExecutionSet method.
 Map<String,Object> getProperties()
          Get this rule set's properties as an unmodifiable map.
 String getProviderUri()
          Get the URI of the JSR-94 RuleServiceProvider implementation that should be used.
 String getRules()
          Get the rules defined in terms of the language reqired by the provider.
 String getRuleSetUri()
          Get the URI of this rule set.
 boolean hasChanged(ComponentConfig obj)
          Determine whether this component has changed with respect to the supplied component.
 
Methods inherited from class org.jboss.dna.common.component.ComponentConfig
compareTo, equals, getComponentClassname, getComponentClasspath, getComponentClasspathArray, getDescription, getName, getTimestamp, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleSet

public RuleSet(String name,
               String description,
               String classname,
               String[] classpath,
               String providerUri,
               String ruleSetUri,
               String rules,
               Map<String,Object> properties)
Create a JSR-94 rule set definition.

Parameters:
name - the name of the rule set, which is considered the unique identifier
description - the description
classname - the name of the Java class used for the component
classpath - the optional classpath (defined in a way compatible with a ClassLoaderFactory
providerUri - the URI of the JSR-94 RuleServiceProvider implementation to use
ruleSetUri - the URI of the JSR-94 RuleExecutionSet represented by this object; if null, the name is used
rules - the string containing the rules in a provider-specific language
properties - the provider-specific properties, whose values should be strings or byte arrays (the latter if the provider expects an Reader with the value)
Throws:
IllegalArgumentException - if any of the name, classname, provider URI, or rules parameters are null, empty or blank, or if the classname is not a valid Java classname
Method Detail

getProviderUri

public String getProviderUri()
Get the URI of the JSR-94 RuleServiceProvider implementation that should be used.

Returns:
the URI of the JSR-94 implementation; never null, empty or blank

getRuleSetUri

public String getRuleSetUri()
Get the URI of this rule set. The value must be valid as defined by JSR-94 RuleExecutionSet.

Returns:
the rule set's URI; never null, empty or blank

getRules

public String getRules()
Get the rules defined in terms of the language reqired by the provider.

Returns:
the rules for this rule set

getProperties

public Map<String,Object> getProperties()
Get this rule set's properties as an unmodifiable map. Note that the values of these properties are either strings if the value is to be passed literally, or a byte array if the value is to be passed as an InputStream.

Returns:
the unmodifiable properties; never null but possible empty

getExecutionSetProperties

public Map<Object,Object> getExecutionSetProperties()
Get the properties for this rule set that can be passed to an RuleExecutionSetProvider's createRuleExecutionSet method.

This method converts any byte array value in the properties into an Reader. Since ByteArrayInputStream is used, there is no need to close these stream.

Returns:
the properties; never null but possible empty

hasChanged

public boolean hasChanged(ComponentConfig obj)
Determine whether this component has changed with respect to the supplied component. This method basically checks all attributes, whereas equals only checks the type and ComponentConfig.getName().

Overrides:
hasChanged in class ComponentConfig
Parameters:
obj - the component to be compared with this one
Returns:
true if this componet and the supplied component have some changes, or false if they are exactly equivalent

clone

public RuleSet clone()

Overrides:
clone in class Object


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