|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.core.plugin.AbstractPlugin
net.sf.basedb.plugins.AbstractFlatFileImporter
net.sf.basedb.plugins.RawDataFlatFileImporter
public class RawDataFlatFileImporter
A plugin that imports rawdata from a flatfile.
| Nested Class Summary | |
|---|---|
(package private) class |
RawDataFlatFileImporter.FileIterator
|
| Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin |
|---|
Plugin.MainType |
| Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
|---|
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc |
| Constructor Summary | |
|---|---|
RawDataFlatFileImporter()
|
|
| Method Summary | |
|---|---|
private void |
addExperimentParameters(DbControl dc,
Experiment currentExp,
List<PluginParameter<?>> parameters)
|
private void |
addRawBioAssayParameters(DbControl dc,
RawBioAssay currentRaw,
List<PluginParameter<?>> parameters)
|
protected void |
begin(FlatFileParser ffp)
Prepare for importing the next file. |
protected void |
beginData()
Initialise column Mapper:s. |
void |
configure(GuiContext context,
Request request,
Response response)
Store configuration settings for Request.COMMAND_CONFIGURE_PLUGIN,
COMMAND_CONFIGURE_PARSER and Request.COMMAND_CONFIGURE_JOB. |
protected boolean |
continueWithNextFileAfterError(Throwable t)
We will continue if: The file is not of the correct format, eg. t = UnsupportedFileFormatException. |
protected void |
end(boolean success)
Close and commit/rollback the RawDataBatcher and DbControl. |
String |
finish(Throwable t)
Commit/rollback transaction if needed. |
private List<PluginParameter<String>> |
getAllColumnMappings(RawDataType rdt)
Loads the column mappings if they hasn't been loaded already. |
String |
getAnnotationMessage()
Get a message that explains what the plug-in does with the annotations it has. |
ItemQuery<AnnotationType> |
getAnnotationTypes()
Return a query that finds annotation types for raw bioassays. |
private RequestInformation |
getConfigureJobParameters(GuiContext context)
|
private RequestInformation |
getConfigureParserParameters(RawDataType rdt)
|
private RequestInformation |
getConfigureRawDataTypeParameters()
|
protected Iterator<File> |
getFileIterator()
Get an iterator that returns the files to be imported. |
Set<GuiContext> |
getGuiContexts()
Get a set containing all items that the plugin handles. |
Collection<Permissions> |
getPermissions()
Request write access to RawBioAssay:s and read access to ArrayDesign:s, File:s, Reporter:s, Platform:s and DataFileType:s |
private ItemQuery<RawBioAssay> |
getRawBioAssayQuery(Experiment exp)
Get a query that returns all raw bioassays which it may be possible to import raw data to for the given experiment. |
RequestInformation |
getRequestInformation(GuiContext context,
String command)
The Request.COMMAND_CONFIGURE_PLUGIN command will ask for
what type of rawdata to import. |
protected String |
getSuccessMessage(int skippedLines)
Return x spots inserted. |
protected long |
getTotalFileSize()
Get the total file size of all files that are going to be imported. |
protected void |
handleData(FlatFileParser.Data data)
Called by the parser for every line in the file that is a data line. |
protected void |
handleHeader(FlatFileParser.Line line)
Called by the parser for every line in the file that is a header line. |
String |
isInContext(GuiContext context,
Object item)
Returns null if the item is a RawBioAssay of the correct
RawDataType and doesn't already have spots. |
boolean |
requiresConfiguration()
Return TRUE, since the implementation requires it for finding the regular expressions used by the FlatFileParser. |
protected void |
start()
Prepare for the import. |
boolean |
supportsConfigurations()
Returns TRUE, since that is how the plugins used to work before this method was introduced. |
| Methods inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter |
|---|
addErrorHandler, checkColumnMapping, checkColumnMapping, doImport, getCharset, getCharset, getDecimalSeparator, getErrorHandler, getErrorOption, getInitializedFlatFileParser, getMainType, getMapper, getMapper, getNumberFormat, getNumBytes, getProgress, getSignalHandler, handleSection, isImportable, isImportable, log, log, log, log, run, setUpErrorHandling, wrapInputStream |
| Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
|---|
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, init, log, log, storeValue, storeValue, storeValues, validateRequestParameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sf.basedb.core.plugin.Plugin |
|---|
done, getMainType, init, run |
| Field Detail |
|---|
private static final Set<GuiContext> guiContexts
private static final Set<Permissions> permissions
private static final StringParameterType optionalColumnMapping
private static final StringParameterType requiredColumnMapping
private static final PluginParameter<String> positionColumnMapping
private static final PluginParameter<String> blockColumnMapping
private static final PluginParameter<String> columnColumnMapping
private static final PluginParameter<String> rowColumnMapping
private static final PluginParameter<String> metaGridXColumnMapping
private static final PluginParameter<String> metaGridYColumnMapping
private static final PluginParameter<String> xColumnMapping
private static final PluginParameter<String> yColumnMapping
private static final PluginParameter<String> reporterIdColumnMapping
private static final PluginParameter<String> featureIdColumnMapping
protected static final PluginParameter<String> missingReporterErrorParameter
protected static final PluginParameter<String> featureMismatchErrorParameter
protected static final PluginParameter<String> duplicateFeatureErrorParameter
public static final String COMMAND_CONFIGURE_PARSER
private List<PluginParameter<String>> allColumnMappings
private RequestInformation configureParser
private RequestInformation configureJob
private RequestInformation configureRawDataType
private StringParameterType rawDataTypeType
private PluginParameter<String> rawDataTypeParameter
private DbControl dc
private FlatFileParser ffp
private NumberFormat numberFormat
private boolean nullIfException
private boolean continueAfterError
private boolean transactionPerFile
private RawDataFlatFileImporter.FileIterator fileIterator
private long totalFileSize
private RawBioAssay rawBioAssay
private RawDataBatcher batcher
private FileSetMember rawDataMember
private Mapper featureIdMapper
private Mapper reporterMapper
private Mapper positionMapper
private Mapper blockMapper
private Mapper columnMapper
private Mapper rowMapper
private Mapper metaGridXMapper
private Mapper metaGridYMapper
private Mapper xMapper
private Mapper yMapper
private Map<RawDataProperty,Mapper> extendedMappers
| Constructor Detail |
|---|
public RawDataFlatFileImporter()
| Method Detail |
|---|
public boolean supportsConfigurations()
AbstractPlugin
supportsConfigurations in interface PluginsupportsConfigurations in class AbstractPluginpublic boolean requiresConfiguration()
AbstractFlatFileImporterFlatFileParser. If this
method is overridden and returns FALSE, the subclass must also override
the AbstractFlatFileImporter.getInitializedFlatFileParser() method and provide a
parser with all regular expressions and other options set.
requiresConfiguration in interface PluginrequiresConfiguration in class AbstractFlatFileImporterpublic Collection<Permissions> getPermissions()
getPermissions in interface PlugingetPermissions in class AbstractPluginpublic Set<GuiContext> getGuiContexts()
InteractivePluginItem.REPORTER.
This information is used by client applications to put the plugin
in the proper place in the user interface.
getGuiContexts in interface InteractivePluginSet containing Item:s, or null
if the plugin is not concerned about items
public String isInContext(GuiContext context,
Object item)
RawBioAssay of the correct
RawDataType and doesn't already have spots.
isInContext in interface InteractivePlugincontext - The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()item - The currently active item, it's type should match the
GuiContext.getItem() type, or null if the context is a list
context
Null if the plugin can use that item, or
a warning-level message explaining why the plugin can't be used
PermissionDeniedException - If the raw bioasssay already has raw data
or if the logged in user doesn't have write permission
public RequestInformation getRequestInformation(GuiContext context,
String command)
throws BaseException
Request.COMMAND_CONFIGURE_PLUGIN command will ask for
what type of rawdata to import.
The COMMAND_CONFIGURE_PARSER command will ask for
parser regular expressions and column mappings.
The Request.COMMAND_CONFIGURE_JOB command will ask for
a file and the RawBioAssay where the data should be added.
getRequestInformation in interface InteractivePlugincommand - context - The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
RequestInformation for the command
BaseException - if there is an error
public void configure(GuiContext context,
Request request,
Response response)
Request.COMMAND_CONFIGURE_PLUGIN,
COMMAND_CONFIGURE_PARSER and Request.COMMAND_CONFIGURE_JOB.
configure in interface InteractivePlugincontext - The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()request - Request object with the command and parametersresponse - Response object in for the plugin to response
throughpublic ItemQuery<AnnotationType> getAnnotationTypes()
getAnnotationTypes in interface AnnotationSetterPluginpublic String getAnnotationMessage()
AnnotationSetterPlugin
getAnnotationMessage in interface AnnotationSetterPluginprotected void start()
start in class AbstractFlatFileImporterprotected boolean continueWithNextFileAfterError(Throwable t)
UnsupportedFileFormatException.
continueWithNextFileAfterError in class AbstractFlatFileImportert - The error that happened
protected Iterator<File> getFileIterator()
AbstractFlatFileImporterAbstractFlatFileImporter.getTotalFileSize() method to return sum of all
file sizes. Eg. File.getSize().
getFileIterator in class AbstractFlatFileImporterprotected long getTotalFileSize()
AbstractFlatFileImporter
getTotalFileSize in class AbstractFlatFileImporter
protected void begin(FlatFileParser ffp)
throws BaseException
DbControl (if needed) and a RawDataBatcher.
Load the RawBioAssay that has been specified.
begin in class AbstractFlatFileImporterBaseExceptionAbstractFlatFileImporter.end(boolean)protected void beginData()
Mapper:s.
beginData in class AbstractFlatFileImporter
protected void end(boolean success)
throws BaseException
end in class AbstractFlatFileImportersuccess - TRUE if the file was parsed successfully, FALSE otherwise
BaseExceptionAbstractFlatFileImporter.begin(FlatFileParser)public String finish(Throwable t)
finish in class AbstractFlatFileImportert - Null if no error has happened
protected void handleData(FlatFileParser.Data data)
throws BaseException
AbstractFlatFileImporter
handleData in class AbstractFlatFileImporterBaseException
protected void handleHeader(FlatFileParser.Line line)
throws BaseException
AbstractFlatFileImporter
handleHeader in class AbstractFlatFileImporterBaseExceptionprotected String getSuccessMessage(int skippedLines)
x spots inserted.
getSuccessMessage in class AbstractFlatFileImporterskippedLines - The number of data lines that were skipped due to errorsprivate List<PluginParameter<String>> getAllColumnMappings(RawDataType rdt)
rdt - the RawDataType that defines the extra
properties.private RequestInformation getConfigureJobParameters(GuiContext context)
private void addRawBioAssayParameters(DbControl dc,
RawBioAssay currentRaw,
List<PluginParameter<?>> parameters)
private void addExperimentParameters(DbControl dc,
Experiment currentExp,
List<PluginParameter<?>> parameters)
private RequestInformation getConfigureRawDataTypeParameters()
private RequestInformation getConfigureParserParameters(RawDataType rdt)
private ItemQuery<RawBioAssay> getRawBioAssayQuery(Experiment exp)
exp - The experiment
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||