1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package net.sourceforge.osgi.deployment.maven.container;
23
24 import java.io.File;
25
26 import net.sourceforge.osgi.deployment.maven.IDeploymentPluginContext;
27 import net.sourceforge.osgi.deployment.maven.IResource;
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 public class BundleResource implements IResource {
44 private String m_groupId;
45 private String m_artifactId;
46 private String m_version;
47 private boolean m_customizer;
48 private File m_resolvedFile;
49 private String m_targetPath;
50 private IDeploymentPluginContext m_context;
51
52
53
54
55 public BundleResource() {
56 m_groupId = null;
57 m_artifactId = null;
58 m_version = null;
59 m_customizer = false;
60 m_resolvedFile = null;
61 m_targetPath = null;
62 m_context = null;
63 }
64
65
66
67
68
69 public final void setDeploymentContext(final IDeploymentPluginContext p_context) {
70 m_context = p_context;
71 }
72
73
74
75
76
77 public final String getResourceId() {
78 if (m_resolvedFile == null) {
79 m_resolvedFile = m_context.resolveResource(m_groupId, m_artifactId, m_version);
80 }
81 String resourceId = m_resolvedFile.getName();
82 if (m_targetPath != null && m_targetPath.length() > 0) {
83 resourceId = m_targetPath + "/" + resourceId;
84 }
85 return resourceId;
86 }
87
88
89
90
91 public final String getTargetPath() {
92 return m_targetPath;
93 }
94
95
96
97
98
99 public final void setTargetPath(final String p_targetPath) {
100 m_targetPath = p_targetPath;
101 }
102
103
104
105
106 public final boolean isCustomizer() {
107 return m_customizer;
108 }
109
110
111
112
113
114 public final void setCustomizer(final boolean p_customizer) {
115 m_customizer = p_customizer;
116 }
117
118
119
120
121 public final String getGroupId() {
122 return m_groupId;
123 }
124
125
126
127
128
129 public final void setGroupId(final String p_groupId) {
130 m_groupId = p_groupId;
131 }
132
133
134
135
136 public final String getArtifactId() {
137 return m_artifactId;
138 }
139
140
141
142
143
144 public final void setArtifactId(final String p_artifactId) {
145 m_artifactId = p_artifactId;
146 }
147
148
149
150
151 public final String getVersion() {
152 return m_version;
153 }
154
155
156
157
158
159 public final void setVersion(final String p_version) {
160 m_version = p_version;
161 }
162
163
164
165
166 public final IDeploymentPluginContext getContext() {
167 return m_context;
168 }
169
170
171
172
173
174 public final void setContext(final IDeploymentPluginContext p_context) {
175 m_context = p_context;
176 }
177
178
179
180
181 public final File getResolvedFile() {
182 if (m_resolvedFile == null) {
183 m_resolvedFile = m_context.resolveResource(m_groupId, m_artifactId, m_version);
184 }
185 return m_resolvedFile;
186 }
187
188
189
190
191
192 public final void setResolvedFile(final File p_resolvedFile) {
193 m_resolvedFile = p_resolvedFile;
194 }
195
196
197
198
199
200 public final String toString() {
201 final StringBuffer buffer = new StringBuffer(this.getClass().getName());
202 buffer.append("[");
203 buffer.append("groupId:");
204 buffer.append(getGroupId());
205 buffer.append(", ");
206 buffer.append("artifactId:");
207 buffer.append(getArtifactId());
208 buffer.append(", ");
209 buffer.append("version:");
210 buffer.append(getVersion());
211 buffer.append(", ");
212 buffer.append("resolvedFile:");
213 buffer.append(getResolvedFile());
214 buffer.append("]");
215 return buffer.toString();
216 }
217 }