author | eosterlund |
Mon, 29 Jul 2019 13:57:54 +0200 | |
changeset 57582 | a79a819a8218 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
1 |
/* |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
4 |
* |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
10 |
* |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
15 |
* accompanied this code). |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
16 |
* |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
20 |
* |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
23 |
* questions. |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
24 |
*/ |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
25 |
|
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
26 |
package com.oracle.security.ucrypto; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
27 |
|
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
28 |
import java.util.*; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
29 |
|
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
30 |
/** |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
31 |
* Class for encapsulating the type, algorithm, and class name of |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
32 |
* a Provider.Service object. |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
33 |
*/ |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
34 |
final class ServiceDesc { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
35 |
|
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
36 |
private final String type; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
37 |
private final String algo; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
38 |
private final String cn; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
39 |
private final List<String> aliases; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
40 |
|
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
41 |
ServiceDesc(String type, String algo, String cn) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
42 |
this(type, algo, cn, null); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
43 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
44 |
|
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
45 |
ServiceDesc(String type, String algo, String cn, String[] aliases) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
46 |
this.type = type; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
47 |
this.algo = algo; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
48 |
this.cn = cn; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
49 |
if (aliases != null) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
50 |
this.aliases = Arrays.asList(aliases); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
51 |
} else { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
52 |
this.aliases = null; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
53 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
54 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
55 |
String getType() { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
56 |
return type; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
57 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
58 |
String getAlgorithm() { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
59 |
return algo; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
60 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
61 |
String getClassName() { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
62 |
return cn; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
63 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
64 |
List<String> getAliases() { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
65 |
return aliases; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
66 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
67 |
public String toString() { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
68 |
return type + "." + algo + ": " + cn + ", aliases =" + aliases; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
69 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
diff
changeset
|
70 |
} |