[Buix-commits] r379 - in trunk/lutinvcs: lutinvcs-api/src/main/java/org/codelutin/vcs lutinvcs-api/src/main/java/org/codelutin/vcs/util lutinvcs-api/src/main/resources/i18n lutinvcs-core/src/main/java/org/codelutin/vcs/runner
Author: tchemit Date: 2008-04-06 07:31:39 +0000 (Sun, 06 Apr 2008) New Revision: 379 Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/package.html trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-en_GB.properties trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java Log: i18n +... Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 07:31:39 UTC (rev 379) @@ -37,9 +37,20 @@ */ public interface VCSConnexion { + /** @return the provider */ VCSProvider getProvider(); /** + * Initialize the connexion. + * <p/> + * If connexion can not be established, then the method {@link #hasFailed()} will always + * return <code>true</code>. + * + * @param config config to be used to initialize the connexion. + */ + void init(VCSConnexionConfig config); + + /** * @return the working copy used, can be null if no working copy exists. * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. */ @@ -58,16 +69,6 @@ VCSConnexionMode getMode() throws IllegalStateException; /** - * Initialize the connexion. - * <p/> - * If connexion can not be established, then the method {@link #hasFailed()} will always - * return <code>true</code>. - * - * @param config config to be used to initialize the connexion. - */ - void init(VCSConnexionConfig config); - - /** * @return the config of the connexion * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. */ Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/package.html =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/package.html 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/package.html 2008-04-06 07:31:39 UTC (rev 379) @@ -1,11 +1,11 @@ <html> <body> -<h1>Lutin vcs</h1> +<h1>Lutin vcs api</h1> Ensemble de l'api de base pour g�rer des Versionning Concurrent System (aka <code>vcs</code>) tel que CVS ou SVN. <br/> -On retrouve ici des interfaces, des classes g�n�riques et les objets li�s aux vcs. +On retrouve dans ce paquetage, uniquement des d�finitions de types. <br/> -Auncune impl�mentation n'est fournit actuellement ici. +Auncune impl�mentation n'est fournie dans ce paquetage. </body> </html> \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-06 07:31:39 UTC (rev 379) @@ -45,20 +45,15 @@ /** to use log facility, just put in your code: log.info(\"...\"); */ static protected final Log log = LogFactory.getLog(AbstractVCSHandler.class); - /** - * FilenameFilter to detect all files in a vcs working copy all files and directories that must be handled by vcs - * - * @see VCSHandler#getVersionnableFilenameFilter() - */ + public static final String LOCAL_SEP = File.separator; + public static final String LOCAL_SEP_PATTERN = "\\".equals(LOCAL_SEP) ? LOCAL_SEP + LOCAL_SEP : LOCAL_SEP; + public static final String REMOTE_SEP = "/"; + public static final String REMOTE_SEP_PATTERN = "/"; + protected final FilenameFilter versionnableFilenameFilter; protected final FileFilter versionnableFileFilter; protected final String confLocalDirName; protected final String confLocalEntriesFilename; - public static final String LOCAL_SEP = File.separator; - public static final String LOCAL_SEP_PATTERN = "\\".equals(LOCAL_SEP) ? - LOCAL_SEP + LOCAL_SEP : LOCAL_SEP; - public static final String REMOTE_SEP = "/"; - public static final String REMOTE_SEP_PATTERN = "/"; protected AbstractVCSHandler(final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) { this.confLocalDirName = vCSConfLocalDirName; Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-06 07:31:39 UTC (rev 379) @@ -14,26 +14,33 @@ */ package org.codelutin.vcs.util; +import static org.codelutin.i18n.I18n._; import org.codelutin.vcs.VCSConnexion; import org.codelutin.vcs.VCSConnexionConfig; -import org.codelutin.vcs.type.VCSConnexionMode; import org.codelutin.vcs.VCSHandler; import org.codelutin.vcs.VCSProvider; +import org.codelutin.vcs.type.VCSConnexionMode; -import java.lang.reflect.InvocationTargetException; - /** - * base implementation of provider with a cached handler and list of connexions + * base implementation of provider with a cached common handler for all connexions. * * @author chemit */ public abstract class AbstractVCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> implements VCSProvider<C, H> { - + /** + * shared cached instance of handler to use for this provider. + * <p/> + * The handler can be used by all connexions for this provider + */ protected H handler; + /** name of ne provider */ protected final String name; + /** implementation of handler to use */ private final Class<H> handlerImpl; + + /** implementation of connexion to use */ private final Class<C> connexionImpl; protected AbstractVCSProvider(String name, Class<H> handlerImpl, Class<C> connexionImpl) { @@ -57,14 +64,8 @@ C connexion = connexionImpl.getConstructor(VCSConnexionMode.class, getClass()).newInstance(mode, this); connexion.init(config); return connexion; - } catch (InstantiationException e) { - throw new RuntimeException("could not instanciate connexion " + connexionImpl + " for reason " + e.getMessage()); - } catch (IllegalAccessException e) { - throw new RuntimeException("could not instanciate connexion " + connexionImpl + " for reason " + e.getMessage()); - } catch (InvocationTargetException e) { - throw new RuntimeException("could not instanciate connexion " + connexionImpl + " for reason " + e.getMessage()); - } catch (NoSuchMethodException e) { - throw new RuntimeException("could not instanciate connexion " + connexionImpl + " for reason " + e.getMessage()); + } catch (Exception e) { + throw new RuntimeException(_("lutinvcs.error.provider.init.connexion", connexionImpl, this, e.getCause())); } } @@ -72,17 +73,15 @@ if (handler == null) { try { handler = handlerImpl.newInstance(); - } catch (InstantiationException e) { - throw new RuntimeException("could not instanciate the handler " + handlerImpl + " for reason " + e.getMessage()); - } catch (IllegalAccessException e) { - throw new RuntimeException("could not instanciate the handler " + handlerImpl + " for reason " + e.getMessage()); + } catch (Exception e) { + throw new RuntimeException(_("lutinvcs.error.provider.init.handler", handlerImpl, this, e.getCause())); } } } protected void checkHandlerInit() throws IllegalStateException { if (handler == null) { - throw new IllegalStateException("handler was not init in " + this); + throw new IllegalStateException(_("lutinvcs.error.provider.noinit", handler, this)); } } Modified: trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-en_GB.properties =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-en_GB.properties 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-en_GB.properties 2008-04-06 07:31:39 UTC (rev 379) @@ -9,6 +9,9 @@ lutinvcs.action.revert=revert lutinvcs.action.update=update lutinvcs.error.checkout.dir=Can''t checkout dir {0} +lutinvcs.error.provider.init.connexion=could not instanciate connexion {0}, for provider {1}, reason\: {2} +lutinvcs.error.provider.init.handler=could not instanciate handler {0}, for provider {1}, reason\: {2} +lutinvcs.error.provider.noinit=handler {0} was not init for provider {1} lutinvcs.location.all=All lutinvcs.location.local=Local lutinvcs.location.remote=Remote Modified: trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties 2008-04-06 07:31:39 UTC (rev 379) @@ -9,6 +9,9 @@ lutinvcs.action.revert=Rollback lutinvcs.action.update=Update lutinvcs.error.checkout.dir=Ne peut pas uploader le fichier ''{0}'' +lutinvcs.error.provider.init.connexion=Erreur lors de l''instanciation de la connexion {0}, provider {1}, cause\: {2} +lutinvcs.error.provider.init.handler=Erreur lors de l''instanciation du handler {0}, provider {1}, cause\: {2} +lutinvcs.error.provider.noinit=Le handler {0} n''a pas \u00E9t\u00E9 initialis\u00E9 pour le provider {1} lutinvcs.location.all=All lutinvcs.location.local=Local lutinvcs.location.remote=Remote Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java 2008-04-06 07:04:12 UTC (rev 378) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/runner/VCSActionThread.java 2008-04-06 07:31:39 UTC (rev 379) @@ -56,9 +56,11 @@ catch (Throwable eee) { if (log.isWarnEnabled()) { log.warn(_("lutinvcs.error.thread.action", item), eee); + //TODO Deal with errors } + } finally { + log.info("Stop " + getName() + " at " + new Date()); } - log.info("Stop " + getName() + " at " + new Date()); } protected void doAction(VCSActionManager.QueueItem item) throws VCSException {
participants (1)
-
tchemit@users.labs.libre-entreprise.org