org.norther.tammi.core.xml
Class DefaultSAXParserFactory

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultObjectFactory
          extended by org.norther.tammi.core.xml.DefaultSAXParserFactory
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, ObjectFactory, SAXParserFactory

public class DefaultSAXParserFactory
extends DefaultObjectFactory
implements SAXParserFactory

A default implementation of SAXParserFactory.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.xml.SAXParserFactory
SAX_PARSER_FACTORY_PROPERTY
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultSAXParserFactory()
          Constructs a default SAX parser factory.
DefaultSAXParserFactory(String factory)
          Constructs a specific SAX parser factory, if the factory implementation has not yet been initialized.
 
Method Summary
 boolean getFeature(String name)
          Gets the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.
 Object getInstance(String className, ObjectName loader, Object[] params, String[] signature)
          Gets an instance of a named class using a specified class loader.
protected  SAXParserFactory getSAXFactory()
          Gets the implementation of the factory.
 String getSaxParserFactory()
          Gets the class name of the implemention of the factory.
 boolean isLoaderSupported(String className)
          Checks if specified class loaders are supported for a named class.
 boolean isNamespaceAware()
          Indicates whether or not the factory is configured to produce parsers which are namespace aware.
 boolean isValidating()
          Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.
 void setFeature(String name, boolean awareness)
          Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader.
 void setNamespaceAware(boolean flag)
          Specifies that the parser produced by this code will provide support for XML namespaces.
 void setSaxParserFactory(String factory)
          Sets the class name of the implemention of the factory.
 void setValidating(boolean flag)
          Specifies that the parser produced by this code will validate documents as they are parsed.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 
Methods inherited from class org.norther.tammi.core.base.DefaultObjectFactory
getInstance, getInstance, getInstance
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance
 

Constructor Detail

DefaultSAXParserFactory

public DefaultSAXParserFactory()
Constructs a default SAX parser factory.


DefaultSAXParserFactory

public DefaultSAXParserFactory(String factory)
Constructs a specific SAX parser factory, if the factory implementation has not yet been initialized.

Parameters:
factory - the class name of the factory.
Method Detail

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class Adaptee
Throws:
Exception - if the adaptee refused to be unmanaged.

getSaxParserFactory

public String getSaxParserFactory()
Description copied from interface: SAXParserFactory
Gets the class name of the implemention of the factory.

Specified by:
getSaxParserFactory in interface SAXParserFactory
Returns:
the class name.

setSaxParserFactory

public void setSaxParserFactory(String factory)
                         throws LogException
Description copied from interface: SAXParserFactory
Sets the class name of the implemention of the factory.

Specified by:
setSaxParserFactory in interface SAXParserFactory
Parameters:
factory - the class name.
Throws:
LogException - if the factory is already initialized.

isNamespaceAware

public boolean isNamespaceAware()
Description copied from interface: SAXParserFactory
Indicates whether or not the factory is configured to produce parsers which are namespace aware.

Specified by:
isNamespaceAware in interface SAXParserFactory
Returns:
true for namespace aware parsers, false otherwise.

setNamespaceAware

public void setNamespaceAware(boolean flag)
Description copied from interface: SAXParserFactory
Specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to false.

Specified by:
setNamespaceAware in interface SAXParserFactory
Parameters:
flag - true to support XML namespaces, false otherwise.

isValidating

public boolean isValidating()
Description copied from interface: SAXParserFactory
Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.

Specified by:
isValidating in interface SAXParserFactory
Returns:
true for validating parsers, false otherwise.

setValidating

public void setValidating(boolean flag)
Description copied from interface: SAXParserFactory
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Specified by:
setValidating in interface SAXParserFactory
Parameters:
flag - true to validate documents, false otherwise.

getFeature

public boolean getFeature(String name)
                   throws LogException
Description copied from interface: SAXParserFactory
Gets the particular property requested for in the underlying implementation of org.xml.sax.XMLReader.

Specified by:
getFeature in interface SAXParserFactory
Parameters:
name - the name of the feature to get.
Returns:
the value of the feature.
Throws:
LogException - on errors.

setFeature

public void setFeature(String name,
                       boolean awareness)
                throws LogException
Description copied from interface: SAXParserFactory
Sets the particular feature in the underlying implementation of org.xml.sax.XMLReader. A list of the core features and properties can be found at http://www.megginson.com/SAX/Java/features.html .

Specified by:
setFeature in interface SAXParserFactory
Parameters:
name - the name of the feature to be set.
awareness - the value of the feature to be set.
Throws:
LogException - on errors.

getInstance

public Object getInstance(String className,
                          ObjectName loader,
                          Object[] params,
                          String[] signature)
                   throws ConstructionException
Description copied from interface: ObjectFactory
Gets an instance of a named class using a specified class loader. Parameters for its constructor are given as an array of objects, primitive types must be wrapped with a corresponding class.

Class loaders are supported only if the isLoaderSupported method returns true. Otherwise the loader parameter is ignored.

Specified by:
getInstance in interface ObjectFactory
Overrides:
getInstance in class DefaultObjectFactory
Parameters:
className - the name of the class.
loader - the class loader.
params - an array containing the parameters of the constructor.
signature - an array containing the signature of the constructor.
Returns:
the instance.
Throws:
ConstructionException - if construction fails.

isLoaderSupported

public boolean isLoaderSupported(String className)
Description copied from interface: ObjectFactory
Checks if specified class loaders are supported for a named class.

Specified by:
isLoaderSupported in interface ObjectFactory
Overrides:
isLoaderSupported in class DefaultObjectFactory
Parameters:
className - the name of the class.
Returns:
true if class loaders are supported, false otherwise.

getSAXFactory

protected SAXParserFactory getSAXFactory()
Gets the implementation of the factory.

Returns:
the factory.


Copyright © 2004 The Norther Organization. All rights reserved.