org.ceryle.wiki.plugin.assertion
Interface AssertionHandler

All Known Implementing Classes:
AssertionHandlerImpl, WikiMapManager

public interface AssertionHandler

AssertionHandler manages an internal registry of Assertions. The "registry" may be any internal means of storing or representing the asserted statements. They are passed around within the system as Assertion objects, structs containing the assertion's page, subject, predicate, and object data.

Author:
Murray Altheim
See Also:
Assertion, AssertionHandlerFactory

Field Summary
static String SYNCHRONIZED
          The ActionEvent command string sent upon successful completion of the synchronization process.
static String UNSYNCHRONIZED
          The ActionEvent command string sent upon completion of the synchronization process, if any error has occurred.
 
Method Summary
 Assertion createAssertion(String pagename, Term subject, Predicate predicate, Property property)
          Creates and returns a new property Assertion provided its parameters.
 Assertion createAssertion(String pagename, Term subject, Predicate predicate, Term object, boolean isTemplate)
          Creates and returns a new Assertion provided its parameters.
 Assertion getAssertion(String pagename, String subject, String predicate, String object)
          Queries the set of existing Assertions for an Assertion matching the provided Subject, Predicate and Object.
 Assertion getAssertion(String pagename, Term subject, Predicate predicate, Property property, boolean create)
          Returns an Assertion having the WikiContext, Predicate and Property.
 Assertion getAssertion(String pagename, Term subject, Predicate predicate, Term object, boolean isTemplate, boolean create)
          Returns an Assertion having the wiki page name, Predicate and Terms.
 Collection getAssertions()
          Returns a Collection containing all the Assertions in the registry.
 WikiEngine getEngine()
          Returns the WikiEngine associated with this AssertionHandler.
 ReferenceInfoProvider getReferenceInfoProvider()
          Returns the ReferenceInfoProvider associated with this AssertionHandler.
 boolean hasAssertion(String pagename, String subject, String predicate, String object)
          Returns true if an Assertion equivalent to one created with the provided subject, predicate, and object is contained in the registry.
 boolean isListenerEnabled()
          Returns the enabled or disabled state of this AssertionHandler's WikiEventListener.
 boolean removeAssertion(Assertion assertion)
          Returns true if the Assertion was successfully removed from the registry.
 void setListenerEnabled(boolean enable)
          Enables or disables this AssertionHandler's WikiEventListener ability to listen for changes to the wiki.
 void synchronize(String pagename, ActionListener listener)
          Synchronizes the AssertionHandler's registry with the current set of wiki pages.
 String toXHTML(WikiContext context, Assertion assertion)
          Format the assertion into XHTML output suitable for display on a web page.
 

Field Detail

SYNCHRONIZED

static final String SYNCHRONIZED
The ActionEvent command string sent upon successful completion of the synchronization process.

See Also:
Constant Field Values

UNSYNCHRONIZED

static final String UNSYNCHRONIZED
The ActionEvent command string sent upon completion of the synchronization process, if any error has occurred.

See Also:
Constant Field Values
Method Detail

synchronize

void synchronize(String pagename,
                 ActionListener listener)
Synchronizes the AssertionHandler's registry with the current set of wiki pages.

Parameters:
pagename - the optional name of the wiki page that fired the event triggering synchronization, used to check for page-specific changes.
listener - the optional listener may be used to receive notification that the synchronization process has finished. Upon completion, an ActionEvent is fired, with an action command of either SYNCHRONIZED or UNSYNCHRONIZED. The listener is automatically removed following successful synchronization,

getEngine

WikiEngine getEngine()
Returns the WikiEngine associated with this AssertionHandler.


getReferenceInfoProvider

ReferenceInfoProvider getReferenceInfoProvider()
Returns the ReferenceInfoProvider associated with this AssertionHandler.


setListenerEnabled

void setListenerEnabled(boolean enable)
Enables or disables this AssertionHandler's WikiEventListener ability to listen for changes to the wiki.


isListenerEnabled

boolean isListenerEnabled()
Returns the enabled or disabled state of this AssertionHandler's WikiEventListener. If the listener is disabled, the internal registry and page cache are to be considered invalid.


getAssertions

Collection getAssertions()
                         throws AssertionException
Returns a Collection containing all the Assertions in the registry. The Collection should be considered unmodifiable, i.e., modifications may throw an ConcurrentModificationException or UnsupportedOperationException. This returns an empty Set rather than null.

Throws:
AssertionException - if an error occurs while creating the Collection of assertions.

getAssertion

Assertion getAssertion(String pagename,
                       Term subject,
                       Predicate predicate,
                       Term object,
                       boolean isTemplate,
                       boolean create)
                       throws AssertionException
