Rev 332 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
203 | jmachado | 1 | package pt.estgp.estgweb.services.data; |
2 | |||
3 | import org.apache.log4j.Logger; |
||
332 | jmachado | 4 | import org.dom4j.Document; |
203 | jmachado | 5 | import pt.estgp.estgweb.domain.Image; |
6 | |||
7 | import java.io.ByteArrayInputStream; |
||
8 | import java.io.IOException; |
||
9 | import java.io.InputStream; |
||
10 | |||
11 | /** |
||
12 | * @author Jorge Machado |
||
13 | * @date 28/Mai/2008 |
||
14 | * @see pt.estgp.estgweb.services.data |
||
15 | */ |
||
16 | public class RepositoryManager |
||
17 | { |
||
18 | public static final 1.5.0/docs/api/java/lang/String.html">String RESOURCE_PATH = "/files"; |
||
19 | |||
20 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(RepositoryManager.class); |
||
21 | |||
22 | public static boolean store(5+0%2Fdocs%2Fapi+InputStream">InputStream stream, long identifier) |
||
23 | { |
||
24 | try |
||
25 | { |
||
26 | ResourceManager.saveResource(stream, RESOURCE_PATH, identifier); |
||
27 | return true; |
||
28 | } |
||
29 | catch (1.5.0/docs/api/java/io/IOException.html">IOException e) |
||
30 | { |
||
31 | logger.error(e,e); |
||
32 | } |
||
33 | return false; |
||
34 | } |
||
35 | |||
332 | jmachado | 36 | public static boolean storeDescription(5+0%2Fdocs%2Fapi+Document">Document dom, long identifier) |
37 | { |
||
38 | try |
||
39 | { |
||
40 | ResourceManager.saveResource(dom, RESOURCE_PATH, identifier); |
||
41 | return true; |
||
42 | } |
||
43 | catch (1.5.0/docs/api/java/io/IOException.html">IOException e) |
||
44 | { |
||
45 | logger.error(e,e); |
||
46 | } |
||
47 | return false; |
||
48 | } |
||
49 | |||
203 | jmachado | 50 | public static 5+0%2Fdocs%2Fapi+InputStream">InputStream load(long identifier) |
51 | { |
||
52 | try |
||
53 | { |
||
54 | return ResourceManager.getResource(RESOURCE_PATH, identifier); |
||
55 | } |
||
56 | catch (1.5.0/docs/api/java/io/IOException.html">IOException e) |
||
57 | { |
||
58 | logger.error(e,e); |
||
59 | } |
||
60 | return null; |
||
61 | } |
||
62 | } |