Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
132aad5e
Commit
132aad5e
authored
14 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
LMS-1569 Fixed path computation; handle rollbacks.
SVN: 16547
parent
13178079
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/fvec/FeatureVectorStorageProcessor.java
+43
-14
43 additions, 14 deletions
...ss/etl/dataaccess/fvec/FeatureVectorStorageProcessor.java
with
43 additions
and
14 deletions
screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/fvec/FeatureVectorStorageProcessor.java
+
43
−
14
View file @
132aad5e
...
@@ -40,6 +40,8 @@ import ch.systemsx.cisd.utils.CsvFileReaderHelper;
...
@@ -40,6 +40,8 @@ import ch.systemsx.cisd.utils.CsvFileReaderHelper;
import
ch.systemsx.cisd.utils.CsvFileReaderHelper.ICsvFileReaderConfiguration
;
import
ch.systemsx.cisd.utils.CsvFileReaderHelper.ICsvFileReaderConfiguration
;
/**
/**
* Extract features from the file and store them in the database.
*
* @author Chandrasekhar Ramakrishnan
* @author Chandrasekhar Ramakrishnan
*/
*/
public
class
FeatureVectorStorageProcessor
extends
AbstractDelegatingStorageProcessor
public
class
FeatureVectorStorageProcessor
extends
AbstractDelegatingStorageProcessor
...
@@ -140,6 +142,9 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
...
@@ -140,6 +142,9 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
private
final
DataSource
dataSource
;
private
final
DataSource
dataSource
;
// Execution state of this object -- set to null after an execution is finished.
private
IImagingUploadDAO
dataAccessObject
=
null
;
public
FeatureVectorStorageProcessor
(
Properties
properties
)
public
FeatureVectorStorageProcessor
(
Properties
properties
)
{
{
super
(
properties
);
super
(
properties
);
...
@@ -160,18 +165,16 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
...
@@ -160,18 +165,16 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
incomingDataSetDirectory
,
rootDir
);
incomingDataSetDirectory
,
rootDir
);
// Import into the data base
// Import into the data base
File
parent
=
new
File
(
answer
,
ORIGINAL_DIR
);
File
parent
=
new
File
(
answer
,
ORIGINAL_DIR
);
File
dataSets
=
new
File
(
parent
,
incomingDataSetDirectory
.
getName
());
File
dataSet
=
new
File
(
parent
,
incomingDataSetDirectory
.
getName
());
for
(
File
dataSet
:
dataSets
.
listFiles
())
{
try
{
loadDataSetIntoDatabase
(
dataSet
,
dataSetInformation
);
}
catch
(
IOException
ex
)
{
throw
new
IOExceptionUnchecked
(
ex
);
}
try
{
loadDataSetIntoDatabase
(
dataSet
,
dataSetInformation
);
}
catch
(
IOException
ex
)
{
throw
new
IOExceptionUnchecked
(
ex
);
}
}
return
answer
;
return
answer
;
}
}
...
@@ -183,13 +186,11 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
...
@@ -183,13 +186,11 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
new
CSVToCanonicalFeatureVector
(
fileLines
,
convertorConfig
);
new
CSVToCanonicalFeatureVector
(
fileLines
,
convertorConfig
);
ArrayList
<
CanonicalFeatureVector
>
fvecs
=
convertor
.
convert
();
ArrayList
<
CanonicalFeatureVector
>
fvecs
=
convertor
.
convert
();
IImagingUploadDAO
dao
=
createDAO
();
dataAccessObject
=
createDAO
();
FeatureVectorUploader
uploader
=
FeatureVectorUploader
uploader
=
new
FeatureVectorUploader
(
da
o
,
ScreeningContainerDatasetInfo
new
FeatureVectorUploader
(
da
taAccessObject
,
ScreeningContainerDatasetInfo
.
createScreeningDatasetInfo
(
dataSetInformation
));
.
createScreeningDatasetInfo
(
dataSetInformation
));
uploader
.
uploadFeatureVectors
(
fvecs
);
uploader
.
uploadFeatureVectors
(
fvecs
);
dao
.
commit
();
dao
.
close
();
}
}
private
IImagingUploadDAO
createDAO
()
private
IImagingUploadDAO
createDAO
()
...
@@ -197,11 +198,39 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
...
@@ -197,11 +198,39 @@ public class FeatureVectorStorageProcessor extends AbstractDelegatingStorageProc
return
QueryTool
.
getQuery
(
dataSource
,
IImagingUploadDAO
.
class
);
return
QueryTool
.
getQuery
(
dataSource
,
IImagingUploadDAO
.
class
);
}
}
@Override
public
void
commit
()
{
super
.
commit
();
if
(
null
==
dataAccessObject
)
{
return
;
}
dataAccessObject
.
commit
();
closeDataAccessObject
();
}
/**
* Close the DAO and set it to null to make clear that it is not initialized.
*/
private
void
closeDataAccessObject
()
{
dataAccessObject
.
close
();
dataAccessObject
=
null
;
}
@Override
@Override
public
UnstoreDataAction
rollback
(
final
File
incomingDataSetDirectory
,
public
UnstoreDataAction
rollback
(
final
File
incomingDataSetDirectory
,
final
File
storedDataDirectory
,
Throwable
exception
)
final
File
storedDataDirectory
,
Throwable
exception
)
{
{
// Delete the data from the database
// Delete the data from the database
if
(
null
!=
dataAccessObject
)
{
dataAccessObject
.
rollback
();
closeDataAccessObject
();
}
return
super
.
rollback
(
incomingDataSetDirectory
,
storedDataDirectory
,
exception
);
return
super
.
rollback
(
incomingDataSetDirectory
,
storedDataDirectory
,
exception
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment