Skip to content

Commit 67e674c

Browse files
author
SvetoKrchnavy
committed
Merge branch 'release/UV_Core_v2.1.2'
2 parents da02366 + 068d458 commit 67e674c

66 files changed

Lines changed: 2552 additions & 1922 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>eu.unifiedviews</groupId>
55
<artifactId>uv-core</artifactId>
6-
<version>2.1.1</version>
6+
<version>2.1.2</version>
77
</parent>
88
<artifactId>backend</artifactId>
99
<packaging>jar</packaging>

backend/src/main/resources/backend-context.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<bean id="configuration" class="cz.cuni.mff.xrg.odcs.commons.app.conf.AppConfig">
1111
<property name="ignoreUnresolvablePlaceholders" value="true"/>
1212
<property name="ignoreResourceNotFound" value="true"/>
13+
<property name ="fileEncoding" value="UTF-8"/>
1314
<property name="locations">
1415
<list>
1516
<value>file:${configFileLocation}</value>

backend/src/main/resources/backend-messages_sk.properties

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ AnnotationsOutput.unknown.field = Nezn\u00E1my typ po\u013Ea: {0}
77
AnnotationsOutput.value.set.failed = Zlyhalo nastavenie hodnoty pre ''{0}'' v\u00FDnimka: ''{1}''
88

99
Configurator.configException = dpu.configure hodilo non ConfigException
10-
Configurator.configuration.fail = Zlyhala konfigur\u00E1cia DPU.
10+
Configurator.configuration.fail = Zlyhala konfigur\u00E1cia kroku.
1111

12-
DPUEvent.completed = DPU: {0} ukon\u010Den\u00E9.
12+
DPUEvent.completed = Krok: {0} ukon\u010Den\u00E9.
1313
DPUEvent.dataUnit.error = Chyba d\u00E1tovej jednotky.
14-
DPUEvent.execution.failed = DPU skon\u010Dilo s chybou.
14+
DPUEvent.execution.failed = Krok skon\u010Dil s chybou.
1515
DPUEvent.missing.output = Ch\u00FDba v\u00FDstupn\u00E1 d\u00E1tov\u00E1 jednotka.
16-
DPUEvent.post.executor.failed = Chyba DPU post-spracovania.
17-
DPUEvent.pre.executor.failed = Chyba DPU pred-spracovania.
16+
DPUEvent.post.executor.failed = Chyba post-spracovania kroku.
17+
DPUEvent.pre.executor.failed = Chyba pred-spracovania kroku.
1818
DPUEvent.request.termination = Po\u017Eiadavka na ukon\u010Denie spracovania.
19-
DPUEvent.starting = Za\u010D\u00EDna spracovanie developersk\u00E9ho k\u00F3du pre DPU: {0}
20-
DPUEvent.unexpected.state = Neo\u010Dak\u00E1van\u00FD stav DPU pred spracovan\u00EDm.
19+
DPUEvent.starting = Za\u010D\u00EDna spracovanie developersk\u00E9ho k\u00F3du pre krok: {0}
20+
DPUEvent.unexpected.state = Neo\u010Dak\u00E1van\u00FD stav kroku pred spracovan\u00EDm.
2121

2222
DPUExecutor.post.executor.exception = Post-spracovanie hodilo neo\u010Dak\u00E1van\u00FA v\u00FDnimku. Pre viac inform\u00E1ci\u00ED pozri logy.
2323
DPUExecutor.pre.executor.exception = Pred-spracovanie hodilo neo\u010Dak\u00E1van\u00FA v\u00FDnimku. Pre viac inform\u00E1ci\u00ED pozri logy.
@@ -42,8 +42,8 @@ DailyReportEmailBuilder.running = sprac\u00FAva sa
4242
DailyReportEmailBuilder.started.header = <th>Proces</th><th>ID spracovania</th><th>\u0160tart</th><th>Spustil / Napl\u00E1noval</th><th>Stav spracovania</th>
4343
DailyReport.started.report = Denn\u00E1 spr\u00E1va spusten\u00FDch procesov
4444

