org.magnos.data
Class Stores

java.lang.Object
  extended by org.magnos.data.Stores

public class Stores
extends java.lang.Object

A registry of stores mapped by their (hopefully) unique names.

Author:
Philip Diffenderfer

Constructor Summary
Stores()
           
 
Method Summary
static Store get(java.lang.String name)
          Gets the store with the given name from the registry.
static Store put(Store store)
          Adds the store to this registry.
static Store put(Store store, java.lang.String alias)
          Adds the store to this registry under an alias.
static Store remove(Store store)
          Removes the given store from this registry.
static Store remove(java.lang.String name)
          Removes the store with the given name from this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stores

public Stores()
Method Detail

get

public static Store get(java.lang.String name)
Gets the store with the given name from the registry.

Parameters:
name - The name of the store to get from the registry.
Returns:
The store with the given name, or null if none existed.

put

public static Store put(Store store)
Adds the store to this registry. If the registry already contains a store with the same name it will be overriden and the previous store will be returned.

Parameters:
store - The store to add to the registry.
Returns:
The previous store under the same name, or null if none existed.

put

public static Store put(Store store,
                        java.lang.String alias)
Adds the store to this registry under an alias. If the registry already contains a store with the given name it will be overriden and the previous tore will be returned.

Parameters:
store - The store to add to the registry.
alias - The alias to add the store under, opposed to its own name.
Returns:
The previous store under the same name, or null if none existed.

remove

public static Store remove(java.lang.String name)
Removes the store with the given name from this registry.

Parameters:
name - The name of the store to remove.
Returns:
The store removed, or null if none existed.

remove

public static Store remove(Store store)
Removes the given store from this registry.

Parameters:
store - The store to remove.
Returns:
The store removed, or null if none existed.