01: /*
02: * ConfPPF.java
03: *
04: */
05:
06: package com.sun.portal.desktop.deployment;
07:
08: import java.io.FileInputStream;
09: import java.io.InputStream;
10: import java.io.File;
11:
12: import java.util.zip.ZipEntry;
13:
14: /**
15: * ProviderPackageFile for encapsulating static content files.
16: *
17: * @version
18: */
19: public class ConfPPF extends ProviderPackageFile {
20:
21: // Takes the property (for representation in the .par file), the
22: // directory that corresponds to in the current environment (so
23: // we can stream the contents), and the relative path underneath
24: // the property.
25:
26: public ConfPPF(String confdir, String relpath, int types) {
27:
28: super (types);
29:
30: m_ConfDir = confdir;
31: if (m_ConfDir.endsWith(FS)) {
32: int len = m_ConfDir.length();
33: m_ConfDir = m_ConfDir.substring(0, len - 1);
34: }
35: m_RelPath = relpath;
36: }
37:
38: public InputStream getStream() throws ParFileException {
39: try {
40: return new FileInputStream(new File(m_ConfDir + FS
41: + m_RelPath));
42: } catch (Exception ex) {
43: throw new ParFileException("errorStaticContent", ex);
44: }
45: }
46:
47: public void addManifestInclusion(ParManifest man, String name)
48: throws ParFileException {
49: man.addDPEntryIncludeConf(name, m_RelPath, m_Types);
50: }
51:
52: public ZipEntry getZipEntry(ParManifest man)
53: throws ParFileException {
54: return man.getConfZip(m_RelPath);
55: }
56:
57: private String m_ConfDir;
58: private String m_RelPath;
59: }
|