Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/BasicSessionContext.java @ 431:12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 29 Mar 2012 20:54:04 +0200 |
parents | 30922c728341 |
children | 909306e412e2 |
comparison
equal
deleted
inserted
replaced
430:d280759c2a3f | 431:12f668401613 |
---|---|
19 import java.util.Collections; | 19 import java.util.Collections; |
20 import java.util.Map; | 20 import java.util.Map; |
21 | 21 |
22 import org.tmatesoft.hg.core.SessionContext; | 22 import org.tmatesoft.hg.core.SessionContext; |
23 import org.tmatesoft.hg.util.LogFacility; | 23 import org.tmatesoft.hg.util.LogFacility; |
24 import org.tmatesoft.hg.util.PathPool; | |
25 import org.tmatesoft.hg.util.PathRewrite; | |
26 | 24 |
27 /** | 25 /** |
28 * | 26 * |
29 * @author Artem Tikhomirov | 27 * @author Artem Tikhomirov |
30 * @author TMate Software Ltd. | 28 * @author TMate Software Ltd. |
31 */ | 29 */ |
32 public class BasicSessionContext implements SessionContext { | 30 public class BasicSessionContext implements SessionContext { |
33 | 31 |
34 private PathPool pathPool; | |
35 private LogFacility logFacility; | 32 private LogFacility logFacility; |
36 private final Map<String, Object> properties; | 33 private final Map<String, Object> properties; |
37 | 34 |
38 public BasicSessionContext(PathPool pathFactory, LogFacility log) { | 35 public BasicSessionContext(LogFacility log) { |
39 this(null, pathFactory, log); | 36 this(null, log); |
40 } | 37 } |
41 | 38 |
42 @SuppressWarnings("unchecked") | 39 @SuppressWarnings("unchecked") |
43 public BasicSessionContext(Map<String,?> propertyOverrides, PathPool pathFactory, LogFacility log) { | 40 public BasicSessionContext(Map<String,?> propertyOverrides, LogFacility log) { |
44 pathPool = pathFactory; | |
45 logFacility = log; | 41 logFacility = log; |
46 properties = propertyOverrides == null ? Collections.<String,Object>emptyMap() : (Map<String, Object>) propertyOverrides; | 42 properties = propertyOverrides == null ? Collections.<String,Object>emptyMap() : (Map<String, Object>) propertyOverrides; |
47 } | |
48 | |
49 public PathPool getPathPool() { | |
50 if (pathPool == null) { | |
51 pathPool = new PathPool(new PathRewrite.Empty()); | |
52 } | |
53 return pathPool; | |
54 } | 43 } |
55 | 44 |
56 public LogFacility getLog() { | 45 public LogFacility getLog() { |
57 // e.g. for exceptions that we can't handle but log (e.g. FileNotFoundException when we've checked beforehand file.canRead() | 46 // e.g. for exceptions that we can't handle but log (e.g. FileNotFoundException when we've checked beforehand file.canRead() |
58 if (logFacility == null) { | 47 if (logFacility == null) { |