Mercurial > jhg
comparison src/org/tmatesoft/hg/core/SessionContext.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 | 3cfa4d908fc9 |
children | b3c16d1aede0 |
comparison
equal
deleted
inserted
replaced
454:36fd1fd06492 | 456:909306e412e2 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 TMate Software Ltd | 2 * Copyright (c) 2011-2012 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 * |
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.core; | 17 package org.tmatesoft.hg.core; |
18 | 18 |
19 import org.tmatesoft.hg.internal.Experimental; | |
20 import org.tmatesoft.hg.util.LogFacility; | 19 import org.tmatesoft.hg.util.LogFacility; |
21 | 20 |
22 /** | 21 /** |
23 * WORK IN PROGRESS | 22 * 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 * | 24 * |
25 * Access to objects that might need to be shared between various distinct operations ran during the same working session | 25 * <p>Note, API is likely to be extended in future versions, adding more object to share. |
26 * (i.e. caches, log, etc.). It's unspecified whether session context is per repository or can span multiple repositories | |
27 * | 26 * |
28 * @author Artem Tikhomirov | 27 * @author Artem Tikhomirov |
29 * @author TMate Software Ltd. | 28 * @author TMate Software Ltd. |
30 */ | 29 */ |
31 @Experimental(reason="Work in progress") | 30 public abstract class SessionContext { |
32 public interface SessionContext { | 31 // abstract class to facilitate adding more functionality without API break |
33 LogFacility getLog(); | |
34 | 32 |
35 /** | 33 /** |
36 * LIKELY TO CHANGE TO STANDALONE CONFIGURATION OBJECT | 34 * Access wrapper for a system log facility. |
35 * @return facility to direct dumps to, never <code>null</code> | |
37 */ | 36 */ |
38 Object getProperty(String name, Object defaultValue); | 37 public abstract LogFacility getLog(); |
38 | |
39 /** | |
40 * Access configuration parameters of the session. | |
41 * @param name name of the session configuration parameter | |
42 * @param defaultValue value to return if parameter is not configured | |
43 * @return value of the session parameter, defaultValue if none found | |
44 */ | |
45 public abstract Object getConfigurationProperty(String name, Object defaultValue); | |
46 // perhaps, later may add Configuration object, with PropertyMarshal's helpers | |
47 // e.g. when there's standalone Caches and WritableSessionProperties objects | |
39 } | 48 } |