org.rhq.enterprise.server.resource.disambiguation
Class Disambiguator

java.lang.Object
  extended by org.rhq.enterprise.server.resource.disambiguation.Disambiguator

public class Disambiguator
extends Object

This is basically a helper class that provides the disambiguation method. It is intended to be used in an SLSB context.

Author:
Lukas Krejci

Field Summary
static int MAXIMUM_DISAMBIGUATED_TREE_DEPTH
          The maximum depth of the resource tree.
 
Method Summary
static
<T> List<org.rhq.core.domain.resource.composite.DisambiguationReport<T>>
disambiguate(List<T> results, DisambiguationUpdateStrategy disambiguationUpdateStrategy, org.rhq.core.util.IntExtractor<? super T> extractor, javax.persistence.EntityManager entityManager, List<String> duplicateTypeNames)
          Given a list of results, this method produces an object decorates the provided original results with data needed to disambiguate the results with respect to resource names, their types and ancestory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXIMUM_DISAMBIGUATED_TREE_DEPTH

public static final int MAXIMUM_DISAMBIGUATED_TREE_DEPTH
The maximum depth of the resource tree.

See Also:
Constant Field Values
Method Detail

disambiguate

public static <T> List<org.rhq.core.domain.resource.composite.DisambiguationReport<T>> disambiguate(List<T> results,
                                                                                                    DisambiguationUpdateStrategy disambiguationUpdateStrategy,
                                                                                                    org.rhq.core.util.IntExtractor<? super T> extractor,
                                                                                                    javax.persistence.EntityManager entityManager,
                                                                                                    List<String> duplicateTypeNames)
Given a list of results, this method produces an object decorates the provided original results with data needed to disambiguate the results with respect to resource names, their types and ancestory.

The disambiguation result contains information on what types of information are needed to make the resources in the original result unambiguous and contains the decorated original data in the same order as the supplied result list.

The objects in results do not necessarily need to correspond to a resource. In case of such objects, the resourceIdExtractor should return 0. In the resulting report such objects will still be wrapped in a DisambiguationReport but the parent list will be empty and resource type and plugin name will be null.

Type Parameters:
T - the type of the result elements
Parameters:
results - the results to disambiguate
disambiguationUpdateStrategy - how is the disambiguation info going to be applied to the results.
resourceIdExtractor - an object able to extract resource id from an instance of type parameter.
entityManager - an entityManager to be used to access the database
duplicateTypeNames - the list of type names that are ambiguous without plugin spec
Returns:
the disambiguation result
See Also:
ResourceNamesDisambiguationResult


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.