Jaxx-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
- 3940 discussions
[Buix-commits] r349 - in trunk/lutinvcs: lutinvcs-provider-cvs/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 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 21:26:10 +0000 (Fri, 04 Apr 2008)
New Revision: 349
Added:
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java
Removed:
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java
Modified:
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java
Log:
refactor provider to act as handler and connexion factory
Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java 2008-04-04 21:24:11 UTC (rev 348)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java 2008-04-04 21:26:10 UTC (rev 349)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.impl.cvs.CVSHandler;
import org.codelutin.vcs.impl.cvs.CVSHelper;
+import org.codelutin.vcs.impl.cvs.CVSConnexion;
/** @author chemit */
public class CVSProvider implements VCSProvider<CVSHandler, CVSConnexion> {
Copied: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSConnexion.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSConnexion.java 2008-04-04 21:26:10 UTC (rev 349)
@@ -0,0 +1,36 @@
+/**
+ * # #% 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.cvs;
+
+import org.codelutin.vcs.util.AbstractVCSConnexion;
+import org.codelutin.vcs.VCSConfig;
+import org.codelutin.vcs.VCSHandler;
+
+/** @author chemit */
+public class CVSConnexion extends AbstractVCSConnexion {
+
+ public void init(VCSConfig config, VCSHandler handler) {
+ }
+
+ @Override
+ public void close() throws IllegalStateException {
+ checkInit();
+ }
+
+ @Override
+ public void open() throws IllegalStateException {
+ checkInit();
+ }
+}
\ No newline at end of file
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-04 21:24:11 UTC (rev 348)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-04 21:26:10 UTC (rev 349)
@@ -15,6 +15,7 @@
package org.codelutin.vcs;
import org.codelutin.vcs.impl.mock.MockVCSHandler;
+import org.codelutin.vcs.impl.mock.MockConnexion;
/** @author chemit */
public class MockProvider implements VCSProvider<MockVCSHandler, MockConnexion> {
Copied: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockConnexion.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-04 21:26:10 UTC (rev 349)
@@ -0,0 +1,40 @@
+/**
+ * # #% 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.util.AbstractVCSConnexion;
+import org.codelutin.vcs.VCSConfig;
+import org.codelutin.vcs.VCSHandler;
+import org.codelutin.vcs.ConnectionState;
+
+/** @author chemit */
+public class MockConnexion extends AbstractVCSConnexion {
+
+ public void init(VCSConfig config, VCSHandler handler) {
+ state = ConnectionState.INIT;
+ }
+
+ @Override
+ public void close() throws IllegalStateException {
+ checkInit();
+ }
+
+ @Override
+ public void open() throws IllegalStateException {
+ checkInit();
+ state = ConnectionState.INIT;
+ }
+
+}
\ No newline at end of file
Deleted: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java 2008-04-04 21:24:11 UTC (rev 348)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java 2008-04-04 21:26:10 UTC (rev 349)
@@ -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;
-
-import org.codelutin.vcs.util.AbstractVCSConnexion;
-
-/** @author chemit */
-public class SVNConnexion extends AbstractVCSConnexion {
-
- public void init(VCSConfig config, VCSHandler handler) {
- state = null;
- }
-
- @Override
- public void close() throws IllegalStateException {
- checkInit();
- if (!isOpen()) {
- return;
- }
- }
-
- @Override
- public void open() throws IllegalStateException {
- checkInit();
- }
-}
Copied: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNConnexion.java 2008-04-04 21:26:10 UTC (rev 349)
@@ -0,0 +1,40 @@
+/**
+ * # #% 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.svn;
+
+import org.codelutin.vcs.util.AbstractVCSConnexion;
+import org.codelutin.vcs.VCSConfig;
+import org.codelutin.vcs.VCSHandler;
+
+/** @author chemit */
+public class SVNConnexion extends AbstractVCSConnexion {
+
+ public void init(VCSConfig config, VCSHandler handler) {
+ state = null;
+ }
+
+ @Override
+ public void close() throws IllegalStateException {
+ checkInit();
+ if (!isOpen()) {
+ return;
+ }
+ }
+
+ @Override
+ public void open() throws IllegalStateException {
+ checkInit();
+ }
+}
1
0
[Buix-commits] r348 - in trunk/lutinvcs: lutinvcs-provider-mock/src/main/resources/META-INF/services lutinvcs-provider-svn/src/main/resources/META-INF/services
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 21:24:11 +0000 (Fri, 04 Apr 2008)
New Revision: 348
Modified:
trunk/lutinvcs/lutinvcs-provider-mock/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider
trunk/lutinvcs/lutinvcs-provider-svn/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider
Log:
refactor provider to act as handler and connexion factory
Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:23:56 UTC (rev 347)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:24:11 UTC (rev 348)
@@ -1 +1 @@
-org.codelutin.vcs.MockHandlerProvider
\ No newline at end of file
+org.codelutin.vcs.MockProvider
\ No newline at end of file
Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:23:56 UTC (rev 347)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:24:11 UTC (rev 348)
@@ -1 +1 @@
-org.codelutin.vcs.SVNHandlerProvider
\ No newline at end of file
+org.codelutin.vcs.SVNProvider
\ No newline at end of file
1
0
[Buix-commits] r347 - in trunk/lutinvcs: lutinvcs-api/src/main/java/org/codelutin/vcs lutinvcs-core/src/main/java/org/codelutin/vcs lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs lutinvcs-provider-cvs/src/main/resources/META-INF/services lutinvcs-provider-mock/src/main/java/org/codelutin/vcs lutinvcs-provider-svn/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 21:23:56 +0000 (Fri, 04 Apr 2008)
New Revision: 347
Added:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java
Removed:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java
Modified:
trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider
Log:
refactor provider to act as handler and connexion factory
Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -1,46 +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;
-
-/**
- * The contract to be realized to provide vcs communication.
- * <p/>
- * Atcs as a handler and connexion factory.
- *
- * @author chemit
- * @see VCSHandler
- * @see VCSConnexion
- */
-public interface VCSHandlerProvider<H extends VCSHandler, C extends VCSConnexion> {
-
- /** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */
- String getName();
-
- /**
- * return a new VCSHandler instance for given config.
- *
- * @param config svn handler config
- * @return the new instance
- */
- H newInstance(VCSConfig config);
-
- /**
- * @param mode the mode required
- * @param config the config to be used
- * @return the new connexion initializd <b>but not opened</b>.
- */
- C newConnection(VCSConnexionMode mode, VCSConfig config);
-
-}
Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java (from rev 346, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -0,0 +1,46 @@
+/**
+ * # #% 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;
+
+/**
+ * The contract to be realized to provide vcs communication.
+ * <p/>
+ * Atcs as a handler and connexion factory.
+ *
+ * @author chemit
+ * @see VCSHandler
+ * @see VCSConnexion
+ */
+public interface VCSProvider<H extends VCSHandler, C extends VCSConnexion> {
+
+ /** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */
+ String getName();
+
+ /**
+ * return a new VCSHandler instance for given config.
+ *
+ * @param config svn handler config
+ * @return the new instance
+ */
+ H newInstance(VCSConfig config);
+
+ /**
+ * @param mode the mode required
+ * @param config the config to be used
+ * @return the new connexion initializd <b>but not opened</b>.
+ */
+ C newConnection(VCSConnexionMode mode, VCSConfig config);
+
+}
Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java
===================================================================
--- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java 2008-04-04 21:22:58 UTC (rev 346)
+++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandlerFactory.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -49,7 +49,7 @@
private VCSHandler handler;
/** providers availables */
- private List<VCSHandlerProvider> providers;
+ private List<VCSProvider> providers;
public static VCSHandlerFactory getInstance() {
@@ -91,7 +91,7 @@
VCSHandlerFactory factory = getInstance();
assertConfigIsInit(config);
- VCSHandlerProvider<?> provider = factory.getProvider(config.getType().name().toUpperCase());
+ VCSProvider<?> provider = factory.getProvider(config.getType().name().toUpperCase());
if (provider == null) {
throw new IllegalArgumentException("could not find a provider for type " + config.getType());
}
@@ -100,21 +100,21 @@
private VCSHandlerFactory() {
long t0 = System.nanoTime();
- providers = new ArrayList<VCSHandlerProvider>();
- for (VCSHandlerProvider provider : ServiceLoader.load(VCSHandlerProvider.class)) {
+ providers = new ArrayList<VCSProvider>();
+ for (VCSProvider provider : ServiceLoader.load(VCSProvider.class)) {
providers.add(provider);
if (log.isDebugEnabled()) {
log.debug("find " + provider);
}
}
log.info("found " + providers.size() + " provider(s) " + providers.toString() + " in " + StringUtil.convertTime(t0, System.nanoTime()));
- for (VCSHandlerProvider provider : providers) {
+ for (VCSProvider provider : providers) {
log.info(provider.getName() + " [" + provider + ']');
}
}
- private VCSHandlerProvider getProvider(String type) {
- for (VCSHandlerProvider provider : providers) {
+ private VCSProvider getProvider(String type) {
+ for (VCSProvider provider : providers) {
if (type.equals(provider.getName().toUpperCase())) {
return provider;
}
Deleted: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -1,35 +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 org.codelutin.vcs.impl.cvs.CVSHandler;
-import org.codelutin.vcs.impl.cvs.CVSHelper;
-
-/** @author chemit */
-public class CVSHandlerProvider implements VCSHandlerProvider<CVSHandler, CVSConnexion> {
-
- public String getName() {
- return "CVS";
- }
-
- public CVSHandler newInstance(VCSConfig config) {
- CVSHelper.setConfig(config);
- return new CVSHandler(config);
- }
-
- public CVSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
- return null;
- }
-}
\ No newline at end of file
Copied: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -0,0 +1,35 @@
+/**
+ * # #% 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 org.codelutin.vcs.impl.cvs.CVSHandler;
+import org.codelutin.vcs.impl.cvs.CVSHelper;
+
+/** @author chemit */
+public class CVSProvider implements VCSProvider<CVSHandler, CVSConnexion> {
+
+ public String getName() {
+ return "CVS";
+ }
+
+ public CVSHandler newInstance(VCSConfig config) {
+ CVSHelper.setConfig(config);
+ return new CVSHandler(config);
+ }
+
+ public CVSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
+ return null;
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:22:58 UTC (rev 346)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/resources/META-INF/services/org.codelutin.vcs.VCSHandlerProvider 2008-04-04 21:23:56 UTC (rev 347)
@@ -1 +1 @@
-org.codelutin.vcs.CVSHandlerProvider
\ No newline at end of file
+org.codelutin.vcs.CVSProvider
\ No newline at end of file
Deleted: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -1,33 +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 org.codelutin.vcs.impl.mock.MockVCSHandler;
-
-/** @author chemit */
-public class MockHandlerProvider implements VCSHandlerProvider<MockVCSHandler, MockConnexion> {
-
- public String getName() {
- return "MOCK";
- }
-
- public MockVCSHandler newInstance(VCSConfig config) {
- return new MockVCSHandler(config);
- }
-
- public MockConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
- return null;
- }
-}
\ No newline at end of file
Copied: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -0,0 +1,33 @@
+/**
+ * # #% 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 org.codelutin.vcs.impl.mock.MockVCSHandler;
+
+/** @author chemit */
+public class MockProvider implements VCSProvider<MockVCSHandler, MockConnexion> {
+
+ public String getName() {
+ return "MOCK";
+ }
+
+ public MockVCSHandler newInstance(VCSConfig config) {
+ return new MockVCSHandler(config);
+ }
+
+ public MockConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
+ return null;
+ }
+}
\ No newline at end of file
Deleted: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -1,33 +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 org.codelutin.vcs.impl.svn.SVNHandler;
-import org.codelutin.vcs.util.AbstractVCSConnexion;
-
-/** @author chemit */
-public class SVNHandlerProvider implements VCSHandlerProvider<SVNHandler, AbstractVCSConnexion> {
- public String getName() {
- return "SVN";
- }
-
- public SVNHandler newInstance(VCSConfig config) {
- return new SVNHandler(config);
- }
-
- public AbstractVCSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
- return null;
- }
-}
Copied: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java (from rev 345, trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNProvider.java 2008-04-04 21:23:56 UTC (rev 347)
@@ -0,0 +1,33 @@
+/**
+ * # #% 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 org.codelutin.vcs.impl.svn.SVNHandler;
+import org.codelutin.vcs.util.AbstractVCSConnexion;
+
+/** @author chemit */
+public class SVNProvider implements VCSProvider<SVNHandler, AbstractVCSConnexion> {
+ public String getName() {
+ return "SVN";
+ }
+
+ public SVNHandler newInstance(VCSConfig config) {
+ return new SVNHandler(config);
+ }
+
+ public AbstractVCSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
+ return null;
+ }
+}
1
0
[Buix-commits] r346 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 21:22:58 +0000 (Fri, 04 Apr 2008)
New Revision: 346
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java
Log:
refactor provider to act as handler and connexion factory
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:14:37 UTC (rev 345)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:22:58 UTC (rev 346)
@@ -15,9 +15,13 @@
package org.codelutin.vcs;
/**
- * The contract to be realized to provide a {@link VCSHandler}.
+ * The contract to be realized to provide vcs communication.
+ * <p/>
+ * Atcs as a handler and connexion factory.
*
* @author chemit
+ * @see VCSHandler
+ * @see VCSConnexion
*/
public interface VCSHandlerProvider<H extends VCSHandler, C extends VCSConnexion> {
1
0
[Buix-commits] r345 - in trunk/lutinvcs: lutinvcs-api/src/main/java/org/codelutin/vcs lutinvcs-api/src/main/java/org/codelutin/vcs/util lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs lutinvcs-provider-cvs/src/test/java/org/codelutin/vcs/impl/cvs lutinvcs-provider-mock/src/main/java/org/codelutin/vcs lutinvcs-provider-svn/src/main/java/org/codelutin/vcs lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 21:14:37 +0000 (Fri, 04 Apr 2008)
New Revision: 345
Added:
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-provider-cvs/src/main/java/org/codelutin/vcs/CVSConnexion.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockConnexion.java
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java
Removed:
trunk/lutinvcs/lutinvcs-provider-cvs/src/test/java/org/codelutin/vcs/impl/cvs/CVSHandlerTest.java
trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNHandlerTest.java
trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNLogTest.java
Modified:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java
trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java
trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java
Log:
begin of refactor : handler are staeless with no config information
introduc a VCSConnexion objectto deal with connexion, handler must use now this object to perform action as a method parameter
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -24,6 +24,8 @@
* @author chemit
*/
public enum ConnectionState {
+ /** lorsque la connexion a �t� initialis�e (valid�e) mais pas ouverte */
+ INIT,
/** lorsque la connexion n'a pas encore initialis�e */
UNDEFINED,
/** lorsque la connexion est ok, mais que l'on est pas connect� */
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -61,12 +61,13 @@
/** libelle of the action */
private final String libelle;
- /** flag to say if action should be visible in ui */
+ /** flag to say if action should be visible in ui TODO Delete this */
private final boolean visible;
- /** flag to say if this action need backup */
+ /** flag to say if this action need backup TODO Delete this ? */
private final boolean backup;
/** flag to say if this action need write access to repository */
private final boolean write;
+ /** flag to say if this action need a commit message to be performed */
private boolean commit;
VCSAction(String libelle, boolean visible, boolean backup, boolean commit, boolean write) {
Added: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -0,0 +1,96 @@
+/**
+ * # #% 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.io.File;
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * Contract to be realized for a connexion to a vcs.
+ * <p/>
+ * The method {@link #init(VCSConfig, VCSHandler)} must be invoked before using the connexion.
+ *
+ * @author chemit
+ */
+public interface VCSConnexion {
+
+ /**
+ * @return the working copy used, can be null if no working copy exists.
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ File getWorkingCopy() throws IllegalStateException;
+
+ /**
+ * @return the URI used to connect to vcs
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ URI getRemoteURI() throws IllegalStateException;
+
+ /**
+ * @return the mode of this connexion
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ VCSConnexionMode getMode() throws IllegalStateException;
+
+ /**
+ * @return options to be used by this connexion
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ Map<String, String> getOptions() throws IllegalStateException;
+
+ /**
+ * Initialise the connexion.
+ * <p/>
+ * If connexion can not be established, then the method {@link #hasFailed()} will always
+ * return <code>true</code>.
+ *
+ * @param config config to be used to initialize the connexion.
+ * @param handler handler to be used to initialize the connexion.
+ */
+ void init(VCSConfig config, VCSHandler handler);
+
+ /**
+ * Close connexion.
+ *
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ void open() throws IllegalStateException;
+
+ /**
+ * Close connexion.
+ *
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ void close() throws IllegalStateException;
+
+ /**
+ * @return <code>true</code> if connexion is opened, <code>false</code> otherwise
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ boolean isOpen() throws IllegalStateException;
+
+ /**
+ * @return <code>true</code> if connexion is closed, <code>false</code> otherwise
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ boolean isClosed() throws IllegalStateException;
+
+ /**
+ * @return <code>true</code> if connexion has failed, <code>false</code> otherwise
+ * @throws IllegalStateException if {@link #init(VCSConfig, VCSHandler)} was not invoked before.
+ */
+ boolean hasFailed() throws IllegalStateException;
+}
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -21,5 +21,6 @@
*/
public enum VCSConnexionMode {
ANONYMOUS,
+ PASSWORD,
SSH
}
Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandlerProvider.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -19,7 +19,7 @@
*
* @author chemit
*/
-public interface VCSHandlerProvider<H extends VCSHandler> {
+public interface VCSHandlerProvider<H extends VCSHandler, C extends VCSConnexion> {
/** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */
String getName();
@@ -32,4 +32,11 @@
*/
H newInstance(VCSConfig config);
+ /**
+ * @param mode the mode required
+ * @param config the config to be used
+ * @return the new connexion initializd <b>but not opened</b>.
+ */
+ C newConnection(VCSConnexionMode mode, VCSConfig config);
+
}
Added: 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 (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -0,0 +1,88 @@
+/**
+ * # #% 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.util;
+
+import org.codelutin.vcs.ConnectionState;
+import org.codelutin.vcs.VCSConnexion;
+import org.codelutin.vcs.VCSConnexionMode;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Map;
+
+/** @author chemit */
+public abstract class AbstractVCSConnexion implements VCSConnexion {
+
+ public static final String OPTION_LOGIN = "login";
+ public static final String OPTION_PASSWORD = "password";
+ public static final String OPTION_PASSPHRASE = "passphrase";
+ public static final String OPTION_KEY_FILE = "keyfile";
+
+ protected File localRoot;
+ protected URI remoteRoot;
+ protected VCSConnexionMode mode;
+ protected ConnectionState state;
+
+ protected Map<String, String> options;
+
+ public File getWorkingCopy() throws IllegalStateException {
+ checkInit();
+ return localRoot;
+ }
+
+ public URI getRemoteURI() throws IllegalStateException {
+ checkInit();
+ return remoteRoot;
+ }
+
+ public VCSConnexionMode getMode() throws IllegalStateException {
+ checkInit();
+ return mode;
+ }
+
+ public Map<String, String> getOptions() throws IllegalStateException {
+ checkInit();
+ return options;
+ }
+
+ public boolean isOpen() throws IllegalStateException {
+ checkInit();
+ return !hasFailed() && state == ConnectionState.ON_LINE;
+ }
+
+ public boolean isClosed() throws IllegalStateException {
+ checkInit();
+ return !hasFailed() && state != ConnectionState.ON_LINE;
+ }
+
+ public boolean hasFailed() throws IllegalStateException {
+ checkInit();
+ return state == ConnectionState.ERROR;
+ }
+
+ protected void checkInit() throws IllegalStateException {
+ if (state == null) {
+ throw new IllegalStateException("connexion was not init");
+ }
+ }
+
+ protected void checkOpen() throws IllegalStateException {
+ checkInit();
+ if (!isOpen()) {
+ throw new IllegalStateException("connexion was not init");
+ }
+ }
+
+}
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-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -52,12 +52,13 @@
/**
* FilenameFilter to detect all files in a vcs working copy all files and directories that must be handled by vcs
*
- * @see org.codelutin.vcs.VCSHandler#getVersionnableFilenameFilter()
+ * @see VCSHandler#getVersionnableFilenameFilter()
*/
protected final FilenameFilter versionnableFilenameFilter;
protected final FileFilter versionnableFileFilter;
protected final String confLocalDirName;
protected final String confLocalEntriesFilename;
+
protected final VCSConfig config;
protected ListenerSet<VCSHandlerEventListener> listeners = new ListenerSet<VCSHandlerEventListener>();
Added: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSConnexion.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSConnexion.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -0,0 +1,34 @@
+/**
+ * # #% 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 org.codelutin.vcs.util.AbstractVCSConnexion;
+
+/** @author chemit */
+public class CVSConnexion extends AbstractVCSConnexion {
+
+ public void init(VCSConfig config, VCSHandler handler) {
+ }
+
+ @Override
+ public void close() throws IllegalStateException {
+ checkInit();
+ }
+
+ @Override
+ public void open() throws IllegalStateException {
+ checkInit();
+ }
+}
\ No newline at end of file
Modified: trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/CVSHandlerProvider.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -18,7 +18,7 @@
import org.codelutin.vcs.impl.cvs.CVSHelper;
/** @author chemit */
-public class CVSHandlerProvider implements VCSHandlerProvider<CVSHandler> {
+public class CVSHandlerProvider implements VCSHandlerProvider<CVSHandler, CVSConnexion> {
public String getName() {
return "CVS";
@@ -28,4 +28,8 @@
CVSHelper.setConfig(config);
return new CVSHandler(config);
}
+
+ public CVSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
+ return null;
+ }
}
\ No newline at end of file
Deleted: trunk/lutinvcs/lutinvcs-provider-cvs/src/test/java/org/codelutin/vcs/impl/cvs/CVSHandlerTest.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-cvs/src/test/java/org/codelutin/vcs/impl/cvs/CVSHandlerTest.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/test/java/org/codelutin/vcs/impl/cvs/CVSHandlerTest.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -1,16 +0,0 @@
-package org.codelutin.vcs.impl.cvs;
-
-import org.codelutin.vcs.VCSHandlerTest;
-import org.codelutin.vcs.VCSType;
-
-/** Test CVSHandler */
-class CVSHandlerTest extends VCSHandlerTest {
-
- protected void setUpVars() {
- vcsType = VCSType.CVS;
- super.setUpVars();
- }
-
- // if you don't want to execute some incompatible test just override them
-
-}
\ No newline at end of file
Added: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockConnexion.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockConnexion.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -0,0 +1,37 @@
+/**
+ * # #% 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 org.codelutin.vcs.util.AbstractVCSConnexion;
+
+/** @author chemit */
+public class MockConnexion extends AbstractVCSConnexion {
+
+ public void init(VCSConfig config, VCSHandler handler) {
+ state = ConnectionState.INIT;
+ }
+
+ @Override
+ public void close() throws IllegalStateException {
+ checkInit();
+ }
+
+ @Override
+ public void open() throws IllegalStateException {
+ checkInit();
+ state = ConnectionState.INIT;
+ }
+
+}
\ No newline at end of file
Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockHandlerProvider.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -17,7 +17,7 @@
import org.codelutin.vcs.impl.mock.MockVCSHandler;
/** @author chemit */
-public class MockHandlerProvider implements VCSHandlerProvider<MockVCSHandler> {
+public class MockHandlerProvider implements VCSHandlerProvider<MockVCSHandler, MockConnexion> {
public String getName() {
return "MOCK";
@@ -26,4 +26,8 @@
public MockVCSHandler newInstance(VCSConfig config) {
return new MockVCSHandler(config);
}
+
+ public MockConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
+ return null;
+ }
}
\ No newline at end of file
Added: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNConnexion.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -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;
+
+import org.codelutin.vcs.util.AbstractVCSConnexion;
+
+/** @author chemit */
+public class SVNConnexion extends AbstractVCSConnexion {
+
+ public void init(VCSConfig config, VCSHandler handler) {
+ state = null;
+ }
+
+ @Override
+ public void close() throws IllegalStateException {
+ checkInit();
+ if (!isOpen()) {
+ return;
+ }
+ }
+
+ @Override
+ public void open() throws IllegalStateException {
+ checkInit();
+ }
+}
Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/SVNHandlerProvider.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -15,9 +15,10 @@
package org.codelutin.vcs;
import org.codelutin.vcs.impl.svn.SVNHandler;
+import org.codelutin.vcs.util.AbstractVCSConnexion;
/** @author chemit */
-public class SVNHandlerProvider implements VCSHandlerProvider<SVNHandler> {
+public class SVNHandlerProvider implements VCSHandlerProvider<SVNHandler, AbstractVCSConnexion> {
public String getName() {
return "SVN";
}
@@ -25,4 +26,8 @@
public SVNHandler newInstance(VCSConfig config) {
return new SVNHandler(config);
}
+
+ public AbstractVCSConnexion newConnection(VCSConnexionMode mode, VCSConfig config) {
+ return null;
+ }
}
Deleted: trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNHandlerTest.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNHandlerTest.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNHandlerTest.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -1,22 +0,0 @@
-package org.codelutin.vcs.impl.svn;
-
-import org.codelutin.vcs.VCSHandlerTest;
-import org.codelutin.vcs.VCSType;
-
-/**
- * Test SVNHandler
- * <p/>
- * <br/>
- * This test use junit_SVN.properties to load vcs configuration
- * Please check everything is ok inside it before lanching test.
- */
-public class SVNHandlerTest extends VCSHandlerTest {
-
- protected void setUpVars() {
- vcsType = VCSType.SVN;
- super.setUpVars();
- }
-
- // if you don't want to execute some incompatible test just override them
-
-}
\ No newline at end of file
Deleted: trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNLogTest.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNLogTest.java 2008-04-04 20:10:54 UTC (rev 344)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/test/java/org/codelutin/vcs/impl/svn/SVNLogTest.java 2008-04-04 21:14:37 UTC (rev 345)
@@ -1,338 +0,0 @@
-package org.codelutin.vcs.impl.svn;
-
-import junit.framework.Assert;
-import org.codelutin.vcs.MethodTest;
-import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.VCSLocalData;
-import org.codelutin.vcs.VCSLocalDataContext;
-import org.codelutin.vcs.VCSRuntimeException;
-import org.codelutin.vcs.VCSTest;
-import static org.codelutin.vcs.VCSType.SVN;
-import org.tmatesoft.svn.core.SVNLogEntry;
-import org.tmatesoft.svn.core.wc.SVNRevision;
-
-import java.io.File;
-import java.util.List;
-
-public class SVNLogTest extends VCSTest {
- static protected int start, last;
-
- static protected int[] interval;
-
- static protected SVNHandler svnhandler;
-
- static protected VCSLocalDataContext context;
-
- protected void setUpVars() {
- VCSTest.vcsType = SVN;
- VCSTest.resetConfiguration = true;
- }
-
- @Override
- protected void initConfig() throws Exception {
- super.initConfig();
-
- context = new VCSLocalDataContext(getLocalDatabaseFile());
-
- // this is specific SVN test
- Assert.assertTrue(VCSTest.handler instanceof SVNHandler);
- svnhandler = (SVNHandler) VCSTest.handler;
-
- // init VCS (create remote repo + create working copy)
- initVCS();
-
- // add 4 files to repository
- setCommand(0, 4, "add with commit");
- list = context.create(VCSLocalData.FILE, interval);
-
- VCSTest.handler.add(list, VCSLocalData.FILE.getCommitMessage("add", this));
-
- }
-
- protected void tearDownVars() throws Exception {
- VCSTest.resetConfiguration = null;
- VCSTest.vcsType = null;
- cleanAfterAll();
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / Demarrage du scenario
- // /////////////////////////////////////////////////////////////////////////
-
- List<File> list;
-
- @MethodTest
- public void testLog() throws Exception {
-
- // at this point of the scenario, we only have a [0-3]
- // (files/directories) left on local and remote
- setCommand(0, 3, "log");
- list = context.getFile(VCSLocalData.FILE, interval);
-
- File f = list.get(0);
-
- List<SVNLogEntry> logEntries = svnhandler.getLog(SVNRevision.WORKING,
- SVNRevision.HEAD, f);
-
- // we just have one revision on this file
- Assert.assertEquals(0, logEntries.size());
-
- for (SVNLogEntry logEntry : logEntries) {
- System.out.println("logEntry " + logEntry.getAuthor() + " : Rev "
- + logEntry.getRevision() + ", Msg '"
- + logEntry.getMessage() + "' ");
- }
- SVNRevision revision1 = svnhandler.getRevision(f);
-
- System.out.println("==== Revision for file " + f + "(before all) : "
- + revision1);
- // modify file
- modifyFile(f, 20);
-
- // commit it
- VCSTest.handler.commit(this.getOneFileAsList(f), VCSLocalData.FILE.getCommitMessage(
- "modif One", this));
- System.out.println("==== Revision for file " + f + "(after commit) : "
- + svnhandler.getRevision(f));
-
- logEntries = svnhandler
- .getLog(SVNRevision.WORKING, SVNRevision.HEAD, f);
-
- // we just have always no revision for this file since working
- // copy is last one
- Assert.assertEquals(0, logEntries.size());
-
- // go back to first revision
- svnhandler.update(f, revision1);
-
- System.out.println("==== Revision for file " + f + "("
- + svnhandler.getRevision(f) + ") after going back to revision "
- + revision1);
-
- logEntries = svnhandler
- .getLog(SVNRevision.WORKING, SVNRevision.HEAD, f);
-
- // we just have one revision for this file (the last commit)
- Assert.assertEquals(1, logEntries.size());
- for (SVNLogEntry logEntry : logEntries) {
- System.out.println("logEntry " + logEntry.getAuthor() + " : Rev "
- + logEntry.getRevision() + ", Msg '"
- + logEntry.getMessage() + "' ");
- }
-
- // a non existing file have no logs of course....
- File file = new File(getLocalDatabaseFile(), "nonExistingFile");
-
- logEntries = svnhandler.getLog(SVNRevision.WORKING, SVNRevision.HEAD,
- file);
- Assert.assertEquals(0, logEntries.size());
-
- try {
- // now file exists, but still can not have some log entries since
- // it is not versionned
- file.createNewFile();
- logEntries = svnhandler.getLog(SVNRevision.WORKING,
- SVNRevision.HEAD, file);
- Assert.assertEquals(0, logEntries.size());
- } finally {
- file.delete();
- }
- }
-
- @MethodTest
- public void testGetChangeLog() throws Exception {
-
- // at this point of the scenario, we only have a [0-3]
- // (files/directories) left on local and remote
- setCommand(0, 3, "changeLog");
- list = context.getFile(VCSLocalData.FILE, interval);
-
- File f = list.get(0);
- SVNRevision revision1 = svnhandler.getRevision(f);
-
- System.out.println("==== Revision for file " + f + "(" + revision1
- + ") at init ");
-
- // this file hase two revision and on local we are on first revision
- Assert.assertFalse(VCSTest.handler.isUpToDate(f));
-
- List<SVNLogEntry> entries = svnhandler.getLog(SVNRevision.WORKING,
- SVNRevision.HEAD, f);
-
- Assert.assertEquals(1, entries.size());
-
- for (SVNLogEntry logEntry : entries) {
- System.out.println("changeLogEntry " + logEntry.getAuthor()
- + " : Rev " + logEntry.getRevision() + ", Msg '"
- + logEntry.getMessage() + "' ");
- }
-
- String changeLog;
- changeLog = svnhandler.getChangeLog(f);
- System.out.println("change log for file " + f + "\n" + changeLog);
-
- // update to head revision
- svnhandler.update(f, SVNRevision.HEAD);
-
- Assert.assertTrue(VCSTest.handler.isUpToDate(f));
-
- SVNRevision newRevision = svnhandler.getRevision(f);
-
- Assert.assertTrue(revision1.getNumber() < newRevision.getNumber());
-
- entries = svnhandler.getLog(SVNRevision.WORKING, SVNRevision.HEAD, f);
-
- // should have no log entries since we have on local the last version
- Assert.assertEquals(0, entries.size());
-
- // since there no revision between working revision and remote revision
- Assert.assertNull(svnhandler.getChangeLog(f));
-
- // add a another revision
- modifyFile(f, 40);
-
- VCSTest.handler.commit(getOneFileAsList(f), VCSLocalData.FILE.getCommitMessage("add a "
- + "second revision", this));
-
- // go back to first revision
- svnhandler.update(f, revision1);
-
- entries = svnhandler.getLog(SVNRevision.WORKING, SVNRevision.HEAD, f);
-
- Assert.assertEquals(2, entries.size());
-
- changeLog = svnhandler.getChangeLog(f);
- System.out.println("change log for file (2 entries) : " + f + "\n"
- + changeLog);
- Assert.assertTrue(changeLog.contains("add a second revision"));
-
- // go back to first revision
- svnhandler.update(f, revision1);
-
- // a non existing file have no logs of course....
- File file = new File(getLocalDatabaseFile(), "nonExistingFile");
-
- changeLog = svnhandler.getChangeLog(file);
- Assert.assertNull(changeLog);
-
- try {
- // now file exists, but still can not have some log entries since
- // it is not versionned
- file.createNewFile();
- changeLog = svnhandler.getChangeLog(file);
- Assert.assertNull(changeLog);
- } finally {
- file.delete();
- }
- }
-
- @MethodTest
- public void testGetDiff() throws Exception {
-
- // at this point of the scenario, we only have a [0-3]
- // (files/directories)
- // left on local and remote
- setCommand(0, 3, "getDiff");
- list = context.getFile(VCSLocalData.FILE, interval);
-
- File f = list.get(0);
-
- // cas limites
- try {
- VCSTest.handler.getDiff(null);
- Assert.fail();
- } catch (VCSRuntimeException e) {
- Assert.assertTrue(true);
- }
-
- // a non existing file have no logs of course....
- File file = new File(getLocalDatabaseFile(), "nonExistingFile");
-
- try {
- VCSTest.handler.getDiff(file);
- Assert.fail();
- } catch (VCSException e) {
- Assert.assertTrue(true);
- }
-
- try {
- // now file exists, but still can not have some log entries
- // since it is not versionned
- file.createNewFile();
- VCSTest.handler.getDiff(file);
- Assert.fail();
- } catch (VCSException e) {
- Assert.assertTrue(true);
- } finally {
- file.delete();
- }
-
- SVNRevision revision1 = svnhandler.getRevision(f);
-
- System.out.println("==== Revision for file " + f + "(" + revision1
- + ") at init ");
-
- String diff = VCSTest.handler.getDiff(f);
-
- System.out.println(" get diff for file " + f + " result : \n" + diff);
-
- VCSTest.handler.update(f);
-
- Object revision2 = VCSTest.handler.getRevision(f);
-
- // modify file
- modifyFile(f, 43, 'b');
-
- VCSTest.handler.commit(getOneFileAsList(f), VCSLocalData.FILE.getCommitMessage("second "
- + "commit with more as", this));
-
- // go back to first revision
- VCSTest.handler.update(f, revision1);
-
- String diff2 = VCSTest.handler.getDiff(f);
-
- Assert.assertNotSame(diff, diff2);
-
- // we should have another diff
- System.out.println(" get diff for file " + f + " result : \n" + diff2);
-
- VCSTest.handler.update(f, revision2);
-
- String diff3 = VCSTest.handler.getDiff(f);
-
- Assert.assertNotSame(diff3, diff2);
- Assert.assertNotSame(diff, diff3);
-
- // we should have another diff
- System.out.println(" get diff for file " + f + " result : \n" + diff3);
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / methodes utiles
- // /////////////////////////////////////////////////////////////////////////
-
- public void cleanAfterAll() throws Exception {
-
- // delete remote directory
- VCSTest.handler.deleteRemoteDir(VCSLocalData.DIRECTORY.getCommitMessage("deldir remote",
- this), "");
-
- // delete local working copy
- VCSTest.handler.deleteWorkingCopy();
-
- // assert local directory does not exists any longer
- Assert.assertFalse(getLocalDatabaseFile().exists());
-
- }
-
- protected void setCommand(int start, int last, String command) {
- if (!(start == SVNLogTest.start && last == SVNLogTest.last)) {
- SVNLogTest.start = start;
- SVNLogTest.last = last;
- SVNLogTest.interval = context.getIndex(start, last);
- }
-
- VCSTest.log.info("[" + command + "] on interval [" + SVNLogTest.start + ","
- + SVNLogTest.last + "]");
- }
-}
1
0
[Buix-commits] r344 - in trunk/lutinvcs/lutinvcs-core/src: main/java/org/codelutin/vcs test/java/org/codelutin/vcs
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 20:10:54 +0000 (Fri, 04 Apr 2008)
New Revision: 344
Modified:
trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java
trunk/lutinvcs/lutinvcs-core/src/test/java/org/codelutin/vcs/VCSStateTest.java
Log:
move to util package all helper classes and abstract implementations
Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java
===================================================================
--- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java 2008-04-04 20:10:40 UTC (rev 343)
+++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java 2008-04-04 20:10:54 UTC (rev 344)
@@ -2,6 +2,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.codelutin.vcs.util.VCSHelper;
import java.io.File;
import java.io.Serializable;
Modified: trunk/lutinvcs/lutinvcs-core/src/test/java/org/codelutin/vcs/VCSStateTest.java
===================================================================
--- trunk/lutinvcs/lutinvcs-core/src/test/java/org/codelutin/vcs/VCSStateTest.java 2008-04-04 20:10:40 UTC (rev 343)
+++ trunk/lutinvcs/lutinvcs-core/src/test/java/org/codelutin/vcs/VCSStateTest.java 2008-04-04 20:10:54 UTC (rev 344)
@@ -4,6 +4,7 @@
import org.codelutin.util.FileUtil;
import static org.codelutin.vcs.VCSState.UNVERSIONNED_OR_MISSING;
import static org.codelutin.vcs.VCSType.SVN;
+import org.codelutin.vcs.util.VCSHelper;
import java.io.File;
import static java.io.File.separator;
1
0
[Buix-commits] r343 - in trunk/lutinvcs: lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 20:10:40 +0000 (Fri, 04 Apr 2008)
New Revision: 343
Modified:
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/impl/mock/MockVCSHandler.java
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/SVNHelper.java
Log:
move to util package all helper classes and abstract implementations
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-04 20:10:16 UTC (rev 342)
+++ trunk/lutinvcs/lutinvcs-provider-cvs/src/main/java/org/codelutin/vcs/impl/cvs/CVSHandler.java 2008-04-04 20:10:40 UTC (rev 343)
@@ -2,7 +2,7 @@
import static org.codelutin.i18n.I18n._;
import org.codelutin.util.FileUtil;
-import org.codelutin.vcs.AbstractVCSHandler;
+import org.codelutin.vcs.util.AbstractVCSHandler;
import org.codelutin.vcs.VCSConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSState;
Modified: 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-04 20:10:16 UTC (rev 342)
+++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java 2008-04-04 20:10:40 UTC (rev 343)
@@ -14,7 +14,7 @@
*/
package org.codelutin.vcs.impl.mock;
-import org.codelutin.vcs.AbstractVCSHandler;
+import org.codelutin.vcs.util.AbstractVCSHandler;
import org.codelutin.vcs.VCSConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSState;
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-04 20:10:16 UTC (rev 342)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHandler.java 2008-04-04 20:10:40 UTC (rev 343)
@@ -20,11 +20,11 @@
package org.codelutin.vcs.impl.svn;
import static org.codelutin.i18n.I18n._;
-import org.codelutin.vcs.AbstractVCSHandler;
+import org.codelutin.vcs.util.AbstractVCSHandler;
import org.codelutin.vcs.VCSConfig;
import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.VCSHelper;
-import static org.codelutin.vcs.VCSHelper.isFileInCheckedDir;
+import org.codelutin.vcs.util.VCSHelper;
+import static org.codelutin.vcs.util.VCSHelper.isFileInCheckedDir;
import org.codelutin.vcs.VCSRuntimeException;
import org.codelutin.vcs.VCSState;
import static org.codelutin.vcs.VCSState.OUT_OF_DATE;
Modified: trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHelper.java
===================================================================
--- trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHelper.java 2008-04-04 20:10:16 UTC (rev 342)
+++ trunk/lutinvcs/lutinvcs-provider-svn/src/main/java/org/codelutin/vcs/impl/svn/SVNHelper.java 2008-04-04 20:10:40 UTC (rev 343)
@@ -22,7 +22,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codelutin.vcs.VCSException;
-import org.codelutin.vcs.VCSHelper;
+import org.codelutin.vcs.util.VCSHelper;
import org.codelutin.vcs.VCSRuntimeException;
import org.codelutin.vcs.VCSTypeRepo;
import org.tmatesoft.svn.core.SVNCancelException;
1
0
[Buix-commits] r342 - in trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs: . util
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 20:10:16 +0000 (Fri, 04 Apr 2008)
New Revision: 342
Added:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSHelper.java
Removed:
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/AbstractVCSHandler.java
trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHelper.java
Log:
move to util package all helper classes and abstract implementations
Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/AbstractVCSHandler.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/AbstractVCSHandler.java 2008-04-04 19:37:59 UTC (rev 341)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/AbstractVCSHandler.java 2008-04-04 20:10:16 UTC (rev 342)
@@ -1,207 +0,0 @@
-/* *##%
-* 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.util.FileUtil;
-import org.codelutin.util.ListenerSet;
-import org.codelutin.vcs.VCSHandlerEvent.Type;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.EnumSet;
-
-/**
- * abstract VCSHandler base with usefull methods that does not need vcs specific code.
- *
- * @author chemit
- */
-public abstract class AbstractVCSHandler implements VCSHandler {
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static protected final Log log = LogFactory.getLog(AbstractVCSHandler.class);
-
- /**
- * FilenameFilter to detect all files in a vcs working copy all files and directories that must be handled by vcs
- *
- * @see org.codelutin.vcs.VCSHandler#getVersionnableFilenameFilter()
- */
- protected final FilenameFilter versionnableFilenameFilter;
- protected final FileFilter versionnableFileFilter;
- protected final String confLocalDirName;
- protected final String confLocalEntriesFilename;
- protected final VCSConfig config;
-
- protected ListenerSet<VCSHandlerEventListener> listeners = new ListenerSet<VCSHandlerEventListener>();
-
- protected AbstractVCSHandler(VCSConfig config, final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) {
- this.config = config;
- this.confLocalDirName = vCSConfLocalDirName;
- this.confLocalEntriesFilename = vCSConfLocalEntriesFilename;
- this.versionnableFilenameFilter = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return !vCSConfLocalDirName.equals(name) && !"CVS".equals(name);
- }
- };
- this.versionnableFileFilter = new FileFilter() {
- public boolean accept(File dir) {
- return dir.isFile() || (!vCSConfLocalDirName.equals(dir.getName()) && !"CVS".equals(dir.getName()));
- }
- };
- fireInit();
- }
-
- public VCSConfig getConfig() {
- return config;
- }
-
- public File getLocalDatabasePath() {
- return config.getLocalDatabasePath();
- }
-
- public void deleteWorkingCopy() {
- if (getLocalDatabasePath().exists()) {
- FileUtil.deleteRecursively(getLocalDatabasePath());
- getLocalDatabasePath().delete();
- }
- }
-
- public FilenameFilter getVersionnableFilenameFilter() {
- return versionnableFilenameFilter;
- }
-
- public FileFilter getVersionnableFileFilter() {
- return versionnableFileFilter;
- }
-
- public String getConfLocalDirname() {
- return confLocalDirName;
- }
-
- public String getConfLocalEntriesFilename() {
- return confLocalEntriesFilename;
- }
-
- public boolean isVersionnableFile(File file) {
- assertFileExists(file, "file is empty or non existant");
- return !confLocalDirName.equalsIgnoreCase(file.getName());
- }
-
- public List<String> getLocalStorageNames(File directory) {
- List<String> result = new ArrayList<String>();
- if (directory.exists()) {
- getFiles0(directory, result, "");
- }
- Collections.sort(result);
- return result;
- }
-
- public void addVCSHandlerEventListener(VCSHandlerEventListener l) {
- listeners.add(l);
- }
-
- public void removeVCSHandlerEventListener(VCSHandlerEventListener l) {
- listeners.remove(l);
- }
-
- public void open() {
- fireOpen();
- }
-
- public void close() {
- fireClose();
- }
-
- protected void fireInit() {
- VCSHandlerEvent e = new VCSHandlerEvent(this, Type.INIT);
- for (VCSHandlerEventListener l : listeners) {
- l.init(e);
- }
- }
-
- protected void fireOpen() {
- VCSHandlerEvent e = new VCSHandlerEvent(this, Type.OPEN);
- for (VCSHandlerEventListener l : listeners) {
- l.open(e);
- }
- }
-
- protected void fireClose() {
- VCSHandlerEvent e = new VCSHandlerEvent(this, Type.CLOSE);
- for (VCSHandlerEventListener l : listeners) {
- l.close(e);
- }
- }
-
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- close();
- }
-
- protected void getFiles0(File directory, List<String> result, String prefix) {
- //TODO put the hardcored value in a property!!!
- if (directory.getName().equals("data")) return;
- final String[] strings = directory.list(versionnableFilenameFilter);
- boolean first = prefix.equals("");
- final String newPrefix = (first ? "" : prefix + File.separator);
-
- for (String filename : strings) {
- final File dir = new File(directory, filename);
- if (dir.isDirectory())
- getFiles0(dir, result, newPrefix + dir.getName());
- else result.add(newPrefix + dir.getName());
- }
- }
-
- protected void assertFileExists(File file, String msg) {
- if (file == null || !file.exists())
- throw new VCSRuntimeException(msg + " (file passed : [" + file + "])");
- }
-
- /**
- * 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 isConnected() {
- return getConfig().isConnected();
- }
-
- public boolean hasWriteAccess() {
- return !getConfig().isReadOnly();
- }
-}
Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHelper.java
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHelper.java 2008-04-04 19:37:59 UTC (rev 341)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHelper.java 2008-04-04 20:10:16 UTC (rev 342)
@@ -1,191 +0,0 @@
-/* *##%
-* 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.codelutin.i18n.I18n._;
-
-import java.io.File;
-
-(a)org.codelutin.i18n.I18nable
-public class VCSHelper {
-
- private static final String LOCAL_SEP = File.separator;
- private static final String LOCAL_SEP_PATTERN = "\\".equals(LOCAL_SEP) ?
- LOCAL_SEP + LOCAL_SEP : LOCAL_SEP;
- private static final String REMOTE_SEP = "/";
- private static final String REMOTE_SEP_PATTERN = "/";
-
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(VCSHelper.class);
-
- public static boolean isFileInWorkingCopy(File parent, String name, VCSHandler handler, boolean underVCS) {
- if (parent == null || name == null)
- throw new RuntimeException(VCSHelper.class.getName() +
- "#isFileInWorkingCopy can not be invoked with some " +
- "null parameter but was. [" + parent + "," + name + "," +
- handler + "]");
- return isFileInWorkingCopy(new File(parent, name), handler, underVCS);
- }
-
- public static boolean isFileInWorkingCopy(File file, VCSHandler handler, boolean underVCS) {
- if (file == null || handler == null)
- throw new RuntimeException(VCSHelper.class.getName() +
- "#isFileInWorkingCopy can not be invoked with some " +
- "null parameter but was. [" + file + "," + handler + "]");
- String rootPath = handler.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);
- }
-
- public static boolean isFileInCheckedDir(File file, VCSHandler handler) {
- if (file == null || handler == null)
- throw new RuntimeException(VCSHelper.class.getName() +
- "#isFileInCheckedDir can not be invoked with some " +
- "null parameter but was. [" + file + "," + handler + "]");
- final File realDir = file.isDirectory() ? file : file.getParentFile();
- return (new File(realDir, handler.getConfLocalDirname()).exists());
-
- }
-
- public static void assertFileInWC(File file, VCSHandler handler) {
- if (!isFileInWorkingCopy(file, handler, false))
- throw new VCSRuntimeException("the file [" + file +
- "] is not in the working copy [" +
- handler.getLocalDatabasePath() + "]");
- }
-
- public static String getRemoteRelativePath(File f, VCSHandler handler) {
- if (!isFileInWorkingCopy(f, handler, false)) return null;
- //System.out.println("file on vcs working copy : "+f);
- String rootPath = handler.getConfig().getLocalDatabasePath().getAbsolutePath();
- String localPath = f.getAbsolutePath();
- if (!localPath.startsWith(rootPath)) return null;
- localPath = localPath.substring(rootPath.length() + 1);
- return convertToRemoteName(localPath);
- }
-
- public static String getLocalRelativePath(String remoteRelativePath, VCSHandler handler) {
- String localPath = convertToLocalName(remoteRelativePath);
- final File file = new File(handler.getConfig().getLocalDatabasePath(), localPath);
- if (!isFileInWorkingCopy(file, handler, false)) return null;
- return localPath;
- }
-
- public static String convertToRemoteName(String txt) {
- return txt.replaceAll(LOCAL_SEP_PATTERN, REMOTE_SEP);
- }
-
- public static String convertToLocalName(String txt) {
- return txt.replaceAll(REMOTE_SEP_PATTERN, LOCAL_SEP);
- }
-
- public static void doCheckoutDir(VCSHandler handler, File... dirs) {
- for (File dir : dirs) {
- try {
- if (!dir.exists() || !isFileInWorkingCopy(dir, handler, true)) {
- handler.checkoutOnlyTheDirectory(dir, null);
- }
- } catch (Exception eee) {
- log.warn(_("lutinvcs.error.checkout.dir", dir), eee);
- break;
- }
- }
- }
-
- /**
- * @param typeRepo the type of repo to used
- * @param remotePath the unclean remote path to use
- * @return the remote path from the old one according to given type repo
- */
- public static String getRemotePath(VCSTypeRepo typeRepo, String remotePath) {
- String result = cleanRemotePath(remotePath);
- switch (typeRepo) {
- case BRANCH:
- case TAG:
- result = remotePath + '/' + typeRepo.getPath();
- break;
- case HEAD:
- result = remotePath;
- break;
- }
- return result;
- }
-
- /**
- * @param typeRepo the type of repo to use
- * @param version the version to use
- * @return the remoteDatabase according to type of repo and version
- */
- public static String getRemoteDatabase(VCSTypeRepo typeRepo, String version) {
- String result = null;
- switch (typeRepo) {
- case BRANCH:
- case TAG:
- result = version;
- break;
- case HEAD:
- result = VCSTypeRepo.HEAD.getPath();
- break;
- }
- return result;
- }
-
- /**
- * to clean a remote path from typeRepo suffix.
- * <p/>
- * For example, having a url svn://XXX/trunk then remove /trunk.
- * <p/>
- * Or if having svn://XXX/branches/YYY then remove /branches/YYY
- * Or if having svn://XXX/tags/YYY then remove /tags/YYY
- *
- * @param remotePath the remote path to clean
- * @return the cleaned remote path
- */
- public static String cleanRemotePath(String remotePath) {
- int pos = remotePath.indexOf(VCSTypeRepo.BRANCH.getPath());
- if (pos > -1) {
- // found a branch
- remotePath = remotePath.substring(0, pos - 1);
- } else {
- pos = remotePath.indexOf(VCSTypeRepo.HEAD.getPath());
- if (pos > -1) {
- // found a branch
- remotePath = remotePath.substring(0, pos - 1);
- } else {
- pos = remotePath.indexOf(VCSTypeRepo.TAG.getPath());
- if (pos > -1) {
- // found a tag
- remotePath = remotePath.substring(0, pos - 1);
- } else {
- // remote path was clean
- }
- }
- }
- return remotePath;
- }
-
-}
\ No newline at end of file
Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java (from rev 334, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/AbstractVCSHandler.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-04 20:10:16 UTC (rev 342)
@@ -0,0 +1,213 @@
+/* *##%
+* 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.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.util.FileUtil;
+import org.codelutin.util.ListenerSet;
+import org.codelutin.vcs.VCSHandlerEvent.Type;
+import org.codelutin.vcs.VCSHandler;
+import org.codelutin.vcs.VCSConfig;
+import org.codelutin.vcs.VCSHandlerEventListener;
+import org.codelutin.vcs.VCSHandlerEvent;
+import org.codelutin.vcs.VCSRuntimeException;
+import org.codelutin.vcs.VCSAction;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.EnumSet;
+
+/**
+ * abstract VCSHandler base with usefull methods that does not need vcs specific code.
+ *
+ * @author chemit
+ */
+public abstract class AbstractVCSHandler implements VCSHandler {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static protected final Log log = LogFactory.getLog(AbstractVCSHandler.class);
+
+ /**
+ * FilenameFilter to detect all files in a vcs working copy all files and directories that must be handled by vcs
+ *
+ * @see org.codelutin.vcs.VCSHandler#getVersionnableFilenameFilter()
+ */
+ protected final FilenameFilter versionnableFilenameFilter;
+ protected final FileFilter versionnableFileFilter;
+ protected final String confLocalDirName;
+ protected final String confLocalEntriesFilename;
+ protected final VCSConfig config;
+
+ protected ListenerSet<VCSHandlerEventListener> listeners = new ListenerSet<VCSHandlerEventListener>();
+
+ protected AbstractVCSHandler(VCSConfig config, final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) {
+ this.config = config;
+ this.confLocalDirName = vCSConfLocalDirName;
+ this.confLocalEntriesFilename = vCSConfLocalEntriesFilename;
+ this.versionnableFilenameFilter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return !vCSConfLocalDirName.equals(name) && !"CVS".equals(name);
+ }
+ };
+ this.versionnableFileFilter = new FileFilter() {
+ public boolean accept(File dir) {
+ return dir.isFile() || (!vCSConfLocalDirName.equals(dir.getName()) && !"CVS".equals(dir.getName()));
+ }
+ };
+ fireInit();
+ }
+
+ public VCSConfig getConfig() {
+ return config;
+ }
+
+ public File getLocalDatabasePath() {
+ return config.getLocalDatabasePath();
+ }
+
+ public void deleteWorkingCopy() {
+ if (getLocalDatabasePath().exists()) {
+ FileUtil.deleteRecursively(getLocalDatabasePath());
+ getLocalDatabasePath().delete();
+ }
+ }
+
+ public FilenameFilter getVersionnableFilenameFilter() {
+ return versionnableFilenameFilter;
+ }
+
+ public FileFilter getVersionnableFileFilter() {
+ return versionnableFileFilter;
+ }
+
+ public String getConfLocalDirname() {
+ return confLocalDirName;
+ }
+
+ public String getConfLocalEntriesFilename() {
+ return confLocalEntriesFilename;
+ }
+
+ public boolean isVersionnableFile(File file) {
+ assertFileExists(file, "file is empty or non existant");
+ return !confLocalDirName.equalsIgnoreCase(file.getName());
+ }
+
+ public List<String> getLocalStorageNames(File directory) {
+ List<String> result = new ArrayList<String>();
+ if (directory.exists()) {
+ getFiles0(directory, result, "");
+ }
+ Collections.sort(result);
+ return result;
+ }
+
+ public void addVCSHandlerEventListener(VCSHandlerEventListener l) {
+ listeners.add(l);
+ }
+
+ public void removeVCSHandlerEventListener(VCSHandlerEventListener l) {
+ listeners.remove(l);
+ }
+
+ public void open() {
+ fireOpen();
+ }
+
+ public void close() {
+ fireClose();
+ }
+
+ protected void fireInit() {
+ VCSHandlerEvent e = new VCSHandlerEvent(this, Type.INIT);
+ for (VCSHandlerEventListener l : listeners) {
+ l.init(e);
+ }
+ }
+
+ protected void fireOpen() {
+ VCSHandlerEvent e = new VCSHandlerEvent(this, Type.OPEN);
+ for (VCSHandlerEventListener l : listeners) {
+ l.open(e);
+ }
+ }
+
+ protected void fireClose() {
+ VCSHandlerEvent e = new VCSHandlerEvent(this, Type.CLOSE);
+ for (VCSHandlerEventListener l : listeners) {
+ l.close(e);
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ close();
+ }
+
+ protected void getFiles0(File directory, List<String> result, String prefix) {
+ //TODO put the hardcored value in a property!!!
+ if (directory.getName().equals("data")) return;
+ final String[] strings = directory.list(versionnableFilenameFilter);
+ boolean first = prefix.equals("");
+ final String newPrefix = (first ? "" : prefix + File.separator);
+
+ for (String filename : strings) {
+ final File dir = new File(directory, filename);
+ if (dir.isDirectory())
+ getFiles0(dir, result, newPrefix + dir.getName());
+ else result.add(newPrefix + dir.getName());
+ }
+ }
+
+ protected void assertFileExists(File file, String msg) {
+ if (file == null || !file.exists())
+ throw new VCSRuntimeException(msg + " (file passed : [" + file + "])");
+ }
+
+ /**
+ * 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 isConnected() {
+ return getConfig().isConnected();
+ }
+
+ public boolean hasWriteAccess() {
+ return !getConfig().isReadOnly();
+ }
+}
Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSHelper.java (from rev 334, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHelper.java)
===================================================================
--- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSHelper.java (rev 0)
+++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/util/VCSHelper.java 2008-04-04 20:10:16 UTC (rev 342)
@@ -0,0 +1,194 @@
+/* *##%
+* 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.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.codelutin.i18n.I18n._;
+import org.codelutin.vcs.VCSHandler;
+import org.codelutin.vcs.VCSRuntimeException;
+import org.codelutin.vcs.VCSTypeRepo;
+
+import java.io.File;
+
+(a)org.codelutin.i18n.I18nable
+public class VCSHelper {
+
+ private static final String LOCAL_SEP = File.separator;
+ private static final String LOCAL_SEP_PATTERN = "\\".equals(LOCAL_SEP) ?
+ LOCAL_SEP + LOCAL_SEP : LOCAL_SEP;
+ private static final String REMOTE_SEP = "/";
+ private static final String REMOTE_SEP_PATTERN = "/";
+
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(VCSHelper.class);
+
+ public static boolean isFileInWorkingCopy(File parent, String name, VCSHandler handler, boolean underVCS) {
+ if (parent == null || name == null)
+ throw new RuntimeException(VCSHelper.class.getName() +
+ "#isFileInWorkingCopy can not be invoked with some " +
+ "null parameter but was. [" + parent + "," + name + "," +
+ handler + "]");
+ return isFileInWorkingCopy(new File(parent, name), handler, underVCS);
+ }
+
+ public static boolean isFileInWorkingCopy(File file, VCSHandler handler, boolean underVCS) {
+ if (file == null || handler == null)
+ throw new RuntimeException(VCSHelper.class.getName() +
+ "#isFileInWorkingCopy can not be invoked with some " +
+ "null parameter but was. [" + file + "," + handler + "]");
+ String rootPath = handler.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);
+ }
+
+ public static boolean isFileInCheckedDir(File file, VCSHandler handler) {
+ if (file == null || handler == null)
+ throw new RuntimeException(VCSHelper.class.getName() +
+ "#isFileInCheckedDir can not be invoked with some " +
+ "null parameter but was. [" + file + "," + handler + "]");
+ final File realDir = file.isDirectory() ? file : file.getParentFile();
+ return (new File(realDir, handler.getConfLocalDirname()).exists());
+
+ }
+
+ public static void assertFileInWC(File file, VCSHandler handler) {
+ if (!isFileInWorkingCopy(file, handler, false))
+ throw new VCSRuntimeException("the file [" + file +
+ "] is not in the working copy [" +
+ handler.getLocalDatabasePath() + "]");
+ }
+
+ public static String getRemoteRelativePath(File f, VCSHandler handler) {
+ if (!isFileInWorkingCopy(f, handler, false)) return null;
+ //System.out.println("file on vcs working copy : "+f);
+ String rootPath = handler.getConfig().getLocalDatabasePath().getAbsolutePath();
+ String localPath = f.getAbsolutePath();
+ if (!localPath.startsWith(rootPath)) return null;
+ localPath = localPath.substring(rootPath.length() + 1);
+ return convertToRemoteName(localPath);
+ }
+
+ public static String getLocalRelativePath(String remoteRelativePath, VCSHandler handler) {
+ String localPath = convertToLocalName(remoteRelativePath);
+ final File file = new File(handler.getConfig().getLocalDatabasePath(), localPath);
+ if (!isFileInWorkingCopy(file, handler, false)) return null;
+ return localPath;
+ }
+
+ public static String convertToRemoteName(String txt) {
+ return txt.replaceAll(LOCAL_SEP_PATTERN, REMOTE_SEP);
+ }
+
+ public static String convertToLocalName(String txt) {
+ return txt.replaceAll(REMOTE_SEP_PATTERN, LOCAL_SEP);
+ }
+
+ public static void doCheckoutDir(VCSHandler handler, File... dirs) {
+ for (File dir : dirs) {
+ try {
+ if (!dir.exists() || !isFileInWorkingCopy(dir, handler, true)) {
+ handler.checkoutOnlyTheDirectory(dir, null);
+ }
+ } catch (Exception eee) {
+ log.warn(_("lutinvcs.error.checkout.dir", dir), eee);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @param typeRepo the type of repo to used
+ * @param remotePath the unclean remote path to use
+ * @return the remote path from the old one according to given type repo
+ */
+ public static String getRemotePath(VCSTypeRepo typeRepo, String remotePath) {
+ String result = cleanRemotePath(remotePath);
+ switch (typeRepo) {
+ case BRANCH:
+ case TAG:
+ result = remotePath + '/' + typeRepo.getPath();
+ break;
+ case HEAD:
+ result = remotePath;
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * @param typeRepo the type of repo to use
+ * @param version the version to use
+ * @return the remoteDatabase according to type of repo and version
+ */
+ public static String getRemoteDatabase(VCSTypeRepo typeRepo, String version) {
+ String result = null;
+ switch (typeRepo) {
+ case BRANCH:
+ case TAG:
+ result = version;
+ break;
+ case HEAD:
+ result = VCSTypeRepo.HEAD.getPath();
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * to clean a remote path from typeRepo suffix.
+ * <p/>
+ * For example, having a url svn://XXX/trunk then remove /trunk.
+ * <p/>
+ * Or if having svn://XXX/branches/YYY then remove /branches/YYY
+ * Or if having svn://XXX/tags/YYY then remove /tags/YYY
+ *
+ * @param remotePath the remote path to clean
+ * @return the cleaned remote path
+ */
+ public static String cleanRemotePath(String remotePath) {
+ int pos = remotePath.indexOf(VCSTypeRepo.BRANCH.getPath());
+ if (pos > -1) {
+ // found a branch
+ remotePath = remotePath.substring(0, pos - 1);
+ } else {
+ pos = remotePath.indexOf(VCSTypeRepo.HEAD.getPath());
+ if (pos > -1) {
+ // found a branch
+ remotePath = remotePath.substring(0, pos - 1);
+ } else {
+ pos = remotePath.indexOf(VCSTypeRepo.TAG.getPath());
+ if (pos > -1) {
+ // found a tag
+ remotePath = remotePath.substring(0, pos - 1);
+ } else {
+ // remote path was clean
+ }
+ }
+ }
+ return remotePath;
+ }
+
+}
\ No newline at end of file
1
0
[Buix-commits] r341 - trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 19:37:59 +0000 (Fri, 04 Apr 2008)
New Revision: 341
Modified:
trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx
Log:
used fixed size + only used table as spacor :)
Modified: trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx
===================================================================
--- trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx 2008-04-04 19:37:36 UTC (rev 340)
+++ trunk/lutinvcs/lutinvcs-ui-jaxx/src/main/uimodel/org/codelutin/vcs/ui/JConfirmUI.jaxx 2008-04-04 19:37:59 UTC (rev 341)
@@ -1,4 +1,5 @@
-<org.codelutin.vcs.ui.AbstractUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true'>
+<org.codelutin.vcs.ui.AbstractUI title='lutinvcs.confirm.title' defaultCloseOperation='DISPOSE_ON_CLOSE' modal='true'
+ resizable='false' height='300' width='400'>
<style source="common.css"/>
<script>
import org.codelutin.vcs.VCSAction;
@@ -29,7 +30,6 @@
}
</script>
-
<Table>
<row fill='both'>
<cell fill='both'>
@@ -42,28 +42,21 @@
<row>
<cell>
<JToolBar id='tool'>
+ <JLabel id="actionCommitLabel" text="lutinvcs.commit.message"/>
<Table fill='both' insets='0,0,0,0'>
<row>
- <cell fill='both'>
- <JLabel id="actionCommitLabel" text="lutinvcs.commit.message"/>
- </cell>
- <cell fill='both' weightx="1">
- <JLabel/>
- </cell>
- <cell anchor='east'>
- <JButton id='lastMessages'
- toolTipText="lutinvcs.action.tooltip.lastMessages"
- icon='{createImageIcon("recent_msgs.png")}'
- onActionPerformed='showLastMessages()'/>
- </cell>
+ <cell fill='both'/>
</row>
</Table>
-
+ <JButton id='lastMessages'
+ toolTipText="lutinvcs.action.tooltip.lastMessages"
+ icon='{createImageIcon("recent_msgs.png")}'
+ onActionPerformed='showLastMessages()'/>
</JToolBar>
</cell>
</row>
<row fill='both'>
- <cell fill='both' columns='3' weightx='1' weighty='1'>
+ <cell fill='both' columns='3' weightx='1'>
<JScrollPane id="commitScroll" height='90' verticalScrollBarPolicy="20"
columnHeaderView="{tool}">
<JTextArea id="commitMessage" constructorParams="4,50"/>
@@ -73,7 +66,6 @@
</Table>
</cell>
</row>
-
<row>
<cell fill='both' weightx='1' weighty='1'>
<JScrollPane id='content' styleClass='confirmScroll'>
1
0
[Buix-commits] r340 - trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
by tchemit@users.labs.libre-entreprise.org 04 Apr '08
04 Apr '08
Author: tchemit
Date: 2008-04-04 19:37:36 +0000 (Fri, 04 Apr 2008)
New Revision: 340
Modified:
trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java
Log:
more files generated
Modified: trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java
===================================================================
--- trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java 2008-04-04 19:36:20 UTC (rev 339)
+++ trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java 2008-04-04 19:37:36 UTC (rev 340)
@@ -39,7 +39,7 @@
VCSHandler handler = initVCS(root);
- List<VCSFileState> datas = generateListFileStates(handler, 20, "trunk", "local/", "remote/");
+ List<VCSFileState> datas = generateListFileStates(handler, 50, "trunk", "local/", "remote/");
JSynchUI synchUI = VCSUIFactory.newSynchUI(handler, datas);
1
0