]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/build/ResourceDistribution.java
Add generate script
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / build / ResourceDistribution.java
1 package org.argeo.slc.core.build;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5
6 import org.argeo.slc.SlcException;
7 import org.argeo.slc.StreamReadable;
8 import org.argeo.slc.build.Distribution;
9 import org.springframework.core.io.Resource;
10
11 public class ResourceDistribution implements Distribution, StreamReadable {
12 private Resource resource;
13
14 public ResourceDistribution() {
15 }
16
17 public ResourceDistribution(Resource location) {
18 this.resource = location;
19 }
20
21 public String getDistributionId() {
22 return resource.toString();
23 }
24
25 public Resource getResource() {
26 return resource;
27 }
28
29 public void setResource(Resource resource) {
30 this.resource = resource;
31 }
32
33 public InputStream getInputStream() {
34 try {
35 return resource.getInputStream();
36 } catch (IOException e) {
37 throw new SlcException("Cannot get input stream", e);
38 }
39 }
40
41 @Override
42 public String toString() {
43 return resource.toString();
44 }
45
46 }