String writeFormPath = formName + "_write.jsp";
String viewFormPath = formName + "_view.jsp";
String viewFormHandlerPath = formName + "_formview.jsp";
String printFormPath = formName + "_print.jsp";
LocalFileSystem fileSystem = new LocalFileSystem();
File srcFile = new File(formDir, htmlFormPath);
File trgFile = new File(contextDir, toHtmlFormPath);
fileSystem.copyFile(srcFile, trgFile);
trgFile.setLastModified(srcFile.lastModified());
if ( (new File(formDir, writeFormPath).exists()) ) {
File srcWriteFile = new File(formDir, writeFormPath);
File trgWriteFile = new File(contextDir, writeFormPath);
fileSystem.copyFile(srcWriteFile, trgWriteFile);
trgWriteFile.setLastModified(srcWriteFile.lastModified());
}
if ( (new File(formDir, viewFormPath).exists()) ) {
File srcViewFile = new File(formDir, viewFormPath);
File trgViewFile = new File(contextDir, viewFormPath);
fileSystem.copyFile(srcViewFile, trgViewFile);
trgViewFile.setLastModified(srcViewFile.lastModified());
}
if ( (new File(formDir, viewFormHandlerPath).exists()) ) {
File srcViewFormHandlerPath = new File(formDir, viewFormHandlerPath);
File trgViewFormHandlerPath = new File(contextDir, viewFormHandlerPath);
fileSystem.copyFile(srcViewFormHandlerPath, trgViewFormHandlerPath);
trgViewFormHandlerPath.setLastModified(srcViewFormHandlerPath.lastModified());
}
if ( (new File(formDir, printFormPath).exists()) ) {
File srcPrintForm = new File(formDir, printFormPath);
File trgPrintForm = new File(contextDir, printFormPath);
fileSystem.copyFile(srcPrintForm, trgPrintForm);
trgPrintForm.setLastModified(srcPrintForm.lastModified());
}
File formImgDir = new File(formDir, formName);
if ( formImgDir.exists() ) {
File contextImgDir = new File(contextDir, formName);
if ( !contextImgDir.exists() ) contextImgDir.mkdir();
String[] imgFileArray = formImgDir.list();
for (int i=0; i<imgFileArray.length; i++) {
if (logger.isInfoEnabled()) {
logger
.info("copyFile(File, File, String) - " + imgFileArray[i]); //$NON-NLS-1$
}
fileSystem.copyFile(new File(formDir, formName+"/"+imgFileArray[i]), new File(contextDir, formName+"/"+imgFileArray[i]));
}
}
}