org.lobobrowser.main
Class PlatformInit

java.lang.Object
  extended by org.lobobrowser.main.PlatformInit

public class PlatformInit
extends java.lang.Object

A singleton class that is used to initialize a browser session in the current JVM. It can also be used to open a browser window.

See Also:
getInstance()

Method Summary
 void addPrivilegedPermission(java.security.Permission permission)
          Adds one permission to the base set of permissions assigned to privileged code, i.e.
 java.io.File getApplicationDirectory()
           
static PlatformInit getInstance()
          Gets the singleton instance.
 void init(boolean exitWhenAllWindowsAreClosed, boolean initConsole)
          Initializes security, protocols, look & feel, console, the default window factory, extensions and java.library.path.
 void init(java.lang.String[] args, boolean exitWhenAllWindowsAreClosed)
          Deprecated. Use init(boolean, boolean).
 void initConsole()
          Resets standard output and error streams so they are redirected to the browser console.
 void initExtensions()
          Initializes browser extensions.
 void initLogging(boolean debugOn)
          Initializes platform logging.
 void initLookAndFeel()
          Initializes the Swing look & feel.
 void initNative(java.lang.String dirName)
          Initializers the java.library.path property.
 void initOtherProperties()
          Initializes some Java properties required by the browser.
 void initProtocols()
          Initializes the global URLStreamHandlerFactory, sets up an authenticator and a cookie handler.
 void initSecurity()
          Intializes security by installing a security policy and a security manager.
 void initWindowFactory(boolean exitWhenAllWindowsAreClosed)
          Initializes the default window factory such that the JVM exits when all windows created by the factory are closed by the user.
 boolean isCodeLocationDirectory()
           
 void launch()
          Opens as many browser windows as there are startup URLs in general settings.
 void launch(java.lang.String urlOrPath)
          Opens a window and attempts to render the URL or path given.
 void scheduleTask(org.lobobrowser.util.SimpleThreadPoolTask task)
           
static void shutdown()
          Performs some cleanup and then exits the JVM.
 void start(java.lang.String[] args)
          Starts the browser by opening the URLs specified in the command-line arguments provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initSecurity

public void initSecurity()
Intializes security by installing a security policy and a security manager. Programs that use the browser API should invoke this method (or init) to prevent web content from having full access to the user's computer.

See Also:
addPrivilegedPermission(Permission)

initProtocols

public void initProtocols()
Initializes the global URLStreamHandlerFactory, sets up an authenticator and a cookie handler. This is essential for various protocols and URL API features to work.

This method is invoked by init(boolean, boolean).


initLookAndFeel

public void initLookAndFeel()
                     throws java.lang.Exception
Initializes the Swing look & feel.

Throws:
java.lang.Exception

isCodeLocationDirectory

public boolean isCodeLocationDirectory()

initConsole

public void initConsole()
Resets standard output and error streams so they are redirected to the browser console.

See Also:
ConsoleModel

initLogging

public void initLogging(boolean debugOn)
                 throws java.lang.Exception
Initializes platform logging. Note that this method is not implicitly called by init(boolean, boolean).

Parameters:
debugOn - Debugging mode. This determines which one of two different logging configurations is used.
Throws:
java.lang.Exception

initExtensions

public void initExtensions()
Initializes browser extensions. Invoking this method is essential to enable the primary extension and all basic browser functionality. This method is invoked by init(boolean, boolean).


initWindowFactory

public void initWindowFactory(boolean exitWhenAllWindowsAreClosed)
Initializes the default window factory such that the JVM exits when all windows created by the factory are closed by the user.


initNative

public void initNative(java.lang.String dirName)
Initializers the java.library.path property.

This method is called by init(boolean, boolean).

Parameters:
dirName - A directory name relative to the browser application directory.

initOtherProperties

public void initOtherProperties()
Initializes some Java properties required by the browser.

This method is called by init(boolean, boolean).


init

public void init(java.lang.String[] args,
                 boolean exitWhenAllWindowsAreClosed)
          throws java.lang.Exception
Deprecated. Use init(boolean, boolean).

Throws:
java.lang.Exception

init

public void init(boolean exitWhenAllWindowsAreClosed,
                 boolean initConsole)
          throws java.lang.Exception
Initializes security, protocols, look & feel, console, the default window factory, extensions and java.library.path. This method should be invoked before using other functionality in the browser API. If this method is not called, at the very least initOtherProperties(), initProtocols() and initExtensions() should be called.

Applications that need to install their own security manager and policy should not call this method.

Parameters:
exitWhenAllWindowsAreClosed - Whether the JVM should exit when all windows created by the default window factory are closed.
initConsole - If this parameter is true, standard output is redirected to a browser console. See ConsoleModel.
Throws:
java.lang.Exception
See Also:
initSecurity(), initProtocols(), initExtensions()

launch

public void launch(java.lang.String urlOrPath)
            throws java.net.MalformedURLException
Opens a window and attempts to render the URL or path given.

Parameters:
urlOrPath - A URL or file path.
Throws:
java.net.MalformedURLException

launch

public void launch()
            throws java.net.MalformedURLException
Opens as many browser windows as there are startup URLs in general settings.

Throws:
java.net.MalformedURLException
See Also:
GeneralSettings.getStartupURLs()

start

public void start(java.lang.String[] args)
           throws java.net.MalformedURLException
Starts the browser by opening the URLs specified in the command-line arguments provided. Non-option arguments are assumed to be URLs and opened in separate windows. If no arguments are found, the method launches URLs from general settings. This method will not return until at least one window has been shown.

Throws:
java.net.MalformedURLException
See Also:
GeneralSettings.getStartupURLs()

getInstance

public static PlatformInit getInstance()
Gets the singleton instance.


shutdown

public static void shutdown()
Performs some cleanup and then exits the JVM.


addPrivilegedPermission

public void addPrivilegedPermission(java.security.Permission permission)
Adds one permission to the base set of permissions assigned to privileged code, i.e. code loaded from the local system rather than a remote location. This method must be called before a security manager has been set, that is, before init(boolean, boolean) or initSecurity() are invoked. The purpose of the method is to add permissions otherwise missing from the security policy installed by this facility.

Parameters:
permission - A Permission instance.

scheduleTask

public void scheduleTask(org.lobobrowser.util.SimpleThreadPoolTask task)

getApplicationDirectory

public java.io.File getApplicationDirectory()


SourceForge.net LogoCopyright © 2005, 2006, 2007 The Lobo Project. All Rights Reserved.
[Lobo Home]