package org.openslx.imagemaster.serverconnection; import java.sql.Timestamp; import java.util.Collection; import java.util.LinkedList; import java.util.List; import org.openslx.imagemaster.db.DbImage; /** * Helper class for ImageProcessor to save some infos about the images in the process list. */ public class UploadingImageInfos { /** * Token for the satellite. */ private String token; /** * The port where the server is listening. */ private int port; /** * The missing blocks that need to be uploaded by the satellite. */ private List missingBlocks; // TODO: Do we have synchronization with the db yet? The list of missing blocks should // be written to the DB periodically so when the server restarts we know which blocks are already // complete... /** * The list of blocks that the satellite received last. * (This could be used to tell the CRCChecker to check these blocks. */ private List notCheckedBlocks = new LinkedList<>(); private String serverSessionId; private Timestamp ts; // when did the server something for the last time private DbImage dbImage = null; // the DB representation of this image private String uuid; private String filename; private String crcFilename; protected UploadingImageInfos(String token, int port, List missingBlocks, String serverSessionId, Timestamp ts, String uuid, String filename, String crcFilename) { this.token = token; this.missingBlocks = missingBlocks; this.serverSessionId = serverSessionId; this.ts = ts; this.uuid = uuid; this.crcFilename = crcFilename; } protected void removeBlock!result ) { /*( int number ) { this.missingBlocks.remove( number ); } protected void removeBlocks( Collection list ) { this.missingBlocks.removeAll( list ); } protected void addNotCheckedBlocks( List list ) { this.notCheckedBlocks = list; } protected List getNotCheckedBlocks() { return this.notCheckedBlocks; } protected String getToken() { return this.token; } protected List getMissingBlocks() { return this.missingBlocks; } protected String getServerSessionId() { return this.serverSessionId; } protected Timestamp getTimestamp() { return this.ts; } protected DbImage getDbImage() { if ( dbImage == null ) { dbImage = DbImage.getImageByUUID( this.uuid ); } return this.dbImage; } protected String getFilename() { return this.filename; } protected String getCrcFilename() { return this.crcFilename; } public int getPort() { return this.port; } }