*/
protected boolean analyze(final ModelRequest req, ModelResponse res, final String fileName, final String handlerId,
final boolean bulkImport, String xslt, final Properties properties) throws ModelException
{
final I18N i18n = (I18N) req.getSpringBean(I18N.ID);
final ImportManager im = (ImportManager) req.getSpringBean(ImportManager.ID);
FileTools.newAkteraFile("/var/tmp/iritgo").mkdirs();
final File lockFile = FileTools.newAkteraFile("/var/tmp/iritgo/import.lck");
if ("Y".equals(req.getParameter("force")))
{
lockFile.delete();
}
if (lockFile.exists())
{
return false;
}
try
{
lockFile.createNewFile();
File reportFile = FileTools.newAkteraFile("/var/tmp/iritgo/import-report.txt");
reportFile.delete();
reportFile.createNewFile();
final PrintWriter reporter = new PrintWriter(new FileOutputStream(reportFile), true);
convertToXml(req, fileName, xslt);
if (im.validateXmlFile(new File(fileName)))
{
new Thread()
{
public void run()
{
boolean ok = true;
try
{
File file = new File(fileName);
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
"file://" + file.getAbsolutePath());
if (doc.getChildNodes().getLength() > 0)
{
XPath xPath = XPathFactory.newInstance().newXPath();
Node importElem = (Node) xPath.evaluate("import", doc, XPathConstants.NODE);
if (importElem != null)
{
reporter.println(i18n.msg(req, "Aktera", "startingImportAnalysis"));
ok = im.analyzeImport(req, doc, importElem, reporter, i18n, handlerId, bulkImport, properties);
}
else
{
reporter.println(i18n
.msg(req, "AkteraImporter", "importErrorNoImportRootNodeFound"));