[Buix-commits] r433 - in trunk/lutinvcs: lutinvcs-api/src/main/java/org/codelutin/vcs lutinvcs-core/src/main/java/org/codelutin/vcs
Author: tchemit Date: 2008-04-06 19:17:09 +0000 (Sun, 06 Apr 2008) New Revision: 433 Added: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSException.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandler.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRuntimeException.java Removed: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSException.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRevision.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRuntimeException.java Log: remove module api, now just the core-module :) Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,302 +0,0 @@ -/* *##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ -package org.codelutin.vcs; - -import org.codelutin.vcs.type.VCSState; - -import java.io.File; -import java.io.FileFilter; -import java.io.FilenameFilter; -import java.io.IOException; -import java.util.Collection; -import java.util.List; - -/** - * Contract of operations to realized by a handler or a connexion - * - * @author chemit - */ - -public interface VCSCommon { - - /** - * init working copy, says if it is the first we use it it, we will checkout - * the databaseDirectory directory - * - * @throws org.codelutin.vcs.VCSException if any exception while init - */ - void initWorkingCopy() throws VCSException; - - /** delete the local working copy with all his files */ - void deleteWorkingCopy(); - - /** - * @return a <code>FilenameFilter<code> to detect all files and directories in a vcs working copy that - * must be handled by vcs - */ - FilenameFilter getVersionnableFilenameFilter(); - - /** - * @return a <code>FileFilter<code> to detect all files and directories in a vcs working copy that - * must be handled by vcs - */ - FileFilter getVersionnableFileFilter(); - - /** - * @return name of directory used by vcs to store in working copy, a data's - * directory configuration (e.g CVS for cvs and .svn for svn) - */ - String getConfLocalDirname(); - - /** - * @return name of the file used by vcs to store in working copy - * configuration directory entries of data's directory (e.g Entries - * for cvs and entries for svn) - */ - String getConfLocalEntriesFilename(); - - VCSState getState(File file, Collection tmp) throws VCSException; - - VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException; - - /** - * @param file file to test - * @return <code>true</code> if <code>file</code> is on remote - * repository, <code>false</code> otherwise. - */ - boolean isOnRemote(File file); - - /** - * @param file file to test - * @return <code>true</code> if file is uptodate,<code>false</code> - * otherwise. - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - boolean isUpToDate(File file) throws VCSException; - - /** - * @param file file to test - * @return <code>true</code> if file is handled by VCS,<code>false</code> - * otherwise. - */ - boolean isVersionnableFile(File file); - - /** - * add on remote repository somes directories - * - * @param commitMessage commit message - * @param dirNames names of the directories to create on remote repository (could - * used multi-level directories) - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void makeRemoteDir(String commitMessage, String... dirNames) - throws VCSException; - - /** - * delete on remote repository somes directories - * - * @param commitMessage commit message - * @param dirNames names of the directories to delete on remote repository (could - * used multi-level directories) - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void deleteRemoteDir(String commitMessage, String... dirNames) - throws VCSException; - - /** - * add a list of files into repository - * - * @param files files to add - * @param msg message for VCS commit, if <code>null</code> then no commit - * is performed - * @return revision of the operation - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - long add(List<File> files, String msg) throws VCSException; - - // void add(File file, String msg) throws VCSException; - - /** - * delete a list of files from repository - * - * @param files files to delete - * @param msg message for VCS commit, if <code>null</code> then no commit - * is performed - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void delete(List<File> files, String msg) throws VCSException; - - /** - * revert a list of files from repository - * - * @param files files to revert - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void revert(List<File> files) throws VCSException; - - /** - * commit a list of files into repository - * - * @param files files to commit - * @param msg message for VCS commit - * @return revision of the operation - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - long commit(List<File> files, String msg) throws VCSException; - - /** - * update a file to repository to a certain revision - * - * @param file file to update - * @param revision object representing a revision for the current VCS - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void update(File file, Object revision) throws VCSException; - - /** - * update a file to repository - * - * @param file file to update - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void update(File file) throws VCSException; - - /** - * checkout a module from repository to a local file - * - * @param destDir local file where to checkout - * @param module module's name to checkout - * @param recurse flag to say to recurse checkout or not. - * @throws org.codelutin.vcs.VCSException if any exception while operation - */ - void checkout(File destDir, String module, boolean recurse) throws VCSException; - - void checkoutFile(File destDir, String module) throws VCSException; - - long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException; - - /** - * TODO This is not the good place : VCS != Storage - * - * @param directory directory to treate - * @return TODO - * @throws org.codelutin.vcs.VCSException TODO - */ - List<String> getRemoteStorageNames(File directory) throws VCSException; - - /** - * TODO This is not the good place : VCS != Storage - * - * @param directory directory to treate - * @return TODO - */ - List<String> getLocalStorageNames(File directory); - - /** - * @param f local file to treate - * @return current local revision of a file - * @throws org.codelutin.vcs.VCSException TODO - */ - Object getRevision(File f) throws VCSException; - - /** - * Obtain the list of log entries for the file - * - * @param startRevision TODO - * @param endRevision TODO - * @param file file to treate - * @return list of log entries for this file between two revisions - * @throws org.codelutin.vcs.VCSException if any exception while grabbing infos - */ - List getLog(Object startRevision, Object endRevision, File file) - throws VCSException; - - /** - * obtain the content of a file for a specific revision - * - * @param file file to obtain - * @param revision revision treated - * @return the content of the file on repository for the specific revision - * passed as arguement. - * @throws org.codelutin.vcs.VCSException if any exception while operation - * @throws java.io.IOException TODO - */ - String getFileContent(File file, Object revision) throws VCSException, IOException; - - /** - * Build the changelog for <code>file</code> from current revision of this - * local file against head repository head version. For each revision - * between current revision and head revision of this file, we give the - * following informations : - * <ul> - * <li>revision number</li> - * <li>author</li> - * <li>date</li> - * <li>commit message</li> - * </ul> - * - * @param file file to treate - * @return a string representation of change log for the local file to the - * head ? - * @throws org.codelutin.vcs.VCSException if any exception while building changelog - */ - String getChangeLog(File file) throws VCSException; - - /** - * Generate in the ouputstream the diff between the current revision of the - * local file against headest revision on repository. <br> - * If file is uptodate, then does nothing. - * - * @param file the file to treate - * @return the diff - * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as : - * <ul> - * <li>unversionned file</li> - * <li>unexistant file locally</li> - * <li>locally modified file ?</li> - * <li>...</li> - * </ul> - * @throws java.io.IOException if io problem with streams - */ - String getDiff(File file) throws VCSException, IOException; - - - /** - * Generate in the ouputstream the diff between the current revision of the - * local file against another revision (<code>againstRevision</code>) on - * repository. <br> - * If file is uptodate, then does nothing. - * - * @param file the file to treate - * @param againstRevision the against revision to use - * @return the diff - * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as : - * <ul> - * <li>unversionned file</li> - * <li>unexistant file locally</li> - * <li>locally modified file ?</li> - * <li>...</li> - * </ul> - * @throws java.io.IOException if problem with streams - */ - String getDiff(File file, Object againstRevision) throws VCSException, IOException; - - boolean hasProtocoleChanged() throws VCSException; -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,117 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.type.VCSConnexionMode; -import org.codelutin.vcs.event.VCSConnexionEventListener; - -import java.io.File; -import java.net.URI; - -/** - * Contract to be realized for a connexion to a vcs. - * <p/> - * 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. - * - * @author chemit - */ -public interface VCSConnexion<H extends VCSHandler> extends VCSCommon { - - /** @return the handler */ - H getHandler(); - - /** - * Initialize the connexion. - * <p/> - * If connexion can not be established, then the method {@link #hasFailed()} will always - * return <code>true</code>. - * - * @param config config to be used to initialize the connexion. - */ - void init(VCSConnexionConfig config); - - /** - * @return the working copy used, can be null if no working copy exists. - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - File getWorkingCopy() throws IllegalStateException; - - /** - * @return the URI used to connect to vcs - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - URI getRemoteURI() throws IllegalStateException; - - /** - * @return the mode of this connexion - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - VCSConnexionMode getMode() throws IllegalStateException; - - /** - * @return the config of the connexion - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - VCSConnexionConfig getConfig() throws IllegalStateException; - - /** - * test if connection is ok - * - * @throws VCSException if any problem - */ - void testConnection() throws VCSException; - - /** - * Close connexion. - * - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - void open() throws IllegalStateException; - - /** - * Close connexion. - * - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - void close() throws IllegalStateException; - - /** - * @return <code>true</code> if connexion is opened, <code>false</code> otherwise - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - boolean isOpen() throws IllegalStateException; - - /** - * @return <code>true</code> if connexion is closed, <code>false</code> otherwise - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - boolean isClosed() throws IllegalStateException; - - /** - * @return <code>true</code> if connexion has failed, <code>false</code> otherwise - * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. - */ - boolean hasFailed() throws IllegalStateException; - - /** @param l the listener to add */ - void addVCSConnexionEventListener(VCSConnexionEventListener l); - - /** @param l the listener to remove */ - void removeVCSConnexionEventListener(VCSConnexionEventListener l); - -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,90 +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; - -import org.codelutin.vcs.type.VCSTypeRepo; - -import java.io.File; - -/** - * Contract to be realized by a VCSConnexion configuration. - * <p/> - * This class has no logic, ans is a <code>POJO</code>. - * - * @author chemit - */ -public interface VCSConnexionConfig { - - /** @return the type of vcs used */ - String getType(); - - /** @return <code>true</code> if ssh connexion is used */ - boolean isUseSshConnexion(); - - /** @return the url of hostname */ - String getHostName(); - - /** @return location of the private ssh2 key file */ - File getKeyFile(); - - /** @return the user connexion login */ - String getUserName(); - - /** @return <code>true</code> if user ssh2 pair keys use a passphrase */ - boolean isNoPassPhrase(); - - String getPassphrase(); - - /** @return the full location path of the remote container of module */ - String getRemotePath(); - - /** @return the name of remote module */ - String getRemoteDatabase(); - - /** @return the full url path to the remote repository (with module name include) */ - String getRemoteDatabasePath(); - - File getLocalDatabasePath(); - - /** @return the type of reposotory used (head,tags,branches,...) */ - VCSTypeRepo getTypeRepo(); - - - void setHostName(String hostName); - - void setKeyFile(File keyFile); - - void setLocalDatabasePath(File localDatabasePath); - - void setNoPassPhrase(boolean noPassPhrase); - - void setPassPhrase(String passPhrase); - - void setRemoteDatabase(String remoteDatabase); - - void setRemotePath(String remotePath); - - void setType(String type); - - void setTypeRepo(VCSTypeRepo typeRepo); - - void setUserName(String userName); - - void setUseSshConnexion(boolean newValue); -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,141 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.type.VCSAction; -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.type.VCSState; - -import javax.swing.ListSelectionModel; -import java.util.List; - -/** - * Contract of list of VCSEntry - * - * @author chemit - */ -public interface VCSEntries { - - /** - * Discover and Populate with all local and remote entries. - * - * @param timestamp gloabal timestamp to apply - * @param connexion connexion used to populate - * @throws VCSException if any pb with vcs io - */ - void populate(VCSConnexion connexion, long timestamp) throws VCSException; - - /** - * Populate with no discovering for a given list of local relative paths for a given location type. - * <p/> - * Note : <b>We always used the filesystem path separator to encode paths.</b> - * - * @param relativeLocalPaths list of local relative path to populate - * @param location location to be used - * @param timestamp gloabal timestamp to apply - * @param connexion connexion used tro refresh - * @throws VCSException if any pb with vcs io - */ - void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location, long timestamp) throws VCSException; - - /** - * Populate from pre-computed entries. No discovering is done, nor vcs io operations. - * - * @param location given location to use - * @param states pre-computed states to populate - */ - void populate(VCSEntryLocation location, VCSEntry[] states); - - /** - * refresh state of the entry. - * - * @param entries entries to refresh - * @param timestamp global timestamp to apply - * @throws IllegalStateException if entry was never populated - */ - void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException; - - /** - * obtain the array of all {@link VCSAction} found in the given entries - * - * @param entries entries to scan - * @return array of {@link VCSAction} found in entires - */ - VCSAction[] getActions(List<VCSEntry> entries); - - /** - * obtain the array of all {@link VCSState} found in the given entries - * - * @param entries entries to scan - * @return array of {@link VCSState found in entires - */ - VCSState[] getStates(List<VCSEntry> entries); - - /** clear the internal list of entries. */ - void clear(); - - /** - * obtain the list of all entries. - * - * @return list of all entries - * @throws IllegalStateException if entry was never populated - */ - List<VCSEntry> getEntries() throws IllegalStateException; - - /** - * obtain the list of all entries for a given connexion - * - * @param connexion filter connexion - * @param entries entries to filter - * @return list of all entries for a given connexion - */ - List<VCSEntry> filter(VCSConnexion connexion, List<VCSEntry> entries); - - /** - * obtain the list of all entries for a given location - * - * @param location filter location - * @param entries entries to filter - * @return list of all entries for a given connexion - */ - List<VCSEntry> filter(VCSEntryLocation location, List<VCSEntry> entries); - - /** - * obtain the list of all entries for a given state - * - * @param state filter state - * @param entries entries to filter - * @return list of all entries for a given connexion - */ - List<VCSEntry> filter(VCSState state, List<VCSEntry> entries); - - /** - * obtain the list of all entries for a given selection model - * - * @param selectionModel filter from selection model - * @param entries entries to filter - * @return list of all entries for a given connexion - */ - List<VCSEntry> filter(ListSelectionModel selectionModel, List<VCSEntry> entries); - - /** - * obtain the list of all entries for a given action - * - * @param action filter state - * @param entries entries to filter - * @return list of all entries for a given connexion - */ - List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries); -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,128 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.type.VCSEntryLocation; -import org.codelutin.vcs.type.VCSState; - -import java.io.BufferedReader; -import java.io.File; -import java.io.Serializable; - -/** - * Contract of an entry in VCS (a file or a dir) - * - * @author chemit - */ -public interface VCSEntry extends Serializable { - - /** - * Populate the state of the entry, this method calls {@link #refresh(long)} method. - * - * @param timestamp gloabal timestamp to apply - * @throws VCSException if anypb with vcs io - */ - void populate(long timestamp) throws VCSException; - - /** - * refresh state of the entry. - * - * @param timestamp global timestamp to apply - * @throws IllegalStateException if entry was never populated - * @throws VCSException if anypb with vcs io - */ - void refresh(long timestamp) throws IllegalStateException, VCSException; - - /** - * Obtain the relative path from root repository to the entry. - * <p/> - * Note: <b>We use the filesystem path separator, could not be the same on remote</b> - * - * @return the relativePath from local root repository to the entry - */ - String getRelativeLocalPath(); - - /** - * Obtain the relative path from root repository to the entry. - * <p/> - * Note: <b>We use the '/' as path separator, could not be the same on local</b> - * - * @return the relativePath from remote root repository to the entry - */ - String getRelativeRemotePath(); - - /** - * Obtain the projected entry on local working copy. - * <p/> - * Note : <b> the file could not exists. - * - * @return the local file represented by this entry - */ - File getFile(); - - /** @return connexion used */ - VCSConnexion getConnexion(); - - /** - * @return the location of entry - * @throws IllegalStateException if entry was never populated - * @see VCSEntryLocation - */ - VCSEntryLocation getLocation() throws IllegalStateException; - - /** - * @return the last state found for the entry - * @throws IllegalStateException if entry was never populated - */ - VCSState getState() throws IllegalStateException; - - /** - * @return the timestamp of the last state synchronization for the entry - * @throws IllegalStateException if entry was never populated - */ - long getTimestamp() throws IllegalStateException; - - /** - * @return the rev of entry - * @throws IllegalStateException if entry was never populated - */ - String getRev() throws IllegalStateException; - - /** - * @return the changelog of entry from local aginst remote - * @throws IllegalStateException if entry was never populated - */ - BufferedReader getChangeLog() throws IllegalStateException; - - /** - * @return the diff of entry from local aginst remote - * @throws IllegalStateException if entry was never populated - */ - BufferedReader getDiff() throws IllegalStateException; - - /** - * @return the local entry content - * @throws IllegalStateException if entry was never populated, or entry is a directory - */ - BufferedReader getLocalContent() throws IllegalStateException; - - /** - * @return the remote entry content - * @throws IllegalStateException if entry was never populated, or entry is a directory - */ - BufferedReader getRemoteContent() throws IllegalStateException; - - void setState(VCSState state); -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSException.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSException.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSException.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,51 +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; - - -/** - * A generic vcs exception. - * - * @author chemit - */ - -public class VCSException extends Exception { - - private static final long serialVersionUID = -2665066202505740998L; - - public VCSException() { - super(); - } - - public VCSException(String message) { - super(message); - } - - public VCSException(String message, Throwable cause) { - super(message, cause); - } - - public VCSException(Throwable cause) { - super(cause); - } - -} - - Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,40 +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; - -/** - * Contract of an VCS handler - * - * @author chemit - */ - -public interface VCSHandler<C extends VCSConnexion> extends VCSCommon { - - /** - * Attach a connexion to handler. - * <p/> - * Note : <b>This method MUST be called before all.</b> - * - * @param connexion the connexion to attach - */ - void setConnexion(C connexion); - - -} \ No newline at end of file Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,50 +0,0 @@ -/** - * # #% Copyright (C) 2008 Code Lutin, Tony Chemit - * This program is free software; you - * can redistribute it and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. This program is - * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU General Public License for more details. You - * should have received a copy of the GNU General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - * - Suite 330, Boston, MA 02111-1307, USA. - * # #% - */ -package org.codelutin.vcs; - -import org.codelutin.vcs.type.VCSConnexionMode; - -/** - * The contract to be realized to provide vcs communication. - * <p/> - * Acts as a handler and connexion factory and manage a single handler instance - * - * @author chemit - * @see VCSHandler - * @see VCSConnexion - */ -public interface VCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> { - - /** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */ - String getName(); - - /** @return the class of implementation of handler to use for this provider */ - Class<H> getHandlerImpl(); - - /** @return the imclass of implementation of connexion to use for this provider */ - Class<C> getConnexionImpl(); - - /** - * 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(VCSConnexionMode mode, VCSConnexionConfig config); - -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRevision.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRevision.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRevision.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,21 +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; - -/** @author chemit */ -public interface VCSRevision { - - String getValue(); -} Deleted: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRuntimeException.java =================================================================== --- trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRuntimeException.java 2008-04-06 19:16:23 UTC (rev 432) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRuntimeException.java 2008-04-06 19:17:09 UTC (rev 433) @@ -1,51 +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; - - -/** - * A generic runtime vcs exception. - * - * @author chemit - */ - -public class VCSRuntimeException extends RuntimeException { - - private static final long serialVersionUID = -2665066202505740998L; - - public VCSRuntimeException() { - super(); - } - - public VCSRuntimeException(String message) { - super(message); - } - - public VCSRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public VCSRuntimeException(Throwable cause) { - super(cause); - } - -} - - Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSCommon.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSCommon.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,302 @@ +/* *##% +* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, +* Benjamin Poussin, Tony Chemit +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ +package org.codelutin.vcs; + +import org.codelutin.vcs.type.VCSState; + +import java.io.File; +import java.io.FileFilter; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +/** + * Contract of operations to realized by a handler or a connexion + * + * @author chemit + */ + +public interface VCSCommon { + + /** + * init working copy, says if it is the first we use it it, we will checkout + * the databaseDirectory directory + * + * @throws org.codelutin.vcs.VCSException if any exception while init + */ + void initWorkingCopy() throws VCSException; + + /** delete the local working copy with all his files */ + void deleteWorkingCopy(); + + /** + * @return a <code>FilenameFilter<code> to detect all files and directories in a vcs working copy that + * must be handled by vcs + */ + FilenameFilter getVersionnableFilenameFilter(); + + /** + * @return a <code>FileFilter<code> to detect all files and directories in a vcs working copy that + * must be handled by vcs + */ + FileFilter getVersionnableFileFilter(); + + /** + * @return name of directory used by vcs to store in working copy, a data's + * directory configuration (e.g CVS for cvs and .svn for svn) + */ + String getConfLocalDirname(); + + /** + * @return name of the file used by vcs to store in working copy + * configuration directory entries of data's directory (e.g Entries + * for cvs and entries for svn) + */ + String getConfLocalEntriesFilename(); + + VCSState getState(File file, Collection tmp) throws VCSException; + + VCSState getState(File file, Collection tmp, boolean noremote) throws VCSException; + + /** + * @param file file to test + * @return <code>true</code> if <code>file</code> is on remote + * repository, <code>false</code> otherwise. + */ + boolean isOnRemote(File file); + + /** + * @param file file to test + * @return <code>true</code> if file is uptodate,<code>false</code> + * otherwise. + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + boolean isUpToDate(File file) throws VCSException; + + /** + * @param file file to test + * @return <code>true</code> if file is handled by VCS,<code>false</code> + * otherwise. + */ + boolean isVersionnableFile(File file); + + /** + * add on remote repository somes directories + * + * @param commitMessage commit message + * @param dirNames names of the directories to create on remote repository (could + * used multi-level directories) + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void makeRemoteDir(String commitMessage, String... dirNames) + throws VCSException; + + /** + * delete on remote repository somes directories + * + * @param commitMessage commit message + * @param dirNames names of the directories to delete on remote repository (could + * used multi-level directories) + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void deleteRemoteDir(String commitMessage, String... dirNames) + throws VCSException; + + /** + * add a list of files into repository + * + * @param files files to add + * @param msg message for VCS commit, if <code>null</code> then no commit + * is performed + * @return revision of the operation + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + long add(List<File> files, String msg) throws VCSException; + + // void add(File file, String msg) throws VCSException; + + /** + * delete a list of files from repository + * + * @param files files to delete + * @param msg message for VCS commit, if <code>null</code> then no commit + * is performed + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void delete(List<File> files, String msg) throws VCSException; + + /** + * revert a list of files from repository + * + * @param files files to revert + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void revert(List<File> files) throws VCSException; + + /** + * commit a list of files into repository + * + * @param files files to commit + * @param msg message for VCS commit + * @return revision of the operation + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + long commit(List<File> files, String msg) throws VCSException; + + /** + * update a file to repository to a certain revision + * + * @param file file to update + * @param revision object representing a revision for the current VCS + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void update(File file, Object revision) throws VCSException; + + /** + * update a file to repository + * + * @param file file to update + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void update(File file) throws VCSException; + + /** + * checkout a module from repository to a local file + * + * @param destDir local file where to checkout + * @param module module's name to checkout + * @param recurse flag to say to recurse checkout or not. + * @throws org.codelutin.vcs.VCSException if any exception while operation + */ + void checkout(File destDir, String module, boolean recurse) throws VCSException; + + void checkoutFile(File destDir, String module) throws VCSException; + + long checkoutOnlyTheDirectory(File root, Object revision) throws VCSException; + + /** + * TODO This is not the good place : VCS != Storage + * + * @param directory directory to treate + * @return TODO + * @throws org.codelutin.vcs.VCSException TODO + */ + List<String> getRemoteStorageNames(File directory) throws VCSException; + + /** + * TODO This is not the good place : VCS != Storage + * + * @param directory directory to treate + * @return TODO + */ + List<String> getLocalStorageNames(File directory); + + /** + * @param f local file to treate + * @return current local revision of a file + * @throws org.codelutin.vcs.VCSException TODO + */ + Object getRevision(File f) throws VCSException; + + /** + * Obtain the list of log entries for the file + * + * @param startRevision TODO + * @param endRevision TODO + * @param file file to treate + * @return list of log entries for this file between two revisions + * @throws org.codelutin.vcs.VCSException if any exception while grabbing infos + */ + List getLog(Object startRevision, Object endRevision, File file) + throws VCSException; + + /** + * obtain the content of a file for a specific revision + * + * @param file file to obtain + * @param revision revision treated + * @return the content of the file on repository for the specific revision + * passed as arguement. + * @throws org.codelutin.vcs.VCSException if any exception while operation + * @throws java.io.IOException TODO + */ + String getFileContent(File file, Object revision) throws VCSException, IOException; + + /** + * Build the changelog for <code>file</code> from current revision of this + * local file against head repository head version. For each revision + * between current revision and head revision of this file, we give the + * following informations : + * <ul> + * <li>revision number</li> + * <li>author</li> + * <li>date</li> + * <li>commit message</li> + * </ul> + * + * @param file file to treate + * @return a string representation of change log for the local file to the + * head ? + * @throws org.codelutin.vcs.VCSException if any exception while building changelog + */ + String getChangeLog(File file) throws VCSException; + + /** + * Generate in the ouputstream the diff between the current revision of the + * local file against headest revision on repository. <br> + * If file is uptodate, then does nothing. + * + * @param file the file to treate + * @return the diff + * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as : + * <ul> + * <li>unversionned file</li> + * <li>unexistant file locally</li> + * <li>locally modified file ?</li> + * <li>...</li> + * </ul> + * @throws java.io.IOException if io problem with streams + */ + String getDiff(File file) throws VCSException, IOException; + + + /** + * Generate in the ouputstream the diff between the current revision of the + * local file against another revision (<code>againstRevision</code>) on + * repository. <br> + * If file is uptodate, then does nothing. + * + * @param file the file to treate + * @param againstRevision the against revision to use + * @return the diff + * @throws org.codelutin.vcs.VCSException inf any exception while building diff, such as : + * <ul> + * <li>unversionned file</li> + * <li>unexistant file locally</li> + * <li>locally modified file ?</li> + * <li>...</li> + * </ul> + * @throws java.io.IOException if problem with streams + */ + String getDiff(File file, Object againstRevision) throws VCSException, IOException; + + boolean hasProtocoleChanged() throws VCSException; +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,117 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.type.VCSConnexionMode; +import org.codelutin.vcs.event.VCSConnexionEventListener; + +import java.io.File; +import java.net.URI; + +/** + * Contract to be realized for a connexion to a vcs. + * <p/> + * 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. + * + * @author chemit + */ +public interface VCSConnexion<H extends VCSHandler> extends VCSCommon { + + /** @return the handler */ + H getHandler(); + + /** + * Initialize the connexion. + * <p/> + * If connexion can not be established, then the method {@link #hasFailed()} will always + * return <code>true</code>. + * + * @param config config to be used to initialize the connexion. + */ + void init(VCSConnexionConfig config); + + /** + * @return the working copy used, can be null if no working copy exists. + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + File getWorkingCopy() throws IllegalStateException; + + /** + * @return the URI used to connect to vcs + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + URI getRemoteURI() throws IllegalStateException; + + /** + * @return the mode of this connexion + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + VCSConnexionMode getMode() throws IllegalStateException; + + /** + * @return the config of the connexion + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + VCSConnexionConfig getConfig() throws IllegalStateException; + + /** + * test if connection is ok + * + * @throws VCSException if any problem + */ + void testConnection() throws VCSException; + + /** + * Close connexion. + * + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + void open() throws IllegalStateException; + + /** + * Close connexion. + * + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + void close() throws IllegalStateException; + + /** + * @return <code>true</code> if connexion is opened, <code>false</code> otherwise + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + boolean isOpen() throws IllegalStateException; + + /** + * @return <code>true</code> if connexion is closed, <code>false</code> otherwise + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + boolean isClosed() throws IllegalStateException; + + /** + * @return <code>true</code> if connexion has failed, <code>false</code> otherwise + * @throws IllegalStateException if {@link #init(VCSConnexionConfig)} was not invoked before. + */ + boolean hasFailed() throws IllegalStateException; + + /** @param l the listener to add */ + void addVCSConnexionEventListener(VCSConnexionEventListener l); + + /** @param l the listener to remove */ + void removeVCSConnexionEventListener(VCSConnexionEventListener l); + +} Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSConnexionConfig.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,90 @@ +/* +* ##% 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; + +import org.codelutin.vcs.type.VCSTypeRepo; + +import java.io.File; + +/** + * Contract to be realized by a VCSConnexion configuration. + * <p/> + * This class has no logic, ans is a <code>POJO</code>. + * + * @author chemit + */ +public interface VCSConnexionConfig { + + /** @return the type of vcs used */ + String getType(); + + /** @return <code>true</code> if ssh connexion is used */ + boolean isUseSshConnexion(); + + /** @return the url of hostname */ + String getHostName(); + + /** @return location of the private ssh2 key file */ + File getKeyFile(); + + /** @return the user connexion login */ + String getUserName(); + + /** @return <code>true</code> if user ssh2 pair keys use a passphrase */ + boolean isNoPassPhrase(); + + String getPassphrase(); + + /** @return the full location path of the remote container of module */ + String getRemotePath(); + + /** @return the name of remote module */ + String getRemoteDatabase(); + + /** @return the full url path to the remote repository (with module name include) */ + String getRemoteDatabasePath(); + + File getLocalDatabasePath(); + + /** @return the type of reposotory used (head,tags,branches,...) */ + VCSTypeRepo getTypeRepo(); + + + void setHostName(String hostName); + + void setKeyFile(File keyFile); + + void setLocalDatabasePath(File localDatabasePath); + + void setNoPassPhrase(boolean noPassPhrase); + + void setPassPhrase(String passPhrase); + + void setRemoteDatabase(String remoteDatabase); + + void setRemotePath(String remotePath); + + void setType(String type); + + void setTypeRepo(VCSTypeRepo typeRepo); + + void setUserName(String userName); + + void setUseSshConnexion(boolean newValue); +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntries.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntries.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,141 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.type.VCSAction; +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.type.VCSState; + +import javax.swing.ListSelectionModel; +import java.util.List; + +/** + * Contract of list of VCSEntry + * + * @author chemit + */ +public interface VCSEntries { + + /** + * Discover and Populate with all local and remote entries. + * + * @param timestamp gloabal timestamp to apply + * @param connexion connexion used to populate + * @throws VCSException if any pb with vcs io + */ + void populate(VCSConnexion connexion, long timestamp) throws VCSException; + + /** + * Populate with no discovering for a given list of local relative paths for a given location type. + * <p/> + * Note : <b>We always used the filesystem path separator to encode paths.</b> + * + * @param relativeLocalPaths list of local relative path to populate + * @param location location to be used + * @param timestamp gloabal timestamp to apply + * @param connexion connexion used tro refresh + * @throws VCSException if any pb with vcs io + */ + void populate(VCSConnexion connexion, List<String> relativeLocalPaths, VCSEntryLocation location, long timestamp) throws VCSException; + + /** + * Populate from pre-computed entries. No discovering is done, nor vcs io operations. + * + * @param location given location to use + * @param states pre-computed states to populate + */ + void populate(VCSEntryLocation location, VCSEntry[] states); + + /** + * refresh state of the entry. + * + * @param entries entries to refresh + * @param timestamp global timestamp to apply + * @throws IllegalStateException if entry was never populated + */ + void refresh(List<VCSEntry> entries, long timestamp) throws IllegalStateException; + + /** + * obtain the array of all {@link VCSAction} found in the given entries + * + * @param entries entries to scan + * @return array of {@link VCSAction} found in entires + */ + VCSAction[] getActions(List<VCSEntry> entries); + + /** + * obtain the array of all {@link VCSState} found in the given entries + * + * @param entries entries to scan + * @return array of {@link VCSState found in entires + */ + VCSState[] getStates(List<VCSEntry> entries); + + /** clear the internal list of entries. */ + void clear(); + + /** + * obtain the list of all entries. + * + * @return list of all entries + * @throws IllegalStateException if entry was never populated + */ + List<VCSEntry> getEntries() throws IllegalStateException; + + /** + * obtain the list of all entries for a given connexion + * + * @param connexion filter connexion + * @param entries entries to filter + * @return list of all entries for a given connexion + */ + List<VCSEntry> filter(VCSConnexion connexion, List<VCSEntry> entries); + + /** + * obtain the list of all entries for a given location + * + * @param location filter location + * @param entries entries to filter + * @return list of all entries for a given connexion + */ + List<VCSEntry> filter(VCSEntryLocation location, List<VCSEntry> entries); + + /** + * obtain the list of all entries for a given state + * + * @param state filter state + * @param entries entries to filter + * @return list of all entries for a given connexion + */ + List<VCSEntry> filter(VCSState state, List<VCSEntry> entries); + + /** + * obtain the list of all entries for a given selection model + * + * @param selectionModel filter from selection model + * @param entries entries to filter + * @return list of all entries for a given connexion + */ + List<VCSEntry> filter(ListSelectionModel selectionModel, List<VCSEntry> entries); + + /** + * obtain the list of all entries for a given action + * + * @param action filter state + * @param entries entries to filter + * @return list of all entries for a given connexion + */ + List<VCSEntry> filter(VCSAction action, List<VCSEntry> entries); +} Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSEntry.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSEntry.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,128 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.type.VCSEntryLocation; +import org.codelutin.vcs.type.VCSState; + +import java.io.BufferedReader; +import java.io.File; +import java.io.Serializable; + +/** + * Contract of an entry in VCS (a file or a dir) + * + * @author chemit + */ +public interface VCSEntry extends Serializable { + + /** + * Populate the state of the entry, this method calls {@link #refresh(long)} method. + * + * @param timestamp gloabal timestamp to apply + * @throws VCSException if anypb with vcs io + */ + void populate(long timestamp) throws VCSException; + + /** + * refresh state of the entry. + * + * @param timestamp global timestamp to apply + * @throws IllegalStateException if entry was never populated + * @throws VCSException if anypb with vcs io + */ + void refresh(long timestamp) throws IllegalStateException, VCSException; + + /** + * Obtain the relative path from root repository to the entry. + * <p/> + * Note: <b>We use the filesystem path separator, could not be the same on remote</b> + * + * @return the relativePath from local root repository to the entry + */ + String getRelativeLocalPath(); + + /** + * Obtain the relative path from root repository to the entry. + * <p/> + * Note: <b>We use the '/' as path separator, could not be the same on local</b> + * + * @return the relativePath from remote root repository to the entry + */ + String getRelativeRemotePath(); + + /** + * Obtain the projected entry on local working copy. + * <p/> + * Note : <b> the file could not exists. + * + * @return the local file represented by this entry + */ + File getFile(); + + /** @return connexion used */ + VCSConnexion getConnexion(); + + /** + * @return the location of entry + * @throws IllegalStateException if entry was never populated + * @see VCSEntryLocation + */ + VCSEntryLocation getLocation() throws IllegalStateException; + + /** + * @return the last state found for the entry + * @throws IllegalStateException if entry was never populated + */ + VCSState getState() throws IllegalStateException; + + /** + * @return the timestamp of the last state synchronization for the entry + * @throws IllegalStateException if entry was never populated + */ + long getTimestamp() throws IllegalStateException; + + /** + * @return the rev of entry + * @throws IllegalStateException if entry was never populated + */ + String getRev() throws IllegalStateException; + + /** + * @return the changelog of entry from local aginst remote + * @throws IllegalStateException if entry was never populated + */ + BufferedReader getChangeLog() throws IllegalStateException; + + /** + * @return the diff of entry from local aginst remote + * @throws IllegalStateException if entry was never populated + */ + BufferedReader getDiff() throws IllegalStateException; + + /** + * @return the local entry content + * @throws IllegalStateException if entry was never populated, or entry is a directory + */ + BufferedReader getLocalContent() throws IllegalStateException; + + /** + * @return the remote entry content + * @throws IllegalStateException if entry was never populated, or entry is a directory + */ + BufferedReader getRemoteContent() throws IllegalStateException; + + void setState(VCSState state); +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSException.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSException.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSException.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSException.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,51 @@ +/* *##% +* 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; + + +/** + * A generic vcs exception. + * + * @author chemit + */ + +public class VCSException extends Exception { + + private static final long serialVersionUID = -2665066202505740998L; + + public VCSException() { + super(); + } + + public VCSException(String message) { + super(message); + } + + public VCSException(String message, Throwable cause) { + super(message, cause); + } + + public VCSException(Throwable cause) { + super(cause); + } + +} + + Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandler.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandler.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSHandler.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,40 @@ +/* *##% +* 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; + +/** + * Contract of an VCS handler + * + * @author chemit + */ + +public interface VCSHandler<C extends VCSConnexion> extends VCSCommon { + + /** + * Attach a connexion to handler. + * <p/> + * Note : <b>This method MUST be called before all.</b> + * + * @param connexion the connexion to attach + */ + void setConnexion(C connexion); + + +} \ No newline at end of file Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSProvider.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSProvider.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,50 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.vcs; + +import org.codelutin.vcs.type.VCSConnexionMode; + +/** + * The contract to be realized to provide vcs communication. + * <p/> + * Acts as a handler and connexion factory and manage a single handler instance + * + * @author chemit + * @see VCSHandler + * @see VCSConnexion + */ +public interface VCSProvider<C extends VCSConnexion, H extends VCSHandler<C>> { + + /** @return the identifier of the vcs provider (eg SVN, CVS, MOCK) */ + String getName(); + + /** @return the class of implementation of handler to use for this provider */ + Class<H> getHandlerImpl(); + + /** @return the imclass of implementation of connexion to use for this provider */ + Class<C> getConnexionImpl(); + + /** + * 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(VCSConnexionMode mode, VCSConnexionConfig config); + +} Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRevision.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRevision.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,21 @@ +/** + * # #% 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; + +/** @author chemit */ +public interface VCSRevision { + + String getValue(); +} Copied: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRuntimeException.java (from rev 430, trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSRuntimeException.java) =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRuntimeException.java (rev 0) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSRuntimeException.java 2008-04-06 19:17:09 UTC (rev 433) @@ -0,0 +1,51 @@ +/* *##% +* 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; + + +/** + * A generic runtime vcs exception. + * + * @author chemit + */ + +public class VCSRuntimeException extends RuntimeException { + + private static final long serialVersionUID = -2665066202505740998L; + + public VCSRuntimeException() { + super(); + } + + public VCSRuntimeException(String message) { + super(message); + } + + public VCSRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public VCSRuntimeException(Throwable cause) { + super(cause); + } + +} + +
participants (1)
-
tchemit@users.labs.libre-entreprise.org