Commit db25e16d authored by Riegel's avatar Riegel
Browse files

Feat: Add basis for ZipLoader implementation

parent 333a3df1
Showing with 348 additions and 0 deletions
+348 -0
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId>
<version>3.16.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>CityDoctorZipLoader</artifactId>
<name>CityDoctorZipLoader</name>
<description>ZipLoader enables the loading and parsing of zip archives</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorModel</artifactId>
</dependency>
<dependency>
<groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorValidation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>create-binaries</id>
<properties>
<win-jre>jre-${jre-version-short}</win-jre>
<lin-jre>${win-jre}</lin-jre>
<mac-jre>${win-jre}.jre</mac-jre>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<id>downloadWindowsJre</id>
<phase>install</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<uri>https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-windows-amd64.zip</uri>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/jre/jre-win</outputDirectory>
<outputFileName>win-runtime.zip</outputFileName>
</configuration>
</execution>
<execution>
<id>downloadLinuxJre</id>
<phase>install</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<uri>https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-linux-amd64.tar.gz</uri>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/jre/jre-lin</outputDirectory>
<outputFileName>lin-runtime.tar.gz</outputFileName>
</configuration>
</execution>
<execution>
<id>downloadMacJre</id>
<phase>install</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<uri>https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-macos-amd64.zip</uri>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/jre/jre-mac</outputDirectory>
<outputFileName>mac-runtime.zip</outputFileName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>unpack</id>
<phase>install</phase>
<configuration>
<target name="unpack">
<untar src="${project.build.directory}/jre/jre-lin/lin-runtime.tar.gz" dest="${project.build.directory}/jre/jre-lin/runtime" compression="gzip"></untar>
<unzip src="${project.build.directory}/jre/jre-win/win-runtime.zip" dest="${project.build.directory}/jre/jre-win/runtime"></unzip>
<unzip src="${project.build.directory}/jre/jre-mac/mac-runtime.zip" dest="${project.build.directory}/jre/jre-mac/runtime"></unzip>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>create-archive-no-runtime</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}-no-runtime</finalName>
<descriptors>
<descriptor>${project.basedir}/src/assembly/no_runtime/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>create-archive-win</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}-win</finalName>
<descriptors>
<descriptor>${project.basedir}/src/assembly/win/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>create-archive-lin</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}-lin</finalName>
<descriptors>
<descriptor>${project.basedir}/src/assembly/lin/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>create-archive-mac</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}-mac</finalName>
<descriptors>
<descriptor>${project.basedir}/src/assembly/mac/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
\ No newline at end of file
package de.hft.stuttgart.citydoctor2.ziploader;
import de.hft.stuttgart.citydoctor2.check.Checker;
import java.util.ArrayList;
import java.util.List;
public class CityGmlArchive {
private List<CityGmlZipEntry> entries;
public CityGmlArchive(List<CityGmlZipEntry> entries) {
this.entries = entries;
}
public void checkEntries(){
for(CityGmlZipEntry entry : entries){
Checker checker = new Checker(entry.getModel());
checker.runChecks();
}
}
}
package de.hft.stuttgart.citydoctor2.ziploader;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.zip.ZipEntry;
public class CityGmlZipEntry {
private static final Logger logger = LogManager.getLogger(CityGmlZipEntry.class);
private String fileName;
private String archivePath;
private CityDoctorModel model;
private boolean erroneous = false;
private boolean isLibraryObject = false;
public static CityGmlZipEntry of(ZipEntry entry, ParserConfiguration config, String archivePath){
CityGmlZipEntry cgzEntry = new CityGmlZipEntry();
cgzEntry.fileName = entry.getName();
cgzEntry.archivePath = archivePath;
try {
cgzEntry.model = CityGmlParser.parseCityGmlFile(entry.getName(), config);
}
catch (CityGmlParseException | InvalidGmlFileException e) {
logger.error(e);
cgzEntry.erroneous = true;
}
return cgzEntry;
}
public void setIsLibraryObject(boolean isLibraryObject) {
this.isLibraryObject = isLibraryObject;
}
public String getFileName() {
return fileName;
}
public String getArchivePath() {
return archivePath;
}
public CityDoctorModel getModel() {
return model;
}
public boolean isLibraryObject() {
return isLibraryObject;
}
public boolean isErroneous() {
return erroneous;
}
}
package de.hft.stuttgart.citydoctor2.ziploader;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public class ZipParser {
private static final Logger logger = LogManager.getLogger(ZipParser.class);
public static List<CityGmlZipEntry> parseZipFile(String zipFile, ParserConfiguration config) {
ArrayList<CityGmlZipEntry> archiveEntries = new ArrayList<>();
try (ZipFile zipFileObj = new ZipFile(zipFile)) {
for (Enumeration<? extends ZipEntry> entries = zipFileObj.entries(); entries.hasMoreElements();) {
ZipEntry entry = entries.nextElement();
if (entry.isDirectory()) {
continue;
}
if (entry.getName().endsWith(".gml")) {
archiveEntries.add(CityGmlZipEntry.of(entry, config, zipFile));
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return archiveEntries;
}
}
package de.hft.stuttgart.citydoctor2.ziploader.gui;
public class ZipLoaderView {
}
CityDoctorParent/Extensions/CityDoctorZipLoader/src/main/resources/citydoctor_logo.ico

4.19 KB

<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="534.0" maxWidth="833.0" prefHeight="534.0" prefWidth="833.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
<children>
<SplitPane dividerPositions="0.48736462093862815" prefHeight="487.0" prefWidth="833.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<ScrollPane prefHeight="534.0" prefWidth="402.0">
<content>
<TreeView prefHeight="482.0" prefWidth="400.0" />
</content>
</ScrollPane>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" SplitPane.resizableWithParent="false">
<children>
<TreeView prefHeight="482.0" prefWidth="423.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</VBox>
......@@ -267,6 +267,7 @@
<!--CityDoctor2 Extension Modules-->
<module>Extensions/CityDoctorGUI</module>
<module>Extensions/CityDoctorZipLoader</module>
<!--
<module>Extensions/CityDoctorAutoPro</module>
<module>Extensions/CityDoctorHealer</module>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment