Add provisioning via mDNS (Bonjour).

cusax-fix
Sebastien Vincent 15 years ago
parent 549cc87c86
commit 4930d5be2a

@ -895,7 +895,7 @@
bundle-fileaccess-slick,bundle-neomedia,bundle-hid,
bundle-resource-manager,bundle-resources-defaultpack,
bundle-protocol,bundle-protocol-media,bundle-icq,
bundle-icq-slick,bundle-mock,bundle-smacklib,
bundle-icq-slick,bundle-mock,bundle-smacklib,bundle-jmdnslib,
bundle-jabber,bundle-jabber-slick,bundle-swing-ui,bundle-ui-service,
bundle-msn,bundle-msn-slick,bundle-yahoo,bundle-yahoo-slick,
bundle-contactlist,meta-contactlist,meta-contactlist-slick,
@ -932,7 +932,7 @@
bundle-vimeo,bundle-vbox7,bundle-metacafe,bundle-flickr,bundle-hulu,
bundle-twitpic,bundle-directimage,bundle-bliptv,bundle-viddler,
bundle-plugin-chatconfig,bundle-certificate,
bundle-provdisc,bundle-provdisc-dhcp,
bundle-provdisc,bundle-provdisc-dhcp,bundle-provdisc-mdns,
bundle-provisioning"/>
<!--BUNDLE-SC-LAUNCHER-->
@ -1336,6 +1336,14 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
<target name="bundle-jmdnslib">
<!-- Creates a bundle containing the jmdns lib.-->
<jar compress="false" destfile="${bundles.dest}/jmdnslib.jar"
manifest="${lib.noinst}/jmdns.manifest.mf">
<zipfileset src="${lib.noinst}/jmdns.jar" prefix=""/>
</jar>
</target>
<!-- BUNDLE-ICQ -->
<target name="bundle-icq">
<!-- Creates a bundle containing the icq impl of the protocol provider.-->
@ -2548,6 +2556,15 @@ org.apache.http.util"/>
</jar>
</target>
<!--BUNDLE-PROVDISC-MDNS -->
<target name="bundle-provdisc-mdns">
<jar compress="false" destfile="${bundles.dest}/provdisc-mdns.jar"
manifest="${src}/net/java/sip/communicator/impl/provdisc/mdns/mdns.provdisc.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/impl/provdisc/mdns"
prefix="net/java/sip/communicator/impl/provdisc/mdns" />
</jar>
</target>
<!--BUNDLE-PROVISIONING -->
<target name="bundle-provisioning">
<jar compress="false" destfile="${bundles.dest}/provisioning.jar"

@ -12,6 +12,7 @@
<classpathentry kind="lib" path="lib/installer-exclude/concurrent.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/dict4j.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/dhcp4java-1.00.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jmdns.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/dnsjava-2.0.3.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/fmj.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/httpclient-4.0.1.jar"/>

