diff -r 85df38eb4012 -r df88fead2976 buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java Thu Jul 22 17:08:43 2010 +0300 @@ -121,24 +121,31 @@ for (MetaDataInput metadataInput : metadataList) { boolean removed = false; String logPath = null; + String currentLogPath = null; Iterator inputIterator = metadataInput.iterator(); while (inputIterator.hasNext()) { + //Todo: better way of log handling, with metadatainput + // metadata initialization for each logfile within + //metadatainput itself would be better. this is temporary. Metadata.LogEntry logEntry = inputIterator.next(); - if (!removed) { - logPath = logEntry.getLogPath(); + logPath = logEntry.getLogPath(); + if (currentLogPath == null) { + currentLogPath = logPath; + removed = false; + } else if (!currentLogPath.equals(logPath)) { + finalizeForLogPath(currentLogPath, metadataInput, ormDB); + currentLogPath = logPath; + removed = false; + } + if (!removed ) { + log.debug("processing for log: " + logPath); ormDB.removeEntries(logPath); removed = true; } //initializes the metadata if none exists ormDB.addLogEntry(logEntry); } - if (logPath != null && metadataInput instanceof CustomMetaDataProvider) { - CustomMetaDataProvider provider = (CustomMetaDataProvider)metadataInput; - provider.provide(ormDB, logPath); - } - if (logPath != null) { - ormDB.finalizeMetadata(logPath); - } + finalizeForLogPath(currentLogPath, metadataInput, ormDB); } Date after = new Date(); log("Time after recording to db: " + after); @@ -155,4 +162,16 @@ } } } + + private void finalizeForLogPath(String currentLogPath, + MetaDataInput metadataInput, ORMMetadataDB ormDB) { + if (currentLogPath != null) { + if (metadataInput instanceof CustomMetaDataProvider) { + CustomMetaDataProvider provider = + (CustomMetaDataProvider)metadataInput; + provider.provide(ormDB, currentLogPath); + } + ormDB.finalizeMetadata(currentLogPath); + } + } } \ No newline at end of file