Package fi.tut.mei.resdescapi.rescatapi
Class ResCatStoPool
- java.lang.Object
-
- fi.tut.mei.resdescapi.rescatapi.ResCatStoPool
-
public class ResCatStoPool extends Object
Pool for Resource Catalogue Storages- Author:
- Niko Siltala
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addStorage(String id, ResCatStoImpl storage)
Adds specific Resource Catalogue Storage to the poolstatic ResCatStoPool
getInstance()
Gets the common instance of this pool of Resource Catalogue StoragesResCatStoImpl
getStorage_byId(String id)
Gets specific Resource Catalogue Storage from the poolResCatStoImpl
getStorage_byName(String name)
Gets specific Resource Catalogue Storage from the poolSet<String>
getStorageKeys()
Gets the list of the IDs of available Resource Catalogue Storages in this poolprotected Map<String,ResCatStoImpl>
getStoragePool()
Gets the entire Storage Poolboolean
reinitialiseStorages()
Re-initialises the Storage Pool with data from (updated) configuration.boolean
removeFromStorage(String id)
Removes specific Resource Catalogue Storage from the pool
-
-
-
Method Detail
-
getInstance
public static ResCatStoPool getInstance()
Gets the common instance of this pool of Resource Catalogue Storages- Returns:
- Singleton instance of this class
-
getStorageKeys
public Set<String> getStorageKeys()
Gets the list of the IDs of available Resource Catalogue Storages in this pool- Returns:
- Set(storage name/ID as String)
-
getStorage_byId
public ResCatStoImpl getStorage_byId(String id)
Gets specific Resource Catalogue Storage from the pool- Parameters:
id
- ID of the Storage- Returns:
- Resource Catalogue Storage. Returns null if it does not exist.
-
getStorage_byName
public ResCatStoImpl getStorage_byName(String name)
Gets specific Resource Catalogue Storage from the pool- Parameters:
name
- Name of the Storage- Returns:
- Resource Catalogue Storage. Returns null if it does not exist.
-
addStorage
public boolean addStorage(String id, ResCatStoImpl storage)
Adds specific Resource Catalogue Storage to the pool- Parameters:
id
- to be used. If null, tries to get it from inside ResCatStoImpl.storage
- Resource Catalogue storage instance- Returns:
- true if adding is successful
-
removeFromStorage
public boolean removeFromStorage(String id)
Removes specific Resource Catalogue Storage from the pool- Parameters:
id
- ID of the removed Storage- Returns:
- if removal was successful
-
reinitialiseStorages
public boolean reinitialiseStorages()
Re-initialises the Storage Pool with data from (updated) configuration. First it removes all previous resources from the pool.- Returns:
- True if all went ok.
-
getStoragePool
protected Map<String,ResCatStoImpl> getStoragePool()
Gets the entire Storage Pool- Returns:
- Map(String, ResCatStoImpl)
-
-