Class PlatformManagerImpl
java.lang.Object
com.biglybt.platform.PlatformManagerBase
com.biglybt.platform.win32.PlatformManagerImpl
- All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator, PlatformManager, PlatformManager, AEWin32AccessListener
public class PlatformManagerImpl
extends PlatformManagerBase
implements PlatformManager, AEWin32AccessListener, AEDiagnosticsEvidenceGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AEWin32Accessprivate final Stringprivate final Stringprivate Fileprivate booleanstatic final Stringprivate final Set<PlatformManagerCapabilities> private static AEMonitorstatic Stringprivate static booleanprivate static booleanprivate Liststatic final Stringprivate booleanprivate AEThread2static final intstatic final intstatic final intprivate static PlatformManagerImplFields inherited from interface AEWin32AccessListener
ET_RESUME, ET_SHUTDOWN, ET_SUSPEND, RT_SUSPEND_DENYFields inherited from interface PlatformManager
LOC_DOCUMENTS, LOC_DOWNLOADS, LOC_MUSIC, LOC_USER_DATA, LOC_VIDEOFields inherited from interface PlatformManager
ERR_UNSUPPORTED, PT_MACOSX, PT_OTHER, PT_UNIX, PT_WINDOWS, SD_ALL, SD_HIBERNATE, SD_SHUTDOWN, SD_SLEEP, USER_REQUEST_INFO, USER_REQUEST_QUESTION, USER_REQUEST_WARNING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(PlatformManagerListener listener) protected voidprivate booleanprivate Fileprivate voidcheckCapability(PlatformManagerCapabilities capability) protected voidcheckExeKey(int hkey, File exe) protected voidcheckExeKey(File exe) voidcopyFilePermissions(String from_file_name, String to_file_name) protected booleanvoidcreateProcess(String command_line, boolean inherit_handles) voiddispose()Does nothinginteventOccurred(int type) protected voidfixPermissions(File parent, File dir) voidgenerate(IndentWriter writer) intgetAdditionalFileTypeRegistrationDetails(String name, String type) protected FileString[]protected intprivate UpdateInstallergetInstaller(Core core) private File[]private StringgetLocation(long location_id) Get a well-known location, if defined for the platformintThis max-open-files concept here is from linux/osx where network connections are treated as 'files'intbooleanbooleanintstatic PlatformManagerImplbooleanhasCapability(PlatformManagerCapabilities capability) Gets whether the platform manager supports a capabilityprivate booleanprivate voidbooleanisAdditionalFileTypeRegistered(String name, String type) Checks to see if the supplied file type is registered with this applicationbooleanClass<?> loadClass(ClassLoader loader, String class_name) Gives a particular platform the ability to alter the class-loading methodvoidperformRecoverableFileDelete(String file_name) voidping(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) voidregisterAdditionalFileType(String name, String description, String type, String content_type) Registers a file type with this applicationvoidregisterAdditionalFileType(String name, String description, String type, String content_type, boolean url_protocol) voidprotected voidprotected voidprotected voidregisterMagnet(boolean force) voidremoveListener(PlatformManagerListener listener) voidrequestUserAttention(int type, Object data) Requests the user's attention such as bouncing the application icon on OSXvoidsetExplicitVMOptions(String[] options) voidsetPreventComputerSleep(boolean prevent_it) voidsetRunAtLogin(boolean run) voidsetTCPTOSEnabled(boolean enabled) enable or disable the platforms support for TCP TOSintshellExecute(String operation, String file, String parameters, String directory, int SW_const) voidReveals the file or directory with the platform's default browservoidshutdown(int type) voidbooleantestNativeAvailability(String name) voidtraceRoute(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) voidunregisterAdditionalFileType(String name, String type) Removes a file-type registrationprivate voidwriteStringToHKCRandHKCU(String subkey, String name, String value) Methods inherited from class PlatformManagerBase
checkCanUseJVMOptionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PlatformManager
setUseSystemTheme
-
Field Details
-
RT_NONE
public static final int RT_NONE- See Also:
-
RT_AZ
public static final int RT_AZ- See Also:
-
RT_OTHER
public static final int RT_OTHER- See Also:
-
DLL_NAME
-
BIGLYBY_ASSOC
- See Also:
-
OLD_MAIN_ASS0C
- See Also:
-
initialising
private static boolean initialising -
init_tried
private static boolean init_tried -
singleton
-
class_mon
-
capabilitySet
-
listeners
-
access
-
app_name
-
app_exe_name
-
az_exe
-
az_exe_checked
private boolean az_exe_checked -
prevent_computer_sleep
private boolean prevent_computer_sleep -
prevent_sleep_thread
-
-
Constructor Details
-
PlatformManagerImpl
- Throws:
PlatformManagerException
-
-
Method Details
-
getSingleton
- Throws:
PlatformManagerException
-
initializeCapabilities
private void initializeCapabilities() -
applyPatches
protected void applyPatches() -
fixPermissions
- Throws:
PlatformManagerException
-
getIconIndex
- Throws:
PlatformManagerException
-
getVersion
- Specified by:
getVersionin interfacePlatformManager
-
getApplicationEXELocation
- Throws:
PlatformManagerException
-
getPlatformType
public int getPlatformType()- Specified by:
getPlatformTypein interfacePlatformManager
-
getUserDataDirectory
- Specified by:
getUserDataDirectoryin interfacePlatformManager- Throws:
PlatformManagerException
-
getComputerName
- Specified by:
getComputerNamein interfacePlatformManager- Returns:
- null if can't be found
-
getLocation
Description copied from interface:PlatformManagerGet a well-known location, if defined for the platform- Specified by:
getLocationin interfacePlatformManager- Parameters:
location_id- from above LOC_constants- Returns:
- Throws:
PlatformManagerException
-
getJVMOptionRedirect
-
getJVMOptionFiles
-
checkAndGetLocalVMOptionFile
- Throws:
PlatformManagerException
-
getVMOptionFile
- Specified by:
getVMOptionFilein interfacePlatformManager- Throws:
PlatformManagerException
-
getExplicitVMOptions
- Specified by:
getExplicitVMOptionsin interfacePlatformManager- Throws:
PlatformManagerException
-
setExplicitVMOptions
- Specified by:
setExplicitVMOptionsin interfacePlatformManager- Throws:
PlatformManagerException
-
getRunAtLogin
- Specified by:
getRunAtLoginin interfacePlatformManager- Throws:
PlatformManagerException
-
setRunAtLogin
- Specified by:
setRunAtLoginin interfacePlatformManager- Throws:
PlatformManagerException
-
getShutdownTypes
public int getShutdownTypes()- Specified by:
getShutdownTypesin interfacePlatformManager
-
getPreventComputerSleep
public boolean getPreventComputerSleep()- Specified by:
getPreventComputerSleepin interfacePlatformManager
-
setPreventComputerSleep
public void setPreventComputerSleep(boolean prevent_it) - Specified by:
setPreventComputerSleepin interfacePlatformManager
-
canHibernate
private boolean canHibernate() -
startup
- Specified by:
startupin interfacePlatformManager- Throws:
PlatformManagerException
-
getInstaller
- Throws:
Exception
-
informUpdateRequired
private boolean informUpdateRequired() -
shutdown
- Specified by:
shutdownin interfacePlatformManager- Throws:
PlatformManagerException
-
getApplicationCommandLine
- Specified by:
getApplicationCommandLinein interfacePlatformManager
-
isApplicationRegistered
- Specified by:
isApplicationRegisteredin interfacePlatformManager- Throws:
PlatformManagerException
-
checkExeKey
-
checkExeKey
-
isAdditionalFileTypeRegistered
public boolean isAdditionalFileTypeRegistered(String name, String type) throws PlatformManagerException Description copied from interface:PlatformManagerChecks to see if the supplied file type is registered with this application- Specified by:
isAdditionalFileTypeRegisteredin interfacePlatformManager- Parameters:
name-type-- Returns:
- Throws:
PlatformManagerException
-
getAdditionalFileTypeRegistrationDetails
public int getAdditionalFileTypeRegistrationDetails(String name, String type) throws PlatformManagerException - Throws:
PlatformManagerException
-
registerApplication
- Specified by:
registerApplicationin interfacePlatformManager- Throws:
PlatformManagerException
-
registerMagnet
protected void registerMagnet(boolean force) -
createKey
-
registerDHT
protected void registerDHT() -
registerBC
protected void registerBC() -
registerAdditionalFileType
public void registerAdditionalFileType(String name, String description, String type, String content_type) throws PlatformManagerException Description copied from interface:PlatformManagerRegisters a file type with this application- Specified by:
registerAdditionalFileTypein interfacePlatformManager- Parameters:
name-description-type-content_type-- Throws:
PlatformManagerException
-
registerAdditionalFileType
public void registerAdditionalFileType(String name, String description, String type, String content_type, boolean url_protocol) throws PlatformManagerException - Throws:
PlatformManagerException
-
writeStringToHKCRandHKCU
-
unregisterAdditionalFileType
Description copied from interface:PlatformManagerRemoves a file-type registration- Specified by:
unregisterAdditionalFileTypein interfacePlatformManager- Parameters:
name-type-- Throws:
PlatformManagerException
-
createProcess
public void createProcess(String command_line, boolean inherit_handles) throws PlatformManagerException - Specified by:
createProcessin interfacePlatformManager- Throws:
PlatformManagerException
-
performRecoverableFileDelete
- Specified by:
performRecoverableFileDeletein interfacePlatformManager- Throws:
PlatformManagerException
-
setTCPTOSEnabled
Description copied from interface:PlatformManagerenable or disable the platforms support for TCP TOS- Specified by:
setTCPTOSEnabledin interfacePlatformManager- Parameters:
enabled-- Throws:
PlatformManagerException
-
copyFilePermissions
public void copyFilePermissions(String from_file_name, String to_file_name) throws PlatformManagerException - Specified by:
copyFilePermissionsin interfacePlatformManager- Throws:
PlatformManagerException
-
showFile
Reveals the file or directory with the platform's default browser- Specified by:
showFilein interfacePlatformManager- Parameters:
file_name- The full path to a file or directory- Throws:
PlatformManagerException- If this operation fails
-
testNativeAvailability
- Specified by:
testNativeAvailabilityin interfacePlatformManager- Throws:
PlatformManagerException
-
traceRoute
public void traceRoute(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) throws PlatformManagerException - Specified by:
traceRoutein interfacePlatformManager- Throws:
PlatformManagerException
-
ping
public void ping(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) throws PlatformManagerException - Specified by:
pingin interfacePlatformManager- Throws:
PlatformManagerException
-
shellExecute
public int shellExecute(String operation, String file, String parameters, String directory, int SW_const) throws PlatformManagerException - Throws:
PlatformManagerException
-
getMaxOpenFiles
Description copied from interface:PlatformManagerThis max-open-files concept here is from linux/osx where network connections are treated as 'files'- Specified by:
getMaxOpenFilesin interfacePlatformManager- Returns:
- Throws:
PlatformManagerException
-
hasCapability
Gets whether the platform manager supports a capability
Users of PlatformManager should check for supported capabilities before calling the corresponding methods
Note that support for a particular capability may change arbitrarily in the duration of the application session, but the manager will cache where necessary.
- Specified by:
hasCapabilityin interfacePlatformManager- Parameters:
capability- A platform manager capability- Returns:
- True if the manager supports the capability
-
checkCapability
private void checkCapability(PlatformManagerCapabilities capability) throws PlatformManagerException - Throws:
PlatformManagerException
-
dispose
-
eventOccurred
public int eventOccurred(int type) - Specified by:
eventOccurredin interfaceAEWin32AccessListener
-
addListener
- Specified by:
addListenerin interfacePlatformManager
-
removeListener
- Specified by:
removeListenerin interfacePlatformManager
-
requestUserAttention
Description copied from interface:PlatformManagerRequests the user's attention such as bouncing the application icon on OSX- Specified by:
requestUserAttentionin interfacePlatformManager- Parameters:
type-data-- Throws:
PlatformManagerException
-
loadClass
Description copied from interface:PlatformManagerGives a particular platform the ability to alter the class-loading method- Specified by:
loadClassin interfacePlatformManager- Parameters:
loader-class_name-- Returns:
- Throws:
PlatformManagerException
-
generate
- Specified by:
generatein interfaceAEDiagnosticsEvidenceGenerator
-