|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pepper.platform.util.Env
public class Env
Env contains environment helper methods. Pad has a generic architecture designation isPadOS() This is further qualified when necessary as Pad 2 or Pad 3. The -dPAD*=true properties could be used to force an override, like on a non-pad linux box. isPad returns true for Pad 2 and Pad 3, or when PAD=true isPad2 only for Pad 2, based on value of os.arch="arm" or PAD2=true isPad3 only for Pad 3, based on os.version including "geode" or PAD3=true Otherwise its a PC OS is determined by the value of os.name
for corresponding values used in
XML pages and XSL tests
Field Summary | |
---|---|
static int |
DOCUMENTS
|
static int |
DOWNLOADS
|
static int |
EBOOKS
|
static int |
HOME
|
static int |
MUSIC
|
static String |
PAD_CARD
Path for Pad SD/MMC card |
static String |
PAD_DROPBOX
Path for Pad drop box |
static String |
PAD_HOME
Path for Pad home dir |
static String |
PAD_NETWORK
Path for Pad mounted network device |
static String |
PAD_PROPERTY
|
static String |
PAD_USB
Path for Pad USB device |
static String |
PAD2_PROPERTY
|
static String |
PAD3_PROPERTY
|
static String |
PEPPER_PROTOCOL
Pepper Protocol Prefix. |
static int |
PICTURES
|
static int |
VIDEO
|
Constructor Summary | |
---|---|
Env()
|
Method Summary | |
---|---|
static String |
getArch()
The current architecture Used for matching in page transformations |
static String |
getDefaultUserDirectory(int dirType)
Get user's default directory path. |
static String[] |
getDirs()
Return the list of valid directories |
static String[] |
getEnv()
This Linux-only function returns a subset of the Keeper's process environment. |
static String |
getFileURL(String filePath)
Returns a File URL appropriate for the specified path. |
static String |
getFileURLPrefix(String filePath)
Returns a File URL prefix appropriate for the specified path. |
static String |
getJarURLPrefix(String filePath)
Returns a Jar File URL prefix appropriate for the specified path. |
static String |
getPepperURL(String filePath)
Returns a Pepper URL appropriate for the specified path. |
static String |
getSerialNumber()
Get the serial number for this Pad |
static void |
initialize()
Initialize frequently used booleans |
static boolean |
isLinuxOS()
Returns true if called on a Linux system. |
static boolean |
isMacOS()
Returns true if called on an OS X system. |
static boolean |
isPad2()
Returns true if called on the Pepper Pad 2. |
static boolean |
isPad3()
Returns true if called on the Pepper Pad 3. |
static boolean |
isPad3OrLinux()
Returns true if called on Pad 3 or a Linux environment that is NOT Pad2 |
static boolean |
isPadOS()
Returns true if called on the Pepper Pad. |
static boolean |
isWindows()
Returns true if called on a Window system. |
static String |
makePepperURL(String resourceId,
String sectionId,
String packageId,
boolean isPage)
Creates a string representing a pepper url |
static URL |
makeThePepperURL(String resourceId,
String sectionId,
String packageId,
boolean isPage)
Make Pepper URL and return it as a URL |
static void |
populateDirectoryNames(MessageCatalog catalog)
Load default directory names for each platform from the message catalog. |
static String |
removeFileURL(String filePath)
Removes the File URL from the specified path and returns the result. |
static String |
removePepperURL(String s)
Returns a String by removing the Pepper URL prefix from the passed in String. |
static boolean |
startsWithFileURL(String filePath)
Returns true if the filePath starts with a file URL. |
static boolean |
startsWithPepperURL(String filePath)
Returns true if the filePath starts with a Pepper URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PAD_HOME
public static final String PAD_CARD
public static final String PAD_USB
public static final String PAD_NETWORK
public static final String PAD_DROPBOX
public static final String PAD_PROPERTY
public static final String PAD2_PROPERTY
public static final String PAD3_PROPERTY
public static final String PEPPER_PROTOCOL
public static final int HOME
public static final int PICTURES
public static final int MUSIC
public static final int VIDEO
public static final int DOWNLOADS
public static final int EBOOKS
public static final int DOCUMENTS
Constructor Detail |
---|
public Env()
Method Detail |
---|
public static void initialize()
public static String[] getEnv()
Runtime.exec()
, allowing such code to pass a minimal environment
to the new process. The primary purpose of this is to allow new executables
to be launched without LD_PRELOAD set which causes latency in startup of the
new process.
The environment variables that are set by this call are:
DISPLAY
HOME
LD_LIBRARY_PATH
PATH
Note - new environment variables should only be added to this
method only if they are truly global and apply to multiple
applications. Otherwise, they should be added to the
to the local copy of the env before it's passed to the
Runtime exec call.
String
instances of the form: NAME=VALUE,
or null
if the OS is not Linux.public static boolean isLinuxOS()
true
if called on a Linux system.
boolean
value.public static boolean isMacOS()
true
if called on an OS X system.
boolean
value.public static boolean isWindows()
true
if called on a Window system.
boolean
value.public static boolean isPadOS()
true
if called on the Pepper Pad.
boolean
value.public static boolean isPad2()
true
if called on the Pepper Pad 2.
boolean
value.public static boolean isPad3()
true
if called on the Pepper Pad 3.
boolean
value.public static boolean isPad3OrLinux()
boolean
valuepublic static String getArch()
PageXML
public static String makePepperURL(String resourceId, String sectionId, String packageId, boolean isPage)
resourceId
- stringsectionId
- stringpackageId
- stringisPage
- booleanpublic static URL makeThePepperURL(String resourceId, String sectionId, String packageId, boolean isPage) throws MalformedURLException
resourceId
- a String
valuesectionId
- a String
valuepackageId
- a String
valueisPage
- a boolean
value
URL
value
MalformedURLException
- if an error occurspublic static String removePepperURL(String s)
s
- the String to convert.public static String getPepperURL(String filePath)
filePath
- the path to the file.public static boolean startsWithPepperURL(String filePath)
filePath
- the path to the file.
public static String getFileURLPrefix(String filePath)
filePath
- the path to the file.public static String getJarURLPrefix(String filePath)
filePath
- the path to the file.public static String getFileURL(String filePath)
filePath
- the path to the file.public static boolean startsWithFileURL(String filePath)
filePath
- the path to the file.
public static String removeFileURL(String filePath)
filePath
- the path to clip.
public static String getDefaultUserDirectory(int dirType)
dirType:
- HOME, PICTURES, MUSIC, VIDEO, DOWNLOADS, EBOOKS, DOCUMENTS
public static void populateDirectoryNames(MessageCatalog catalog)
catalog
- MessageCatalog containing localized directory names.public static String[] getDirs()
public static String getSerialNumber()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |