Mercurial > hg4j
diff 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 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/SessionContext.java Wed Jun 13 21:07:39 2012 +0200 +++ b/src/org/tmatesoft/hg/core/SessionContext.java Mon Jun 18 16:54:00 2012 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 TMate Software Ltd + * Copyright (c) 2011-2012 TMate Software Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,24 +16,33 @@ */ package org.tmatesoft.hg.core; -import org.tmatesoft.hg.internal.Experimental; import org.tmatesoft.hg.util.LogFacility; /** - * WORK IN PROGRESS + * Access to objects that might need to be shared between various distinct operations ran during the same working session + * (i.e. caches, log, etc.). It's unspecified whether session context is per repository or can span multiple repositories * - * Access to objects that might need to be shared between various distinct operations ran during the same working session - * (i.e. caches, log, etc.). It's unspecified whether session context is per repository or can span multiple repositories + * <p>Note, API is likely to be extended in future versions, adding more object to share. * * @author Artem Tikhomirov * @author TMate Software Ltd. */ -@Experimental(reason="Work in progress") -public interface SessionContext { - LogFacility getLog(); +public abstract class SessionContext { + // abstract class to facilitate adding more functionality without API break /** - * LIKELY TO CHANGE TO STANDALONE CONFIGURATION OBJECT + * Access wrapper for a system log facility. + * @return facility to direct dumps to, never <code>null</code> */ - Object getProperty(String name, Object defaultValue); + public abstract LogFacility getLog(); + + /** + * Access configuration parameters of the session. + * @param name name of the session configuration parameter + * @param defaultValue value to return if parameter is not configured + * @return value of the session parameter, defaultValue if none found + */ + public abstract Object getConfigurationProperty(String name, Object defaultValue); + // perhaps, later may add Configuration object, with PropertyMarshal's helpers + // e.g. when there's standalone Caches and WritableSessionProperties objects }