Examples of StorageFile


Examples of org.apache.derby.io.StorageFile

                        properties.getProperty(Property.LOG_DEVICE_AT_BACKUP);
        }
      }  
       
            getLogStorageFactory();
      StorageFile logDir;
      logDir = logStorageFactory.newStorageFile(
                             LogFactory.LOG_DIRECTORY_NAME);
       
      //remove the log directory in case of restoreFrom
      //if it exist, this happens if the log device is on seperate
      //location than the db home.
      if (isRestoreFrom && logDevice != null)
      {
        if(!privRemoveDirectory(logDir))
        {
          //it may be just a file, try deleting it
          if(!privDelete(logDir))
                    {
            throw StandardException.newException(
                            SQLState.UNABLE_TO_REMOVE_DATA_DIRECTORY,
                            getLogDirPath( logDir));
                    }
        }
      }

            // if it is a create/restore from backup,
            // create the log directory.
            if (isCreateFrom || isRestoreFrom) {
                createLogDirectory();
            }

      File backupLogDir = new File(backupPath, LogFactory.LOG_DIRECTORY_NAME);
      String[] logfilelist = privList(backupLogDir);
      if(logfilelist !=null)
      {
        for (int i = 0; i < logfilelist.length; i++)
        {
          File blogFile = new File(backupLogDir, logfilelist[i]);
          StorageFile clogFile = logStorageFactory.newStorageFile(logDir, logfilelist[i]);
          if(!privCopyFile(blogFile , clogFile))
          {
            throw
              StandardException.newException(SQLState.UNABLE_TO_COPY_LOG_FILE, blogFile, clogFile);
          }
View Full Code Here

Examples of org.geotools.data.shapefile.files.StorageFile

        } else {
            throw new DataSourceException("Cannot create a shapefile whose geometry type is "
                    + geomType);
        }

        StorageFile shpStoragefile = shpFiles.getStorageFile(SHP);
        StorageFile shxStoragefile = shpFiles.getStorageFile(SHX);
        StorageFile dbfStoragefile = shpFiles.getStorageFile(DBF);
        StorageFile prjStoragefile = shpFiles.getStorageFile(PRJ);

        FileChannel shpChannel = shpStoragefile.getWriteChannel();
        FileChannel shxChannel = shxStoragefile.getWriteChannel();

        ShapefileWriter writer = new ShapefileWriter(shpChannel, shxChannel);
        try {
            // by spec, if the file is empty, the shape envelope should be ignored
            writer.writeHeaders(new Envelope(), shapeType, 0, 100);
        } finally {
            writer.close();
            assert !shpChannel.isOpen();
            assert !shxChannel.isOpen();
        }

        DbaseFileHeader dbfheader = createDbaseHeader(featureType);

        dbfheader.setNumRecords(0);

        WritableByteChannel dbfChannel = dbfStoragefile.getWriteChannel();

        try {
            dbfheader.writeHeader(dbfChannel);
        } finally {
            dbfChannel.close();
        }

        if (crs != null) {
            String s = toSingleLineWKT(crs);

            FileWriter prjWriter = new FileWriter(prjStoragefile.getFile());
            try {
                prjWriter.write(s);
            } finally {
                prjWriter.close();
            }
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.