ini.trakem2.persistence
Class DBLoader

java.lang.Object
  extended by ini.trakem2.persistence.Loader
      extended by ini.trakem2.persistence.DBLoader

public class DBLoader
extends Loader


Nested Class Summary
 
Nested classes/interfaces inherited from class ini.trakem2.persistence.Loader
Loader.ImageLoadingLock
 
Field Summary
 
Fields inherited from class ini.trakem2.persistence.Loader
AREA_AVERAGING, BICUBIC, BILINEAR, changes, db_lock, ERROR_PATH_NOT_FOUND, GAUSSIAN, GRAY_LUT, hs_unloadable, mawts, MAX_RETRIES, MIN_FREE_BYTES, mipmaps_regen, modes, NEAREST_NEIGHBOR, NOT_FOUND, opener, PREPROCESSED, REGENERATING, RUNTIME, v_loaders
 
Constructor Summary
DBLoader()
          Create and connect to the database.
 
Method Summary
 void addCrossLink(long project_id, long id1, long id2)
           
 boolean addToDatabase(DBObject ob)
           
 void commitLargeUpdate()
          Used in combination with startLargeUpdate()
 void destroy()
          Release all memory and unregister itself.
 void disconnect()
          Disconnect from the database.
 java.awt.geom.Area fetchArea(long area_list_id, long layer_id)
           
 java.util.ArrayList fetchBallPoints(long id)
           
 double[][][] fetchBezierArrays(long id)
          Get the bezier points from the database for the given profile but as a triple array of points, that is, three arrays with 2 arrays (x and y) each.
 ij.ImagePlus fetchImagePlus(Patch p)
           
 java.lang.Object[] fetchLabel(DLabel label)
           
 ij.ImagePlus fetchOriginal(Patch patch)
          Used for the revert command.
 java.util.ArrayList fetchPipePoints(long id)
           
 long getNextId()
          Retrieve next id from a sequence for a new DBObject to be added.
 Project[] getProjects()
          Fetch all existing projects from the database.
 LayerThing getRootLayerThing(Project project, ProjectThing project_thing, TemplateThing layer_set_tt, TemplateThing layer_tt)
          Fetches the root LayerSet, fills it with children (recursively) and uses the profiles, pipes, etc., from the project_thing.
 ProjectThing getRootProjectThing(Project project, TemplateThing root_tt, TemplateThing project_tt, java.util.HashMap<java.lang.Long,Displayable> hs_d)
          Get all the Thing objects, recursively, for the root, and their corresponding encapsulated objects.
 TemplateThing getTemplateRoot(Project project)
          Fetch the root of the TemplateThing tree from the database-stored hierarchy of TemplateThing objects defined in the original XML file .
 boolean hasChanges()
          Always returns false.
protected  Patch importStackAsPatches(Project project, Layer first_layer, double x, double y, ij.ImagePlus imp_stack, boolean as_copy, java.lang.String filepath)
          Returns the last Patch.
 boolean isConnected()
          Find out whether the connection is up.
 boolean isIdenticalProjectSource(Loader loader)
           
 boolean isReady()
          Check if settings are in.
 boolean removeCrossLink(long id1, long id2)
          Remove a link between two objects.
 boolean removeFromDatabase(DBObject ob)
           
 void restoreNodesExpandedState(Project project)
          Affects only those set to true; the rest are left untouched.
 void rollback()
          Used when errors ocurr during a large insertion.
 void startLargeUpdate()
          Used in combination with commitLargeUpdate()
 boolean updateInDatabase(DBObject ob, java.util.Set<java.lang.String> keys)
           
 boolean updateInDatabase(DBObject ob, java.lang.String key)
           
 
