Examples of VolumeBase


Examples of org.photovault.imginfo.VolumeBase

      if ( !rs.next() ) {
    fail( "Matching DB record not found" );
      }
            String volume = rs.getString( "VOLUME_ID" );
            String fname = rs.getString( "FNAME" );
            VolumeBase vol = VolumeBase.getVolume( volume );
            File f = null;
            try {
                f = vol.mapFileName(fname);
            } catch (FileNotFoundException ex) {
                fail( "Cannot map " + fname + " in volume " + vol.getName() );
            }
            assertTrue( f.exists() );
  } catch ( SQLException e ) {
      fail( "DB error:; " + e.getMessage() );
  } finally {
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

            txw.lock( p, Transaction.WRITE );
            p.setName( name );
            p.setDescription( description );
           
            // Copy the file to the default volume
            VolumeBase defvol = VolumeBase.getDefaultVolume();
            File f = defvol.getFilingFname( profileFile );
            log.debug( "Copying to default volume: " + f.getAbsolutePath() );
            try {
                FileUtils.copyFile( profileFile, f );
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            byte[] hash = FileUtils.calcHash( f );
            p.setHash( hash );
            txw.flush();
           
            ColorProfileInstance i = new ColorProfileInstance();
            i.fname = defvol.mapFileToVolumeRelativeName( f );
            i.volumeId = defvol.getName();
            i.profileId = p.id;
           
           
            p.addInstance( i );
            txw.lock( i, Transaction.WRITE );
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

     Add a new volume to this database.
     @param volume The new volume
     @throws @see PhotovaultException if another volume with the same name is already present
     */
    public void addVolume( VolumeBase volume ) throws PhotovaultException {
        VolumeBase v = getVolume( volume.getName() );
        if ( v != null ) {
            throw new PhotovaultException( "Volume with name " + volume.getName() +
                    " already exists" );
        }
        volumes.add( volume );
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

    public List getVolumes( ) {
        return  volumes;
    }

    public VolumeBase getDefaultVolume() {
        VolumeBase vol = null;
        if ( volumes.size() > 0 ) {
            vol = (VolumeBase) volumes.get(0);
        }
        return vol;
    }
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

    /**
     * Returns a volume with the given name or <code>null</code> if it does not exist
     *
     */
    public VolumeBase getVolume( String volumeName ) {
        VolumeBase vol = null;
       
        /* TODO: Should we use HashMap for volumes instead of iterating a list?
         * This method is urgenty needed for a WAR for bug 44 so I am doing it
         * in the least disruptive way - and since the number of volumes per database
         * is currently low this may be enough.
         */
        Iterator iter = volumes.iterator();
        while ( iter.hasNext() ) {
            VolumeBase candidate = (VolumeBase) iter.next();
            if ( candidate.getName().equals( volumeName ) ) {
                vol = candidate;
            }
        }
        return vol;
    }
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

     belong to any volume of this database
     @throws IOException if there is an error constructing canonical form of the file
     */
    public VolumeBase getVolumeOfFile( File f ) throws IOException {
        Iterator iter = volumes.iterator();
        VolumeBase v = null;
        while ( iter.hasNext() ) {
            VolumeBase candidate = (VolumeBase) iter.next();
            if ( candidate.isFileInVolume( f ) ) {
                v = candidate;
                break;
            }
        }
        return v;
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

        }       
        outputWriter.write( ">\n" );
        Iterator iter = volumes.iterator();
        outputWriter.write( s + "  " + "<volumes>\n" );
        while( iter.hasNext() ) {
            VolumeBase v = (VolumeBase) iter.next();
            v.writeXml( outputWriter, indent+4 );           
        }
        outputWriter.write( s + "  " + "</volumes>\n" );
        outputWriter.write( s + "</database>\n" );
    }
View Full Code Here

Examples of org.photovault.imginfo.VolumeBase

        PVDatabase db = settings.getCurrentDatabase();
        List allVolumes = db.getVolumes();
        volumes = new Vector();
        Iterator iter = allVolumes.iterator();
        while ( iter.hasNext() ) {
            VolumeBase vol = (VolumeBase) iter.next();
            if ( vol instanceof ExternalVolume ) {
                volumes.add( vol );
            }
        }
       
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.