|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rhq.core.domain.resource.flyweight.FlyweightCache
public class FlyweightCache
A helper object to hold the cached instances of the flyweights. The keys in the maps are ids, values are the objects themselves.
The construct*
methods are provided to correctly initialize
instances of the flyweight types in the cache instance from a minimal set
of data.
Constructor Summary | |
---|---|
FlyweightCache()
|
Method Summary | |
---|---|
ResourceFlyweight |
constructResource(int id,
String name,
String uuid,
String resourceKey,
Integer parentId,
int typeId,
AvailabilityType currentAvailability)
Constructs a fully initialized instance of the resource flyweight. |
ResourceFlyweight |
constructResource(Resource original)
|
ResourceTypeFlyweight |
constructResourceType(int id,
String name,
String plugin,
boolean singleton,
ResourceCategory category,
Integer subCategory)
Constructs a fully initialized resource type flyweight. |
ResourceTypeFlyweight |
constructResourceType(ResourceType original)
|
ResourceSubCategoryFlyweight |
constructSubCategory(int id,
String name,
Integer parentSubCategoryId,
String parentSubCategoryName)
An existing sub category is first looked up in this cache. |
ResourceSubCategoryFlyweight |
constructSubCategory(ResourceSubCategory original)
|
Map<Integer,ResourceFlyweight> |
getResources()
|
Map<Integer,ResourceTypeFlyweight> |
getResourceTypes()
|
Map<Integer,ResourceSubCategoryFlyweight> |
getSubCategories()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FlyweightCache()
Method Detail |
---|
public Map<Integer,ResourceFlyweight> getResources()
public Map<Integer,ResourceTypeFlyweight> getResourceTypes()
public Map<Integer,ResourceSubCategoryFlyweight> getSubCategories()
public ResourceFlyweight constructResource(Resource original)
original
- the resource
#constructResource(int, String, String, Integer, int, AvailabilityType)
public ResourceFlyweight constructResource(int id, String name, String uuid, String resourceKey, Integer parentId, int typeId, AvailabilityType currentAvailability)
Note that if the parentId is not null and not found in this cache, a new flyweight is created for the parent, initialized only with the id.
The type is supposed to exist in this cache already. If it doesn't, no type is assigned to the returned resource flyweight.
If a corresponding flyweight for the provided resource id is already found in this cache, it is refreshed with the data provided to this call.
id
- the resource idname
- the resource nameuuid
- the resource uuidresourceKey
- the resource keyparentId
- the id of the parent resourcetypeId
- the id of the resource typecurrentAvailability
- the availability of the resource
public ResourceSubCategoryFlyweight constructSubCategory(ResourceSubCategory original)
original
-
#constructSubCategory(int, String, Integer, FlyweightCache)
public ResourceSubCategoryFlyweight constructSubCategory(int id, String name, Integer parentSubCategoryId, String parentSubCategoryName)
If parent sub category id is not null but a corresponding flyweight doesn't exist in this cache yet, a new instance is put in this cache initialized with the parent id and name.
id
- name
- parentSubCategoryId
- parentSubCategoryName
- cache
-
public ResourceTypeFlyweight constructResourceType(ResourceType original)
original
- the original resource type
#construct(int, String, String, ResourceCategory, Integer, FlyweightCache)
public ResourceTypeFlyweight constructResourceType(int id, String name, String plugin, boolean singleton, ResourceCategory category, Integer subCategory)
The subcategory is supposed to exist in the cache. If it doesn't the subcategory of the returned resource type flyweight is set to null.
id
- the resource type idname
- the resource type nameplugin
- the resource type pluginsingleton
- true if the resource type is a singletoncategory
- the resource type categorysubCategory
- the id of the resource type sub category or nullcache
- the flyweight cache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |