Skip to content

Commit

Permalink
zipping files
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioG70 committed Oct 25, 2024
1 parent a1747ec commit d2777a5
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 115 deletions.

This file was deleted.

This file was deleted.

69 changes: 54 additions & 15 deletions dbptk-bindings/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,30 @@
<generatePackage>com.databasepreservation.modules.siard.bindings.${packagename}</generatePackage>
</configuration>
</execution>
<execution>
<id>generate-siard-1007-contextDocumentationIndex</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<strict>false</strict>

<!-- specify the schema to convert -->
<schemaDirectory>${basedir}/src/main/resources/schema/1007</schemaDirectory>
<schemaIncludes>
<include>contextDocumentationIndex.xsd</include>
</schemaIncludes>


<generateDirectory>${project.build.directory}/generated-sources/xjc-a
</generateDirectory>

<!-- The package of your generated sources -->
<generatePackage>
com.databasepreservation.modules.siard.bindings.${packagename}.context
</generatePackage>
</configuration>
</execution>
<execution>
<id>generate-siard-1007</id>
<goals>
Expand All @@ -73,24 +97,43 @@
<schemaIncludes>
<include>archiveIndex.xsd</include>
<include>docIndex.xsd</include>
<include>contextDocumentationIndex.xsd</include>
<include>fileIndex.xsd</include>
<include>XMLSchema.xsd</include>
<include>tableIndex.xsd</include>
</schemaIncludes>
<forceRegenerate>true</forceRegenerate>

<!-- specifically specify each binding to use in conversion -->
<bindingDirectory>${basedir}/src/main/resources/config/jaxb</bindingDirectory>
<bindingIncludes>
<include>*.xjb</include>
</bindingIncludes>
<!--generate java classes-->
<generateDirectory>${project.build.directory}/generated-sources/xjc</generateDirectory>
<generateDirectory>${project.build.directory}/generated-sources/xjc-b
</generateDirectory>

<!-- The package of your generated sources -->
<generatePackage>com.databasepreservation.modules.siard.bindings.${packagename}</generatePackage>
</configuration>
</execution>
<execution>
<id>generate-siard-128-contextDocumentationIndex</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<strict>false</strict>

<!-- specify the schema to convert -->
<schemaDirectory>${basedir}/src/main/resources/schema/128</schemaDirectory>
<schemaIncludes>
<include>contextDocumentationIndex.xsd</include>
</schemaIncludes>


<generateDirectory>${project.build.directory}/generated-sources/xjc-a
</generateDirectory>

<!-- The package of your generated sources -->
<generatePackage>
com.databasepreservation.modules.siard.bindings.${packagename}.context
</generatePackage>
</configuration>
</execution>
<execution>
<id>generate-siardk-128</id>
<goals>
Expand All @@ -104,20 +147,16 @@
<schemaIncludes>
<include>archiveIndex.xsd</include>
<include>docIndex.xsd</include>
<include>contextDocumentationIndex.xsd</include>
<include>fileIndex.xsd</include>
<include>researchIndex.xsd</include>
<include>XMLSchema.xsd</include>
<include>tableIndex.xsd</include>
</schemaIncludes>
<forceRegenerate>true</forceRegenerate>

<!-- specifically specify each binding to use in conversion -->
<bindingDirectory>${basedir}/src/main/resources/config/jaxb</bindingDirectory>
<bindingIncludes>
<include>*.xjb</include>
</bindingIncludes>
<!--generate java classes-->
<generateDirectory>${project.build.directory}/generated-sources/xjc</generateDirectory>
<generateDirectory>${project.build.directory}/generated-sources/xjc-b
</generateDirectory>

<!-- The package of your generated sources -->
<generatePackage>com.databasepreservation.modules.siard.bindings.${packagename}</generatePackage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.xml.sax.SAXException;

import com.databasepreservation.model.exception.ModuleException;
import com.databasepreservation.modules.siard.bindings.siard_dk_1007.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_1007.context.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.constants.SIARDDKConstants;
import com.databasepreservation.modules.siard.in.path.SIARDDKPathImportStrategy;
import com.databasepreservation.modules.siard.in.read.FolderReadStrategyMD5Sum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.xml.sax.SAXException;

