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.
<T> T
create(Class<T> concept, Class<?>... concepts)
          Assigns type to a new anonymous entity.
<T> T
create(QName qname, Class<T> concept, Class<?>... concepts)
          Assigns concept to the new named entity.
 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, Class<?>... concepts)
          Deprecated. 
<T> T
designate(Class<T> concept, QName qname)
          Deprecated. 
<T> T
designate(QName qname, Class<T> concept, Class<?>... concepts)
          Assigns concept to the named entity subject.
<T> T
designateEntity(Class<T> concept, Object entity)
          Deprecated. 
<T> T
designateEntity(Object entity, Class<T> concept, Class<?>... concepts)
          Assigns concept to the given entity and return a new object reference that implements the given concept.
 Entity find(QName qname)
          Retrieves 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 persist(Object 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)
          Deprecated. 
 Entity removeDesignation(Object entity, Class<?>... concepts)
          Removes the concept designation from this 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 further 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. It is the responsibility of the caller to ensure that it is safe to roll-back this set of changes. Any referenced object instances modified by this change need to be externally refreshed. Any referenced object instances removed or renamed by this change must no longer be used by this or any other processes.

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(), undoMemento(Memento)

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.

create

<T> T create(Class<T> concept,
             Class<?>... concepts)
Assigns type to a new anonymous entity.

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

create

<T> T create(QName qname,
             Class<T> concept,
             Class<?>... concepts)
Assigns concept to the new named entity.

Parameters:
qname - URI of the new entity that does not exist in the repository.
concept - interface to be translated to rdf:type.
concepts - additional interfaces to be translated to rdf:type.
Returns:
Java Bean representing the subject.

designate

@Deprecated
<T> T designate(Class<T> concept,
                           Class<?>... concepts)
Deprecated. 

Assigns type to a new anonymous entity. Use create instead.

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

designate

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

Parameters:
qname - URI of the entity that may exist in the repository.
concept - interface to be translated to rdf:type.
concepts - additional interfaces to be translated to rdf:type.
Returns:
Java Bean representing the subject.

designate

@Deprecated
<T> T designate(Class<T> concept,
                           QName qname)
Deprecated. 

Assigns concept to the named entity subject.

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

designateEntity

<T> T designateEntity(Object entity,
                      Class<T> concept,
                      Class<?>... concepts)
Assigns concept to the given entity and return a new object reference that implements the given concept.

Type Parameters:
T -
Parameters:
entity - An existing entity retrieved from this manager.
concept - interface to be translated to rdf:type.
concepts - additional interfaces to be translated to rdf:type.
Returns:
Java Bean representing entity that implements concept.

designateEntity

@Deprecated
<T> T designateEntity(Class<T> concept,
                                 Object entity)
Deprecated. 

Assigns concept to the given entity and return a new object reference that implements the given concept.

Type Parameters:
T -
Parameters:
concept - interface to be translated to rdf:type.
entity - An existing entity retrieved from this manager.
Returns:
Java Bean representing entity that implements concept.

removeDesignation

Entity removeDesignation(Object entity,
                         Class<?>... concepts)
Removes the concept designation from this entity.

Parameters:
entity - An existing entity retrieved from this manager.
concepts - interface to be translated to rdf:type.
Returns:
Java Bean representing entity that does not implement concept.

removeDesignation

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

Removes the concept designation from this entity.

Parameters:
concept - interface to be translated to rdf:type.
entity - An existing entity retrieved from this manager.
Returns:
Java Bean representing entity that does not implement concept.

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. It is the responsibility of the caller to ensure that any object references to this resource are replaced with the returned object. Previous referenced objects must no longer be used and any cached values must be refreshed.

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)
Retrieves the rdf:type, creates a Java Bean class and instantiates it.

Parameters:
qname - URI 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. This call instructs entities that their property values may have changed and they should reload them as needed.

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

persist

void persist(Object 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.

Parameters:
bean - with values that shoud be merged

remove

void remove(Object entity)
Removes the given entity or subject and all implementing roles. It is the responsibility of the caller to ensure this entity or any other object referencing it are no longer used and any object that may have cached a value containing this is refreshed.

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


Copyright © 2004-2008 Aduna. All Rights Reserved.