< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2016, 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


 329 
 330         /**
 331      * utility method to load classes
 332      * @param className the name of the class to load
 333      * @param errorMessage
 334      *      Error message to use when the resolution fails.
 335      * @return the class specified by <code>className</code>
 336      */
 337     private Class getClass(String className, Localizable errorMessage) {
 338         try {
 339             if (classLoader == null)
 340                 return Thread.currentThread().getContextClassLoader().loadClass(className);
 341             else
 342                 return classLoader.loadClass(className);
 343         } catch (ClassNotFoundException e) {
 344             throw new RuntimeModelerException(errorMessage);
 345         }
 346     }
 347 
 348     private boolean noWrapperGen() {
 349         if (Runtime.version().major() >= 9) return true;
 350         Object o = config.properties().get(SuppressDocLitWrapperGeneration);
 351         return (o!= null && o instanceof Boolean) ? ((Boolean) o) : false;
 352     }
 353 
 354     private Class getRequestWrapperClass(String className, Method method, QName reqElemName) {
 355         ClassLoader loader =  (classLoader == null) ? Thread.currentThread().getContextClassLoader() : classLoader;
 356         try {
 357             return loader.loadClass(className);
 358         } catch (ClassNotFoundException e) {
 359             if (noWrapperGen()) return WrapperComposite.class;
 360             logger.fine("Dynamically creating request wrapper Class " + className);
 361             return WrapperBeanGenerator.createRequestWrapperBean(className, method, reqElemName, loader);
 362         }
 363     }
 364 
 365     private Class getResponseWrapperClass(String className, Method method, QName resElemName) {
 366         ClassLoader loader =  (classLoader == null) ? Thread.currentThread().getContextClassLoader() : classLoader;
 367         try {
 368             return loader.loadClass(className);
 369         } catch (ClassNotFoundException e) {


   1 /*
   2  * Copyright (c) 1997, 2017, 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


 329 
 330         /**
 331      * utility method to load classes
 332      * @param className the name of the class to load
 333      * @param errorMessage
 334      *      Error message to use when the resolution fails.
 335      * @return the class specified by <code>className</code>
 336      */
 337     private Class getClass(String className, Localizable errorMessage) {
 338         try {
 339             if (classLoader == null)
 340                 return Thread.currentThread().getContextClassLoader().loadClass(className);
 341             else
 342                 return classLoader.loadClass(className);
 343         } catch (ClassNotFoundException e) {
 344             throw new RuntimeModelerException(errorMessage);
 345         }
 346     }
 347 
 348     private boolean noWrapperGen() {

 349         Object o = config.properties().get(SuppressDocLitWrapperGeneration);
 350         return (o!= null && o instanceof Boolean) ? ((Boolean) o) : false;
 351     }
 352 
 353     private Class getRequestWrapperClass(String className, Method method, QName reqElemName) {
 354         ClassLoader loader =  (classLoader == null) ? Thread.currentThread().getContextClassLoader() : classLoader;
 355         try {
 356             return loader.loadClass(className);
 357         } catch (ClassNotFoundException e) {
 358             if (noWrapperGen()) return WrapperComposite.class;
 359             logger.fine("Dynamically creating request wrapper Class " + className);
 360             return WrapperBeanGenerator.createRequestWrapperBean(className, method, reqElemName, loader);
 361         }
 362     }
 363 
 364     private Class getResponseWrapperClass(String className, Method method, QName resElemName) {
 365         ClassLoader loader =  (classLoader == null) ? Thread.currentThread().getContextClassLoader() : classLoader;
 366         try {
 367             return loader.loadClass(className);
 368         } catch (ClassNotFoundException e) {


< prev index next >