1 package net.sf.jpkgmk.pkgmap;
2
3 import net.sf.jpkgmk.pkgmap.PkgMapEntryFile.PkgMapEntryFileParser;
4 import net.sf.jpkgmk.util.StringUtil;
5 import net.sf.jpkgmk.util.StringUtil.KeyValuePair;
6
7 import org.apache.commons.logging.Log;
8 import org.apache.commons.logging.LogFactory;
9
10
11
12
13
14
15
16 public class PkgMapEntryLink extends AbstractPkgMapEntry implements PkgMapEntry
17 {
18 private Log log = LogFactory.getLog(PkgMapEntryLink.class);
19
20
21
22
23
24
25
26
27
28 public PkgMapEntryLink(Integer part, PkgMapEntryType type, String entryClass, String path, String destinationPath)
29 {
30 super(part, type, entryClass, path, destinationPath, null, null, null, null, null);
31 validate();
32 }
33
34 public void validate()
35 {
36 log.debug("<entering> validate()");
37
38 if(getType() == null) {
39 throw new NullPointerException("The parameter 'type' must not be null");
40 }
41
42 if (getEntryClass() == null) {
43 throw new NullPointerException("The parameter 'entryClass' must not be null");
44 }
45 if(getEntryPath()==null) {
46 throw new NullPointerException("The parameter 'entryPath' must not be null");
47 }
48 }
49
50
51
52 public static class PkgMapEntryLinkParser extends PkgMapEntryFileParser
53 {
54 @Override
55 protected PkgMapEntry createPkgMapEntry(Integer part,
56 PkgMapEntryType type, String fileClass, String path,
57 String mode, String owner, String group, Long size,
58 Long chksum, Long modtime) {
59
60 KeyValuePair splitPath = StringUtil.resolveKeyValue(path);
61 PkgMapEntryLink result = new PkgMapEntryLink(part, type, fileClass, splitPath.getKey(), splitPath.getValue());
62 return result;
63 }
64 }
65
66 }