[Buix-commits] r383 - trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs
Author: tchemit Date: 2008-04-06 09:33:56 +0000 (Sun, 06 Apr 2008) New Revision: 383 Modified: trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java Log: introduce VCSCommon contract tobe realized by VCSHandler and VCSConnexion Modified: 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 09:33:33 UTC (rev 382) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSConnexion.java 2008-04-06 09:33:56 UTC (rev 383) @@ -15,15 +15,9 @@ package org.codelutin.vcs; import org.codelutin.vcs.type.VCSConnexionMode; -import org.codelutin.vcs.type.VCSState; import java.io.File; -import java.io.FileFilter; -import java.io.FilenameFilter; -import java.io.IOException; import java.net.URI; -import java.util.Collection; -import java.util.List; /** * Contract to be realized for a connexion to a vcs. @@ -35,10 +29,10 @@ * * @author chemit */ -public interface VCSConnexion { +public interface VCSConnexion<H extends VCSHandler> extends VCSCommon { - /** @return the provider */ - VCSProvider getProvider(); + /** @return the handler */ + H getHandler(); /** * Initialize the connexion. @@ -119,270 +113,4 @@ /** @param l the listener to remove */ void removeVCSConnexionEventListener(VCSConnexionEventListener l); - /** - * init working copy, says if it is the first we use it it, we will checkout - * the databaseDirectory directory - * - * @throws 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 fileState, 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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; - - /** - * @return <code>true</code> if protocol has changed between config and working copy - * @throws VCSException if any pb - */ - boolean hasProtocoleChanged() throws VCSException; } Modified: 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 09:33:33 UTC (rev 382) +++ trunk/lutinvcs/lutinvcs-api/src/main/java/org/codelutin/vcs/VCSHandler.java 2008-04-06 09:33:56 UTC (rev 383) @@ -19,310 +19,22 @@ *##%*/ 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 an VCS handler * * @author chemit */ -public interface VCSHandler<C extends VCSConnexion> { +public interface VCSHandler<C extends VCSConnexion> extends VCSCommon { /** - * init working copy, says if it is the first we use it it, we will checkout - * the databaseDirectory directory + * Attach a connexion to handler. + * <p/> + * Note : <b>This method MUST be called before all.</b> * - * @param connexion vcs connexion to use - * @throws VCSException if any exception while init + * @param connexion the connexion to attach */ - void initWorkingCopy(C connexion) throws VCSException; + void setConnexion(C connexion); - /** - * delete the local working copy with all his files - * - * @param connexion vcs connexion to use - */ - void deleteWorkingCopy(C connexion); - /** - * @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(C connexion, File file, Collection tmp) throws VCSException; - - VCSState getState(C connexion, File file, Collection tmp, boolean noremote) throws VCSException; - - /** - * @param connexion vcs connexion to use - * @param file file to test - * @return <code>true</code> if <code>file</code> is on remote - * repository, <code>false</code> otherwise. - */ - boolean isOnRemote(C connexion, File file); - - /** - * @param connexion vcs connexion to use - * @param file file to test - * @return <code>true</code> if file is uptodate,<code>false</code> - * otherwise. - * @throws VCSException if any exception while operation - */ - boolean isUpToDate(C connexion, File file) throws VCSException; - - /** - * @param connexion vcs connexion to use - * @param file file to test - * @return <code>true</code> if file is handled by VCS,<code>false</code> - * otherwise. - */ - boolean isVersionnableFile(C connexion, File file); - - /** - * add on remote repository somes directories - * - * @param connexion vcs connexion to use - * @param commitMessage commit message - * @param dirNames names of the directories to create on remote repository (could - * used multi-level directories) - * @throws VCSException if any exception while operation - */ - void makeRemoteDir(C connexion, String commitMessage, String... dirNames) - throws VCSException; - - /** - * delete on remote repository somes directories - * - * @param connexion vcs connexion to use - * @param commitMessage commit message - * @param dirNames names of the directories to delete on remote repository (could - * used multi-level directories) - * @throws VCSException if any exception while operation - */ - void deleteRemoteDir(C connexion, String commitMessage, String... dirNames) - throws VCSException; - - /** - * add a list of files into repository - * - * @param connexion vcs connexion to use - * @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 VCSException if any exception while operation - */ - long add(C connexion, List<File> files, String msg) throws VCSException; - - // void add(File file, String msg) throws VCSException; - - /** - * delete a list of files from repository - * - * @param connexion vcs connexion to use - * @param files files to delete - * @param msg message for VCS commit, if <code>null</code> then no commit - * is performed - * @throws VCSException if any exception while operation - */ - void delete(C connexion, List<File> files, String msg) throws VCSException; - - /** - * revert a list of files from repository - * - * @param connexion vcs connexion to use - * @param files files to revert - * @throws VCSException if any exception while operation - */ - void revert(C connexion, List<File> files) throws VCSException; - - /** - * commit a list of files into repository - * - * @param connexion vcs connexion to use - * @param files files to commit - * @param msg message for VCS commit - * @return revision of the operation - * @throws VCSException if any exception while operation - */ - long commit(C connexion, List<File> files, String msg) throws VCSException; - - /** - * update a file to repository to a certain revision - * - * @param connexion vcs connexion to use - * @param file file to update - * @param revision object representing a revision for the current VCS - * @throws VCSException if any exception while operation - */ - void update(C connexion, File file, Object revision) throws VCSException; - - /** - * update a file to repository - * - * @param connexion vcs connexion to use - * @param file file to update - * @throws VCSException if any exception while operation - */ - void update(C connexion, File file) throws VCSException; - - /** - * checkout a module from repository to a local file - * - * @param connexion vcs connexion to use - * @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 VCSException if any exception while operation - */ - void checkout(C connexion, File destDir, String module, boolean recurse) throws VCSException; - - void checkoutFile(C connexion, File destDir, String module) throws VCSException; - - long checkoutOnlyTheDirectory(C connexion, File root, Object revision) throws VCSException; - - /** - * TODO This is not the good place : VCS != Storage - * - * @param connexion vcs connexion to use - * @param directory directory to treate - * @return TODO - * @throws VCSException TODO - */ - List<String> getRemoteStorageNames(C connexion, File directory) throws VCSException; - - /** - * TODO This is not the good place : VCS != Storage - * - * @param connexion vcs connexion to use - * @param directory directory to treate - * @return TODO - */ - List<String> getLocalStorageNames(C connexion, File directory); - - /** - * @param connexion vcs connexion to use - * @param f local file to treate - * @return current local revision of a file - * @throws VCSException TODO - */ - Object getRevision(C connexion, File f) throws VCSException; - - /** - * Obtain the list of log entries for the file - * - * @param connexion vcs connexion to use - * @param startRevision TODO - * @param endRevision TODO - * @param file file to treate - * @return list of log entries for this file between two revisions - * @throws VCSException if any exception while grabbing infos - */ - List getLog(C connexion, Object startRevision, Object endRevision, File file) - throws VCSException; - - /** - * obtain the content of a file for a specific revision - * - * @param connexion vcs connexion to use - * @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 VCSException if any exception while operation - * @throws java.io.IOException TODO - */ - String getFileContent(C connexion, 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 connexion vcs connexion to use - * @param file file to treate - * @return a string representation of change log for the local file to the - * head ? - * @throws VCSException if any exception while building changelog - */ - String getChangeLog(C connexion, 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 connexion vcs connexion to use - * @param file the file to treate - * @return the diff - * @throws 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(C connexion, 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 connexion vcs connexion to use - * @param file the file to treate - * @param againstRevision the against revision to use - * @return the diff - * @throws 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(C connexion, File file, Object againstRevision) throws VCSException, IOException; - - - boolean hasProtocoleChanged(C connexion) throws VCSException; - } \ No newline at end of file
participants (1)
-
tchemit@users.labs.libre-entreprise.org