Package org.photovault.dbhelper

Examples of org.photovault.dbhelper.ODMGXAWrapper.lock()


    /**
     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


    /**
     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();
    }
   
    private long mtime;
View Full Code Here

     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;               
    }
   
    private java.util.Date checkTime;
View Full Code Here

     (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

     */
    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;
View Full Code Here

                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;
                }
            }
        }   
View Full Code Here

        }   
       
        /* 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

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

     * Set the value of width.
     * @param v  Value to assign to width.
     */
    public void setWidth(int  v) {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.WRITE );
  this.width = v;
  txw.commit();
    }
    int height;
   
View Full Code Here

     * Get the value of height.
     * @return value of height.
     */
    public int getHeight() {
  ODMGXAWrapper txw = new ODMGXAWrapper();
  txw.lock( this, Transaction.READ );
  txw.commit();
  return height;
    }
   
    /**
 
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.