|
From: Alexander S. <as...@us...> - 2008-11-27 18:33:43
|
Update of /cvsroot/jxtaim/jxtaim/src/vsis/im/communication In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6730/src/vsis/im/communication Modified Files: JxtaConnection.java Log Message: 2008-11-27 Alexander Sack <as...@jw...> Port configuration code to jxta 2.5 and do some randome cleanups * src/vsis/im/util/config/ConfigurationService.java, src/vsis/im/util/config/JxtaConfigurator.java, src/vsis/im/util/config/JxtaConfiguratorImpl.java - refactor all Platform configuration code and make it use NetworkManager and NetworkConfigurator introduced by JXTA 2.5 instead of the old Configurator * src/vsis/im/communication/JxtaConnection.java - (nm): NEW field: private NetworkManager nm - (goOnline): goOnline takes care now to setup NetworkManager and configure it using the new ConfigurationService mechanisms; catch and forward rethrow new exceptions * src/vsis/im/util/XMLResource.java - (load): improve logging - (<class>) fix indentation of field definition * src/vsis/im/Main.java: - [cleanup] drop not used com.sun import * src/conf/DefaultConfiguration.xml: - fix default relay and rendevouz auto-uri's used to gather initial seeds. Index: JxtaConnection.java =================================================================== RCS file: /cvsroot/jxtaim/jxtaim/src/vsis/im/communication/JxtaConnection.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** JxtaConnection.java 24 Nov 2005 22:56:26 -0000 1.13 --- JxtaConnection.java 27 Nov 2008 18:33:37 -0000 1.14 *************** *** 46,49 **** --- 46,50 ---- import vsis.im.util.AsyncClosure; import vsis.im.util.config.ConfigurationService; + import vsis.im.util.FS; import net.jxta.credential.AuthenticationCredential; *************** *** 71,74 **** --- 72,76 ---- import net.jxta.rendezvous.RendezvousEvent; import net.jxta.rendezvous.RendezvousListener; + import net.jxta.platform.NetworkManager; /** *************** *** 117,120 **** --- 119,124 ---- private HashMap pgid2uuid = new HashMap(); + private NetworkManager nm = null; + /** * Constructor for JxtaConnection. *************** *** 129,137 **** private void goOnline() throws CommunicationException { // TODO: CHECK IF CONNECTION IS ESTABLISHED ! online = false; ! try { // Join the main group ! setNetPeerGroup(PeerGroupFactory.newNetPeerGroup()); log.debug("NetPeerGroup is joint!"); --- 133,151 ---- private void goOnline() throws CommunicationException { // TODO: CHECK IF CONNECTION IS ESTABLISHED ! if (this.online) ! return; try { + // create the NetworkManager + nm = new NetworkManager (NetworkManager.ConfigMode.EDGE, + getConfigurationService().getPeername(), + FS.getHome().toURI()); + nm.setConfigPersistent(true); + + configurationService.getJxtaConfigurator().configureNetworkManager(nm); + + nm.getConfigurator().save(); + // Join the main group ! setNetPeerGroup(nm.startNetwork()); log.debug("NetPeerGroup is joint!"); *************** *** 166,169 **** --- 180,189 ---- online = true; + } catch (IOException e) { + log.error("Unable to setup NetworkManager", e); + throw new CommunicationException("Unable to setup NetworkManager", e); + } catch (net.jxta.exception.ConfiguratorException e) { + log.error("Unable to configure NetworkManager", e); + throw new CommunicationException("Unable to configure NetworkManager", e); } catch (PeerGroupException e) { log.error("Unable to join the PeerGroup", e); *************** *** 587,590 **** --- 607,641 ---- // $Log$ + // Revision 1.14 2008/11/27 18:33:37 asac + // 2008-11-27 Alexander Sack <as...@jw...> + // + // Port configuration code to jxta 2.5 and do some + // randome cleanups + // + // * src/vsis/im/util/config/ConfigurationService.java, + // src/vsis/im/util/config/JxtaConfigurator.java, + // src/vsis/im/util/config/JxtaConfiguratorImpl.java + // - refactor all Platform configuration code and make it + // use NetworkManager and NetworkConfigurator introduced + // by JXTA 2.5 instead of the old Configurator + // + // * src/vsis/im/communication/JxtaConnection.java + // - (nm): NEW field: private NetworkManager nm + // - (goOnline): goOnline takes care now to setup + // NetworkManager and configure it using + // the new ConfigurationService mechanisms; + // catch and forward rethrow new exceptions + // + // * src/vsis/im/util/XMLResource.java + // - (load): improve logging + // - (<class>) fix indentation of field definition + // + // * src/vsis/im/Main.java: + // - [cleanup] drop not used com.sun import + // + // * src/conf/DefaultConfiguration.xml: + // - fix default relay and rendevouz auto-uri's used to + // gather initial seeds. + // // Revision 1.13 2005/11/24 22:56:26 asac // landing patch for asynchronous error handling *with* CounterActions (which coincidentially allow user Interaction in response to errors): |