sophware.home.io
Class MemoryHomeStorage

java.lang.Object
  extended by sophware.home.io.MemoryHomeStorage
All Implemented Interfaces:
HomeStorage
Direct Known Subclasses:
NetworkHomeStorage, PersistentHomeStorage

public class MemoryHomeStorage
extends java.lang.Object
implements HomeStorage

The MemoryHomeStorage is a non-persistent implementation of the HomeStorage interface.

Version:
1.0, 03/19/07
Author:
Russell Soph

Constructor Summary
MemoryHomeStorage()
           
 
Method Summary
 void add(java.lang.Object dev)
          Add a Object to this container
 void close()
          stops this data store
 boolean contains(java.lang.Object obj)
          Checks to see if Object is in home storage.
 void flush()
          flush this data store
 java.lang.Object get(java.lang.Class c, java.lang.String name)
          Get a named instance of the class
 HomeDevice get(DeviceAddress addr)
          Get a HomeDevice associated with an address
 java.util.Enumeration<java.lang.Object> getAll()
          Get all Objects.
 java.util.Enumeration<java.lang.Object> getAll(java.lang.Class c)
          Get all HomeDevices.
 void open()
          Initializes this data store
 void remove(java.lang.Object dev)
          Remove a BinaryObject from this container
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryHomeStorage

public MemoryHomeStorage()
Method Detail

open

public void open()
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Initializes this data store

Specified by:
open in interface HomeStorage
Throws:
java.io.IOException
java.lang.ClassNotFoundException

getAll

public java.util.Enumeration<java.lang.Object> getAll(java.lang.Class c)
Get all HomeDevices.

Specified by:
getAll in interface HomeStorage
Parameters:
c - the class of the objects to be retrieved
Returns:
returns all HomeDevices in the container

contains

public boolean contains(java.lang.Object obj)
Checks to see if Object is in home storage.

Specified by:
contains in interface HomeStorage
Parameters:
obj - the object.
Returns:
true if object is in home storage, false otherwise

getAll

public java.util.Enumeration<java.lang.Object> getAll()
Get all Objects.

Specified by:
getAll in interface HomeStorage
Returns:
returns all BinaryObjects in the container

get

public HomeDevice get(DeviceAddress addr)
Get a HomeDevice associated with an address

Specified by:
get in interface HomeStorage
Parameters:
addr - the DeviceAddress
Returns:
HomeDevice or null if no device found

get

public java.lang.Object get(java.lang.Class c,
                            java.lang.String name)
Get a named instance of the class

Specified by:
get in interface HomeStorage
Parameters:
c - the class
name - the name
Returns:
Object or null if no object found

add

public void add(java.lang.Object dev)
Add a Object to this container

Specified by:
add in interface HomeStorage
Parameters:
dev - the device to be added

remove

public void remove(java.lang.Object dev)
Remove a BinaryObject from this container

Specified by:
remove in interface HomeStorage
Parameters:
dev - the device to be removed

flush

public void flush()
           throws java.io.IOException
flush this data store

Specified by:
flush in interface HomeStorage
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
stops this data store

Specified by:
close in interface HomeStorage
Throws:
java.io.IOException