Author: tchemit Date: 2008-04-06 07:03:02 +0000 (Sun, 06 Apr 2008) New Revision: 375 Added: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSAction.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSState.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSStatus.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSType.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSTypeRepo.java Removed: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntryLocation.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSStatus.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSType.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSTypeRepo.java Log: un paquetage pour contenir les constantes (Enum) Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,37 +0,0 @@ -/* -* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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; - -/** - * Une enumeration pour definir l'�tat du connexion � un serveur vcs. - * - * @author chemit - */ -public enum ConnectionState { - /** lorsque la connexion a �t� initialis�e (valid�e) mais pas ouverte */ - INIT, - /** lorsque la connexion n'a pas encore initialis�e */ - UNDEFINED, - /** lorsque la connexion est ok, mais que l'on est pas connect� */ - OFF_LINE, - /** lorsque la connexion est �tablie avec succes */ - ON_LINE, - /** lorsque la connexion a tent�e de s'initialiser sans succes */ - ERROR -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,100 +0,0 @@ -/* ##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ -package org.codelutin.vcs; - -import static org.codelutin.i18n.I18n._; -import static org.codelutin.i18n.I18n.n_; - -/** - * a VCSAction represents an action that can be realized on a file in working - * copy or on remote repository. - * <p/> - * Each <code>VCSAction</code> has 4 properties : - * <ul> - * <li>libelle : i18n to be used for this action</li> - * <li>visible : flag to say if action should be visible in ui</li> - * <li>backup : flag to say if this action need backup</li> - * <li>write : flag to say if this action need write access to repository</li> - * </ul> - * - * @author chemit - */ -@org.codelutin.i18n.I18nable -public enum VCSAction { - /** to refresh the state of a file on repository */ - REFRESH(n_("lutinvcs.action.refresh"), true, false, false, false), - /** to add an unversionned file on repository */ - ADD(n_("lutinvcs.action.add"), true, false, true, true), - /** to delete locally and from repository */ - DELETE(n_("lutinvcs.action.delete"), true, true, true, true), - /** to get another version from repository */ - UPDATE(n_("lutinvcs.action.update"), true, true, false, false), - /** to get a clean copy from repository */ - OVERWRITE_AND_UPDATE(n_("lutinvcs.action.overwriteAndUpdate"), true, true, false, false), - /** commit a modification to repository */ - COMMIT(n_("lutinvcs.action.commit"), true, false, true, true), - /** to rollback to working base revision */ - REVERT(n_("lutinvcs.action.revert"), true, true, false, false), - /** to acquire a file from repository */ - CHECKOUT(n_("lutinvcs.action.checkout"), true, false, false, false), - /** to obtain the changelog of a file */ - CHANGELOG(n_("lutinvcs.action.changeLog"), false, false, false, false), - /** to obtain diif */ - DIFF(n_("lutinvcs.action.diff"), false, false, false, false); - - /** libelle of the action */ - private final String libelle; - /** flag to say if action should be visible in ui TODO Delete this */ - private final boolean visible; - /** flag to say if this action need backup TODO Delete this ? */ - private final boolean backup; - /** flag to say if this action need write access to repository */ - private final boolean write; - /** flag to say if this action need a commit message to be performed */ - private boolean commit; - - VCSAction(String libelle, boolean visible, boolean backup, boolean commit, boolean write) { - this.libelle = libelle; - this.visible = visible; - this.backup = backup; - this.commit = commit; - this.write = write; - } - - public String getLibelle() { - return _(libelle); - } - - public boolean isVisible() { - return visible; - } - - public boolean isBackup() { - return backup; - } - - public boolean isWrite() { - return write; - } - - public boolean isCommit() { - return commit; - } -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,26 +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; - -/** - * L'ensemble des typs de connexion VCS connues - * - * @author chemit - */ -public enum VCSConnexionMode { - ANONYMOUS, - PASSWORD, - SSH -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntryLocation.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntryLocation.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntryLocation.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,65 +0,0 @@ -/* ##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ -package org.codelutin.vcs; - -import static org.codelutin.i18n.I18n._; -import static org.codelutin.i18n.I18n.n_; - -/** - * a VCSEntryLocation represents where a {@link VCSEntry} was found, should be : - * <p/> - * <ul> - * <li>{@link #ALL} : if entry is both on local and on remote</li> - * <li>{@link #LOCAL} : if entry is only on local </li> - * <li>{@link #REMOTE} : if entryis only on remote</li> - * <p/> - * </ul> - * VCSAction represents an action that can be realized on a file in working - * copy or on remote repository. - * <p/> - * Each <code>VCSAction</code> has 4 properties : - * <ul> - * <li>libelle : i18n to be used for this action</li> - * <li>visible : flag to say if action should be visible in ui</li> - * <li>backup : flag to say if this action need backup</li> - * <li>write : flag to say if this action need write access to repository</li> - * </ul> - * - * @author chemit - */ -@org.codelutin.i18n.I18nable -public enum VCSEntryLocation { - ALL(n_("lutinvcs.location.all")), - LOCAL(n_("lutinvcs.location.local")), - REMOTE(n_("lutinvcs.location.remote")), - UNKNOW(n_("lutinvcs.location.unknown")); - - /** libelle of location */ - private final String libelle; - - - public String getLibelle() { - return _(libelle); - } - - VCSEntryLocation(String libelle) { - this.libelle = libelle; - } -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,180 +0,0 @@ -package org.codelutin.vcs; - -import static org.codelutin.i18n.I18n._; -import static org.codelutin.i18n.I18n.n_; -import static org.codelutin.vcs.VCSAction.ADD; -import static org.codelutin.vcs.VCSAction.CHANGELOG; -import static org.codelutin.vcs.VCSAction.COMMIT; -import static org.codelutin.vcs.VCSAction.DELETE; -import static org.codelutin.vcs.VCSAction.DIFF; -import static org.codelutin.vcs.VCSAction.OVERWRITE_AND_UPDATE; -import static org.codelutin.vcs.VCSAction.REVERT; -import static org.codelutin.vcs.VCSAction.UPDATE; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * This constants represents all states for a file. - * Should contains all static data concerning file state (libelle, actions, - * icon link, color,...). - * We associate for each state, all VCSActions authorized for this state. - */ -@org.codelutin.i18n.I18nable -public enum VCSState { - - /** - * when a local file matches the latest remote copy. - * <br/> - * The only action for this state is to delete the file, nothing else. - */ - UP_TO_DATE("uptodate", n_("lutinvcs.state.uptodate"), VCSEntryLocation.ALL, DELETE), - - /** - * when a local file matches a remote copy but not the latest one. - * <br/> - * This state owns 3 actions : - * <ul> - * <li>{@link VCSAction#UPDATE}</li> - * <li>{@link VCSAction#DIFF}</li> - * <li>{@link VCSAction#CHANGELOG}</li> - * </ul> - */ - OUT_OF_DATE("outofdate", n_("lutinvcs.state.outofdate"), VCSEntryLocation.REMOTE, UPDATE, DIFF, CHANGELOG), - - /** - * when a local file does not matches his remote latest copy, but is based - * on. - * This state owns 4 actions : - * <ul> - * <li>{@link VCSAction#COMMIT}</li> - * <li>{@link VCSAction#REVERT}</li> - * <li>{@link VCSAction#OVERWRITE_AND_UPDATE}</li> - * <li>{@link VCSAction#DIFF}</li> - * </ul> - */ - MODIFIED("modified", n_("lutinvcs.state.modified"), VCSEntryLocation.LOCAL, COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF), - - /** - * when a local file does not match the working version remote copy and - * there is also new yougest version on remote : this is the worse case - * (conflict). - * This state owns 4 actions : - * <ul> - * <li>{@link VCSAction#REVERT}</li> - * <li>{@link VCSAction#OVERWRITE_AND_UPDATE}</li> - * <li>{@link VCSAction#DIFF}</li> - * <li>{@link VCSAction#CHANGELOG}</li> - * </ul> - */ - OUT_OF_DATE_AND_MODIFIED("outofdateAndModified", n_("lutinvcs.state.outofdateAndModified"), VCSEntryLocation.ALL, OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG), - - /** - * when a local file does not exist on remote repository. - * * This state owns 1 action : - * <ul> - * <li>{@link VCSAction#ADD}</li> - * </ul> - */ - UNVERSIONNED("unversionned", n_("lutinvcs.state.unversionned"), VCSEntryLocation.LOCAL, ADD, REVERT), - - /** - * when a file exists on remote repository but not locally. - * * This state owns 1 action : - * <ul> - * <li>{@link VCSAction#UPDATE}</li> - * </ul> - */ - MISSING("missing", n_("lutinvcs.state.missing"), VCSEntryLocation.REMOTE, UPDATE), - - /** - * when a file is unversionned or missing : this special and durty state - * correspond for exemple when you want to add a file under a no checked - * directory... - * <br/> - * <b> This state needs special add and update operation to create unchecked - * directories).</b> - * This state owns 2 action : - * <ul> - * <li>{@link VCSAction#ADD}</li> - * <li>{@link VCSAction#UPDATE}</li> - * <p/> - * </ul> - */ - UNVERSIONNED_OR_MISSING("unversionnedOrMissing", n_("lutinvcs.state.unversionnedOrMissing"), VCSEntryLocation.LOCAL, ADD, UPDATE), - - REMOVED("removed", n_("lutinvcs.state.removed"), VCSEntryLocation.LOCAL, DELETE, REVERT), - - /** to deal with other cases (...) */ - UNKNOWN("unknown", n_("lutinvcs.state.unknown"), null); - - - /** libelle to be used */ - private final String libelle; - /** key of the state */ - private final String key; - - /** VCSAction associated with this state */ - private final List<VCSAction> actions; - - /** location of the state */ - private VCSEntryLocation location; - - VCSState(String key, String libelle, VCSEntryLocation location, VCSAction... actions) { - this.location = location; - this.libelle = libelle; - List<VCSAction> actions1 = new ArrayList<VCSAction>(Arrays.asList(actions)); - // refresh action is enabled for all states - actions1.add(VCSAction.REFRESH); - this.actions = Collections.unmodifiableList(actions1); - this.key = key; - - } - - public String libelle() { - return _(libelle); - } - - public List<VCSAction> getActions() { - return actions; - } - - public String getKey() { - return key; - } - - public VCSEntryLocation getLocation() { - return location; - } - - public boolean isLocal() { - return location != VCSEntryLocation.REMOTE; - } - - public boolean isRemote() { - return location != VCSEntryLocation.LOCAL; - } - - public boolean authorizeAction(VCSAction... actions) { - java.util.List<VCSAction> acts = java.util.Arrays.asList(actions); - for (VCSAction vcsAction : this.actions) { - if (acts.contains(vcsAction)) { - return true; - } - } - return false; - } - - /** - * @param key key of required state - * @return the <code>VCSState</code> with <code>key</code> as key value, - * or <code>null</code> if no state found. - */ - public static VCSState valueOfKey(String key) { - for (VCSState state : VCSState.values()) - if (state.key.equals(key)) return state; - return null; - } -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSStatus.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSStatus.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSStatus.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,32 +0,0 @@ -/* *##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ -package org.codelutin.vcs; - -public enum VCSStatus { - NORMAL, - ADDED, - MODIFIED, - DELETED, - UNVERSIONED, - MISSING, - IGNORED, - CONFLICTED, - NONE -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSType.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSType.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSType.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,31 +0,0 @@ -/* *##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ -package org.codelutin.vcs; - -/** - * This type-safe class representing a type of vcs (SVN,CVS,...) - * - * @author chemit - */ -public enum VCSType { - - CVS, SVN, MOCK - -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSTypeRepo.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSTypeRepo.java 2008-04-06 07:02:17 UTC (rev 374) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSTypeRepo.java 2008-04-06 07:03:02 UTC (rev 375) @@ -1,55 +0,0 @@ -/* *##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ -package org.codelutin.vcs; - -/** - * type of repository to used, if no typeRepo (for CVS, use {@link #NONE} - * - * @author chemit - */ -public enum VCSTypeRepo { - /** head repo : is writable */ - HEAD("trunk", false), - /** tag repo : readonly */ - TAG("tags", true), - /** branch repo : should be writable ? */ - BRANCH("branches", false), - /** no type of repo : readonly */ - NONE(null, true); - - /** the path of the type of repo */ - final String path; - - /** flag to say this type of repo is readonly or not. */ - final boolean readonly; - - VCSTypeRepo(String path, boolean readOnly) { - this.path = path; - this.readonly = readOnly; - } - - public String getPath() { - return path; - } - - public boolean isReadonly() { - return readonly; - } -} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/ConnectionState.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/ConnectionState.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,37 @@ +/* +* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 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; + +/** + * Une enumeration pour definir l'�tat du connexion � un serveur vcs. + * + * @author chemit + */ +public enum ConnectionState { + /** lorsque la connexion a �t� initialis�e (valid�e) mais pas ouverte */ + INIT, + /** lorsque la connexion n'a pas encore initialis�e */ + UNDEFINED, + /** lorsque la connexion est ok, mais que l'on est pas connect� */ + OFF_LINE, + /** lorsque la connexion est �tablie avec succes */ + ON_LINE, + /** lorsque la connexion a tent�e de s'initialiser sans succes */ + ERROR +} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSAction.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSAction.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSAction.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSAction.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,100 @@ +/* ##% +* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ +package org.codelutin.vcs.type; + +import static org.codelutin.i18n.I18n._; +import static org.codelutin.i18n.I18n.n_; + +/** + * a VCSAction represents an action that can be realized on a file in working + * copy or on remote repository. + * <p/> + * Each <code>VCSAction</code> has 4 properties : + * <ul> + * <li>libelle : i18n to be used for this action</li> + * <li>visible : flag to say if action should be visible in ui</li> + * <li>backup : flag to say if this action need backup</li> + * <li>write : flag to say if this action need write access to repository</li> + * </ul> + * + * @author chemit + */ +@org.codelutin.i18n.I18nable +public enum VCSAction { + /** to refresh the state of a file on repository */ + REFRESH(n_("lutinvcs.action.refresh"), true, false, false, false), + /** to add an unversionned file on repository */ + ADD(n_("lutinvcs.action.add"), true, false, true, true), + /** to delete locally and from repository */ + DELETE(n_("lutinvcs.action.delete"), true, true, true, true), + /** to get another version from repository */ + UPDATE(n_("lutinvcs.action.update"), true, true, false, false), + /** to get a clean copy from repository */ + OVERWRITE_AND_UPDATE(n_("lutinvcs.action.overwriteAndUpdate"), true, true, false, false), + /** commit a modification to repository */ + COMMIT(n_("lutinvcs.action.commit"), true, false, true, true), + /** to rollback to working base revision */ + REVERT(n_("lutinvcs.action.revert"), true, true, false, false), + /** to acquire a file from repository */ + CHECKOUT(n_("lutinvcs.action.checkout"), true, false, false, false), + /** to obtain the changelog of a file */ + CHANGELOG(n_("lutinvcs.action.changeLog"), false, false, false, false), + /** to obtain diif */ + DIFF(n_("lutinvcs.action.diff"), false, false, false, false); + + /** libelle of the action */ + private final String libelle; + /** flag to say if action should be visible in ui TODO Delete this */ + private final boolean visible; + /** flag to say if this action need backup TODO Delete this ? */ + private final boolean backup; + /** flag to say if this action need write access to repository */ + private final boolean write; + /** flag to say if this action need a commit message to be performed */ + private boolean commit; + + VCSAction(String libelle, boolean visible, boolean backup, boolean commit, boolean write) { + this.libelle = libelle; + this.visible = visible; + this.backup = backup; + this.commit = commit; + this.write = write; + } + + public String getLibelle() { + return _(libelle); + } + + public boolean isVisible() { + return visible; + } + + public boolean isBackup() { + return backup; + } + + public boolean isWrite() { + return write; + } + + public boolean isCommit() { + return commit; + } +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionMode.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSConnexionMode.java 2008-04-06 07:03:02 UTC (rev 375) @@ -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.type; + +/** + * L'ensemble des typs de connexion VCS connues + * + * @author chemit + */ +public enum VCSConnexionMode { + ANONYMOUS, + PASSWORD, + SSH +} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntryLocation.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSEntryLocation.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,65 @@ +/* ##% +* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ +package org.codelutin.vcs.type; + +import static org.codelutin.i18n.I18n._; +import static org.codelutin.i18n.I18n.n_; + +/** + * a VCSEntryLocation represents where a {@link org.codelutin.vcs.VCSEntry} was found, should be : + * <p/> + * <ul> + * <li>{@link #ALL} : if entry is both on local and on remote</li> + * <li>{@link #LOCAL} : if entry is only on local </li> + * <li>{@link #REMOTE} : if entryis only on remote</li> + * <p/> + * </ul> + * VCSAction represents an action that can be realized on a file in working + * copy or on remote repository. + * <p/> + * Each <code>VCSAction</code> has 4 properties : + * <ul> + * <li>libelle : i18n to be used for this action</li> + * <li>visible : flag to say if action should be visible in ui</li> + * <li>backup : flag to say if this action need backup</li> + * <li>write : flag to say if this action need write access to repository</li> + * </ul> + * + * @author chemit + */ +@org.codelutin.i18n.I18nable +public enum VCSEntryLocation { + ALL(n_("lutinvcs.location.all")), + LOCAL(n_("lutinvcs.location.local")), + REMOTE(n_("lutinvcs.location.remote")), + UNKNOW(n_("lutinvcs.location.unknown")); + + /** libelle of location */ + private final String libelle; + + + public String getLibelle() { + return _(libelle); + } + + VCSEntryLocation(String libelle) { + this.libelle = libelle; + } +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSState.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSState.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSState.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSState.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,180 @@ +package org.codelutin.vcs.type; + +import static org.codelutin.i18n.I18n._; +import static org.codelutin.i18n.I18n.n_; +import static org.codelutin.vcs.type.VCSAction.ADD; +import static org.codelutin.vcs.type.VCSAction.CHANGELOG; +import static org.codelutin.vcs.type.VCSAction.COMMIT; +import static org.codelutin.vcs.type.VCSAction.DELETE; +import static org.codelutin.vcs.type.VCSAction.DIFF; +import static org.codelutin.vcs.type.VCSAction.OVERWRITE_AND_UPDATE; +import static org.codelutin.vcs.type.VCSAction.REVERT; +import static org.codelutin.vcs.type.VCSAction.UPDATE; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * This constants represents all states for a file. + * Should contains all static data concerning file state (libelle, actions, + * icon link, color,...). + * We associate for each state, all VCSActions authorized for this state. + */ +@org.codelutin.i18n.I18nable +public enum VCSState { + + /** + * when a local file matches the latest remote copy. + * <br/> + * The only action for this state is to delete the file, nothing else. + */ + UP_TO_DATE("uptodate", n_("lutinvcs.state.uptodate"), VCSEntryLocation.ALL, DELETE), + + /** + * when a local file matches a remote copy but not the latest one. + * <br/> + * This state owns 3 actions : + * <ul> + * <li>{@link VCSAction#UPDATE}</li> + * <li>{@link VCSAction#DIFF}</li> + * <li>{@link VCSAction#CHANGELOG}</li> + * </ul> + */ + OUT_OF_DATE("outofdate", n_("lutinvcs.state.outofdate"), VCSEntryLocation.REMOTE, UPDATE, DIFF, CHANGELOG), + + /** + * when a local file does not matches his remote latest copy, but is based + * on. + * This state owns 4 actions : + * <ul> + * <li>{@link VCSAction#COMMIT}</li> + * <li>{@link VCSAction#REVERT}</li> + * <li>{@link VCSAction#OVERWRITE_AND_UPDATE}</li> + * <li>{@link VCSAction#DIFF}</li> + * </ul> + */ + MODIFIED("modified", n_("lutinvcs.state.modified"), VCSEntryLocation.LOCAL, COMMIT, OVERWRITE_AND_UPDATE, REVERT, DIFF), + + /** + * when a local file does not match the working version remote copy and + * there is also new yougest version on remote : this is the worse case + * (conflict). + * This state owns 4 actions : + * <ul> + * <li>{@link VCSAction#REVERT}</li> + * <li>{@link VCSAction#OVERWRITE_AND_UPDATE}</li> + * <li>{@link VCSAction#DIFF}</li> + * <li>{@link VCSAction#CHANGELOG}</li> + * </ul> + */ + OUT_OF_DATE_AND_MODIFIED("outofdateAndModified", n_("lutinvcs.state.outofdateAndModified"), VCSEntryLocation.ALL, OVERWRITE_AND_UPDATE, REVERT, DIFF, CHANGELOG), + + /** + * when a local file does not exist on remote repository. + * * This state owns 1 action : + * <ul> + * <li>{@link VCSAction#ADD}</li> + * </ul> + */ + UNVERSIONNED("unversionned", n_("lutinvcs.state.unversionned"), VCSEntryLocation.LOCAL, ADD, REVERT), + + /** + * when a file exists on remote repository but not locally. + * * This state owns 1 action : + * <ul> + * <li>{@link VCSAction#UPDATE}</li> + * </ul> + */ + MISSING("missing", n_("lutinvcs.state.missing"), VCSEntryLocation.REMOTE, UPDATE), + + /** + * when a file is unversionned or missing : this special and durty state + * correspond for exemple when you want to add a file under a no checked + * directory... + * <br/> + * <b> This state needs special add and update operation to create unchecked + * directories).</b> + * This state owns 2 action : + * <ul> + * <li>{@link VCSAction#ADD}</li> + * <li>{@link VCSAction#UPDATE}</li> + * <p/> + * </ul> + */ + UNVERSIONNED_OR_MISSING("unversionnedOrMissing", n_("lutinvcs.state.unversionnedOrMissing"), VCSEntryLocation.LOCAL, ADD, UPDATE), + + REMOVED("removed", n_("lutinvcs.state.removed"), VCSEntryLocation.LOCAL, DELETE, REVERT), + + /** to deal with other cases (...) */ + UNKNOWN("unknown", n_("lutinvcs.state.unknown"), null); + + + /** libelle to be used */ + private final String libelle; + /** key of the state */ + private final String key; + + /** VCSAction associated with this state */ + private final List<VCSAction> actions; + + /** location of the state */ + private VCSEntryLocation location; + + VCSState(String key, String libelle, VCSEntryLocation location, VCSAction... actions) { + this.location = location; + this.libelle = libelle; + List<VCSAction> actions1 = new ArrayList<VCSAction>(Arrays.asList(actions)); + // refresh action is enabled for all states + actions1.add(VCSAction.REFRESH); + this.actions = Collections.unmodifiableList(actions1); + this.key = key; + + } + + public String libelle() { + return _(libelle); + } + + public List<VCSAction> getActions() { + return actions; + } + + public String getKey() { + return key; + } + + public VCSEntryLocation getLocation() { + return location; + } + + public boolean isLocal() { + return location != VCSEntryLocation.REMOTE; + } + + public boolean isRemote() { + return location != VCSEntryLocation.LOCAL; + } + + public boolean authorizeAction(VCSAction... actions) { + java.util.List<VCSAction> acts = java.util.Arrays.asList(actions); + for (VCSAction vcsAction : this.actions) { + if (acts.contains(vcsAction)) { + return true; + } + } + return false; + } + + /** + * @param key key of required state + * @return the <code>VCSState</code> with <code>key</code> as key value, + * or <code>null</code> if no state found. + */ + public static VCSState valueOfKey(String key) { + for (VCSState state : VCSState.values()) + if (state.key.equals(key)) return state; + return null; + } +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSStatus.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSStatus.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSStatus.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSStatus.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,32 @@ +/* *##% +* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ +package org.codelutin.vcs.type; + +public enum VCSStatus { + NORMAL, + ADDED, + MODIFIED, + DELETED, + UNVERSIONED, + MISSING, + IGNORED, + CONFLICTED, + NONE +} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSType.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSType.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSType.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSType.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,31 @@ +/* *##% +* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ +package org.codelutin.vcs.type; + +/** + * This type-safe class representing a type of vcs (SVN,CVS,...) + * + * @author chemit + */ +public enum VCSType { + + CVS, SVN, MOCK + +} Copied: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSTypeRepo.java (from rev 371, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSTypeRepo.java) =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSTypeRepo.java (rev 0) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/type/VCSTypeRepo.java 2008-04-06 07:03:02 UTC (rev 375) @@ -0,0 +1,55 @@ +/* *##% +* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ +package org.codelutin.vcs.type; + +/** + * type of repository to used, if no typeRepo (for CVS, use {@link #NONE} + * + * @author chemit + */ +public enum VCSTypeRepo { + /** head repo : is writable */ + HEAD("trunk", false), + /** tag repo : readonly */ + TAG("tags", true), + /** branch repo : should be writable ? */ + BRANCH("branches", false), + /** no type of repo : readonly */ + NONE(null, true); + + /** the path of the type of repo */ + final String path; + + /** flag to say this type of repo is readonly or not. */ + final boolean readonly; + + VCSTypeRepo(String path, boolean readOnly) { + this.path = path; + this.readonly = readOnly; + } + + public String getPath() { + return path; + } + + public boolean isReadonly() { + return readonly; + } +}