FileDocCategorySizeDatePackage
PlatformManagerImpl.javaAPI DocAzureus 3.0.3.49265Tue Feb 13 16:49:12 GMT 2007org.gudy.azureus2.platform.unix

PlatformManagerImpl

public class PlatformManagerImpl extends Object implements PlatformManager
author
TuxPaper
created
Dec 18, 2006

Fields Summary
private static final org.gudy.azureus2.core3.logging.LogIDs
LOGID
private static final String
ERR_UNSUPPORTED
protected static PlatformManagerImpl
singleton
protected static org.gudy.azureus2.core3.util.AEMonitor
class_mon
private final HashSet
capabilitySet
private static final Object
migrate_lock
Constructors Summary
public PlatformManagerImpl()
Creates a new PlatformManager and initializes its capabilities

		capabilitySet.add(PlatformManagerCapabilities.GetUserDataDirectory);
	
Methods Summary
public voidaddListener(PlatformManagerListener listener)

		// No Listener Functionality
	
public voidcopyFilePermissions(java.lang.String from_file_name, java.lang.String to_file_name)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidcreateProcess(java.lang.String command_line, boolean inherit_handles)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voiddispose()

	
public java.lang.StringgetApplicationCommandLine()

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public java.lang.StringgetAzComputerID()

    throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public java.io.FilegetLocation(long location_id)

		switch ((int)location_id) {
			case LOC_USER_DATA:
				return( new File( getUserDataDirectory() ));
				
			case LOC_DOCUMENTS:
				return new File(System.getProperty("user.home"));
				
			case LOC_MUSIC:
				
			case LOC_VIDEO:

			default:
				return( null );
		}
	
public intgetPlatformType()

		return PT_UNIX;
	
public static org.gudy.azureus2.platform.unix.PlatformManagerImplgetSingleton()
Gets the platform manager singleton, which was already initialized


	         	 
	    
		return singleton;
	
public java.lang.StringgetUserDataDirectory()

		String userhome = System.getProperty("user.home");
		String temp_user_path = userhome + SystemProperties.SEP + "."
				+ SystemProperties.APPLICATION_NAME.toLowerCase()
				+ SystemProperties.SEP;

		synchronized (migrate_lock) {
			File home = new File(temp_user_path);
			if (!home.exists()) { //might be a fresh install or might be an old non-migrated install
				String old_home_path = userhome + SystemProperties.SEP + "."
						+ SystemProperties.APPLICATION_NAME + SystemProperties.SEP;
				File old_home = new File(old_home_path);
				if (old_home.exists()) { //migrate
					String msg = "Migrating unix user config dir [" + old_home_path
							+ "] ===> [" + temp_user_path + "]";
					System.out.println(msg);
					Logger.log(new LogEvent(LOGID,
							"SystemProperties::getUserPath(Unix): " + msg));
					try {
						old_home.renameTo(home);
					} catch (Throwable t) {
						t.printStackTrace();
						Logger.log(new LogEvent(LOGID, "migration rename failed:", t));
					}
				}
			}
		}

		return temp_user_path;
	
public java.lang.StringgetVersion()

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public booleanhasCapability(PlatformManagerCapabilities capability)

		return capabilitySet.contains(capability);
	
private static voidinitializeSingleton()
Instantiates the singleton

		initializeSingleton();
	
		try {
			class_mon.enter();
			singleton = new PlatformManagerImpl();
		} catch (Throwable e) {
			Logger.log(new LogEvent(LOGID, "Failed to initialize platform manager"
					+ " for Unix Compatable OS", e));
		} finally {
			class_mon.exit();
		}
	
public booleanisAdditionalFileTypeRegistered(java.lang.String name, java.lang.String type)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public booleanisApplicationRegistered()

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidperformRecoverableFileDelete(java.lang.String file_name)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidping(java.net.InetAddress interface_address, java.net.InetAddress target, PlatformManagerPingCallback callback)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidregisterAdditionalFileType(java.lang.String name, java.lang.String description, java.lang.String type, java.lang.String content_type)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidregisterApplication()

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidremoveListener(PlatformManagerListener listener)

		// No Listener Functionality
	
public voidsetTCPTOSEnabled(boolean enabled)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidshowFile(java.lang.String file_name)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public booleantestNativeAvailability(java.lang.String name)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidtraceRoute(java.net.InetAddress interface_address, java.net.InetAddress target, PlatformManagerPingCallback callback)

		throw new PlatformManagerException(ERR_UNSUPPORTED);
	
public voidunregisterAdditionalFileType(java.lang.String name, java.lang.String type)

		throw new PlatformManagerException(ERR_UNSUPPORTED);