org.eclipse.modisco.infra.discovery.core
Interface IDiscoveryManager


public interface IDiscoveryManager


Field Summary
static IDiscoveryManager INSTANCE
           
 
Method Summary
 boolean canRetrieveValue(DiscovererParameter parameter)
          This method indicates if a parameter value can be retrieved from one discoverer (thanks to one public field or public getter method).
 IDiscoverer<?> createDiscovererImpl(DiscovererDescription description)
          This method creates a new IDiscoverer from the given DiscovererDescription.
 IDiscoverer<?> createDiscovererImpl(java.lang.String id)
          This method creates a new IDiscoverer from the DiscovererDescription with the given id.
 void discoverElement(IDiscoverer<?> discoverer, java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> parametersValues, IProgressMonitor monitor)
          Launch a discovery for a discoverer using the Java reflective API.
 java.util.Collection<DiscovererDescription> getApplicableDiscoverers(java.lang.Object source)
          This method returns a collection of IDiscoverer instances which accept the "source" parameter value as a discovery source.
 DiscovererDescription getDiscovererDescription(IDiscoverer<?> discoverer)
          This method returns the DiscovererDescription instance for the given Discoverer instance.
 DiscovererDescription getDiscovererDescription(java.lang.String id)
          This method returns the DiscovererDescription instance for the given discoverer id.
 java.util.Collection<DiscovererDescription> getDiscoverers()
          This method returns all existing instances of registered DiscovererDescriptions.
 java.lang.Object getInitialValue(DiscovererParameter parameter, DiscovererDescription discoverer, java.lang.Object source)
          Returns the initial value for the given parameter, or null if none.
 java.lang.Object getValue(DiscovererParameter parameter, IDiscoverer<?> discoverer)
          Retrieve a parameter value for a Discoverer using the Java reflective API.
 boolean hasInitialValue(DiscovererParameter parameter, DiscovererDescription discoverer)
          Whether an initial value is specified for the given parameter
 boolean isApplicable(DiscovererDescription discovererDefinition, java.lang.Object source)
          This method indicates if the discoverer associated to the given DiscovererDescription instance accepts the "source" parameter value as a discovery source.
 void setValue(DiscovererParameter parameter, IDiscoverer<?> discoverer, java.lang.Object parameterValue)
          Set a parameter value for a Discoverer using the Java reflective API.
 

Field Detail

INSTANCE

static final IDiscoveryManager INSTANCE
Method Detail

createDiscovererImpl

IDiscoverer<?> createDiscovererImpl(java.lang.String id)
This method creates a new IDiscoverer from the DiscovererDescription with the given id.

Returns:
the created IDiscoverer or null if no DiscovererDescription was registered with the given id.

createDiscovererImpl

IDiscoverer<?> createDiscovererImpl(DiscovererDescription description)
This method creates a new IDiscoverer from the given DiscovererDescription.

Returns:
the created IDiscoverer or null if it couldn't be created..

getApplicableDiscoverers

java.util.Collection<DiscovererDescription> getApplicableDiscoverers(java.lang.Object source)
This method returns a collection of IDiscoverer instances which accept the "source" parameter value as a discovery source. This method basically relies on the isApplicable(DiscovererDescription, Object) service. The resulting collection is unmodifiable.


isApplicable

boolean isApplicable(DiscovererDescription discovererDefinition,
                     java.lang.Object source)
This method indicates if the discoverer associated to the given DiscovererDescription instance accepts the "source" parameter value as a discovery source.


getDiscoverers

java.util.Collection<DiscovererDescription> getDiscoverers()
This method returns all existing instances of registered DiscovererDescriptions. The returned collection is unmodifiable.


getDiscovererDescription

DiscovererDescription getDiscovererDescription(java.lang.String id)
This method returns the DiscovererDescription instance for the given discoverer id.


getDiscovererDescription

DiscovererDescription getDiscovererDescription(IDiscoverer<?> discoverer)
This method returns the DiscovererDescription instance for the given Discoverer instance.


canRetrieveValue

boolean canRetrieveValue(DiscovererParameter parameter)
This method indicates if a parameter value can be retrieved from one discoverer (thanks to one public field or public getter method).


getValue

java.lang.Object getValue(DiscovererParameter parameter,
                          IDiscoverer<?> discoverer)
                          throws DiscoveryException
Retrieve a parameter value for a Discoverer using the Java reflective API.

Parameters:
parameter - the parameter whose value to get
discoverer - the discoverer on which to parameter is set
Returns:
the value of the parameter
Throws:
DiscoveryException

setValue

void setValue(DiscovererParameter parameter,
              IDiscoverer<?> discoverer,
              java.lang.Object parameterValue)
              throws DiscoveryException
Set a parameter value for a Discoverer using the Java reflective API.

Parameters:
parameter - the parameter to set
discoverer - the discoverer on which to set the parameter
parameterValue - the value to set the parameter to
Throws:
DiscoveryException

discoverElement

void discoverElement(IDiscoverer<?> discoverer,
                     java.lang.Object source,
                     java.util.Map<java.lang.String,java.lang.Object> parametersValues,
                     IProgressMonitor monitor)
                     throws DiscoveryException
Launch a discovery for a discoverer using the Java reflective API.

This method should be called from a Job, in order to avoid freezing the UI and provide progress and cancellation.

Parameters:
discoverer - the discoverer to launch
source - the input of the discovery (file, project, etc.)
parametersValues - values for the discoverer's parameters
monitor - a progress monitor used to report progress and respond to cancellation. May be a NullProgressMonitor if no monitor is to be used.
Throws:
DiscoveryException

hasInitialValue

boolean hasInitialValue(DiscovererParameter parameter,
                        DiscovererDescription discoverer)
Whether an initial value is specified for the given parameter

Parameters:
parameter - the parameter
discoverer - the discoverer in which the parameter is defined
Returns:
whether an initial value was specified for the parameter in the discoverer

getInitialValue

java.lang.Object getInitialValue(DiscovererParameter parameter,
                                 DiscovererDescription discoverer,
                                 java.lang.Object source)
                                 throws DiscoveryException
Returns the initial value for the given parameter, or null if none.

Parameters:
parameter - the parameter
discoverer - the discoverer in which the parameter is defined
source - the element the discovery is applied on
Returns:
the initial value for the given parameter, or null if none
Throws:
DiscoveryException