org.gudy.azureus2.platform.unix
Class PlatformManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.platform.unix.PlatformManagerImpl
All Implemented Interfaces:
PlatformManager

public class PlatformManagerImpl
extends Object
implements PlatformManager

Author:
TuxPaper

Field Summary
protected static AEMonitor class_mon
           
protected static PlatformManagerImpl singleton
           
 
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
 
Constructor Summary
PlatformManagerImpl()
          Creates a new PlatformManager and initializes its capabilities
 
Method Summary
 void addListener(PlatformManagerListener listener)
           
 void copyFilePermissions(String from_file_name, String to_file_name)
           
 void createProcess(String command_line, boolean inherit_handles)
           
 void dispose()
          Disposes system resources.
 String getApplicationCommandLine()
           
 String getAzComputerID()
           
 String getComputerName()
           
 String[] getExplicitVMOptions()
           
 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()
          Gets the platform manager singleton, which was already initialized
 String getUserDataDirectory()
           
 String getVersion()
           
 File getVMOptionFile()
           
 boolean hasCapability(PlatformManagerCapabilities capability)
          Gets whether the platform manager supports a capability
 boolean isAdditionalFileTypeRegistered(String name, String type)
          Checks to see if the supplied file type is registered with this application
 boolean isApplicationRegistered()
           
 Class<?> loadClass(ClassLoader loader, String class_name)
          Gives a particular platform the ability to alter the class-loading method
 void 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 application
 void registerApplication()
           
 void removeListener(PlatformManagerListener listener)
           
 void requestUserAttention(int type, Object data)
          Requests the user's attention such as bouncing the application icon on OSX
 void setExplicitVMOptions(String[] options)
           
 void setPreventComputerSleep(boolean b)
           
 void setRunAtLogin(boolean run)
           
 void setTCPTOSEnabled(boolean enabled)
          enable or disable the platforms support for TCP TOS
 void showFile(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(String name)
           
 void traceRoute(InetAddress interface_address, InetAddress target, PlatformManagerPingCallback callback)
           
 void unregisterAdditionalFileType(String name, 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

singleton

protected static PlatformManagerImpl singleton

class_mon

protected static AEMonitor class_mon
Constructor Detail

PlatformManagerImpl

public PlatformManagerImpl()
Creates a new PlatformManager and initializes its capabilities

Method Detail

getSingleton

public static PlatformManagerImpl getSingleton()
Gets the platform manager singleton, which was already initialized


copyFilePermissions

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

createProcess

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

dispose

public void dispose()
Description copied from interface: PlatformManager
Disposes system resources. This method is optional.


getApplicationCommandLine

public String getApplicationCommandLine()
                                 throws PlatformManagerException
Throws:
PlatformManagerException

getPlatformType

public int getPlatformType()

getUserDataDirectory

public String getUserDataDirectory()
                            throws PlatformManagerException
Throws:
PlatformManagerException

getComputerName

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

getVersion

public String getVersion()
                  throws PlatformManagerException
Throws:
PlatformManagerException

hasCapability

public boolean hasCapability(PlatformManagerCapabilities capability)
Description copied from interface: PlatformManager

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

isApplicationRegistered

public boolean isApplicationRegistered()
                                throws PlatformManagerException
Throws:
PlatformManagerException

performRecoverableFileDelete

public void performRecoverableFileDelete(String file_name)
                                  throws PlatformManagerException
Throws:
PlatformManagerException

ping

public void ping(InetAddress interface_address,
                 InetAddress target,
                 PlatformManagerPingCallback callback)
          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

registerApplication

public void registerApplication()
                         throws PlatformManagerException
Throws:
PlatformManagerException

addListener

public void addListener(PlatformManagerListener listener)

removeListener

public void removeListener(PlatformManagerListener listener)

getVMOptionFile

public File getVMOptionFile()
                     throws PlatformManagerException
Throws:
PlatformManagerException

getExplicitVMOptions

public String[] getExplicitVMOptions()
                              throws PlatformManagerException
Throws:
PlatformManagerException

setExplicitVMOptions

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

getRunAtLogin

public boolean getRunAtLogin()
                      throws PlatformManagerException
Throws:
PlatformManagerException

setRunAtLogin

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

startup

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

getShutdownTypes

public int getShutdownTypes()

shutdown

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

setPreventComputerSleep

public void setPreventComputerSleep(boolean b)
                             throws PlatformManagerException
Throws:
PlatformManagerException

getPreventComputerSleep

public boolean getPreventComputerSleep()

setTCPTOSEnabled

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

Throws:
PlatformManagerException

testNativeAvailability

public boolean testNativeAvailability(String name)
                               throws PlatformManagerException
Throws:
PlatformManagerException

traceRoute

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

getLocation

public 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

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 interface PlatformManager
Returns:
Throws:
PlatformManagerException

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 interface PlatformManager
Throws:
PlatformManagerException

showFile

public void showFile(String file_name)
              throws PlatformManagerException
Description copied from interface: PlatformManager
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

unregisterAdditionalFileType

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

Specified by:
unregisterAdditionalFileType in interface PlatformManager
Throws:
PlatformManagerException

getAzComputerID

public String getAzComputerID()
                       throws PlatformManagerException
Throws:
PlatformManagerException

requestUserAttention

public void requestUserAttention(int type,
                                 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 Class<?> loadClass(ClassLoader loader,
                          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