i3.dragos.gm.core.schema
Interface ExistenceCheckable

All Known Subinterfaces:
Attribute, Edge, EdgeClass, Graph, GraphClass, GraphEntity, GraphEntityClass, Node, NodeClass, Relation, RelationClass, RelationEnd, RelationEndClass
All Known Implementing Classes:
AbstractAttribute, AttributeProxy, EdgeClassProxy, EdgeProxy, GraphClassProxy, GraphEntityClassProxy, GraphEntityProxy, GraphProxy, NodeClassProxy, NodeProxy, RelationClassProxy, RelationEndClassProxy, RelationEndProxy, RelationProxy

public interface ExistenceCheckable

Methods for verifying the existence of referenced objects. See the "Consistency" chapter in the documentation for details.

Author:
Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>

Method Summary
 void checkExistence()
          Checks whether this object still exists, throwing an exception if not.
 void checkExistenceOptional()
          Checks whether this object still exists, throwing an exception if not.
 

Method Detail

checkExistence

void checkExistence()
                    throws java.lang.RuntimeException
Checks whether this object still exists, throwing an exception if not. This method should be called by all writing operations.

Throws:
java.lang.RuntimeException - if this object no longer exists or an error occurred while accessing the GraphPool.

checkExistenceOptional

void checkExistenceOptional()
                            throws java.lang.RuntimeException
Checks whether this object still exists, throwing an exception if not. This method should be called by all reading operations.

A useful default implementation would be as follows:

 try {
     GraphPool gp = GraphPoolFactory.get(getDataSourceURL());
     if (gp.getForceExistenceCheckOnRead()) {
         checkExistence();
     }
 } catch (DragosException e) {
     String message = "Caught GraphPoolException while trying to determine whether to perform checks on read operation!";
     log.error(message);
     throw new RuntimeException(message);
 }
 

Throws:
java.lang.RuntimeException - if this object no longer exists or an error occurred while accessing the GraphPool.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.