edu.stanford.ejalbert.launching.misc
Class UnixNetscapeBrowserLaunching

java.lang.Object
  extended by edu.stanford.ejalbert.launching.misc.UnixNetscapeBrowserLaunching
All Implemented Interfaces:
IBrowserLaunching
Direct Known Subclasses:
SunOSBrowserLaunching

public class UnixNetscapeBrowserLaunching
extends java.lang.Object
implements IBrowserLaunching

Tries several browsers (mozilla, netscape, firefox, opera, and konqueror). Most users will have at least one of these installed.

Author:
Markus Gebhard, Jeff Chapman

Field Summary
private static int BROWSER_COUNT
           
protected  AbstractLogger logger
           
private  java.util.Map unixBrowsers
          list of supported unix/linux browsers
 
Fields inherited from interface edu.stanford.ejalbert.launching.IBrowserLaunching
BROWSER_DEFAULT, PROTOCOL_FILE, PROTOCOL_HTTP, PROTOCOL_MAILTO
 
Constructor Summary
UnixNetscapeBrowserLaunching(AbstractLogger logger)
           
 
Method Summary
 java.util.List getBrowserList()
          Returns a list of browsers to be used for browser targetting.
 void initialize()
          Use the which command to find out which browsers are available.
 void openUrl(java.lang.String urlString)
          This implementation will cause the calling thread to block until the browser exits.
 void openUrl(java.lang.String browser, java.lang.String urlString)
          Allows user to target a specific browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BROWSER_COUNT

private static final int BROWSER_COUNT
See Also:
Constant Field Values

unixBrowsers

private java.util.Map unixBrowsers
list of supported unix/linux browsers


logger

protected final AbstractLogger logger
Constructor Detail

UnixNetscapeBrowserLaunching

public UnixNetscapeBrowserLaunching(AbstractLogger logger)
Method Detail

initialize

public void initialize()
                throws BrowserLaunchingInitializingException
Use the which command to find out which browsers are available.

Specified by:
initialize in interface IBrowserLaunching
Throws:
BrowserLaunchingInitializingException

openUrl

public void openUrl(java.lang.String urlString)
             throws UnsupportedOperatingSystemException,
                    BrowserLaunchingExecutionException,
                    BrowserLaunchingInitializingException
This implementation will cause the calling thread to block until the browser exits. Calling methods MUST wrap the call in a separate thread.

Specified by:
openUrl in interface IBrowserLaunching
Parameters:
urlString - String
Throws:
BrowserLaunchingExecutionException
UnsupportedOperatingSystemException
BrowserLaunchingInitializingException

openUrl

public void openUrl(java.lang.String browser,
                    java.lang.String urlString)
             throws UnsupportedOperatingSystemException,
                    BrowserLaunchingExecutionException,
                    BrowserLaunchingInitializingException
Description copied from interface: IBrowserLaunching
Allows user to target a specific browser. The names of potential browsers can be accessed via the getBrowserList method.

If the call to the requested browser fails, the code will fail over to the default browser.

Specified by:
openUrl in interface IBrowserLaunching
Parameters:
browser - String
urlString - String
Throws:
UnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException

getBrowserList

public java.util.List getBrowserList()
Returns a list of browsers to be used for browser targetting. This list will always contain at least one item--the BROWSER_DEFAULT.

Specified by:
getBrowserList in interface IBrowserLaunching
Returns:
List