org.eaglei.repository.model
Class ImmutableObjectModel

java.lang.Object
  extended by org.eaglei.repository.model.ImmutableObjectModel
Direct Known Subclasses:
EditToken, QueryMacro, WorkflowState, WritableObjectModel

public abstract class ImmutableObjectModel
extends java.lang.Object

 Outline of all "Object Model" classes - even the writable ones are a
 subclass of this.  Object Models are Java objects that represent an
 instance or layer -- i.e. a body of properties on an instance -- in the
 RDF database.  They exist to cache the information and make it easier
 to manipulate in Java.  This class describes a common interface to
 be implemented by all object models.

 This is implemented as an abstract class instead of an interface for
 several reasons:
  1. implement and/or require static methods
  2. allow subclasses to skip implementing irrelevant methods so long
     as they never get called.
  3. consistency with the WritableObjectModel class, which had to be
     abstract since it includes its own common logic.
 

Author:
Larry Stone Started March 2011
See Also:
WritableObjectModel, HasContentCache

Constructor Summary
ImmutableObjectModel()
           
 
Method Summary
static ImmutableObjectModel find(javax.servlet.http.HttpServletRequest request, org.openrdf.model.URI subject)
          Get an instance of the object model whose subject is the given URI.
static java.util.List<? extends ImmutableObjectModel> findAll(javax.servlet.http.HttpServletRequest request)
          Gets List of object models for _all_ instances of the class found in the repository.
abstract  java.lang.String getLabel()
          Get a human-readable text string appropriate to label this instance in e.g.
abstract  org.openrdf.model.URI getURI()
          Get the subject URI taht created this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableObjectModel

public ImmutableObjectModel()
Method Detail

find

public static ImmutableObjectModel find(javax.servlet.http.HttpServletRequest request,
                                        org.openrdf.model.URI subject)
                                 throws javax.servlet.ServletException
Get an instance of the object model whose subject is the given URI. This is the canonical way to look up or discover an object.

Parameters:
request - the HTTP request object from the servlet
subject - URI of hte subject of the RDF object or layer
Returns:
an instance of the object model class filled in for subject, or null if not found.
Throws:
javax.servlet.ServletException

findAll

public static java.util.List<? extends ImmutableObjectModel> findAll(javax.servlet.http.HttpServletRequest request)
                                                              throws javax.servlet.ServletException
Gets List of object models for _all_ instances of the class found in the repository. Should be cached, perhaps statically, for infrequently- changning items. See the HasContentCache class for clues about decaching.

Parameters:
request - the HTTP request object from the servlet
Returns:
List of all instances of the object model class in the repository
Throws:
javax.servlet.ServletException

getURI

public abstract org.openrdf.model.URI getURI()
Get the subject URI taht created this instance.

Returns:
the subject URI

getLabel

public abstract java.lang.String getLabel()
Get a human-readable text string appropriate to label this instance in e.g. a UI display or printed document.

Returns:
the text label


Copyright © 2009-2011 Eagle-I. All Rights Reserved.