Returns an Assertion having the wiki page name, Predicate and Terms. If a registry is being maintained, this should return the existing Assertion if one matching exists. If create is false, null is returned when no match is found; this can be used as a surrogate for a hasAssertion() method.

Note: This is the only way to add an Assertion to the registry; there is no addAssertion() method. This keeps any Assertions not created by the AssertionHandler from entering into the system.

Parameters:
pagename - the wiki page name source of the Assertion
subject - the subject Term of the Assertion
predicate - the Predicate of the Assertion
object - the subject Term of the Assertion
isTemplate - when true, queries for an assertion template
create - when true, permits creation of Assertion to fulfill a match
Returns:
a new or existing Assertion, depending on the value of create
Throws:
AssertionException - if an error occurs while creating the new Assertion

getAssertion

Assertion getAssertion(String pagename,
                       Term subject,
                       Predicate predicate,
                       Property property,
                       boolean create)
                       throws AssertionException
Returns an Assertion having the WikiContext, Predicate and Property. (This style of assertion is considered a property assertion.) If a registry is being maintained, this should return the existing Assertion if one matching exists. If create is false, null is returned when no match is found; this can be used as a surrogate for a hasAssertion() method.

Note: This is the only way to add an Assertion to the registry; there is no addAssertion() method. This keeps any Assertions not created by the AssertionHandler from entering into the system.

Parameters:
pagename - the wiki page name source of the Assertion
subject - the subject Term of the Assertion
predicate - the property assignment Predicate (or property name) of the Assertion
property - the property value of the Assertion
create - when true, permits creation of Assertion to fulfill a match
Returns:
a new or existing Assertion, depending on the value of create
Throws:
AssertionException - if an error occurs while creating the new Assertion

getAssertion

Assertion getAssertion(String pagename,
                       String subject,
                       String predicate,
                       String object)
                       throws AssertionException
Queries the set of existing Assertions for an Assertion matching the provided Subject, Predicate and Object. This is not expected to return assertion templates nor property assertions.

Returns null if unable to locate a matching Assertion. The pagename parameter is optional; it is only used as an additional query filter if provided.

Parameters:
pagename - the wiki page source of the Assertion
subject - the wiki page name of the Assertion's subject
predicate - the wiki page name of the Assertion's predicate
object - the wiki page name of the Assertion's object
Throws:
AssertionException

hasAssertion

boolean hasAssertion(String pagename,
                     String subject,
                     String predicate,
                     String object)
Returns true if an Assertion equivalent to one created with the provided subject, predicate, and object is contained in the registry. This is not expected to match assertion templates nor property assertions. The pagename parameter is optional; it is only used as an additional query filter if provided.

Parameters:
pagename - the wiki page source of the Assertion
subject - the wiki page name of the Assertion's subject
predicate - the wiki page name of the Assertion's predicate
object - the wiki page name of the Assertion's object
Returns:
true if a matching Assertion already exists in the registry.

removeAssertion

boolean removeAssertion(Assertion assertion)
Returns true if the Assertion was successfully removed from the registry. This performs any necessary update processes.

Parameters:
assertion - the Assertion to be removed.

toXHTML

String toXHTML(WikiContext context,
               Assertion assertion)
               throws AssertionException
Format the assertion into XHTML output suitable for display on a web page.

Parameters:
context - optional; if supplied, used to provide link markup.
assertion - the Assertion to be displayed.
Returns:
an XHTML compliant HTML fragment, all tags to be closed and balanced.
Throws:
AssertionException

createAssertion

Assertion createAssertion(String pagename,
                          Term subject,
                          Predicate predicate,
                          Term object,
                          boolean isTemplate)
                          throws AssertionException
Creates and returns a new Assertion provided its parameters.

NOTE: while this is a public method by virtue of it being part of the API, it should not be called directly since creation of Assertions is meant to be handled internal to the process.

Parameters:
pagename - the wiki page source of the Assertion
subject - the subject Term of the Assertion
predicate - the Predicate of the Assertion
object - the subject Term of the Assertion
isTemplate - if true, the assertion is created as an assertion template.
Throws:
AssertionException - if unable to create the new Assertion.
See Also:
to create a property assertion

createAssertion

Assertion createAssertion(String pagename,
                          Term subject,
                          Predicate predicate,
                          Property property)
                          throws AssertionException
Creates and returns a new property Assertion provided its parameters.

NOTE: while this is a public method by virtue of it being part of the API, it should not be called directly since creation of Assertions is meant to be handled internal to the process.

Parameters:
pagename - the wiki page source of the Assertion
subject - the subject Term of the Assertion
predicate - the Predicate of the Assertion
property - the Property being asserted.
Throws:
AssertionException - if unable to create the new Assertion.
See Also:
to create an assertion or assertion template


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.