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 property-based files.
17: *
18: * @author yabob
19: * @version
20: */
21: public class PropLocPPF 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 PropLocPPF(String prop, String propdir, String relpath,
29: int types) {
30:
31: super (types);
32:
33: m_Prop = prop;
34: m_PropDir = propdir;
35: if (m_PropDir.endsWith(FS)) {
36: int len = m_PropDir.length();
37: m_PropDir = m_PropDir.substring(0, len - 1);
38: }
39: m_RelPath = relpath;
40: }
41:
42: public InputStream getStream() throws ParFileException {
43: try {
44: return new FileInputStream(new File(m_PropDir + FS
45: + m_RelPath));
46: } catch (Exception ex) {
47: throw new ParFileException("errorPropLocFile", ex);
48: }
49: }
50:
51: public void addManifestInclusion(ParManifest man, String name)
52: throws ParFileException {
53: man.addDPEntryIncludePBFile(name, m_Prop, m_RelPath, m_Types);
54: }
55:
56: public ZipEntry getZipEntry(ParManifest man)
57: throws ParFileException {
58: return man.getPBFileZip(m_Prop, m_RelPath);
59: }
60:
61: private String m_Prop;
62: private String m_PropDir;
63: private String m_RelPath;
64: }
|