01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: //
07: package com.sun.portal.ffj.deploy;
08:
09: //
10: import java.io.*;
11:
12: import org.openide.filesystems.*;
13:
14: import com.sun.portal.ffj.filesystems.PSFileSystem;
15: import com.sun.portal.ffj.util.ParEntry;
16: import com.sun.portal.ffj.util.PSProperties;
17:
18: //
19: public class JSPProviderDeploy extends DeployAdapter {
20: //
21: //
22: //
23: public boolean deploy(ParEntry pe) throws DeployException {
24: //
25: String method = "deploy: ";
26: boolean retVal = true;
27:
28: //
29: String srcDirAbsolutePath = getSourceDirAbsolutePath(pe);
30: File fContentPage = getPageFile(srcDirAbsolutePath, pe
31: .getContentPage());
32: File fEditPage = getPageFile(srcDirAbsolutePath, pe
33: .getEditPage());
34: File fProcessPage = getPageFile(srcDirAbsolutePath, pe
35: .getProcessPage());
36:
37: //
38: copy(fContentPage, getDestinationFile(fContentPage));
39: if (fEditPage != null) {
40: copy(fEditPage, getDestinationFile(fEditPage));
41: copy(fProcessPage, getDestinationFile(fProcessPage));
42: }
43:
44: //
45: return retVal;
46: }
47:
48: //
49: //
50: //
51: private String getSourceDirAbsolutePath(ParEntry pe) {
52: //
53: FileObject foPE = pe.getXMLDataObject().getPrimaryFile();
54: String absolutePath = PSFileSystem.getAbsolutePathName(foPE
55: .getParent());
56:
57: //
58: return absolutePath;
59: }
60:
61: private File getPageFile(String srcDirAbsolutePath,
62: String pageFileName) {
63: //
64: String method = "getContentPageFile: ";
65: File retVal = null;
66:
67: //
68: if (pageFileName != null) {
69: String srcPathName = srcDirAbsolutePath + File.separator
70: + pageFileName;
71: retVal = new File(srcPathName);
72: }
73:
74: //
75: return retVal;
76: }
77:
78: private File getDestinationFile(File fSrc) {
79:
80: String deployDir = PSProperties.getJSPDeployDirectory();
81: if (!deployDir.endsWith(File.separator))
82: deployDir += File.separator;
83: File fDeployDir = new File(deployDir);
84: fDeployDir.mkdirs();
85:
86: String fileName = fSrc.getName();
87: String destPath = deployDir + fileName;
88: File fDest = new File(destPath);
89:
90: return fDest;
91: }
92: }
|