Allow to load a flatfile database.

@return True if the file is open. Else false.
347621
private boolean loadFile() {
        boolean result = false;
        File dbFile = new File(Common.getInstance().getServerCaller().getDataFolder(), getDbConnectInfo().get("filename"));
        if (dbFile.exists()) {
            try {
                flatFileReader = new BufferedReader(new FileReader(dbFile));
                result = true;
            } catch (FileNotFoundException e) {
                Common.getInstance().getLogger().severe("iConomy database file not found!");
            }
        }
        return result;
    }
275916
protected boolean _load ()
    {
        java.util.Iterator it =
            this.getOjbMetaTreeModel ().getRepository().iterator();
        java.util.ArrayList newChildren = new java.util.ArrayList();

        /* @todo make this work */

//        newChildren.add(new OjbMetaJdbcConnectionDescriptorNode(
//            this.getOjbMetaTreeModel ().getRepository(),
//            this.getOjbMetaTreeModel (),
//            this,
//            this.getOjbMetaTreeModel ().getRepository().getDefaultJdbcConnection()));

        while (it.hasNext())
        {
            org.apache.ojb.broker.metadata.ClassDescriptor cld = (org.apache.ojb.broker.metadata.ClassDescriptor)it.next();
            OjbMetaClassDescriptorNode cldNode =
            	new OjbMetaClassDescriptorNode(this.getOjbMetaTreeModel ().getRepository(),
					                           this.getOjbMetaTreeModel (),
     						                   this, cld);
            cldToNodes.put(cld, cldNode);
            newChildren.add(cldNode);
        }
        java.util.Collections.sort(newChildren);
        this.alChildren = newChildren;
        this.getOjbMetaTreeModel ().nodeStructureChanged(this);
        return true;
    }
921654
def open
      begin
        if File.exist?(@file_name)
          @f = File.open(@file_name, 'rb+')
        else
          @f = File.open(@file_name, 'wb+')
        end
      rescue => e
        PEROBS.log.fatal "Cannot open stack file #{@file_name}: #{e.message}"
      end
      unless @f.flock(File::LOCK_NB | File::LOCK_EX)
        PEROBS.log.fatal 'Database stack file is locked by another process'
      end
    end
815393
static boolean getLoadLocalLibsFirstForFile(final File file) {
        Attributes attributes = loadMainAttributes(file);
        if (null == attributes) {
            return false;
        }
        boolean loadFirstDefault=true;
        String loadFirst = attributes.getValue(RUNDECK_PLUGIN_LIBS_LOAD_FIRST);
        if(null!=loadFirst){
            return Boolean.valueOf(loadFirst);
        }
        return loadFirstDefault;
    }
732407
private function _loadSqlFile()
    {
        $fileObj = fopen($this->_sqlFile, 'r');
        $sql = fread($fileObj, filesize($this->_sqlFile));
        fclose($fileObj);
        return $sql;
    }
998104
private function mustLoadStoredRoutine(): bool
  {
    // If this is the first time we see the source file it must be loaded.
    if (!isset($this->phpStratumOldMetadata)) return true;

    // If the source file has changed the source file must be loaded.
    if ($this->phpStratumOldMetadata['timestamp']!=$this->filemtime) return true;

    // If the value of a placeholder has changed the source file must be loaded.
    foreach ($this->phpStratumOldMetadata['replace'] as $place_holder => $old_value)
    {
      if (!isset($this->replacePairs[strtoupper($place_holder)]) ||
        $this->replacePairs[strtoupper($place_holder)]!==$old_value)
      {
        return true;
      }
    }

    // If stored routine not exists in database the source file must be loaded.
    if (!isset($this->rdbmsOldRoutineMetadata)) return true;

    // If current sql-mode is different the source file must reload.
    if ($this->rdbmsOldRoutineMetadata['sql_mode']!=$this->sqlMode) return true;

    // If current character set is different the source file must reload.
    if ($this->rdbmsOldRoutineMetadata['character_set_client']!=$this->characterSet) return true;

    // If current collation is different the source file must reload.
    if ($this->rdbmsOldRoutineMetadata['collation_connection']!=$this->collate) return true;

    return false;
  }