Methods inherited from class ini.trakem2.persistence.Loader
addedPatchFrom, addJob, addNewImage, addNewImage, adjustChannels, askForXMLTemplate, cache, cache, cacheAWT, cacheImagePlus, canReadAndWriteTo, checkMipMapFileExists, computeDesirableMinFreeBytes, countObjects, createARGBImage, createFlyThrough, createLazyFlyThrough, createZippedStream, debug, decache, decacheAWT, decacheImagePlus, decacheImagePlus, deserialize, destroyPreloader, doGUILater, doLater, embedAlpha, embedAlpha, enhanceContrast, enhanceContrast, enoughFreeMemory, estimateImageFileSize, export, export, exportImage, exportImage, fetchAWTImage, fetchDataImage, fetchImage, fetchImage, fetchImageMask, fetchImagePlus, fetchImageProcessor, fetchMipMapAWT, flush, flushMipMaps, flushMipMaps, generateLayerMipMaps, generateMipMaps, generateMipMaps, generateMipMaps, getAbsolutePath, getAlphaPath, getCached, getCachedAWT, getCachedClosestAboveImage, getCachedClosestBelowImage, getCachedImagePlus, getClosestMipMapLevel, getCurrentMemory, getDimensions, getDimensions, getFileName, getFlatAWTImage, getFlatAWTImage, getFlatImage, getFlatImage, getFlatImage, getFlatImage, getFlatImage, getFlatImage, getHighestMipMapLevel, getHighestMipMapLevel, getImageFilePath, getImageStorageFolder, getInternalFileName, getJobsPopup, getMipMapFormat, getMipMapLevel, getMipMapsFolder, getMode, getNextTempId, getOrMakeImageLoadingLock, getOrMakeImageLoadingLock, getParentFolder, getPath, getPathsCopy, getPreprocessorScriptPath, getStorageFolder, getUNUId, getUNUIdFolder, handleCacheError, handlePathlessImage, importGrid, importGrid, importImage, importImage, importImage, importImages, importImages, importLabelsAsAreaLists, importLabelsAsAreaLists, importNextImage, importSequenceAsGrid, importSequenceAsGrid, importSequenceAsGrid, importStack, importStack, importStack, importStackAsPatches, insertXMLOptions, isAsynchronous, isCached, isImagePlusCached, isMipMapsRegenerationEnabled, isSignalImage, isSnapPaintable, isUnloadable, makeAllPathsRelativeTo, makeFlatImage, makeFlatImage, makeFlatImage, makeGrayLut, makePatchesDir, makePrescaledTiles, makePrescaledTiles, makeProjectName, makeRelativePath, maskBorders, maskBorders, maskBordersLayerWise, maxDim, measureSize, openImage, openImagePlus, openStack, preload, preload, preProcess, printCache, printCaches, printCacheStatus, printMemState, queueForMipmapRemoval, quitJob, recoverOOME, recreateBuckets, recreateBuckets, regenerateMipMaps, regenerateMipMaps, releaseAll, releaseAllCaches, releaseMemory, releaseMemory2, releaseToFit, releaseToFit, removeAlphaMask, removeFromUnloadable, removeImageLoadingLock, removeJob, removeMipMaps, restorePaths, save, saveAs, saveAs, saveAs, saveTask, scaleImage, scaleImage, serialize, setChanged, setDesirableMinFreeBytes, setHeapFraction, setImageFile, setMinAndMax, setMipMapFormat, setMipMapsRegeneration, setPreprocessorScriptPath, setPreprocessorScriptPathSilently, setupMenuItems, setupPreloader, setupPreloaderThreads, storeAlphaMask, tagForMipmapRemoval, unzipTiff, updateMipMapsFormat, usesMipMapsFolder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBLoader

public DBLoader()
Create and connect to the database.

Method Detail

isReady

public boolean isReady()
Check if settings are in.


destroy

public void destroy()
Release all memory and unregister itself.

Overrides:
destroy in class Loader

startLargeUpdate

public void startLargeUpdate()
Used in combination with commitLargeUpdate()

Overrides:
startLargeUpdate in class Loader

commitLargeUpdate

public void commitLargeUpdate()
Used in combination with startLargeUpdate()

Overrides:
commitLargeUpdate in class Loader

