org.gudy.azureus2.platform.win32
Class PlatformManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.platform.win32.PlatformManagerImpl
All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator, AEWin32AccessListener, PlatformManager

public class PlatformManagerImpl
extends java.lang.Object
implements PlatformManager, AEWin32AccessListener, AEDiagnosticsEvidenceGenerator


Field Summary
static java.lang.String DLL_NAME
           
static java.lang.String NEW_MAIN_ASSOC
           
static java.lang.String OLD_MAIN_ASS0C
           
static int RT_AZ
           
static int RT_NONE
           
static int RT_OTHER
           
static java.lang.String VUZE_ASSOC
           
 
Fields inherited from interface org.gudy.azureus2.platform.PlatformManager
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
 
Fields inherited from interface org.gudy.azureus2.plugins.platform.PlatformManager
LOC_DOCUMENTS, LOC_MUSIC, LOC_USER_DATA, LOC_VIDEO
 
Fields inherited from interface org.gudy.azureus2.platform.win32.access.AEWin32AccessListener
ET_RESUME, ET_SHUTDOWN, ET_SUSPEND, RT_SUSPEND_DENY
 
Constructor Summary
protected PlatformManagerImpl()
           
 
Method Summary
 void addListener(PlatformManagerListener listener)
           
protected  void applyPatches()
           
protected  void checkExeKey(java.io.File exe)
           
protected  void checkExeKey(int hkey, java.io.File exe)
           
 void copyFilePermissions(java.lang.String from_file_name, java.lang.String to_file_name)
           
protected  boolean createKey(int type, java.lang.String key)
           
 void createProcess(java.lang.String command_line, boolean inherit_handles)
           
 void dispose()
          Does nothing
 int eventOccurred(int type)
           
protected  void fixPermissions(java.io.File parent, java.io.File dir)
           
 void generate(IndentWriter writer)
           
 int getAdditionalFileTypeRegistrationDetails(java.lang.String name, java.lang.String type)
           
 java.lang.String getApplicationCommandLine()
           
protected  java.io.File getApplicationEXELocation()
           
 java.lang.String getComputerName()
           
 java.lang.String[] getExplicitVMOptions()
           
protected  int getIconIndex()
           
 java.io.File getLocation(long location_id)
          Get a well-known location, if defined for the platform
 int getMaxOpenFiles()
          This max-open-files concept here is from linux/osx where network connections are treated as 'files'
 int getPlatformType()
           
 boolean getPreventComputerSleep()
           
 boolean getRunAtLogin()
           
 int getShutdownTypes()
           
static PlatformManagerImpl getSingleton()
           
 java.lang.String getUserDataDirectory()
           
 java.lang.String getVersion()
           
 java.io.File getVMOptionFile()
           
 boolean hasCapability(PlatformManagerCapabilities capability)
          Gets whether the platform manager supports a capability
 boolean isAdditionalFileTypeRegistered(java.lang.String name, java.lang.String type)
          Checks to see if the supplied file type is registered with this application
 boolean isApplicationRegistered()
           
 java.lang.Class<?> loadClass(java.lang.ClassLoader loader, java.lang.String class_name)
          Gives a particular platform the ability to alter the class-loading method
 void performRecoverableFileDelete(java.lang.String file_name)
           
 void ping(java.net.InetAddress interface_address, java.net.InetAddress target, PlatformManagerPingCallback callback)
           
 void registerAdditionalFileType(java.lang.String name, java.lang.String description, java.lang.String type, java.lang.String content_type)
          Registers a file type with this application
 void registerAdditionalFileType(java.lang.String name, java.lang.String description, java.lang.String type, java.lang.String content_type, boolean url_protocol)
           
 void registerApplication()
           
protected  void registerBC()
           
protected  void registerDHT()
           
protected  void registerMagnet(boolean force)
           
 void removeListener(PlatformManagerListener listener)
           
 void requestUserAttention(int type, java.lang.Object data)
          Requests the user's attention such as bouncing the application icon on OSX
 void setExplicitVMOptions(java.lang.String[] options)
           
 void setPreventComputerSleep(boolean prevent_it)
           
 void setRunAtLogin(boolean run)
           
 void setTCPTOSEnabled(boolean enabled)
          enable or disable the platforms support for TCP TOS
 int shellExecute(java.lang.String operation, java.lang.String file, java.lang.String parameters, java.lang.String directory, int SW_const)
           
 void showFile(java.lang.String file_name)
          Reveals the file or directory with the platform's default browser
 void shutdown(int type)
           
 void startup(AzureusCore azureus_core)
           
 boolean testNativeAvailability(java.lang.String name)
           
 void traceRoute(java.net.InetAddress interface_address, java.net.InetAddress target, PlatformManagerPingCallback callback)
           
 void unregisterAdditionalFileType(java.lang.String name, java.lang.String type)
          Removes a file-type registration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RT_NONE

