1 /* |
1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
41 |
41 |
42 /** |
42 /** |
43 * Build the profile information from ct.sym if exists. |
43 * Build the profile information from ct.sym if exists. |
44 */ |
44 */ |
45 enum Profile { |
45 enum Profile { |
46 |
|
47 COMPACT1("compact1", 1), |
46 COMPACT1("compact1", 1), |
48 COMPACT2("compact2", 2), |
47 COMPACT2("compact2", 2), |
49 COMPACT3("compact3", 3), |
48 COMPACT3("compact3", 3), |
50 FULL_JRE("Full JRE", 4); |
49 FULL_JRE("Full JRE", 4); |
51 |
50 |
59 this.profile = profile; |
58 this.profile = profile; |
60 this.packages = new HashSet<>(); |
59 this.packages = new HashSet<>(); |
61 this.proprietaryPkgs = new HashSet<>(); |
60 this.proprietaryPkgs = new HashSet<>(); |
62 } |
61 } |
63 |
62 |
64 @Override |
63 public String profileName() { |
65 public String toString() { |
|
66 return name; |
64 return name; |
67 } |
65 } |
68 |
66 |
69 public static int getProfileCount() { |
67 public static int getProfileCount() { |
70 return PackageToProfile.map.values().size(); |
68 return PackageToProfile.map.values().size(); |
75 * string if the given package is not in any profile. |
73 * string if the given package is not in any profile. |
76 */ |
74 */ |
77 public static Profile getProfile(String pn) { |
75 public static Profile getProfile(String pn) { |
78 Profile profile = PackageToProfile.map.get(pn); |
76 Profile profile = PackageToProfile.map.get(pn); |
79 return (profile != null && profile.packages.contains(pn)) |
77 return (profile != null && profile.packages.contains(pn)) |
80 ? profile : null; |
78 ? profile : null; |
81 } |
79 } |
82 |
80 |
83 static class PackageToProfile { |
81 static class PackageToProfile { |
84 static String[] JAVAX_CRYPTO_PKGS = new String[] { |
82 static String[] JAVAX_CRYPTO_PKGS = new String[] { |
85 "javax.crypto", |
83 "javax.crypto", |