org.anadix.impl
Class AbstractElementFactory

java.lang.Object
  extended by org.anadix.impl.AbstractElementFactory
All Implemented Interfaces:
ElementFactory
Direct Known Subclasses:
HTMLElementFactory

public abstract class AbstractElementFactory
extends Object
implements ElementFactory

Abstract class for all ElementFactory implementations

Version:
$Id: $
Author:
tomason

Constructor Summary
protected AbstractElementFactory(org.drools.runtime.StatefulKnowledgeSession ksession)
          Constructor
 
Method Summary
static
<T extends ElementFactory>
T
createFactory(Class<T> clazz, org.drools.runtime.StatefulKnowledgeSession session)
          Creates a new instance of ElementFactory of given class.
 Collection<Element> getElements()
          Gets all Element instances in the underlying session
protected  org.drools.runtime.StatefulKnowledgeSession getSession()
          Gets the session
 void insertElement(Element element)
          Inserts element using this ElementFactory
 void insertEvent(String entrypoint, Object event)
          Inserts an object using specific entry point using this ElementFactory
 void setAsGlobal(String name)
          Sets this instance of ElementFactory as a global variable with given name
 void setGlobal(String name, Object instance)
          Sets a global variable with given name with given value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractElementFactory

protected AbstractElementFactory(org.drools.runtime.StatefulKnowledgeSession ksession)
Constructor

Parameters:
ksession - - StatefulKnowledgeSession to be used to insert elements to
Method Detail

createFactory

public static <T extends ElementFactory> T createFactory(Class<T> clazz,
                                                         org.drools.runtime.StatefulKnowledgeSession session)
Creates a new instance of ElementFactory of given class.

Parameters:
clazz - class of ElementFactory to construct
session - session to use within this ElementFactory
Returns:
a new instance of ElementFactory of given type

getSession

protected org.drools.runtime.StatefulKnowledgeSession getSession()
Gets the session

Returns:
session used throughout this factory

insertElement

public void insertElement(Element element)
Inserts element using this ElementFactory

Specified by:
insertElement in interface ElementFactory
Parameters:
element - - element to insert

getElements

public Collection<Element> getElements()
Gets all Element instances in the underlying session

Specified by:
getElements in interface ElementFactory
Returns:
collection of Elements in session

setGlobal

public void setGlobal(String name,
                      Object instance)
Sets a global variable with given name with given value

Specified by:
setGlobal in interface ElementFactory
Parameters:
name - - name of the global to set
instance - -value of the global to set

setAsGlobal

public void setAsGlobal(String name)
Sets this instance of ElementFactory as a global variable with given name

Specified by:
setAsGlobal in interface ElementFactory
Parameters:
name - - name of the global to set with this instance

insertEvent

public void insertEvent(String entrypoint,
                        Object event)
Inserts an object using specific entry point using this ElementFactory

Specified by:
insertEvent in interface ElementFactory
Parameters:
entrypoint - - entry point to insert the object through
event - - object to insert


Copyright © 2011. All Rights Reserved.