public interface DerivedResourceManager
A derived object is an object that is created based on one or more resources (potentially of different types), or even other derived objects. Examples of such derived types: a compiled xquery, a WSDL object model (e.g. WSDL4J).
Derived objects of a given type are kept in a cache. Various cahing behaviours are available and should be used to best fit the need for the derived objects. E.g. objects that are transient, like a WSDL object model used for design time, could be registered using a weak o soft cache.
The lifecycle of a derived object is automatically handled by this manager. Especially, if a resource used by a derived object has been updated, the next time that derived object is queried it will be re-computed based on the updated resources. As such, client code of derived objects should not cache this derived object but instead query it everytime it is used.
Modifier and Type | Method and Description |
---|---|
<T> T |
get(Ref ref)
Returns the derived value associated with the given reference
|
<T> T |
get(Ref ref, boolean recompute) |
<T extends DerivedTypeDef> |
getDerivedTypeDef(java.lang.String typeId)
Returns the derived type definition with the given id.
|
DerivedCachesDocument |
getDiagnostics()
Returns the DFW diagnostics for all the derived caches maintained by the derived resource manager
|
DerivedCachesDocument |
getDiagnostics(java.lang.String typeId)
Returns the DFW diagnostics given a DerivedType ID
|
boolean |
isDerivedTypeId(java.lang.String typeId)
Returns true if the given type id represents a DerivedTypeDef
|
boolean |
isValidRef(Ref ref)
Returns true if the derived resource with the given reference is valid, i.e., exists
|
<V> void |
registerHardDerivedType(DerivedTypeDef<V> derivedTypeDef)
Registers a derived type whose values will be stored using hard references.
|
<V> void |
registerLRUDerivedType(DerivedTypeDef<V> derivedTypeDef, int cacheSize, EvictionHandler<V> handler)
Registers a derived type whose values will be stored in an LRU cache and therefore can be evicted from the cache
|
<V> void |
registerMultiLevelDerivedType(DerivedTypeDef<V> derivedTypeDef, int cacheSize, GarbageCollectionHandler<V,?> handler)
Creates a multi level cache.
|
<V> void |
registerSoftDerivedType(DerivedTypeDef<V> derivedTypeDef, GarbageCollectionHandler<V,?> handler)
Registers a derived type whose values will be stored using soft references.
|
<V> void |
registerWeakDerivedType(DerivedTypeDef<V> derivedTypeDef, GarbageCollectionHandler<V,?> handler)
Registers a derived type whose values will be stored using weak references.
|
<V> void registerHardDerivedType(DerivedTypeDef<V> derivedTypeDef)
V
- the type of the derived valuederivedTypeDef
- the derived type.<V> void registerSoftDerivedType(DerivedTypeDef<V> derivedTypeDef, GarbageCollectionHandler<V,?> handler)
V
- the type of the derived valuederivedTypeDef
- the derived type.handler
- handler to be notified after a derived value has been garbage collected. Can be null.<V> void registerWeakDerivedType(DerivedTypeDef<V> derivedTypeDef, GarbageCollectionHandler<V,?> handler)
V
- the type of the derived valuederivedTypeDef
- the derived type.handler
- handler to be notified after a derived value has been garbage collected. Can be null.<V> void registerLRUDerivedType(DerivedTypeDef<V> derivedTypeDef, int cacheSize, EvictionHandler<V> handler)
derivedTypeDef
- the derived typecacheSize
- the size of the LRU cachehandler
- the handler that will be called some time after a derived value has been evicted from the cache. Can be null.<V> void registerMultiLevelDerivedType(DerivedTypeDef<V> derivedTypeDef, int cacheSize, GarbageCollectionHandler<V,?> handler)
derivedTypeDef
- the derived typecacheSize
- the size of the LRU cachehandler
- handler to be notified after a derived value has been garbage collected. Can be null.boolean isDerivedTypeId(java.lang.String typeId)
<T extends DerivedTypeDef> T getDerivedTypeDef(java.lang.String typeId)
boolean isValidRef(Ref ref)
ref
- reference to the derived resource<T> T get(Ref ref) throws NotFoundException
ref
- reference to the derived resourceNotFoundException
- thrown if the reference does not exist or the derived object could not be computed.<T> T get(Ref ref, boolean recompute) throws NotFoundException
NotFoundException
DerivedCachesDocument getDiagnostics()
DerivedCachesDocument getDiagnostics(java.lang.String typeId)
the
- derived type id