src/share/classes/com/sun/java/browser/dom/DOMService.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 {
  30     /**
  31      * Returns new instance of a DOMService. The implementation
  32      * of the DOMService returns depends on the setting of the
  33      * com.sun.java.browser.dom.DOMServiceProvider property or,
  34      * if the property is not set, a platform specific default.
  35      *
  36      * Throws DOMUnsupportedException if the DOMService is not
  37      * available to the obj.
  38      *
  39      * @param obj Object to leverage the DOMService
  40      */
  41     public static DOMService getService(Object obj)
  42                   throws DOMUnsupportedException
  43     {
  44         try
  45         {
  46             String provider = (String) java.security.AccessController.doPrivileged(
  47                    new sun.security.action.GetPropertyAction("com.sun.java.browser.dom.DOMServiceProvider"));
  48 
  49             Class clazz = DOMService.class.forName("sun.plugin.dom.DOMService");
  50 
  51             return (DOMService) clazz.newInstance();
  52         }
  53         catch (Throwable e)
  54         {
  55             throw new DOMUnsupportedException(e.toString());
  56         }
  57     }
  58 
  59     /**
  60      * An empty constructor is provided. Implementations of this
  61      * abstract class must provide a public no-argument constructor
  62      * in order for the static getService() method to work correctly.
  63      * Application programmers should not be able to directly
  64      * construct implementation subclasses of this abstract subclass.
  65      */
  66     public DOMService()
  67     {
  68     }
  69 


   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 {
  30     /**
  31      * Returns new instance of a DOMService. The implementation
  32      * of the DOMService returns depends on the setting of the
  33      * com.sun.java.browser.dom.DOMServiceProvider property or,
  34      * if the property is not set, a platform specific default.
  35      *
  36      * Throws DOMUnsupportedException if the DOMService is not
  37      * available to the obj.
  38      *
  39      * @param obj Object to leverage the DOMService
  40      */
  41     public static DOMService getService(Object obj)
  42                   throws DOMUnsupportedException
  43     {
  44         try
  45         {
  46             String provider = (String) java.security.AccessController.doPrivileged(
  47                    new sun.security.action.GetPropertyAction("com.sun.java.browser.dom.DOMServiceProvider"));
  48 
  49             Class clazz = Class.forName("sun.plugin.dom.DOMService");
  50 
  51             return (DOMService) clazz.newInstance();
  52         }
  53         catch (Throwable e)
  54         {
  55             throw new DOMUnsupportedException(e.toString());
  56         }
  57     }
  58 
  59     /**
  60      * An empty constructor is provided. Implementations of this
  61      * abstract class must provide a public no-argument constructor
  62      * in order for the static getService() method to work correctly.
  63      * Application programmers should not be able to directly
  64      * construct implementation subclasses of this abstract subclass.
  65      */
  66     public DOMService()
  67     {
  68     }
  69