Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package backer;
- /**
- * Class that contains all the constants that
- * Backer needs to run.
- *
- * @author João Loureiro
- */
- public class Constants {
- /** Size of the array that is used in the DatagramPackets. */
- public static final int DATAGRAM_DATA_SIZE = 65500;
- /** Offset used for the extraction of data from a DatagramPacket. */
- public static final int DATAGRAM_DATA_OFFSET = 0;
- /** Message type that a peer sends when backing up a chunk. */
- public static final String PUTCHUNK = "PUTCHUNK";
- public static final int PUTCHUNK_MAX_ATTEMPTS = 5;
- public static final String STORED = "STORED";
- /** Version 1.0 */
- public static final String VERSION_1_0 = "1.0";
- /** Header terminator string. */
- public static final String CRLF = "\r\n\r\n";
- /** Encoding used in the packets exchanged. */
- public static final String ENCODING = "ISO-8859-1";
- /** Regex that represents whitespaces */
- public static final String WHITESPACE_REGEX = "\\s";
- public static final long ONE_SECOND = 1000;
- public static final int SENDER_ID_LIMIT = 1000;
- public static final int FOUR_HUNDRED_MILLISECONDS = 400;
- public static final String PEER_DATABASE_NAME = "peer.db";
- public static final String PEER_DATABASE_TABLE = "CREATE TABLE `Chunk` ( `ID` TEXT NOT NULL, `size` INTEGER NOT NULL, `perceived_replication_degree` INTEGER NOT NULL, PRIMARY KEY(`ID`));";
- public static final String PEER_DATABASE_TABLE_CHECK = "SELECT name FROM sqlite_master WHERE type='table' AND name='Chunk';";
- public static final String PEER_DATABASE_TABLE_CHECK_COLUMNS = "PRAGMA table_info(Chunk)";
- public static final String PEER_DATABASE_SELECT = "SELECT * FROM Chunk WHERE ID='%s%s';";
- public static final String PEER_DATABASE_INSERT = "INSERT INTO `Chunk`(`ID`,`size`, `perceived_replication_degree`) VALUES ('%s%s',%d,%d);";
- public static final String DATABASE_DIRECTORY = "build/";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement