View Javadoc

1   /*
2    * This file is part of NetPisteur.
3    * 
4    * Copyright 2001-2002 : Olivier CORNEC, David BOUANCHEAU, Loic LOPEZ,
5    *                       Gaetan BOUDARD, Mael LE LANNOU, Julien ROBINEAU
6    * 
7    * Copyright 2002-2003 : Olivier BRIENS, Simon DEZE, Florence FRIGOULT,
8    *                       Olivier JOURNEAULT, Francois MARTINIER, Damien RAUDE-MORVAN
9    * 
10   * Copyright 2004-2007 : Damien RAUDE-MORVAN
11   * 
12   * NetPisteur is free software; you can redistribute it and/or modify it under
13   * the terms of the GNU General Public License as published by the Free
14   * Software Foundation; either version 2 of the License, or (at your option)
15   * any later version.
16   * 
17   * NetPisteur is distributed in the hope that it will be useful, but WITHOUT
18   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19   * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20   * more details.
21   * 
22   * You should have received a copy of the GNU General Public License along with
23   * NetPisteur; if not, write to the Free Software Foundation, Inc., 59 Temple
24   * Place, Suite 330, Boston, MA 02110-1301 USA
25   */
26  package com.drazzib.netpisteur;
27  
28  import java.util.Properties;
29  
30  import org.apache.commons.logging.Log;
31  import org.apache.commons.logging.LogFactory;
32  
33  import com.drazzib.netpisteur.configuration.Configuration;
34  import com.drazzib.netpisteur.ui.ConfigFrame;
35  
36  public class Start {
37  	
38  	private static Log log = LogFactory.getLog(Start.class);
39  
40  	public static void main(String args[]) {
41  
42  		Configuration uneConfiguration = Configuration.getHandle();
43  
44  		// chargement des parametres du proxy
45  		boolean read = uneConfiguration.readProxyConfFromDisk();
46  		if (!read) {
47  			log.error("Fichier de configuration du proxy introuvable");
48  
49  		}
50  
51  		log.info("Utilisation d'un proxy : " + uneConfiguration.isProxyActif());
52  
53  		if (uneConfiguration.isProxyActif()) {
54  			// recuperation de la configuration du proxy
55  
56  			log.info("****Configuration du proxy****");
57  			log.info("\tproxyHost : "
58  					+ uneConfiguration.getProxyHost());
59  			log.info("\tproxyPort : "
60  					+ uneConfiguration.getProxyPort());
61  			log.info("\tproxySet  : "
62  					+ uneConfiguration.isProxyActif());
63  
64  			// Recuperation des proprits systme courantes
65  			Properties sysProperties = System.getProperties();
66  
67  			// Modification des proprits systme
68  			sysProperties.setProperty("proxyHost", Configuration.getHandle()
69  					.getProxyHost());
70  			sysProperties.setProperty("proxyPort", Configuration.getHandle()
71  					.getProxyPort());
72  			sysProperties.setProperty("proxySet", ""
73  					+ Configuration.getHandle().isProxyActif());
74  
75  		}
76  
77  		ConfigFrame configWindow = new ConfigFrame();
78  		configWindow.setLocationRelativeTo(null);
79  		configWindow.setVisible(true);
80  	}
81  
82  } // ----------------------------------------------------fin Start.java