| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| nl.toolforge.karma.core.module.AdminModule |
|
|
| 1 | /* |
|
| 2 | Karma core - Core of the Karma application |
|
| 3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, write to the Free Software |
|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 18 | */ |
|
| 19 | package nl.toolforge.karma.core.module; |
|
| 20 | ||
| 21 | import nl.toolforge.karma.core.location.Location; |
|
| 22 | import nl.toolforge.karma.core.manifest.Module; |
|
| 23 | import nl.toolforge.karma.core.vc.AuthenticationException; |
|
| 24 | import nl.toolforge.karma.core.vc.Authenticator; |
|
| 25 | import nl.toolforge.karma.core.vc.VersionControlException; |
|
| 26 | import nl.toolforge.karma.core.vc.VersionControlSystem; |
|
| 27 | import org.apache.tools.ant.DirectoryScanner; |
|
| 28 | ||
| 29 | import java.io.File; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * <code>AdminModule</code>s are suitable for module-like structures which are not used by any <code>Manifest</code>. A |
|
| 33 | * good example is a module that stores manifests itself. |
|
| 34 | * |
|
| 35 | * @author D.A. Smedes |
|
| 36 | * @version $Id: AdminModule.java,v 1.5 2004/11/02 23:57:07 asmedes Exp $ |
|
| 37 | */ |
|
| 38 | public abstract class AdminModule implements Module { |
|
| 39 | ||
| 40 | 0 | private String moduleName = null; |
| 41 | 0 | private Location location = null; |
| 42 | ||
| 43 | 0 | private File baseDir = null; |
| 44 | 0 | private File checkoutDir = null; |
| 45 | ||
| 46 | 0 | public AdminModule(String moduleName, Location location) { |
| 47 | 0 | this.moduleName = moduleName; |
| 48 | 0 | this.location = location; |
| 49 | 0 | } |
| 50 | ||
| 51 | public final String getName() { |
|
| 52 | 0 | return moduleName; |
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * Gets all file entries in this module. An entry is relative to a modules' base directory. Directories are ignored. |
|
| 57 | * |
|
| 58 | * @param includePatterns A String array containing the file patterns to include in the output array. |
|
| 59 | */ |
|
| 60 | public final String[] getEntries(String[] includePatterns) { |
|
| 61 | ||
| 62 | 0 | DirectoryScanner scanner = new DirectoryScanner(); |
| 63 | 0 | scanner.setBasedir(getBaseDir()); |
| 64 | 0 | scanner.setIncludes(includePatterns); |
| 65 | ||
| 66 | 0 | return scanner.getIncludedFiles(); |
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * Checks is |
|
| 71 | * @return |
|
| 72 | */ |
|
| 73 | public final boolean isVersionControlled() { |
|
| 74 | 0 | return location instanceof VersionControlSystem; |
| 75 | } |
|
| 76 | ||
| 77 | public void setBaseDir(File baseDir) { |
|
| 78 | 0 | this.baseDir = baseDir; |
| 79 | 0 | } |
| 80 | ||
| 81 | public File getBaseDir() { |
|
| 82 | 0 | return baseDir; |
| 83 | } |
|
| 84 | // |
|
| 85 | // public void setCheckoutDir(File checkoutDir) { |
|
| 86 | // this.checkoutDir = checkoutDir; |
|
| 87 | 0 | // } |
| 88 | 0 | // |
| 89 | // public File getCheckoutDir() { |
|
| 90 | // return checkoutDir; |
|
| 91 | 0 | // } |
| 92 | ||
| 93 | /** |
|
| 94 | * Returns the location for this |
|
| 95 | * @return |
|
| 96 | */ |
|
| 97 | public Location getLocation() { |
|
| 98 | 0 | return location; |
| 99 | } |
|
| 100 | ||
| 101 | public abstract void createRemote(Authenticator authenticator, String createComment) throws VersionControlException, AuthenticationException; |
|
| 102 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |