1 package net.sf.jpkgmk.pkgmap;
2
3 import net.sf.jpkgmk.util.ArrayUtil;
4
5
6
7
8
9
10
11 public class PkgMapEntryDevice extends AbstractPkgMapEntry
12 {
13
14 public PkgMapEntryDevice(Integer part, PkgMapEntryType type,
15 String entryClass, String entryPath,
16 Integer major, Integer minor, String mode, String owner,
17 String group) {
18 super(part, type, entryClass, entryPath, null, major, minor, mode, owner, group);
19
20 validate();
21 }
22
23
24 private void validate() {
25
26 if(this.getEntryPath() == null) {
27 throw new NullPointerException("The parameter 'path' must not be null");
28 }
29 if(this.getType() == null) {
30 throw new NullPointerException("The parameter 'type' must not be null");
31 }
32 if(this.getEntryClass() == null) {
33 throw new NullPointerException("The parameter 'entryClass' must not be null");
34 }
35 if(this.getEntryPath() == null) {
36 throw new NullPointerException("The parameter 'entryPath' must not be null");
37 }
38 if(this.getMajor() == null) {
39 throw new NullPointerException("The parameter 'major' must not be null");
40 }
41 if(this.getMinor() == null) {
42 throw new NullPointerException("The parameter 'minor' must not be null");
43 }
44 if(this.getMode() == null) {
45 throw new NullPointerException("The parameter 'mode' must not be null");
46 }
47 if(this.getOwner() == null) {
48 throw new NullPointerException("The parameter 'owner' must not be null");
49 }
50 if(this.getGroup() == null) {
51 throw new NullPointerException("The parameter 'group' must not be null");
52 }
53 }
54
55
56 public static class PkgMapEntryDeviceParser extends AbstractPkgMapEntryParser
57 {
58 @Override
59 protected PkgMapEntry parseItems(String[] items, Integer part, PkgMapEntryType type, int currentIndex)
60 {
61 String fileClass = items[currentIndex++];
62 String path = items[currentIndex++];
63
64 Integer major = ArrayUtil.getArrayValueAsInt(items, currentIndex++);
65 Integer minor = ArrayUtil.getArrayValueAsInt(items, currentIndex++);
66 String mode = ArrayUtil.getArrayValue(items, currentIndex++);
67 String owner = ArrayUtil.getArrayValue(items, currentIndex++);
68 String group = ArrayUtil.getArrayValue(items, currentIndex++);
69
70 PkgMapEntryDevice result = new PkgMapEntryDevice(part, type, fileClass, path, major, minor, mode, owner, group);
71 return result;
72 }
73 }
74
75 }