Create object file if not exist and load datasource
553392
def prepare(datasource = nil)
      # Compile it, if needed
      if @source_file && ((!@object_file.exist? && @source_file.exist?) || (@source_file.exist? && @source_file.mtime > @object_file.mtime))
        _JasperCompileManager = Rjb.import('net.sf.jasperreports.engine.JasperCompileManager')
        _JasperCompileManager.compileReportToFile(@source_file.to_s, @object_file.to_s)
      end
      load_datasource(datasource)
    end
1153569
private void initDatasource()  {
		if(this.isIncreamentImport()) {
			if(this.esjdbc.getStatusDbConfig() == null) {
				statusDbname = this.esjdbc.getDbConfig().getDbName() + "_config";
				String dbJNDIName = this.esjdbc.getDbConfig().getDbName() + "_config";
				try {
					createStatusTableSQL = new StringBuilder().append("create table " ).append( statusTableName)
							.append( " (ID number(10),lasttime number(10),lastvalue number(10),lastvaluetype number(1),PRIMARY KEY (ID))").toString();
					File dbpath = new File(statusStorePath);
					logger.info("initDatasource dbpath:" + dbpath.getCanonicalPath());
					SQLUtil.startPool(statusDbname,
							"org.sqlite.JDBC",
							"jdbc:sqlite://" + dbpath.getCanonicalPath(),
							"root", "root",
							null,//"false",
							null,// "READ_UNCOMMITTED",
							"select 1",
							dbJNDIName,
							10,
							10,
							20,
							true,
							false,
							null, false, false
					);
				} catch (Exception e) {
					throw new ESDataImportException(e);
				}
			}
			else{
				DBConfig statusDBConfig = esjdbc.getStatusDbConfig();

				statusDbname = esjdbc.getStatusDbConfig().getDbName();
				if(!statusDbname.equals(esjdbc.getDbConfig().getDbName())){
					String dbJNDIName = statusDbname + "_config";
					try {

						SQLUtil.startPool(statusDbname,
								statusDBConfig.getDbDriver(),
								statusDBConfig.getDbUrl(),
								statusDBConfig.getDbUser(), statusDBConfig.getDbPassword(),
								null,//"false",
								null,// "READ_UNCOMMITTED",
								statusDBConfig.getValidateSQL(),
								dbJNDIName,
								10,
								10,
								20,
								true,
								false,
								null, false, false
						);
					} catch (Exception e) {
						throw new ESDataImportException(e);
					}
				}
				createStatusTableSQL = statusDBConfig.getStatusTableDML();
				if(createStatusTableSQL == null){
					createStatusTableSQL = statusDBConfig.getCreateStatusTableSQL(SQLUtil.getPool(statusDbname).getDBType());
				}
				createStatusTableSQL = createStatusTableSQL.replace("$statusTableName",statusTableName);
			}

			if (esjdbc.getDateLastValueColumn() != null) {
				this.lastValueType = ImportIncreamentConfig.TIMESTAMP_TYPE;
			} else if (esjdbc.getNumberLastValueColumn() != null) {
				this.lastValueType = ImportIncreamentConfig.NUMBER_TYPE;

			} else if (esjdbc.getLastValueType() != null) {
				this.lastValueType = esjdbc.getLastValueType();
			} else {
				this.lastValueType = ImportIncreamentConfig.NUMBER_TYPE;
			}


			existSQL = new StringBuilder().append("select 1 from ").append(statusTableName).toString();
			selectSQL = new StringBuilder().append("select id,lasttime,lastvalue,lastvaluetype from ")
					.append(statusTableName).append(" where id=?").toString();
			updateSQL = new StringBuilder().append("update ").append(statusTableName)
					.append(" set lasttime = ?,lastvalue = ? ,lastvaluetype= ? where id=?").toString();
			insertSQL = new StringBuilder().append("insert into ").append(statusTableName)
					.append(" (id,lasttime,lastvalue,lastvaluetype) values(?,?,?,?)").toString();
		}
	}