196882
@Override
    public synchronized boolean load() {
        Either<Void, T> oldData = data;
        long oldModified = modified;
        String oldKey = versionedKey;
        try {
            if (isOutOfDate() || needsData()) {
                String newVersionedKey = reader.getAsString(key)
                                               .orElse(null);
                val loaded = nonAtomicload(newVersionedKey);
                data = Either.right((T) loaded._2());
                modified = loaded._1();
                versionedKey = newVersionedKey;
            } else {
                return false;
            }
        } catch (Throwable e) {
            data = oldData;
            versionedKey = oldKey;
            modified = oldModified;
            logger.info(e.getMessage(), e);
            throw ExceptionSoftener.throwSoftenedException(e);
        }
        return true;
    }
4885
public function loadData()
    {
        try {
            LoggerFactory::$file = $this->config['logFile'];
            LoggerFactory::$level = $this->config['logLevel'];
            $data = $this->getDataSync();
            $data->setDefaults();
            $data->cacheDir = $this->config['cacheDir'];
            $data->cacheOnly = $this->config['cacheOnly'];
            $data->dataExpire = $this->config['dataExpire'];
            $data->refreshInterval = $this->config['dataRefresh'];
            $data->forceRefresh = $this->config['forceDataRefresh'];

            // use statussync for non-cache mode
            if (!$data->cacheOnly) {
                $status = $this->prepareSync();
                $data->registerUrlFromStatus($status, 'dataUrls');
            }

            $this->results = $data->loadData();
        } catch (\Exception $e) {
            $this->exceptionStack[] = $e;

            return false;
        }

        return true;
    }
757948
public boolean open() throws RasterWritingFailureException {
        boolean ok;
        if (mapPath != null) {
            ok = writer.open(mapPath);
        } else if (locationPath != null && mapsetName != null && mapName != null) {
            ok = writer.open(mapName, locationPath, mapsetName);
        } else {
            return false;
        }

        return ok;
    }
137745
private function _loadRecords()
    {
        /* Need to start at offset 100 */
        while (! $this->eofSHP()) {
            $record = new ShapeRecord(-1);
            $record->loadFromFile($this, $this->SHPFile, $this->DBFFile);
            if ($record->lastError != '') {
                $this->setError($record->lastError);

                return false;
            }
            if (($record->shapeType === false || $record->shapeType === '') && $this->eofSHP()) {
                break;
            }

            $this->records[] = $record;
        }

        return true;
    }
886793
public static function shouldLoadExpanded()
    {
        // if filter_column_recursive & filter_pattern_recursive are supplied, and flat isn't supplied
        // we have to load all the child subtables.
        return Common::getRequestVar('filter_column_recursive', false) !== false
            && Common::getRequestVar('filter_pattern_recursive', false) !== false
            && !self::shouldLoadFlatten();
    }
104754
protected function loadFromCacheCache(): bool
    {
        if (file_exists($this->cacheFileName())) {
            $content = @file_get_contents($this->cacheFileName());
            if ($content) {
                TypeRegistry::setTypeMapping(unserialize($content));

                return true;
            }
        }

        return false;
    }
