Module org.jpo

Class Camera

java.lang.Object
org.jpo.datamodel.Camera
All Implemented Interfaces:
Serializable

public class Camera extends Object implements 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 Details

    • Camera

      public Camera()
  • Method Details

    • setDescription

      public void setDescription(String newDescription)
      Sets a new description for the camera
      Parameters:
      newDescription - The description of the camera
    • getDescription

      public String getDescription()
      returns the description of the camera
      Returns:
      the description of the camera
    • getCameraMountPoint

      public String getCameraMountPoint()
      This method returns the mount point of the camera in the computer's file system.
      Returns:
      the mount point of the camera
    • setCameraMountPoint

      public void setCameraMountPoint(String newDir)
      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

      public Map<File,String> getOldImage()
      The old images held on the camera
      Returns:
      the old images held on the camera
    • setOldImage

      public void setOldImage(Map<File,String> oldImage)
      Remembers the old images on the camera
      Parameters:
      oldImage - the old images on the camera
    • toString

      public String toString()
      toString method that returns the description of the camera
      Overrides:
      toString in class Object
      Returns:
      the description of the camera
    • storePictureNewImage

      public void storePictureNewImage(File f, String sha256)
      stores the checksum and file in the newImage HashMap
      Parameters:
      f - The file
      sha256 - The checksum
    • inOldImage

      public boolean inOldImage(String sha256)
      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

      public boolean inOldImage(File f)
      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

      public void copyToNewImage(File f)
      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

      public void buildOldImage(ProgressListener progressListener, InterruptSemaphore interrupter)
      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 ProgressListener
      interrupter - The semaphore to interrupt the job
    • getNewPictures

      public Collection<File> 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

      public String 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.