Author: tchemit Date: 2008-05-13 14:14:17 +0000 (Tue, 13 May 2008) New Revision: 651 Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java Log: refactor config + introduction factory de config Added: trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java =================================================================== --- trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java (rev 0) +++ trunk/lutinvcs/core/src/main/java/org/codelutin/vcs/util/SimpleVCSConnexionConfig.java 2008-05-13 14:14:17 UTC (rev 651) @@ -0,0 +1,121 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs.util; + +import org.codelutin.vcs.VCSConnexionConfig; +import org.codelutin.vcs.VCSRootConfig; +import org.codelutin.vcs.type.VCSConnexionConfigProperty; +import static org.codelutin.vcs.type.VCSConnexionConfigProperty.*; +import org.codelutin.vcs.type.VCSConnexionMode; +import org.codelutin.vcs.type.VCSTypeRepo; + +import java.io.File; +import java.util.EnumMap; + +/** @author chemit */ +public class SimpleVCSConnexionConfig extends org.codelutin.util.config.SimpleConfig<VCSConnexionConfigProperty> implements VCSConnexionConfig { + + public SimpleVCSConnexionConfig() { + super(VCSConnexionConfigProperty.class); + } + + public SimpleVCSConnexionConfig(EnumMap<VCSConnexionConfigProperty, Object> properties) { + super(VCSConnexionConfigProperty.class, properties); + } + + public VCSRootConfig getRootConfig() { + return (VCSRootConfig) properties.get(rootConfig); + } + + public VCSTypeRepo getTypeRepo() { + return (VCSTypeRepo) properties.get(typeRepo); + } + + public String getTypeRepoValue() { + return (String) properties.get(typeRepoValue); + } + + public File getWorkingCopyFile() { + return (File) properties.get(workingCopyFile); + } + + public VCSConnexionMode getConnexionMode() { + return (VCSConnexionMode) properties.get(connexionMode); + } + + public String getLogin() { + return (String) properties.get(login); + } + + public String getPassword() { + return (String) properties.get(password); + } + + public String getSshLogin() { + return (String) properties.get(sshLogin); + } + + public String getSshPassphrase() { + return (String) properties.get(sshPassphrase); + } + + public File getSshPrivateKeyFile() { + return (File) properties.get(sshPrivateKeyFile); + } + + public void setRootConfig(VCSRootConfig newRootConfig) { + setProperty(rootConfig, newRootConfig); + } + + public void setTypeRepo(VCSTypeRepo newTypeRepo) { + setProperty(typeRepo, newTypeRepo); + } + + public void setTypeRepoValue(String newTypeRepoValue) { + setProperty(typeRepoValue, newTypeRepoValue); + } + + public void setWorkingCopyFile(File newLocalDatabasePath) { + setProperty(workingCopyFile, newLocalDatabasePath); + } + + public void setConnexionMode(VCSConnexionMode newConnexionMode) { + setProperty(connexionMode, newConnexionMode); + } + + public void setLogin(String newLogin) { + setProperty(login, newLogin); + } + + public void setPassword(String newPassword) { + setProperty(password, newPassword); + } + + public void setSshLogin(String newSshLogin) { + setProperty(sshLogin, newSshLogin); + } + + public void setSshPassphrase(String newSshPassphrase) { + setProperty(sshPassphrase, newSshPassphrase); + } + + public void setSshPrivateKeyFile(File newSshPrivateKeyFile) { + setProperty(sshPrivateKeyFile, newSshPrivateKeyFile); + } + + public boolean isNoPassPhrase() { + return getSshPassphrase() == null; + } +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org