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