public static final int RT_NONE
See Also:
Constant Field Values

RT_AZ

public static final int RT_AZ
See Also:
Constant Field Values

RT_OTHER

public static final int RT_OTHER
See Also:
Constant Field Values

DLL_NAME

public static java.lang.String DLL_NAME

VUZE_ASSOC

public static final java.lang.String VUZE_ASSOC
See Also:
Constant Field Values

NEW_MAIN_ASSOC

public static final java.lang.String NEW_MAIN_ASSOC
See Also:
Constant Field Values

OLD_MAIN_ASS0C

public static final java.lang.String OLD_MAIN_ASS0C
See Also:
Constant Field Values
Constructor Detail

PlatformManagerImpl

protected PlatformManagerImpl()
                       throws PlatformManagerException
Throws:
PlatformManagerException
Method Detail

getSingleton

public static PlatformManagerImpl getSingleton()
                                        throws PlatformManagerException
Throws:
PlatformManagerException

applyPatches

protected void applyPatches()

fixPermissions

protected void fixPermissions(java.io.File parent,
                              java.io.File dir)
                       throws PlatformManagerException
Throws:
PlatformManagerException

getIconIndex

protected int getIconIndex()
                    throws PlatformManagerException
Throws:
PlatformManagerException

getVersion

public java.lang.String getVersion()

getApplicationEXELocation

protected java.io.File getApplicationEXELocation()
                                          throws PlatformManagerException
Throws:
PlatformManagerException

getPlatformType

public int getPlatformType()

getUserDataDirectory

public java.lang.String getUserDataDirectory()
                                      throws PlatformManagerException
Throws:
PlatformManagerException

getComputerName

public java.lang.String getComputerName()
Specified by:
getComputerName in interface PlatformManager
Returns:
null if can't be found

getLocation

public java.io.File getLocation(long location_id)
                         throws PlatformManagerException
Description copied from interface: PlatformManager
Get a well-known location, if defined for the platform

Specified by:
getLocation in interface PlatformManager
Parameters:
location_id - from above LOC_constants
Returns:
Throws:
PlatformManagerException

getVMOptionFile

public java.io.File getVMOptionFile()
                             throws PlatformManagerException
Throws:
PlatformManagerException

getExplicitVMOptions

public java.lang.String[] getExplicitVMOptions()
                                        throws PlatformManagerException
Throws:
PlatformManagerException

setExplicitVMOptions

public void setExplicitVMOptions(java.lang.String[] options)
                          throws PlatformManagerException
Throws:
PlatformManagerException

getRunAtLogin

public boolean getRunAtLogin()
                      throws PlatformManagerException
Throws:
PlatformManagerException

setRunAtLogin

public void setRunAtLogin(boolean run)
                   throws PlatformManagerException
Throws:
PlatformManagerException

getShutdownTypes

public int getShutdownTypes()

getPreventComputerSleep

public boolean getPreventComputerSleep()

setPreventComputerSleep

public void setPreventComputerSleep(boolean prevent_it)

startup

public void startup(AzureusCore azureus_core)
             throws PlatformManagerException
Throws:
PlatformManagerException

shutdown

public void shutdown(int type)
              throws PlatformManagerException
Throws:
PlatformManagerException

getApplicationCommandLine

public java.lang.String getApplicationCommandLine()

isApplicationRegistered

public boolean isApplicationRegistered()
                                throws PlatformManagerException
Throws:
PlatformManagerException

checkExeKey

protected void checkExeKey(java.io.File exe)

checkExeKey

protected void checkExeKey(int hkey,
                           java.io.File exe)

isAdditionalFileTypeRegistered