@ -123,7 +123,7 @@
<compilation-unit>
<package-root>src</package-root>
<classpath
mode="compile">lib/felix.jar:lib/jdic-all.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/bundle/commons-logging.jar:lib/installer-exclude/concurrent.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava-2.0.3.jar:lib/installer-exclude/jain-sip-api.jar:lib/installer-exclude/jain-sip-ri.jar:lib/installer-exclude/jain-sdp.jar:lib/installer-exclude/jcalendar-1.3.2.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jmf.jar:lib/installer-exclude/jml-1.0b5.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/ymsg_network_v0_67.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/os-specific/linux/installer-exclude/jmf.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/OrangeExtensions.jar:lib/os-specific/mac/growl4j.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/installer-exclude/jmf.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jmf.jar:lib/os-specific/windows/installer-exclude/sound.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/pircbot.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/solaris/installer-exclude/jmf.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/izpack-shortcut-link.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/zrtp4j-light.jar:lib/installer-exclude/lcrypto-jdk16-143.jar:lib/installer-exclude/otr4j.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar:lib/installer-exclude/httpcore-4.0.1.jar:lib/installer-exclude/httpclient-4.0.1.jar:lib/installer-exclude/json-20090723.jar:lib/installer-exclude/ice4j.jar:lib/installer-exclude/dhcp4java-1.00.jar</classpath>
mode="compile">lib/felix.jar:lib/jdic-all.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/bundle/commons-logging.jar:lib/installer-exclude/concurrent.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava-2.0.3.jar:lib/installer-exclude/jain-sip-api.jar:lib/installer-exclude/jain-sip-ri.jar:lib/installer-exclude/jain-sdp.jar:lib/installer-exclude/jcalendar-1.3.2.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jmf.jar:lib/installer-exclude/jml-1.0b5.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/ymsg_network_v0_67.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/os-specific/linux/installer-exclude/jmf.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/OrangeExtensions.jar:lib/os-specific/mac/growl4j.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/installer-exclude/jmf.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jmf.jar:lib/os-specific/windows/installer-exclude/sound.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/pircbot.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/solaris/installer-exclude/jmf.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/izpack-shortcut-link.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/zrtp4j-light.jar:lib/installer-exclude/lcrypto-jdk16-143.jar:lib/installer-exclude/otr4j.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar:lib/installer-exclude/httpcore-4.0.1.jar:lib/installer-exclude/httpclient-4.0.1.jar:lib/installer-exclude/json-20090723.jar:lib/installer-exclude/ice4j.jar:lib/installer-exclude/dhcp4java-1.00.jar:lib/installer-exclude/jmdns.jar</classpath>
<built-to>classes</built-to>
<source-level>1.5</source-level>
</compilation-unit>

@ -38,6 +38,7 @@ felix.auto.start.30= \
felix.auto.start.40= \
reference:file:sc-bundles/configuration.jar \
reference:file:sc-bundles/jmdnslib.jar \
reference:file:sc-bundles/provdisc.jar \
reference:file:sc-bundles/resourcemanager.jar \
reference:file:sc-bundles/jfontchooserlib.jar \
@ -55,6 +56,7 @@ felix.auto.start.45= \
reference:file:sc-bundles/version-impl.jar \
reference:file:sc-bundles/branding.jar \
reference:file:sc-bundles/provdisc-dhcp.jar \
reference:file:sc-bundles/provdisc-mdns.jar \
reference:file:sc-bundles/certificate.jar
felix.auto.start.49= \

Binary file not shown.

@ -0,0 +1,8 @@
Bundle-Name: JmDNS Lib Provider
Bundle-Description: JmDNS Lib Provider
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Export-Package:
javax.jmdns,

