cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1306188 - /cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
Date Wed, 28 Mar 2012 07:10:54 GMT
Author: ffang
Date: Wed Mar 28 07:10:54 2012
New Revision: 1306188

URL: http://svn.apache.org/viewvc?rev=1306188&view=rev
Log:
break big createTlsServerParameters method into small method to make checkstyle happy

Modified:
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java?rev=1306188&r1=1306187&r2=1306188&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/osgi/HTTPJettyTransportActivator.java
Wed Mar 28 07:10:54 2012
@@ -199,57 +199,11 @@ public class HTTPJettyTransportActivator
                     }
                     p.getClientAuthentication().setRequired(Boolean.parseBoolean(v));
                 } else if (k.startsWith("certConstraints.")) {
-                    k = k.substring("certConstraints.".length());
-                    CertificateConstraintsType cct = p.getCertConstraints();
-                    if (cct == null) {
-                        cct = new CertificateConstraintsType();
-                        p.setCertConstraints(cct);
-                    }
-                    DNConstraintsType dnct = null;
-                    if (k.startsWith("SubjectDNConstraints.")) {
-                        dnct = cct.getSubjectDNConstraints();
-                        if (dnct == null) {
-                            dnct = new DNConstraintsType();
-                            cct.setSubjectDNConstraints(dnct);
-                        }
-                        k = k.substring("SubjectDNConstraints.".length());
-                    } else if (k.startsWith("IssuerDNConstraints.")) {
-                        dnct = cct.getIssuerDNConstraints();
-                        if (dnct == null) {
-                            dnct = new DNConstraintsType();
-                            cct.setIssuerDNConstraints(dnct);
-                        }
-                        k = k.substring("IssuerDNConstraints.".length());
-                    }
-                    if (dnct != null) {
-                        if ("combinator".equals(k)) {
-                            dnct.setCombinator(CombinatorType.fromValue(v));
-                        } else if ("RegularExpression".equals(k)) {
-                            dnct.getRegularExpression().add(k);
-                        }
-                    }
+                    configureCertConstraints(p, k, v);
                 } else if (k.startsWith("secureRandomParameters.")) {
-                    k = k.substring("secureRandomParameters.".length());
-                    if (srp == null) {
-                        srp = new SecureRandomParameters();
-                    }
-                    if ("algorithm".equals(k)) {
-                        srp.setAlgorithm(v);
-                    } else if ("provider".equals(k)) {
-                        srp.setProvider(v);
-                    }
+                    srp = configureSecureRandom(srp, k, v);
                 } else if (k.startsWith("cipherSuitesFilter.")) {
-                    k = k.substring("cipherSuitesFilter.".length());
-                    StringTokenizer st = new StringTokenizer(v, ",");
-                    FiltersType ft = p.getCipherSuitesFilter();
-                    if (ft == null) {
-                        ft = new FiltersType();
-                        p.setCipherSuitesFilter(ft);
-                    }
-                    List<String> lst = "include".equals(k) ? ft.getInclude() : ft.getExclude();
-                    while (st.hasMoreTokens()) {
-                        lst.add(st.nextToken());
-                    }
+                    configureCipherSuitesFilter(p, k, v);
                 } else if (k.startsWith("cipherSuites")) {
                     StringTokenizer st = new StringTokenizer(v, ",");
                     while (st.hasMoreTokens()) {
@@ -285,6 +239,65 @@ public class HTTPJettyTransportActivator
         return p;
     }
 
+    private void configureCipherSuitesFilter(TLSServerParameters p, String k, String v) {
+        k = k.substring("cipherSuitesFilter.".length());
+        StringTokenizer st = new StringTokenizer(v, ",");
+        FiltersType ft = p.getCipherSuitesFilter();
+        if (ft == null) {
+            ft = new FiltersType();
+            p.setCipherSuitesFilter(ft);
+        }
+        List<String> lst = "include".equals(k) ? ft.getInclude() : ft.getExclude();
+        while (st.hasMoreTokens()) {
+            lst.add(st.nextToken());
+        }
+    }
+
+    private SecureRandomParameters configureSecureRandom(SecureRandomParameters srp, String
k, String v) {
+        k = k.substring("secureRandomParameters.".length());
+        if (srp == null) {
+            srp = new SecureRandomParameters();
+        }
+        if ("algorithm".equals(k)) {
+            srp.setAlgorithm(v);
+        } else if ("provider".equals(k)) {
+            srp.setProvider(v);
+        }
+        return srp;
+    }
+
+    private void configureCertConstraints(TLSServerParameters p, String k, String v) {
+        k = k.substring("certConstraints.".length());
+        CertificateConstraintsType cct = p.getCertConstraints();
+        if (cct == null) {
+            cct = new CertificateConstraintsType();
+            p.setCertConstraints(cct);
+        }
+        DNConstraintsType dnct = null;
+        if (k.startsWith("SubjectDNConstraints.")) {
+            dnct = cct.getSubjectDNConstraints();
+            if (dnct == null) {
+                dnct = new DNConstraintsType();
+                cct.setSubjectDNConstraints(dnct);
+            }
+            k = k.substring("SubjectDNConstraints.".length());
+        } else if (k.startsWith("IssuerDNConstraints.")) {
+            dnct = cct.getIssuerDNConstraints();
+            if (dnct == null) {
+                dnct = new DNConstraintsType();
+                cct.setIssuerDNConstraints(dnct);
+            }
+            k = k.substring("IssuerDNConstraints.".length());
+        }
+        if (dnct != null) {
+            if ("combinator".equals(k)) {
+                dnct.setCombinator(CombinatorType.fromValue(v));
+            } else if ("RegularExpression".equals(k)) {
+                dnct.getRegularExpression().add(k);
+            }
+        }
+    }
+
     private KeyManagersType getKeyManagers(KeyManagersType keyManagers, String k, String
v) {
         if (keyManagers == null) {
             keyManagers = new KeyManagersType();



Mime
View raw message