[Lutinutil-commits] r912 - trunk/commandline/commandline-core/src/main/java/org/codelutin/option
Author: tchemit Date: 2008-07-25 21:34:18 +0000 (Fri, 25 Jul 2008) New Revision: 912 Added: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java Log: introduce Context as a real contract renmae old Context to AbstractContext Modified: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java =================================================================== --- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java 2008-07-25 16:21:31 UTC (rev 911) +++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/AbstractContext.java 2008-07-25 21:34:18 UTC (rev 912) @@ -33,7 +33,7 @@ * * @author chemit */ -public abstract class AbstractContext<P extends OptionParser> implements ContextVisitable { +public abstract class AbstractContext<P extends OptionParser> implements Context<P> { /** logger non statique pour �pouser la cat�gorie de l'implantation */ protected final Log log = LogFactory.getLog(getClass()); @@ -200,12 +200,6 @@ } - /** initialisation i18n apr�s init du parser et des configs. */ - public abstract void initI18n(); - - /** @return la configuration principale de l'application */ - public abstract Config getMainConfig(); - /** * @return le parseur utilis� pour parser les options de la ligne de * commande. Added: trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java =================================================================== --- trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java (rev 0) +++ trunk/commandline/commandline-core/src/main/java/org/codelutin/option/Context.java 2008-07-25 21:34:18 UTC (rev 912) @@ -0,0 +1,77 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.option; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** @author chemit */ +public interface Context<P extends OptionParser> extends ContextVisitable { + void init(String[] args) throws Exception; + + long getStartingTime(); + + long getElapsedTime(); + + String getElapsedTimeAsString(); + + /** initialisation i18n apr�s init du parser et des configs. */ + void initI18n(); + + /** @return la configuration principale de l'application */ + Config getMainConfig(); + + P getParser(); + + <C extends Config> C getConfig(ConfigKey<C> key); + + boolean isQuit(); + + boolean isUseUI(); + + boolean isLaunchUI(); + + boolean isFirstLaunch(); + + void setQuit(boolean quit); + + void setLaunchUI(boolean launchUI); + + void setFirstLaunch(boolean firstLaunch); + + void save() throws IOException, IllegalStateException; + + void saveSafely(); + + void setSource(File source); + + File getSource(); + + List<ConfigKey<?>> getConfigKeys(); + + Config[] getConfigs(); + + ConfigKey<?> getConfigKey(String key); + + Config getConfig(String key); + + @SuppressWarnings({"unchecked"}) + <C extends Config> void registerConfig(Class<? extends C> aClass); + + void accept(ContextVisitor visitor); + + void dispose(boolean reload); +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org