01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Boris V. Kuznetsov
20: * @version $Revision$
21: */package javax.net.ssl;
22:
23: import java.security.AccessController;
24: import java.security.Security;
25:
26: import javax.net.ServerSocketFactory;
27:
28: /**
29: * @com.intel.drl.spec_ref
30: *
31: */
32: public abstract class SSLServerSocketFactory extends
33: ServerSocketFactory {
34: // TODO EXPORT CONTROL
35:
36: // The default SSL socket factory
37: private static ServerSocketFactory defaultServerSocketFactory;
38:
39: private static String defaultName;
40:
41: protected SSLServerSocketFactory() {
42: super ();
43: }
44:
45: public static ServerSocketFactory getDefault() {
46: if (defaultServerSocketFactory != null) {
47: return defaultServerSocketFactory;
48: }
49: if (defaultName == null) {
50: AccessController
51: .doPrivileged(new java.security.PrivilegedAction() {
52: public Object run() {
53: defaultName = Security
54: .getProperty("ssl.ServerSocketFactory.provider");
55: if (defaultName != null) {
56: ClassLoader cl = Thread.currentThread()
57: .getContextClassLoader();
58: if (cl == null) {
59: cl = ClassLoader
60: .getSystemClassLoader();
61: }
62: try {
63: defaultServerSocketFactory = (ServerSocketFactory) Class
64: .forName(defaultName, true,
65: cl).newInstance();
66: } catch (Exception e) {
67: return e;
68: }
69: }
70: return null;
71: }
72: });
73: }
74: if (defaultServerSocketFactory == null) {
75: // Try to find in providers
76: SSLContext context = DefaultSSLContext.getContext();
77: if (context != null) {
78: defaultServerSocketFactory = context
79: .getServerSocketFactory();
80: }
81: }
82: if (defaultServerSocketFactory == null) {
83: // Use internal dummy implementation
84: defaultServerSocketFactory = new DefaultSSLServerSocketFactory(
85: "No ServerSocketFactory installed");
86: }
87: return defaultServerSocketFactory;
88: }
89:
90: public abstract String[] getDefaultCipherSuites();
91:
92: public abstract String[] getSupportedCipherSuites();
93:
94: }
|