java.lang.Object
org.jpo.datamodel.Camera
- All Implemented Interfaces:
Serializable
A class which holds information about the digital camera as seen by the file
system and can tell if there are new pictures on the camera.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
build a list of old image from the files on the camera-directory.void
buildOldImage
(ProgressListener progressListener, InterruptSemaphore interrupter) build a list of old image from the files on the camera-directory.void
copies the entry specified by the file in the oldImage HashMap to the newImage HashMap.int
Returns the number of files the camera directory tree holds.This method returns the mount point of the camera in the computer's file system.returns the description of the cameraboolean
Returns the last connection status.boolean
returns whether to monitor for new picturesThis method returns a collection of new pictures found on the camera not previously found thereThe old images held on the cameracounts the number of pictures for which a checksum is held in the HashMapboolean
Returns whether the user wants to use just filenames to detect new imagesboolean
inOldImage
(File f) returns whether the provided file is registered in the old camera image.boolean
inOldImage
(String sha256) returns whether the provided checksum registered in the old camera image.boolean
This method tries to find out if the camera is connected to the computer.void
setCameraMountPoint
(String newDir) This method sets the mount point of the camera in the computer's file systemvoid
setDescription
(String newDescription) Sets a new description for the cameravoid
setLastConnectionStatus
(boolean newStatus) Sets the last connection status.void
setMonitorForNewPictures
(boolean monitorForNewPictures) sets whether to monitor for new picturesvoid
setOldImage
(Map<File, String> oldImage) Remembers the old images on the cameravoid
setUseFilename
(boolean useFilename) Remembers the user wants to use filenames to identify new picturesvoid
copies the entries in the newImage to the oldImage and zaps the new image.void
storePictureNewImage
(File f, String sha256) stores the checksum and file in the newImage HashMaptoString()
toString method that returns the description of the cameravoid
deletes all entries in the new Image.void
deletes all entries in the new Image.
-
Constructor Details
-
Camera
public Camera()
-
-
Method Details
-
setDescription
Sets a new description for the camera- Parameters:
newDescription
- The description of the camera
-
getDescription
returns the description of the camera- Returns:
- the description of the camera
-
getCameraMountPoint
This method returns the mount point of the camera in the computer's file system.- Returns:
- the mount point of the camera
-
setCameraMountPoint
This method sets the mount point of the camera in the computer's file system- Parameters:
newDir
- The new mount point
-
getUseFilename
public boolean getUseFilename()Returns whether the user wants to use just filenames to detect new images- Returns:
- true if only filenames are to be used
-
setUseFilename
public void setUseFilename(boolean useFilename) Remembers the user wants to use filenames to identify new pictures- Parameters:
useFilename
- true if we should use filenames
-
getOldImage
The old images held on the camera- Returns:
- the old images held on the camera
-
setOldImage
Remembers the old images on the camera- Parameters:
oldImage
- the old images on the camera
-
toString
toString method that returns the description of the camera -
storePictureNewImage
stores the checksum and file in the newImage HashMap- Parameters:
f
- The filesha256
- The checksum
-
inOldImage
returns whether the provided checksum registered in the old camera image. it determines whether to check by checksum or file based on the useChecksum and useFilename flags.- Parameters:
sha256
- The checksum- Returns:
- true if the image was known before based on the checksum
-
inOldImage
returns whether the provided file is registered in the old camera image. it determines whether to check by checksum or file based on the useChecksum and useFilename flags.- Parameters:
f
- the file- Returns:
- true if file is found in old camera
-
copyToNewImage
copies the entry specified by the file in the oldImage HashMap to the newImage HashMap.- Parameters:
f
- the file
-
zapNewImage
public void zapNewImage()deletes all entries in the new Image. -
zapOldImage
public void zapOldImage()deletes all entries in the new Image. -
countFiles
public int countFiles()Returns the number of files the camera directory tree holds. This includes directories and non picture files.- Returns:
- the number of files in the camera directory tree
-
buildOldImage
public void buildOldImage()build a list of old image from the files on the camera-directory. This method creates a ProgressGui. -
buildOldImage
build a list of old image from the files on the camera-directory. This method notifies a ProgressListener if one is defined.- Parameters:
progressListener
- The ProgressListenerinterrupter
- The semaphore to interrupt the job
-
getNewPictures
This method returns a collection of new pictures found on the camera not previously found there- Returns:
- a collection of new picture files
-
storeNewImage
public void storeNewImage()copies the entries in the newImage to the oldImage and zaps the new image. -
getOldIndexCountAsString
counts the number of pictures for which a checksum is held in the HashMap- Returns:
- the number of pictures previously known as a string
-
isCameraConnected
public boolean isCameraConnected()This method tries to find out if the camera is connected to the computer. It does this by checking whether the directory of the camera is empty.- Returns:
- true if the camera is connected
-
getMonitorForNewPictures
public boolean getMonitorForNewPictures()returns whether to monitor for new pictures- Returns:
- whether to monitor for new pictures
-
setMonitorForNewPictures
public void setMonitorForNewPictures(boolean monitorForNewPictures) sets whether to monitor for new pictures- Parameters:
monitorForNewPictures
- whether to monitor for new files
-
setLastConnectionStatus
public void setLastConnectionStatus(boolean newStatus) Sets the last connection status.- Parameters:
newStatus
- Send true to indicate that last time we checked the camera was connected, send false to indicate that the last time we checked it was disconnected
-
getLastConnectionStatus
public boolean getLastConnectionStatus()Returns the last connection status.- Returns:
- returns true if the last time we checked the camera was connected, returns false if it was disconnected.
-