Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.util
Class PlatformUtility

java.lang.Object
  extended by oracle.adfnmc.util.PlatformUtility

public abstract class PlatformUtility
extends java.lang.Object

Contains a number of useful static methods for the Blackberry platform

Author:
pchandra

Field Summary
static java.lang.Class CLASS_INSTANCE
           
static java.lang.String DEFAULT_INTERNALSTORAGE_LOGFILE_ROOT
           
static java.lang.String FILE_SEPARATOR
           
static java.lang.String SCROOT_BB_DEFAULT
           
static java.lang.String USER_HOME_PATH
           
 
Constructor Summary
PlatformUtility()
           
 
Method Summary
static void captureScreenShot(java.lang.String fileName)
           
static void closeSilently(javax.microedition.rms.RecordStore rs)
          Close the specified RecordStore and ignore any exception that may be thrown
static void deleteRecordStoreIfExists(java.lang.String rsName)
          Delete the named record store if it exists.
static java.lang.String getDefaultSettingsDir()
           
static java.lang.String getInternalReadWriteRoot()
           
static java.lang.String getOpenSyncOSELocation()
           
static byte getOSType()
          Tell the call we're running on a Blackberry
static java.lang.String getReadWriteRoot()
           
static java.lang.String getResourceString(ResourceBundle bundle, java.lang.String key)
           
static java.lang.String getResourceString(ResourceBundle bundle, java.lang.String key, java.lang.Object[] params)
           
static java.lang.String getRootPath()
          Return the root path for this platform
static UiServicesProvider getUiServicesProvider()
           
static void hideWaitCursor()
          Hides the wait cursor
static void hideWaitCursorNative()
           
static boolean isDatabaseOnInternalStorageSupported()
          Detects if the user home path can support databases.
static boolean isHostedMode()
           
static boolean isRunningOnDevice()
          Returns true if this is running on an actual Blackberry device; false if it's running on a simulator.
static boolean isTrackballSupported()
          Determines if the device supports a newer trackball or just a thumbwheel
static boolean isUiThread()
          Determines whether the invoking thread is the UI event loop thread.
static boolean launchAppAsynchronously(java.lang.String moduleName, java.lang.String[] args)
          Launch another application on the handheld.
static boolean launchAppSynchronously(java.lang.String moduleName, java.lang.String[] args)
           
static net.rim.device.api.system.Bitmap loadBitmap(java.lang.String fileName)
           
static java.lang.String normalizeResourcePath(java.lang.String resPath)
          This method ensures the resource path is appropriate for the target platform, as resource paths can be built up in a variety of ways, or passed directly from application code.
static java.lang.String prependLeadingSlash(java.lang.String dir, boolean isJarPath)
           
static boolean recordStoreExists(java.lang.String rsName)
          Does the named RecordStore exist?
static void runFromUiThreadAsynchronously(java.lang.Runnable r)
          Invoke this Runnable from the UI event thread and return immediately
static void runFromUiThreadSynchronously(java.lang.Runnable r)
          Invoke this Runnable from the UI event thread and wait for it to finish
