/
NegoziazioneTokenDynamicParametersModIUtils.java
112 lines (106 loc) · 3.68 KB
/
NegoziazioneTokenDynamicParametersModIUtils.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* GovWay - A customizable API Gateway
* https://govway.org
*
* Copyright (c) 2005-2023 Link.it srl (https://link.it).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.openspcoop2.pdd.core.token;
import java.lang.reflect.Method;
import org.openspcoop2.protocol.sdk.ProtocolException;
import org.openspcoop2.protocol.utils.ModIUtils;
/**
* NegoziazioneTokenDynamicParametersModIUtils
*
* @author Poli Andrea (apoli@link.it)
* @author $Author$
* @version $Rev$, $Date$
*/
public class NegoziazioneTokenDynamicParametersModIUtils {
private NegoziazioneTokenDynamicParametersModIUtils() {}
private static Object modIProperties = null;
private static synchronized void initModiProperties() throws ProtocolException {
if(modIProperties==null) {
try {
modIProperties = ModIUtils.getModiProperties();
}catch(Exception e) {
throw new ProtocolException(e.getMessage(),e);
}
}
}
private static Object getModiProperties() throws ProtocolException {
if(modIProperties==null) {
initModiProperties();
}
return modIProperties;
}
public static String getSicurezzaMessaggioCertificatiKeyStoreTipo() throws ProtocolException {
try {
Object instance = getModiProperties();
Method m = instance.getClass().getMethod("getSicurezzaMessaggioCertificatiKeyStoreTipo");
return (String) m.invoke(instance);
}catch(Exception e) {
throw new ProtocolException(e.getMessage(),e);
}
}
public static String getSicurezzaMessaggioCertificatiKeyStorePath() throws ProtocolException {
try {
if(getSicurezzaMessaggioCertificatiKeyStoreTipo()!=null) {
Object instance = getModiProperties();
Method m = instance.getClass().getMethod("getSicurezzaMessaggioCertificatiKeyStorePath");
return (String) m.invoke(instance);
}
return null;
}catch(Exception e) {
throw new ProtocolException(e.getMessage(),e);
}
}
public static String getSicurezzaMessaggioCertificatiKeyStorePassword() throws ProtocolException {
try {
if(getSicurezzaMessaggioCertificatiKeyStoreTipo()!=null) {
Object instance = getModiProperties();
Method m = instance.getClass().getMethod("getSicurezzaMessaggioCertificatiKeyStorePassword");
return (String) m.invoke(instance);
}
return null;
}catch(Exception e) {
throw new ProtocolException(e.getMessage(),e);
}
}
public static String getSicurezzaMessaggioCertificatiKeyAlias() throws ProtocolException {
try {
if(getSicurezzaMessaggioCertificatiKeyStoreTipo()!=null) {
Object instance = getModiProperties();
Method m = instance.getClass().getMethod("getSicurezzaMessaggioCertificatiKeyAlias");
return (String) m.invoke(instance);
}
return null;
}catch(Exception e) {
throw new ProtocolException(e.getMessage(),e);
}
}
public static String getSicurezzaMessaggioCertificatiKeyPassword() throws ProtocolException {
try {
if(getSicurezzaMessaggioCertificatiKeyStoreTipo()!=null) {
Object instance = getModiProperties();
Method m = instance.getClass().getMethod("getSicurezzaMessaggioCertificatiKeyPassword");
return (String) m.invoke(instance);
}
return null;
}catch(Exception e) {
throw new ProtocolException(e.getMessage(),e);
}
}
}