Package org.intermine.dataloader
Class IntegrationWriterDataTrackingImpl
- java.lang.Object
-
- org.intermine.dataloader.IntegrationWriterAbstractImpl
-
- org.intermine.dataloader.IntegrationWriterDataTrackingImpl
-
- All Implemented Interfaces:
IntegrationWriter
,ObjectStore
,ObjectStoreWriter
public class IntegrationWriterDataTrackingImpl extends IntegrationWriterAbstractImpl
Priority-based implementation of IntegrationWriter. Allows field values to be chosen according to the relative priorities of the data sources that originated them.- Author:
- Matthew Wakeling, Andrew Varley
-
-
Field Summary
Fields Modifier and Type Field Description protected DataTracker
dataTracker
protected IntPresentSet
duplicateObjects
This is a list of the objects in the destination database that we have written to as a non-skeleton more than once.protected boolean
isDuplicates
protected PriorityConfig
priorityConfig
protected IntPresentSet
pureObjects
This is a list of the objects that did not merge with anything from a previous data sourceprotected IntPresentSet
skeletons
protected java.util.Set<java.lang.Class<?>>
trackerMissingClasses
protected IntPresentSet
writtenObjects
This is a list of the objects in the destination database that we have written to as a non-skeleton.-
Fields inherited from class org.intermine.dataloader.IntegrationWriterAbstractImpl
beof, dbIdsStored, eof, FROM_DB, idMap, idMapOps, ignoreDuplicates, lastSource, osw, seenBrokenOneToMany, SKELETON, SOURCE, timeSpentRecursing
-
Fields inherited from interface org.intermine.objectstore.ObjectStore
SEQUENCE_IGNORE
-
-
Constructor Summary
Constructors Constructor Description IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker)
Constructs a new instance of IntegrationWriterDataTrackingImpl.IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker, java.util.Set<java.lang.Class<?>> trackerMissingClasses)
Constructs a new instance of IntegrationWriterDataTrackingImpl.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the connection associated with this ObjectStoreWriterboolean
doTrackerFor(java.lang.Class<?> c)
Returns true if the given class is NOT a subclass of any of the classes in trackerMissingClasses.DataTracker
getDataTracker()
Returns the data tracker being used.static IntegrationWriterDataTrackingImpl
getInstance(java.lang.String osAlias, java.util.Properties props)
Creates a new instance of this class, given the properties defining it.protected static IntegrationWriterDataTrackingImpl
getInstance(java.lang.String osAlias, java.util.Properties props, java.lang.Class<? extends IntegrationWriterDataTrackingImpl> iwClass, java.lang.Class<? extends DataTracker> trackerClass)
Creates a new IntegrationWriter instance of the specified class and with a specified DataTracker class plus properties.Source
getMainSource(java.lang.String name, java.lang.String type)
Converts a string describing the data source into a Source object suitable for passing to the store method as the main source.Source
getSkeletonSource(java.lang.String name, java.lang.String type)
Converts a string describing the data source into a Source object suitable for passing to the store method as the skeleton source.void
reset()
Resets the IntegrationWriter, clearing the id map and the hintsprotected InterMineObject
store(FastPathObject nimo, Source source, Source skelSource, int type)
Stores the given object in the objectstore.-
Methods inherited from class org.intermine.dataloader.IntegrationWriterAbstractImpl
abortTransaction, addAllToBag, addToBag, addToBagFromQuery, addToCollection, assignMapping, batchCommitTransaction, beginTransaction, cacheObjectById, commitTransaction, copyField, count, createClob, createObjectStoreBag, delete, delete, estimate, execute, execute, execute, executeSingleton, executeSingleton, flushObjectById, getBaseEof, getComponentsForQuery, getEof, getEquivalentObjects, getMaxLimit, getMaxOffset, getMaxTime, getModel, getNewWriter, getObjectByExample, getObjectById, getObjectById, getObjectsByExample, getObjectsByIds, getObjectStore, getObjectStoreWriter, getSequence, getSerial, invalidateObjectById, isInTransaction, isMultiConnection, pilferObjectById, prefetchObjectById, removeAllFromBag, removeFromBag, replaceClob, setEof, setIgnoreDuplicates, store, store
-
-
-
-
Field Detail
-
dataTracker
protected DataTracker dataTracker
-
trackerMissingClasses
protected java.util.Set<java.lang.Class<?>> trackerMissingClasses
-
skeletons
protected IntPresentSet skeletons
-
pureObjects
protected IntPresentSet pureObjects
This is a list of the objects that did not merge with anything from a previous data source
-
writtenObjects
protected IntPresentSet writtenObjects
This is a list of the objects in the destination database that we have written to as a non-skeleton. This is so that we can notice if we write to a given object twice, given ignoreDuplicates, so we can tell the user if ignoreDuplicates is necessary.
-
duplicateObjects
protected IntPresentSet duplicateObjects
This is a list of the objects in the destination database that we have written to as a non-skeleton more than once.
-
isDuplicates
protected boolean isDuplicates
-
priorityConfig
protected PriorityConfig priorityConfig
-
-
Constructor Detail
-
IntegrationWriterDataTrackingImpl
public IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker)
Constructs a new instance of IntegrationWriterDataTrackingImpl.- Parameters:
osw
- an instance of an ObjectStoreWriter, which we can use to access the databasedataTracker
- an instance of DataTracker, which we can use to store data tracking information
-
IntegrationWriterDataTrackingImpl
public IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker, java.util.Set<java.lang.Class<?>> trackerMissingClasses)
Constructs a new instance of IntegrationWriterDataTrackingImpl.- Parameters:
osw
- an instance of an ObjectStoreWriter, which we can use to access the databasedataTracker
- an instance of DataTracker, which we can use to store data tracking informationtrackerMissingClasses
- a Set of classes for which DataTracker data is useless
-
-
Method Detail
-
getInstance
public static IntegrationWriterDataTrackingImpl getInstance(java.lang.String osAlias, java.util.Properties props) throws ObjectStoreException
Creates a new instance of this class, given the properties defining it.- Parameters:
osAlias
- the alias of this objectstoreprops
- the Properties- Returns:
- an instance of this class
- Throws:
ObjectStoreException
- sometimes
-
getInstance
protected static IntegrationWriterDataTrackingImpl getInstance(java.lang.String osAlias, java.util.Properties props, java.lang.Class<? extends IntegrationWriterDataTrackingImpl> iwClass, java.lang.Class<? extends DataTracker> trackerClass) throws ObjectStoreException
Creates a new IntegrationWriter instance of the specified class and with a specified DataTracker class plus properties.- Parameters:
osAlias
- the alias of this objectstoreprops
- the PropertiesiwClass
- Class of IntegrationWriter to create - IntegrationWriterDataTrackingImpl or a subclass.trackerClass
- Class of DataTracker to use with IntegrationWriter- Returns:
- an instance of this class
- Throws:
ObjectStoreException
- sometimes
-
reset
public void reset()
Resets the IntegrationWriter, clearing the id map and the hints- Overrides:
reset
in classIntegrationWriterAbstractImpl
-
getMainSource
public Source getMainSource(java.lang.String name, java.lang.String type)
Converts a string describing the data source into a Source object suitable for passing to the store method as the main source.- Parameters:
name
- the name of the data sourcetype
- the source type- Returns:
- a Source
-
getSkeletonSource
public Source getSkeletonSource(java.lang.String name, java.lang.String type)
Converts a string describing the data source into a Source object suitable for passing to the store method as the skeleton source.- Parameters:
name
- the name of the data sourcetype
- the source type- Returns:
- a skeleton Source
-
getDataTracker
public DataTracker getDataTracker()
Returns the data tracker being used.- Returns:
- dataTracker
-
doTrackerFor
public boolean doTrackerFor(java.lang.Class<?> c)
Returns true if the given class is NOT a subclass of any of the classes in trackerMissingClasses.- Parameters:
c
- a Class- Returns:
- a boolean
-
store
protected InterMineObject store(FastPathObject nimo, Source source, Source skelSource, int type) throws ObjectStoreException
Stores the given object in the objectstore. This method recurses into the object's fields according to the type variable.- Specified by:
store
in classIntegrationWriterAbstractImpl
- Parameters:
nimo
- the object to storesource
- the data Source to which to attribute the dataskelSource
- the data Source to which to attribute skeleton datatype
- the type of action required, from SOURCE, SKELETON, or FROM_DB- Returns:
- the InterMineObject that was written to the database
- Throws:
ObjectStoreException
- if an error occurs in the underlying objectstore
-
close
public void close() throws ObjectStoreException
Closes the connection associated with this ObjectStoreWriter- Specified by:
close
in interfaceObjectStoreWriter
- Overrides:
close
in classIntegrationWriterAbstractImpl
- Throws:
ObjectStoreException
- if something goes wrong
-
-