01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)KeyStoreManagerFactory.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: /**
30: * KeyStoreManagerFactory.java
31: *
32: * SUN PROPRIETARY/CONFIDENTIAL.
33: * This software is the proprietary information of Sun Microsystems, Inc.
34: * Use is subject to license terms.
35: *
36: * Created on February 16, 2005, 5:16 PM
37: */package com.sun.jbi.internal.security.keymgt;
38:
39: /**
40: *
41: * @author Sun Microsystems, Inc.
42: */
43: public class KeyStoreManagerFactory {
44:
45: /**
46: * Create a KeyStoreManager instance.
47: *
48: * @param props - the name,value pairs which contain KeyStore data.
49: * @throws IllegalArgumentException if the properties contain a invalid value
50: * for example if Manager is defined to be seomething other than JavaStandard.
51: * @return a KeyStoreManager instance.
52: */
53: public static com.sun.jbi.internal.security.KeyStoreManager createKeyStoreManager(
54: java.util.Properties props) throws IllegalArgumentException {
55: String type = (String) props
56: .get(com.sun.jbi.internal.security.Constants.MANAGER);
57: if (type == null) {
58: type = com.sun.jbi.internal.security.KeyStoreManager.JAVA_STD;
59: }
60: com.sun.jbi.internal.security.KeyStoreManager mgr = null;
61:
62: KeyStoreManagerType mgrType = KeyStoreManagerType.valueOf(type);
63: if (mgrType.equals(KeyStoreManagerType.JAVA_STD)) {
64: mgr = new JavaStdKeyStoreManager();
65:
66: } else if (mgrType.equals(KeyStoreManagerType.SJSAS)) {
67: mgr = new AppSrvKeyStoreManager();
68: } else {
69: // -- In Shasta 1.0 this will never be called, since the type
70: // -- is always defined.
71: throw new IllegalArgumentException();
72: }
73: mgr.setType(type);
74: mgr.initialize(props);
75: return mgr;
76: }
77:
78: }
|