org.jboss.cache.factories
Class XmlConfigurationParser

java.lang.Object
  extended by org.jboss.cache.factories.XmlConfigurationParser

public class XmlConfigurationParser
extends java.lang.Object

Reads in XMLconfiguration files and spits out a Configuration object. When deployed as a JBoss MBean, this role is performed by the JBoss Microcontainer. This class is only used internally in unit tests or within CacheFactory implementations for standalone JBoss Cache usage.

Author:
Manik Surtani (manik@jboss.org), Galder Zamarreno

Field Summary
static java.lang.String ATTR
           
static java.lang.String NAME
           
 
Constructor Summary
XmlConfigurationParser()
           
 
Method Summary
protected static org.jboss.cache.factories.XmlConfigurationParser.ParsedAttributes extractAttributes(org.w3c.dom.Element source)
           
protected  java.io.InputStream getAsInputStreamFromClassLoader(java.lang.String filename)
           
protected  org.w3c.dom.Element getMBeanElement(org.w3c.dom.Element root)
           
protected  void handleRemovedAttributes(org.jboss.cache.factories.XmlConfigurationParser.ParsedAttributes attributes)
          Check for and remove any attributes that were supported in the 1.x releases and no longer are.
static BuddyReplicationConfig parseBuddyReplicationConfig(org.w3c.dom.Element element)
           
static CacheLoaderConfig parseCacheLoaderConfig(org.w3c.dom.Element element)
           
static java.lang.String parseClusterConfigXml(org.w3c.dom.Element config)
          Parses the cluster config which is used to start a JGroups channel
static EvictionConfig parseEvictionConfig(org.w3c.dom.Element element)
           
static void parseEvictionPolicyConfig(org.w3c.dom.Element element, EvictionPolicyConfig target)
           
static EvictionRegionConfig parseEvictionRegionConfig(org.w3c.dom.Element element, java.lang.String defaultEvictionClass, int defaultQueueCapacity)
           
 Configuration parseFile(java.lang.String filename)
          Parses an XML file and returns a new configuration.
protected  Configuration parseStream(java.io.InputStream stream)
          Parses an input stream containing XML text and returns a new configuration.
protected static void setValues(java.lang.Object target, java.util.Map<?,?> attribs, boolean isXmlAttribs)
           
protected  void setXmlValues(Configuration conf, java.util.Map<java.lang.String,org.w3c.dom.Element> attribs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR

public static final java.lang.String ATTR
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values
Constructor Detail

XmlConfigurationParser

public XmlConfigurationParser()
Method Detail

parseFile

public Configuration parseFile(java.lang.String filename)
Parses an XML file and returns a new configuration.


parseStream

protected Configuration parseStream(java.io.InputStream stream)
Parses an input stream containing XML text and returns a new configuration.


handleRemovedAttributes

protected void handleRemovedAttributes(org.jboss.cache.factories.XmlConfigurationParser.ParsedAttributes attributes)
Check for and remove any attributes that were supported in the 1.x releases and no longer are. Log a WARN or throw a ConfigurationException if any are found. Which is done depends on the attribute:

Parameters:
attributes -

getAsInputStreamFromClassLoader

protected java.io.InputStream getAsInputStreamFromClassLoader(java.lang.String filename)

getMBeanElement

protected org.w3c.dom.Element getMBeanElement(org.w3c.dom.Element root)

setValues

protected static void setValues(java.lang.Object target,
                                java.util.Map<?,?> attribs,
                                boolean isXmlAttribs)

setXmlValues

protected void setXmlValues(Configuration conf,
                            java.util.Map<java.lang.String,org.w3c.dom.Element> attribs)

parseBuddyReplicationConfig

public static BuddyReplicationConfig parseBuddyReplicationConfig(org.w3c.dom.Element element)

parseCacheLoaderConfig

public static CacheLoaderConfig parseCacheLoaderConfig(org.w3c.dom.Element element)

parseEvictionConfig

public static EvictionConfig parseEvictionConfig(org.w3c.dom.Element element)

parseEvictionRegionConfig

public static EvictionRegionConfig parseEvictionRegionConfig(org.w3c.dom.Element element,
                                                             java.lang.String defaultEvictionClass,
                                                             int defaultQueueCapacity)

parseEvictionPolicyConfig

public static void parseEvictionPolicyConfig(org.w3c.dom.Element element,
                                             EvictionPolicyConfig target)

parseClusterConfigXml

public static java.lang.String parseClusterConfigXml(org.w3c.dom.Element config)
Parses the cluster config which is used to start a JGroups channel

Parameters:
config - an old-style JGroups protocol config String

extractAttributes

protected static org.jboss.cache.factories.XmlConfigurationParser.ParsedAttributes extractAttributes(org.w3c.dom.Element source)