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: * @version
19: */
20: public class WarPPF extends ProviderPackageFile {
21:
22: // Takes the property (for representation in the .par file), the
23: // directory that corresponds to in the current environment (so
24: // we can stream the contents), and the relative path underneath
25: // the property.
26:
27: public WarPPF(String wardir, String relpath, int types) {
28:
29: super (types);
30:
31: m_WarDir = wardir;
32: if (m_WarDir.endsWith(FS)) {
33: int len = m_WarDir.length();
34: m_WarDir = m_WarDir.substring(0, len - 1);
35: }
36: m_RelPath = relpath;
37: }
38:
39: public InputStream getStream() throws ParFileException {
40: try {
41: return new FileInputStream(new File(m_WarDir + FS
42: + m_RelPath));
43: } catch (Exception ex) {
44: throw new ParFileException("errorStaticContent", ex);
45: }
46: }
47:
48: public void addManifestInclusion(ParManifest man, String name)
49: throws ParFileException {
50: man.addDPEntryIncludeWar(name, m_RelPath, m_Types);
51: }
52:
53: public ZipEntry getZipEntry(ParManifest man)
54: throws ParFileException {
55: return man.getWarZip(m_RelPath);
56: }
57:
58: private String m_WarDir;
59: private String m_RelPath;
60: }
|