Class ContextCache
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache
-
public class ContextCache extends Object
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected ContextCacheRenewalcontextCacheRenewalprotected Map<String,UUID>contextFullNameToUUIDprotected List<org.gcube.informationsystem.contexts.reference.entities.Context>contextsprotected org.gcube.informationsystem.tree.Tree<org.gcube.informationsystem.contexts.reference.entities.Context>contextsTreeprotected CalendarcreationTimestatic longDEFAULT_EXPIRING_TIMEOUTprotected CalendarexpiringTimestatic intexpiringTimeoutprotected static ContextCachesingletonprotected Map<UUID,org.gcube.informationsystem.contexts.reference.entities.Context>uuidToContextprotected Map<UUID,String>uuidToContextFullName
-
Constructor Summary
Constructors Constructor Description ContextCache()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanCache()protected voidcleanCache(Calendar calendar)org.gcube.informationsystem.contexts.reference.entities.ContextgetContextByFullName(String contextFullName)org.gcube.informationsystem.contexts.reference.entities.ContextgetContextByUUID(String uuid)org.gcube.informationsystem.contexts.reference.entities.ContextgetContextByUUID(UUID uuid)ContextCacheRenewalgetContextCacheRenewal()protected StringgetContextFullName(org.gcube.informationsystem.contexts.reference.entities.Context context)StringgetContextFullNameByUUID(String uuid)StringgetContextFullNameByUUID(UUID uuid)Map<String,UUID>getContextFullNameToUUIDAssociation()List<org.gcube.informationsystem.contexts.reference.entities.Context>getContexts()org.gcube.informationsystem.tree.Tree<org.gcube.informationsystem.contexts.reference.entities.Context>getContextsTree()static ContextCachegetInstance()UUIDgetUUIDByFullName(String contextFullName)Map<UUID,String>getUUIDToContextFullNameAssociation()voidrefreshContextsIfNeeded()voidrenew()voidsetContextCacheRenewal(ContextCacheRenewal contextCacheRenewal)protected voidsetContexts(Calendar calendar, List<org.gcube.informationsystem.contexts.reference.entities.Context> contexts)voidsetContexts(List<org.gcube.informationsystem.contexts.reference.entities.Context> contexts)static voidsetExpiringTimeout(int expiringTimeout)
-
-
-
Field Detail
-
DEFAULT_EXPIRING_TIMEOUT
public static final long DEFAULT_EXPIRING_TIMEOUT
-
expiringTimeout
public static int expiringTimeout
-
singleton
protected static ContextCache singleton
-
contextCacheRenewal
protected ContextCacheRenewal contextCacheRenewal
-
creationTime
protected Calendar creationTime
-
expiringTime
protected Calendar expiringTime
-
contexts
protected List<org.gcube.informationsystem.contexts.reference.entities.Context> contexts
-
uuidToContext
protected Map<UUID,org.gcube.informationsystem.contexts.reference.entities.Context> uuidToContext
-
contextsTree
protected org.gcube.informationsystem.tree.Tree<org.gcube.informationsystem.contexts.reference.entities.Context> contextsTree
-
-
Method Detail
-
setExpiringTimeout
public static void setExpiringTimeout(int expiringTimeout)
-
getInstance
public static ContextCache getInstance()
-
cleanCache
public void cleanCache()
-
cleanCache
protected void cleanCache(Calendar calendar)
-
renew
public void renew() throws ResourceRegistryException- Throws:
ResourceRegistryException
-
getContextCacheRenewal
public ContextCacheRenewal getContextCacheRenewal()
-
setContextCacheRenewal
public void setContextCacheRenewal(ContextCacheRenewal contextCacheRenewal)
-
refreshContextsIfNeeded
public void refreshContextsIfNeeded() throws ResourceRegistryException- Throws:
ResourceRegistryException
-
getContexts
public List<org.gcube.informationsystem.contexts.reference.entities.Context> getContexts() throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
setContexts
public void setContexts(List<org.gcube.informationsystem.contexts.reference.entities.Context> contexts)
-
setContexts
protected void setContexts(Calendar calendar, List<org.gcube.informationsystem.contexts.reference.entities.Context> contexts)
-
getContextFullName
protected String getContextFullName(org.gcube.informationsystem.contexts.reference.entities.Context context)
-
getContextFullNameByUUID
public String getContextFullNameByUUID(UUID uuid) throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
getContextFullNameByUUID
public String getContextFullNameByUUID(String uuid) throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
getUUIDByFullName
public UUID getUUIDByFullName(String contextFullName) throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
getContextByUUID
public org.gcube.informationsystem.contexts.reference.entities.Context getContextByUUID(UUID uuid) throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
getContextByUUID
public org.gcube.informationsystem.contexts.reference.entities.Context getContextByUUID(String uuid) throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
getContextByFullName
public org.gcube.informationsystem.contexts.reference.entities.Context getContextByFullName(String contextFullName) throws ResourceRegistryException
- Throws:
ResourceRegistryException
-
getUUIDToContextFullNameAssociation
public Map<UUID,String> getUUIDToContextFullNameAssociation() throws ResourceRegistryException
- Returns:
- an Map containing UUID to Context FullName association
- Throws:
ResourceRegistryException
-
getContextFullNameToUUIDAssociation
public Map<String,UUID> getContextFullNameToUUIDAssociation() throws ResourceRegistryException
- Returns:
- an Map containing Context FullName to UUID association
- Throws:
ResourceRegistryException
-
getContextsTree
public org.gcube.informationsystem.tree.Tree<org.gcube.informationsystem.contexts.reference.entities.Context> getContextsTree()
-
-