org.apache.neethi
Class AssertionBuilderFactoryImpl

java.lang.Object
  extended by org.apache.neethi.AssertionBuilderFactoryImpl
All Implemented Interfaces:
AssertionBuilderFactory

public class AssertionBuilderFactoryImpl
extends Object
implements AssertionBuilderFactory

AssertionFactory is used to create an Assertion from an Element. It uses an appropriate AssertionBuilder instance to create an Assertion based on the QName of the given element. Domain Policy authors could right custom AssertionBuilders to build Assertions for domain specific assertions.


Field Summary
protected  ConverterRegistry converters
           
protected  AssertionBuilder<?> defaultBuilder
           
protected  PolicyBuilder engine
           
 
Constructor Summary
AssertionBuilderFactoryImpl(PolicyBuilder eng)
           
AssertionBuilderFactoryImpl(PolicyBuilder eng, ConverterRegistry reg)
           
 
Method Summary
 Assertion build(Object element)
          Returns an assertion that is built using the specified element.
 AssertionBuilder<?> getBuilder(QName qname)
          Returns an AssertionBuilder that build an Assertion from an element of qname type.
 ConverterRegistry getConverterRegistry()
          Returns the ConverterRegistry that the builder uses for converting the object to the types needed for the AssertionBuilders
 PolicyBuilder getPolicyEngine()
          Returns the PolicyEngine associated with this factory
protected  AssertionBuilder<?> handleNoRegisteredBuilder(QName qname)
          A subclass may want to log when an unknown assertion is encountered or possibly throw an exception or similar.
protected  void loadDynamic()
          Touch point for subclasses that would like to dynamically load builders when policies are first encountered
 void registerBuilder(AssertionBuilder<?> builder)
          Registers an AssertionBuilder with all the builder's known elements.
 void registerBuilder(QName key, AssertionBuilder<?> builder)
          Registers an AssertionBuilder with a specified QName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultBuilder

protected AssertionBuilder<?> defaultBuilder

converters

protected ConverterRegistry converters

engine

protected PolicyBuilder engine
Constructor Detail

AssertionBuilderFactoryImpl

public AssertionBuilderFactoryImpl(PolicyBuilder eng)

AssertionBuilderFactoryImpl

public AssertionBuilderFactoryImpl(PolicyBuilder eng,
                                   ConverterRegistry reg)
Method Detail

getConverterRegistry

public ConverterRegistry getConverterRegistry()
Description copied from interface: AssertionBuilderFactory
Returns the ConverterRegistry that the builder uses for converting the object to the types needed for the AssertionBuilders

Specified by:
getConverterRegistry in interface AssertionBuilderFactory
Returns:

getPolicyEngine

public PolicyBuilder getPolicyEngine()
Description copied from interface: AssertionBuilderFactory
Returns the PolicyEngine associated with this factory

Specified by:
getPolicyEngine in interface AssertionBuilderFactory
Returns:

loadDynamic

protected void loadDynamic()
Touch point for subclasses that would like to dynamically load builders when policies are first encountered


registerBuilder

public void registerBuilder(QName key,
                            AssertionBuilder<?> builder)
Registers an AssertionBuilder with a specified QName.

Specified by:
registerBuilder in interface AssertionBuilderFactory
Parameters:
key - the QName that the AssertionBuilder understand
builder - the AssertionBuilder that can build an Assertion from an element of specified type

registerBuilder

public void registerBuilder(AssertionBuilder<?> builder)
Description copied from interface: AssertionBuilderFactory
Registers an AssertionBuilder with all the builder's known elements.

Specified by:
registerBuilder in interface AssertionBuilderFactory
Parameters:
builder - the AssertionBuilder that can build an Assertion from an element of specified type

build

public Assertion build(Object element)
Returns an assertion that is built using the specified element.

Specified by:
build in interface AssertionBuilderFactory
Parameters:
element - the element that the AssertionBuilder can use to build an Assertion.
Returns:
an Assertion that is built using the specified element.

handleNoRegisteredBuilder

protected AssertionBuilder<?> handleNoRegisteredBuilder(QName qname)
A subclass may want to log when an unknown assertion is encountered or possibly throw an exception or similar. Another option is to provide a unique AssertionBuilder specific for that QName.

Parameters:
qname -
Returns:
a AssertionBuilder to use for the element.

getBuilder

public AssertionBuilder<?> getBuilder(QName qname)
Returns an AssertionBuilder that build an Assertion from an element of qname type.

Specified by:
getBuilder in interface AssertionBuilderFactory
Parameters:
qname - the type that the AssertionBuilder understands and builds an Assertion from
Returns:
an AssertionBuilder that understands qname type


Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.