KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > jetty6 > connector > GeronimoSSLListener


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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 package org.apache.geronimo.jetty6.connector;
18
19 import org.mortbay.jetty.security.SslSocketConnector;
20 import org.apache.geronimo.management.geronimo.KeystoreManager;
21
22 import javax.net.ssl.SSLServerSocketFactory;
23
24 /**
25  * SSL listener that hooks into the Geronimo keystore infrastructure.
26  *
27  * @version $Rev: 482336 $ $Date: 2006-12-04 15:12:19 -0500 (Mon, 04 Dec 2006) $
28  */

29 public class GeronimoSSLListener extends SslSocketConnector {
30     private KeystoreManager manager;
31     private String JavaDoc keyStore;
32     private String JavaDoc trustStore;
33     private String JavaDoc keyAlias;
34
35     public GeronimoSSLListener(KeystoreManager manager) {
36         this.manager = manager;
37     }
38
39     protected SSLServerSocketFactory createFactory() throws Exception JavaDoc {
40         // we need the server factory version.
41
return manager.createSSLServerFactory(null, getProtocol(), getSslKeyManagerFactoryAlgorithm(), keyStore, keyAlias, trustStore, SslSocketConnector.class.getClassLoader());
42     }
43
44     public String JavaDoc getKeyStore() {
45         return keyStore;
46     }
47
48     public void setKeyStore(String JavaDoc keyStore) {
49         this.keyStore = keyStore;
50     }
51
52     public String JavaDoc getTrustStore() {
53         return trustStore;
54     }
55
56     public void setTrustStore(String JavaDoc trustStore) {
57         this.trustStore = trustStore;
58     }
59
60     public String JavaDoc getKeyAlias() {
61         return keyAlias;
62     }
63
64     public void setKeyAlias(String JavaDoc keyAlias) {
65         this.keyAlias = keyAlias;
66     }
67 }
68
Popular Tags