View Javadoc
1   /**
2    * This Source Code Form is subject to the terms of the Mozilla Public
3    * License, v. 2.0. If a copy of the MPL was not distributed with this
4    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5    *
6    * If it is not possible or desirable to put the notice in a particular
7    * file, then You may include the notice in a location (such as a LICENSE
8    * file in a relevant directory) where a recipient would be likely to look
9    * for such a notice.
10  
11   * 
12   */
13   
14  /*  ---------------------------------------------------------------------------
15   *  U.S. Government, Department of the Army
16   *  Army Materiel Command
17   *  Research Development Engineering Command
18   *  Communications Electronics Research Development and Engineering Center
19   *  ---------------------------------------------------------------------------
20   */
21  
22  package org.miloss.fgsms.agentcore;
23  
24  import org.miloss.fgsms.common.Constants;
25  import org.apache.log4j.Level;
26  import org.miloss.fgsms.common.Logger;
27  
28  /**
29   * Detects the presence of an Apache CXF stack, if present, adds SSL
30   * context information
31   *
32   * @author AO
33   */
34  public class ApacheCxfSslHelper {
35  
36      private static final Logger log = Logger.getLogger(org.miloss.fgsms.common.Constants.LoggerName);
37  
38      public static void doCXF(Object webserviceclient, ConfigLoader cfg) {
39  
40          try {
41              //first, check to see if the cxf stack is present
42              Class<?> loadClass = Thread.currentThread().getContextClassLoader().loadClass("org.apache.cxf.transport.http.HTTPConduit");
43              if (loadClass == null) {
44                  return;
45              }
46              Class<?> loadClass2 = Thread.currentThread().getContextClassLoader().loadClass("org.apache.cxf.common.i18n.UncheckedException");
47              if (loadClass2 == null) {
48                  return;
49              }
50              log.log(Level.INFO, "CXF stack detected, adding SSL information");
51              //ok it's available
52              ApacheCxfSSlHelperGo.doCXF(webserviceclient, cfg);
53          } catch (ClassNotFoundException ex) {
54              log.log(Level.DEBUG, "CXF stack not found, most likely this is ignorable", ex);
55          } catch (NoClassDefFoundError ex) {
56              log.log(Level.DEBUG, "CXF stack not found, most likely this is ignorable", ex);
57  
58          }
59      }
60  }