45-
Executor.execution.failed = DPU spracovanie zlyhalo
46-
Executor.execution.failed.detail = DPU spracovanie skon\u010Dilo ne\u0161tandardn\u00FDm sp\u00F4sobom
45+
Executor.execution.failed = Spracovanie kroku zlyhalo
46+
Executor.execution.failed.detail = Spracovanie kroku skon\u010Dilo ne\u0161tandardn\u00FDm sp\u00F4sobom
4747

4848
InstantReport.execution.started.report = Spr\u00E1va o spusten\u00ED procesu: {0} [{1}]
4949
InstantReport.execution.ended.report = Spr\u00E1va o ukon\u010Den\u00ED procesu: {0} [{1}]
@@ -71,12 +71,12 @@ PipelineAbortedEvent.execution.aborted.detail = Spracovanie procesu preru\u0161e
7171

7272
PipelineFailedEvent.execution.failed = Spracovanie procesu zlyhalo.
7373
PipelineFailedEvent.execution.failed.detail = Spracovanie zlyhalo lebo:
74-
PipelineFailedEvent.missing.dpu = Ch\u00FDba DPU.
75-
PipelineFailedEvent.missing.jarFile = Ch\u00FDba jar-s\u00FAbor pre DPU: ''{0}''
74+
PipelineFailedEvent.missing.dpu = Ch\u00FDba krok.
75+
PipelineFailedEvent.missing.jarFile = Ch\u00FDba jar-s\u00FAbor pre krok: ''{0}''
7676
PipelineFailedEvent.pipeline.failed = Spracovanie procesu zlyhalo.
7777
PipelineFailedEvent.pipeline.failed.context = Spracovanie zlyhalo pri pr\u00EDprave kontextu pre DPURecord z d\u00F4vodu v\u00FDnimky:
7878
PipelineFailedEvent.pipeline.failed.detail = Spracovanie zlyhalo z d\u00F4vodu chyby:
79-
PipelineFailedEvent.pipeline.failed.implementation = Na\u010D\u00EDtanie implement\u00E1cie DPURecordu hodilo nasleduj\u00FAcu v\u00FDnimku:
79+
PipelineFailedEvent.pipeline.failed.implementation = Na\u010D\u00EDtanie implement\u00E1cie DPURecord hodilo nasleduj\u00FAcu v\u00FDnimku:
8080
PipelineFailedEvent.pipeline.failed.root = V\u00FDnimka kore\u0148ovej (root) \u0161trukt\u00FAry:
8181
PipelineFailedEvent.unknown = nezn\u00E1ma
8282

