org.norther.tammi.core.xml
Class DefaultDOMBuilderFactory

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultObjectFactory<DocumentBuilder>
          extended by org.norther.tammi.core.xml.DefaultDOMBuilderFactory
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, ObjectFactory<DocumentBuilder>, DOMBuilderFactory

public class DefaultDOMBuilderFactory
extends DefaultObjectFactory<DocumentBuilder>
implements DOMBuilderFactory

A default implementation of DOMBuilderFactor.

Version:
$Id: DefaultDOMBuilderFactory.java,v 1.8 2009/09/28 15:08:44 cvsimp Exp $
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.DOMBuilderFactory
DOM_BUILDER_FACTORY_PROPERTY
 
Constructor Summary
DefaultDOMBuilderFactory()
          Constructs a default DOM builder factory.
DefaultDOMBuilderFactory(String factory)
          Constructs a specific DOM builder factory, if the factory implementation has not yet been initialized.
 
Method Summary
 Object getAttribute(String name)
          Gets an attribute of the factory.
 String getDocumentBuilderFactory()
          Gets the class name of the implemention of the factory.
protected  DocumentBuilderFactory getDOMFactory()
          Gets the implementation of the factory.
 DocumentBuilder getInstance(String className, ObjectName loader, Object[] params, String[] signature)
          Gets an instance of a named class using a specified class loader.
 boolean isCoalescing()
          Indicates whether or not the factory is configured to produce parsers which converts CDATA nodes to Text nodes and appends it to the adjacent (if any) Text node.
 boolean isExpandEntityReferences()
          Indicates whether or not the factory is configured to produce parsers which expand entity reference nodes.
 boolean isIgnoreElementContentWhitespace()
          Indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.
 boolean isIgnoringComments()
          Indicates whether or not the factory is configured to produce parsers which ignores comments.
 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 setAttribute(String name, Object value)
          Sets an attribute of the factory.
 void setCoalescing(boolean flag)
          Specifies that the parser produced by this code will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node.
 void setDocumentBuilderFactory(String factory)
          Sets the class name of the implemention of the factory.
 void setExpandEntityReferences(boolean flag)
          Specifies that the parser produced by this code will expand entity reference nodes.
 void setIgnoreElementContentWhitespace(boolean flag)
          Specifies that the parsers created by this factory must eliminate whitespace in element content (sometimes known loosely as 'ignorable whitespace') when parsing XML documents (see XML Rec 2.10).
 void setIgnoringComments(boolean flag)
          Specifies that the parser produced by this code will ignore comments.
 void setNamespaceAware(boolean flag)
          Specifies that the parser produced by this code will provide support for XML namespaces.
 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

DefaultDOMBuilderFactory

public DefaultDOMBuilderFactory()
Constructs a default DOM builder factory.


DefaultDOMBuilderFactory

public DefaultDOMBuilderFactory(String factory)
Constructs a specific DOM builder 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.

getDocumentBuilderFactory

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

Specified by:
getDocumentBuilderFactory in interface DOMBuilderFactory
Returns:
the class name.

setDocumentBuilderFactory

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

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

isCoalescing

public boolean isCoalescing()
Description copied from interface: DOMBuilderFactory
Indicates whether or not the factory is configured to produce parsers which converts CDATA nodes to Text nodes and appends it to the adjacent (if any) Text node.

Specified by:
isCoalescing in interface DOMBuilderFactory
Returns:
true for coalescing parsers, false otherwise.

setCoalescing

public void setCoalescing(boolean flag)
Description copied from interface: DOMBuilderFactory
Specifies that the parser produced by this code will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node. By default the value of this is set to false.

Specified by:
setCoalescing in interface DOMBuilderFactory
Parameters:
flag - true to convert CDATA nodes to Text nodes, false otherwise.

isExpandEntityReferences

public boolean isExpandEntityReferences()
Description copied from interface: DOMBuilderFactory
Indicates whether or not the factory is configured to produce parsers which expand entity reference nodes.

Specified by:
isExpandEntityReferences in interface DOMBuilderFactory
Returns:
true for expanding parsers, false otherwise.

setExpandEntityReferences

public void setExpandEntityReferences(boolean flag)
Description copied from interface: DOMBuilderFactory
Specifies that the parser produced by this code will expand entity reference nodes. By default the value of this is set to true.

Specified by:
setExpandEntityReferences in interface DOMBuilderFactory
Parameters:
flag - true to expand entity reference nodes, false otherwise.

isIgnoreElementContentWhitespace

public boolean isIgnoreElementContentWhitespace()
Description copied from interface: DOMBuilderFactory
Indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.

Specified by:
isIgnoreElementContentWhitespace in interface DOMBuilderFactory
Returns:
true for parsers ignoring whitespace, false otherwise.

setIgnoreElementContentWhitespace

public void setIgnoreElementContentWhitespace(boolean flag)
Description copied from interface: DOMBuilderFactory
Specifies that the parsers created by this factory must eliminate whitespace in element content (sometimes known loosely as 'ignorable whitespace') when parsing XML documents (see XML Rec 2.10). Note that only whitespace which is directly contained within element content that has an element only content model (see XML Rec 3.2.1) will be eliminated. Due to reliance on the content model this setting requires the parser to be in validating mode. By default the value of this is set to false.

Specified by:
setIgnoreElementContentWhitespace in interface DOMBuilderFactory
Parameters:
flag - true to ignore whitespace, false otherwise.

isIgnoringComments

public boolean isIgnoringComments()
Description copied from interface: DOMBuilderFactory
Indicates whether or not the factory is configured to produce parsers which ignores comments.

Specified by:
isIgnoringComments in interface DOMBuilderFactory
Returns:
true for parsers ignoring comments, false otherwise.

setIgnoringComments

public void setIgnoringComments(boolean flag)
Description copied from interface: DOMBuilderFactory
Specifies that the parser produced by this code will ignore comments. By default the value of this is set to false.

Specified by:
setIgnoringComments in interface DOMBuilderFactory
Parameters:
flag - true to ignore comments, false otherwise.

isNamespaceAware

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

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

setNamespaceAware

public void setNamespaceAware(boolean flag)
Description copied from interface: DOMBuilderFactory
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 DOMBuilderFactory
Parameters:
flag - true to support XML namespaces, false otherwise.

isValidating

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

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

setValidating

public void setValidating(boolean flag)
Description copied from interface: DOMBuilderFactory
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 DOMBuilderFactory
Parameters:
flag - true to validate documents, false otherwise.

getAttribute

public Object getAttribute(String name)
Description copied from interface: DOMBuilderFactory
Gets an attribute of the factory.

Specified by:
getAttribute in interface DOMBuilderFactory
Parameters:
name - the name of the attribute.
Returns:
the value of the attribute.

setAttribute

public void setAttribute(String name,
                         Object value)
                  throws LogException
Description copied from interface: DOMBuilderFactory
Sets an attribute of the factory.

Specified by:
setAttribute in interface DOMBuilderFactory
Parameters:
name - the name of the attribute.
value - the value of the attribute.
Throws:
LogException - for attribute errors.

getInstance

public DocumentBuilder 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<DocumentBuilder>
Overrides:
getInstance in class DefaultObjectFactory<DocumentBuilder>
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<DocumentBuilder>
Overrides:
isLoaderSupported in class DefaultObjectFactory<DocumentBuilder>
Parameters:
className - the name of the class.
Returns:
true if class loaders are supported, false otherwise.

getDOMFactory

protected DocumentBuilderFactory getDOMFactory()
Gets the implementation of the factory.

Returns:
the factory.


Copyright © 2004 The Norther Organization. All rights reserved.