static void setUiServicesProvider(UiServicesProvider m)
          Each UI toolkit (e.g.
static void showWaitCursor()
          Shows the wait cursor
static void showWaitCursorNative()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_INSTANCE

public static final java.lang.Class CLASS_INSTANCE

SCROOT_BB_DEFAULT

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

USER_HOME_PATH

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

DEFAULT_INTERNALSTORAGE_LOGFILE_ROOT

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

FILE_SEPARATOR

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

PlatformUtility

public PlatformUtility()
Method Detail

getOSType

public static final byte getOSType()
Tell the call we're running on a Blackberry

Returns:

getRootPath

public static final java.lang.String getRootPath()
Return the root path for this platform

Returns:

getDefaultSettingsDir

public static final java.lang.String getDefaultSettingsDir()

normalizeResourcePath

public static final java.lang.String normalizeResourcePath(java.lang.String resPath)
This method ensures the resource path is appropriate for the target platform, as resource paths can be built up in a variety of ways, or passed directly from application code. Specifically it ensures a resource path begins with the value returned by getRootPath() and does not begin with duplicated or unintentional separator characters.

Parameters:
resPath -
Returns:

closeSilently

public static final void closeSilently(javax.microedition.rms.RecordStore rs)
Close the specified RecordStore and ignore any exception that may be thrown

Parameters:
rs -

deleteRecordStoreIfExists

public static final void deleteRecordStoreIfExists(java.lang.String rsName)
Delete the named record store if it exists. If it does not, the RecordStoreNotFoundException that would ordinarily be thrown is caught and an informational message is logged instead.

Parameters:
rsName - Name of RecordStore to delete

recordStoreExists

public static final boolean recordStoreExists(java.lang.String rsName)
Does the named RecordStore exist?

Parameters:
rsName - Name of RecordStore to find
Returns:
true if it exists; false otherwise.

isRunningOnDevice

public static final boolean isRunningOnDevice()
Returns true if this is running on an actual Blackberry device; false if it's running on a simulator.

Returns:

runFromUiThreadAsynchronously

public static final void runFromUiThreadAsynchronously(java.lang.Runnable r)
Invoke this Runnable from the UI event thread and return immediately

Parameters:
r - Runnable to execute

runFromUiThreadSynchronously

public static final void runFromUiThreadSynchronously(java.lang.Runnable r)
Invoke this Runnable from the UI event thread and wait for it to finish

Parameters:
r -

isUiThread

public static boolean isUiThread()
Determines whether the invoking thread is the UI event loop thread.

Returns:
true if the invoking thread is the UI event loop thread

isTrackballSupported

public static final boolean isTrackballSupported()
Determines if the device supports a newer trackball or just a thumbwheel

Returns:
True if device uses a trackball; false means it uses a thumbwheel

launchAppAsynchronously

public static boolean launchAppAsynchronously(java.lang.String moduleName,
                                              java.lang.String[] args)
Launch another application on the handheld.

Parameters:
moduleName - Name of app to start, like "BB_PushRegistryTest"
args - TODO
Returns:
true if app was started successfully; false otherwise

launchAppSynchronously

public static boolean launchAppSynchronously(java.lang.String moduleName,
                                             java.lang.String[] args)

loadBitmap

public static final net.rim.device.api.system.Bitmap loadBitmap(java.lang.String fileName)

isHostedMode

public static final boolean isHostedMode()

captureScreenShot

public static final void captureScreenShot(java.lang.String fileName)
                                    throws java.io.IOException
Throws:
java.io.IOException

getReadWriteRoot

public static final java.lang.String getReadWriteRoot()

getInternalReadWriteRoot

public static final java.lang.String getInternalReadWriteRoot()

showWaitCursorNative

public static void showWaitCursorNative()

hideWaitCursorNative

public static void hideWaitCursorNative()

prependLeadingSlash

public static final java.lang.String prependLeadingSlash(java.lang.String dir,
                                                         boolean isJarPath)

getOpenSyncOSELocation

public static final java.lang.String getOpenSyncOSELocation()

setUiServicesProvider

public static final void setUiServicesProvider(UiServicesProvider m)
Each UI toolkit (e.g. eSWT, AWT) has different semantics for executing some work on the UI thread. Hence, we leave the details to another construct, such as an application's main screen, and require that this construct register itself with us so that we can provide these capabilities at all layers of the framework. This method MUST be called with a valid UiServicesProvider in order to execute work items on the UI thread.

Parameters:
m -

getUiServicesProvider

public static final UiServicesProvider getUiServicesProvider()

showWaitCursor

public static final void showWaitCursor()
Shows the wait cursor


hideWaitCursor

public static final void hideWaitCursor()
Hides the wait cursor


getResourceString

public static java.lang.String getResourceString(ResourceBundle bundle,
                                                 java.lang.String key)

getResourceString

public static java.lang.String getResourceString(ResourceBundle bundle,
                                                 java.lang.String key,
                                                 java.lang.Object[] params)

isDatabaseOnInternalStorageSupported

public static boolean isDatabaseOnInternalStorageSupported()
Detects if the user home path can support databases.

Returns:
true if the user home path can support databases, false if it cannot or the path does not exist.

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.