Author: tchemit Date: 2008-04-06 09:57:57 +0000 (Sun, 06 Apr 2008) New Revision: 390 Added: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java Removed: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java Log: introduce VCSConnexionState instead of ConnexionState Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java 2008-04-06 09:57:57 UTC (rev 390) @@ -15,26 +15,21 @@ package org.codelutin.vcs.event; import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.type.VCSConnectionState; import java.util.EventObject; /** - * Events to be used while {@link org.codelutin.vcs.VCSHandler} life cycle. + * Events to be used while {@link VCSConnexion} life cycle. * * @author chemit - * @see org.codelutin.vcs.VCSHandlerEventListener - * @see org.codelutin.vcs.VCSHandler */ public class VCSConnexionEvent extends EventObject { private static final long serialVersionUID = 1L; - protected Type state; + protected VCSConnectionState state; - public enum Type { - OPEN, CLOSE - } - /** * Constructs a prototypical Event. * @@ -42,7 +37,7 @@ * @param type type of event * @throws IllegalArgumentException if source is null. */ - public VCSConnexionEvent(VCSConnexion source, Type type) { + public VCSConnexionEvent(VCSConnexion source, VCSConnectionState type) { super(source); this.state = type; } @@ -52,7 +47,7 @@ return (VCSConnexion) super.getSource(); } - public Type getState() { + public VCSConnectionState getState() { return state; } } \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java 2008-04-06 09:57:57 UTC (rev 390) @@ -26,13 +26,13 @@ * * @param event current event */ - public void open(VCSConnexionEvent event); + public void onConnexionOpened(VCSConnexionEvent event); /** * call when vcs connexion was closed * * @param event current event */ - public void close(VCSConnexionEvent event); + public void onConnexionClosed(VCSConnexionEvent event); } \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java 2008-04-06 09:57:57 UTC (rev 390) @@ -1,37 +0,0 @@ -/* -* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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.vcs.type; - -/** - * Une enumeration pour definir l'�tat du connexion � un serveur vcs. - * - * @author chemit - */ -public enum ConnectionState { - /** lorsque la connexion a �t� initialis�e (valid�e) mais pas ouverte */ - INIT, - /** lorsque la connexion n'a pas encore initialis�e */ - UNDEFINED, - /** lorsque la connexion est ok, mais que l'on est pas connect� */ - OFF_LINE, - /** lorsque la connexion est �tablie avec succes */ - ON_LINE, - /** lorsque la connexion a tent�e de s'initialiser sans succes */ - ERROR -} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java (from rev 375, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java 2008-04-06 09:57:57 UTC (rev 390) @@ -0,0 +1,43 @@ +/* +* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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.vcs.type; + +import org.codelutin.vcs.VCSConnexion; +import org.codelutin.vcs.VCSConnexionConfig; +import org.codelutin.vcs.VCSProvider; + +/** + * All states of a {@link VCSConnexion}. + * + * @author chemit + */ +public enum VCSConnectionState { + + /** connexion was not init */ + UNDEFINED, + /** connexion was init, but not opened (default state after instanciate a new connexion from {@link VCSProvider#newConnection(VCSConnexionMode, VCSConnexionConfig)} */ + INIT, + /** connexion was successfull opened, via {@link VCSConnexion#open()} */ + OPEN, + /** connexion was successfull opened, via {@link VCSConnexion#close()} */ + CLOSE, + + /** connexion was not successfull opened, via {@link VCSConnexion#open()} */ + ERROR +} \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-06 09:57:57 UTC (rev 390) @@ -20,12 +20,11 @@ import org.codelutin.util.ListenerSet; import org.codelutin.vcs.VCSConnexion; import org.codelutin.vcs.VCSConnexionConfig; -import org.codelutin.vcs.event.VCSConnexionEvent; -import org.codelutin.vcs.event.VCSConnexionEvent.Type; -import org.codelutin.vcs.event.VCSConnexionEventListener; import org.codelutin.vcs.VCSException; import org.codelutin.vcs.VCSHandler; -import org.codelutin.vcs.type.ConnectionState; +import org.codelutin.vcs.event.VCSConnexionEvent; +import org.codelutin.vcs.event.VCSConnexionEventListener; +import org.codelutin.vcs.type.VCSConnectionState; import org.codelutin.vcs.type.VCSConnexionMode; import org.codelutin.vcs.type.VCSState; @@ -46,7 +45,7 @@ protected File localRoot; protected URI remoteRoot; protected VCSConnexionMode mode; - protected ConnectionState state; + protected VCSConnectionState state; protected VCSConnexionConfig config; protected H handler; @@ -84,17 +83,17 @@ public boolean isOpen() throws IllegalStateException { checkInit(); - return !hasFailed() && state == ConnectionState.ON_LINE; + return !hasFailed() && state == VCSConnectionState.OPEN; } public boolean isClosed() throws IllegalStateException { checkInit(); - return !hasFailed() && state != ConnectionState.ON_LINE; + return !hasFailed() && state != VCSConnectionState.CLOSE; } public boolean hasFailed() throws IllegalStateException { checkInit(); - return state == ConnectionState.ERROR; + return state == VCSConnectionState.ERROR; } public void addVCSConnexionEventListener(VCSConnexionEventListener l) { @@ -246,16 +245,16 @@ } protected void fireOpen() { - VCSConnexionEvent e = new VCSConnexionEvent(this, Type.OPEN); + VCSConnexionEvent e = new VCSConnexionEvent(this, VCSConnectionState.OPEN); for (VCSConnexionEventListener l : listeners) { - l.open(e); + l.onConnexionOpened(e); } } protected void fireClose() { - VCSConnexionEvent e = new VCSConnexionEvent(this, Type.CLOSE); + VCSConnexionEvent e = new VCSConnexionEvent(this, VCSConnectionState.CLOSE); for (VCSConnexionEventListener l : listeners) { - l.close(e); + l.onConnexionClosed(e); } } Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-06 09:57:57 UTC (rev 390) @@ -110,7 +110,7 @@ return connexions.toArray(new VCSConnexion[connexions.size()]); } - public void open(VCSConnexionEvent event) { + public void onConnexionOpened(VCSConnexionEvent event) { // register connexion as active connexions.add(event.getSource()); if (connexions.size() == 1) { @@ -119,7 +119,7 @@ } } - public void close(VCSConnexionEvent event) { + public void onConnexionClosed(VCSConnexionEvent event) { // remove connexion from active connexions.remove(event.getSource()); if (connexions.isEmpty()) { Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-06 09:57:57 UTC (rev 390) @@ -16,7 +16,7 @@ import org.codelutin.vcs.VCSConnexionConfig; import org.codelutin.vcs.VCSException; -import org.codelutin.vcs.type.ConnectionState; +import org.codelutin.vcs.type.VCSConnectionState; import org.codelutin.vcs.type.VCSConnexionMode; import org.codelutin.vcs.util.AbstractVCSConnexion; @@ -28,7 +28,7 @@ } public void init(VCSConnexionConfig config) { - state = ConnectionState.INIT; + state = VCSConnectionState.INIT; this.config = config; } @@ -44,7 +44,7 @@ @Override public void open() throws IllegalStateException { checkInit(); - state = ConnectionState.ON_LINE; + state = VCSConnectionState.CLOSE; fireOpen(); } Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java 2008-04-06 09:49:11 UTC (rev 389) +++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java 2008-04-06 09:57:57 UTC (rev 390) @@ -18,7 +18,7 @@ import org.codelutin.vcs.VCSConnexionConfig; import org.codelutin.vcs.VCSException; import org.codelutin.vcs.VCSRuntimeException; -import org.codelutin.vcs.type.ConnectionState; +import org.codelutin.vcs.type.VCSConnectionState; import org.codelutin.vcs.type.VCSConnexionMode; import org.codelutin.vcs.util.AbstractVCSConnexion; import org.tmatesoft.svn.core.SVNException; @@ -48,7 +48,7 @@ } public void init(VCSConnexionConfig config) { - state = ConnectionState.UNDEFINED; + state = VCSConnectionState.UNDEFINED; this.config = config; try {