Get the cached GeoPackage or open and cache the GeoPackage file

@param name
GeoPackage name
@param file
GeoPackage file
@return GeoPackage
193514
public GeoPackage getOrOpen(String name, File file) {
		return getOrOpen(name, file, true);
	}
543999
public int uploadFile(String name, java.io.File file) {
		FileDataBodyPart filePart = new FileDataBodyPart("source", file);
		// Work around for bug in cherrypy
		FormDataContentDisposition.FormDataContentDispositionBuilder builder = FormDataContentDisposition
				.name(filePart.getName());
		builder.fileName(file.getName());
		builder.size(file.length());
		filePart.setFormDataContentDisposition(builder.build());

		FormDataMultiPart multiPart = new FormDataMultiPart();
		multiPart.bodyPart(filePart);
		multiPart.field("filename", name);

		Builder resource = getResourceFactory().getApiResource("/file/v2/")
				.entity(multiPart,
						new MediaType("multipart", "form-data", Collections
								.singletonMap("boundary", "AaB03x")));
		return resource.post(File.class).getId();
	}
1059961
public static RegionMetadata load
    (final File file) throws IOException {
        return RegionMetadataParser.parse(new BufferedInputStream(new
                FileInputStream(file)));
    }
1162888
private String getFileFromCache(String filename) {
        LRUCache.CacheEntry<String, T> cachedTemplate = cache.get(filename);

        if (cachedTemplate == null) {
            return null;
        }

        return cache.get(filename).raw;
    }
813807
public String header() {
		StringBuilder output = new StringBuilder();
		output.append("GeoPackage File: " + geoPackage.getPath());
		output.append("\nGeoPackage Name: " + geoPackage.getName());
		return output.toString();
	}
265950
protected static Properties loadConfig(String name) {
    try {
      URL url = new URL(name);
      return loadConfig(url);
    } catch (Exception ex) {
      return loadConfig(new File(name));
    }
  }
986486
public static PluginFileDependency fileInTcMenu(String file) {
        return new PluginFileDependency(file, PackagingType.WITHIN_TCMENU, Map.of());
    }
63376
public JavaFileObject asJavaFileObject(File file) {
        JavacFileManager fm = (JavacFileManager)context.get(JavaFileManager.class);
        return fm.getRegularFile(file);
    }
1066928
def load(filename, drop=False):
    '''
    
    '''
    if filename.startswith('http'):
        log.info('Downloading GeoZones bundle: %s', filename)
        filename, _ = urlretrieve(filename, tmp.path('geozones.tar.xz'))

    log.info('Extracting GeoZones bundle')
    with contextlib.closing(lzma.LZMAFile(filename)) as xz:
        with tarfile.open(fileobj=xz) as f:
            f.extractall(tmp.root)

    log.info('Loading GeoZones levels')

    if drop:
        log.info('Dropping existing levels')
        GeoLevel.drop_collection()

    log.info('Loading levels.msgpack')
    levels_filepath = tmp.path('levels.msgpack')
    with open(levels_filepath) as fp:
        unpacker = msgpack.Unpacker(fp, encoding=str('utf-8'))
        for i, level in enumerate(unpacker, start=1):
            GeoLevel.objects(id=level['id']).modify(
                upsert=True,
                set__name=level['label'],
                set__parents=[level_ref(p) for p in level['parents']],
                set__admin_level=level.get('admin_level')
            )
    os.remove(levels_filepath)
    log.info('Loaded {total} levels'.format(total=i))

    if drop:
        log.info('Dropping existing spatial zones')
        GeoZone.drop_collection()

    log.info('Loading zones.msgpack')
    zones_filepath = tmp.path('zones.msgpack')
    with open(zones_filepath) as fp:
        unpacker = msgpack.Unpacker(fp, encoding=str('utf-8'))
        unpacker.next()  # Skip headers.
        for i, geozone in enumerate(unpacker):
            params = {
                'slug': slugify.slugify(geozone['name'], separator='-'),
                'level': geozone['level'],
                'code': geozone['code'],
                'name': geozone['name'],
                'keys': geozone.get('keys'),
                'parents': geozone.get('parents', []),
                'ancestors': geozone.get('ancestors', []),
                'successors': geozone.get('successors', []),
                'validity': geozone.get('validity'),
                'population': geozone.get('population'),
                'dbpedia': geozone.get('dbpedia'),
                'flag': geozone.get('flag'),
                'blazon': geozone.get('blazon'),
                'wikipedia': geozone.get('wikipedia'),
                'area': geozone.get('area'),
            }
            if geozone.get('geom') and (
                geozone['geom']['type'] != 'GeometryCollection' or
                    geozone['geom']['geometries']):
                params['geom'] = geozone['geom']
            try:
                GeoZone.objects(id=geozone['_id']).modify(upsert=True, **{
                    'set__{0}'.format(k): v for k, v in params.items()
                })
            except errors.ValidationError as e:
                log.warning('Validation error (%s) for %s with %s',
                            e, geozone['_id'], params)
                continue
    os.remove(zones_filepath)
    log.info('Loaded {total} zones'.format(total=i))

    shutil.rmtree(tmp.path('translations'))
4076
public static function loadFile( $file, $name ) {

		if( !isset( $file ) ) {

			$file	= new File();
		}

		$file->load( Yii::$app->request->post(), $name );

		return $file;
	}
769312
public static void validateGeoPackageExtension(File file) {
		if (!hasGeoPackageExtension(file)) {
			throw new GeoPackageException("GeoPackage database file '" + file
					+ "' does not have a valid extension of '"
					+ GeoPackageConstants.GEOPACKAGE_EXTENSION + "' or '"
					+ GeoPackageConstants.GEOPACKAGE_EXTENDED_EXTENSION + "'");
		}
	}
610946
private static synchronized String getFile(String name) {
        if(Objects.isNullOrEmpty(baseDirectory)){
            baseDirectory = Options.getStorage().getSystem("numberSequence.home", System.getProperty("user.home") + File.separator + ".s1-sequences");
        }
        File dir = new File(baseDirectory);
        if(!dir.exists())
            dir.mkdirs();
        if(!dir.isDirectory())
            throw new S1SystemError("Directory error: "+baseDirectory);
        return dir.getAbsolutePath()+File.separator+name;
    }
531793
@Override
    public PackageInfoImpl getPackageInfo(String name) {
        return getClassInfoCache().getPackageInfo(name, ClassInfoCache.DO_NOT_FORCE_PACKAGE);
    }
1299257
public static CacheConfiguration build(File file) throws IOException {
		ConfigMap<String, String> config = ConfigMap.load(file);
		return CacheConfiguration.build(config);
	}
882275
public HttpRequest form(String name, File file) {
		return form(name, file, file.getName());
	}
315385
private static String getJsPackage(FileDescriptor file) {
    String protoPackage = file.getPackage();
    if (!protoPackage.isEmpty()) {
      return "proto." + protoPackage;
    }
    return "proto";
  }
583337
private File getTarFile(String name) {
        File hexCache = new File(dotHexCachePath);
        File[] files = hexCache.listFiles(new HexFileNameFilter(name));
        if (files != null && files.length > 0) {
            Arrays.sort(files, Collections.reverseOrder());
            return files[0];
        }
        logger.warn("Couldn't find tar file of {}", name);
        return null;
    }