commons-app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>eu.unifiedviews</groupId>
55
<artifactId>uv-core</artifactId>
6-
<version>2.1.1</version>
6+
<version>2.1.2</version>
77
</parent>
88
<artifactId>commons-app</artifactId>
99
<name>commons-app</name>

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/pipeline/graph/PipelineGraph.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,17 @@ public Node getNodeById(int id) {
312312
* @param newY
313313
* The value of Y point of node
314314
*/
315-
public void moveNode(int dpuId, int newX, int newY) {
315+
public boolean moveNode(int dpuId, int newX, int newY) {
316316
Node node = getNodeById(dpuId);
317317
if (node == null) {
318318
throw new IllegalArgumentException(
319319
"Node with supplied id was not found!");
320320
}
321+
if ((node.getPosition() != null)&&(node.getPosition().getX() == newX)&&(node.getPosition().getY() == newY)) {
322+
return false;
323+
}
321324
node.setPosition(new Position(newX, newY));
325+
return true;
322326
}
323327

324328
/**

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/pipeline/transfer/ExportService.java

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -386,34 +386,38 @@ public void saveDpusInfo(TreeSet<DpuItem> dpusInformation, ZipOutputStream zipSt
386386
xStream.alias("dpus", List.class);
387387
xStream.alias("dpu", DpuItem.class);
388388

389-
File serializedTarget;
389+
File serializedTarget = null;
390390
try {
391-
serializedTarget = File.createTempFile("temp", ".tmp");
392-
} catch (IOException ex2) {
393-
throw new ExportException(Messages.getString("ExportService.error"), ex2);
394-
}
395-
try (FileOutputStream foutStream = new FileOutputStream(serializedTarget)) {
396-
xStream.toXML(dpus, foutStream);
397-
} catch (IOException ex1) {
398-
throw new ExportException(Messages.getString("ExportService.error"), ex1);
399-
}
400-
401-
byte[] buffer = new byte[4096];
402-
try {
403-
final ZipEntry ze = new ZipEntry(ArchiveStructure.USED_DPUS.getValue());
404-
zipStream.putNextEntry(ze);
405-
406-
// move jar file into the zip file
407-
try (FileInputStream in = new FileInputStream(serializedTarget)) {
408-
int len;
409-
while ((len = in.read(buffer)) > 0) {
410-
zipStream.write(buffer, 0, len);
391+
try {
392+
serializedTarget = File.createTempFile("temp", ".tmp");
393+
} catch (IOException ex2) {
394+
throw new ExportException(Messages.getString("ExportService.error"), ex2);
395+
}
396+
try (FileOutputStream foutStream = new FileOutputStream(serializedTarget)) {
397+
xStream.toXML(dpus, foutStream);
398+
} catch (IOException ex1) {
399+
throw new ExportException(Messages.getString("ExportService.error"), ex1);
400+
}
401+
402+
byte[] buffer = new byte[4096];
403+
try {
404+
final ZipEntry ze = new ZipEntry(ArchiveStructure.USED_DPUS.getValue());
405+
zipStream.putNextEntry(ze);
406+
407+
// move jar file into the zip file
408+
try (FileInputStream in = new FileInputStream(serializedTarget)) {
409+
int len;
410+
while ((len = in.read(buffer)) > 0) {
411+
zipStream.write(buffer, 0, len);
412+
}
411413
}
414+
} catch (IOException ex) {
415+
throw new ExportException(Messages.getString("ExportService.jarFile.infos.fail"), ex);
412416
}
413-
} catch (IOException ex) {
414-
throw new ExportException(Messages.getString("ExportService.jarFile.infos.fail"), ex);
417+
LOG.debug("<<< Leaving saveDpusInfo()");
418+
} finally {
419+
ResourceManager.cleanupQuietly(serializedTarget);
415420
}
416-
LOG.debug("<<< Leaving saveDpusInfo()");
417421
}
418422

419423
public TreeSet<DpuItem> getDpusInformation(Pipeline pipeline) {

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/pipeline/transfer/ImportService.java

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public Pipeline importPipeline(File zipFile, boolean importUserDataFile, boolean
8989
public Pipeline importPipeline(File zipFile, File tempDirectory, boolean importUserDataFile, boolean importScheduleFile)
9090
throws ImportException, IOException {
9191
// delete tempDirectory
92-
FileUtils.deleteQuietly(tempDirectory);
92+
ResourceManager.cleanupQuietly(tempDirectory);
9393

9494
if (authCtx == null) {
9595
throw new ImportException(Messages.getString("ImportService.pipeline.authenticationContext.null"));
@@ -151,11 +151,7 @@ public Pipeline importPipeline(File zipFile, File tempDirectory, boolean importU
151151
} catch (ImportException ex) {
152152
throw ex;
153153
} finally {
154-
// in every case delte temp directory
155-
if (!FileUtils.deleteQuietly(tempDirectory)) {
156-
// failed to delete directory
157-
LOG.warn("Failed to delete temp directory.");
158-
}
154+
ResourceManager.cleanupQuietly(tempDirectory);
159155
}
160156
return pipe;
161157
}
@@ -310,66 +306,70 @@ public ImportedFileInformation getImportedInformation(File zipFile)
310306
boolean isScheduleFile = false;
311307

312308
File tempDirectory = resourceManager.getNewImportTempDir();
313-
ZipCommons.unpack(zipFile, tempDirectory);
314-
Pipeline pipeline = loadPipeline(tempDirectory);
315-
316-
List<DpuItem> usedDpus = loadUsedDpus(tempDirectory);
317-
TreeMap<String, DpuItem> missingDpus = new TreeMap<>();
318-
319-
if (pipeline != null) {
320-
PipelineGraph graph = pipeline.getGraph();
321-
if (graph != null) {
322-
Set<Node> nodes = graph.getNodes();
323-
if (nodes != null) {
324-
for (Node node : nodes) {
325-
DPUInstanceRecord dpu = node.getDpuInstance();
326-
if (dpu == null) {
327-
continue;
328-
}
329-
330-
DPUTemplateRecord template = dpu.getTemplate();
331-
332-
if (template == null) {
333-
continue;
334-
}
335-
336-
// try to detect if dpus are installed
337-
DPUTemplateRecord dpuTemplateRecord = dpuFacade
338-
.getByName(template.getName());
339-
// TODO jmc add version
340-
String version = "unknown";
341-
DpuItem dpuItem = new DpuItem(dpu.getName(), template.getJarName(), version);
342-
if (dpuTemplateRecord == null) {
343-
// these dpus is missing
344-
if (!missingDpus.containsKey(dpu.getName())) {
345-
missingDpus.put(dpu.getName(), dpuItem);
309+
try {
310+
ZipCommons.unpack(zipFile, tempDirectory);
311+
Pipeline pipeline = loadPipeline(tempDirectory);
312+
313+
List<DpuItem> usedDpus = loadUsedDpus(tempDirectory);
314+
TreeMap<String, DpuItem> missingDpus = new TreeMap<>();
315+
316+
if (pipeline != null) {
317+
PipelineGraph graph = pipeline.getGraph();
318+
if (graph != null) {
319+
Set<Node> nodes = graph.getNodes();
320+
if (nodes != null) {
321+
for (Node node : nodes) {
322+
DPUInstanceRecord dpu = node.getDpuInstance();
323+
if (dpu == null) {
324+
continue;
325+
}
326+
327+
DPUTemplateRecord template = dpu.getTemplate();
328+
329+
if (template == null) {
330+
continue;
346331
}
332+
333+
// try to detect if dpus are installed
334+
DPUTemplateRecord dpuTemplateRecord = dpuFacade
335+
.getByName(template.getName());
336+
// TODO jmc add version
337+
String version = "unknown";
338+
DpuItem dpuItem = new DpuItem(dpu.getName(), template.getJarName(), version);
339+
if (dpuTemplateRecord == null) {
340+
// these dpus is missing
341+
if (!missingDpus.containsKey(dpu.getName())) {
342+
missingDpus.put(dpu.getName(), dpuItem);
343+
}
344+
}
345+
final File userDataFile = new File(tempDirectory,
346+
ArchiveStructure.DPU_DATA_USER.getValue() + File.separator
347+
+ template.getJarDirectory());
348+
349+
if (userDataFile.exists()) {
350+
isUserData = true;
351+
352+
}
353+
LOG.debug("userDataFile: " + userDataFile.toString());
347354
}
348-
final File userDataFile = new File(tempDirectory,
349-
ArchiveStructure.DPU_DATA_USER.getValue() + File.separator
350-
+ template.getJarDirectory());
351-
352-
if (userDataFile.exists()) {
353-
isUserData = true;
354-
355+
356+
final File scheduleFile = new File(tempDirectory,
357+
ArchiveStructure.SCHEDULE.getValue());
358+
if (scheduleFile.exists()) {
359+
isScheduleFile = true;
355360
}
356-
LOG.debug("userDataFile: " + userDataFile.toString());
357-
}
358-
359-
final File scheduleFile = new File(tempDirectory,
360-
ArchiveStructure.SCHEDULE.getValue());
361-
if (scheduleFile.exists()) {
362-
isScheduleFile = true;
363361
}
364362
}
365363
}
364+
365+
ImportedFileInformation result = new ImportedFileInformation(usedDpus,
366+
missingDpus, isUserData, isScheduleFile);
367+
368+
LOG.debug("<<< Leaving getImportedInformation: {}", result);
369+
return result;
370+
} finally {
371+
ResourceManager.cleanupQuietly(tempDirectory);
366372
}
367-
368-
ImportedFileInformation result = new ImportedFileInformation(usedDpus,
369-
missingDpus, isUserData, isScheduleFile);
370-
371-
LOG.debug("<<< Leaving getImportedInformation: {}", result);
372-
return result;
373373
}
374374

375375
public boolean hasUserPermission(String permission) {

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/pipeline/transfer/ZipCommons.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static void unpack(File sourceZip, File targetDir) throws IOException {
4040
IOUtils.closeQuietly(out);
4141
}
4242
}
43+
zipFile.close();
4344

4445
LOG.debug("<<< Leaving unpack");
4546
}

commons-app/src/main/java/cz/cuni/mff/xrg/odcs/commons/app/resource/ResourceManager.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import java.io.File;
44
import java.util.Date;
55

6+
import org.apache.commons.io.FileUtils;
67
import org.apache.commons.lang3.time.DateFormatUtils;
8+
import org.slf4j.Logger;
9+
import org.slf4j.LoggerFactory;
710
import org.springframework.beans.factory.annotation.Autowired;
811

912
import cz.cuni.mff.xrg.odcs.commons.app.conf.AppConfig;
@@ -23,6 +26,8 @@
2326
* @author Škoda Petr
2427
*/
2528
public class ResourceManager {
29+
30+
private static final Logger LOG = LoggerFactory.getLogger(ResourceManager.class);
2631

2732
/**
2833
* Name of sub-directory for shared DPU's data.
@@ -325,4 +330,16 @@ private File getNewUniqueDir(File root) throws MissingResourceException {
325330
return newFile;
326331
}
327332

333+
public static void cleanupQuietly(File... filesToCleanup) {
334+
for (File file : filesToCleanup) {
335+
if (file == null || !file.exists()) {
336+
continue;
337+
}
338+
339+
LOG.debug("Cleaning up file / dir: " + file);
340+
if (!FileUtils.deleteQuietly(file)) {
341+
LOG.warn("Failed to delete temp directory.");
342+
}
343+
}
344+
}
328345
}

commons-app/src/main/resources/commons-messages_sk.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ EdgeCompiler.dpu.output = Krok: {0}, V\u00FDstup: {1}
2929
ExportService.authenticationContext.fail = AuthenticationContext je pr\u00E1zdny (null).
3030
ExportService.canonical.path.fail = Nepodarilo sa na\u010D\u00EDta\u0165 kanonick\u00FA cestu.
3131
ExportService.close.zip.fail = Nepodarilo sa zatvori\u0165 zip stream.
32-
ExportService.dpu.list.fail = Nepodarilo sa serializova\u0165 zoznam dpu.
32+
ExportService.dpu.list.fail = Nepodarilo sa serializova\u0165 zoznam krokov.
3333
ExportService.dpu.serialization.fail = Nepodarilo sa serializova\u0165 inform\u00E1cie zo \u0161abl\u00F3ny kroku.
3434
ExportService.error = Chyba
3535
ExportService.jarFile.copy.fail = Zlyhalo kop\u00EDrovanie jar s\u00FAboru.

0 commit comments

Comments
 (0)