public boolean isAdditionalFileTypeRegistered(java.lang.String name,
                                              java.lang.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 interface PlatformManager
Returns:
Throws:
PlatformManagerException

getAdditionalFileTypeRegistrationDetails

public int getAdditionalFileTypeRegistrationDetails(java.lang.String name,
                                                    java.lang.String type)
                                             throws PlatformManagerException
Throws:
PlatformManagerException

registerApplication

public void registerApplication()
                         throws PlatformManagerException
Throws:
PlatformManagerException

registerMagnet

protected void registerMagnet(boolean force)

createKey

protected boolean createKey(int type,
                            java.lang.String key)

registerDHT

protected void registerDHT()

registerBC

protected void registerBC()

registerAdditionalFileType

public void registerAdditionalFileType(java.lang.String name,
                                       java.lang.String description,
                                       java.lang.String type,
                                       java.lang.String content_type)
                                throws PlatformManagerException
Description copied from interface: PlatformManager
Registers a file type with this application

Specified by:
registerAdditionalFileType in interface PlatformManager
Throws:
PlatformManagerException

registerAdditionalFileType

public void registerAdditionalFileType(java.lang.String name,
                                       java.lang.String description,
                                       java.lang.String type,
                                       java.lang.String content_type,
                                       boolean url_protocol)
                                throws PlatformManagerException
Throws:
PlatformManagerException

unregisterAdditionalFileType

public void unregisterAdditionalFileType(java.lang.String name,
                                         java.lang.String type)
                                  throws PlatformManagerException
Description copied from interface: PlatformManager
Removes a file-type registration

Specified by:
unregisterAdditionalFileType in interface PlatformManager
Throws:
PlatformManagerException

createProcess

public void createProcess(java.lang.String command_line,
                          boolean inherit_handles)
                   throws PlatformManagerException
Throws:
PlatformManagerException

performRecoverableFileDelete

public void performRecoverableFileDelete(java.lang.String file_name)
                                  throws PlatformManagerException
Throws:
PlatformManagerException

setTCPTOSEnabled

public void setTCPTOSEnabled(boolean enabled)
                      throws PlatformManagerException
Description copied from interface: PlatformManager
enable or disable the platforms support for TCP TOS

Throws:
PlatformManagerException

copyFilePermissions

public void copyFilePermissions(java.lang.String from_file_name,
                                java.lang.String to_file_name)
                         throws PlatformManagerException
Throws:
PlatformManagerException

showFile

public void showFile(java.lang.String file_name)
              throws PlatformManagerException
Reveals the file or directory with the platform's default browser

Specified by:
showFile in interface PlatformManager
Parameters:
file_name - The full path to a file or directory
Throws:
PlatformManagerException - If this operation fails

testNativeAvailability

public boolean testNativeAvailability(java.lang.String name)
                               throws PlatformManagerException
Throws:
PlatformManagerException

traceRoute

public void traceRoute(java.net.InetAddress interface_address,
                       java.net.InetAddress target,
                       PlatformManagerPingCallback callback)
                throws PlatformManagerException
Throws:
PlatformManagerException

ping

public void ping(java.net.InetAddress interface_address,
                 java.net.InetAddress target,
                 PlatformManagerPingCallback callback)
          throws PlatformManagerException
Throws:
PlatformManagerException

shellExecute

public int shellExecute(java.lang.String operation,
                        java.lang.String file,
                        java.lang.String parameters,
                        java.lang.String directory,
                        int SW_const)
                 throws PlatformManagerException
Throws:
PlatformManagerException

getMaxOpenFiles

public int getMaxOpenFiles()
                    throws PlatformManagerException
Description copied from interface: PlatformManager
This max-open-files concept here is from linux/osx where network connections are treated as 'files'

Returns:
Throws:
PlatformManagerException

hasCapability

public boolean hasCapability(PlatformManagerCapabilities capability)

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.

Parameters:
capability - A platform manager capability
Returns:
True if the manager supports the capability

dispose

public void dispose()
Does nothing


eventOccurred

public int eventOccurred(int type)
Specified by:
eventOccurred in interface AEWin32AccessListener

addListener

public void addListener(PlatformManagerListener listener)

removeListener

public void removeListener(PlatformManagerListener listener)

requestUserAttention

public void requestUserAttention(int type,
                                 java.lang.Object data)
                          throws PlatformManagerException
Description copied from interface: PlatformManager
Requests the user's attention such as bouncing the application icon on OSX

Throws:
PlatformManagerException

loadClass

public java.lang.Class<?> loadClass(java.lang.ClassLoader loader,
                                    java.lang.String class_name)
                             throws PlatformManagerException
Description copied from interface: PlatformManager
Gives a particular platform the ability to alter the class-loading method

Returns:
Throws:
PlatformManagerException

generate

public void generate(IndentWriter writer)
Specified by:
generate in interface AEDiagnosticsEvidenceGenerator