Mercurial > jhg
comparison src/org/tmatesoft/hg/core/SessionContext.java @ 571:e4ee4bf4c7d0
Let session context control creation of Path instances
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 11 Apr 2013 16:27:06 +0200 |
parents | b3c16d1aede0 |
children | fba85bc1dfb8 |
comparison
equal
deleted
inserted
replaced
570:36853bb80a35 | 571:e4ee4bf4c7d0 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011-2012 TMate Software Ltd | 2 * Copyright (c) 2011-2013 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.core; | 17 package org.tmatesoft.hg.core; |
18 | 18 |
19 import org.tmatesoft.hg.util.LogFacility; | 19 import org.tmatesoft.hg.util.LogFacility; |
20 import org.tmatesoft.hg.util.Path; | |
20 | 21 |
21 /** | 22 /** |
22 * Access to objects that might need to be shared between various distinct operations ran during the same working session | 23 * Access to objects that might need to be shared between various distinct operations ran during the same working session |
23 * (i.e. caches, log, etc.). It's unspecified whether session context is per repository or can span multiple repositories | 24 * (i.e. caches, log, etc.). It's unspecified whether session context is per repository or can span multiple repositories |
24 * | 25 * |
45 public abstract Object getConfigurationProperty(String name, Object defaultValue); | 46 public abstract Object getConfigurationProperty(String name, Object defaultValue); |
46 // perhaps, later may add Configuration object, with PropertyMarshal's helpers | 47 // perhaps, later may add Configuration object, with PropertyMarshal's helpers |
47 // e.g. when there's standalone Caches and WritableSessionProperties objects | 48 // e.g. when there's standalone Caches and WritableSessionProperties objects |
48 | 49 |
49 /** | 50 /** |
51 * Provide a factory to create {@link Path} objects. | |
52 * | |
53 * Occasionally, there's a need to construct a {@link Path} object from a string/byte data | |
54 * kept in mercurial control files. Generally, default implementation (with {@link Path#create(CharSequence)} | |
55 * is enough, however, if there's a need to control number of string objects in memory (i.e. prevent duplicates), | |
56 * default implementation might need to be replaced with more sophisticated (e.g. using weak references or | |
57 * just a huge hash set). | |
58 * | |
59 * @return factory to construct Path objects, never <code>null</code> | |
60 */ | |
61 public Path.Source getPathFactory() { | |
62 return new Path.Source() { | |
63 public Path path(CharSequence p) { | |
64 return Path.create(p); | |
65 } | |
66 }; | |
67 } | |
68 | |
69 /** | |
50 * Providers of the context may implement | 70 * Providers of the context may implement |
51 */ | 71 */ |
52 public interface Source { | 72 public interface Source { |
53 SessionContext getSessionContext(); | 73 SessionContext getSessionContext(); |
54 } | 74 } |