Examples of PVDatabase


Examples of org.photovault.common.PVDatabase

        String user = ld.getUsername();
  String passwd = ld.getPassword();
  String dbName = ld.getDb();
  log.debug( "Using configuration " + dbName );
  settings.setConfiguration( dbName );
        PVDatabase db = settings.getDatabase( dbName );
        String sqldbName = db.getDbName();
        log.debug( "Mysql DB name: " + sqldbName );
        if ( sqldbName == null ) {
            JOptionPane.showMessageDialog( ld, "Could not find dbname for configuration " + db, "Configuration error", JOptionPane.ERROR_MESSAGE );
            throw new PhotovaultException( "Could not find dbname for configuration " + db );
        }
       
        ODMG.initODMG( user, passwd, db );
        log.debug( "Connection succesful!!!" );
        // Login is succesfull
        // ld.setVisible( false );
        success = true;
       
        int schemaVersion = db.getSchemaVersion();
        if ( schemaVersion < db.CURRENT_SCHEMA_VERSION ) {
            String options[] = {"Proceed", "Exit Photovault"};
            if ( JOptionPane.YES_OPTION == JOptionPane.showOptionDialog( ld,
                    "The database was created with an older version of Photovault\n" +
                    "Photovault will upgrade the database format before starting.",
View Full Code Here

Examples of org.photovault.common.PVDatabase

                extVolName += n;
            }
            ExternalVolume v = new ExternalVolume( extVolName,
                    dir.getAbsolutePath() );
            PhotovaultSettings settings = PhotovaultSettings.getSettings();
            PVDatabase db = settings.getCurrentDatabase();
            try {
                db.addVolume( v );
            } catch (PhotovaultException ex) {
                // This should not happen since we just checked for it!!!
            }
           
            // Set up the indexer
View Full Code Here

Examples of org.photovault.common.PVDatabase

        } catch (IOException ex) {
            ex.printStackTrace();
        }
  volume = new Volume( "testVolume", volumeRoot.getAbsolutePath() );
        PhotovaultSettings settings = PhotovaultSettings.getSettings();
        PVDatabase curDb = settings.getCurrentDatabase();
//        try {
//            curDb.addVolume( extVol );
//        } catch (PhotovaultException ex) {
//            ex.printStackTrace();
//        }
View Full Code Here

Examples of org.photovault.common.PVDatabase

            ex.printStackTrace();
        }
  volume = new Volume( "testVolume", volumeRoot.getAbsolutePath() );
  extVol = new ExternalVolume( "extVolume", extvolRoot.getAbsolutePath() );
        PhotovaultSettings settings = PhotovaultSettings.getSettings();
        PVDatabase curDb = settings.getCurrentDatabase();
        try {
            curDb.addVolume( extVol );
        } catch (PhotovaultException ex) {
            ex.printStackTrace();
        }
    }
View Full Code Here

Examples of org.photovault.common.PVDatabase

    }
   
    private boolean createDatabase() {
        // Ask for the admin password
        try {
            PVDatabase db = new PVDatabase();
            db.setName( nameFld.getText() );
            PhotovaultSettings settings = PhotovaultSettings.getSettings();
            settings.addDatabase( db );
            String user = "";
            String passwd = "";
            if ( dbServerBtn.isSelected() ) {
                AdminLoginDlg loginDlg = new AdminLoginDlg( this, true );
                if ( loginDlg.showDialog() == AdminLoginDlg.LOGIN_DLG_OK ) {
                    user = loginDlg.getUsername();
                    passwd = loginDlg.getPasswd();
                }
                db.setDbName( dbNameFld.getText() );
                db.setHost( dbHostFld.getText() );
                Volume vol = new Volume( "defaultVolume", volumeDirFld.getText() );
                try {
                    db.addVolume( vol );
                } catch (PhotovaultException ex) {
                    // Should not happen...
                }
            } else {
                // Creating an embedded database
                db.setInstanceType( PVDatabase.TYPE_EMBEDDED );
                db.setEmbeddedDirectory( new File( volumeDirFld.getText() ) );
            }
            db.createDatabase( user, passwd );
            settings.saveConfig();
        } catch (PhotovaultException ex) {
            JOptionPane.showMessageDialog( this, ex.getMessage(),
                    "Error creating database", JOptionPane.ERROR_MESSAGE );
            return false;
View Full Code Here

Examples of org.photovault.common.PVDatabase

       Returns the current default volume object
    */
    public static VolumeBase getDefaultVolume() {
  if ( defaultVolume == null ) {
            PhotovaultSettings settings = PhotovaultSettings.getSettings();
            PVDatabase db = settings.getCurrentDatabase();
            defaultVolume = db.getDefaultVolume();
  }
  return defaultVolume;
    }
View Full Code Here

Examples of org.photovault.common.PVDatabase

       @param volName The name to look for
    */
    public static VolumeBase getVolume( String volName ) {
  VolumeBase vol = null;
        PhotovaultSettings settings = PhotovaultSettings.getSettings();
        PVDatabase db = settings.getCurrentDatabase();
  vol = db.getVolume( volName );
  return vol;
    }
View Full Code Here

Examples of org.photovault.common.PVDatabase

     @deprecated Use PVDatabase#getVolumeOfFile instead.
     */
    public static VolumeBase getVolumeOfFile( File f ) throws IOException {
        VolumeBase v = null;
        PhotovaultSettings settings = PhotovaultSettings.getSettings();
        PVDatabase db = settings.getCurrentDatabase();
  v = db.getVolumeOfFile( f );
        return v;
    }
View Full Code Here

Examples of org.photovault.common.PVDatabase

   
    public void testIndexing() {
        int n;
        ExternalVolume v = new ExternalVolume( "extVol", extVolDir.getAbsolutePath() );
        PhotovaultSettings settings = PhotovaultSettings.getSettings();
        PVDatabase db = settings.getDatabase( "pv_junit" );
        try {
            db.addVolume( v );
        } catch (PhotovaultException ex) {
            fail( ex.getMessage() );
        }
        ExtVolIndexer indexer = new ExtVolIndexer( v );
        indexer.setTopFolder( topFolder );
View Full Code Here

Examples of org.photovault.common.PVDatabase

        /*
         * Get a list of external volumes
         */
       
        PhotovaultSettings settings = PhotovaultSettings.getSettings();
        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 ) {
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.