Add javadoc
This commit is contained in:
committed by
Sheepit Renderfarm
parent
1ef0b2f4b7
commit
e1ec588fe2
@@ -39,6 +39,9 @@ import com.sheepit.client.os.OS;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides facilities regarding the configuration of the SheepIt client
|
||||||
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Data public class Configuration {
|
@Data public class Configuration {
|
||||||
|
|
||||||
@@ -115,7 +118,9 @@ import lombok.Data;
|
|||||||
config.priority, config.computeMethod, config.GPUDevice, config.detectGPUs, config.printLog, config.requestTime, config.shutdownTime,
|
config.priority, config.computeMethod, config.GPUDevice, config.detectGPUs, config.printLog, config.requestTime, config.shutdownTime,
|
||||||
config.shutdownMode, config.extras, config.autoSignIn, config.useSysTray, config.headless, config.UIType, config.hostname, config.theme);
|
config.shutdownMode, config.extras, config.autoSignIn, config.useSysTray, config.headless, config.UIType, config.hostname, config.theme);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return string formatted with SheepIt Admin Log Viewer in mind
|
||||||
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String c = " CFG: ", n ="\n";
|
String c = " CFG: ", n ="\n";
|
||||||
return
|
return
|
||||||
@@ -149,6 +154,11 @@ import lombok.Data;
|
|||||||
c + "theme: " + theme;
|
c + "theme: " + theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the priority that Blender will be started with
|
||||||
|
* @param priority integer that will be clamped between 19 and -19,
|
||||||
|
* lowest to highest in terms of priority
|
||||||
|
*/
|
||||||
public void setUsePriority(int priority) {
|
public void setUsePriority(int priority) {
|
||||||
if (priority > 19)
|
if (priority > 19)
|
||||||
priority = 19;
|
priority = 19;
|
||||||
@@ -159,10 +169,18 @@ import lombok.Data;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns ordinal integer of the computeMethod enum
|
||||||
|
* @return ordinal integer of the computeMethod enum
|
||||||
|
*/
|
||||||
public int computeMethodToInt() {
|
public int computeMethodToInt() {
|
||||||
return this.computeMethod.ordinal();
|
return this.computeMethod.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets and optionally creates cache directory
|
||||||
|
* @param cache_dir_ File representing cache directory
|
||||||
|
*/
|
||||||
public void setCacheDir(File cache_dir_) {
|
public void setCacheDir(File cache_dir_) {
|
||||||
removeWorkingDirectory();
|
removeWorkingDirectory();
|
||||||
if (cache_dir_ == null) {
|
if (cache_dir_ == null) {
|
||||||
@@ -210,6 +228,9 @@ import lombok.Data;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the storage directory or the working directory if the former is not defined
|
||||||
|
*/
|
||||||
public File getStorageDir() {
|
public File getStorageDir() {
|
||||||
if (this.storageDirectory == null) {
|
if (this.storageDirectory == null) {
|
||||||
return this.workingDirectory;
|
return this.workingDirectory;
|
||||||
@@ -219,6 +240,9 @@ import lombok.Data;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the user specified cache directory or null if it hasn't been specified
|
||||||
|
*/
|
||||||
public File getCacheDirForSettings() {
|
public File getCacheDirForSettings() {
|
||||||
if (this.userHasSpecifiedACacheDir == false) {
|
if (this.userHasSpecifiedACacheDir == false) {
|
||||||
return null;
|
return null;
|
||||||
@@ -229,6 +253,9 @@ import lombok.Data;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string-representation of the hostname or an empty string if an error was encountered
|
||||||
|
*/
|
||||||
public String getDefaultHostname() {
|
public String getDefaultHostname() {
|
||||||
try {
|
try {
|
||||||
return InetAddress.getLocalHost().getHostName();
|
return InetAddress.getLocalHost().getHostName();
|
||||||
@@ -238,11 +265,19 @@ import lombok.Data;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the working and storage directories
|
||||||
|
*/
|
||||||
public void cleanWorkingDirectory() {
|
public void cleanWorkingDirectory() {
|
||||||
this.cleanDirectory(this.workingDirectory);
|
this.cleanDirectory(this.workingDirectory);
|
||||||
this.cleanDirectory(this.storageDirectory);
|
this.cleanDirectory(this.storageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans a directory and removes files in it from the md5 cache
|
||||||
|
* @param dir representing the directory to be cleaned
|
||||||
|
* @return false if the dir null, true otherwise
|
||||||
|
*/
|
||||||
public boolean cleanDirectory(File dir) {
|
public boolean cleanDirectory(File dir) {
|
||||||
if (dir == null) {
|
if (dir == null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -281,6 +316,9 @@ import lombok.Data;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans working directory and also deletes it if the user hasn't specified a cache directory
|
||||||
|
*/
|
||||||
public void removeWorkingDirectory() {
|
public void removeWorkingDirectory() {
|
||||||
if (this.userHasSpecifiedACacheDir) {
|
if (this.userHasSpecifiedACacheDir) {
|
||||||
this.cleanWorkingDirectory();
|
this.cleanWorkingDirectory();
|
||||||
@@ -290,6 +328,10 @@ import lombok.Data;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a list of archives (files with extensions .zip or .wool) in the
|
||||||
|
* working, storage, and shared downloads directories as long as they are not null
|
||||||
|
*/
|
||||||
public List<File> getLocalCacheFiles() {
|
public List<File> getLocalCacheFiles() {
|
||||||
List<File> files_local = new LinkedList<File>();
|
List<File> files_local = new LinkedList<File>();
|
||||||
List<File> files = new LinkedList<File>();
|
List<File> files = new LinkedList<File>();
|
||||||
@@ -337,7 +379,7 @@ import lombok.Data;
|
|||||||
* Runs through all SheepIt related directories and checks if files and folders are all readable, writeable
|
* Runs through all SheepIt related directories and checks if files and folders are all readable, writeable
|
||||||
* and in case of directories, checks if the contents can be listed and if usable space is enough.
|
* and in case of directories, checks if the contents can be listed and if usable space is enough.
|
||||||
* Only logs instances where something was detected, otherwise is it will only print "FilesystemHealthCheck started"
|
* Only logs instances where something was detected, otherwise is it will only print "FilesystemHealthCheck started"
|
||||||
* @return an ArrayList of Strings containing all of the logs of the FSHealth check
|
* @return an ArrayList of Strings containing all logs of the FSHealth check
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> filesystemHealthCheck() {
|
public ArrayList<String> filesystemHealthCheck() {
|
||||||
ArrayList<String> logs = new ArrayList<>();
|
ArrayList<String> logs = new ArrayList<>();
|
||||||
@@ -392,6 +434,10 @@ import lombok.Data;
|
|||||||
return logs;
|
return logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a string representing the version of the jar or
|
||||||
|
* {@code 6.0.0} if on error is encountered or the VERSION file doesn't exist
|
||||||
|
*/
|
||||||
private static String getJarVersion() {
|
private static String getJarVersion() {
|
||||||
String versionPath = "/VERSION";
|
String versionPath = "/VERSION";
|
||||||
String version = "6.0.0";
|
String version = "6.0.0";
|
||||||
@@ -412,10 +458,22 @@ import lombok.Data;
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if operating system is in among the supported platforms
|
||||||
|
* and is running in a compatible configuration
|
||||||
|
* false otherwise
|
||||||
|
* @see OS#isSupported()
|
||||||
|
*/
|
||||||
public boolean checkOSisSupported() {
|
public boolean checkOSisSupported() {
|
||||||
return OS.getOS() != null && OS.getOS().isSupported();
|
return OS.getOS() != null && OS.getOS().isSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if operating system is in among the supported platforms
|
||||||
|
* and if we have data on the cpu
|
||||||
|
* false otherwise
|
||||||
|
* @see CPU#haveData()
|
||||||
|
*/
|
||||||
public boolean checkCPUisSupported() {
|
public boolean checkCPUisSupported() {
|
||||||
OS os = OS.getOS();
|
OS os = OS.getOS();
|
||||||
if (os != null) {
|
if (os != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user