Examples of ODMGXAWrapper


Examples of org.photovault.dbhelper.ODMGXAWrapper

        }
        return  (hash != null) ? (byte[]) hash.clone() : null;
    }
   
    public void setHash( byte[] hash ) {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.WRITE );
  this.hash = hash;
  txw.commit();       
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     * Get the value of volume.
     * @return value of volume.
     */
    public VolumeBase getVolume() {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.READ );
  txw.commit();
  return volume;
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     * Set the value of volume.
     * @param v  Value to assign to volume.
     */
    public void setVolume(VolumeBase  v) {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.WRITE );
  this.volume = v;
  volumeId = volume.getName();
  txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     * Get the value of imageFile.
     * @return value of imageFile.
     */
    public File getImageFile() {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.READ );
  txw.commit();
  return imageFile;
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     * Set the value of imageFile.
     * @param v  Value to assign to imageFile.
     */
    public void setImageFile(File  v) {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.WRITE );
  this.imageFile = v;
  fname = volume.mapFileToVolumeRelativeName( v );
  txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

   
    /**
     Get the size of the image file <b>as stored in database</b>
     */
    public long getFileSize() {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.READ );
  txw.commit();
  return fileSize;       
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

   
    /**
     Set the file size. NOTE!!! This method should only be used by XmlImporter.
     */
    public void setFileSize( long s ) {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.WRITE );
        this.fileSize = s;
        txw.commit();
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

    /**
     Get the last modification time of the actual image file <b>as stored in
     database</b>. Measured as milliseconds since epoc(Jan 1, 1970 midnight)
     */
    public long getMtime() {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.READ );
  txw.commit();
  return mtime;               
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

     Returns the time when consistency of the instance information was last checked
     (i.e. that the image file really exists and is still unchanged after creating
     the instance.
     */
    public java.util.Date getCheckTime() {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.READ );
  txw.commit();
  return checkTime != null ? (java.util.Date) checkTime.clone() : null;               
    }
View Full Code Here

Examples of org.photovault.dbhelper.ODMGXAWrapper

     @return true if information was consistent, false otherwise
     */
    public boolean doConsistencyCheck() {
  boolean isConsistent = true;
        boolean needsHashCheck = false;
        ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.WRITE );
        File f = this.getImageFile();
        if ( f.exists() ) {
            long size = f.length();
            if ( size != this.fileSize ) {
                isConsistent = false;
                if ( this.fileSize == 0 ) {
                    needsHashCheck = true;
                }
            }
           
            long mtime = f.lastModified();
            if ( mtime != this.mtime ) {
                needsHashCheck = true;
            }
           
            if ( needsHashCheck ) {
                byte[] dbHash = (byte[]) hash.clone();
                calcHash();
                byte[] realHash = (byte[])hash.clone();
                isConsistent = Arrays.equals( dbHash, realHash );
                if ( isConsistent ) {
                    txw.lock( this, Transaction.WRITE );
                    this.mtime = mtime;
                    this.fileSize = size;
                }
            }
        }   
       
        /* Update the database with check result if it was positive */
        
        if ( isConsistent ) {
            txw.lock( this, Transaction.WRITE );
            this.checkTime = new java.util.Date();
        }
        txw.commit();
        return isConsistent;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.