Buix-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1440 discussions
r389 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:49:11 +0000 (Sun, 06 Apr 2008)
New Revision: 389
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java
Log:
javadoc
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-06 09:48:53 UTC (rev 388)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-06 09:49:11 UTC (rev 389)
@@ -21,7 +21,11 @@
import javax.swing.ListSelectionModel;
import java.util.List;
-/** @author chemit */
+/**
+ * Contract of list of VCSEntry
+ *
+ * @author chemit
+ */
public interface VCSEntries {
/**
@@ -64,6 +68,25 @@
void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException;
/**
+ * obtain the array of all {@link VCSAction} found in the given entries
+ *
+ * @param entries entries to scan
+ * @return array of {@link VCSAction} found in entires
+ */
+ VCSAction[] getActions(List<VCSEntry> entries);
+
+ /**
+ * obtain the array of all {@link VCSState} found in the given entries
+ *
+ * @param entries entries to scan
+ * @return array of {@link VCSState found in entires
+ */
+ VCSState[] getStates(List<VCSEntry> entries);
+
+ /** clear the internal list of entries. */
+ void clear();
+
+ /**
* obtain the list of all entries.
*
* @return list of all entries
@@ -115,11 +138,4 @@
* @return list of all entries for a given connexion
*/
List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries);
-
- VCSAction[] getActions(List<VCSEntry> entries);
-
- VCSState[] getStates(List<VCSEntry> entries);
-
- /** clear the list of entries. */
- void clear();
}
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-06 09:48:53 UTC (rev 388)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-06 09:49:11 UTC (rev 389)
@@ -21,7 +21,11 @@
import java.io.File;
import java.io.Serializable;
-/** @author chemit */
+/**
+ * Contract of an entry in VCS (a file or a dir)
+ *
+ * @author chemit
+ */
public interface VCSEntry extends Serializable {
/**
1
0
r388 - in trunk/lutinvcs: lutinvcs-api/src/main/java/org/codelutin/vcs lutinvcs-api/src/main/java/org/codelutin/vcs/util lutinvcs-core/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:48:53 +0000 (Sun, 06 Apr 2008)
New Revision: 388
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.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
Log:
improve VCSConnexionConfig (add srttter to contract)
introduc event package to put all event stuff
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 09:47:33 UTC (rev 387)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 09:48:53 UTC (rev 388)
@@ -15,6 +15,7 @@
package org.codelutin.vcs;
import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.event.VCSConnexionEventListener;
import java.io.File;
import java.net.URI;
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:47:33 UTC (rev 387)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-06 09:48:53 UTC (rev 388)
@@ -20,9 +20,9 @@
import org.codelutin.util.ListenerSet;
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSConnexionConfig;
-import org.codelutin.vcs.VCSConnexionEvent;
-import org.codelutin.vcs.VCSConnexionEvent.Type;
-import org.codelutin.vcs.VCSConnexionEventListener;
+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;
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:47:33 UTC (rev 387)
+++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-06 09:48:53 UTC (rev 388)
@@ -24,6 +24,8 @@
import org.codelutin.util.StringUtil;
import org.codelutin.vcs.runner.VCSActionManager;
import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.event.VCSConnexionEventListener;
+import org.codelutin.vcs.event.VCSConnexionEvent;
import java.util.ArrayList;
import java.util.List;
1
0
r387 - in trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs: . event
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:47:33 +0000 (Sun, 06 Apr 2008)
New Revision: 387
Added:
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
Removed:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEvent.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEventListener.java
Log:
improve VCSConnexionConfig (add srttter to contract)
introduc event package to put all event stuff
Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEvent.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEvent.java 2008-04-06 09:41:19 UTC (rev 386)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEvent.java 2008-04-06 09:47:33 UTC (rev 387)
@@ -1,56 +0,0 @@
-/**
- * # #% 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.vcs;
-
-import java.util.EventObject;
-
-/**
- * Events to be used while {@link org.codelutin.vcs.VCSHandler} 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;
-
- public enum Type {
- OPEN, CLOSE
- }
-
- /**
- * Constructs a prototypical Event.
- *
- * @param source The object on which the Event initially occurred.
- * @param type type of event
- * @throws IllegalArgumentException if source is null.
- */
- public VCSConnexionEvent(VCSConnexion source, Type type) {
- super(source);
- this.state = type;
- }
-
- @Override
- public VCSConnexion getSource() {
- return (VCSConnexion) super.getSource();
- }
-
- public Type getState() {
- return state;
- }
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEventListener.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEventListener.java 2008-04-06 09:41:19 UTC (rev 386)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEventListener.java 2008-04-06 09:47:33 UTC (rev 387)
@@ -1,38 +0,0 @@
-/**
- * # #% 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.vcs;
-
-/**
- * A listener on {@link VCSConnexion} life cycle
- *
- * @author chemit
- */
-public interface VCSConnexionEventListener extends java.util.EventListener {
-
- /**
- * call when vcs connexion was successfull open
- *
- * @param event current event
- */
- public void open(VCSConnexionEvent event);
-
- /**
- * call when vcs connexion was closed
- *
- * @param event current event
- */
- public void close(VCSConnexionEvent event);
-
-}
\ No newline at end of file
Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEvent.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEvent.java 2008-04-06 09:47:33 UTC (rev 387)
@@ -0,0 +1,58 @@
+/**
+ * # #% 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.vcs.event;
+
+import org.codelutin.vcs.VCSConnexion;
+
+import java.util.EventObject;
+
+/**
+ * Events to be used while {@link org.codelutin.vcs.VCSHandler} 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;
+
+ public enum Type {
+ OPEN, CLOSE
+ }
+
+ /**
+ * Constructs a prototypical Event.
+ *
+ * @param source The object on which the Event initially occurred.
+ * @param type type of event
+ * @throws IllegalArgumentException if source is null.
+ */
+ public VCSConnexionEvent(VCSConnexion source, Type type) {
+ super(source);
+ this.state = type;
+ }
+
+ @Override
+ public VCSConnexion getSource() {
+ return (VCSConnexion) super.getSource();
+ }
+
+ public Type getState() {
+ return state;
+ }
+}
\ No newline at end of file
Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionEventListener.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/VCSConnexionEventListener.java 2008-04-06 09:47:33 UTC (rev 387)
@@ -0,0 +1,38 @@
+/**
+ * # #% 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.vcs.event;
+
+/**
+ * A listener on {@link org.codelutin.vcs.VCSConnexion} life cycle
+ *
+ * @author chemit
+ */
+public interface VCSConnexionEventListener extends java.util.EventListener {
+
+ /**
+ * call when vcs connexion was successfull open
+ *
+ * @param event current event
+ */
+ public void open(VCSConnexionEvent event);
+
+ /**
+ * call when vcs connexion was closed
+ *
+ * @param event current event
+ */
+ public void close(VCSConnexionEvent event);
+
+}
\ No newline at end of file
1
0
r386 - in trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs: . util
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:41:19 +0000 (Sun, 06 Apr 2008)
New Revision: 386
Added:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/event/
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java
Log:
improve VCSConnexionConfig (add srttter to contract)
introduc event package to put all event stuff
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-06 09:34:59 UTC (rev 385)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-06 09:41:19 UTC (rev 386)
@@ -66,5 +66,26 @@
/** @return the type of reposotory used (head,tags,branches,...) */
VCSTypeRepo getTypeRepo();
+
+ void setHostName(String hostName);
+
+ void setKeyFile(File keyFile);
+
+ void setLocalDatabasePath(File localDatabasePath);
+
+ void setNoPassPhrase(boolean noPassPhrase);
+
+ void setPassPhrase(String passPhrase);
+
+ void setRemoteDatabase(String remoteDatabase);
+
+ void setRemotePath(String remotePath);
+
+ void setType(VCSType type);
+
+ void setTypeRepo(VCSTypeRepo typeRepo);
+
+ void setUserName(String userName);
+
void setUseSshConnexion(boolean newValue);
}
\ 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:34:59 UTC (rev 385)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-06 09:41:19 UTC (rev 386)
@@ -63,10 +63,6 @@
return handler;
}
- /*public VCSProvider<AbstractVCSConnexion, ?> getProvider() {
- return provider;
- }*/
-
public File getWorkingCopy() throws IllegalStateException {
checkInit();
return localRoot;
@@ -109,7 +105,6 @@
listeners.remove(l);
}
-
public boolean hasWriteAccess() {
return !getConfig().isUseSshConnexion() && getMode() != VCSConnexionMode.ANONYMOUS;
}
@@ -278,5 +273,4 @@
}
}
-
}
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-04-06 09:34:59 UTC (rev 385)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSConnexionConfigImpl.java 2008-04-06 09:41:19 UTC (rev 386)
@@ -23,19 +23,18 @@
/** @author chemit */
public class VCSConnexionConfigImpl implements VCSConnexionConfig {
- private VCSType type;
- private boolean useSshConnexion;
- private String hostName;
- private File keyFile;
- private String userName;
- private boolean noPassPhrase;
- private String passPhrase;
- private String remotePath;
- private String remoteDatabase;
- private VCSTypeRepo typeRepo;
- private File localDatabasePath;
+ protected VCSType type;
+ protected boolean useSshConnexion;
+ protected String hostName;
+ protected File keyFile;
+ protected String userName;
+ protected boolean noPassPhrase;
+ protected String passPhrase;
+ protected String remotePath;
+ protected String remoteDatabase;
+ protected VCSTypeRepo typeRepo;
+ protected File localDatabasePath;
-
public VCSType getType() {
return type;
}
1
0
r385 - in trunk/lutinvcs: lutinvcs-core/src/main/java/org/codelutin/vcs lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs lutinvcs-provider-mock/src/main/java/org/codelutin/vcs lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock lutinvcs-provider-svn/src/main/java/org/codelutin/vcs lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:34:59 +0000 (Sun, 06 Apr 2008)
New Revision: 385
Modified:
trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSHandler.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java
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/MockHandler.java
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java
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/SVNHandler.java
Log:
improve design :
no more shared handler instance in provider
each connexion has his own handler
handler has a cached connexion
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:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -83,9 +83,6 @@
// obtain matching provider
provider = factory.getProvider(config.getType().name().toUpperCase());
- // make sure provider is init
- provider.init();
-
// delegate instanciation of connexion to provider
VCSConnexion connexion = provider.newConnection(mode, config);
Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java 2008-04-06 09:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -14,10 +14,9 @@
*/
package org.codelutin.vcs.impl.cvs;
-import org.codelutin.vcs.CVSProvider;
import org.codelutin.vcs.VCSConnexionConfig;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
import org.netbeans.lib.cvsclient.CVSRoot;
import org.netbeans.lib.cvsclient.Client;
@@ -27,10 +26,10 @@
import org.netbeans.lib.cvsclient.connection.PServerConnection;
/** @author chemit */
-public class CVSConnexion extends AbstractVCSConnexion {
+public class CVSConnexion extends AbstractVCSConnexion<CVSHandler> {
- public CVSConnexion(VCSConnexionMode mode, CVSProvider provider) {
- super(mode, provider);
+ public CVSConnexion(VCSConnexionMode mode, CVSHandler handler) {
+ super(mode, handler);
}
public void init(VCSConnexionConfig config) {
Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSHandler.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSHandler.java 2008-04-06 09:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSHandler.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -29,7 +29,7 @@
super("CVS", "Entries");
}
- public void initWorkingCopy(CVSConnexion connexion) throws VCSException {
+ public void initWorkingCopy() throws VCSException {
VCSConnexionConfig config = connexion.getConfig();
File root = config.getLocalDatabasePath();
@@ -41,7 +41,7 @@
}
- public boolean isOnRemote(CVSConnexion connexion, File file) {
+ public boolean isOnRemote(File file) {
boolean result = false;
if (file.isDirectory()) {
File cvsdir = new File(file, confLocalDirName);
@@ -62,7 +62,7 @@
return result;
}
- public boolean isUpToDate(CVSConnexion connexion, File file) throws VCSException {
+ public boolean isUpToDate(File file) throws VCSException {
CVSCommandResult cvsResult = CVSHelper.cvsStatus(connexion, file);
if (cvsResult.isError()) {
@@ -84,12 +84,12 @@
return result;
}
- public void makeRemoteDir(CVSConnexion connexion, String msg, String... dirNames) throws VCSException {
+ public void makeRemoteDir(String msg, String... dirNames) throws VCSException {
//TODO
throw new RuntimeException(getClass().getName() + "#makeRemoteDir is not actually implemented");
}
- public void deleteRemoteDir(CVSConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
+ public void deleteRemoteDir(String commitMessage, String... dirNames) throws VCSException {
throw new RuntimeException(getClass().getName() + "#deleteRemoteDir is not actually implemented");
//TODO
}
@@ -99,16 +99,16 @@
//TODO
}*/
- public VCSState getState(CVSConnexion connexion, File fileState, Collection tmp) throws VCSException {
- return getState(connexion, fileState, tmp, true);
+ public VCSState getState(File fileState, Collection tmp) throws VCSException {
+ return getState(fileState, tmp, true);
}
- public VCSState getState(CVSConnexion connexion, File file, Collection tmp, boolean noremote) throws VCSException {
+ public VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getState(File) is not actually implemented");
//TODO
}
- public long add(CVSConnexion connexion, List<File> files, String msg) throws VCSException {
+ public long add(List<File> files, String msg) throws VCSException {
log.debug("files to add: " + files);
CVSCommandResult result = CVSHelper.cvsAdd(connexion, files);
@@ -119,7 +119,7 @@
return -1;
}
- public void delete(CVSConnexion connexion, List<File> files, String msg) throws VCSException {
+ public void delete(List<File> files, String msg) throws VCSException {
CVSCommandResult result = CVSHelper.cvsRemove(connexion, files);
assertCommandResult(result, "Can''t remove files: {0}");
@@ -129,22 +129,22 @@
}
- public long commit(CVSConnexion connexion, List<File> files, String msg) throws VCSException {
- add(connexion, files, msg);
+ public long commit(List<File> files, String msg) throws VCSException {
+ add(files, msg);
return 0;
}
- public void update(CVSConnexion connexion, File file) throws VCSException {
+ public void update(File file) throws VCSException {
CVSCommandResult result = CVSHelper.cvsUpdate(connexion, file);
assertCommandResult(result, "Can''t update files: {0}");
}
- public void checkout(CVSConnexion connexion, File destDir, String module, boolean recurse) throws VCSException {
+ public void checkout(File destDir, String module, boolean recurse) throws VCSException {
CVSCommandResult result = CVSHelper.checkout(connexion, destDir, module);
assertCommandResult(result, "Can''t checkout files: {0}");
}
- public void checkoutFile(CVSConnexion connexion, File destDir, String module) throws VCSException {
+ public void checkoutFile(File destDir, String module) throws VCSException {
/*try {
new File(destDir,module).createNewFile();
} catch (IOException e) {
@@ -154,7 +154,7 @@
}
- public List<String> getRemoteStorageNames(CVSConnexion connexion, File directory) {
+ public List<String> getRemoteStorageNames(File directory) {
List<String> result = new ArrayList<String>();
try {
CVSCommandResult cvsResult = CVSHelper.cvsLog(connexion, directory);
@@ -175,14 +175,13 @@
* Retourne les messages de logs entre la version local et la remote ou null
* si les deux fichiers ont la meme version
*
- * @param connexion connexion to be used
- * @param file TODO
- * @param logInfo TODO
+ * @param file TODO
+ * @param logInfo TODO
* @return le log ou null
* @throws VCSException TODO
*/
@SuppressWarnings("unchecked")
- public String getLogMessage(CVSConnexion connexion, File file, LogInformation logInfo) throws VCSException {
+ public String getLogMessage(File file, LogInformation logInfo) throws VCSException {
CVSCommandResult cvsResult = CVSHelper.cvsStatus(connexion, file);
if (cvsResult.isError()) {
throw new VCSException(_("lutinvcs.error.get.status.files", cvsResult.getTrace().toString()));
@@ -233,27 +232,27 @@
}
}
- public void revert(CVSConnexion connexion, List<File> files) throws VCSException {
+ public void revert(List<File> files) throws VCSException {
throw new RuntimeException(getClass().getName() + "#revert is not actually implemented");
//TODO
}
- public Object getRevision(CVSConnexion connexion, File f) throws VCSException {
+ public Object getRevision(File f) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getRevision is not actually implemented");
//TODO
}
- public void update(CVSConnexion connexion, File file, Object revision) throws VCSException {
+ public void update(File file, Object revision) throws VCSException {
throw new RuntimeException(getClass().getName() + "#update(File,Object) is not actually implemented");
//TODO
}
- public String getDiff(CVSConnexion connexion, File file) throws VCSException {
+ public String getDiff(File file) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getDiff(File,OutputStream) is not actually implemented");
//TODO
}
- public String getDiff(CVSConnexion connexion, File file, Object againstRevision) throws VCSException {
+ public String getDiff(File file, Object againstRevision) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getDiff(File,Object,OutputStream) is not actually implemented");
//TODO
}
@@ -262,30 +261,31 @@
//TODO
}
- public boolean hasProtocoleChanged(CVSConnexion connexion) {
+ public boolean hasProtocoleChanged() {
throw new RuntimeException(getClass().getName() + "#hasProtocoleChanged() is not actually implemented");
}
- public String getChangeLog(CVSConnexion connexion, File file) throws VCSException {
+ public String getChangeLog(File file) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getChangeLog((File) is not actually implemented");
//TODO
}
- public List getLog(CVSConnexion connexion, Object startRevision, Object endRevision, File file) throws VCSException {
+ public List getLog(Object startRevision, Object endRevision, File file) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getLog(Object,Object,File) is not actually implemented");
//TODO
}
- public String getFileContent(CVSConnexion connexion, File file, Object revision) throws VCSException {
+ public String getFileContent(File file, Object revision) throws VCSException {
throw new RuntimeException(getClass().getName() + "#getFileContent(File,Object) is not actually implemented");
//TODO
}
- public long checkoutOnlyTheDirectory(CVSConnexion connexion, File root, Object revision) throws VCSException {
- checkoutFile(connexion, root.getParentFile(), root.getName());
+ public long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException {
+ checkoutFile(root.getParentFile(), root.getName());
return -1;
//throw new RuntimeException(getClass().getName() + "#checkoutOnlyTheDirectory(File,Object) is not actually implemented");
//TODO
}
+
}
Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-06 09:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -15,14 +15,14 @@
package org.codelutin.vcs;
import org.codelutin.vcs.impl.mock.MockConnexion;
-import org.codelutin.vcs.impl.mock.MockVCSHandler;
+import org.codelutin.vcs.impl.mock.MockHandler;
import org.codelutin.vcs.util.AbstractVCSProvider;
/** @author chemit */
-public class MockProvider extends AbstractVCSProvider<MockConnexion, MockVCSHandler> {
+public class MockProvider extends AbstractVCSProvider<MockConnexion, MockHandler> {
public MockProvider() {
- super("MOCK", MockVCSHandler.class, MockConnexion.class);
+ super("MOCK", MockHandler.class, MockConnexion.class);
}
}
\ No newline at end of file
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:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -14,18 +14,17 @@
*/
package org.codelutin.vcs.impl.mock;
-import org.codelutin.vcs.type.ConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.MockProvider;
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.type.ConnectionState;
+import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
/** @author chemit */
-public class MockConnexion extends AbstractVCSConnexion {
+public class MockConnexion extends AbstractVCSConnexion<MockHandler> {
- public MockConnexion(VCSConnexionMode mode, MockProvider provider) {
- super(mode, provider);
+ public MockConnexion(VCSConnexionMode mode, MockHandler handler) {
+ super(mode, handler);
}
public void init(VCSConnexionConfig config) {
Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java 2008-04-06 09:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -30,90 +30,90 @@
super("", "");
}
- public void initWorkingCopy(MockConnexion connexion) throws VCSException {
+ public void initWorkingCopy() throws VCSException {
}
- public VCSState getState(MockConnexion connexion, File fileState, Collection tmp) throws VCSException {
+ public VCSState getState(File fileState, Collection tmp) throws VCSException {
return null;
}
- public VCSState getState(MockConnexion connexion, File file, Collection tmp, boolean noremote) throws VCSException {
+ public VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException {
return null;
}
- public boolean isOnRemote(MockConnexion connexion, File file) {
+ public boolean isOnRemote(File file) {
return false;
}
- public boolean isUpToDate(MockConnexion connexion, File file) throws VCSException {
+ public boolean isUpToDate(File file) throws VCSException {
return false;
}
- public void makeRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
+ public void makeRemoteDir(String commitMessage, String... dirNames) throws VCSException {
}
- public void deleteRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
+ public void deleteRemoteDir(String commitMessage, String... dirNames) throws VCSException {
}
- public long add(MockConnexion connexion, List<File> files, String msg) throws VCSException {
+ public long add(List<File> files, String msg) throws VCSException {
return 0;
}
- public void delete(MockConnexion connexion, List<File> files, String msg) throws VCSException {
+ public void delete(List<File> files, String msg) throws VCSException {
}
- public void revert(MockConnexion connexion, List<File> files) throws VCSException {
+ public void revert(List<File> files) throws VCSException {
}
- public long commit(MockConnexion connexion, List<File> files, String msg) throws VCSException {
+ public long commit(List<File> files, String msg) throws VCSException {
return 0;
}
- public void update(MockConnexion connexion, File file, Object revision) throws VCSException {
+ public void update(File file, Object revision) throws VCSException {
}
- public void update(MockConnexion connexion, File file) throws VCSException {
+ public void update(File file) throws VCSException {
}
- public void checkout(MockConnexion connexion, File destDir, String module, boolean recurse) throws VCSException {
+ public void checkout(File destDir, String module, boolean recurse) throws VCSException {
}
- public void checkoutFile(MockConnexion connexion, File destDir, String module) throws VCSException {
+ public void checkoutFile(File destDir, String module) throws VCSException {
}
- public long checkoutOnlyTheDirectory(MockConnexion connexion, File root, Object revision) throws VCSException {
+ public long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException {
return 0;
}
- public List<String> getRemoteStorageNames(MockConnexion connexion, File directory) throws VCSException {
+ public List<String> getRemoteStorageNames(File directory) throws VCSException {
return null;
}
- public Object getRevision(MockConnexion connexion, File f) throws VCSException {
+ public Object getRevision(File f) throws VCSException {
return null;
}
- public List getLog(MockConnexion connexion, Object startRevision, Object endRevision, File file) throws VCSException {
+ public List getLog(Object startRevision, Object endRevision, File file) throws VCSException {
return null;
}
- public String getFileContent(MockConnexion connexion, File file, Object revision) throws VCSException, IOException {
+ public String getFileContent(File file, Object revision) throws VCSException, IOException {
return null;
}
- public String getChangeLog(MockConnexion connexion, File file) throws VCSException {
+ public String getChangeLog(File file) throws VCSException {
return null;
}
- public String getDiff(MockConnexion connexion, File file) throws VCSException, IOException {
+ public String getDiff(File file) throws VCSException, IOException {
return null;
}
- public String getDiff(MockConnexion connexion, File file, Object againstRevision) throws VCSException, IOException {
+ public String getDiff(File file, Object againstRevision) throws VCSException, IOException {
return null;
}
- public boolean hasProtocoleChanged(MockConnexion connexion) throws VCSException {
+ public boolean hasProtocoleChanged() throws VCSException {
return false;
}
}
Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java 2008-04-06 09:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -30,11 +30,7 @@
public SVNProvider() {
super("SVN", SVNHandler.class, SVNConnexion.class);
- }
- @Override
- public void init() {
-
// For using over http:// and https://
DAVRepositoryFactory.setup();
@@ -43,8 +39,6 @@
// For using over file:///
FSRepositoryFactory.setup();
-
- super.init();
}
}
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:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -15,14 +15,12 @@
package org.codelutin.vcs.impl.svn;
import static org.codelutin.i18n.I18n._;
-import org.codelutin.vcs.type.ConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.SVNProvider;
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.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
-import org.codelutin.vcs.util.AbstractVCSHandler;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.io.SVNRepository;
@@ -35,7 +33,7 @@
import java.util.Arrays;
/** @author chemit */
-public class SVNConnexion extends AbstractVCSConnexion {
+public class SVNConnexion extends AbstractVCSConnexion<SVNHandler> {
protected SVNURL repositoryURL;
@@ -45,8 +43,8 @@
protected SVNWCClient ourWcClient;
- public SVNConnexion(VCSConnexionMode mode, SVNProvider provider) {
- super(mode, provider);
+ public SVNConnexion(VCSConnexionMode mode, SVNHandler handler) {
+ super(mode, handler);
}
public void init(VCSConnexionConfig config) {
@@ -124,17 +122,6 @@
return sb.toString();
}
- public boolean hasProtocoleChanged(SVNHandler handler) throws VCSException {
- File root = config.getLocalDatabasePath();
- if (!root.exists() || !AbstractVCSHandler.isFileInCheckedDir(root, handler)) {
- // local database does not exists, so no switch
- return false;
- }
- String oldProtocol = handler.getSVNStatus(this, root, false).getURL().getProtocol();
- String newProtocol = repositoryURL.getProtocol();
- return !oldProtocol.equals(newProtocol);
- }
-
public void testConnection() throws VCSException {
//TODO This is not the good place for this, this should be done in provider
if (getConfig().isUseSshConnexion()) {
@@ -173,4 +160,5 @@
public SVNURL getRepositoryURL() {
return repositoryURL;
}
+
}
Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHandler.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHandler.java 2008-04-06 09:34:44 UTC (rev 384)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHandler.java 2008-04-06 09:34:59 UTC (rev 385)
@@ -63,7 +63,7 @@
super(".svn", "entries");
}
- public void initWorkingCopy(SVNConnexion connexion) throws VCSException {
+ public void initWorkingCopy() throws VCSException {
try {
// test connection
connexion.getRepository().testConnection();
@@ -80,15 +80,15 @@
if (!root.exists()) {
config.getLocalDatabasePath().mkdirs();
}
- long lastRevision = checkoutOnlyTheDirectory(connexion, root, SVNRevision.HEAD);
+ long lastRevision = checkoutOnlyTheDirectory(root, SVNRevision.HEAD);
log.info(_("lutinvcs.message.copy.revision", null, lastRevision));
}
// TODO Delete VCSStatus and all links, use VCSState
- public VCSStatus getStatus(SVNConnexion connexion, File file) {
+ public VCSStatus getStatus(File file) {
SVNStatusType statusType;
try {
- statusType = getStatusType(connexion, file);
+ statusType = getStatusType(file);
} catch (SVNException e) {
return VCSStatus.NONE;
}
@@ -115,18 +115,18 @@
}
// tmp is used to get back the revision
- public VCSState getState(SVNConnexion connexion, File file, Collection tmp) throws VCSException {
- return getState(connexion, file, tmp, true);
+ public VCSState getState(File file, Collection tmp) throws VCSException {
+ return getState(file, tmp, true);
}
@SuppressWarnings("unchecked")
- public VCSState getState(SVNConnexion connexion, File file, Collection tmp, boolean noremote) throws VCSException {
+ public VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException {
VCSState result = VCSState.UNKNOWN;
boolean exist = file.exists();
- assertFileInWC(file, this, connexion);
+ assertFileInWC(file);
// file is in a working copy
@@ -134,7 +134,7 @@
SVNStatusType statusLocal;
SVNStatusType statRemote;
- if (!exist || !isFileInCheckedDir(file, this)) {
+ if (!exist || !isFileInCheckedDir(file)) {
// file not locally exists or not in a checked dir
// check if present on remote repository
@@ -226,29 +226,29 @@
return prefixPath;
}
- private String getRelativePath(SVNConnexion connexion, File f) {
+ private String getRelativePath(File f) {
final String path = f.getAbsolutePath();
return path.length() <= getPrefixPath(connexion) ? path : path.substring(getPrefixPath(connexion));
}
- public boolean isOnRemote(SVNConnexion connexion, File file) {
- VCSStatus fileStatus = getStatus(connexion, file);
+ public boolean isOnRemote(File file) {
+ VCSStatus fileStatus = getStatus(file);
return !(VCSStatus.UNVERSIONED == fileStatus || VCSStatus.NONE == fileStatus);
}
- public boolean isUpToDate(SVNConnexion connexion, File file) throws VCSException {
- SVNStatus status = getSVNStatus(connexion, file);
+ public boolean isUpToDate(File file) throws VCSException {
+ SVNStatus status = getSVNStatus(file);
return status.getContentsStatus() == STATUS_NORMAL && STATUS_NONE == status.getRemoteContentsStatus();
}
- public long add(SVNConnexion connexion, List<File> files, String msg) throws VCSException {
+ public long add(List<File> files, String msg) throws VCSException {
assertFilesExist(files, msg);
try {
ArrayList<File> filesTmp = new ArrayList<File>(files);
for (Iterator<File> it = filesTmp.iterator(); it.hasNext();) {
File file = it.next();
- VCSStatus status = getStatus(connexion, file);
+ VCSStatus status = getStatus(file);
if (!file.exists() || status == VCSStatus.NORMAL) {
// do not commit this file
it.remove();
@@ -257,14 +257,14 @@
// we must check first if file need really to be added ?
if (status == VCSStatus.UNVERSIONED) {
connexion.getOurWcClient().doAdd(file, false, false, false, false, false);
- log.debug("mark to add '" + getRelativePath(connexion, file) + "'");
+ log.debug("mark to add '" + getRelativePath(file) + "'");
}
}
if (!filesTmp.isEmpty() && msg != null) {
// we do commit
- long rev = commit(connexion, filesTmp, msg);
+ long rev = commit(filesTmp, msg);
for (File file : filesTmp) {
- log.info("'" + getRelativePath(connexion, file) + "' at revison " + rev);
+ log.info("'" + getRelativePath(file) + "' at revison " + rev);
}
return rev;
}
@@ -274,7 +274,7 @@
return -1;
}
- public void delete(SVNConnexion connexion, List<File> files, String msg) throws VCSException {
+ public void delete(List<File> files, String msg) throws VCSException {
assertFilesExist(files, "delete");
files.remove(connexion.getConfig().getLocalDatabasePath());
files.remove(connexion.getConfig().getLocalDatabasePath().getParentFile());
@@ -283,14 +283,14 @@
for (File file : files) {
connexion.getOurWcClient().doDelete(file, true, msg != null, false);
- log.debug("mark to delete '" + getRelativePath(connexion, file) + "'");
+ log.debug("mark to delete '" + getRelativePath(file) + "'");
}
long revision;
if (msg != null) {
// we do commit
- revision = commit(connexion, files, msg);
+ revision = commit(files, msg);
for (File file : files) {
- log.info("'" + getRelativePath(connexion, file) + "' at revison " + revision);
+ log.info("'" + getRelativePath(file) + "' at revison " + revision);
}
}
} catch (SVNException e) {
@@ -298,23 +298,23 @@
}
}
- public void revert(SVNConnexion connexion, List<File> files) throws VCSException {
+ public void revert(List<File> files) throws VCSException {
assertFilesExist(files, "revert");
try {
for (File file : files) {
// we have nothing to do for with a normal status file
- if (getStatus(connexion, file) == VCSStatus.NORMAL) {
+ if (getStatus(file) == VCSStatus.NORMAL) {
continue;
}
connexion.getOurWcClient().doRevert(file, true);
- log.info("'" + getRelativePath(connexion, file) + "' at revison " + "TODO");
+ log.info("'" + getRelativePath(file) + "' at revison " + "TODO");
}
} catch (SVNException e) {
throw new VCSException(e);
}
}
- public long commit(SVNConnexion connexion, List<File> files, String msg) throws VCSException {
+ public long commit(List<File> files, String msg) throws VCSException {
assertFilesExist(files, "commit");
try {
@@ -327,8 +327,8 @@
}
}
- public void update(SVNConnexion connexion, File file) throws VCSException {
- update(connexion, file, SVNRevision.HEAD);
+ public void update(File file) throws VCSException {
+ update(file, SVNRevision.HEAD);
}
/**
@@ -337,21 +337,21 @@
* @throws VCSException if any exception while update operation (like update a
* locally modified file or a unversionned file)
*/
- public void update(SVNConnexion connexion, File file, Object revision) throws VCSException {
+ public void update(File file, Object revision) throws VCSException {
try {
- VCSStatus status = getStatus(connexion, file);
+ VCSStatus status = getStatus(file);
if (status == VCSStatus.MODIFIED)
throw new VCSException("could not update a localy modified file " + file);
if (status == VCSStatus.UNVERSIONED || status == VCSStatus.NONE)
throw new VCSException("could not update a non versionned file " + file);
long newRev = connexion.getOurClientManager().getUpdateClient().doUpdate(file, (SVNRevision) revision, true);
- log.info("'" + getRelativePath(connexion, file) + "' to revision " + newRev);
+ log.info("'" + getRelativePath(file) + "' to revision " + newRev);
} catch (SVNException e) {
throw new VCSException(e);
}
}
- public void checkout(SVNConnexion connexion, File destDir, String module, boolean recurse)
+ public void checkout(File destDir, String module, boolean recurse)
throws VCSException {
try {
final SVNURL urlModule = connexion.getRepositoryURL().appendPath(module, true);
@@ -359,18 +359,18 @@
String sep = File.separator;
// TODO Why this ?
final File modulePath = new File(destDir, module.replaceAll("/", "\\".equals(sep) ? sep + sep : sep));
- log.info(urlModule + " to path '" + getRelativePath(connexion, modulePath) + "' (module:" + module + ")");
+ log.info(urlModule + " to path '" + getRelativePath(modulePath) + "' (module:" + module + ")");
connexion.getOurClientManager().getUpdateClient().doCheckout(urlModule, modulePath, null, SVNRevision.HEAD, recurse);
} catch (SVNException e) {
throw new VCSException(e);
}
}
- public void checkoutFile(SVNConnexion connexion, File destDir, String module) throws VCSException {
- update(connexion, new File(destDir, module));
+ public void checkoutFile(File destDir, String module) throws VCSException {
+ update(new File(destDir, module));
}
- public long checkoutOnlyTheDirectory(SVNConnexion connexion, File root, Object revision)
+ public long checkoutOnlyTheDirectory(File root, Object revision)
throws VCSException {
long lastRevision;
try {
@@ -395,7 +395,7 @@
(SVNRevision) (revision == null ? SVNRevision.HEAD
: revision), false);
- log.info(url + " to path '" + getRelativePath(connexion, root) + "' (module:" + module + ") to revision " + lastRevision);
+ log.info(url + " to path '" + getRelativePath(root) + "' (module:" + module + ") to revision " + lastRevision);
// Suppress all files from root directory of working copy
for (File file : root.listFiles())
if (file.isFile())
@@ -406,7 +406,7 @@
return lastRevision;
}
- public List<String> getRemoteStorageNames(SVNConnexion connexion, File directory)
+ public List<String> getRemoteStorageNames(File directory)
throws VCSException {
final List<String> result = new ArrayList<String>();
@@ -436,7 +436,7 @@
return result;
}
- public SVNRevision getRevision(SVNConnexion connexion, File f) throws VCSException {
+ public SVNRevision getRevision(File f) throws VCSException {
SVNStatus status;
try {
status = connexion.getOurClientManager().getStatusClient().doStatus(f, false);
@@ -453,12 +453,12 @@
* @return la liste des r�visions en tre la startRevision et la endRevision
* @throws VCSException if nay exception while operation
*/
- public List<SVNLogEntry> getLog(SVNConnexion connexion, Object startRevision, Object endRevision,
+ public List<SVNLogEntry> getLog(Object startRevision, Object endRevision,
File file) throws VCSException {
final List<SVNLogEntry> result = new ArrayList<SVNLogEntry>();
- final long workingRevision = getRevision(connexion, file).getNumber();
+ final long workingRevision = getRevision(file).getNumber();
final long startRev = ((SVNRevision) startRevision).getNumber();
ISVNLogEntryHandler handler = new ISVNLogEntryHandler() {
@@ -488,14 +488,13 @@
* @return le log ou null si auncune r�vision n'a �t� fourni
* @throws VCSException if nay exception while operation
*/
- public String getChangeLog(SVNConnexion connexion, File file) throws VCSException {
+ public String getChangeLog(File file) throws VCSException {
SVNRevision startRevision = file.exists() ? SVNRevision.WORKING
: SVNRevision.create(0);
log.debug("file " + file + " init Rev " + startRevision);
- List<SVNLogEntry> logInfo = getLog(connexion, startRevision, SVNRevision.HEAD,
- file);
+ List<SVNLogEntry> logInfo = getLog(startRevision, SVNRevision.HEAD, file);
// List<SVNLogEntry> logInfo = getLog(file.exists()?SVNRevision.WORKING:
// SVNRevision.BASE, SVNRevision.HEAD, file);
@@ -522,20 +521,20 @@
return result.substring(1);
}
- public String getDiff(SVNConnexion connexion, File file) throws VCSException, IOException {
+ public String getDiff(File file) throws VCSException, IOException {
// make diff against Head revision of file
- return getDiff(connexion, file, SVNRevision.HEAD);
+ return getDiff(file, SVNRevision.HEAD);
}
- public String getDiff(SVNConnexion connexion, File file, Object againstRevision)
+ public String getDiff(File file, Object againstRevision)
throws VCSException, IOException {
assertFileExist(file, "getDiff");
SVNRevision remoteRevision = (SVNRevision) againstRevision;
- SVNStatus status = getSVNStatus(connexion, file);
+ SVNStatus status = getSVNStatus(file);
if (status == null) {
throw new VCSException("could not found status for the file " + file);
@@ -573,11 +572,8 @@
}
}
- public boolean hasProtocoleChanged(SVNConnexion connexion) throws VCSException {
- return connexion.hasProtocoleChanged(this);
- }
- public String getFileContent(SVNConnexion connexion, File file, Object revision)
+ public String getFileContent(File file, Object revision)
throws VCSException, IOException {
if (file == null || file.isDirectory()) {
throw new VCSRuntimeException("could not invoke getFileContent for a directory [" + file + "]");
@@ -606,7 +602,7 @@
}
}
- public byte[] getBinaryFileContent(SVNConnexion connexion, File file, Object revision) throws VCSException, IOException {
+ public byte[] getBinaryFileContent(File file, Object revision) throws VCSException, IOException {
if (file == null || file.isDirectory())
throw new VCSRuntimeException("could not invoke getFileContent for a directory [" + file + "]");
String path = file.getAbsolutePath();
@@ -629,11 +625,11 @@
}
}
- public SVNStatus getSVNStatus(SVNConnexion connexion, File file) throws VCSException {
- return getSVNStatus(connexion, file, true);
+ public SVNStatus getSVNStatus(File file) throws VCSException {
+ return getSVNStatus(file, true);
}
- protected SVNStatus getSVNStatus(SVNConnexion connexion, File file, boolean remote) throws VCSException {
+ protected SVNStatus getSVNStatus(File file, boolean remote) throws VCSException {
try {
return connexion.getOurClientManager().getStatusClient().doStatus(file, remote);
} catch (SVNException e) {
@@ -641,7 +637,7 @@
}
}
- protected SVNStatusType getStatusType(SVNConnexion connexion, File file) throws SVNException {
+ protected SVNStatusType getStatusType(File file) throws SVNException {
SVNStatus status = connexion.getOurClientManager().getStatusClient().doStatus(file, false);
return status == null ? UNKNOWN : status.getContentsStatus();
}
@@ -658,7 +654,7 @@
throw new VCSRuntimeException(getClass().getName() + "#" + command + "(File,...) first argument can not be null");
}
- public void makeRemoteDir(SVNConnexion connexion, String commitMessage, String... dirNames)
+ public void makeRemoteDir(String commitMessage, String... dirNames)
throws VCSException {
try {
@@ -681,7 +677,7 @@
}
}
- public void deleteRemoteDir(SVNConnexion connexion, String commitMessage, String... dirNames)
+ public void deleteRemoteDir(String commitMessage, String... dirNames)
throws VCSException {
try {
@@ -703,4 +699,15 @@
}
}
+ public boolean hasProtocoleChanged() throws VCSException {
+ File root = connexion.getConfig().getLocalDatabasePath();
+ if (!root.exists() || !isFileInCheckedDir(root)) {
+ // local database does not exists, so no switch
+ return false;
+ }
+ String oldProtocol = getSVNStatus(root, false).getURL().getProtocol();
+ String newProtocol = connexion.getRepositoryURL().getProtocol();
+ return !oldProtocol.equals(newProtocol);
+ }
+
}
1
0
r384 - in trunk/lutinvcs/lutinvcs-api/src/main: java/org/codelutin/vcs java/org/codelutin/vcs/util resources/i18n
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:34:44 +0000 (Sun, 06 Apr 2008)
New Revision: 384
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
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
Log:
improve design :
no more shared handler instance in provider
each connexion has his own handler
handler has a cached connexion
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 09:33:56 UTC (rev 383)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 09:34:44 UTC (rev 384)
@@ -30,29 +30,21 @@
/** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */
String getName();
- /**
- * init the provider. (instanciate handler)
- * <p/>
- * This method MUST be invoked before asking any connexion.
- */
- void init();
+ /** @return the class of implementation of handler to use for this provider */
+ Class<H> getHandlerImpl();
- /**
- * return a new VCSHandler instance for given config.
- *
- * @return the cached instance of handler
- * @throws IllegalStateException if provider was not init via {@link #init()}
- */
- H getHandler() throws IllegalStateException;
+ /** @return the imclass of implementation of connexion to use for this provider */
+ Class<C> getConnexionImpl();
/**
* Instanciate an new connexion for a given config, and init it.
+ * <p/>
+ * Note : <b>After this method connexion is init, but not opened.</b>
*
* @param mode the mode required
* @param config the config to be used
* @return the new connexion initialized <b>but not opened</b>.
- * @throws IllegalStateException if provider was not init via {@link #init()}
*/
- C newConnection(VCSConnexionMode mode, VCSConnexionConfig config) throws IllegalStateException;
+ C newConnection(VCSConnexionMode mode, VCSConnexionConfig config);
}
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:33:56 UTC (rev 383)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-06 09:34:44 UTC (rev 384)
@@ -16,18 +16,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import static org.codelutin.i18n.I18n._;
import org.codelutin.util.ListenerSet;
-import org.codelutin.vcs.type.ConnectionState;
-import org.codelutin.vcs.type.VCSAction;
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSConnexionEvent;
import org.codelutin.vcs.VCSConnexionEvent.Type;
import org.codelutin.vcs.VCSConnexionEventListener;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSHandler;
-import org.codelutin.vcs.VCSProvider;
+import org.codelutin.vcs.type.ConnectionState;
+import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.type.VCSState;
import java.io.File;
@@ -36,11 +35,10 @@
import java.io.IOException;
import java.net.URI;
import java.util.Collection;
-import java.util.EnumSet;
import java.util.List;
/** @author chemit */
-public abstract class AbstractVCSConnexion implements VCSConnexion {
+public abstract class AbstractVCSConnexion<H extends VCSHandler> implements VCSConnexion<H> {
/** to use log facility, just put in your code: log.info(\"...\"); */
static protected final Log log = LogFactory.getLog(AbstractVCSConnexion.class);
@@ -49,26 +47,25 @@
protected URI remoteRoot;
protected VCSConnexionMode mode;
protected ConnectionState state;
-
protected VCSConnexionConfig config;
+ protected H handler;
- protected VCSProvider<AbstractVCSConnexion, ?> provider;
-
protected ListenerSet<VCSConnexionEventListener> listeners = new ListenerSet<VCSConnexionEventListener>();
@SuppressWarnings({"unchecked"})
- protected AbstractVCSConnexion(VCSConnexionMode mode, VCSProvider provider) {
+ protected AbstractVCSConnexion(VCSConnexionMode mode, H handler) {
this.mode = mode;
- this.provider = provider;
+ this.handler = handler;
+ this.handler.setConnexion(this);
}
- public VCSHandler<AbstractVCSConnexion> getHandler() throws IllegalStateException {
- return getProvider().getHandler();
+ public H getHandler() throws IllegalStateException {
+ return handler;
}
- public VCSProvider<AbstractVCSConnexion, ?> getProvider() {
+ /*public VCSProvider<AbstractVCSConnexion, ?> getProvider() {
return provider;
- }
+ }*/
public File getWorkingCopy() throws IllegalStateException {
checkInit();
@@ -112,158 +109,147 @@
listeners.remove(l);
}
+
+ public boolean hasWriteAccess() {
+ return !getConfig().isUseSshConnexion() && getMode() != VCSConnexionMode.ANONYMOUS;
+ }
+
+ public void addVCSHandlerEventListener(VCSConnexionEventListener l) {
+ listeners.add(l);
+ }
+
+ public void removeVCSHandlerEventListener(VCSConnexionEventListener l) {
+ listeners.remove(l);
+ }
+
+ // ---------------------------------------------------------------------
+ // handler delegate methods
+ // ---------------------------------------------------------------------
+
public void initWorkingCopy() throws VCSException {
- getHandler().initWorkingCopy(this);
+ handler.initWorkingCopy();
}
public void deleteWorkingCopy() {
- getHandler().deleteWorkingCopy(this);
+ handler.deleteWorkingCopy();
}
public FilenameFilter getVersionnableFilenameFilter() {
- return getHandler().getVersionnableFilenameFilter();
+ return handler.getVersionnableFilenameFilter();
}
public FileFilter getVersionnableFileFilter() {
- return getHandler().getVersionnableFileFilter();
+ return handler.getVersionnableFileFilter();
}
public String getConfLocalDirname() {
- return getHandler().getConfLocalDirname();
+ return handler.getConfLocalDirname();
}
public String getConfLocalEntriesFilename() {
- return getHandler().getConfLocalEntriesFilename();
+ return handler.getConfLocalEntriesFilename();
}
public VCSState getState(File fileState, Collection tmp) throws VCSException {
- return getHandler().getState(this, fileState, tmp);
+ return handler.getState(fileState, tmp);
}
public VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException {
- return getHandler().getState(this, file, tmp, noremote);
+ return handler.getState(file, tmp, noremote);
}
public boolean isOnRemote(File file) {
- return getHandler().isOnRemote(this, file);
+ return handler.isOnRemote(file);
}
public boolean isUpToDate(File file) throws VCSException {
- return getHandler().isUpToDate(this, file);
+ return handler.isUpToDate(file);
}
public boolean isVersionnableFile(File file) {
- return getHandler().isVersionnableFile(this, file);
+ return handler.isVersionnableFile(file);
}
public void makeRemoteDir(String commitMessage, String... dirNames) throws VCSException {
- getHandler().makeRemoteDir(this, commitMessage, dirNames);
+ handler.makeRemoteDir(commitMessage, dirNames);
}
public void deleteRemoteDir(String commitMessage, String... dirNames) throws VCSException {
- getHandler().deleteRemoteDir(this, commitMessage, dirNames);
+ handler.deleteRemoteDir(commitMessage, dirNames);
}
public long add(List<File> files, String msg) throws VCSException {
- return getHandler().add(this, files, msg);
+ return handler.add(files, msg);
}
public void delete(List<File> files, String msg) throws VCSException {
- getHandler().delete(this, files, msg);
+ handler.delete(files, msg);
}
public void revert(List<File> files) throws VCSException {
- getHandler().revert(this, files);
+ handler.revert(files);
}
public long commit(List<File> files, String msg) throws VCSException {
- return getHandler().commit(this, files, msg);
+ return handler.commit(files, msg);
}
public void update(File file, Object revision) throws VCSException {
- getHandler().update(this, file, revision);
+ handler.update(file, revision);
}
public void update(File file) throws VCSException {
- getHandler().update(this, file);
+ handler.update(file);
}
public void checkout(File destDir, String module, boolean recurse) throws VCSException {
- getHandler().checkout(this, destDir, module, recurse);
+ handler.checkout(destDir, module, recurse);
}
public void checkoutFile(File destDir, String module) throws VCSException {
- getHandler().checkoutFile(this, destDir, module);
+ handler.checkoutFile(destDir, module);
}
public long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException {
- return getHandler().checkoutOnlyTheDirectory(this, root, revision);
+ return handler.checkoutOnlyTheDirectory(root, revision);
}
public List<String> getRemoteStorageNames(File directory) throws VCSException {
- return getHandler().getRemoteStorageNames(this, directory);
+ return handler.getRemoteStorageNames(directory);
}
public List<String> getLocalStorageNames(File directory) {
- return getHandler().getLocalStorageNames(this, directory);
+ return handler.getLocalStorageNames(directory);
}
public Object getRevision(File f) throws VCSException {
- return getHandler().getRevision(this, f);
+ return handler.getRevision(f);
}
public List getLog(Object startRevision, Object endRevision, File file) throws VCSException {
- return getHandler().getLog(this, startRevision, endRevision, file);
+ return handler.getLog(startRevision, endRevision, file);
}
public String getFileContent(File file, Object revision) throws VCSException, IOException {
- return getHandler().getFileContent(this, file, revision);
+ return handler.getFileContent(file, revision);
}
public String getChangeLog(File file) throws VCSException {
- return getHandler().getChangeLog(this, file);
+ return handler.getChangeLog(file);
}
public String getDiff(File file) throws VCSException, IOException {
- return getHandler().getDiff(this, file);
+ return handler.getDiff(file);
}
public String getDiff(File file, Object againstRevision) throws VCSException, IOException {
- return getHandler().getDiff(this, file, againstRevision);
+ return handler.getDiff(file, againstRevision);
}
public boolean hasProtocoleChanged() throws VCSException {
- return getHandler().hasProtocoleChanged(this);
+ return handler.hasProtocoleChanged();
}
- /**
- * Obtain the set of permitted vcs actions.
- *
- * @return the EnumSet of authorized action according to current vcs config
- */
- public EnumSet<VCSAction> getAuthorizedActions() {
- boolean canWrite = hasWriteAccess();
- EnumSet<VCSAction> result = EnumSet.noneOf(VCSAction.class);
- for (VCSAction vcsAction : VCSAction.values()) {
- if (!vcsAction.isWrite() || canWrite) {
- result.add(vcsAction);
- }
- }
- return result;
- }
-
- public boolean hasWriteAccess() {
- return !getConfig().isUseSshConnexion() && getMode() != VCSConnexionMode.ANONYMOUS;
- }
-
- public void addVCSHandlerEventListener(VCSConnexionEventListener l) {
- listeners.add(l);
- }
-
- public void removeVCSHandlerEventListener(VCSConnexionEventListener l) {
- listeners.remove(l);
- }
-
protected void fireOpen() {
VCSConnexionEvent e = new VCSConnexionEvent(this, Type.OPEN);
for (VCSConnexionEventListener l : listeners) {
@@ -280,14 +266,15 @@
protected void checkInit() throws IllegalStateException {
if (state == null) {
- throw new IllegalStateException("connexion was not init");
+ throw new IllegalStateException(_("lutinvcs.error.connexion.noinit", this));
}
}
protected void checkOpen() throws IllegalStateException {
checkInit();
if (!isOpen()) {
- throw new IllegalStateException("connexion was not init");
+ throw new IllegalStateException(_("lutinvcs.error.connexion.noopen", this));
+
}
}
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 09:33:56 UTC (rev 383)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-06 09:34:44 UTC (rev 384)
@@ -54,6 +54,7 @@
protected final FileFilter versionnableFileFilter;
protected final String confLocalDirName;
protected final String confLocalEntriesFilename;
+ protected C connexion;
protected AbstractVCSHandler(final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) {
this.confLocalDirName = vCSConfLocalDirName;
@@ -70,6 +71,10 @@
};
}
+ public void setConnexion(C connexion) {
+ this.connexion = connexion;
+ }
+
public FilenameFilter getVersionnableFilenameFilter() {
return versionnableFilenameFilter;
}
@@ -86,19 +91,19 @@
return confLocalEntriesFilename;
}
- public boolean isVersionnableFile(C connexion, File file) {
+ public boolean isVersionnableFile(File file) {
assertFileExists(file, "file is empty or non existant");
return !confLocalDirName.equalsIgnoreCase(file.getName());
}
- public void deleteWorkingCopy(C connexion) {
+ public void deleteWorkingCopy() {
if (connexion.getConfig().getLocalDatabasePath().exists()) {
FileUtil.deleteRecursively(connexion.getConfig().getLocalDatabasePath());
connexion.getConfig().getLocalDatabasePath().delete();
}
}
- public List<String> getLocalStorageNames(C connexion, File directory) {
+ public List<String> getLocalStorageNames(File directory) {
List<String> result = new ArrayList<String>();
if (directory.exists()) {
getFiles0(directory, result, "");
@@ -107,11 +112,11 @@
return result;
}
- public void doCheckoutDir(C connexion, File... dirs) {
+ public void doCheckoutDir(File... dirs) {
for (File dir : dirs) {
try {
- if (!dir.exists() || !isFileInWorkingCopy(dir, this, connexion, true)) {
- checkoutOnlyTheDirectory(connexion, dir, null);
+ if (!dir.exists() || !isFileInWorkingCopy(dir, true)) {
+ checkoutOnlyTheDirectory(dir, null);
}
} catch (Exception eee) {
log.warn(_("lutinvcs.error.checkout.dir", dir), eee);
@@ -140,40 +145,40 @@
}
}
- public static boolean isFileInWorkingCopy(File parent, String name, VCSHandler handler, VCSConnexion connexion, boolean underVCS) {
+ public boolean isFileInWorkingCopy(File parent, String name, boolean underVCS) {
if (parent == null || name == null)
throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInWorkingCopy can not be invoked with some null parameter but was. [" + parent + "," + name + "," +
- handler + "]");
- return isFileInWorkingCopy(new File(parent, name), handler, connexion, underVCS);
+ this + "]");
+ return isFileInWorkingCopy(new File(parent, name), underVCS);
}
- public static boolean isFileInWorkingCopy(File file, VCSHandler handler, VCSConnexion connexion, boolean underVCS) {
- if (file == null || handler == null)
- throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInWorkingCopy can not be invoked with some null parameter but was. [" + file + "," + handler + "]");
+ public boolean isFileInWorkingCopy(File file, boolean underVCS) {
+ if (file == null)
+ throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInWorkingCopy can not be invoked with some null parameter but was. [" + file + "," + this + "]");
String rootPath = connexion.getConfig().getLocalDatabasePath().getAbsolutePath();
String localPath = file.getAbsolutePath();
if (localPath.startsWith(rootPath) && !underVCS) {
return true;
}
final File realDir = file.isDirectory() ? file : file.getParentFile();
- return isFileInCheckedDir(realDir, handler);
+ return isFileInCheckedDir(realDir);
}
- public static boolean isFileInCheckedDir(File file, VCSHandler handler) {
- if (file == null || handler == null)
- throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInCheckedDir can not be invoked with some null parameter but was. [" + file + "," + handler + "]");
+ public boolean isFileInCheckedDir(File file) {
+ if (file == null)
+ throw new RuntimeException(AbstractVCSHandler.class.getName() + "#isFileInCheckedDir can not be invoked with some null parameter but was. [" + file + "," + this + "]");
final File realDir = file.isDirectory() ? file : file.getParentFile();
- return (new File(realDir, handler.getConfLocalDirname()).exists());
+ return (new File(realDir, getConfLocalDirname()).exists());
}
- public static void assertFileInWC(File file, VCSHandler handler, VCSConnexion connexion) {
- if (!isFileInWorkingCopy(file, handler, connexion, false))
+ public void assertFileInWC(File file) {
+ if (!isFileInWorkingCopy(file, false))
throw new VCSRuntimeException("the file [" + file + "] is not in the working copy [" + connexion.getConfig().getLocalDatabasePath() + "]");
}
- public static String getRemoteRelativePath(File f, VCSHandler handler, VCSConnexion connexion) {
- if (!isFileInWorkingCopy(f, handler, connexion, false)) return null;
+ public String getRemoteRelativePath(File f) {
+ if (!isFileInWorkingCopy(f, false)) return null;
//System.out.println("file on vcs working copy : "+f);
String rootPath = connexion.getConfig().getLocalDatabasePath().getAbsolutePath();
String localPath = f.getAbsolutePath();
@@ -182,10 +187,10 @@
return convertToRemoteName(localPath);
}
- public static String getLocalRelativePath(String remoteRelativePath, VCSHandler handler, VCSConnexion connexion) {
+ public String getLocalRelativePath(String remoteRelativePath) {
String localPath = convertToLocalName(remoteRelativePath);
final File file = new File(connexion.getConfig().getLocalDatabasePath(), localPath);
- if (!isFileInWorkingCopy(file, handler, connexion, false)) return null;
+ if (!isFileInWorkingCopy(file, false)) return null;
return localPath;
}
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 09:33:56 UTC (rev 383)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-06 09:34:44 UTC (rev 384)
@@ -22,17 +22,11 @@
import org.codelutin.vcs.type.VCSConnexionMode;
/**
- * base implementation of provider with a cached common handler for all connexions.
+ * base implementation of provider.
*
* @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;
+public class AbstractVCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> implements VCSProvider<C, H> {
/** name of ne provider */
protected final String name;
@@ -53,15 +47,26 @@
return name;
}
- public H getHandler() throws IllegalStateException {
- checkHandlerInit();
- return handler;
+ public Class<C> getConnexionImpl() {
+ return connexionImpl;
}
- public C newConnection(VCSConnexionMode mode, VCSConnexionConfig config) throws IllegalStateException {
- checkHandlerInit();
+ public Class<H> getHandlerImpl() {
+ return handlerImpl;
+ }
+
+ public C newConnection(VCSConnexionMode mode, VCSConnexionConfig config) {
+
+ H handler;
+ C connexion;
+
try {
- C connexion = connexionImpl.getConstructor(VCSConnexionMode.class, getClass()).newInstance(mode, this);
+ handler = handlerImpl.newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException(_("lutinvcs.error.provider.init.handler", handlerImpl, this, e.getCause()));
+ }
+ try {
+ connexion = connexionImpl.getConstructor(VCSConnexionMode.class, handlerImpl).newInstance(mode, handler);
connexion.init(config);
return connexion;
} catch (Exception e) {
@@ -69,20 +74,4 @@
}
}
- public void init() {
- if (handler == null) {
- try {
- handler = handlerImpl.newInstance();
- } 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(_("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 09:33:56 UTC (rev 383)
+++ trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-en_GB.properties 2008-04-06 09:34:44 UTC (rev 384)
@@ -9,9 +9,10 @@
lutinvcs.action.revert=revert
lutinvcs.action.update=update
lutinvcs.error.checkout.dir=Can''t checkout dir {0}
+lutinvcs.error.connexion.noinit=connexion {0} was not init
+lutinvcs.error.connexion.noopen=connexion {0} was not opened
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 09:33:56 UTC (rev 383)
+++ trunk/lutinvcs/lutinvcs-api/src/main/resources/i18n/lutinvcs-api-fr_FR.properties 2008-04-06 09:34:44 UTC (rev 384)
@@ -9,9 +9,10 @@
lutinvcs.action.revert=Rollback
lutinvcs.action.update=Update
lutinvcs.error.checkout.dir=Ne peut pas uploader le fichier ''{0}''
+lutinvcs.error.connexion.noinit=La connexion {0} n''a pas \u00E9t\u00E9 initialis\u00E9e
+lutinvcs.error.connexion.noopen=La connexion {0} n''a pas \u00E9t\u00E9 ouverte
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
1
0
r383 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:33:56 +0000 (Sun, 06 Apr 2008)
New Revision: 383
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java
Log:
introduce VCSCommon contract tobe realized by VCSHandler and VCSConnexion
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 09:33:33 UTC (rev 382)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 09:33:56 UTC (rev 383)
@@ -15,15 +15,9 @@
package org.codelutin.vcs;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.type.VCSState;
import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.io.IOException;
import java.net.URI;
-import java.util.Collection;
-import java.util.List;
/**
* Contract to be realized for a connexion to a vcs.
@@ -35,10 +29,10 @@
*
* @author chemit
*/
-public interface VCSConnexion {
+public interface VCSConnexion<H extends VCSHandler> extends VCSCommon {
- /** @return the provider */
- VCSProvider getProvider();
+ /** @return the handler */
+ H getHandler();
/**
* Initialize the connexion.
@@ -119,270 +113,4 @@
/** @param l the listener to remove */
void removeVCSConnexionEventListener(VCSConnexionEventListener l);
- /**
- * init working copy, says if it is the first we use it it, we will checkout
- * the databaseDirectory directory
- *
- * @throws VCSException if any exception while init
- */
- void initWorkingCopy() throws VCSException;
-
- /** delete the local working copy with all his files */
- void deleteWorkingCopy();
-
- /**
- * @return a <code>FilenameFilter<code> to detect all files and directories in a vcs working copy that
- * must be handled by vcs
- */
- FilenameFilter getVersionnableFilenameFilter();
-
- /**
- * @return a <code>FileFilter<code> to detect all files and directories in a vcs working copy that
- * must be handled by vcs
- */
- FileFilter getVersionnableFileFilter();
-
- /**
- * @return name of directory used by vcs to store in working copy, a data's
- * directory configuration (e.g CVS for cvs and .svn for svn)
- */
- String getConfLocalDirname();
-
- /**
- * @return name of the file used by vcs to store in working copy
- * configuration directory entries of data's directory (e.g Entries
- * for cvs and entries for svn)
- */
- String getConfLocalEntriesFilename();
-
- VCSState getState(File fileState, Collection tmp) throws VCSException;
-
- VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException;
-
- /**
- * @param file file to test
- * @return <code>true</code> if <code>file</code> is on remote
- * repository, <code>false</code> otherwise.
- */
- boolean isOnRemote(File file);
-
- /**
- * @param file file to test
- * @return <code>true</code> if file is uptodate,<code>false</code>
- * otherwise.
- * @throws VCSException if any exception while operation
- */
- boolean isUpToDate(File file) throws VCSException;
-
- /**
- * @param file file to test
- * @return <code>true</code> if file is handled by VCS,<code>false</code>
- * otherwise.
- */
- boolean isVersionnableFile(File file);
-
- /**
- * add on remote repository somes directories
- *
- * @param commitMessage commit message
- * @param dirNames names of the directories to create on remote repository (could
- * used multi-level directories)
- * @throws VCSException if any exception while operation
- */
- void makeRemoteDir(String commitMessage, String... dirNames)
- throws VCSException;
-
- /**
- * delete on remote repository somes directories
- *
- * @param commitMessage commit message
- * @param dirNames names of the directories to delete on remote repository (could
- * used multi-level directories)
- * @throws VCSException if any exception while operation
- */
- void deleteRemoteDir(String commitMessage, String... dirNames)
- throws VCSException;
-
- /**
- * add a list of files into repository
- *
- * @param files files to add
- * @param msg message for VCS commit, if <code>null</code> then no commit
- * is performed
- * @return revision of the operation
- * @throws VCSException if any exception while operation
- */
- long add(List<File> files, String msg) throws VCSException;
-
- // void add(File file, String msg) throws VCSException;
-
- /**
- * delete a list of files from repository
- *
- * @param files files to delete
- * @param msg message for VCS commit, if <code>null</code> then no commit
- * is performed
- * @throws VCSException if any exception while operation
- */
- void delete(List<File> files, String msg) throws VCSException;
-
- /**
- * revert a list of files from repository
- *
- * @param files files to revert
- * @throws VCSException if any exception while operation
- */
- void revert(List<File> files) throws VCSException;
-
- /**
- * commit a list of files into repository
- *
- * @param files files to commit
- * @param msg message for VCS commit
- * @return revision of the operation
- * @throws VCSException if any exception while operation
- */
- long commit(List<File> files, String msg) throws VCSException;
-
- /**
- * update a file to repository to a certain revision
- *
- * @param file file to update
- * @param revision object representing a revision for the current VCS
- * @throws VCSException if any exception while operation
- */
- void update(File file, Object revision) throws VCSException;
-
- /**
- * update a file to repository
- *
- * @param file file to update
- * @throws VCSException if any exception while operation
- */
- void update(File file) throws VCSException;
-
- /**
- * checkout a module from repository to a local file
- *
- * @param destDir local file where to checkout
- * @param module module's name to checkout
- * @param recurse flag to say to recurse checkout or not.
- * @throws VCSException if any exception while operation
- */
- void checkout(File destDir, String module, boolean recurse) throws VCSException;
-
- void checkoutFile(File destDir, String module) throws VCSException;
-
- long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException;
-
- /**
- * TODO This is not the good place : VCS != Storage
- *
- * @param directory directory to treate
- * @return TODO
- * @throws VCSException TODO
- */
- List<String> getRemoteStorageNames(File directory) throws VCSException;
-
- /**
- * TODO This is not the good place : VCS != Storage
- *
- * @param directory directory to treate
- * @return TODO
- */
- List<String> getLocalStorageNames(File directory);
-
- /**
- * @param f local file to treate
- * @return current local revision of a file
- * @throws VCSException TODO
- */
- Object getRevision(File f) throws VCSException;
-
- /**
- * Obtain the list of log entries for the file
- *
- * @param startRevision TODO
- * @param endRevision TODO
- * @param file file to treate
- * @return list of log entries for this file between two revisions
- * @throws VCSException if any exception while grabbing infos
- */
- List getLog(Object startRevision, Object endRevision, File file)
- throws VCSException;
-
- /**
- * obtain the content of a file for a specific revision
- *
- * @param file file to obtain
- * @param revision revision treated
- * @return the content of the file on repository for the specific revision
- * passed as arguement.
- * @throws VCSException if any exception while operation
- * @throws java.io.IOException TODO
- */
- String getFileContent(File file, Object revision) throws VCSException, IOException;
-
- /**
- * Build the changelog for <code>file</code> from current revision of this
- * local file against head repository head version. For each revision
- * between current revision and head revision of this file, we give the
- * following informations :
- * <ul>
- * <li>revision number</li>
- * <li>author</li>
- * <li>date</li>
- * <li>commit message</li>
- * </ul>
- *
- * @param file file to treate
- * @return a string representation of change log for the local file to the
- * head ?
- * @throws VCSException if any exception while building changelog
- */
- String getChangeLog(File file) throws VCSException;
-
- /**
- * Generate in the ouputstream the diff between the current revision of the
- * local file against headest revision on repository. <br>
- * If file is uptodate, then does nothing.
- *
- * @param file the file to treate
- * @return the diff
- * @throws VCSException inf any exception while building diff, such as :
- * <ul>
- * <li>unversionned file</li>
- * <li>unexistant file locally</li>
- * <li>locally modified file ?</li>
- * <li>...</li>
- * </ul>
- * @throws java.io.IOException if io problem with streams
- */
- String getDiff(File file) throws VCSException, IOException;
-
- /**
- * Generate in the ouputstream the diff between the current revision of the
- * local file against another revision (<code>againstRevision</code>) on
- * repository. <br>
- * If file is uptodate, then does nothing.
- *
- * @param file the file to treate
- * @param againstRevision the against revision to use
- * @return the diff
- * @throws VCSException inf any exception while building diff, such as :
- * <ul>
- * <li>unversionned file</li>
- * <li>unexistant file locally</li>
- * <li>locally modified file ?</li>
- * <li>...</li>
- * </ul>
- * @throws java.io.IOException if problem with streams
- */
- String getDiff(File file, Object againstRevision) throws VCSException, IOException;
-
- /**
- * @return <code>true</code> if protocol has changed between config and working copy
- * @throws VCSException if any pb
- */
- boolean hasProtocoleChanged() throws VCSException;
}
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java 2008-04-06 09:33:33 UTC (rev 382)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java 2008-04-06 09:33:56 UTC (rev 383)
@@ -19,310 +19,22 @@
*##%*/
package org.codelutin.vcs;
-import org.codelutin.vcs.type.VCSState;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-
/**
* Contract of an VCS handler
*
* @author chemit
*/
-public interface VCSHandler<C extends VCSConnexion> {
+public interface VCSHandler<C extends VCSConnexion> extends VCSCommon {
/**
- * init working copy, says if it is the first we use it it, we will checkout
- * the databaseDirectory directory
+ * Attach a connexion to handler.
+ * <p/>
+ * Note : <b>This method MUST be called before all.</b>
*
- * @param connexion vcs connexion to use
- * @throws VCSException if any exception while init
+ * @param connexion the connexion to attach
*/
- void initWorkingCopy(C connexion) throws VCSException;
+ void setConnexion(C connexion);
- /**
- * delete the local working copy with all his files
- *
- * @param connexion vcs connexion to use
- */
- void deleteWorkingCopy(C connexion);
- /**
- * @return a <code>FilenameFilter<code> to detect all files and directories in a vcs working copy that
- * must be handled by vcs
- */
- FilenameFilter getVersionnableFilenameFilter();
-
- /**
- * @return a <code>FileFilter<code> to detect all files and directories in a vcs working copy that
- * must be handled by vcs
- */
- FileFilter getVersionnableFileFilter();
-
- /**
- * @return name of directory used by vcs to store in working copy, a data's
- * directory configuration (e.g CVS for cvs and .svn for svn)
- */
- String getConfLocalDirname();
-
- /**
- * @return name of the file used by vcs to store in working copy
- * configuration directory entries of data's directory (e.g Entries
- * for cvs and entries for svn)
- */
- String getConfLocalEntriesFilename();
-
- VCSState getState(C connexion, File file, Collection tmp) throws VCSException;
-
- VCSState getState(C connexion, File file, Collection tmp, boolean noremote) throws VCSException;
-
- /**
- * @param connexion vcs connexion to use
- * @param file file to test
- * @return <code>true</code> if <code>file</code> is on remote
- * repository, <code>false</code> otherwise.
- */
- boolean isOnRemote(C connexion, File file);
-
- /**
- * @param connexion vcs connexion to use
- * @param file file to test
- * @return <code>true</code> if file is uptodate,<code>false</code>
- * otherwise.
- * @throws VCSException if any exception while operation
- */
- boolean isUpToDate(C connexion, File file) throws VCSException;
-
- /**
- * @param connexion vcs connexion to use
- * @param file file to test
- * @return <code>true</code> if file is handled by VCS,<code>false</code>
- * otherwise.
- */
- boolean isVersionnableFile(C connexion, File file);
-
- /**
- * add on remote repository somes directories
- *
- * @param connexion vcs connexion to use
- * @param commitMessage commit message
- * @param dirNames names of the directories to create on remote repository (could
- * used multi-level directories)
- * @throws VCSException if any exception while operation
- */
- void makeRemoteDir(C connexion, String commitMessage, String... dirNames)
- throws VCSException;
-
- /**
- * delete on remote repository somes directories
- *
- * @param connexion vcs connexion to use
- * @param commitMessage commit message
- * @param dirNames names of the directories to delete on remote repository (could
- * used multi-level directories)
- * @throws VCSException if any exception while operation
- */
- void deleteRemoteDir(C connexion, String commitMessage, String... dirNames)
- throws VCSException;
-
- /**
- * add a list of files into repository
- *
- * @param connexion vcs connexion to use
- * @param files files to add
- * @param msg message for VCS commit, if <code>null</code> then no commit
- * is performed
- * @return revision of the operation
- * @throws VCSException if any exception while operation
- */
- long add(C connexion, List<File> files, String msg) throws VCSException;
-
- // void add(File file, String msg) throws VCSException;
-
- /**
- * delete a list of files from repository
- *
- * @param connexion vcs connexion to use
- * @param files files to delete
- * @param msg message for VCS commit, if <code>null</code> then no commit
- * is performed
- * @throws VCSException if any exception while operation
- */
- void delete(C connexion, List<File> files, String msg) throws VCSException;
-
- /**
- * revert a list of files from repository
- *
- * @param connexion vcs connexion to use
- * @param files files to revert
- * @throws VCSException if any exception while operation
- */
- void revert(C connexion, List<File> files) throws VCSException;
-
- /**
- * commit a list of files into repository
- *
- * @param connexion vcs connexion to use
- * @param files files to commit
- * @param msg message for VCS commit
- * @return revision of the operation
- * @throws VCSException if any exception while operation
- */
- long commit(C connexion, List<File> files, String msg) throws VCSException;
-
- /**
- * update a file to repository to a certain revision
- *
- * @param connexion vcs connexion to use
- * @param file file to update
- * @param revision object representing a revision for the current VCS
- * @throws VCSException if any exception while operation
- */
- void update(C connexion, File file, Object revision) throws VCSException;
-
- /**
- * update a file to repository
- *
- * @param connexion vcs connexion to use
- * @param file file to update
- * @throws VCSException if any exception while operation
- */
- void update(C connexion, File file) throws VCSException;
-
- /**
- * checkout a module from repository to a local file
- *
- * @param connexion vcs connexion to use
- * @param destDir local file where to checkout
- * @param module module's name to checkout
- * @param recurse flag to say to recurse checkout or not.
- * @throws VCSException if any exception while operation
- */
- void checkout(C connexion, File destDir, String module, boolean recurse) throws VCSException;
-
- void checkoutFile(C connexion, File destDir, String module) throws VCSException;
-
- long checkoutOnlyTheDirectory(C connexion, File root, Object revision) throws VCSException;
-
- /**
- * TODO This is not the good place : VCS != Storage
- *
- * @param connexion vcs connexion to use
- * @param directory directory to treate
- * @return TODO
- * @throws VCSException TODO
- */
- List<String> getRemoteStorageNames(C connexion, File directory) throws VCSException;
-
- /**
- * TODO This is not the good place : VCS != Storage
- *
- * @param connexion vcs connexion to use
- * @param directory directory to treate
- * @return TODO
- */
- List<String> getLocalStorageNames(C connexion, File directory);
-
- /**
- * @param connexion vcs connexion to use
- * @param f local file to treate
- * @return current local revision of a file
- * @throws VCSException TODO
- */
- Object getRevision(C connexion, File f) throws VCSException;
-
- /**
- * Obtain the list of log entries for the file
- *
- * @param connexion vcs connexion to use
- * @param startRevision TODO
- * @param endRevision TODO
- * @param file file to treate
- * @return list of log entries for this file between two revisions
- * @throws VCSException if any exception while grabbing infos
- */
- List getLog(C connexion, Object startRevision, Object endRevision, File file)
- throws VCSException;
-
- /**
- * obtain the content of a file for a specific revision
- *
- * @param connexion vcs connexion to use
- * @param file file to obtain
- * @param revision revision treated
- * @return the content of the file on repository for the specific revision
- * passed as arguement.
- * @throws VCSException if any exception while operation
- * @throws java.io.IOException TODO
- */
- String getFileContent(C connexion, File file, Object revision) throws VCSException, IOException;
-
- /**
- * Build the changelog for <code>file</code> from current revision of this
- * local file against head repository head version. For each revision
- * between current revision and head revision of this file, we give the
- * following informations :
- * <ul>
- * <li>revision number</li>
- * <li>author</li>
- * <li>date</li>
- * <li>commit message</li>
- * </ul>
- *
- * @param connexion vcs connexion to use
- * @param file file to treate
- * @return a string representation of change log for the local file to the
- * head ?
- * @throws VCSException if any exception while building changelog
- */
- String getChangeLog(C connexion, File file) throws VCSException;
-
- /**
- * Generate in the ouputstream the diff between the current revision of the
- * local file against headest revision on repository. <br>
- * If file is uptodate, then does nothing.
- *
- * @param connexion vcs connexion to use
- * @param file the file to treate
- * @return the diff
- * @throws VCSException inf any exception while building diff, such as :
- * <ul>
- * <li>unversionned file</li>
- * <li>unexistant file locally</li>
- * <li>locally modified file ?</li>
- * <li>...</li>
- * </ul>
- * @throws java.io.IOException if io problem with streams
- */
- String getDiff(C connexion, File file) throws VCSException, IOException;
-
- /**
- * Generate in the ouputstream the diff between the current revision of the
- * local file against another revision (<code>againstRevision</code>) on
- * repository. <br>
- * If file is uptodate, then does nothing.
- *
- * @param connexion vcs connexion to use
- * @param file the file to treate
- * @param againstRevision the against revision to use
- * @return the diff
- * @throws VCSException inf any exception while building diff, such as :
- * <ul>
- * <li>unversionned file</li>
- * <li>unexistant file locally</li>
- * <li>locally modified file ?</li>
- * <li>...</li>
- * </ul>
- * @throws java.io.IOException if problem with streams
- */
- String getDiff(C connexion, File file, Object againstRevision) throws VCSException, IOException;
-
-
- boolean hasProtocoleChanged(C connexion) throws VCSException;
-
}
\ No newline at end of file
1
0
r382 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 09:33:33 +0000 (Sun, 06 Apr 2008)
New Revision: 382
Added:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java
Log:
introduce VCSCommon contract tobe realized by VCSHandler and VCSConnexion
Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java (from rev 376, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-06 09:33:33 UTC (rev 382)
@@ -0,0 +1,302 @@
+/* *##%
+* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin,
+* Benjamin Poussin, 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;
+
+import org.codelutin.vcs.type.VCSState;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Contract of operations to realized by a handler or a connexion
+ *
+ * @author chemit
+ */
+
+public interface VCSCommon {
+
+ /**
+ * init working copy, says if it is the first we use it it, we will checkout
+ * the databaseDirectory directory
+ *
+ * @throws org.codelutin.vcs.VCSException if any exception while init
+ */
+ void initWorkingCopy() throws VCSException;
+
+ /** delete the local working copy with all his files */
+ void deleteWorkingCopy();
+
+ /**
+ * @return a <code>FilenameFilter<code> to detect all files and directories in a vcs working copy that
+ * must be handled by vcs
+ */
+ FilenameFilter getVersionnableFilenameFilter();
+
+ /**
+ * @return a <code>FileFilter<code> to detect all files and directories in a vcs working copy that
+ * must be handled by vcs
+ */
+ FileFilter getVersionnableFileFilter();
+
+ /**
+ * @return name of directory used by vcs to store in working copy, a data's
+ * directory configuration (e.g CVS for cvs and .svn for svn)
+ */
+ String getConfLocalDirname();
+
+ /**
+ * @return name of the file used by vcs to store in working copy
+ * configuration directory entries of data's directory (e.g Entries
+ * for cvs and entries for svn)
+ */
+ String getConfLocalEntriesFilename();
+
+ VCSState getState(File file, Collection tmp) throws VCSException;
+
+ VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException;
+
+ /**
+ * @param file file to test
+ * @return <code>true</code> if <code>file</code> is on remote
+ * repository, <code>false</code> otherwise.
+ */
+ boolean isOnRemote(File file);
+
+ /**
+ * @param file file to test
+ * @return <code>true</code> if file is uptodate,<code>false</code>
+ * otherwise.
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ boolean isUpToDate(File file) throws VCSException;
+
+ /**
+ * @param file file to test
+ * @return <code>true</code> if file is handled by VCS,<code>false</code>
+ * otherwise.
+ */
+ boolean isVersionnableFile(File file);
+
+ /**
+ * add on remote repository somes directories
+ *
+ * @param commitMessage commit message
+ * @param dirNames names of the directories to create on remote repository (could
+ * used multi-level directories)
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void makeRemoteDir(String commitMessage, String... dirNames)
+ throws VCSException;
+
+ /**
+ * delete on remote repository somes directories
+ *
+ * @param commitMessage commit message
+ * @param dirNames names of the directories to delete on remote repository (could
+ * used multi-level directories)
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void deleteRemoteDir(String commitMessage, String... dirNames)
+ throws VCSException;
+
+ /**
+ * add a list of files into repository
+ *
+ * @param files files to add
+ * @param msg message for VCS commit, if <code>null</code> then no commit
+ * is performed
+ * @return revision of the operation
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ long add(List<File> files, String msg) throws VCSException;
+
+ // void add(File file, String msg) throws VCSException;
+
+ /**
+ * delete a list of files from repository
+ *
+ * @param files files to delete
+ * @param msg message for VCS commit, if <code>null</code> then no commit
+ * is performed
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void delete(List<File> files, String msg) throws VCSException;
+
+ /**
+ * revert a list of files from repository
+ *
+ * @param files files to revert
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void revert(List<File> files) throws VCSException;
+
+ /**
+ * commit a list of files into repository
+ *
+ * @param files files to commit
+ * @param msg message for VCS commit
+ * @return revision of the operation
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ long commit(List<File> files, String msg) throws VCSException;
+
+ /**
+ * update a file to repository to a certain revision
+ *
+ * @param file file to update
+ * @param revision object representing a revision for the current VCS
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void update(File file, Object revision) throws VCSException;
+
+ /**
+ * update a file to repository
+ *
+ * @param file file to update
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void update(File file) throws VCSException;
+
+ /**
+ * checkout a module from repository to a local file
+ *
+ * @param destDir local file where to checkout
+ * @param module module's name to checkout
+ * @param recurse flag to say to recurse checkout or not.
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ */
+ void checkout(File destDir, String module, boolean recurse) throws VCSException;
+
+ void checkoutFile(File destDir, String module) throws VCSException;
+
+ long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException;
+
+ /**
+ * TODO This is not the good place : VCS != Storage
+ *
+ * @param directory directory to treate
+ * @return TODO
+ * @throws org.codelutin.vcs.VCSException TODO
+ */
+ List<String> getRemoteStorageNames(File directory) throws VCSException;
+
+ /**
+ * TODO This is not the good place : VCS != Storage
+ *
+ * @param directory directory to treate
+ * @return TODO
+ */
+ List<String> getLocalStorageNames(File directory);
+
+ /**
+ * @param f local file to treate
+ * @return current local revision of a file
+ * @throws org.codelutin.vcs.VCSException TODO
+ */
+ Object getRevision(File f) throws VCSException;
+
+ /**
+ * Obtain the list of log entries for the file
+ *
+ * @param startRevision TODO
+ * @param endRevision TODO
+ * @param file file to treate
+ * @return list of log entries for this file between two revisions
+ * @throws org.codelutin.vcs.VCSException if any exception while grabbing infos
+ */
+ List getLog(Object startRevision, Object endRevision, File file)
+ throws VCSException;
+
+ /**
+ * obtain the content of a file for a specific revision
+ *
+ * @param file file to obtain
+ * @param revision revision treated
+ * @return the content of the file on repository for the specific revision
+ * passed as arguement.
+ * @throws org.codelutin.vcs.VCSException if any exception while operation
+ * @throws java.io.IOException TODO
+ */
+ String getFileContent(File file, Object revision) throws VCSException, IOException;
+
+ /**
+ * Build the changelog for <code>file</code> from current revision of this
+ * local file against head repository head version. For each revision
+ * between current revision and head revision of this file, we give the
+ * following informations :
+ * <ul>
+ * <li>revision number</li>
+ * <li>author</li>
+ * <li>date</li>
+ * <li>commit message</li>
+ * </ul>
+ *
+ * @param file file to treate
+ * @return a string representation of change log for the local file to the
+ * head ?
+ * @throws org.codelutin.vcs.VCSException if any exception while building changelog
+ */
+ String getChangeLog(File file) throws VCSException;
+
+ /**
+ * Generate in the ouputstream the diff between the current revision of the
+ * local file against headest revision on repository. <br>
+ * If file is uptodate, then does nothing.
+ *
+ * @param file the file to treate
+ * @return the diff
+ * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as :
+ * <ul>
+ * <li>unversionned file</li>
+ * <li>unexistant file locally</li>
+ * <li>locally modified file ?</li>
+ * <li>...</li>
+ * </ul>
+ * @throws java.io.IOException if io problem with streams
+ */
+ String getDiff(File file) throws VCSException, IOException;
+
+
+ /**
+ * Generate in the ouputstream the diff between the current revision of the
+ * local file against another revision (<code>againstRevision</code>) on
+ * repository. <br>
+ * If file is uptodate, then does nothing.
+ *
+ * @param file the file to treate
+ * @param againstRevision the against revision to use
+ * @return the diff
+ * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as :
+ * <ul>
+ * <li>unversionned file</li>
+ * <li>unexistant file locally</li>
+ * <li>locally modified file ?</li>
+ * <li>...</li>
+ * </ul>
+ * @throws java.io.IOException if problem with streams
+ */
+ String getDiff(File file, Object againstRevision) throws VCSException, IOException;
+
+ boolean hasProtocoleChanged() throws VCSException;
+}
\ No newline at end of file
1
0
r381 - trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 08:38:06 +0000 (Sun, 06 Apr 2008)
New Revision: 381
Added:
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java
Removed:
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java
Log:
rename
Copied: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java (from rev 378, trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockHandler.java 2008-04-06 08:38:06 UTC (rev 381)
@@ -0,0 +1,119 @@
+/**
+ * # #% 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.vcs.impl.mock;
+
+import org.codelutin.vcs.VCSException;
+import org.codelutin.vcs.type.VCSState;
+import org.codelutin.vcs.util.AbstractVCSHandler;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+/** @author chemit */
+public class MockHandler extends AbstractVCSHandler<MockConnexion> {
+
+ public MockHandler() {
+ super("", "");
+ }
+
+ public void initWorkingCopy(MockConnexion connexion) throws VCSException {
+ }
+
+ public VCSState getState(MockConnexion connexion, File fileState, Collection tmp) throws VCSException {
+ return null;
+ }
+
+ public VCSState getState(MockConnexion connexion, File file, Collection tmp, boolean noremote) throws VCSException {
+ return null;
+ }
+
+ public boolean isOnRemote(MockConnexion connexion, File file) {
+ return false;
+ }
+
+ public boolean isUpToDate(MockConnexion connexion, File file) throws VCSException {
+ return false;
+ }
+
+ public void makeRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
+ }
+
+ public void deleteRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
+ }
+
+ public long add(MockConnexion connexion, List<File> files, String msg) throws VCSException {
+ return 0;
+ }
+
+ public void delete(MockConnexion connexion, List<File> files, String msg) throws VCSException {
+ }
+
+ public void revert(MockConnexion connexion, List<File> files) throws VCSException {
+ }
+
+ public long commit(MockConnexion connexion, List<File> files, String msg) throws VCSException {
+ return 0;
+ }
+
+ public void update(MockConnexion connexion, File file, Object revision) throws VCSException {
+ }
+
+ public void update(MockConnexion connexion, File file) throws VCSException {
+ }
+
+ public void checkout(MockConnexion connexion, File destDir, String module, boolean recurse) throws VCSException {
+ }
+
+ public void checkoutFile(MockConnexion connexion, File destDir, String module) throws VCSException {
+ }
+
+ public long checkoutOnlyTheDirectory(MockConnexion connexion, File root, Object revision) throws VCSException {
+ return 0;
+ }
+
+ public List<String> getRemoteStorageNames(MockConnexion connexion, File directory) throws VCSException {
+ return null;
+ }
+
+ public Object getRevision(MockConnexion connexion, File f) throws VCSException {
+ return null;
+ }
+
+ public List getLog(MockConnexion connexion, Object startRevision, Object endRevision, File file) throws VCSException {
+ return null;
+ }
+
+ public String getFileContent(MockConnexion connexion, File file, Object revision) throws VCSException, IOException {
+ return null;
+ }
+
+ public String getChangeLog(MockConnexion connexion, File file) throws VCSException {
+ return null;
+ }
+
+ public String getDiff(MockConnexion connexion, File file) throws VCSException, IOException {
+ return null;
+ }
+
+ public String getDiff(MockConnexion connexion, File file, Object againstRevision) throws VCSException, IOException {
+ return null;
+ }
+
+ public boolean hasProtocoleChanged(MockConnexion connexion) throws VCSException {
+ return false;
+ }
+}
Deleted: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java 2008-04-06 08:17:21 UTC (rev 380)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java 2008-04-06 08:38:06 UTC (rev 381)
@@ -1,119 +0,0 @@
-/**
- * # #% 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.vcs.impl.mock;
-
-import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.type.VCSState;
-import org.codelutin.vcs.util.AbstractVCSHandler;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-
-/** @author chemit */
-public class MockVCSHandler extends AbstractVCSHandler<MockConnexion> {
-
- public MockVCSHandler() {
- super("", "");
- }
-
- public void initWorkingCopy(MockConnexion connexion) throws VCSException {
- }
-
- public VCSState getState(MockConnexion connexion, File fileState, Collection tmp) throws VCSException {
- return null;
- }
-
- public VCSState getState(MockConnexion connexion, File file, Collection tmp, boolean noremote) throws VCSException {
- return null;
- }
-
- public boolean isOnRemote(MockConnexion connexion, File file) {
- return false;
- }
-
- public boolean isUpToDate(MockConnexion connexion, File file) throws VCSException {
- return false;
- }
-
- public void makeRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
- }
-
- public void deleteRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException {
- }
-
- public long add(MockConnexion connexion, List<File> files, String msg) throws VCSException {
- return 0;
- }
-
- public void delete(MockConnexion connexion, List<File> files, String msg) throws VCSException {
- }
-
- public void revert(MockConnexion connexion, List<File> files) throws VCSException {
- }
-
- public long commit(MockConnexion connexion, List<File> files, String msg) throws VCSException {
- return 0;
- }
-
- public void update(MockConnexion connexion, File file, Object revision) throws VCSException {
- }
-
- public void update(MockConnexion connexion, File file) throws VCSException {
- }
-
- public void checkout(MockConnexion connexion, File destDir, String module, boolean recurse) throws VCSException {
- }
-
- public void checkoutFile(MockConnexion connexion, File destDir, String module) throws VCSException {
- }
-
- public long checkoutOnlyTheDirectory(MockConnexion connexion, File root, Object revision) throws VCSException {
- return 0;
- }
-
- public List<String> getRemoteStorageNames(MockConnexion connexion, File directory) throws VCSException {
- return null;
- }
-
- public Object getRevision(MockConnexion connexion, File f) throws VCSException {
- return null;
- }
-
- public List getLog(MockConnexion connexion, Object startRevision, Object endRevision, File file) throws VCSException {
- return null;
- }
-
- public String getFileContent(MockConnexion connexion, File file, Object revision) throws VCSException, IOException {
- return null;
- }
-
- public String getChangeLog(MockConnexion connexion, File file) throws VCSException {
- return null;
- }
-
- public String getDiff(MockConnexion connexion, File file) throws VCSException, IOException {
- return null;
- }
-
- public String getDiff(MockConnexion connexion, File file, Object againstRevision) throws VCSException, IOException {
- return null;
- }
-
- public boolean hasProtocoleChanged(MockConnexion connexion) throws VCSException {
- return false;
- }
-}
1
0
r380 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
by tchemit@users.labs.libre-entreprise.org 06 Apr '08
06 Apr '08
Author: tchemit
Date: 2008-04-06 08:17:21 +0000 (Sun, 06 Apr 2008)
New Revision: 380
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java
Log:
javadoc
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 07:31:39 UTC (rev 379)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 08:17:21 UTC (rev 380)
@@ -31,6 +31,13 @@
String getName();
/**
+ * init the provider. (instanciate handler)
+ * <p/>
+ * This method MUST be invoked before asking any connexion.
+ */
+ void init();
+
+ /**
* return a new VCSHandler instance for given config.
*
* @return the cached instance of handler
@@ -38,15 +45,12 @@
*/
H getHandler() throws IllegalStateException;
- /** init the provider */
- void init();
-
/**
* Instanciate an new connexion for a given config, and init it.
*
* @param mode the mode required
* @param config the config to be used
- * @return the new connexion initializd <b>but not opened</b>.
+ * @return the new connexion initialized <b>but not opened</b>.
* @throws IllegalStateException if provider was not init via {@link #init()}
*/
C newConnection(VCSConnexionMode mode, VCSConnexionConfig config) throws IllegalStateException;
1
0