Java Code Examples for javax.jnlp.ServiceManager#lookup()

The following examples show how to use javax.jnlp.ServiceManager#lookup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebstartPersistence.java    From marauroa with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a instance of class
 */
public WebstartPersistence() {
	try {
		ps = (PersistenceService) ServiceManager.lookup("javax.jnlp.PersistenceService");
		bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");

		if (ps != null && bs != null) {
			codebase = bs.getCodeBase();
		}

	} catch (UnavailableServiceException e) {
		e.printStackTrace(System.err);
		ps = null;
		bs = null;
	}
}
 
Example 2
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
private static ClipboardService getClipboardService() {
  try {
    return (ClipboardService) ServiceManager.lookup("javax.jnlp.ClipboardService");
  } catch (UnavailableServiceException ex) {
    return null;
  }
}
 
Example 3
Source File: JnlpResponseCache.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
private JnlpResponseCache ()
{
    try {
        service = (DownloadService) ServiceManager.lookup(
            "javax.jnlp.DownloadService");
    } catch (UnavailableServiceException ex) {
        throw new NoClassDefFoundError(ex.toString());
    }
}
 
Example 4
Source File: Jnlp.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
public BasicServiceFacade ()
{
    try {
        service = (BasicService) ServiceManager.lookup(
            "javax.jnlp.BasicService");
        logger.debug("Real BasicService available");

        // Use JNLP cache for all downloads
        JnlpResponseCache.init();
    } catch (UnavailableServiceException ex) {
        logger.debug("No BasicService available");
    }
}
 
Example 5
Source File: Jnlp.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
public DownloadServiceFacade ()
{
    try {
        service = (DownloadService) ServiceManager.lookup(
            "javax.jnlp.DownloadService");
        logger.debug("Real DownloadService available");
    } catch (UnavailableServiceException ex) {
        logger.debug("No DownloadService available");
    }
}
 
Example 6
Source File: Jnlp.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ExtensionInstallerServiceFacade ()
{
    try {
        service = (ExtensionInstallerService) ServiceManager.lookup(
            "javax.jnlp.ExtensionInstallerService");
        logger.debug("Real ExtensionInstallerService available");

        logger.debug("ExtensionLocation = {}", getExtensionLocation());
        logger.debug("InstallPath = {}", getInstallPath());
    } catch (UnavailableServiceException ex) {
        logger.debug("No ExtensionInstallerService available");
    }
}
 
Example 7
Source File: SavedState.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Quick test to see if running through Java webstart
 * 
 * @return True if jws running
 */
private boolean isWebstartAvailable() {
	try {
		Class.forName("javax.jnlp.ServiceManager");
		// this causes to go and see if the service is available
		ServiceManager.lookup("javax.jnlp.PersistenceService");
		Log.info("Webstart detected using Muffins");
	} catch (Exception e) {
		Log.info("Using Local File System");
		return false;
	}
	return true;
}