517826
async function loadSources (sources, options) {
  const mergedConfig = {};

  function handleSourceLoad (sourceConfig) {
    if (sourceConfig) merge(sourceConfig, mergedConfig);
  }

  for (const source of sources) {
    let sourceConfig;

    if (source == null) {
            // No-op... skip this source
      continue;
    } else if (typeof source === 'string') {
            // Load a source from a JSON file
      sourceConfig = await loadFileSource(source, options);
    } else if (Array.isArray(source)) {
      sourceConfig = await loadSources(source, options); // Load and merge all of the sources
    } else if (typeof source === 'function') {
      sourceConfig = await source(); // Invoke the function to asynchronously load the config object for this source
    } else if (typeof source === 'object') {
      sourceConfig = source; // Just merge the object
    } else {
      throw new Error('Invalid configuration source: ' + source);
    }

    handleSourceLoad(sourceConfig);
  }

  return mergedConfig;
}
410473
function _load(source, callback) {
  fs.readFile(source, {encoding: 'utf8'}, _jsonLoaded.bind(null, callback));
}
599041
protected void setDataSource(Session session, String dataSourceNew,
                                 boolean isReversedNew, boolean createFile) {

        if (getTableType() == Table.TEMP_TEXT_TABLE) {
            ;
        } else {
            session.getGrantee().checkSchemaUpdateOrGrantRights(
                getSchemaName().name);
        }

        dataSourceNew = dataSourceNew.trim();

        if (createFile
                && FileUtil.getDefaultInstance().exists(dataSourceNew)) {
            throw Error.error(ErrorCode.TEXT_SOURCE_EXISTS, dataSourceNew);
        }

        //-- Open if descending, direction changed, file changed, or not connected currently
        if (isReversedNew || (isReversedNew != isReversed)
                || !dataSource.equals(dataSourceNew) || !isConnected) {
            openCache(session, dataSourceNew, isReversedNew, isReadOnly);
        }

        if (isReversed) {
            isReadOnly = true;
        }
    }
1200767
def load_data_file(path_of_file):
    
    if os.path.exists(path_of_file):
        return storage_utils.load_objects_from_json(path_of_file)
    raise ValueError("Data file not found: {0}".format(path_of_file))
1069941
def db_file(self, value):
        
        assert not os.path.isfile(value), "%s already exists" % value
        self._db_file = value
762417
private void checkFileDataSource(FileDataSourceBase<?> fileSource) {
		String path = fileSource.getFilePath();
		if (path == null) {
			throw new InvalidProgramException("File path of FileDataSource is null.");
		}
		if (path.length() == 0) {
			throw new InvalidProgramException("File path of FileDataSource is empty string.");
		}
		
		try {
			Path p = new Path(path);
			String scheme = p.toUri().getScheme();
			
			if (scheme == null) {
				throw new InvalidProgramException("File path \"" + path + "\" of FileDataSource has no file system scheme (like 'file:// or hdfs://').");
			}
		} catch (Exception e) {
			throw new InvalidProgramException("File path \"" + path + "\" of FileDataSource is an invalid path: " + e.getMessage());
		}
	}
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;
    }
693990
function db(objectName) {
    if (_.isBoolean(save.hasLoaded)) deasync.loopWhile(() => !save.hasLoaded);
    if (!_.has(objects, objectName)) objects[objectName] = {};
    return createMethods(objects[objectName], save.bind(null, objectName));
  }
999542
public static FSDataOutputStream tryCreateFile(FileSystem fs, Path file) throws IOException {
    try {
      FSDataOutputStream os = fs.create(file, false);
      return os;
    } catch (FileAlreadyExistsException e) {
      return null;
    } catch (RemoteException e) {
      if( e.unwrapRemoteException() instanceof AlreadyBeingCreatedException ) {
        return null;
      } else { // unexpected error
        throw e;
      }
    }
  }
