org.openrdf.elmo
Interface ElmoManager

All Known Implementing Classes:
HiveMindSesameManager, SesameManager

public interface ElmoManager

Manages the basic operations of Elmo JavaBeans.

Author:
James Leigh

Method Summary
 void close()
          Closes any transactions or connections in the manager.
 void close(Iterator<?> iter)
          Close an Iterator created by iterate() immediately, instead of waiting until the iteration is complete or connection is closed.
 boolean contains(Object entity)
          Check if the instance belongs to the current persistence context.
 Memento createMemento()
          Creates a new Memento Object that represents the current state of the Bean pool.
 ElmoQuery createQuery(String query)
          Creates an ElmoQuery to evaluate the query string.
<T> T
designate(Class<T> concept)
          Assigns type to a new anonymous entity.
<T> T
designate(Class<T> concept, QName qname)
          Assigns type to the named entity subject.
<T> T
designateEntity(Class<T> concept, Object entity)
           
 Entity find(QName qname)
          Retrives the rdf:type, creates a Java Bean class and instantiates it.
<T> Iterable<T>
findAll(Class<T> role)
          Creates an iteration of entities that implement this role.
 Locale getLocale()
          Locale this manager was created with.
 EntityTransaction getTransaction()
          Returns the resource-level transaction object.
 boolean isOpen()
          If this manager currently has an open connection to the repository.
<T> T
merge(T bean)
          Copies all non-null values from bean into an entity managed by this manager.
 void redoMemento(Memento memento)
          Replays changes made after this memento object was created.
 void refresh(Object entity)
          If entity implements Refreshable, its method Refreshable.refresh() will be called.
 void remove(Object entity)
          Removes the given entity or subject and all implementing roles.
 Entity removeDesignation(Class<?> concept, Object entity)
           
<T> T
rename(T entity, QName qname)
          Removes all the references to the given entity and replaces them with references to the new qname.
 void undoMemento(Memento memento)
          Rolls-back any changes made after this memento object was created.
 

Method Detail

getLocale

Locale getLocale()
Locale this manager was created with.

Returns:
Locale or null

isOpen

boolean isOpen()
If this manager currently has an open connection to the repository.

Returns:
true if the connection is open.

close

void close()
Closes any transactions or connections in the manager.


close

void close(Iterator<?> iter)
Close an Iterator created by iterate() immediately, instead of waiting until the iteration is complete or connection is closed.


getTransaction

EntityTransaction getTransaction()
Returns the resource-level transaction object. The EntityTransaction instance may be used serially to begin and commit multiple transactions.

Returns:
EntityTransaction instance

createMemento

Memento createMemento()
Creates a new Memento Object that represents the current state of the Bean pool. Once created the returned Object will track any futher changes on this Bean pool.

Returns:
A memento object that can undone subsequent changes.
See Also:
undoMemento(Memento)

undoMemento

void undoMemento(Memento memento)
Rolls-back any changes made after this memento object was created. The memento object does not have to have been created from this Bean pool.

Parameters:
memento - Transaction to be rolled-back.
See Also:
createMemento()

redoMemento

void redoMemento(Memento memento)
Replays changes made after this memento object was created. The memento object does not have to have been created from this Bean pool.

Parameters:
memento - Transaction to be repeated.
See Also:
createMemento()

contains

boolean contains(Object entity)
Check if the instance belongs to the current persistence context.

Parameters:
entity -
Returns:
true if the instance belongs to the current persistence context.

designate

<T> T designate(Class<T> concept)
Assigns type to a new anonymous entity.

Parameters:
concept - interface to be translated to rdf:type.
Returns:
Java Bean representing the subject.

designate

<T> T designate(Class<T> concept,
                QName qname)
Assigns type to the named entity subject.

Parameters:
concept - interface to be translated to rdf:type.
qname - URI or encoded BNode id of the entity.
Returns:
Java Bean representing the subject.

designateEntity

<T> T designateEntity(Class<T> concept,
                      Object entity)

removeDesignation

Entity removeDesignation(Class<?> concept,
                         Object entity)

rename

<T> T rename(T entity,
             QName qname)
Removes all the references to the given entity and replaces them with references to the new qname.

Parameters:
entity - current Entity to be renamed
qname - new qualified name of the entity
Returns:
entity with the given qname.

find

Entity find(QName qname)
Retrives the rdf:type, creates a Java Bean class and instantiates it.

Parameters:
qname - URI or encoded BNode id of the entity.
Returns:
JavaBean representing the subject.

createQuery

ElmoQuery createQuery(String query)
Creates an ElmoQuery to evaluate the query string.

Parameters:
query - rdf query in the configured language - default SPARQL.
Returns:
ElmoQuery.

findAll

<T> Iterable<T> findAll(Class<T> role)
Creates an iteration of entities that implement this role.

Parameters:
role - concept or behaviour to be translated to one or more rdf:types.
Returns:
Iterable entities that implement role.

refresh

void refresh(Object entity)
If entity implements Refreshable, its method Refreshable.refresh() will be called.

Parameters:
entity -

merge

<T> T merge(T bean)
Copies all non-null values from bean into an entity managed by this manager. If bean implements Entity its QName will be used to look up the managed entity, otherwise a new anonymous entity will be created.

Type Parameters:
T -
Parameters:
bean - with values that shoud be merged
Returns:
managed entity it was merged with

remove

void remove(Object entity)
Removes the given entity or subject and all implementing roles.

Parameters:
entity - to be removed from the pool and repository.


Copyright © 2004-2008 Aduna. All Rights Reserved.