0N/A/*
2362N/A * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.java.browser.dom;
0N/A
0N/Apublic abstract class DOMService
0N/A{
0N/A /**
0N/A * Returns new instance of a DOMService. The implementation
0N/A * of the DOMService returns depends on the setting of the
0N/A * com.sun.java.browser.dom.DOMServiceProvider property or,
0N/A * if the property is not set, a platform specific default.
0N/A *
0N/A * Throws DOMUnsupportedException if the DOMService is not
0N/A * available to the obj.
0N/A *
0N/A * @param obj Object to leverage the DOMService
0N/A */
0N/A public static DOMService getService(Object obj)
0N/A throws DOMUnsupportedException
0N/A {
0N/A try
0N/A {
0N/A String provider = (String) java.security.AccessController.doPrivileged(
0N/A new sun.security.action.GetPropertyAction("com.sun.java.browser.dom.DOMServiceProvider"));
0N/A
0N/A Class clazz = DOMService.class.forName("sun.plugin.dom.DOMService");
0N/A
0N/A return (DOMService) clazz.newInstance();
0N/A }
0N/A catch (Throwable e)
0N/A {
0N/A throw new DOMUnsupportedException(e.toString());
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * An empty constructor is provided. Implementations of this
0N/A * abstract class must provide a public no-argument constructor
0N/A * in order for the static getService() method to work correctly.
0N/A * Application programmers should not be able to directly
0N/A * construct implementation subclasses of this abstract subclass.
0N/A */
0N/A public DOMService()
0N/A {
0N/A }
0N/A
0N/A /**
0N/A * Causes action.run() to be executed synchronously on the
0N/A * DOM action dispatching thread. This call will block until all
0N/A * pending DOM actions have been processed and (then)
0N/A * action.run() returns. This method should be used when an
0N/A * application thread needs to access the browser's DOM.
0N/A * It should not be called from the DOMActionDispatchThread.
0N/A *
0N/A * Note that if the DOMAction.run() method throws an uncaught
0N/A * exception (on the DOM action dispatching thread), it's caught
0N/A * and re-thrown, as an DOMAccessException, on the caller's thread.
0N/A *
0N/A * If the DOMAction.run() method throws any DOM security related
0N/A * exception (on the DOM action dispatching thread), it's caught
0N/A * and re-thrown, as an DOMSecurityException, on the caller's thread.
0N/A *
0N/A * @param action DOMAction.
0N/A */
0N/A public abstract Object invokeAndWait(DOMAction action) throws DOMAccessException;
0N/A
0N/A /**
0N/A * Causes action.run() to be executed asynchronously on the
0N/A * DOM action dispatching thread. This method should be used
0N/A * when an application thread needs to access the browser's
0N/A * DOM. It should not be called from the DOMActionDispatchThread.
0N/A *
0N/A * Note that if the DOMAction.run() method throws an uncaught
0N/A * exception (on the DOM action dispatching thread), it will not be
0N/A * caught and re-thrown on the caller's thread.
0N/A *
0N/A * @param action DOMAction.
0N/A */
0N/A public abstract void invokeLater(DOMAction action);
0N/A}