- Timestamp:
- May 3, 2013, 2:25:21 PM (12 years ago)
- Location:
- java
- Files:
-
- 9 added
- 15 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
java/AEInstaller2-Updater/.classpath
r734 r852 5 5 <classpathentry combineaccessrules="false" kind="src" path="/SVNAccess"/> 6 6 <classpathentry combineaccessrules="false" kind="src" path="/PlatformTools"/> 7 <classpathentry combineaccessrules="false" kind="src" path="/ProxySettings"/> 7 8 <classpathentry kind="output" path="bin"/> 8 9 </classpath> -
java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/AEInstaller2Updater.java
r777 r852 9 9 import javax.swing.UIManager; 10 10 11 import net.oni2.ProxySettings; 11 12 import net.oni2.aeinstaller.updater.backend.Paths; 12 13 import net.oni2.aeinstaller.updater.gui.MainWin; … … 41 42 } 42 43 44 if (Paths.getProxySettingsFilename().exists()) { 45 ProxySettings.deserializeFromFile(Paths.getProxySettingsFilename()); 46 } 47 43 48 System.setProperty("networkaddress.cache.ttl", "5"); 44 49 System.setProperty("networkaddress.cache.negative.ttl", "1"); -
java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/backend/Paths.java
r777 r852 33 33 34 34 /** 35 * @return Proxy settings filename of AEI 36 */ 37 public static File getProxySettingsFilename() { 38 return new File(getPrefsPath(), "AEI-ProxySettings.xml"); 39 } 40 41 /** 35 42 * Get the preferences path 36 43 * -
java/HTTPFileDownloader/.classpath
r741 r852 3 3 <classpathentry kind="src" path="src"/> 4 4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> 5 <classpathentry combineaccessrules="false" kind="src" path="/ProxySettings"/> 5 6 <classpathentry kind="output" path="bin"/> 6 7 </classpath> -
java/HTTPFileDownloader/src/net/oni2/httpfiledownloader/FileDownloader.java
r786 r852 9 9 import java.net.URLConnection; 10 10 import java.util.HashSet; 11 12 import net.oni2.ProxySettings; 11 13 12 14 /** … … 147 149 String strEtag = null; 148 150 RandomAccessFile outFile = null; 151 149 152 try { 150 153 outFile = new RandomAccessFile(target, "rw"); … … 174 177 BufferedInputStream input = null; 175 178 try { 176 URLConnection connection = url.openConnection(); 177 connection.setRequestProperty("Cache-Control", "no-cache"); 179 URLConnection connection = url 180 .openConnection(ProxySettings.getInstance() 181 .getProxy()); 182 connection.setRequestProperty("Cache-Control", 183 "no-cache"); 178 184 if (downloaded == 0) { 179 185 connection.connect(); -
java/ModDepotAccess/.classpath
r748 r852 3 3 <classpathentry kind="src" path="src"/> 4 4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> 5 <classpathentry kind="lib" path="/_ThirdPartyLibs/httpclient/commons-logging-1.1.1.jar"/>6 <classpathentry kind="lib" path="/_ThirdPartyLibs/httpclient/httpclient-4.2.2.jar"/>7 <classpathentry kind="lib" path="/_ThirdPartyLibs/httpclient/httpcore-4.2.2.jar"/>8 5 <classpathentry kind="lib" path="/_ThirdPartyLibs/JSON-java.jar"/> 9 6 <classpathentry kind="lib" path="/_ThirdPartyLibs/xstream-1.4.3.jar"/> 10 7 <classpathentry combineaccessrules="false" kind="src" path="/HTTPFileDownloader"/> 8 <classpathentry combineaccessrules="false" kind="src" path="/ProxySettings"/> 11 9 <classpathentry kind="output" path="bin"/> 12 10 </classpath> -
java/ModDepotAccess/src/net/oni2/moddepot/DepotManager.java
r748 r852 7 7 import java.io.IOException; 8 8 import java.io.InputStreamReader; 9 import java. io.UnsupportedEncodingException;10 import java.net.U nknownHostException;9 import java.net.HttpURLConnection; 10 import java.net.URL; 11 11 import java.util.Date; 12 12 import java.util.Enumeration; … … 16 16 import java.util.zip.ZipFile; 17 17 18 import net.oni2.ProxySettings; 19 import net.oni2.httpfiledownloader.FileDownloader; 18 20 import net.oni2.moddepot.model.File; 19 21 import net.oni2.moddepot.model.Node; … … 23 25 import net.oni2.moddepot.model.TaxonomyTerm; 24 26 import net.oni2.moddepot.model.TaxonomyVocabulary; 25 import net.oni2.httpfiledownloader.FileDownloader; 26 27 import org.apache.http.HttpResponse; 28 import org.apache.http.client.methods.HttpHead; 29 import org.apache.http.client.methods.HttpRequestBase; 30 import org.apache.http.impl.client.DefaultHttpClient; 27 31 28 import org.json.JSONArray; 32 29 import org.json.JSONException; … … 214 211 */ 215 212 public boolean checkConnection() { 216 HttpRequestBase httpQuery = null;217 218 213 try { 219 DefaultHttpClient httpclient = new DefaultHttpClient(); 220 httpQuery = new HttpHead(DepotConfig.depotUrl); 221 HttpResponse response = httpclient.execute(httpQuery); 222 int code = response.getStatusLine().getStatusCode(); 214 HttpURLConnection con = (HttpURLConnection) new URL( 215 DepotConfig.depotUrl).openConnection(ProxySettings 216 .getInstance().getProxy()); 217 con.setRequestMethod("HEAD"); 218 int code = con.getResponseCode(); 223 219 return (code >= 200) && (code <= 299); 224 } catch (UnknownHostException e) {225 } catch (UnsupportedEncodingException e) {226 e.printStackTrace();227 220 } catch (IOException e) { 228 221 e.printStackTrace(); 229 } finally {230 if (httpQuery != null)231 httpQuery.releaseConnection();232 222 } 233 223 return false; -
java/ProgramSettings/src/net/oni2/SettingsManager.java
r776 r852 23 23 private static SettingsManager instance = new SettingsManager(); 24 24 25 private static boolean debugRun = false;26 private static boolean useWorkingDir = false;27 28 25 private HashMap<String, Object> prefs = new HashMap<String, Object>(); 29 26 30 27 private boolean printNamesNotInMap = false; 31 28 32 private boolean offlineMode = false; 33 private boolean noCacheUpdate = false; 29 @SuppressWarnings("unused") 30 private transient boolean offlineMode = false; 31 @SuppressWarnings("unused") 32 private transient boolean noCacheUpdate = false; 34 33 35 34 /** … … 40 39 public static SettingsManager getInstance() { 41 40 return instance; 42 }43 44 /**45 * @param debug46 * Debug mode47 */48 public static void setDebug(boolean debug) {49 debugRun = debug;50 }51 52 /**53 * @return Is debug run54 */55 public static boolean isDebug() {56 return debugRun;57 }58 59 /**60 * @param useWd61 * Use working directory instead of jar path62 */63 public static void setUseWorkingDir(boolean useWd) {64 useWorkingDir = useWd;65 }66 67 /**68 * @return Do we want to use working directory69 */70 public static boolean getUseWorkingDir() {71 return useWorkingDir;72 }73 74 /**75 * @return Is offline?76 */77 public boolean isOfflineMode() {78 return offlineMode;79 }80 81 /**82 * @param offline83 * Is offline?84 */85 public void setOfflineMode(boolean offline) {86 this.offlineMode = offline;87 }88 89 /**90 * @return Is in noCacheUpdate mode?91 */92 public boolean isNoCacheUpdateMode() {93 return noCacheUpdate;94 }95 96 /**97 * @param noCacheUpdate98 * Is in noCacheUpdate mode?99 */100 public void setNoCacheUpdateMode(boolean noCacheUpdate) {101 this.noCacheUpdate = noCacheUpdate;102 41 } 103 42 -
java/SVNAccess/.classpath
r738 r852 7 7 <classpathentry exported="true" kind="lib" path="/_ThirdPartyLibs/svnkit/sqljet-1.1.6.jar"/> 8 8 <classpathentry exported="true" kind="lib" path="/_ThirdPartyLibs/svnkit/svnkit-1.7.8.jar" sourcepath="/home/ci/.m2/repository/org/tmatesoft/svnkit/svnkit/1.7.8/svnkit-1.7.8-sources.jar"/> 9 <classpathentry combineaccessrules="false" kind="src" path="/ProxySettings"/> 9 10 <classpathentry kind="output" path="bin"/> 10 11 </classpath> -
java/SVNAccess/src/net/oni2/svnaccess/SVN.java
r764 r852 5 5 import java.io.File; 6 6 import java.util.Vector; 7 8 import net.oni2.ProxySettings; 7 9 8 10 import org.tmatesoft.svn.core.SVNDepth; … … 10 12 import org.tmatesoft.svn.core.SVNException; 11 13 import org.tmatesoft.svn.core.SVNURL; 14 import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; 15 import org.tmatesoft.svn.core.auth.SVNAuthentication; 12 16 import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; 13 17 import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; … … 30 34 SVNClientManager svnCManager = null; 31 35 32 /** 33 * Constructor 34 */ 35 public SVN() { 36 private void setup() { 36 37 // For using over http:// and https:// 37 38 DAVRepositoryFactory.setup(); … … 40 41 // For using over file:/// 41 42 FSRepositoryFactory.setup(); 42 43 svnCManager = SVNClientManager.newInstance(SVNWCUtil 44 .createDefaultOptions(true)); 43 } 44 45 private void setProxy(BasicAuthenticationManager authMan) { 46 ProxySettings prox = ProxySettings.getInstance(); 47 if (prox.validate()) { 48 authMan.setProxy(prox.getHostOrIp(), prox.getPort(), null, null); 49 } 50 } 51 52 private BasicAuthenticationManager getAuthManager() { 53 BasicAuthenticationManager auth = new BasicAuthenticationManager( 54 new SVNAuthentication[0]); 55 setProxy(auth); 56 return auth; 57 } 58 59 private BasicAuthenticationManager getAuthManager(String username, 60 String password) { 61 BasicAuthenticationManager auth = new BasicAuthenticationManager( 62 username, password); 63 setProxy(auth); 64 return auth; 65 } 66 67 /** 68 * Constructor 69 */ 70 public SVN() { 71 setup(); 72 73 svnCManager = SVNClientManager.newInstance( 74 SVNWCUtil.createDefaultOptions(true), getAuthManager()); 45 75 } 46 76 … … 54 84 */ 55 85 public SVN(String username, String password) { 56 // For using over http:// and https:// 57 DAVRepositoryFactory.setup(); 58 // For using over svn:// and svn+xxx:// 59 SVNRepositoryFactoryImpl.setup(); 60 // For using over file:/// 61 FSRepositoryFactory.setup(); 86 setup(); 62 87 63 88 svnCManager = SVNClientManager.newInstance( 64 SVNWCUtil.createDefaultOptions(true), username, password); 89 SVNWCUtil.createDefaultOptions(true), 90 getAuthManager(username, password)); 65 91 } 66 92 -
java/installer2/.classpath
r850 r852 28 28 <classpathentry combineaccessrules="false" kind="src" path="/SwingComponents"/> 29 29 <classpathentry combineaccessrules="false" kind="src" path="/NaturalOrderComparator"/> 30 <classpathentry combineaccessrules="false" kind="src" path="/ProxySettings"/> 30 31 <classpathentry kind="output" path="bin"/> 31 32 </classpath> -
java/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
r849 r852 21 21 import javax.swing.UIManager.LookAndFeelInfo; 22 22 23 import net.oni2.ProxySettings; 23 24 import net.oni2.SettingsManager; 24 25 import net.oni2.aeinstaller.backend.CaseInsensitiveFile; 25 26 import net.oni2.aeinstaller.backend.Paths; 27 import net.oni2.aeinstaller.backend.RuntimeOptions; 26 28 import net.oni2.aeinstaller.backend.SizeFormatter; 27 29 import net.oni2.aeinstaller.backend.oni.OniSplit; … … 47 49 public class AEInstaller2 { 48 50 49 private static ResourceBundle imagesBundle; 50 private static ResourceBundle basicBundle; 51 private static ResourceBundle imagesBundle = ResourceBundle 52 .getBundle("net.oni2.aeinstaller.Images"); 53 private static ResourceBundle basicBundle = ResourceBundle 54 .getBundle("net.oni2.aeinstaller.AEInstaller"); 51 55 private static ResourceBundle globalBundle; 52 56 … … 82 86 } 83 87 } 84 imagesBundle = ResourceBundle.getBundle("net.oni2.aeinstaller.Images");85 basicBundle = ResourceBundle86 .getBundle("net.oni2.aeinstaller.AEInstaller");87 88 globalBundle = UTF8ResourceBundleLoader 88 89 .getBundle("net.oni2.aeinstaller.localization.Global"); … … 116 117 Paths.getDownloadPath().mkdirs(); 117 118 118 boolean debug = false;119 boolean useWd = false;120 boolean noCacheUpdate = false;121 boolean offline = false;122 119 for (String a : args) { 123 120 if (a.equalsIgnoreCase("-debug")) 124 debug = true;121 RuntimeOptions.setDebug(true); 125 122 if (a.equalsIgnoreCase("-nocacheupdate")) 126 noCacheUpdate = true;123 RuntimeOptions.setNoCacheUpdateMode(true); 127 124 if (a.equalsIgnoreCase("-offline")) 128 offline = true;125 RuntimeOptions.setOfflineMode(true); 129 126 if (a.equalsIgnoreCase("-usewd")) 130 useWd = true;131 } 132 if (! debug) {127 RuntimeOptions.setUseWorkingDir(true); 128 } 129 if (!RuntimeOptions.isDebug()) { 133 130 try { 134 131 PrintStream ps = new PrintStream(new File(Paths.getPrefsPath(), … … 141 138 } 142 139 143 SettingsManager.setDebug(debug);144 SettingsManager.deserializeFromFile(Paths.getSettingsFilename());145 SettingsManager.setDebug(debug);146 SettingsManager.setUseWorkingDir(useWd);147 SettingsManager.getInstance().setNoCacheUpdateMode(noCacheUpdate);148 149 initBundles();150 151 140 if (PlatformInformation.getPlatform() == Platform.MACOS) 152 141 initMacOS(); 142 143 SettingsManager.deserializeFromFile(Paths.getSettingsFilename()); 144 145 if (Paths.getProxySettingsFilename().exists()) { 146 ProxySettings.deserializeFromFile(Paths.getProxySettingsFilename()); 147 } 148 149 initBundles(); 153 150 154 151 SwingJavaBuilder.getConfig().addResourceBundle(imagesBundle); … … 242 239 globalBundle.getString("invalidPath.title"), 243 240 JOptionPane.ERROR_MESSAGE); 244 if (! SettingsManager.isDebug()) {241 if (!RuntimeOptions.isDebug()) { 245 242 return; 246 243 } 247 244 } 248 245 249 if (!offline) { 250 offline = !DepotManager.getInstance().checkConnection(); 251 } 252 if (offline) { 246 if (!RuntimeOptions.isOfflineMode()) { 247 RuntimeOptions.setOfflineMode(!DepotManager.getInstance() 248 .checkConnection()); 249 } 250 if (RuntimeOptions.isOfflineMode()) { 253 251 JOptionPane.showMessageDialog(null, 254 252 globalBundle.getString("offlineModeStartup.text"), … … 256 254 JOptionPane.INFORMATION_MESSAGE); 257 255 } 258 SettingsManager.getInstance().setOfflineMode(offline); 259 260 if (!offline) { 256 257 if (!RuntimeOptions.isOfflineMode()) { 261 258 SVN svn = new SVN(); 262 259 try { -
java/installer2/src/net/oni2/aeinstaller/backend/Paths.java
r779 r852 4 4 import java.io.UnsupportedEncodingException; 5 5 import java.net.URLDecoder; 6 7 import net.oni2.SettingsManager;8 6 9 7 /** … … 27 25 28 26 /** 27 * @return Proxy settings filename of AEI 28 */ 29 public static File getProxySettingsFilename() { 30 return new File(getPrefsPath(), "AEI-ProxySettings.xml"); 31 } 32 33 /** 29 34 * Get the Jar path 30 35 * … … 32 37 */ 33 38 public static File getInstallerPath() { 34 if ( SettingsManager.isDebug() || SettingsManager.getUseWorkingDir()) {39 if (RuntimeOptions.isDebug() || RuntimeOptions.getUseWorkingDir()) { 35 40 String wd = System.getProperty("user.dir"); 36 41 return new File(wd); -
java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r840 r852 50 50 import net.oni2.aeinstaller.backend.ImageResizer; 51 51 import net.oni2.aeinstaller.backend.Paths; 52 import net.oni2.aeinstaller.backend.RuntimeOptions; 52 53 import net.oni2.aeinstaller.backend.SizeFormatter; 53 54 import net.oni2.aeinstaller.backend.oni.OniLauncher; … … 217 218 DepotManager.loadFromCacheFile(Paths.getDepotCacheFilename()); 218 219 219 if (! SettingsManager.getInstance().isOfflineMode()220 && ! SettingsManager.getInstance().isNoCacheUpdateMode()) {220 if (!RuntimeOptions.isOfflineMode() 221 && !RuntimeOptions.isNoCacheUpdateMode()) { 221 222 long start = new Date().getTime(); 222 223 … … 240 241 if ((evtSource != this) 241 242 || SettingsManager.getInstance().get("notifyupdates", true)) { 242 if ( SettingsManager.getInstance().isOfflineMode()) {243 if (RuntimeOptions.isOfflineMode()) { 243 244 if (evtSource != this) { 244 245 JOptionPane.showMessageDialog( … … 584 585 @SuppressWarnings("unused") 585 586 private void checkCorePackages() { 586 if (! SettingsManager.getInstance().isOfflineMode()) {587 if (!RuntimeOptions.isOfflineMode()) { 587 588 TreeSet<Package> tools = new TreeSet<Package>(); 588 589 for (Package m : PackageManager.getInstance().getCoreTools()) { … … 649 650 } 650 651 651 if (toDownload.size() > 0 652 && SettingsManager.getInstance().isOfflineMode()) { 652 if (toDownload.size() > 0 && RuntimeOptions.isOfflineMode()) { 653 653 installState = EInstallState.OFFLINE; 654 654 break; -
java/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r840 r852 14 14 import javax.swing.UIManager; 15 15 16 import net.oni2.ProxySettings; 16 17 import net.oni2.SettingsManager; 18 import net.oni2.aeinstaller.backend.Paths; 17 19 import net.oni2.resourcebundle.UTF8ResourceBundleLoader; 18 20 … … 100 102 JOptionPane.INFORMATION_MESSAGE); 101 103 } 104 105 ProxySettings prox = ProxySettings.getInstance(); 106 prox.serializeToFile(Paths.getProxySettingsFilename()); 102 107 103 108 return true; -
java/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r840 r852 18 18 19 19 import net.oni2.SettingsManager; 20 import net.oni2.aeinstaller.backend.RuntimeOptions; 20 21 import net.oni2.aeinstaller.backend.oni.management.tools.ToolsManager; 21 22 import net.oni2.aeinstaller.backend.packages.Package; … … 103 104 } else { 104 105 if (!selectedPackage.isLocalAvailable()) { 105 if ( SettingsManager.getInstance().isOfflineMode()) {106 if (RuntimeOptions.isOfflineMode()) { 106 107 JOptionPane.showMessageDialog(this, 107 108 bundle.getString("offlineMode.text"),
Note:
See TracChangeset
for help on using the changeset viewer.