Class ServiceUtil
java.lang.Object
net.sourceforge.jnlp.services.ServiceUtil
Provides static methods to interact useful for using the JNLP
services.
- Version:
- $Revision: 1.8 $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classcalls the object's method using privileged access -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckAccess(ApplicationInstance app, AccessType type, Object... extras) Returns whether the app requesting a JNLP service has the right permissions.static booleancheckAccess(AccessType type, Object... extras) Returns whether the app requesting a JNLP service has the right permissions.static voidcheckExistingSingleInstance(JNLPFile jnlpFile) Checks that this application (represented by the jnlp) isn't already running(package private) static ObjectcreatePrivilegedProxy(Class<?> iface, Object receiver) Creates a Proxy object implementing the specified interface when makes all calls in the security context of the system classes (ie, AllPermissions).static BasicServicestatic ClipboardServicestatic DownloadServicestatic DownloadService2static ExtensionInstallerServicestatic FileOpenServicestatic FileSaveServicestatic PersistenceServicestatic PrintServiceprivate static ObjectgetService(String name) Returns the service, or null instead of an UnavailableServiceExceptionstatic SingleInstanceServicestatic booleanReturns whether the app requesting a JNLP service is a trusted applicationprivate static booleanReturns whether the current runtime configuration allows prompting the user for JNLP permissions.
-
Field Details
-
LOG
-
-
Constructor Details
-
ServiceUtil
public ServiceUtil()
-
-
Method Details
-
getBasicService
- Returns:
- the BasicService reference, or null if the service is unavailable.
-
getClipboardService
- Returns:
- the ClipboardService reference, or null if the service is unavailable.
-
getDownloadService
- Returns:
- the DownloadService reference, or null if the service is unavailable.
-
getDownloadService2
- Returns:
- the DownloadService reference, or null if the service is unavailable.
-
getExtensionInstallerService
- Returns:
- the ExtensionInstallerService reference, or null if the service is unavailable.
-
getFileOpenService
- Returns:
- the FileOpenService reference, or null if the service is unavailable.
-
getFileSaveService
- Returns:
- the FileSaveService reference, or null if the service is unavailable.
-
getPersistenceService
- Returns:
- the PersistenceService reference, or null if the service is unavailable.
-
getPrintService
- Returns:
- the PrintService reference, or null if the service is unavailable.
-
getSingleInstanceService
- Returns:
- the SingleInstanceService reference, or null if the service is unavailable.
-
checkExistingSingleInstance
Checks that this application (represented by the jnlp) isn't already running- Parameters:
jnlpFile- theJNLPFilethat specifies the application- Throws:
InstanceExistsException- if an instance of this application already exists
-
getService
-
createPrivilegedProxy
Creates a Proxy object implementing the specified interface when makes all calls in the security context of the system classes (ie, AllPermissions). This means that the services must be more than extremely careful in the operations they perform. -
checkAccess
Returns whether the app requesting a JNLP service has the right permissions. If it doesn't, user is prompted for permissions. This method should only be used for JNLP API related permissions.- Parameters:
type- the type of access being requestedextras- extra Strings (usually) that are passed to the dialog for message formatting.- Returns:
- true if the access was granted, false otherwise.
-
checkAccess
Returns whether the app requesting a JNLP service has the right permissions. If it doesn't, user is prompted for permissions. This method should only be used for JNLP API related permissions.- Parameters:
app- the application which is requesting the check. If null, the current application is used.type- the type of access being requestedextras- extra Strings (usually) that are passed to the dialog for message formatting.- Returns:
- true if the access was granted, false otherwise.
-
shouldPromptUser
private static boolean shouldPromptUser()Returns whether the current runtime configuration allows prompting the user for JNLP permissions.- Returns:
- true if the user should be prompted for JNLP API related permissions.
-
isSigned
Returns whether the app requesting a JNLP service is a trusted application- Parameters:
app- the application which is requesting the check. If null, the current application is used.- Returns:
- true, if the app is a trusted application; false otherwise
-