rollback

public void rollback()
Used when errors ocurr during a large insertion.

Overrides:
rollback in class Loader

isConnected

public boolean isConnected()
Find out whether the connection is up.


disconnect

public void disconnect()
Disconnect from the database.


getNextId

public long getNextId()
Retrieve next id from a sequence for a new DBObject to be added.

Specified by:
getNextId in class Loader

getTemplateRoot

public TemplateThing getTemplateRoot(Project project)
Fetch the root of the TemplateThing tree from the database-stored hierarchy of TemplateThing objects defined in the original XML file .


getProjects

public Project[] getProjects()
Fetch all existing projects from the database.


getRootProjectThing

public ProjectThing getRootProjectThing(Project project,
                                        TemplateThing root_tt,
                                        TemplateThing project_tt,
                                        java.util.HashMap<java.lang.Long,Displayable> hs_d)
Get all the Thing objects, recursively, for the root, and their corresponding encapsulated objects. Also, fills in the given ArrayList with all loaded Displayable objects.


getRootLayerThing

public LayerThing getRootLayerThing(Project project,
                                    ProjectThing project_thing,
                                    TemplateThing layer_set_tt,
                                    TemplateThing layer_tt)
Fetches the root LayerSet, fills it with children (recursively) and uses the profiles, pipes, etc., from the project_thing. Will reconnect the links and open Displays for the layers that have one.


fetchBezierArrays

public double[][][] fetchBezierArrays(long id)
Get the bezier points from the database for the given profile but as a triple array of points, that is, three arrays with 2 arrays (x and y) each.

Specified by:
fetchBezierArrays in class Loader

fetchArea

public java.awt.geom.Area fetchArea(long area_list_id,
                                    long layer_id)
Specified by:
fetchArea in class Loader

fetchPipePoints

public java.util.ArrayList fetchPipePoints(long id)
Specified by:
fetchPipePoints in class Loader

fetchBallPoints

public java.util.ArrayList fetchBallPoints(long id)
Specified by:
fetchBallPoints in class Loader

addToDatabase

public boolean addToDatabase(DBObject ob)
Specified by:
addToDatabase in class Loader

updateInDatabase

public boolean updateInDatabase(DBObject ob,
                                java.lang.String key)
Specified by:
updateInDatabase in class Loader

updateInDatabase

public boolean updateInDatabase(DBObject ob,
                                java.util.Set<java.lang.String> keys)
Specified by:
updateInDatabase in class Loader

removeFromDatabase

public boolean removeFromDatabase(DBObject ob)
Specified by:
removeFromDatabase in class Loader

addCrossLink

public void addCrossLink(long project_id,
                         long id1,
                         long id2)
Overrides:
addCrossLink in class Loader

removeCrossLink

public boolean removeCrossLink(long id1,
                               long id2)
Remove a link between two objects.

Overrides:
removeCrossLink in class Loader

fetchImagePlus

public ij.ImagePlus fetchImagePlus(Patch p)
Specified by:
fetchImagePlus in class Loader

fetchLabel

public java.lang.Object[] fetchLabel(DLabel label)
Specified by:
fetchLabel in class Loader

fetchOriginal

public ij.ImagePlus fetchOriginal(Patch patch)
Description copied from class: Loader
Used for the revert command.

Specified by:
fetchOriginal in class Loader

hasChanges

public boolean hasChanges()
Always returns false.

Overrides:
hasChanges in class Loader

isIdenticalProjectSource

public boolean isIdenticalProjectSource(Loader loader)

restoreNodesExpandedState

public void restoreNodesExpandedState(Project project)
Affects only those set to true; the rest are left untouched.


importStackAsPatches

protected Patch importStackAsPatches(Project project,
                                     Layer first_layer,
                                     double x,
                                     double y,
                                     ij.ImagePlus imp_stack,
                                     boolean as_copy,
                                     java.lang.String filepath)
Returns the last Patch.

Specified by:
importStackAsPatches in class Loader