Class ServiceUtil

java.lang.Object
net.sourceforge.jnlp.services.ServiceUtil

public class ServiceUtil extends Object
Provides static methods to interact useful for using the JNLP services.
Version:
$Revision: 1.8 $
  • Field Details

    • LOG

      private static final Logger LOG
  • Constructor Details

    • ServiceUtil

      public ServiceUtil()
  • Method Details

    • getBasicService

      public static BasicService getBasicService()
      Returns:
      the BasicService reference, or null if the service is unavailable.
    • getClipboardService

      public static ClipboardService getClipboardService()
      Returns:
      the ClipboardService reference, or null if the service is unavailable.
    • getDownloadService

      public static DownloadService getDownloadService()
      Returns:
      the DownloadService reference, or null if the service is unavailable.
    • getDownloadService2

      public static DownloadService2 getDownloadService2()
      Returns:
      the DownloadService reference, or null if the service is unavailable.
    • getExtensionInstallerService

      public static ExtensionInstallerService getExtensionInstallerService()
      Returns:
      the ExtensionInstallerService reference, or null if the service is unavailable.
    • getFileOpenService

      public static FileOpenService getFileOpenService()
      Returns:
      the FileOpenService reference, or null if the service is unavailable.
    • getFileSaveService

      public static FileSaveService getFileSaveService()
      Returns:
      the FileSaveService reference, or null if the service is unavailable.
    • getPersistenceService

      public static PersistenceService getPersistenceService()
      Returns:
      the PersistenceService reference, or null if the service is unavailable.
    • getPrintService

      public static PrintService getPrintService()
      Returns:
      the PrintService reference, or null if the service is unavailable.
    • getSingleInstanceService

      public static SingleInstanceService getSingleInstanceService()
      Returns:
      the SingleInstanceService reference, or null if the service is unavailable.
    • checkExistingSingleInstance

      public static void checkExistingSingleInstance(JNLPFile jnlpFile)
      Checks that this application (represented by the jnlp) isn't already running
      Parameters:
      jnlpFile - the JNLPFile that specifies the application
      Throws:
      InstanceExistsException - if an instance of this application already exists
    • getService

      private static Object getService(String name)
      Returns the service, or null instead of an UnavailableServiceException
    • createPrivilegedProxy

      static Object createPrivilegedProxy(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). This means that the services must be more than extremely careful in the operations they perform.
    • checkAccess

      public static boolean checkAccess(AccessType type, Object... extras)
      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 requested
      extras - extra Strings (usually) that are passed to the dialog for message formatting.
      Returns:
      true if the access was granted, false otherwise.
    • checkAccess

      public static boolean checkAccess(ApplicationInstance app, AccessType type, Object... extras)
      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 requested
      extras - 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

      public static boolean isSigned(ApplicationInstance app)
      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