Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgRemoteRepository.java @ 456:909306e412e2
Refactor LogFacility and SessionContext, better API for both
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 18 Jun 2012 16:54:00 +0200 |
parents | 2a08466838d3 |
children | b3c16d1aede0 |
comparison
equal
deleted
inserted
replaced
454:36fd1fd06492 | 456:909306e412e2 |
---|---|
13 * For information on how to redistribute this software under | 13 * For information on how to redistribute this software under |
14 * the terms of a license other than GNU General Public License | 14 * the terms of a license other than GNU General Public License |
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.repo; | 17 package org.tmatesoft.hg.repo; |
18 | |
19 import static org.tmatesoft.hg.util.LogFacility.Severity.Info; | |
18 | 20 |
19 import java.io.BufferedReader; | 21 import java.io.BufferedReader; |
20 import java.io.File; | 22 import java.io.File; |
21 import java.io.FileOutputStream; | 23 import java.io.FileOutputStream; |
22 import java.io.IOException; | 24 import java.io.IOException; |
53 import org.tmatesoft.hg.core.HgBadArgumentException; | 55 import org.tmatesoft.hg.core.HgBadArgumentException; |
54 import org.tmatesoft.hg.core.HgRemoteConnectionException; | 56 import org.tmatesoft.hg.core.HgRemoteConnectionException; |
55 import org.tmatesoft.hg.core.HgRepositoryNotFoundException; | 57 import org.tmatesoft.hg.core.HgRepositoryNotFoundException; |
56 import org.tmatesoft.hg.core.Nodeid; | 58 import org.tmatesoft.hg.core.Nodeid; |
57 import org.tmatesoft.hg.core.SessionContext; | 59 import org.tmatesoft.hg.core.SessionContext; |
60 import org.tmatesoft.hg.internal.PropertyMarshal; | |
58 | 61 |
59 /** | 62 /** |
60 * WORK IN PROGRESS, DO NOT USE | 63 * WORK IN PROGRESS, DO NOT USE |
61 * | 64 * |
62 * @see http://mercurial.selenic.com/wiki/WireProtocol | 65 * @see http://mercurial.selenic.com/wiki/WireProtocol |
78 if (url == null || ctx == null) { | 81 if (url == null || ctx == null) { |
79 throw new IllegalArgumentException(); | 82 throw new IllegalArgumentException(); |
80 } | 83 } |
81 this.url = url; | 84 this.url = url; |
82 sessionContext = ctx; | 85 sessionContext = ctx; |
83 Object debugProp = ctx.getProperty("hg4j.remote.debug", false); | 86 debug = new PropertyMarshal(ctx).getBoolean("hg4j.remote.debug", false); |
84 debug = debugProp instanceof Boolean ? ((Boolean) debugProp).booleanValue() : Boolean.parseBoolean(String.valueOf(debugProp)); | |
85 if ("https".equals(url.getProtocol())) { | 87 if ("https".equals(url.getProtocol())) { |
86 try { | 88 try { |
87 sslContext = SSLContext.getInstance("SSL"); | 89 sslContext = SSLContext.getInstance("SSL"); |
88 class TrustEveryone implements X509TrustManager { | 90 class TrustEveryone implements X509TrustManager { |
89 public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { | 91 public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
114 Preferences tempNode = Preferences.userRoot().node("xxx"); | 116 Preferences tempNode = Preferences.userRoot().node("xxx"); |
115 tempNode.putByteArray("xxx", url.getUserInfo().getBytes()); | 117 tempNode.putByteArray("xxx", url.getUserInfo().getBytes()); |
116 ai = tempNode.get("xxx", null); | 118 ai = tempNode.get("xxx", null); |
117 tempNode.removeNode(); | 119 tempNode.removeNode(); |
118 } catch (BackingStoreException ex) { | 120 } catch (BackingStoreException ex) { |
119 sessionContext.getLog().info(getClass(), ex, null); | 121 sessionContext.getLog().dump(getClass(), Info, ex, null); |
120 // IGNORE | 122 // IGNORE |
121 } | 123 } |
122 authInfo = ai; | 124 authInfo = ai; |
123 } else { | 125 } else { |
124 authInfo = null; | 126 authInfo = null; |