try {
srcDoc = builder.buildDocument(publication, srcUrl);
} catch (DocumentBuildException e) {
throw new BuildException(e);
}
ResourcesManager resourcesMgr = new ResourcesManager(srcDoc);
List resources = new ArrayList(Arrays.asList(resourcesMgr.getResources()));
resources.addAll(Arrays.asList(resourcesMgr.getMetaFiles()));
File[] srcFiles =
(File[]) resources.toArray(new File[resources.size()]);
if (srcFiles == null) {
log(
"There are no resources for the document "
+ getFirstdocumentid());
return;
}
String destUrl =
builder.buildCanonicalUrl(
publication,
getSecarea(),
destDocumentid,
language);
Document destDoc;
try {
destDoc = builder.buildDocument(publication, destUrl);
} catch (DocumentBuildException e) {
throw new BuildException(e);
}
resourcesMgr = new ResourcesManager(destDoc);
for (int i = 0; i < srcFiles.length; i++) {
try {
log(
"copy file "
+ srcFiles[i].getAbsolutePath()
+ "to file "
+ resourcesMgr.getPath().getCanonicalPath());
FileUtil.copyFileToDirectory(
srcFiles[i],
resourcesMgr.getPath());
} catch (IOException e) {
throw new BuildException(e);
}
}