@ -19,30 +19,33 @@
public class ProtocolProviderServiceZeroconfImpl
extends AbstractProtocolProviderService
{
/**
* The logger for this class.
*/
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceZeroconfImpl.class);
/**
* We use this to lock access to initialization.
*/
private final Object initializationLock = new Object();
/**
* The id of the account that this protocol provider represents.
*/
private AccountID accountID = null;
/**
* Indicates whether or not the provider is initialized and ready for use.
*/
private boolean isInitialized = false;
/**
* The logo corresponding to the zeroconf protocol.
*/
private final ProtocolIconZeroconfImpl zeroconfIcon
= new ProtocolIconZeroconfImpl();
/**
* The registration state that we are currently in. Note that in a real
* world protocol implementation this field won't exist and the registration
@ -50,13 +53,13 @@ public class ProtocolProviderServiceZeroconfImpl
*/
private RegistrationState currentRegistrationState
= RegistrationState.UNREGISTERED;
/**
* The BonjourService corresponding to this ProtocolProviderService
*/
private BonjourService bonjourService;
/**
* The default constructor for the Zeroconf protocol provider.
*/
@ -65,7 +68,7 @@ public ProtocolProviderServiceZeroconfImpl()
if (logger.isTraceEnabled())
logger.trace("Creating a zeroconf provider.");
}
/**
* Returns the AccountID that uniquely identifies the account represented
* by this instance of the ProtocolProviderService.
@ -76,18 +79,17 @@ public AccountID getAccountID()
{
return accountID;
}
/**
* Returns the Bonjour Service that handles the Bonjour protocol stack.
*
*
*@return the Bonjour Service linked with this Protocol Provider
*/
public BonjourService getBonjourService()
public BonjourService getBonjourService()
{
return bonjourService;
}
/**
* Initializes the service implementation, and puts it in a sate where it
* could interoperate with other services. It is strongly recomended that
@ -108,7 +110,7 @@ protected void initialize(String userID,
{
this.accountID = accountID;
//initialize the presence operationset
OperationSetPersistentPresenceZeroconfImpl persistentPresence =
new OperationSetPersistentPresenceZeroconfImpl(this);
@ -163,7 +165,7 @@ public RegistrationState getRegistrationState()
{
return currentRegistrationState;
}
/**
* Starts the registration process.
*
@ -183,21 +185,21 @@ public void register(SecurityAuthority authority)
RegistrationState oldState = currentRegistrationState;
currentRegistrationState = RegistrationState.REGISTERED;
//ICI : creer le service Zeroconf !!
if (logger.isInfoEnabled())
logger.info("ZEROCONF: Starting the service");
this.bonjourService = new BonjourService(5298, this);
//bonjourService.changeStatus(ZeroconfStatusEnum.ONLINE);
fireRegistrationStateChanged(
oldState
, currentRegistrationState
, RegistrationStateChangeEvent.REASON_USER_REQUEST
, null);
}
/**
* Makes the service implementation close all open sockets and release
* any resources that it might have taken and prepare for
@ -231,7 +233,7 @@ public void shutdown()
isInitialized = false;
}
/**
* Ends the registration of this protocol provider with the current
* registration service.
@ -247,20 +249,20 @@ public void unregister()
currentRegistrationState = RegistrationState.UNREGISTERED;
bonjourService.shutdown();
fireRegistrationStateChanged(
oldState
, currentRegistrationState
, RegistrationStateChangeEvent.REASON_USER_REQUEST
, null);
}
/**
* Returns the zeroconf protocol icon.
* @return the zeroconf protocol icon
*/
public ProtocolIcon getProtocolIcon()
{
{
return zeroconfIcon;
}
}

