r366 - in trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs: . impl/mock
Author: tchemit Date: 2008-04-05 20:40:27 +0000 (Sat, 05 Apr 2008) New Revision: 366 Removed: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSConfig.java Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java Log: refactor providers Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-05 20:40:12 UTC (rev 365) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/MockProvider.java 2008-04-05 20:40:27 UTC (rev 366) @@ -19,14 +19,10 @@ import org.codelutin.vcs.util.AbstractVCSProvider; /** @author chemit */ -public class MockProvider extends AbstractVCSProvider<MockVCSHandler, MockConnexion> { +public class MockProvider extends AbstractVCSProvider<MockConnexion, MockVCSHandler> { public MockProvider() { - super("MOCK", MockVCSHandler.class); + super("MOCK", MockVCSHandler.class, MockConnexion.class); } - public MockConnexion newConnection(VCSConnexionMode mode, VCSConfig config) { - checkHandlerInit(); - return null; - } } \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-05 20:40:12 UTC (rev 365) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockConnexion.java 2008-04-05 20:40:27 UTC (rev 366) @@ -14,27 +14,39 @@ */ package org.codelutin.vcs.impl.mock; +import org.codelutin.vcs.ConnectionState; +import org.codelutin.vcs.MockProvider; +import org.codelutin.vcs.VCSConnexionConfig; +import org.codelutin.vcs.VCSException; +import org.codelutin.vcs.VCSConnexionMode; import org.codelutin.vcs.util.AbstractVCSConnexion; -import org.codelutin.vcs.VCSConfig; -import org.codelutin.vcs.VCSHandler; -import org.codelutin.vcs.ConnectionState; /** @author chemit */ public class MockConnexion extends AbstractVCSConnexion { - public void init(VCSConfig config, VCSHandler handler) { + public MockConnexion(VCSConnexionMode mode, MockProvider provider) { + super(mode, provider); + } + + public void init(VCSConnexionConfig config) { state = ConnectionState.INIT; + this.config = config; } + public void testConnection() throws VCSException { + } + @Override public void close() throws IllegalStateException { checkInit(); + fireClose(); } @Override public void open() throws IllegalStateException { checkInit(); - state = ConnectionState.INIT; + state = ConnectionState.ON_LINE; + fireOpen(); } } \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSConfig.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSConfig.java 2008-04-05 20:40:12 UTC (rev 365) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSConfig.java 2008-04-05 20:40:27 UTC (rev 366) @@ -1,126 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs.impl.mock; - -import org.codelutin.vcs.ConnectionState; -import org.codelutin.vcs.VCSConfig; -import org.codelutin.vcs.VCSType; -import org.codelutin.vcs.VCSTypeRepo; - -import java.io.File; -import java.net.URL; - -/** @author chemit */ -public class MockVCSConfig implements VCSConfig { - - File localRoot; - URL remoteRoot; - - boolean init; - - public boolean canConnect() { - return false; - } - - public boolean isConnected() { - return false; - } - - public ConnectionState getConnectionState() { - return null; - } - - public VCSType getType() { - return VCSType.MOCK; - } - - public boolean isUseSshConnexion() { - return false; - } - - public String getHostName() { - return null; - } - - public File getKeyFile() { - return null; - } - - public String getUserName() { - return null; - } - - public boolean isNoPassPhrase() { - return false; - } - - public String getPassphrase() { - return null; - } - - public String getRemotePath() { - return null; - } - - public String getRemoteDatabase() { - return remoteRoot.toString(); - } - - public String getRemoteDatabasePath() { - return remoteRoot.toString(); - } - - public File getLocalDatabasePath() { - return localRoot; - } - - public VCSTypeRepo getTypeRepo() { - return null; - } - - public boolean isOffline() { - return false; - } - - public boolean isReadOnly() { - return false; - } - - public boolean isInit() { - return init; - } - - public void validate() { - } - - public void setUseSshConnexion(boolean useSshConnexion) { - } - - public File getSource() { - return null; - } - - public void setLocalRoot(File localRoot) { - this.localRoot = localRoot; - } - - public void setRemoteRoot(URL remoteRoot) { - this.remoteRoot = remoteRoot; - } - - public void setInit(boolean init) { - this.init = init; - } -} Modified: trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java 2008-04-05 20:40:12 UTC (rev 365) +++ trunk/lutinvcs/lutinvcs-provider-mock/src/main/java/org/codelutin/vcs/impl/mock/MockVCSHandler.java 2008-04-05 20:40:27 UTC (rev 366) @@ -14,10 +14,9 @@ */ package org.codelutin.vcs.impl.mock; -import org.codelutin.vcs.util.AbstractVCSHandler; -import org.codelutin.vcs.VCSConfig; import org.codelutin.vcs.VCSException; import org.codelutin.vcs.VCSState; +import org.codelutin.vcs.util.AbstractVCSHandler; import java.io.File; import java.io.IOException; @@ -25,103 +24,96 @@ import java.util.List; /** @author chemit */ -public class MockVCSHandler extends AbstractVCSHandler { +public class MockVCSHandler extends AbstractVCSHandler<MockConnexion> { - public MockVCSHandler(VCSConfig config) { - super(config, "", ""); + public MockVCSHandler() { + super("", ""); } - public void initWorkingCopy() throws VCSException { + public void initWorkingCopy(MockConnexion connexion) throws VCSException { } - public String getRemoteUrl() { + public VCSState getState(MockConnexion connexion, File fileState, Collection tmp) throws VCSException { return null; } - public VCSState getState(File fileState, Collection tmp) throws VCSException { + public VCSState getState(MockConnexion connexion, File file, Collection tmp, boolean noremote) throws VCSException { return null; } - public VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException { - return null; - } - - public boolean isOnRemote(File file) { + public boolean isOnRemote(MockConnexion connexion, File file) { return false; } - public boolean isUpToDate(File file) throws VCSException { + public boolean isUpToDate(MockConnexion connexion, File file) throws VCSException { return false; } - public void makeRemoteDir(String commitMessage, String... dirNames) throws VCSException { + public void makeRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException { } - public void deleteRemoteDir(String commitMessage, String... dirNames) throws VCSException { + public void deleteRemoteDir(MockConnexion connexion, String commitMessage, String... dirNames) throws VCSException { } - public long add(List<File> files, String msg) throws VCSException { + public long add(MockConnexion connexion, List<File> files, String msg) throws VCSException { return 0; } - public void delete(List<File> files, String msg) throws VCSException { + public void delete(MockConnexion connexion, List<File> files, String msg) throws VCSException { } - public void revert(List<File> files) throws VCSException { + public void revert(MockConnexion connexion, List<File> files) throws VCSException { } - public long commit(List<File> files, String msg) throws VCSException { + public long commit(MockConnexion connexion, List<File> files, String msg) throws VCSException { return 0; } - public void update(File file, Object revision) throws VCSException { + public void update(MockConnexion connexion, File file, Object revision) throws VCSException { } - public void update(File file) throws VCSException { + public void update(MockConnexion connexion, File file) throws VCSException { } - public void checkout(File destDir, String module, boolean recurse) throws VCSException { + public void checkout(MockConnexion connexion, File destDir, String module, boolean recurse) throws VCSException { } - public void checkoutFile(File destDir, String module) throws VCSException { + public void checkoutFile(MockConnexion connexion, File destDir, String module) throws VCSException { } - public long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException { + public long checkoutOnlyTheDirectory(MockConnexion connexion, File root, Object revision) throws VCSException { return 0; } - public List<String> getRemoteStorageNames(File directory) throws VCSException { + public List<String> getRemoteStorageNames(MockConnexion connexion, File directory) throws VCSException { return null; } - public Object getRevision(File f) throws VCSException { + public Object getRevision(MockConnexion connexion, File f) throws VCSException { return null; } - public List getLog(Object startRevision, Object endRevision, File file) throws VCSException { + public List getLog(MockConnexion connexion, Object startRevision, Object endRevision, File file) throws VCSException { return null; } - public String getFileContent(File file, Object revision) throws VCSException, IOException { + public String getFileContent(MockConnexion connexion, File file, Object revision) throws VCSException, IOException { return null; } - public String getChangeLog(File file) throws VCSException { + public String getChangeLog(MockConnexion connexion, File file) throws VCSException { return null; } - public String getDiff(File file) throws VCSException, IOException { + public String getDiff(MockConnexion connexion, File file) throws VCSException, IOException { return null; } - public String getDiff(File file, Object againstRevision) throws VCSException, IOException { + public String getDiff(MockConnexion connexion, File file, Object againstRevision) throws VCSException, IOException { return null; } - public void testConnection() throws VCSException { - } - - public boolean hasProtocoleChanged() throws VCSException { + public boolean hasProtocoleChanged(MockConnexion connexion) throws VCSException { return false; } }
participants (1)
-
tchemit@users.labs.libre-entreprise.org