org.astrogrid.samp
Class Platform

java.lang.Object
  extended byorg.astrogrid.samp.Platform

public abstract class Platform
extends Object

Platform-dependent features required by the SAMP implementation.

Since:
14 Jul 2008
Author:
Mark Taylor

Constructor Summary
protected Platform(String name)
          Constructor.
 
Method Summary
abstract  File getHomeDirectory()
          Returns SAMP's definition of the "home" directory.
static Platform getPlatform()
          Returns a Platform instance for the current system.
protected abstract  String[] getPrivateReadArgs(File file)
          Returns an array of words to Runtime.exec(java.lang.String[]) in order to set permissions on a given file so that it cannot be read by anyone other than its owner.
 void setPrivateRead(File file)
          Sets file permissions on a given file so that it cannot be read by anyone other than its owner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Platform

protected Platform(String name)
Constructor.

Parameters:
name - platform name
Method Detail

getHomeDirectory

public abstract File getHomeDirectory()
Returns SAMP's definition of the "home" directory.

Returns:
directory containing SAMP lockfile

setPrivateRead

public void setPrivateRead(File file)
                    throws IOException
Sets file permissions on a given file so that it cannot be read by anyone other than its owner.

Parameters:
file - file whose permissions are to be altered
Throws:
IOException - if permissions cannot be changed

getPrivateReadArgs

protected abstract String[] getPrivateReadArgs(File file)
                                        throws IOException
Returns an array of words to Runtime.exec(java.lang.String[]) in order to set permissions on a given file so that it cannot be read by anyone other than its owner.

Parameters:
file - file to alter
Returns:
exec args
Throws:
IOException

getPlatform

public static Platform getPlatform()
Returns a Platform instance for the current system.

Returns:
platform instance


Copyright © 2008 AstroGrid. All Rights Reserved.