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
113
114
115
116
117
118
119
120
121
122
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.certconfig;
import java.util.*;
import net.java.sip.communicator.service.certificate.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.osgi.framework.*;
/**
* OSGi Activator for the Certificate Configuration Advanced Form.
*
* @author Ingo Bauersachs
*/
public class CertConfigActivator
implements BundleActivator
{
/**
* Indicates if the cert configuration form should be disabled, i.e.
* not visible to the user.
*/
private static final String DISABLED_PROP
= "net.java.sip.communicator.plugin.certconfig.DISABLED";
private static BundleContext bundleContext;
static ResourceManagementService R;
public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put(ConfigurationForm.FORM_TYPE,
ConfigurationForm.ADVANCED_TYPE);
R = ServiceUtils.getService(bc, ResourceManagementService.class);
// Checks if the cert configuration form is disabled.
if(!getConfigService().getBoolean(DISABLED_PROP, false))
{
bc.registerService(ConfigurationForm.class.getName(),
new LazyConfigurationForm(
CertConfigPanel.class.getName(),
getClass().getClassLoader(),
null,
"plugin.certconfig.TITLE",
2000,
true),
properties
);
}
}
public void stop(BundleContext arg0) throws Exception
{
}
static BundleContext getBundleContext()
{
return bundleContext;
}
/**
* Returns a reference to a ConfigurationService implementation currently
* registered in the bundle context or null if no such implementation was
* found.
*
* @return a currently valid implementation of the ConfigurationService.
*/
public static ConfigurationService getConfigService()
{
return ServiceUtils.getService(bundleContext,
ConfigurationService.class);
}
/**
* Returns a reference to a CertificateService implementation currently
* registered in the bundle context or null if no such implementation was
* found.
*
* @return a currently valid implementation of the CertificateService.
*/
public static CertificateService getCertService()
{
return ServiceUtils.getService(bundleContext, CertificateService.class);
}
/**
* Returns a reference to a UIService implementation currently
* registered in the bundle context or null if no such implementation was
* found.
*
* @return a currently valid implementation of the UIService.
*/
public static UIService getUIService()
{
return ServiceUtils.getService(bundleContext, UIService.class);
}
/**
* Returns a reference to a CredentialsStorageService implementation
* currently registered in the bundle context or null if no such
* implementation was found.
*
* @return a currently valid implementation of the
* CredentialsStorageService.
*/
public static CredentialsStorageService getCredService()
{
return ServiceUtils.getService(bundleContext,
CredentialsStorageService.class);
}
}
|