import com.databasepreservation.model.exception.ModuleException;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.context.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.DocIndexType;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.DocumentType;
import com.databasepreservation.modules.siard.constants.SIARDDKConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javax.xml.validation.TypeInfoProvider;
import javax.xml.validation.ValidatorHandler;

import com.databasepreservation.modules.siard.validate.common.ZipFileManager;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
Expand Down Expand Up @@ -221,7 +222,7 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont
}
} else if (table.getId().contains(SIARDDKConstants.CONTEXT_DOCUMENTATION_VIRTUAL_TABLE_NAME)) {
try {
populateContextDocumentationTable(table);
populateContextDocumentationTable(table, databaseStructure.getName().replace(" ", ""));
} catch (FileNotFoundException e) {
throw new ModuleException()
.withMessage(
Expand All @@ -236,7 +237,7 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont

}

void populateContextDocumentationTable(TableStructure table) throws ModuleException, FileNotFoundException {
void populateContextDocumentationTable(TableStructure table, String dbName) throws ModuleException, FileNotFoundException {
F contextDoc = loadContextDocTableContent();
currentTable = table;
this.dbExportHandler.handleDataOpenTable(table.getId());
Expand All @@ -260,20 +261,19 @@ void populateContextDocumentationTable(TableStructure table) throws ModuleExcept
getDocumentDate(doc));
cells[cellCounter] = documentDateCell;
cellCounter++;
//String binPath;
String binPath = pathStrategy.getMainFolder().getPath().toString() + SIARDDKConstants.RESOURCE_FILE_SEPARATOR
String binPath = "";
String docPath = pathStrategy.getMainFolder().getPath().toString() + SIARDDKConstants.RESOURCE_FILE_SEPARATOR
+ SIARDDKConstants.CONTEXT_DOCUMENTATION_FOLDER_NAME + SIARDDKConstants.RESOURCE_FILE_SEPARATOR
+ SIARDDKConstants.DOC_COLLECTION_FOLDER_NAME + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + getDocumentID(doc)
+ SIARDDKConstants.RESOURCE_FILE_SEPARATOR + "1.tif";
// File docFolder = new File(docPath);
// if (docFolder.exists() && docFolder.isDirectory()) {
// File[] fileList = docFolder.listFiles();
// if (fileList != null && fileList.length == 1) {
// binPath = docPath + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + fileList[0].getName();
// } else {
//
// }
// }
+ SIARDDKConstants.DOC_COLLECTION_FOLDER_NAME + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + getDocumentID(doc);
File docFolder = new File(docPath);
if (docFolder.exists() && docFolder.isDirectory()) {
File[] fileList = docFolder.listFiles();
if (fileList != null && fileList.length == 1) {
binPath = docPath + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + fileList[0].getName();
} else if (fileList != null && fileList.length > 1){
binPath = docPath;
}
}
try {
Cell blobCell = new BinaryCell(
SIARDDKConstants.BLOB_EXTENSION + SIARDDKConstants.FILE_EXTENSION_SEPARATOR + rowCounter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import com.databasepreservation.model.structure.virtual.VirtualPrimaryKey;
import com.databasepreservation.model.structure.virtual.VirtualTableStructure;
import com.databasepreservation.modules.siard.bindings.siard_dk_1007.ArchiveIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_1007.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_1007.context.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.common.SIARDArchiveContainer;
import com.databasepreservation.modules.siard.constants.SIARDDKConstants;
import com.databasepreservation.modules.siard.in.metadata.typeConverter.SQL99StandardDatatypeImporter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ArchiveIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ColumnType;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ColumnsType;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.context.ContextDocumentationIndex;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.DocIndexType;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ForeignKeyType;
import com.databasepreservation.modules.siard.bindings.siard_dk_128.ForeignKeysType;
Expand Down

0 comments on commit d2777a5

Please sign in to comment.