All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.antmedia.storage.StorageClient Maven / Gradle / Ivy

Go to download

Ant Media Server supports RTMP, RTSP, MP4, HLS, WebRTC, Adaptive Streaming, etc.

There is a newer version: 2.11.3
Show newest version
package io.antmedia.storage;

import java.io.File;

public abstract class StorageClient {
	
	
	public static final String BEAN_NAME = "app.storageClient";

	/**
	 * Endpoint for the storage, it's optional and it's used in some platforms like Digital Ocean, Wasabi, OVH
	 */
	private String endpoint;
	
	/**
	 * Access key to access the storage
	 */
	private String accessKey;
	/**
	 * Secret key for the storage
	 */
	private String secretKey;
	
	/**
	 * The region of the storage. It's like us-west-1 in S3
	 */
	private String region;
	
	/**
	 * Name of the storage. It's bucketname for S3
	 */
	private String storageName;
	
	/**
	 * Permission of the file that is uploaded to the Storage. 
	 * It may differ according to the implemenation. Default value is public-read
	 */
	private String permission = "public-read";

	private boolean enabled;

	/**
	 * Storage type. In S3 there is standard, glacier, etc. 
	 */
	private String storageClass;

	
	/**
	 * Delete file from storage
	 * 
	 * @param fileName
	 * @param type
	 */
	public abstract void delete(String key);
	
	/**
	 * Save file to storage and delete the local file according to the parameter
	 * 
	 * @param key
	 * @param file
	 * @param deleteLocalFile
	 */
	public abstract void save(String key, File file, boolean deleteLocalFile);
	
	/**
	 * Save file to storage and delete the local file 
	 * 
	 * @param key
	 * @param file
	 */
	public void save(String key, File file) {
		save(key, file, true);
	}

	/**
	 * Check if the key exists in the bucket
	 * 
	 * @param key
	 * @return
	 */
	public abstract boolean fileExist(String key);
	
	/**
	 * Re-initialize the storage client with the current parameters
	 */
	public abstract void reset();

	public String getEndpoint() {
		return endpoint;
	}

	public void setEndpoint(String endpoint) {
		this.endpoint = endpoint;
	}

	public String getAccessKey() {
		return accessKey;
	}

	public void setAccessKey(String accessKey) {
		this.accessKey = accessKey;
	}

	public String getSecretKey() {
		return secretKey;
	}

	public void setSecretKey(String secretKey) {
		this.secretKey = secretKey;
	}

	public String getRegion() {
		return region;
	}

	public void setRegion(String region) {
		this.region = region;
	}

	public String getStorageName() {
		return storageName;
	}

	public void setStorageName(String storageName) {
		this.storageName = storageName;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}
	
	public String getPermission() {
		return permission;
	}
	
	public boolean isEnabled() {
		return enabled;
	}
	
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public void setStorageClass(String storageClass) {
		this.storageClass = storageClass;		
	}
	
	public String getStorageClass() {
		return storageClass;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy