Activator.java
1.74 KB
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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.osgi.framework.Bundle
* org.osgi.framework.BundleActivator
* org.osgi.framework.BundleContext
* org.osgi.framework.ServiceRegistration
* org.osgi.service.cm.ManagedService
*/
package com.day.commons.httpclient.impl;
import com.day.commons.httpclient.impl.ProxyWrapper;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.auth.AuthPolicy;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ManagedService;
public class Activator
extends ProxyWrapper
implements BundleActivator,
ManagedService {
private ServiceRegistration configurator;
public void start(BundleContext context) throws Exception {
AuthPolicy.unregisterAuthScheme("NTLM");
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("service.pid", "com.day.commons.httpclient");
props.put("service.vendor", context.getBundle().getHeaders("Bundle-Vendor"));
props.put("service.description", "Day Commons HTTP Client Configurator");
this.configurator = context.registerService(ManagedService.class.getName(), (Object)this, props);
}
public void stop(BundleContext context) throws Exception {
if (this.configurator != null) {
this.configurator.unregister();
}
MultiThreadedHttpConnectionManager.shutdownAll();
this.setupProxies(null);
}
public void updated(Dictionary properties) {
this.setupProxies(properties);
}
}