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
April 2008
- 1 participants
- 373 discussions
27 Apr '08
Author: tchemit
Date: 2008-04-27 14:15:39 +0000 (Sun, 27 Apr 2008)
New Revision: 643
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java
trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java
trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java
trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java
Log:
introduc VCSURIResolver contract, to resolv remote URI from a VCSConnnexionConfg.
Each provider acts as a VCSURIResolver factory via newURIResolver method.
Handler has his own resolver.
remove mode field from VCSConnexion, used the VCSConnexionConfig one instead.
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -36,6 +36,10 @@
public interface VCSCommon {
+ VCSURIResolver getURIResolver();
+
+ void setURIResolver(VCSURIResolver uriResolver);
+
/**
* init working copy, says if it is the first we use it it, we will checkout
* the databaseDirectory directory
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -26,7 +26,7 @@
* The method {@link #init(VCSConnexionConfig)} must be invoked before using the connexion.
* <p/>
* Note: you should not instanciate directly this class but use
- * {@link org.codelutin.vcs.VCSProvider#newConnection(org.codelutin.vcs.type.VCSConnexionMode , VCSConnexionConfig)} instead.
+ * {@link VCSProvider#newConnection(VCSConnexionConfig)} instead.
*
* @author chemit
*/
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSFactory.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -83,7 +83,7 @@
VCSProvider<?, ?> provider = factory.getProvider(config.getType().toUpperCase());
// delegate instanciation of connexion to provider
- VCSConnexion connexion = provider.newConnection(config.getMode(), config);
+ VCSConnexion connexion = provider.newConnection(config);
// init connexion
connexion.init(config);
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -17,11 +17,12 @@
/**
* The contract to be realized to provide vcs communication.
* <p/>
- * The provider acts as a factory of {@link VCSConnexion}.
- *
+ * The provider acts as a factory of {@link VCSConnexion} and {@link VCSURIResolver}.
+ *
* @author chemit
- * @see org.codelutin.vcs.VCSHandler
- * @see org.codelutin.vcs.VCSConnexion
+ * @see VCSHandler
+ * @see VCSConnexion
+ * @see VCSURIResolver
*/
public interface VCSProvider<C extends VCSConnexion<H>, H extends VCSHandler<C>> {
@@ -34,15 +35,17 @@
/** @return the imclass of implementation of connexion to use for this provider */
Class<C> getConnexionImpl();
+ /** @return a new instance of {@link VCSURIResolver} */
+ VCSURIResolver newURIResolver();
+
/**
* Instanciate an new connexion for a given config, and init it.
* <p/>
* Note : <b>After this method connexion is init, but not opened.</b>
*
- * @param mode the mode required
* @param config the config to be used
* @return the new connexion initialized <b>but not opened</b>.
*/
- C newConnection(org.codelutin.vcs.type.VCSConnexionMode mode, VCSConnexionConfig config);
+ C newConnection(VCSConnexionConfig config);
}
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,26 @@
+/**
+ * # #% 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;
+
+/**
+ * URI resolver from a config to build the remote vcs server uri to vcs root
+ *
+ * @author chemit
+ */
+public interface VCSURIResolver {
+
+ java.net.URI resolv(VCSConnexionConfig config);
+
+}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnectionState.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -33,7 +33,7 @@
UNDEFINED,
/**
* connexion was init, but not opened (default state after instanciate a new connexion from
- * {@link VCSProvider#newConnection(VCSConnexionMode, VCSConnexionConfig)}
+ * {@link VCSProvider#newConnection(VCSConnexionConfig)}
*/
INIT,
/** connexion was successfull opened, via {@link VCSConnexion#open()} */
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionConfigProperty.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,56 @@
+/**
+ * ##% 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.type;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+
+/**
+ * Enumaration of properties useable in a {@link VCSConnexionConfig}
+ *
+ * @author chemit
+ * @see VCSConnexionConfig
+ */
+public enum VCSConnexionConfigProperty {
+
+ /** property <code>rootConfig</code>, as a {@link org.codelutin.vcs.VCSRootConfig} */
+ rootConfig,
+
+ /** property <code>connexionMode</code>, as a {@link org.codelutin.vcs.type.VCSConnexionMode} */
+ connexionMode,
+
+ /** property <code>typeRepo</code>, type of repo to use, as a {@link VCSTypeRepo} */
+ typeRepo,
+
+ /** property <code>typeRepoValue</code>, the value associated to typeRepo (eg, branch or tag name, null for a head connexion) */
+ typeRepoValue,
+
+ /** property <code>login</code>, login for a password connexion */
+ login,
+
+ /** property <code>password</code>, password for a password connexion */
+ password,
+
+ /** property <code>sshLogin</code>, login for a ssh connexion */
+ sshLogin,
+
+ /** property <code>sshPassphrase</code>, passphrase for a ssh connexion */
+ sshPassphrase,
+
+ /** property <code>sshPrivateKey</code>, path of the ssh private key file for a ssh connexion */
+ sshPrivateKeyFile,
+
+ /** property <code>localDatabasePath</code>, path of the local working copy */
+ localDatabasePath
+}
\ No newline at end of file
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -14,33 +14,38 @@
*/
package org.codelutin.vcs.type;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_LOGIN;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_PASSWORD;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_LOGIN;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PASSPHRASE;
-import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PRIVATE_KEY_FILE;
+import org.codelutin.vcs.VCSConnexionConfig;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.login;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.password;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshLogin;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPassphrase;
+import static org.codelutin.vcs.type.VCSConnexionConfigProperty.sshPrivateKeyFile;
+import java.util.EnumSet;
+import java.util.Arrays;
+
/**
* Enumaration of connexion mode.
* <p/>
* Each mode known the list of authentication properties required for a connexion.
*
* @author chemit
- * @see org.codelutin.vcs.VCSConnexionConfig
+ * @see VCSConnexionConfigProperty
+ * @see VCSConnexionConfig
*/
public enum VCSConnexionMode {
ANONYMOUS,
- PASSWORD(PROPERTY_LOGIN, PROPERTY_PASSWORD),
- SSH(PROPERTY_SSH_LOGIN, PROPERTY_SSH_PASSPHRASE, PROPERTY_SSH_PRIVATE_KEY_FILE);
+ PASSWORD(login, password),
+ SSH(sshLogin, sshPassphrase, sshPrivateKeyFile);
/** array of authentication properties required for this connexion mode. */
- private final String[] authenticationProperties;
+ private final EnumSet<VCSConnexionConfigProperty> authenticationProperties;
- VCSConnexionMode(String... authenticationProperties) {
- this.authenticationProperties = authenticationProperties;
+ VCSConnexionMode(VCSConnexionConfigProperty... authenticationProperties) {
+ this.authenticationProperties = EnumSet.copyOf(Arrays.asList(authenticationProperties));
}
- public String[] getAuthenticationProperties() {
+ public EnumSet<VCSConnexionConfigProperty> getAuthenticationProperties() {
return authenticationProperties;
}
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -22,6 +22,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSHandler;
+import org.codelutin.vcs.VCSURIResolver;
import org.codelutin.vcs.event.VCSConnexionEvent;
import org.codelutin.vcs.event.VCSConnexionEventListener;
import org.codelutin.vcs.type.VCSConnectionState;
@@ -43,7 +44,6 @@
protected File localRoot;
protected URI remoteRoot;
- protected VCSConnexionMode mode;
protected VCSConnectionState state;
protected VCSConnexionConfig config;
protected H handler;
@@ -51,8 +51,7 @@
protected ListenerSet<VCSConnexionEventListener> listeners = new ListenerSet<VCSConnexionEventListener>();
@SuppressWarnings({"unchecked"})
- protected AbstractVCSConnexion(VCSConnexionMode mode, H handler) {
- this.mode = mode;
+ protected AbstractVCSConnexion(H handler) {
this.handler = handler;
this.handler.setConnexion(this);
// by default, state is undefined before init
@@ -78,7 +77,7 @@
public VCSConnexionMode getMode() throws IllegalStateException {
checkInit();
- return mode;
+ return getConfig().getMode();
}
public VCSConnexionConfig getConfig() throws IllegalStateException {
@@ -252,6 +251,14 @@
return handler.hasProtocoleChanged();
}
+ public VCSURIResolver getURIResolver() {
+ return handler.getURIResolver();
+ }
+
+ public void setURIResolver(VCSURIResolver uriResolver) {
+ handler.setURIResolver(uriResolver);
+ }
+
protected void fireOpened() {
VCSConnexionEvent e = new VCSConnexionEvent(this, VCSConnectionState.OPEN);
for (VCSConnexionEventListener l : listeners) {
@@ -270,6 +277,7 @@
if (state == VCSConnectionState.UNDEFINED) {
throw new IllegalStateException(_("lutinvcs.error.connexion.noinit", this));
}
+ //TODO Should check config exists
}
protected void checkOpen() throws IllegalStateException {
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSHandler.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -26,6 +26,7 @@
import org.codelutin.vcs.VCSConnexion;
import org.codelutin.vcs.VCSHandler;
import org.codelutin.vcs.VCSRuntimeException;
+import org.codelutin.vcs.VCSURIResolver;
import org.codelutin.vcs.type.VCSTypeRepo;
import java.io.File;
@@ -55,6 +56,7 @@
protected final String confLocalDirName;
protected final String confLocalEntriesFilename;
protected C connexion;
+ protected VCSURIResolver uriResolver;
protected AbstractVCSHandler(final String vCSConfLocalDirName, String vCSConfLocalEntriesFilename) {
this.confLocalDirName = vCSConfLocalDirName;
@@ -71,6 +73,14 @@
};
}
+ public VCSURIResolver getURIResolver() {
+ return uriResolver;
+ }
+
+ public void setURIResolver(VCSURIResolver uriResolver) {
+ this.uriResolver = uriResolver;
+ }
+
public void setConnexion(C connexion) {
this.connexion = connexion;
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -14,14 +14,14 @@
*/
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.VCSConnexion;
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSHandler;
import org.codelutin.vcs.VCSProvider;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.codelutin.vcs.VCSURIResolver;
/**
* base implementation of provider.
@@ -41,10 +41,15 @@
/** implementation of connexion to use */
private final Class<C> connexionImpl;
- protected AbstractVCSProvider(String name, Class<H> handlerImpl, Class<C> connexionImpl) {
+ /** implementation of {@link VCSURIResolver} to use */
+ private final Class<? extends VCSURIResolver> resolverImpl;
+
+
+ protected AbstractVCSProvider(String name, Class<H> handlerImpl, Class<C> connexionImpl, Class<? extends VCSURIResolver> resolverImpl) {
this.name = name;
this.handlerImpl = handlerImpl;
this.connexionImpl = connexionImpl;
+ this.resolverImpl = resolverImpl;
}
public final String getName() {
@@ -59,18 +64,19 @@
return handlerImpl;
}
- public C newConnection(VCSConnexionMode mode, VCSConnexionConfig config) {
+ public C newConnection(VCSConnexionConfig config) {
H handler;
C connexion;
try {
handler = handlerImpl.newInstance();
+ handler.setURIResolver(newURIResolver());
} catch (Exception e) {
throw new RuntimeException(_("lutinvcs.error.provider.init.handler", handlerImpl, this, e.getCause()));
}
try {
- connexion = connexionImpl.getConstructor(VCSConnexionMode.class, handlerImpl).newInstance(mode, handler);
+ connexion = connexionImpl.getConstructor(handlerImpl).newInstance(handler);
// always init connexion from his config
connexion.init(config);
@@ -81,4 +87,13 @@
}
}
+ public VCSURIResolver newURIResolver() {
+ try {
+ return resolverImpl.newInstance();
+ } catch (InstantiationException e) {
+ throw new IllegalStateException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(e);
+ }
+ }
}
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/CVSProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -16,13 +16,14 @@
import org.codelutin.vcs.provider.cvs.CVSConnexion;
import org.codelutin.vcs.provider.cvs.CVSHandler;
+import org.codelutin.vcs.provider.cvs.CVSURIResolver;
import org.codelutin.vcs.util.AbstractVCSProvider;
/** @author chemit */
public class CVSProvider extends AbstractVCSProvider<CVSConnexion, CVSHandler> {
public CVSProvider() {
- super("CVS", CVSHandler.class, CVSConnexion.class);
+ super("CVS", CVSHandler.class, CVSConnexion.class, CVSURIResolver.class);
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -9,7 +9,7 @@
* 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.
+ * - Suite 330, Boston, MA 02111-1307, USA.
* ##%
*/
package org.codelutin.vcs.provider.cvs;
@@ -17,7 +17,6 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
import org.netbeans.lib.cvsclient.CVSRoot;
import org.netbeans.lib.cvsclient.Client;
@@ -29,8 +28,8 @@
/** @author chemit */
public class CVSConnexion extends AbstractVCSConnexion<CVSHandler> {
- public CVSConnexion(VCSConnexionMode mode, CVSHandler handler) {
- super(mode, handler);
+ public CVSConnexion(CVSHandler handler) {
+ super(handler);
}
public void init(VCSConnexionConfig config) {
Added: trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java
===================================================================
--- trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java (rev 0)
+++ trunk/lutinvcs/provider/cvs/src/main/java/org/codelutin/vcs/provider/cvs/CVSURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,27 @@
+/**
+ * # #% 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.provider.cvs;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+
+import java.net.URI;
+
+/** @author chemit */
+public class CVSURIResolver implements org.codelutin.vcs.VCSURIResolver {
+ public URI resolv(VCSConnexionConfig config) {
+ //TODO
+ return null;
+ }
+}
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/MockProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -16,13 +16,14 @@
import org.codelutin.vcs.provider.mock.MockConnexion;
import org.codelutin.vcs.provider.mock.MockHandler;
+import org.codelutin.vcs.provider.mock.MockURIResolver;
import org.codelutin.vcs.util.AbstractVCSProvider;
/** @author chemit */
public class MockProvider extends AbstractVCSProvider<MockConnexion, MockHandler> {
public MockProvider() {
- super("MOCK", MockHandler.class, MockConnexion.class);
+ super("MOCK", MockHandler.class, MockConnexion.class, MockURIResolver.class);
}
}
\ No newline at end of file
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -17,14 +17,13 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.type.VCSConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
/** @author chemit */
public class MockConnexion extends AbstractVCSConnexion<MockHandler> {
- public MockConnexion(VCSConnexionMode mode, MockHandler handler) {
- super(mode, handler);
+ public MockConnexion(MockHandler handler) {
+ super(handler);
}
public void init(VCSConnexionConfig config) {
Modified: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockHandler.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -110,15 +110,15 @@
}
public String getChangeLog(File file) throws VCSException {
- return this+" changelog for : \n"+file+"... mock";
+ return this + " changelog for : \n" + file + "... mock";
}
public String getDiff(File file) throws VCSException, IOException {
- return this+" diff for : \n"+file+"... mock";
+ return this + " diff for : \n" + file + "... mock";
}
public String getDiff(File file, Object againstRevision) throws VCSException, IOException {
- return this+" diff for : \n"+file+"... mock";
+ return this + " diff for : \n" + file + "... mock";
}
public boolean hasProtocoleChanged() throws VCSException {
Added: trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java
===================================================================
--- trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java (rev 0)
+++ trunk/lutinvcs/provider/mock/src/main/java/org/codelutin/vcs/provider/mock/MockURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,25 @@
+/**
+ * # #% 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.provider.mock;
+
+import java.net.URI;
+
+/** @author chemit */
+public class MockURIResolver implements org.codelutin.vcs.VCSURIResolver {
+ public URI resolv(org.codelutin.vcs.VCSConnexionConfig config) {
+ //TODO
+ return null;
+ }
+}
Modified: trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java
===================================================================
--- trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/SVNProvider.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -16,6 +16,7 @@
import org.codelutin.vcs.provider.svn.SVNConnexion;
import org.codelutin.vcs.provider.svn.SVNHandler;
+import org.codelutin.vcs.provider.svn.SVNURIResolver;
import org.codelutin.vcs.type.VCSTypeRepo;
import org.codelutin.vcs.util.AbstractVCSHandler;
import org.codelutin.vcs.util.AbstractVCSProvider;
@@ -45,9 +46,7 @@
private static boolean libraryInit;
public SVNProvider() {
-
- super("SVN", SVNHandler.class, SVNConnexion.class);
-
+ super("SVN", SVNHandler.class, SVNConnexion.class, SVNURIResolver.class);
setupLibrary();
}
Modified: trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java
===================================================================
--- trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java 2008-04-27 12:55:51 UTC (rev 642)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNConnexion.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -20,7 +20,6 @@
import org.codelutin.vcs.VCSRuntimeException;
import org.codelutin.vcs.provider.SVNProvider;
import org.codelutin.vcs.type.VCSConnectionState;
-import org.codelutin.vcs.type.VCSConnexionMode;
import org.codelutin.vcs.util.AbstractVCSConnexion;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
@@ -44,8 +43,8 @@
protected SVNWCClient ourWcClient;
- public SVNConnexion(VCSConnexionMode mode, SVNHandler handler) {
- super(mode, handler);
+ public SVNConnexion(SVNHandler handler) {
+ super(handler);
}
public void init(VCSConnexionConfig config) {
Added: trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java
===================================================================
--- trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java (rev 0)
+++ trunk/lutinvcs/provider/svn/src/main/java/org/codelutin/vcs/provider/svn/SVNURIResolver.java 2008-04-27 14:15:39 UTC (rev 643)
@@ -0,0 +1,28 @@
+/**
+ * # #% 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.provider.svn;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+
+import java.net.URI;
+
+/** @author chemit */
+public class SVNURIResolver implements org.codelutin.vcs.VCSURIResolver {
+
+ public URI resolv(VCSConnexionConfig config) {
+ //TODO
+ return null;
+ }
+}
1
0
[Buix-commits] r642 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . type util
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 12:55:51 +0000 (Sun, 27 Apr 2008)
New Revision: 642
Added:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java
Log:
introduce VCSRootConfig to represent a remote vcs host with a repository, no authentication is deal here.
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSRootConfig.java 2008-04-27 12:55:51 UTC (rev 642)
@@ -0,0 +1,48 @@
+/**
+ * # #% 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.util.config.Config;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+
+/**
+ * Definition of a vcs root config comparable on his name.
+ *
+ * @author chemit
+ * @see VCSRootConfigProperty
+ * @see Config
+ */
+public interface VCSRootConfig extends Comparable<VCSRootConfig>, Config<VCSRootConfigProperty> {
+
+ String getName();
+
+ String getType();
+
+ String getHost();
+
+ String getRepository();
+
+ Integer getPort();
+
+ void setName(String name);
+
+ void setType(String type);
+
+ void setHost(String host);
+
+ void setPort(Integer port);
+
+ void setRepository(String repository);
+}
Copied: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java (from rev 640, trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java)
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSRootConfigProperty.java 2008-04-27 12:55:51 UTC (rev 642)
@@ -0,0 +1,42 @@
+/**
+ * ##% 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.type;
+
+import org.codelutin.vcs.VCSRootConfig;
+
+/**
+ * Enumaration of properties to be used in a {@link VCSRootConfig}
+ *
+ * @author chemit
+ * @see VCSRootConfig
+ */
+public enum VCSRootConfigProperty {
+
+ /** property <code>name</code>, unique name of the root definition */
+ name,
+
+ /** property <code>type</code>, type of the root (eg, CVS,...), should match the name of a {@link org.codelutin.vcs.VCSProvider} */
+ type,
+
+ /** property <code>host</code>, host of the root (eg labs.libreentreprise.org) with no protocol information */
+ host,
+
+ /** property <code>repository</code>, relative path of vcs root on host (eg cvsroot/myModule) */
+ repository,
+
+ /** property <code>port</code>, the port used (if null, will use default vcs type port) */
+ port
+
+}
\ No newline at end of file
Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java (rev 0)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSRootConfig.java 2008-04-27 12:55:51 UTC (rev 642)
@@ -0,0 +1,111 @@
+/**
+ * # #% 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.util.config.SimpleConfig;
+import org.codelutin.vcs.VCSRootConfig;
+import org.codelutin.vcs.type.VCSRootConfigProperty;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.host;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.name;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.port;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.repository;
+import static org.codelutin.vcs.type.VCSRootConfigProperty.type;
+
+import java.util.EnumMap;
+
+/** @author chemit */
+public class SimpleVCSRootConfig extends SimpleConfig<VCSRootConfigProperty> implements VCSRootConfig {
+
+ public SimpleVCSRootConfig() {
+ super(VCSRootConfigProperty.class);
+ }
+
+ public SimpleVCSRootConfig(EnumMap<VCSRootConfigProperty, Object> properties) {
+ super(VCSRootConfigProperty.class, properties);
+ }
+
+ public SimpleVCSRootConfig(String name, String type, String host, String repository, Integer port) {
+ this();
+ setName(name);
+ setType(type);
+ setHost(host);
+ setRepository(repository);
+ setPort(port);
+ }
+
+ public String getName() {
+ return (String) properties.get(name);
+ }
+
+ public String getType() {
+ return (String) properties.get(type);
+ }
+
+ public String getHost() {
+ return (String) properties.get(host);
+ }
+
+ public Integer getPort() {
+ return (Integer) properties.get(port);
+ }
+
+ public String getRepository() {
+ return (String) properties.get(repository);
+ }
+
+ public void setName(String newName) {
+ setProperty(name, newName);
+ }
+
+ public void setType(String newType) {
+ setProperty(type, newType);
+ }
+
+ public void setHost(String newHost) {
+ setProperty(host, newHost);
+ }
+
+ public void setPort(Integer newPort) {
+ setProperty(port, newPort);
+ }
+
+ public void setRepository(String newRepository) {
+ setProperty(repository, newRepository);
+ }
+
+ public int compareTo(VCSRootConfig o) {
+ String name = getName();
+ String oName = o.getName();
+ return name == null ? -1 : oName == null ? 1 : name.compareTo(oName);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof SimpleConfig)) return false;
+
+ SimpleVCSRootConfig that = (SimpleVCSRootConfig) o;
+ String name = getName();
+ String oName = that.getName();
+ return !(name != null ? !name.equals(oName) : oName != null);
+ }
+
+ @Override
+ public int hashCode() {
+ String name = getName();
+ return (name != null ? name.hashCode() : 0);
+ }
+
+}
\ No newline at end of file
1
0
[Buix-commits] r641 - in trunk/lutinvcs/core/src/main/java/org/codelutin/vcs: . util
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 10:24:07 +0000 (Sun, 27 Apr 2008)
New Revision: 641
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
Log:
improve generic type + remove unsued imports
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 10:23:27 UTC (rev 640)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-27 10:24:07 UTC (rev 641)
@@ -14,21 +14,16 @@
*/
package org.codelutin.vcs;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.VCSConnexion;
-import org.codelutin.vcs.VCSHandler;
-import org.codelutin.vcs.VCSConnexionConfig;
-
/**
* The contract to be realized to provide vcs communication.
* <p/>
- * Acts as a handler and connexion factory and manage a single handler instance
- *
+ * The provider acts as a factory of {@link VCSConnexion}.
+ *
* @author chemit
* @see org.codelutin.vcs.VCSHandler
* @see org.codelutin.vcs.VCSConnexion
*/
-public interface VCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> {
+public interface VCSProvider<C extends VCSConnexion<H>, H extends VCSHandler<C>> {
/** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */
String getName();
@@ -48,6 +43,6 @@
* @param config the config to be used
* @return the new connexion initialized <b>but not opened</b>.
*/
- C newConnection(VCSConnexionMode mode, VCSConnexionConfig config);
+ C newConnection(org.codelutin.vcs.type.VCSConnexionMode mode, VCSConnexionConfig config);
}
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 10:23:27 UTC (rev 640)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/AbstractVCSProvider.java 2008-04-27 10:24:07 UTC (rev 641)
@@ -28,7 +28,7 @@
*
* @author chemit
*/
-public abstract class AbstractVCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> implements VCSProvider<C, H> {
+public abstract class AbstractVCSProvider<C extends VCSConnexion<H>, H extends VCSHandler<C>> implements VCSProvider<C, H> {
static protected final Log log = LogFactory.getLog(AbstractVCSProvider.class);
1
0
[Buix-commits] r640 - trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 10:23:27 +0000 (Sun, 27 Apr 2008)
New Revision: 640
Modified:
trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
Log:
adding authentication properties list by connexion mode
Modified: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java
===================================================================
--- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 08:42:16 UTC (rev 639)
+++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-27 10:23:27 UTC (rev 640)
@@ -14,13 +14,33 @@
*/
package org.codelutin.vcs.type;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_LOGIN;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_PASSWORD;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_LOGIN;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PASSPHRASE;
+import static org.codelutin.vcs.VCSConnexionConfig.PROPERTY_SSH_PRIVATE_KEY_FILE;
+
/**
- * L'ensemble des typs de connexion VCS connues
+ * Enumaration of connexion mode.
+ * <p/>
+ * Each mode known the list of authentication properties required for a connexion.
*
* @author chemit
+ * @see org.codelutin.vcs.VCSConnexionConfig
*/
public enum VCSConnexionMode {
ANONYMOUS,
- PASSWORD,
- SSH
+ PASSWORD(PROPERTY_LOGIN, PROPERTY_PASSWORD),
+ SSH(PROPERTY_SSH_LOGIN, PROPERTY_SSH_PASSPHRASE, PROPERTY_SSH_PRIVATE_KEY_FILE);
+
+ /** array of authentication properties required for this connexion mode. */
+ private final String[] authenticationProperties;
+
+ VCSConnexionMode(String... authenticationProperties) {
+ this.authenticationProperties = authenticationProperties;
+ }
+
+ public String[] getAuthenticationProperties() {
+ return authenticationProperties;
+ }
}
1
0
[Buix-commits] r639 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:42:16 +0000 (Sun, 27 Apr 2008)
New Revision: 639
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx 2008-04-27 08:40:56 UTC (rev 638)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxTestUI.jaxx 2008-04-27 08:42:16 UTC (rev 639)
@@ -3,7 +3,7 @@
<script>import static org.codelutin.vcs.ui.VCSUIFactory.*;</script>
<JToolBar>
<JButton id='showFirstLaunch' onActionPerformed="showUI(IDENTITY_UI)"/>
- <JButton id='showConfig' onActionPerformed="showUI(CONFIG_UI)" />
+ <JButton id='showConfig' onActionPerformed="showUI(CONNEXION_CONFIG_UI)" />
<JButton id='showSynch' onActionPerformed="showUI(SYNCH_UI)"/>
<Table fill='both' insets='0,0,0,0'>
<row>
1
0
[Buix-commits] r638 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:40:56 +0000 (Sun, 27 Apr 2008)
New Revision: 638
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-04-27 08:40:06 UTC (rev 637)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-04-27 08:40:56 UTC (rev 638)
@@ -1,4 +1,4 @@
-<ConfigUI modal='true' resizable='false'>
+<ConnexionConfigUI modal='true' resizable='false'>
<style source="config.css"/>
<script>
import static org.codelutin.vcs.type.VCSConnexionMode.*;
@@ -130,4 +130,4 @@
</row>
</Table>
-</ConfigUI>
+</ConnexionConfigUI>
1
0
[Buix-commits] r637 - in trunk/lutinvcs: tools/src/test/java/org/codelutin/vcs ui/common/src/main/java/org/codelutin/vcs/ui ui/common/src/main/java/org/codelutin/vcs/ui/action ui/common/src/main/java/org/codelutin/vcs/ui/handler
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:40:06 +0000 (Sun, 27 Apr 2008)
New Revision: 637
Modified:
trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java
===================================================================
--- trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/tools/src/test/java/org/codelutin/vcs/UITest.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -54,7 +54,7 @@
log.info("show first launch ui "+firstModel.getIdentity());
return;
}
- if (uiDef == VCSUIFactory.CONFIG_UI) {
+ if (uiDef == VCSUIFactory.CONNEXION_CONFIG_UI) {
log.info("show config ui");
return;
}
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -59,13 +59,13 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONNEXION_CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
public static DialogUIDef[] defs() {
- return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI,TEST_UI};
+ return new DialogUIDef[]{SYNCH_UI, DIFF_UI, CHANGELOG_UI, CONNEXION_CONFIG_UI, CONFIRM_UI, GENERATE_SHH_KEY_UI, IDENTITY_UI,TEST_UI};
}
protected static VCSUIFactory instance;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConnexionConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
+ CONNEXION_CONFIG_UI = newDef(ConnexionConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -29,7 +29,7 @@
private static final long serialVersionUID = 1L;
public ShowConfigAction(org.codelutin.ui.DialogUI ui, boolean showText) {
- super(ui, VCSUIFactory.CONFIG_UI, showText);
+ super(ui, VCSUIFactory.CONNEXION_CONFIG_UI, showText);
}
@Override
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-04-27 08:39:32 UTC (rev 636)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/TestUIHandler.java 2008-04-27 08:40:06 UTC (rev 637)
@@ -37,7 +37,7 @@
super.init();
// push icon and text in actions
initAction(VCSUIFactory.IDENTITY_UI, getUi().getShowFirstLaunch());
- initAction(VCSUIFactory.CONFIG_UI, getUi().getShowConfig());
+ initAction(VCSUIFactory.CONNEXION_CONFIG_UI, getUi().getShowConfig());
initAction(VCSUIFactory.SYNCH_UI, getUi().getShowSynch());
}
@@ -58,7 +58,7 @@
UIActionHelper.showIdentityUI(getModel().getIdentity(), getUi(), "bottom-left");
return;
}
- if (uiDef == VCSUIFactory.CONFIG_UI) {
+ if (uiDef == VCSUIFactory.CONNEXION_CONFIG_UI) {
UIActionHelper.showConfigUI(getModel().getConnexion().getConfig(), getUi(), "bottom-left");
return;
}
1
0
[Buix-commits] r636 - trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:39:32 +0000 (Sun, 27 Apr 2008)
New Revision: 636
Added:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx
Removed:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
Modified:
trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
Log:
renommage ConfigUI en ConnexionConfigUI
Deleted: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-27 08:39:02 UTC (rev 635)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx 2008-04-27 08:39:32 UTC (rev 636)
@@ -1,133 +0,0 @@
-<ConfigUI modal='true' resizable='false'>
- <style source="config.css"/>
- <script>
- import static org.codelutin.vcs.type.VCSConnexionMode.*;
- import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
- import org.codelutin.vcs.ui.action.*;
- </script>
-
- <java.awt.CardLayout id='connexionPanelLayout'>
- <Table id='anonymousPanel' insets='2,2,2,2'>
- <row>
- <cell columns="3">
- <JLabel text="lutinvcs.no.config" enabled='false'/>
- </cell>
- </row>
- </Table>
- <Table id='passwordPanel' insets='2,2,2,2'>
- <row fill='horizontal'>
- <cell>
- <JLabel id='loginLabel'/>
- </cell>
- <cell>
- <JTextField id='login' onKeyReleased="doCheck(Element.login)"/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='passwordLabel' labelFor='{password}'/>
- </cell>
- <cell>
- <JPasswordField id='password' onKeyReleased="doCheck(Element.password)"/>
- </cell>
- </row>
- </Table>
- <Table id='sshPanel' opaque="false" insets='2,2,2,2'>
- <row fill='horizontal'>
- <cell>
- <JLabel id='sshLoginLabel'/>
- </cell>
- <cell>
- <JTextField id='sshLogin' onKeyReleased="doCheck(Element.sshLogin)"/>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='passphraseLabel'/>
- </cell>
- <cell>
- <JToolBar opaque='false' borderPainted='false' height="24">
- <JCheckBox id='noPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)"/>
- <JPasswordField id='passphrase' onKeyReleased="doCheck(Element.passphrase)"
- enabled='{!noPassPhrase.isSelected()}'/>
- </JToolBar>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell>
- <JLabel id='privateKeyFileLabel'/>
- </cell>
- <cell>
- <JToolBar opaque='false' borderPainted='false' height="24">
- <JTextField id='privateKeyFile' onKeyReleased="doCheck(Element.privateKeyFile)"/>
- <JButton id='changePrivateKeyFile' icon='{createActionIcon("filechooser")}'
- onActionPerformed="changePrivateKeyFile()"/>
- </JToolBar>
- </cell>
- </row>
- </Table>
- </java.awt.CardLayout>
-
- <JToolBar id='top' height='26'>
- <JLabel text='lutinvcs.config.message'/>
- <Table fill='both' insets='0,0,0,0'>
- <row>
- <cell fill='both'/>
- </row>
- </Table>
- <JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/>
- <JButton id='testConnection' action='{newAction(TestConnexionAction.class)}' borderPainted='false'/>
- <JButton id='help' action='{newAction(HelpAction.class)}' borderPainted='false'/>
- </JToolBar>
-
- <JToolBar id='connexionHead' opaque='false' height='26'>
- <JLabel id='connexionModeLabel'/>
- <JRadioButton id='connexionModeAnonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
- <JRadioButton id='connexionModePassword' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
- <JRadioButton id='connexionModeSsh' onActionPerformed="changeAutheticationMode(SSH)"/>
- <Table fill='both' insets='0,0,0,0'>
- <row>
- <cell fill='both'/>
- </row>
- </Table>
- <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
- borderPainted='false'/>
- </JToolBar>
-
- <Table fill='both' insets="1,1,1,1">
- <row fill='horizontal'>
- <cell columns='2'>
- <JScrollPane columnHeaderView='{top}'>
- <JEditorPane id="doc"/>
- </JScrollPane>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell columns="2" fill='both'>
- <JToolBar id='rootHead' opaque='false' height='26'>
- <JComboBox id='rootsList' />
- <JButton id='editRoot' icon='{createActionIcon("editroot")}' borderPainted='false' onActionPerformed="editRoot()"/>
- <JButton id='addRoot' icon='{createActionIcon("addroot")}' borderPainted='false' onActionPerformed="addRoot()"/>
- <JButton id='deleteRoot' icon='{createActionIcon("deleteroot")}' borderPainted='false' onActionPerformed="deleteRoot()"/>
- <!--JSeparator orientation="vertical"/-->
- </JToolBar>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell columns="2" fill='both'>
- <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
- <JPanel id='connexionPanel' layout='{connexionPanelLayout}'/>
- </JScrollPane>
- </cell>
- </row>
- <row fill='horizontal'>
- <cell weightx='1'>
- <JButton id='ok' onActionPerformed="save()"/>
- </cell>
- <cell weightx='1'>
- <JButton id='cancel' onActionPerformed="dispose()"/>
- </cell>
- </row>
- </Table>
-
-</ConfigUI>
Copied: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx (from rev 630, trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConfigUI.jaxx)
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx (rev 0)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxConnexionConfigUI.jaxx 2008-04-27 08:39:32 UTC (rev 636)
@@ -0,0 +1,133 @@
+<ConfigUI modal='true' resizable='false'>
+ <style source="config.css"/>
+ <script>
+ import static org.codelutin.vcs.type.VCSConnexionMode.*;
+ import static org.codelutin.vcs.ui.util.UIHelper.createActionIcon;
+ import org.codelutin.vcs.ui.action.*;
+ </script>
+
+ <java.awt.CardLayout id='connexionPanelLayout'>
+ <Table id='anonymousPanel' insets='2,2,2,2'>
+ <row>
+ <cell columns="3">
+ <JLabel text="lutinvcs.no.config" enabled='false'/>
+ </cell>
+ </row>
+ </Table>
+ <Table id='passwordPanel' insets='2,2,2,2'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='loginLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='login' onKeyReleased="doCheck(Element.login)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='passwordLabel' labelFor='{password}'/>
+ </cell>
+ <cell>
+ <JPasswordField id='password' onKeyReleased="doCheck(Element.password)"/>
+ </cell>
+ </row>
+ </Table>
+ <Table id='sshPanel' opaque="false" insets='2,2,2,2'>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='sshLoginLabel'/>
+ </cell>
+ <cell>
+ <JTextField id='sshLogin' onKeyReleased="doCheck(Element.sshLogin)"/>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='passphraseLabel'/>
+ </cell>
+ <cell>
+ <JToolBar opaque='false' borderPainted='false' height="24">
+ <JCheckBox id='noPassPhrase' onKeyReleased="doCheck(Element.nopassphrase)"/>
+ <JPasswordField id='passphrase' onKeyReleased="doCheck(Element.passphrase)"
+ enabled='{!noPassPhrase.isSelected()}'/>
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell>
+ <JLabel id='privateKeyFileLabel'/>
+ </cell>
+ <cell>
+ <JToolBar opaque='false' borderPainted='false' height="24">
+ <JTextField id='privateKeyFile' onKeyReleased="doCheck(Element.privateKeyFile)"/>
+ <JButton id='changePrivateKeyFile' icon='{createActionIcon("filechooser")}'
+ onActionPerformed="changePrivateKeyFile()"/>
+ </JToolBar>
+ </cell>
+ </row>
+ </Table>
+ </java.awt.CardLayout>
+
+ <JToolBar id='top' height='26'>
+ <JLabel text='lutinvcs.config.message'/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='reset' onActionPerformed="reset()" icon='{createActionIcon("revert")}' borderPainted='false'/>
+ <JButton id='testConnection' action='{newAction(TestConnexionAction.class)}' borderPainted='false'/>
+ <JButton id='help' action='{newAction(HelpAction.class)}' borderPainted='false'/>
+ </JToolBar>
+
+ <JToolBar id='connexionHead' opaque='false' height='26'>
+ <JLabel id='connexionModeLabel'/>
+ <JRadioButton id='connexionModeAnonymous' onActionPerformed="changeAutheticationMode(ANONYMOUS)"/>
+ <JRadioButton id='connexionModePassword' onActionPerformed="changeAutheticationMode(PASSWORD)"/>
+ <JRadioButton id='connexionModeSsh' onActionPerformed="changeAutheticationMode(SSH)"/>
+ <Table fill='both' insets='0,0,0,0'>
+ <row>
+ <cell fill='both'/>
+ </row>
+ </Table>
+ <JButton id='generateKey' icon='{createActionIcon("generatekey")}' onActionPerformed="generateKey()"
+ borderPainted='false'/>
+ </JToolBar>
+
+ <Table fill='both' insets="1,1,1,1">
+ <row fill='horizontal'>
+ <cell columns='2'>
+ <JScrollPane columnHeaderView='{top}'>
+ <JEditorPane id="doc"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell columns="2" fill='both'>
+ <JToolBar id='rootHead' opaque='false' height='26'>
+ <JComboBox id='rootsList' />
+ <JButton id='editRoot' icon='{createActionIcon("editroot")}' borderPainted='false' onActionPerformed="editRoot()"/>
+ <JButton id='addRoot' icon='{createActionIcon("addroot")}' borderPainted='false' onActionPerformed="addRoot()"/>
+ <JButton id='deleteRoot' icon='{createActionIcon("deleteroot")}' borderPainted='false' onActionPerformed="deleteRoot()"/>
+ <!--JSeparator orientation="vertical"/-->
+ </JToolBar>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell columns="2" fill='both'>
+ <JScrollPane columnHeaderView='{connexionHead}' styleClass='connexionScroll'>
+ <JPanel id='connexionPanel' layout='{connexionPanelLayout}'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill='horizontal'>
+ <cell weightx='1'>
+ <JButton id='ok' onActionPerformed="save()"/>
+ </cell>
+ <cell weightx='1'>
+ <JButton id='cancel' onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
+
+</ConfigUI>
Modified: trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java
===================================================================
--- trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-27 08:39:02 UTC (rev 635)
+++ trunk/lutinvcs/ui/jaxx/src/main/uimodel/org/codelutin/vcs/ui/JaxxVCSUIProvider.java 2008-04-27 08:39:32 UTC (rev 636)
@@ -23,7 +23,7 @@
JaxxDiffUI.class,
JaxxChangelogUI.class,
JaxxConfirmUI.class,
- JaxxConfigUI.class,
+ JaxxConnexionConfigUI.class,
JaxxGenerateSshKeyUI.class,
JaxxIdentityUI.class,
JaxxTestUI.class);
1
0
[Buix-commits] r635 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: . action handler
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:39:02 +0000 (Sun, 27 Apr 2008)
New Revision: 635
Added:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java
Removed:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/ConnexionConfigUI.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -18,7 +18,7 @@
import org.codelutin.ui.FormElement;
import org.codelutin.util.FileUtil;
import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import org.codelutin.vcs.ui.util.ui.AbstractUI;
import javax.swing.AbstractButton;
@@ -34,7 +34,7 @@
import java.util.Arrays;
/** @author chemit */
-public abstract class ConnexionConfigUI extends AbstractUI<ConfigUIHandler> {
+public abstract class ConnexionConfigUI extends AbstractUI<ConnexionConfigUIHandler> {
public enum Element implements FormElement<ConnexionConfigUI> {
connexion,
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/VCSUIFactory.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -26,7 +26,7 @@
import org.codelutin.vcs.VCSConnexionConfig;
import org.codelutin.vcs.VCSFactory;
import org.codelutin.vcs.ui.handler.ChangelogUIHandler;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import org.codelutin.vcs.ui.handler.ConfirmUIHandler;
import org.codelutin.vcs.ui.handler.DiffUIHandler;
import org.codelutin.vcs.ui.handler.IdentityUIHandler;
@@ -59,7 +59,7 @@
public static final DialogUIDef<DiffUIModel, DiffUI, DiffUIHandler> DIFF_UI;
public static final DialogUIDef<ChangelogUIModel, ChangelogUI, ChangelogUIHandler> CHANGELOG_UI;
public static final DialogUIDef<ConfirmUIModel, ConfirmUI, ConfirmUIHandler> CONFIRM_UI;
- public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConfigUIHandler> CONFIG_UI;
+ public static final DialogUIDef<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler> CONFIG_UI;
public static final DialogUIDef<GenerateSshKeyUIModel, GenerateSshKeyUI, GenerateSshKeyUIHandler> GENERATE_SHH_KEY_UI;
public static final DialogUIDef<IdentityUIModel, IdentityUI, IdentityUIHandler> IDENTITY_UI;
public static final DialogUIDef<TestUIModel, TestUI, TestUIHandler> TEST_UI;
@@ -132,7 +132,7 @@
n_("lutinvcs.action.show.confirmui"),
n_("lutinvcs.action.show.confirmui.tip"),
n_("lutinvcs.confirmui.title"));
- CONFIG_UI = newDef(ConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
+ CONFIG_UI = newDef(ConnexionConfigUIHandler.class, ConnexionConfigUI.class, ConnexionConfigUIModel.class,
n_("lutinvcs.action.show.configui"),
n_("lutinvcs.action.show.configui.tip"),
n_("lutinvcs.configui.title"));
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -17,14 +17,14 @@
import org.codelutin.ui.DialogUIHandler;
import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.util.AbstractVCSShowUIAction;
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConnexionConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/TestConnexionAction.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -20,14 +20,14 @@
import org.codelutin.vcs.VCSException;
import org.codelutin.vcs.VCSFactory;
import org.codelutin.vcs.ui.ConnexionConfigUI;
-import org.codelutin.vcs.ui.handler.ConfigUIHandler;
+import org.codelutin.vcs.ui.handler.ConnexionConfigUIHandler;
import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
/** @author chemit */
-public class TestConnexionAction extends org.codelutin.ui.AbstractUIAction<org.codelutin.vcs.ui.handler.ConfigUIHandler> {
+public class TestConnexionAction extends org.codelutin.ui.AbstractUIAction<ConnexionConfigUIHandler> {
private static final long serialVersionUID = 1L;
@@ -41,7 +41,7 @@
public void actionPerformed(java.awt.event.ActionEvent e) {
checkInit();
- ConfigUIHandler uiHandler = getHandler();
+ ConnexionConfigUIHandler uiHandler = getHandler();
VCSConnexionConfig config = uiHandler.getConfig();
VCSConnexion connexion = VCSFactory.newConnexion(config);
ConnexionConfigUI ui = uiHandler.getUi();
Deleted: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:38:39 UTC (rev 634)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -1,288 +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.ui.handler;
-
-import org.codelutin.vcs.VCSConnexionConfig;
-import org.codelutin.vcs.type.VCSConnexionMode;
-import org.codelutin.vcs.ui.ConnexionConfigUI;
-import org.codelutin.vcs.ui.ConnexionConfigUI.Element;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.login;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.nopassphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.passphrase;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.password;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.privateKeyFile;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.sshLogin;
-import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.values;
-import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
-import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
-
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-import javax.swing.text.JTextComponent;
-import java.awt.Color;
-import java.beans.PropertyChangeEvent;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/** @author chemit */
-public class ConfigUIHandler extends AbstractUIHandler<ConnexionConfigUIModel, ConnexionConfigUI> {
-
- protected List<Element> errors;
-
-
- public ConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
- super(ui, new ConnexionConfigUIModel(), config);
- ui.setHandler(this);
- errors = new ArrayList<Element>();
- }
-
- public void init() {
- super.init();
- ConnexionConfigUI ui = getUi();
- JPanel connexionPanel = ui.getConnexionPanel();
- connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
- connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
- connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (log.isDebugEnabled()) {
- log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
- }
- String action = evt.getPropertyName();
-
- if (ConnexionConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
- // update ui with model values,
- populateUI((ConnexionConfigUIModel) evt.getNewValue());
- doCheck(null);
- return;
- }
- if (ConnexionConfigUIModel.MODE_PROPERTY_CHANGED.equals(action)) {
- updateUI((VCSConnexionMode) evt.getNewValue());
- doCheck(null);
- return;
- }
-
- if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
- Boolean newValue = (Boolean) evt.getNewValue();
- boolean modified = newValue != null && newValue;
- getUi().getReset().setEnabled(modified);
- getUi().getTestConnection().setEnabled(modified && isConfigValid());
- return;
- }
-
- if (ConnexionConfigUIModel.CONNEXION_STATE_PROPERTY_CHANGED.equals(action)) {
- Boolean newValue = (Boolean) evt.getNewValue();
- boolean validConnexion = newValue != null && newValue;
- getUi().getOk().setEnabled(validConnexion);
- getUi().getTestConnection().setEnabled(!validConnexion);
- return;
- }
- throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
- }
-
- public synchronized List<Element> validateModel(Element element) {
- errors.clear();
- ConnexionConfigUI ui = getUi();
- if (element != null) {
- // compute modifed
- setModified(element, ui);
- }
- switch (getModel().getMode()) {
- case ANONYMOUS:
- // nothing to validate
- break;
- case PASSWORD:
- // login + password not empty
- checkData(ui.getLogin(), login);
- checkData(ui.getPassword().getPassword().length == 0, password);
- break;
- case SSH:
- // login + private key exists
- checkData(ui.getSshLogin(), sshLogin);
- String s = ui.getPrivateKeyFile().getText();
- File file = new File(s);
- checkData(s.isEmpty() || !file.exists(), privateKeyFile);
- if (ui.getElementValue(nopassphrase).equals("false")) {
- // check it there is a pass-phrase
- checkData(ui.getPassphrase().getPassword().length == 0, passphrase);
- } else {
- errors.remove(passphrase);
- }
- break;
- }
- return errors;
- }
-
- public void setModified(Element element, ConnexionConfigUI ui) {
- boolean modify = false;
- ConnexionConfigUIModel model = getModel();
-
- String value = ui.getElementValue(element);
-
- switch (element) {
- case connexion:
- modify = model.getMode() != model.getConfig().getMode();
- break;
- case login:
- modify = !model.getConfig().getUserName().equals(value);
- break;
- case sshLogin:
- modify = !model.getConfig().getUserName().equals(value);
- break;
- case nopassphrase:
- boolean b = ui.getNoPassPhrase().isSelected();
- modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
- if (!b) {
- model.removeModified(passphrase);
- } else {
- char[] password = ui.getPassphrase().getPassword();
- boolean modify2;
- if (model.getConfig().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
- modify2 = password.length == 0;
- } else {
- modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
- }
- if (modify2) {
- model.addModified(passphrase);
- }
- }
- break;
- case password:
- modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getPassword().getPassword()));
- break;
- case privateKeyFile:
- modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(value);
- break;
- case passphrase:
- modify = !model.getConfig().getPassphrase().equals(value);
- break;
- }
- if (modify) {
- model.addModified(element);
- // reset connexion state
- model.setConnexionState(null);
- } else if (model.getModifieds().contains(element)) {
- model.removeModified(element);
- // reset connexion state
- model.setConnexionState(null);
- }
- }
-
- public void doCheck(Element element) {
- List<Element> errors = validateModel(element);
- updateUI(errors);
- }
-
- public boolean isConfigValid() {
- return errors.isEmpty() && getModel().isConnexionState();
- }
-
- public void reset() {
- getModel().reset();
- }
-
- protected void populateUI(ConnexionConfigUIModel model) {
- ConnexionConfigUI ui = getUi();
- VCSConnexionConfig config = model.getConfig();
- switch (config.getMode()) {
- case ANONYMOUS:
- break;
- case PASSWORD:
- ui.getLogin().setText(config.getUserName());
- ui.getPassword().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
- break;
- case SSH:
- ui.getSshLogin().setText(config.getUserName());
- ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
- ui.getPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
- ui.getPassphrase().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
- break;
- }
- ui.getTestConnection().setEnabled(true);
- }
-
- protected void updateUI(final VCSConnexionMode mode) {
- ConnexionConfigUI ui = getUi();
- //getModel().removeModified(sshLogin, nopassphrase, passphrase, privateKeyFile, login, password);
- switch (mode) {
- case ANONYMOUS:
- ui.getConnexionModeAnonymous().setSelected(true);
- break;
- case PASSWORD:
- ui.getConnexionModePassword().setSelected(true);
- setModified(login, ui);
- setModified(password, ui);
- break;
- case SSH:
- setModified(sshLogin, ui);
- setModified(nopassphrase, ui);
- setModified(passphrase, ui);
- setModified(privateKeyFile, ui);
- ui.getConnexionModeSsh().setSelected(true);
- break;
- }
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- getUi().getConnexionPanelLayout().show(getUi().getConnexionPanel(), mode.name());
- getUi().pack();
- }
- });
- }
-
- protected void updateUI(List<Element> errors) {
- ConnexionConfigUI ui = getUi();
- boolean valid = isConfigValid();
- ui.getOk().setEnabled(valid && getModel().isModified());
- //ui.getTestConnection().setEnabled(valid);
- ui.getGenerateKey().setEnabled(getModel().getMode() == VCSConnexionMode.SSH && !errors.contains(sshLogin) && !errors.contains(passphrase));
- for (Element element : values()) {
- setLabelColor(errors, element);
- }
- }
-
- protected void checkData(JTextComponent component, Element errorName) {
- if (component.getText().isEmpty()) {
- errors.add(errorName);
- }
- }
-
- protected void checkData(boolean notValid, Element errorName) {
- if (notValid) {
- errors.add(errorName);
- }
- }
-
- protected void setLabelColor(List<Element> errors, Element element) {
- JComponent component = getUi().getElementLabel(element);
- if (component != null && component.isVisible()) {
- component.setForeground(errors.contains(element) ? Color.red : Color.black);
- }
- }
-
- public void save() {
- if (!getModel().isModified()) {
- log.warn("nothing to save");
- }
- for (Element element : getModel().getModifieds()) {
- String value = getUi().getElementValue(element);
- getModel().save(element, value);
- log.info("save " + element);
- }
- }
-}
\ No newline at end of file
Copied: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java (from rev 633, trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConfigUIHandler.java)
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java (rev 0)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/ConnexionConfigUIHandler.java 2008-04-27 08:39:02 UTC (rev 635)
@@ -0,0 +1,288 @@
+/**
+ * ##% 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.ui.handler;
+
+import org.codelutin.vcs.VCSConnexionConfig;
+import org.codelutin.vcs.type.VCSConnexionMode;
+import org.codelutin.vcs.ui.ConnexionConfigUI;
+import org.codelutin.vcs.ui.ConnexionConfigUI.Element;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.login;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.nopassphrase;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.passphrase;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.password;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.privateKeyFile;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.sshLogin;
+import static org.codelutin.vcs.ui.ConnexionConfigUI.Element.values;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
+import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.text.JTextComponent;
+import java.awt.Color;
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/** @author chemit */
+public class ConnexionConfigUIHandler extends AbstractUIHandler<ConnexionConfigUIModel, ConnexionConfigUI> {
+
+ protected List<Element> errors;
+
+
+ public ConnexionConfigUIHandler(ConnexionConfigUI ui, VCSConnexionConfig config) {
+ super(ui, new ConnexionConfigUIModel(), config);
+ ui.setHandler(this);
+ errors = new ArrayList<Element>();
+ }
+
+ public void init() {
+ super.init();
+ ConnexionConfigUI ui = getUi();
+ JPanel connexionPanel = ui.getConnexionPanel();
+ connexionPanel.add(ui.getAnonymousPanel(), VCSConnexionMode.ANONYMOUS.name());
+ connexionPanel.add(ui.getPasswordPanel(), VCSConnexionMode.PASSWORD.name());
+ connexionPanel.add(ui.getSshPanel(), VCSConnexionMode.SSH.name());
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (log.isDebugEnabled()) {
+ log.debug(evt.getPropertyName() + " old:" + evt.getOldValue() + ", new:" + evt.getNewValue());
+ }
+ String action = evt.getPropertyName();
+
+ if (ConnexionConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ // update ui with model values,
+ populateUI((ConnexionConfigUIModel) evt.getNewValue());
+ doCheck(null);
+ return;
+ }
+ if (ConnexionConfigUIModel.MODE_PROPERTY_CHANGED.equals(action)) {
+ updateUI((VCSConnexionMode) evt.getNewValue());
+ doCheck(null);
+ return;
+ }
+
+ if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ boolean modified = newValue != null && newValue;
+ getUi().getReset().setEnabled(modified);
+ getUi().getTestConnection().setEnabled(modified && isConfigValid());
+ return;
+ }
+
+ if (ConnexionConfigUIModel.CONNEXION_STATE_PROPERTY_CHANGED.equals(action)) {
+ Boolean newValue = (Boolean) evt.getNewValue();
+ boolean validConnexion = newValue != null && newValue;
+ getUi().getOk().setEnabled(validConnexion);
+ getUi().getTestConnection().setEnabled(!validConnexion);
+ return;
+ }
+ throw new IllegalStateException("unimplemented property changed : " + evt + " for " + this);
+ }
+
+ public synchronized List<Element> validateModel(Element element) {
+ errors.clear();
+ ConnexionConfigUI ui = getUi();
+ if (element != null) {
+ // compute modifed
+ setModified(element, ui);
+ }
+ switch (getModel().getMode()) {
+ case ANONYMOUS:
+ // nothing to validate
+ break;
+ case PASSWORD:
+ // login + password not empty
+ checkData(ui.getLogin(), login);
+ checkData(ui.getPassword().getPassword().length == 0, password);
+ break;
+ case SSH:
+ // login + private key exists
+ checkData(ui.getSshLogin(), sshLogin);
+ String s = ui.getPrivateKeyFile().getText();
+ File file = new File(s);
+ checkData(s.isEmpty() || !file.exists(), privateKeyFile);
+ if (ui.getElementValue(nopassphrase).equals("false")) {
+ // check it there is a pass-phrase
+ checkData(ui.getPassphrase().getPassword().length == 0, passphrase);
+ } else {
+ errors.remove(passphrase);
+ }
+ break;
+ }
+ return errors;
+ }
+
+ public void setModified(Element element, ConnexionConfigUI ui) {
+ boolean modify = false;
+ ConnexionConfigUIModel model = getModel();
+
+ String value = ui.getElementValue(element);
+
+ switch (element) {
+ case connexion:
+ modify = model.getMode() != model.getConfig().getMode();
+ break;
+ case login:
+ modify = !model.getConfig().getUserName().equals(value);
+ break;
+ case sshLogin:
+ modify = !model.getConfig().getUserName().equals(value);
+ break;
+ case nopassphrase:
+ boolean b = ui.getNoPassPhrase().isSelected();
+ modify = (model.getConfig().getPassphrase() != null && !model.getConfig().getPassphrase().isEmpty()) == b;
+ if (!b) {
+ model.removeModified(passphrase);
+ } else {
+ char[] password = ui.getPassphrase().getPassword();
+ boolean modify2;
+ if (model.getConfig().getPassphrase() == null || model.getConfig().getPassphrase().isEmpty()) {
+ modify2 = password.length == 0;
+ } else {
+ modify2 = model.getConfig().getPassphrase().equals(Arrays.toString(password));
+ }
+ if (modify2) {
+ model.addModified(passphrase);
+ }
+ }
+ break;
+ case password:
+ modify = !model.getConfig().getPassphrase().equals(Arrays.toString(ui.getPassword().getPassword()));
+ break;
+ case privateKeyFile:
+ modify = !model.getConfig().getKeyFile().getAbsolutePath().equals(value);
+ break;
+ case passphrase:
+ modify = !model.getConfig().getPassphrase().equals(value);
+ break;
+ }
+ if (modify) {
+ model.addModified(element);
+ // reset connexion state
+ model.setConnexionState(null);
+ } else if (model.getModifieds().contains(element)) {
+ model.removeModified(element);
+ // reset connexion state
+ model.setConnexionState(null);
+ }
+ }
+
+ public void doCheck(Element element) {
+ List<Element> errors = validateModel(element);
+ updateUI(errors);
+ }
+
+ public boolean isConfigValid() {
+ return errors.isEmpty() && getModel().isConnexionState();
+ }
+
+ public void reset() {
+ getModel().reset();
+ }
+
+ protected void populateUI(ConnexionConfigUIModel model) {
+ ConnexionConfigUI ui = getUi();
+ VCSConnexionConfig config = model.getConfig();
+ switch (config.getMode()) {
+ case ANONYMOUS:
+ break;
+ case PASSWORD:
+ ui.getLogin().setText(config.getUserName());
+ ui.getPassword().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ break;
+ case SSH:
+ ui.getSshLogin().setText(config.getUserName());
+ ui.getNoPassPhrase().setSelected(config.isNoPassPhrase());
+ ui.getPrivateKeyFile().setText(config.getKeyFile() == null ? "" : config.getKeyFile().getAbsolutePath());
+ ui.getPassphrase().setText(config.getPassphrase() == null ? "" : config.getPassphrase());
+ break;
+ }
+ ui.getTestConnection().setEnabled(true);
+ }
+
+ protected void updateUI(final VCSConnexionMode mode) {
+ ConnexionConfigUI ui = getUi();
+ //getModel().removeModified(sshLogin, nopassphrase, passphrase, privateKeyFile, login, password);
+ switch (mode) {
+ case ANONYMOUS:
+ ui.getConnexionModeAnonymous().setSelected(true);
+ break;
+ case PASSWORD:
+ ui.getConnexionModePassword().setSelected(true);
+ setModified(login, ui);
+ setModified(password, ui);
+ break;
+ case SSH:
+ setModified(sshLogin, ui);
+ setModified(nopassphrase, ui);
+ setModified(passphrase, ui);
+ setModified(privateKeyFile, ui);
+ ui.getConnexionModeSsh().setSelected(true);
+ break;
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ getUi().getConnexionPanelLayout().show(getUi().getConnexionPanel(), mode.name());
+ getUi().pack();
+ }
+ });
+ }
+
+ protected void updateUI(List<Element> errors) {
+ ConnexionConfigUI ui = getUi();
+ boolean valid = isConfigValid();
+ ui.getOk().setEnabled(valid && getModel().isModified());
+ //ui.getTestConnection().setEnabled(valid);
+ ui.getGenerateKey().setEnabled(getModel().getMode() == VCSConnexionMode.SSH && !errors.contains(sshLogin) && !errors.contains(passphrase));
+ for (Element element : values()) {
+ setLabelColor(errors, element);
+ }
+ }
+
+ protected void checkData(JTextComponent component, Element errorName) {
+ if (component.getText().isEmpty()) {
+ errors.add(errorName);
+ }
+ }
+
+ protected void checkData(boolean notValid, Element errorName) {
+ if (notValid) {
+ errors.add(errorName);
+ }
+ }
+
+ protected void setLabelColor(List<Element> errors, Element element) {
+ JComponent component = getUi().getElementLabel(element);
+ if (component != null && component.isVisible()) {
+ component.setForeground(errors.contains(element) ? Color.red : Color.black);
+ }
+ }
+
+ public void save() {
+ if (!getModel().isModified()) {
+ log.warn("nothing to save");
+ }
+ for (Element element : getModel().getModifieds()) {
+ String value = getUi().getElementValue(element);
+ getModel().save(element, value);
+ log.info("save " + element);
+ }
+ }
+}
\ No newline at end of file
1
0
[Buix-commits] r634 - in trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui: action handler
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
by tchemit@users.labs.libre-entreprise.org 27 Apr '08
27 Apr '08
Author: tchemit
Date: 2008-04-27 08:38:39 +0000 (Sun, 27 Apr 2008)
New Revision: 634
Modified:
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java
Log:
renommage ConfigUI en ConnexionConfigUI
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:28 UTC (rev 633)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/action/ShowConfigAction.java 2008-04-27 08:38:39 UTC (rev 634)
@@ -18,13 +18,13 @@
import org.codelutin.vcs.ui.ConnexionConfigUI;
import org.codelutin.vcs.ui.VCSUIFactory;
import org.codelutin.vcs.ui.handler.ConfigUIHandler;
-import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.util.AbstractVCSShowUIAction;
import java.awt.event.ActionEvent;
/** @author chemit */
-public class ShowConfigAction extends AbstractVCSShowUIAction<ConfigUIModel, ConnexionConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
+public class ShowConfigAction extends AbstractVCSShowUIAction<ConnexionConfigUIModel, ConnexionConfigUI, ConfigUIHandler, DialogUIHandler<?, ?>> {
private static final long serialVersionUID = 1L;
Modified: trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java
===================================================================
--- trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java 2008-04-27 08:38:28 UTC (rev 633)
+++ trunk/lutinvcs/ui/common/src/main/java/org/codelutin/vcs/ui/handler/GenerateSshKeyUIHandler.java 2008-04-27 08:38:39 UTC (rev 634)
@@ -23,7 +23,7 @@
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.nopassphrase;
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.passphrase;
import static org.codelutin.vcs.ui.GenerateSshKeyUI.Element.values;
-import org.codelutin.vcs.ui.model.ConfigUIModel;
+import org.codelutin.vcs.ui.model.ConnexionConfigUIModel;
import org.codelutin.vcs.ui.model.GenerateSshKeyUIModel;
import org.codelutin.vcs.ui.util.handler.AbstractUIHandler;
@@ -59,14 +59,14 @@
}
String action = evt.getPropertyName();
- if (ConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.CONFIG_PROPERTY_CHANGED.equals(action)) {
// update ui with model values,
populateUI((GenerateSshKeyUIModel) evt.getNewValue());
doCheck(null);
return;
}
- if (ConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
+ if (ConnexionConfigUIModel.MODIFIED_PROPERTY_CHANGED.equals(action)) {
Boolean newValue = (Boolean) evt.getNewValue();
getUi().getReset().setEnabled(newValue != null && newValue);
getUi().getGenerate().setEnabled(isConfigValid());
1
0