com.facetmap.simple
Class SimpleResourceSpace

java.lang.Object
  extended bycom.facetmap.simple.SimpleResourceSpace
All Implemented Interfaces:
ResourceSpace

public class SimpleResourceSpace
extends java.lang.Object
implements ResourceSpace

An entirely RAM-based home. There is some commented-out code in here that can be used to turn it into a home that uses database for persistence.


Field Summary
protected  Map map
           
protected  java.util.Vector resources
           
 
Constructor Summary
SimpleResourceSpace(Map map)
           
 
Method Summary
 void clear()
           
 int countResources()
           
 SimpleResource create(SimpleResource r)
          Merely indexes the resource, sets its ID, and returns it.
 java.util.Collection getAll()
          Returns all resources, unsorted.
 Resource getById(int id)
          Will return null if the passed id has no resource.
 int getResourceCount()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected Map map

resources

protected java.util.Vector resources
Constructor Detail

SimpleResourceSpace

public SimpleResourceSpace(Map map)
Method Detail

getResourceCount

public int getResourceCount()
Specified by:
getResourceCount in interface ResourceSpace

clear

public void clear()

create

public SimpleResource create(SimpleResource r)
Merely indexes the resource, sets its ID, and returns it. This SimpleResourceSpace does not make a copy of the resource, so don't go changing the resource unless you mean to change it in Home.


countResources

public int countResources()

getById

public Resource getById(int id)
Will return null if the passed id has no resource.

Specified by:
getById in interface ResourceSpace

getAll

public java.util.Collection getAll()
Returns all resources, unsorted.

Specified by:
getAll in interface ResourceSpace