1336983
def load_object(filename):
    """"""
    logging.info('loading {}...'.format(filename))
    try:
        with gzip.GzipFile(filename, 'rb') as f:
            buf = ''
            while True:
                data = f.read()
                if data == '':
                    break
                buf += data
            return pickle.loads(buf)
    except Exception as e:
        logging.error('load failure: {}'.format(e))
        raise
611845
def load_datafile(name, search_path=('.'), codecs=get_codecs(), **kwargs):
    
    mod = find_datafile(name, search_path, codecs)
    if not mod:
        if 'default' in kwargs:
            return kwargs['default']
        raise IOError("file %s not found in search path %s" %(name, str(search_path)))

    (codec, datafile) = mod[0]
    return codec().load(open(datafile))
387101
def create(cls, data, **kwargs):
        """"""
        with db.session.begin_nested():
            model = cls.dbmodel(**kwargs)
            model.data = data
            obj = cls(model)
            db.session.add(obj.model)
        return obj
41805
public void loadFromPropertyFile() throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "loadFromPropertyFile()");

        String key        = null;
        Properties config = new Properties();
        InputStream is    = this.getClass().getResourceAsStream(PROPERTY_FILE);

        if (is == null) {
            throw new IOException("Resource " + PROPERTY_FILE + " not found in current classloader");
        }

        config.load(is);

        Enumeration vEnum = config.propertyNames();

        while (vEnum.hasMoreElements())
        {
            key = (String) vEnum.nextElement();

            if (key.equals("datasourceClassname"))
                datasourceClassname = config.getProperty(key);
            else if (key.equals("username"))
                datasourceUsername  = config.getProperty(key);
            else if (key.equals("password"))
                datasourcePassword  = config.getProperty(key);
            else if (key.equals("schemaname"))
                schemaName = config.getProperty(key);
            else if (key.equals("poolSize"))
                numberOfPooledConnections = Integer.parseInt(config.getProperty(key));
            else if (key.equals("verbose"))
                verbose = Boolean.valueOf(config.getProperty(key)).booleanValue();
            else
                datasourceProperties.setProperty(key, config.getProperty(key));
        }

        if (datasourceClassname == null)
            throw new IllegalStateException("The properties file must specify datasourceClassname");

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "loadFromPropertyFile()");
    }
1054762
def create(object_type, data)
      url = generate_rest_url(:create, object_type)
      object_name = object_name_for(object_type, :create)
      xml_data = data.to_xml(:root => object_name, :skip_instruct => true, :dasherize => false)
      result = retrieve(url.path, url.method, {'Content-type' => 'application/xml'}, xml_data)
      parsed_result = parse_xml(result)
      find_object_in_result(parsed_result, object_type, :create)
    end
220437
def load(data, udf, data_dir, overwrite):
    """"""
    con = make_ibis_client(ENV)

    # validate our environment before performing possibly expensive operations
    if not can_write_to_hdfs(con):
        raise IbisError('Failed to write to HDFS; check your settings')
    if udf and not can_build_udfs():
        raise IbisError('Build environment does not support building UDFs')

    # load the data files
    if data:
        load_impala_data(con, str(data_dir), overwrite)
    else:
        logger.info('Skipping Ibis test data load (--no-data)')

    # build and upload the UDFs
    if udf:
        already_loaded = is_udf_loaded(con)
        logger.info('Attempting to build and load test UDFs')
        if already_loaded and not overwrite:
            logger.info('UDFs already loaded and not overwriting; moving on')
        else:
            if already_loaded:
                logger.info('UDFs already loaded; attempting to overwrite')
            logger.info('Building UDFs')
            build_udfs()
            logger.info('Uploading UDFs')
            upload_udfs(con)
    else:
        logger.info('Skipping UDF build/load (--no-udf)')