public class SystemUtils extends Object
All functions have been implemented with extreme caution in order to provide a maximum performance.
Modifier and Type | Class and Description |
---|---|
static class |
SystemUtils.ImageSelection
This class is used to hold an image while on the clipboard.
|
Modifier and Type | Field and Description |
---|---|
static String |
AUXDATA_DIR_NAME
Name of BEAM's auxdata directory.
|
static String |
BEAM_HOME_PAGE
Deprecated.
since 4.10, use
getApplicationHomepageUrl() instead |
static String |
BEAM_HOME_PROPERTY_NAME
Deprecated.
since 4.10, use
getApplicationHomePropertyName() instead |
static String |
BEAM_PARALLELISM_PROPERTY_NAME |
static String |
BEAM_PLUGIN_PATH_PROPERTY_NAME
Deprecated.
since 4.10, not in use.
|
static String |
CACHE_DIR_NAME |
static String |
EXTENSION_DIR_NAME
Name of BEAM's extensions directory.
|
static String |
LAX_INSTALL_DIR_PROPERTY_NAME |
static int |
LL_DEBUG |
static int |
LL_ERROR |
static int |
LL_INFO |
static int |
LL_WARNING |
static String |
LLS_DEBUG |
static String |
LLS_ERROR |
static String |
LLS_INFO |
static String |
LLS_WARNING |
static String |
LS
SYSTEM_DEPENDENT_LINE_SEPARATOR
|
Constructor and Description |
---|
SystemUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
convertToLocalPath(String urlPath)
Replace the separator character '/' with the system-dependent path-separator character.
|
static void |
copyToClipboard(Image image)
Copies the given image to the system clipboard.
|
static void |
copyToClipboard(String text)
Copies the given text to the system clipboard.
|
static String |
createHumanReadableExceptionMessage(Exception e)
Creates a (more) human readable exception message text for the given exception.
|
static String |
getApplicationContextId()
Gets the application context ID uses as prefix in a number of application configuration settings.
|
static File |
getApplicationDataDir()
Gets the current user's application data directory.
|
static File |
getApplicationDataDir(boolean force)
Optionally creates and returns the current user's application data directory.
|
static File |
getApplicationHomeDir()
Gets the application's home directory as set by the system property "${ceres.context}.home".
|
static File |
getApplicationHomeDir(URL url)
Extracts an application's home directory from the given URL.
|
static String |
getApplicationHomepageUrl()
Gets the application home page URL as set by the system property "${ceres.context}.homepage.url".
|
static String |
getApplicationHomePropertyName() |
static String |
getApplicationName()
Gets the application name used in logger output and information messages.
|
static String |
getApplicationRemoteVersionUrl() |
static File |
getBeamHomeDir()
Deprecated.
since BEAM 4.10, use
getApplicationHomeDir() instead |
static String |
getBuildNumber() |
static String |
getClassFileName(Class aClass)
Retrieves the file name of a class.
|
static File[] |
getClassPathFiles()
Gets all files (class directory & JAR file pathes) given in the current class path of the Java runtime which
loaded this class.
|
static File |
getCurrentWorkingDir()
Gets the current working directory, or the directory pointed to by '.' if the actual working directory cannot be
determined.
|
static File |
getDefaultBeamCacheDir()
Gets the default BEAM cache directory.
|
static int |
getLogLevel(String logLevelStr) |
static File |
getUserHomeDir()
Gets the current user's home directory, or the directory pointed to by '.' if the user's actual home directory
cannot be determined.
|
static String |
getUserName()
Gets the current user's name, or the string
"unknown" if the the user's name cannot be determined. |
static void |
init3rdPartyLibs(ClassLoader cl)
Initialize third party libraries of BEAM.
|
static boolean |
isRunningOnMacOS() |
static Class<?> |
loadHdf4Lib(Class<?> callerClass)
Deprecated.
since BEAM 4.10 only used by
org.esa.beam.dataio.modis.ModisProductReaderPlugIn - moved there as private method |
static Class<?> |
loadHdf5Lib(Class<?> callerClass)
Deprecated.
since BEAM 4.10 only used by
org.esa.beam.dataio.hdf5.HDF5ProductWriterPlugin - moved there as private method |
static <S> Iterable<S> |
loadServices(Class<S> serviceType)
Loads services from all
META-INF/services/ resources. |
static <S> Iterable<S> |
loadServices(Class<S> serviceType,
ClassLoader classLoader)
Loads services from all
META-INF/services/ resources. |
@Deprecated public static final String BEAM_HOME_PAGE
getApplicationHomepageUrl()
instead@Deprecated public static final String BEAM_HOME_PROPERTY_NAME
getApplicationHomePropertyName()
instead@Deprecated public static final String BEAM_PLUGIN_PATH_PROPERTY_NAME
public static final String BEAM_PARALLELISM_PROPERTY_NAME
public static final String LAX_INSTALL_DIR_PROPERTY_NAME
public static final String LS
public static final int LL_DEBUG
public static final int LL_INFO
public static final int LL_WARNING
public static final int LL_ERROR
public static final String LLS_DEBUG
public static final String LLS_INFO
public static final String LLS_WARNING
public static final String LLS_ERROR
public static final String EXTENSION_DIR_NAME
public static final String AUXDATA_DIR_NAME
public static final String CACHE_DIR_NAME
public static String getUserName()
"unknown"
if the the user's name cannot be determined.null
public static File getUserHomeDir()
null
public static String getApplicationHomepageUrl()
public static File getApplicationDataDir()
public static File getApplicationDataDir(boolean force)
force
- if true, the directory will be created if it didn't exist beforepublic static String getApplicationContextId()
public static String getApplicationName()
getApplicationContextId()
public static File getCurrentWorkingDir()
null
public static File[] getClassPathFiles()
The files pathes returned are either relative or absolute, just as they where defined for the runtime's class path.
null
public static File getApplicationHomeDir()
getApplicationHomeDir(java.net.URL)
.null
public static String getApplicationHomePropertyName()
public static File getApplicationHomeDir(URL url)
"/modules/"
.
If this succeeds the method returns the absolute
(parent) path to the directory which contains modules
, which is
then assumed to be the requested home directory.url
- the URLnull
IllegalArgumentException
- if the given url is null
.public static String getClassFileName(Class aClass)
"Date.class"
is returned for the
class java.util.Date
.aClass
- The class.IllegalArgumentException
- if the given parameter is null
.@Deprecated public static File getBeamHomeDir()
getApplicationHomeDir()
insteadorg.esa.beam.home
. If it
is given, it is returned, otherwise getApplicationHomeDir()
is returned.public static File getDefaultBeamCacheDir()
public static String convertToLocalPath(String urlPath)
urlPath
- an URL path or any other string containing the forward slash '/' as directory separator.IllegalArgumentException
- if the given parameter is null
.public static String createHumanReadableExceptionMessage(Exception e)
Currently the only modifications are
1. the first letter is turned into upper case
2. the message is
suffixed with a dot ('.') character.
e
- the exceptionnull
if e
was null.public static void copyToClipboard(String text)
text
- the text to copypublic static void copyToClipboard(Image image)
image
- the image to copypublic static boolean isRunningOnMacOS()
public static <S> Iterable<S> loadServices(Class<S> serviceType)
META-INF/services/
resources.serviceType
- the type of the service to be loaded.serviceType
found.public static <S> Iterable<S> loadServices(Class<S> serviceType, ClassLoader classLoader)
META-INF/services/
resources.serviceType
- the type of the service to be loaded.classLoader
- the class loader.serviceType
found.public static String getBuildNumber()
public static int getLogLevel(String logLevelStr)
@Deprecated public static Class<?> loadHdf4Lib(Class<?> callerClass)
org.esa.beam.dataio.modis.ModisProductReaderPlugIn
- moved there as private method@Deprecated public static Class<?> loadHdf5Lib(Class<?> callerClass)
org.esa.beam.dataio.hdf5.HDF5ProductWriterPlugin
- moved there as private methodpublic static void init3rdPartyLibs(ClassLoader cl)
cl
- The most useful class loader.public static String getApplicationRemoteVersionUrl()
Copyright © 2002–2014 Brockmann Consult GmbH. All rights reserved.