| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
package nl.toolforge.karma.core.boot; |
| 5 |
|
|
| 6 |
|
import nl.toolforge.karma.core.KarmaRuntimeException; |
| 7 |
|
import nl.toolforge.karma.core.location.Location; |
| 8 |
|
import nl.toolforge.karma.core.module.BaseModule; |
| 9 |
|
import nl.toolforge.karma.core.module.Module; |
| 10 |
|
import nl.toolforge.karma.core.module.template.ModuleLayoutTemplate; |
| 11 |
|
import nl.toolforge.karma.core.vc.AuthenticationException; |
| 12 |
|
import nl.toolforge.karma.core.vc.Runner; |
| 13 |
|
import nl.toolforge.karma.core.vc.RunnerFactory; |
| 14 |
|
import nl.toolforge.karma.core.vc.VersionControlException; |
| 15 |
|
|
| 16 |
|
import java.io.File; |
| 17 |
|
import java.util.ArrayList; |
| 18 |
|
import java.util.List; |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
public final class ManifestStore extends AdminStore { |
| 30 |
|
|
| 31 |
|
public ManifestStore(WorkingContext workingContext) { |
| 32 |
|
super(workingContext); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
public ManifestStore(WorkingContext workingContext, String moduleName, Location location) { |
| 36 |
|
super(workingContext, moduleName, location); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
public List getManifestFiles() { |
| 44 |
|
return new ArrayList(); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public final Module getModule() { |
| 48 |
|
|
| 49 |
|
if (module != null) { |
| 50 |
|
return module; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
if (getModuleName() == null || "".equals(getModuleName())) { |
| 54 |
|
throw new KarmaRuntimeException("Module name for manifest store has not been set (correctly)."); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
62 |
|
| 58 |
62 |
|
| 59 |
62 |
String name = getModuleName(); |
| 60 |
|
while (name.endsWith(File.separator)) { |
| 61 |
|
name.substring(0, name.length()); |
| 62 |
|
} |
| 63 |
|
if (name.lastIndexOf(File.separator) > 0) { |
| 64 |
|
name = name.substring(name.lastIndexOf(File.separator) + 1); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
module = new ManifestModule(name, getLocation()); |
| 68 |
|
module.setBaseDir(new File(getWorkingContext().getManifestStoreBasedir(), getModuleName())); |
| 69 |
|
|
| 70 |
|
return module; |
| 71 |
217 |
} |
| 72 |
217 |
|
| 73 |
217 |
|
| 74 |
|
|
| 75 |
|
|
| 76 |
0 |
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
|
| 80 |
|
public void commit(String releaseName) throws AuthenticationException, VersionControlException { |
| 81 |
|
|
| 82 |
|
File file = new File(module.getBaseDir(), releaseName + ".xml"); |
| 83 |
|
|
| 84 |
|
Runner runner = RunnerFactory.getRunner(getLocation()); |
| 85 |
|
runner.commit(file); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
protected class ManifestModule extends BaseModule { |
| 89 |
|
|
| 90 |
217 |
public ManifestModule(String name, Location location) { |
| 91 |
217 |
super(name, location); |
| 92 |
217 |
} |
| 93 |
|
|
| 94 |
|
public ModuleLayoutTemplate getLayoutTemplate() { |
| 95 |
0 |
return null; |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
} |