@ -29,6 +29,11 @@ public class DHCPProvisioningDiscover
private final Logger logger
= Logger.getLogger(DHCPProvisioningDiscover.class);
/**
* DHCP socket timeout (in milliseconds).
*/
private static final int DHCP_TIMEOUT = 10000;
/**
* UDP socket.
*/
@ -50,10 +55,6 @@ public class DHCPProvisioningDiscover
*/
private byte option = (byte)224;
/**
* DHCP socket timeout (in milliseconds).
*/
private static final int DHCP_TIMEOUT = 10000;
/**
* List of <tt>ProvisioningListener</tt> that will be notified when

@ -71,7 +71,7 @@ public DHCPTransaction(DatagramSocket sock, DatagramPacket message)
/**
* Schedule a timer for retransmission.
*
* @throw Exception if message cannot be sent on the socket
* @throws Exception if message cannot be sent on the socket
*/
public void schedule() throws Exception
{
@ -118,6 +118,9 @@ public void setInterval(int interval)
private class RetransmissionHandler
extends TimerTask
{
/**
* Thread entry point.
*/
public void run()
{
int rand = new Random().nextInt(2) - 1;

@ -21,7 +21,7 @@ public class ProvisioningDiscoveryDHCPActivator
implements BundleActivator
{
/**
* <tt>Logger</tt> used by this <tt>DHCPProvisioningDiscoveryActivator</tt>
* <tt>Logger</tt> used by this <tt>ProvisioningDiscoveryDHCPActivator</tt>
* instance for logging output.
*/
private final Logger logger

@ -0,0 +1,168 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.provdisc.mdns;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.service.provdisc.event.*;
import net.java.sip.communicator.util.*;
import javax.jmdns.*;
/**
* Class that will perform mDNS provisioning discovery.
*
* @author Sebastien Vincent
*/
public class MDNSProvisioningDiscover
implements Runnable
{
/**
* Logger.
*/
private final Logger logger
= Logger.getLogger(MDNSProvisioningDiscover.class);
/**
* MDNS timeout (in milliseconds).
*/
private static final int MDNS_TIMEOUT = 2000;
/**
* List of <tt>ProvisioningListener</tt> that will be notified when
* a provisioning URL is retrieved.
*/
private List<DiscoveryListener> listeners =
new ArrayList<DiscoveryListener>();
/**
* Reference to JmDNS singleton.
*/
private JmDNS jmdns = null;
/**
* Constructor.
*/
public MDNSProvisioningDiscover()
{
try
{
jmdns = JmDNS.create();
}
catch(IOException e)
{
logger.info("Failed to create mDNS", e);
}
}
/**
* Thread entry point. It runs <tt>discoverProvisioningURL</tt> in a
* separate thread.
*/
public void run()
{
String url = discoverProvisioningURL();
if(url != null)
{
/* as we run in an asynchronous manner, notify the listener */
DiscoveryEvent evt = new DiscoveryEvent(this, url);
for(DiscoveryListener listener : listeners)
{
listener.notifyProvisioningURL(evt);
}
}
}
/**
* It sends a mDNS to retrieve provisioning URL and wait for a response.
* Thread stops after first successful answer that contains the provisioning
* URL.
*
* @return provisioning URL or null if no provisioning URL was discovered
*/
public String discoverProvisioningURL()
{
StringBuffer url = new StringBuffer();
ServiceInfo info = jmdns.getServiceInfo("_https._tcp.local",
"Provisioning URL", MDNS_TIMEOUT);
if(info == null)
{
/* try HTTP */
info = jmdns.getServiceInfo("_http._tcp.local", "Provisioning URL",
MDNS_TIMEOUT);
}
if(info != null && info.getName().equals("Provisioning URL"))
{
String protocol = info.getApplication();
url.append(info.getURL(protocol));
Enumeration<String> en = info.getPropertyNames();
if(en.hasMoreElements())
{
url.append("?");
}
/* add the parameters */
while(en.hasMoreElements())
{
String tmp = en.nextElement();
/* take all other parameters except "path" */
if(tmp.equals("path"))
{
continue;
}
url.append(tmp);
url.append("=");
url.append(info.getPropertyString(tmp));
if(en.hasMoreElements())
{
url.append("&");
}
}
}
return (url.toString().length() > 0) ? url.toString() : null;
}
/**
* Add a listener that will be notified when the
* <tt>discoverProvisioningURL</tt> has finished.
*
* @param listener <tt>ProvisioningListener</tt> to add
*/
public void addDiscoveryListener(DiscoveryListener listener)
{
if(!listeners.contains(listener))
{
listeners.add(listener);
}
}
/**
* Add a listener that will be notified when the
* <tt>discoverProvisioningURL</tt> has finished.
*
* @param listener <tt>ProvisioningListener</tt> to add
*/
public void removeDiscoveryListener(DiscoveryListener listener)
{
if(listeners.contains(listener))
{
listeners.remove(listener);
}
}
}

@ -0,0 +1,69 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.provdisc.mdns;
import net.java.sip.communicator.service.provdisc.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
* Implements <tt>BundleActivator</tt> for the mDNS provisioning bundle.
*
* @author Sebastien Vincent
*/
public class ProvisioningDiscoveryMDNSActivator
implements BundleActivator
{
/**
* <tt>Logger</tt> used by this <tt>ProvisioningDiscoveryMDNSActivator</tt>
* instance for logging output.
*/
private final Logger logger
= Logger.getLogger(ProvisioningDiscoveryMDNSActivator.class);
/**
* MDNS provisioning service.
*/
private static ProvisioningDiscoveryServiceMDNSImpl provisioningService =
new ProvisioningDiscoveryServiceMDNSImpl();
/**
* Starts the mDNS provisioning service
*
* @param bundleContext the <tt>BundleContext</tt> as provided by the OSGi
* framework.
* @throws Exception if anything goes wrong
*/
public void start(BundleContext bundleContext)
throws Exception
{
if (logger.isDebugEnabled())
logger.debug("mDNS provisioning discovery Service [STARTED]");
bundleContext.registerService(
ProvisioningDiscoveryService.class.getName(),
provisioningService,
null);
if (logger.isDebugEnabled())
logger.debug("mDNS provisioning discovery Service [REGISTERED]");
}
/**
* Stops the mDNS provisioning service.
*
* @param bundleContext the <tt>BundleContext</tt> as provided by the OSGi
* framework.
* @throws Exception if anything goes wrong
*/
public void stop(BundleContext bundleContext) throws Exception
{
if (logger.isInfoEnabled())
logger.info("mDNS provisioning discovery Service ...[STOPPED]");
}
}

@ -0,0 +1,104 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.provdisc.mdns;
import net.java.sip.communicator.service.provdisc.*;
import net.java.sip.communicator.service.provdisc.event.*;
import net.java.sip.communicator.util.*;
/**
* Class that uses mDNS to retrieve provisioning URL.
*
* @author Sebastien Vincent
*/
public class ProvisioningDiscoveryServiceMDNSImpl
extends AbstractProvisioningDiscoveryService
implements DiscoveryListener
{
/**
* Logger.
*/
private final Logger logger
= Logger.getLogger(ProvisioningDiscoveryServiceMDNSImpl.class);
/**
* Name of the method used to retrieve provisioning URL.
*/
private static final String METHOD_NAME = "Bonjour";
/**
* MDNS provisioning discover object.
*/
private MDNSProvisioningDiscover discover = null;
/**
* Constructor.
*/
public ProvisioningDiscoveryServiceMDNSImpl()
{
try
{
discover = new MDNSProvisioningDiscover();
discover.addDiscoveryListener(this);
}
catch(Exception e)
{
logger.warn("Cannot create JmDNS instance", e);
}
}
/**
* Get the name of the method name used to retrieve provisioning URL.
*
* @return method name
*/
public String getMethodName()
{
return METHOD_NAME;
}
/**
* Launch a discovery for a provisioning URL. This method is synchronous and
* may block for some time. Note that you don't have to call
* <tt>startDiscovery</tt> method prior to this one to retrieve URL.
*
* @return provisioning URL
*/
public String discoverURL()
{
if(discover != null)
{
return discover.discoverProvisioningURL();
}
return null;
}
/**
* Launch a mDNS discovery for a provisioning URL.
*
* This method is asynchronous, the response will be notified to any
* <tt>ProvisioningListener</tt> registered.
*/
public void startDiscovery()
{
if(discover != null)
{
new Thread(discover).start();
}
}
/**
* Notify the provisioning URL.
*
* @param event provisioning event
*/
public void notifyProvisioningURL(DiscoveryEvent event)
{
fireDiscoveryEvent(event);
}
}

@ -0,0 +1,11 @@
Bundle-Activator: net.java.sip.communicator.impl.provdisc.mdns.ProvisioningDiscoveryMDNSActivator
Bundle-Name: mDNS provisioning discovery
Bundle-Description: A bundle providing support for mDNS provisioning discovery
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.provdisc,
net.java.sip.communicator.service.provdisc.event,
net.java.sip.communicator.util,
javax.jmdns,

@ -107,7 +107,6 @@ public void start(BundleContext bundleContext) throws Exception
String downloadLink = getConfigurationService().getString(
PROP_UPDATE_LINK);
System.out.println("download link is: " + downloadLink);
// TODO: better way to get the Sparkle Framework path?
initSparkle(System.getProperty("user.dir")
+ "/../../Frameworks/Sparkle.framework",

@ -349,6 +349,19 @@ else if(url.getProtocol().equals("https"))
((HttpsURLConnection)connection).setSSLSocketFactory(
vs.getSSLContext(
url.getHost(), port).getSocketFactory());
HostnameVerifier hv = new HostnameVerifier()
{
public boolean verify(String urlHostName,
SSLSession session)
{
logger.warn("Warning: URL Host: " + urlHostName +
" vs. " + session.getPeerHost());
return true;
}
};
((HttpsURLConnection)connection).setHostnameVerifier(hv);
}
}
catch (Exception e)
@ -496,7 +509,8 @@ private File retrieveConfigurationFile(String url)
{
for(String s : args)
{
if(s.equals("username"))
if(s.equals("username=$username") ||
s.equals("username"))
{
if(userCredentials == null)
{
@ -508,36 +522,41 @@ private File retrieveConfigurationFile(String url)
userCredentials.getUserName(),
"UTF-8"));
}
else if(s.equals("password"))
else if(s.equals("password=$password") ||
s.equals("password"))
{
if(userCredentials == null)
{
handleProvisioningAuth();
}
content.append("&password=" +
content.append("password=" +
URLEncoder.encode(
userCredentials.
getPasswordAsString(),
"UTF-8"));
}
else if(s.equals("osname"))
else if(s.equals("osname=$osname") ||
s.equals("osname"))
{
content.append("&osname=" + URLEncoder.encode(
content.append("osname=" + URLEncoder.encode(
System.getProperty("os.name"), "UTF-8"));
}
else if(s.equals("build"))
else if(s.equals("build=$build") ||
s.equals("build"))
{
content.append("&build=" + URLEncoder.encode(
content.append("build=" + URLEncoder.encode(
System.getProperty("sip-communicator.version"),
"UTF-8"));
}
else if(s.equals("ipaddr"))
else if(s.equals("ipaddr=$ipaddr") ||
s.equals("ipaddr"))
{
content.append("&ipaddr=" + URLEncoder.encode(
content.append("ipaddr=" + URLEncoder.encode(
ipaddr.getHostAddress(), "UTF-8"));
}
else if(s.equals("hwaddr"))
else if(s.equals("hwaddr=$hwaddr") ||
s.equals("hwaddr"))
{
String hwaddr = null;
@ -581,7 +600,7 @@ else if(s.equals("hwaddr"))
buf.deleteCharAt(buf.length() - 1);
hwaddr = buf.toString();
content.append("&hwaddr=" +
content.append("hwaddr=" +
URLEncoder.encode(
hwaddr, "UTF-8"));
break;
@ -590,6 +609,8 @@ else if(s.equals("hwaddr"))
}
}
}
content.append("&");
}
}

@ -105,8 +105,8 @@ public ProvisioningForm()
final ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(dhcpButton);
buttonGroup.add(dnsButton);
buttonGroup.add(bonjourButton);
buttonGroup.add(dnsButton);
buttonGroup.add(manualButton);
final JPanel radioButtonPanel
@ -116,8 +116,8 @@ public ProvisioningForm()
resources.getI18NString("plugin.provisioning.AUTO")));
radioButtonPanel.add(dhcpButton);
radioButtonPanel.add(dnsButton);
radioButtonPanel.add(bonjourButton);
radioButtonPanel.add(dnsButton);
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
@ -176,8 +176,8 @@ else if (provMethod.equals("Manual"))
dhcpButton.setEnabled(isProvEnabled);
manualButton.setEnabled(isProvEnabled);
uriField.setEnabled(manualButton.isSelected());
bonjourButton.setEnabled(isProvEnabled);
dnsButton.setEnabled(false);
bonjourButton.setEnabled(false);
}
/**
@ -192,6 +192,7 @@ public void stateChanged(ChangeEvent e)
boolean isSelected = enableCheckBox.isSelected();
dhcpButton.setEnabled(isSelected);
bonjourButton.setEnabled(isSelected);
manualButton.setEnabled(isSelected);
String provisioningMethod = null;

@ -16,11 +16,20 @@
*/
public class Resources
{
/**
* Logger for this class.
*/
private static Logger logger = Logger.getLogger(Resources.class);
/**
* Name of the configuration file name.
*/
private static final String CONFIG_PROP_FILE_NAME
= "versionupdate.properties";
/**
* The properties contained in CONFIG_PROP_FILE_NAME.
*/
private static Properties configProps = null;
/**

Loading…
Cancel
Save