129041
public boolean processThisRecord(Record record)
    {
        if (record == null)
            return false;
        boolean bPhysicalName = true;
        if (DBConstants.TRUE.equalsIgnoreCase(this.getProperty(USE_DATABASE_NAME)))
            bPhysicalName = false;
        String strFilename = record.getArchiveFilename(bPhysicalName);
        if (this.getProperty(ConvertCode.DIR_PREFIX) != null)
            strFilename = Utility.addToPath(this.getProperty(ConvertCode.DIR_PREFIX), strFilename);
        
        String strMode = this.getProperty(TRANSFER_MODE);
        boolean bExport = true;
        if (strMode != null) if (strMode.equalsIgnoreCase(IMPORT))
            bExport = false;
        if (bExport)
        {
            int oldOpenMode = record.getOpenMode();
            record.setOpenMode(oldOpenMode & ~DBConstants.OPEN_DONT_CREATE);
            // Make sure the record exists
            try {
                record.open();
                if ((record.getEditMode() != DBConstants.EDIT_CURRENT) && (!record.hasNext()))  // Control file would read current
                    if (!DBConstants.TRUE.equalsIgnoreCase(this.getProperty("importEmptyFiles")))
                        return false;   // Skip empty files (default)
                record.close();
            } catch (DBException e) {
                return false; // Record doesn't exist
            }
            if (this.getProperty(LOCALE) != null)
            {
                if (!record.getTable().getDatabase().getDatabaseName(false).endsWith("_" + this.getProperty(LOCALE).toString()))
                    return false;     // If locale is set, only do locale tables
                if (DatabaseInfo.DATABASE_INFO_FILE.equalsIgnoreCase(record.getTable().getDatabase().getDatabaseName(false)))
                    return false;     // This is a special file type
            }
        }
        else
        { // Import must have file.
            if (!(new File(strFilename).exists()))
                return false;
            if (this.getProperty(LOCALE) != null)
            {
                if (!record.getTable().getDatabase().getDatabaseName(false).endsWith("_" + this.getProperty(LOCALE).toString()))
                    return false;     // If locale is set, only do locale tables
                if (DatabaseInfo.DATABASE_INFO_FILE.equalsIgnoreCase(record.getTable().getDatabase().getDatabaseName(false)))
                    return false;     // This is a special file type
            }
        }
        XmlInOut xml = new XmlInOut(this, null, null);    //0 v
        boolean bSuccess = false;
        if (bExport)
            bSuccess = xml.exportXML(record.getTable(), strFilename);
        else
            bSuccess = xml.importXML(record.getTable(), strFilename, null);
        xml.free();
        return bSuccess;
    }
1070436
def open
      file_name = File.join(@db_dir, 'database.blobs')
      new_db_created = false
      begin
        if File.exist?(file_name)
          @f = File.open(file_name, 'rb+')
        else
          PEROBS.log.info "New FlatFile database '#{file_name}' created"
          @f = File.open(file_name, 'wb+')
          new_db_created = true
        end
      rescue IOError => e
        PEROBS.log.fatal "Cannot open FlatFile database #{file_name}: " +
          e.message
      end
      unless @f.flock(File::LOCK_NB | File::LOCK_EX)
        PEROBS.log.fatal "FlatFile database '#{file_name}' is locked by " +
          "another process"
      end
      @f.sync = true

      open_index_files(!new_db_created)
    end
1157012
@Override
	public boolean existSql(final String fileName) {
		return Thread.currentThread().getContextClassLoader().getResource(getFilePath(fileName)) != null;
	}
266955
public function loadFile( $file ) {

		if ( empty( $this->files ) )
			$this->files = $this->readDirRecursive(
				$this->base_dir,
				'*' . $this->extension
			);

		if ( ! in_array( $file, $this->files ) )
			return FALSE;

		require_once $file;

		return TRUE;
	}
811180
private boolean tryOpenAsync() {
        Connection<CL> connection = null;
        // Try to open a new connection, as long as we haven't reached the max
        if (activeCount.get() < config.getMaxConnsPerHost()) {
            try {
                if (activeCount.incrementAndGet() <= config.getMaxConnsPerHost()) {
                    // Don't try to open too many connections at the same time.
                    if (pendingConnections.incrementAndGet() > config.getMaxPendingConnectionsPerHost()) {
                        pendingConnections.decrementAndGet();
                    }
                    else {
                        try {
                            connectAttempt.incrementAndGet();
                            connection = factory.createConnection(this);
                            connection.openAsync(new Connection.AsyncOpenCallback<CL>() {
                                @Override
                                public void success(Connection<CL> connection) {
                                    openConnections.incrementAndGet();
                                    pendingConnections.decrementAndGet();
                                    availableConnections.add(connection);
    
                                    // Sanity check in case the connection
                                    // pool was closed
                                    if (isShutdown()) {
                                        discardIdleConnections();
                                    }
                                }
    
                                @Override
                                public void failure(Connection<CL> conn, ConnectionException e) {
                                    failedOpenConnections.incrementAndGet();
                                    pendingConnections.decrementAndGet();
                                    activeCount.decrementAndGet();
    
                                    if (e instanceof IsDeadConnectionException) {
                                        noteError(e);
                                    }
                                }
                            });
                            return true;
                        }
                        catch (ThrottledException e) {
                            // Trying to open way too many connections here
                        }
                        finally {
                            if (connection == null)
                                pendingConnections.decrementAndGet();
                        }
                    }
                }
            }
            finally {
                if (connection == null) {
                    activeCount.decrementAndGet();
                }
            }
        }
        return false;
    }