org.electrocodeogram.cpc.imports.api.imports.adapter
Interface IImportToolAdapter


public interface IImportToolAdapter

A CPC Imports interface which can be used to contribute import implementations.
An implementation of this interface is likely to be an adapter/wrapper around an existing clone detection tool.

Implementations need to be registered with the CPC Imports extension point org.electrocodeogram.cpc.imports.importToolAdapters.

Author:
vw
See Also:
IImportController, IImportToolAdapterTask, IImportToolAdapterResult

Nested Class Summary
static class IImportToolAdapter.Status
          Return value for processImport(IProgressMonitor, IImportToolAdapterTask, IImportToolAdapterResult).
 
Method Summary
 IImportToolAdapter.Status processImport(org.eclipse.core.runtime.IProgressMonitor monitor, IImportToolAdapterTask importTask, IImportToolAdapterResult importResult)
          Takes an IImportToolAdapterTask description which contains a list of files to import clone data for and an options map.
 

Method Detail

processImport

IImportToolAdapter.Status processImport(org.eclipse.core.runtime.IProgressMonitor monitor,
                                        IImportToolAdapterTask importTask,
                                        IImportToolAdapterResult importResult)
                                        throws org.electrocodeogram.cpc.importexport.api.generic.ImportExportConfigurationOptionException,
                                               org.electrocodeogram.cpc.importexport.api.generic.ImportExportFailureException,
                                               java.lang.InterruptedException
Takes an IImportToolAdapterTask description which contains a list of files to import clone data for and an options map. Furthermore an empty import result wrapper object if provided for the resulting clone data.
The options map contains user selected options. Possible options are specified using the corresponding CPC Imports extension point.

Files for which the import did not produce any clones should not be added to the result map.

The import implementation may attach additional confidence data to each imported clone by attaching IImportCloneObjectExtension instances to the clone objects.

All exceptions which are not declared in the signature need to be caught and re-thrown as an ImportExportFailureException by all implementations.

An implementation may not create its own ICloneFile instances. All returned instances must be created via IStoreProvider.lookupCloneFileByPath(String, String, boolean, boolean). An implementation may not submit any data to the IStoreProvider, it should have no side effects (aside of those caused by the IStoreProvider's lookup methods).

Parameters:
monitor - progress monitor for progress reporting and cancellation, may be NULL. An implementation should start a new task and continuously update the amount of work done if this is not null. The task should be marked as finished, once the implementation is about to return control to the caller. The monitor should regularly be checked for cancellation.
importTask - the import task which contains the task description, never null.
importResult - the import result object to which detected clones and their groups should be added, never null.
Returns:
the status of the import process, never null.
Throws:
org.electrocodeogram.cpc.importexport.api.generic.ImportExportConfigurationOptionException - if the option map contains illegal data or is missing required options. The exception message should be meaningful for the end user.
org.electrocodeogram.cpc.importexport.api.generic.ImportExportFailureException - if the import failed for some reason. The exception message should be meaningful for the end user.
java.lang.InterruptedException - of the import was cancelled by the user.