01: package ru.emdev.EmForge.email.velocity.resourceloaders;
02:
03: import java.io.InputStream;
04:
05: /**
06: * Gets template from Resource file
07: * @author alasarenko
08: * */
09:
10: public class ClasspathResourceLoader implements ResourceLoader {
11:
12: private String resourceNamePrefix;
13: private String resourceNamePostfix;
14:
15: public InputStream getInputStreamFromResource(String i_resourceName) {
16: return this .getClass().getClassLoader().getResourceAsStream(
17: getResourceNamePrefix() + i_resourceName
18: + getResourceNamePostfix());
19: }
20:
21: /**
22: * @return the resourceNamePostfix
23: */
24: private String getResourceNamePostfix() {
25: return resourceNamePostfix;
26: }
27:
28: /**
29: * @return the resourceNamePrefix
30: */
31: private String getResourceNamePrefix() {
32: return resourceNamePrefix;
33: }
34:
35: /**
36: * @param resourceNamePostfix the resourceNamePostfix to set
37: */
38: public void setResourceNamePostfix(String resourceNamePostfix) {
39: this .resourceNamePostfix = resourceNamePostfix;
40: }
41:
42: /**
43: * @param resourceNamePrefix the resourceNamePrefix to set
44: */
45: public void setResourceNamePrefix(String resourceNamePrefix) {
46: this.resourceNamePrefix = resourceNamePrefix;
47: }
48: }
|