jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/FastInfosetReflection.java
changeset 33547 e4c76ac38b12
parent 28326 2b9860c0d68a
equal deleted inserted replaced
33390:d131f4b8433a 33547:e4c76ac38b12
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    42 public class FastInfosetReflection {
    42 public class FastInfosetReflection {
    43 
    43 
    44     /**
    44     /**
    45      * FI DOMDocumentParser constructor using reflection.
    45      * FI DOMDocumentParser constructor using reflection.
    46      */
    46      */
    47     static Constructor fiDOMDocumentParser_new;
    47     static Constructor<?> fiDOMDocumentParser_new;
    48 
    48 
    49     /**
    49     /**
    50      * FI <code>DOMDocumentParser.parse()</code> method via reflection.
    50      * FI <code>DOMDocumentParser.parse()</code> method via reflection.
    51      */
    51      */
    52     static Method fiDOMDocumentParser_parse;
    52     static Method fiDOMDocumentParser_parse;
    53 
    53 
    54     /**
    54     /**
    55      * FI DOMDocumentSerializer constructor using reflection.
    55      * FI DOMDocumentSerializer constructor using reflection.
    56      */
    56      */
    57     static Constructor fiDOMDocumentSerializer_new;
    57     static Constructor<?> fiDOMDocumentSerializer_new;
    58 
    58 
    59     /**
    59     /**
    60      * FI <code>FastInfosetSource.serialize(Document)</code> method via reflection.
    60      * FI <code>FastInfosetSource.serialize(Document)</code> method via reflection.
    61      */
    61      */
    62     static Method fiDOMDocumentSerializer_serialize;
    62     static Method fiDOMDocumentSerializer_serialize;
    67     static Method fiDOMDocumentSerializer_setOutputStream;
    67     static Method fiDOMDocumentSerializer_setOutputStream;
    68 
    68 
    69     /**
    69     /**
    70      * FI FastInfosetSource constructor using reflection.
    70      * FI FastInfosetSource constructor using reflection.
    71      */
    71      */
    72     static Class fiFastInfosetSource_class;
    72     static Class<?> fiFastInfosetSource_class;
    73 
    73 
    74     /**
    74     /**
    75      * FI FastInfosetSource constructor using reflection.
    75      * FI FastInfosetSource constructor using reflection.
    76      */
    76      */
    77     static Constructor fiFastInfosetSource_new;
    77     static Constructor<?> fiFastInfosetSource_new;
    78 
    78 
    79     /**
    79     /**
    80      * FI <code>FastInfosetSource.getInputStream()</code> method via reflection.
    80      * FI <code>FastInfosetSource.getInputStream()</code> method via reflection.
    81      */
    81      */
    82     static Method fiFastInfosetSource_getInputStream;
    82     static Method fiFastInfosetSource_getInputStream;
    87     static Method fiFastInfosetSource_setInputStream;
    87     static Method fiFastInfosetSource_setInputStream;
    88 
    88 
    89     /**
    89     /**
    90      * FI FastInfosetResult constructor using reflection.
    90      * FI FastInfosetResult constructor using reflection.
    91      */
    91      */
    92     static Constructor fiFastInfosetResult_new;
    92     static Constructor<?> fiFastInfosetResult_new;
    93 
    93 
    94     /**
    94     /**
    95      * FI <code>FastInfosetResult.getOutputSTream()</code> method via reflection.
    95      * FI <code>FastInfosetResult.getOutputSTream()</code> method via reflection.
    96      */
    96      */
    97     static Method fiFastInfosetResult_getOutputStream;
    97     static Method fiFastInfosetResult_getOutputStream;
    98 
    98 
    99     static {
    99     static {
   100         try {
   100         try {
   101             Class clazz = Class.forName("com.sun.xml.internal.fastinfoset.dom.DOMDocumentParser");
   101             Class<?> clazz = Class.forName("com.sun.xml.internal.fastinfoset.dom.DOMDocumentParser");
   102             fiDOMDocumentParser_new = clazz.getConstructor((Class[]) null);
   102             fiDOMDocumentParser_new = clazz.getConstructor((Class[]) null);
   103             fiDOMDocumentParser_parse = clazz.getMethod("parse",
   103             fiDOMDocumentParser_parse = clazz.getMethod("parse",
   104                 new Class[] { org.w3c.dom.Document.class, java.io.InputStream.class });
   104                 new Class[] { org.w3c.dom.Document.class, java.io.InputStream.class });
   105 
   105 
   106             clazz = Class.forName("com.sun.xml.internal.fastinfoset.dom.DOMDocumentSerializer");
   106             clazz = Class.forName("com.sun.xml.internal.fastinfoset.dom.DOMDocumentSerializer");
   177     public static boolean isFastInfosetSource(Source source) {
   177     public static boolean isFastInfosetSource(Source source) {
   178         return source.getClass().getName().equals(
   178         return source.getClass().getName().equals(
   179             "com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetSource");
   179             "com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetSource");
   180     }
   180     }
   181 
   181 
   182     public static Class getFastInfosetSource_class() {
   182     public static Class<?> getFastInfosetSource_class() {
   183         if (fiFastInfosetSource_class == null) {
   183         if (fiFastInfosetSource_class == null) {
   184             throw new RuntimeException("Unable to locate Fast Infoset implementation");
   184             throw new RuntimeException("Unable to locate Fast Infoset implementation");
   185         }
   185         }
   186 
   186 
   187         return fiFastInfosetSource_class;
   187         return fiFastInfosetSource_class;