Package com.biglybt.platform.win32
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 AEWin32Access
private final String
private final String
private File
private boolean
static final String
private final Set
<PlatformManagerCapabilities> private static AEMonitor
static String
private static boolean
private static boolean
private List
static final String
private boolean
private AEThread2
static final int
static final int
static final int
private static PlatformManagerImpl
Fields inherited from interface com.biglybt.platform.win32.access.AEWin32AccessListener
ET_RESUME, ET_SHUTDOWN, ET_SUSPEND, RT_SUSPEND_DENY
Fields inherited from interface com.biglybt.pif.platform.PlatformManager
LOC_DOCUMENTS, LOC_DOWNLOADS, LOC_MUSIC, LOC_USER_DATA, LOC_VIDEO
Fields inherited from interface com.biglybt.platform.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 TypeMethodDescriptionvoid
addListener
(PlatformManagerListener listener) protected void
private boolean
private File
private void
checkCapability
(PlatformManagerCapabilities capability) protected void
checkExeKey
(int hkey, File exe) protected void
checkExeKey
(File exe) void
copyFilePermissions
(String from_file_name, String to_file_name) protected boolean
void
createProcess
(String command_line, boolean inherit_handles) void
dispose()
Does nothingint
eventOccurred
(int type) protected void
fixPermissions
(File parent, File dir) void
generate
(IndentWriter writer) int
getAdditionalFileTypeRegistrationDetails
(String name, String type) protected File
String[]
protected int
private UpdateInstaller
getInstaller
(Core core) private File[]
private String
getLocation
(long location_id) Get a well-known location, if defined for the platformint
This max-open-files concept here is from linux/osx where network connections are treated as 'files'int
boolean
boolean
int
static PlatformManagerImpl
boolean
hasCapability
(PlatformManagerCapabilities capability) Gets whether the platform manager supports a capabilityprivate boolean
private void
boolean
isAdditionalFileTypeRegistered
(String name, String type) Checks to see if the supplied file type is registered with this applicationboolean
Class
<?> loadClass
(ClassLoader loader, String class_name) Gives a particular platform the ability to alter the class-loading methodvoid
performRecoverableFileDelete
(String file_name) void
ping
(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) void
registerAdditionalFileType
(String name, String description, String type, String content_type) Registers a file type with this applicationvoid
registerAdditionalFileType
(String name, String description, String type, String content_type, boolean url_protocol) void
protected void
protected void
protected void
registerMagnet
(boolean force) void
removeListener
(PlatformManagerListener listener) void
requestUserAttention
(int type, Object data) Requests the user's attention such as bouncing the application icon on OSXvoid
setExplicitVMOptions
(String[] options) void
setPreventComputerSleep
(boolean prevent_it) void
setRunAtLogin
(boolean run) void
setTCPTOSEnabled
(boolean enabled) enable or disable the platforms support for TCP TOSint
shellExecute
(String operation, String file, String parameters, String directory, int SW_const) void
Reveals the file or directory with the platform's default browservoid
shutdown
(int type) void
boolean
testNativeAvailability
(String name) void
traceRoute
(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) void
unregisterAdditionalFileType
(String name, String type) Removes a file-type registrationprivate void
writeStringToHKCRandHKCU
(String subkey, String name, String value) Methods inherited from class com.biglybt.platform.PlatformManagerBase
checkCanUseJVMOptions
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.platform.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:
getVersion
in interfacePlatformManager
-
getApplicationEXELocation
- Throws:
PlatformManagerException
-
getPlatformType
public int getPlatformType()- Specified by:
getPlatformType
in interfacePlatformManager
-
getUserDataDirectory
- Specified by:
getUserDataDirectory
in interfacePlatformManager
- Throws:
PlatformManagerException
-
getComputerName
- Specified by:
getComputerName
in interfacePlatformManager
- Returns:
- null if can't be found
-
getLocation
Description copied from interface:PlatformManager
Get a well-known location, if defined for the platform- Specified by:
getLocation
in interfacePlatformManager
- Parameters:
location_id
- from above LOC_constants- Returns:
- Throws:
PlatformManagerException
-
getJVMOptionRedirect
-
getJVMOptionFiles
-
checkAndGetLocalVMOptionFile
- Throws:
PlatformManagerException
-
getVMOptionFile
- Specified by:
getVMOptionFile
in interfacePlatformManager
- Throws:
PlatformManagerException
-
getExplicitVMOptions
- Specified by:
getExplicitVMOptions
in interfacePlatformManager
- Throws:
PlatformManagerException
-
setExplicitVMOptions
- Specified by:
setExplicitVMOptions
in interfacePlatformManager
- Throws:
PlatformManagerException
-
getRunAtLogin
- Specified by:
getRunAtLogin
in interfacePlatformManager
- Throws:
PlatformManagerException
-
setRunAtLogin
- Specified by:
setRunAtLogin
in interfacePlatformManager
- Throws:
PlatformManagerException
-
getShutdownTypes
public int getShutdownTypes()- Specified by:
getShutdownTypes
in interfacePlatformManager
-
getPreventComputerSleep
public boolean getPreventComputerSleep()- Specified by:
getPreventComputerSleep
in interfacePlatformManager
-
setPreventComputerSleep
public void setPreventComputerSleep(boolean prevent_it) - Specified by:
setPreventComputerSleep
in interfacePlatformManager
-
canHibernate
private boolean canHibernate() -
startup
- Specified by:
startup
in interfacePlatformManager
- Throws:
PlatformManagerException
-
getInstaller
- Throws:
Exception
-
informUpdateRequired
private boolean informUpdateRequired() -
shutdown
- Specified by:
shutdown
in interfacePlatformManager
- Throws:
PlatformManagerException
-
getApplicationCommandLine
- Specified by:
getApplicationCommandLine
in interfacePlatformManager
-
isApplicationRegistered
- Specified by:
isApplicationRegistered
in interfacePlatformManager
- Throws:
PlatformManagerException
-
checkExeKey
-
checkExeKey
-
isAdditionalFileTypeRegistered
public boolean isAdditionalFileTypeRegistered(String name, String type) throws PlatformManagerException Description copied from interface:PlatformManager
Checks to see if the supplied file type is registered with this application- Specified by:
isAdditionalFileTypeRegistered
in interfacePlatformManager
- Parameters:
name
-type
-- Returns:
- Throws:
PlatformManagerException
-
getAdditionalFileTypeRegistrationDetails
public int getAdditionalFileTypeRegistrationDetails(String name, String type) throws PlatformManagerException - Throws:
PlatformManagerException
-
registerApplication
- Specified by:
registerApplication
in 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:PlatformManager
Registers a file type with this application- Specified by:
registerAdditionalFileType
in 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:PlatformManager
Removes a file-type registration- Specified by:
unregisterAdditionalFileType
in interfacePlatformManager
- Parameters:
name
-type
-- Throws:
PlatformManagerException
-
createProcess
public void createProcess(String command_line, boolean inherit_handles) throws PlatformManagerException - Specified by:
createProcess
in interfacePlatformManager
- Throws:
PlatformManagerException
-
performRecoverableFileDelete
- Specified by:
performRecoverableFileDelete
in interfacePlatformManager
- Throws:
PlatformManagerException
-
setTCPTOSEnabled
Description copied from interface:PlatformManager
enable or disable the platforms support for TCP TOS- Specified by:
setTCPTOSEnabled
in interfacePlatformManager
- Parameters:
enabled
-- Throws:
PlatformManagerException
-
copyFilePermissions
public void copyFilePermissions(String from_file_name, String to_file_name) throws PlatformManagerException - Specified by:
copyFilePermissions
in interfacePlatformManager
- Throws:
PlatformManagerException
-
showFile
Reveals the file or directory with the platform's default browser- Specified by:
showFile
in interfacePlatformManager
- Parameters:
file_name
- The full path to a file or directory- Throws:
PlatformManagerException
- If this operation fails
-
testNativeAvailability
- Specified by:
testNativeAvailability
in interfacePlatformManager
- Throws:
PlatformManagerException
-
traceRoute
public void traceRoute(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) throws PlatformManagerException - Specified by:
traceRoute
in interfacePlatformManager
- Throws:
PlatformManagerException
-
ping
public void ping(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback) throws PlatformManagerException - Specified by:
ping
in 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:PlatformManager
This max-open-files concept here is from linux/osx where network connections are treated as 'files'- Specified by:
getMaxOpenFiles
in 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:
hasCapability
in 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
public void dispose()Does nothing- Specified by:
dispose
in interfacePlatformManager
-
eventOccurred
public int eventOccurred(int type) - Specified by:
eventOccurred
in interfaceAEWin32AccessListener
-
addListener
- Specified by:
addListener
in interfacePlatformManager
-
removeListener
- Specified by:
removeListener
in interfacePlatformManager
-
requestUserAttention
Description copied from interface:PlatformManager
Requests the user's attention such as bouncing the application icon on OSX- Specified by:
requestUserAttention
in interfacePlatformManager
- Parameters:
type
-data
-- Throws:
PlatformManagerException
-
loadClass
Description copied from interface:PlatformManager
Gives a particular platform the ability to alter the class-loading method- Specified by:
loadClass
in interfacePlatformManager
- Parameters:
loader
-class_name
-- Returns:
- Throws:
PlatformManagerException
-
generate
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-