1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package io.wcm.tooling.commons.packmgr.install;
21
22 import java.io.File;
23 import java.io.IOException;
24 import java.util.Map;
25
26 import org.apache.commons.lang3.StringUtils;
27
28 import io.wcm.tooling.commons.packmgr.util.ContentPackageProperties;
29
30
31
32
33 public final class PackageFile {
34
35 private File file;
36 private int delayAfterInstallSec;
37 private boolean install = true;
38 private Boolean force;
39 private boolean recursive = true;
40 private Integer httpSocketTimeoutSec;
41
42 private static final int DEFAULT_DELAY_AFTER_CONTAINER_PACKAGE_SEC = 3;
43
44
45
46
47
48 public File getFile() {
49 return this.file;
50 }
51
52 public void setFile(File file) {
53 this.file = file;
54 }
55
56
57
58
59
60 public int getDelayAfterInstallSec() {
61 return this.delayAfterInstallSec;
62 }
63
64 public void setDelayAfterInstallSec(int delayAfterInstallSec) {
65 this.delayAfterInstallSec = delayAfterInstallSec;
66 }
67
68
69
70
71
72 public void setDelayAfterInstallSecAutoDetect() {
73 try {
74 Map<String, Object> props = ContentPackageProperties.get(file);
75 String packageType = StringUtils.defaultString((String)props.get("packageType"), "content");
76 if (StringUtils.equals(packageType, "container") || StringUtils.equals(packageType, "mixed")) {
77 this.delayAfterInstallSec = DEFAULT_DELAY_AFTER_CONTAINER_PACKAGE_SEC;
78 }
79 }
80 catch (IOException ex) {
81
82 }
83 }
84
85
86
87
88
89 public boolean isInstall() {
90 return this.install;
91 }
92
93 public void setInstall(boolean install) {
94 this.install = install;
95 }
96
97
98
99
100
101
102 public boolean isForce() {
103
104 if (this.force == null) {
105 return StringUtils.contains(file.getName(), "-SNAPSHOT");
106 }
107 return this.force;
108 }
109
110 public void setForce(Boolean force) {
111 this.force = force;
112 }
113
114
115 public void setForce(boolean force) {
116 this.force = force;
117 }
118
119
120
121
122
123 public boolean isRecursive() {
124 return this.recursive;
125 }
126
127 public void setRecursive(boolean recursive) {
128 this.recursive = recursive;
129 }
130
131
132
133
134
135 public Integer getHttpSocketTimeoutSec() {
136 return this.httpSocketTimeoutSec;
137 }
138
139 public void setHttpSocketTimeoutSec(Integer httpSocketTimeoutSec) {
140 this.httpSocketTimeoutSec = httpSocketTimeoutSec;
141 }
142
143 }