//CYCLONE MATRIX HOST NODE APPLICATION
//Hermann L. Johnson, 2019
//Free for unmodified distribution and non-commercial use.
import java.io.*;
import java.util.*;
public class DataManager {
public DataManager(String root_directory) {
}
//Use special methods to stop data files from being corrupted in case
//of shutdown.
//THE SERVER'S DATAMANAGER CANNOT REORDER ITS DATA IN THE MIDST OF A CLIENT
//CONNECTION, at least as far as that client is concerned.
public Vector<String> getIndex() {
Vector<String> index = new Vector<String>();
index.addElement("text index entry");
return index;
}
//Does not want an extension.
//Provides header hashes as well.
public Vector<String> getHashList(String dataFile) {
Vector<String> results = new Vector<String>();
System.err.println("Data manager is supposed to yield all hashes of "+dataFile);
results.addElement("hashlist for "+dataFile);
return results;
}
//Does not want an extension.
public Vector<String> getHeaderHashList(String dataFile) {
Vector<String> results = new Vector<String>();
results.addElement("header hash list for "+dataFile);
return results;
}
//Returns 1 if the exact datafile is on hand.
//Returns 2 if the datafile is on hand, but is not exact.
//Returns 0 if the datafile is non-existent.
public int hasExactDataFile(String abbrLocation, String entriesDate,
String fileSha) {
System.err.println("Data manager: "+abbrLocation+" "+entriesDate+" "+fileSha+" is being queried, we are claiming that it is on hand, but not exact.");
return 2;
}
//Does not want an extension.
//This would also yield a header entry that is requested by hash.
public String getDataEntry(String dataFileName, String identifyingHash) {
System.err.println("Data manager is supposed to yield entry: "+identifyingHash);
return "This is a test line being pulled by getDataEntry!!!!!!!!%LBR%";
}
//Does not want an extension.
//This also includes header entries.
public Vector<String> getDataEntries(String dataFileName,
String hashSpan) {
int dashLocation = 0;
String firstHash = new String("");
String secondHash = new String("");
Vector<String> results = new Vector<String>();
//If it was called with no dash, return nothing.
if(!hashSpan.contains("-")) return results;
System.err.println("data manager is supposed to yield hash span request: "+firstHash+" - "+secondHash);
//Get the entries..
results.addElement("dataentries for "+dataFileName+" hashspan: "+hashSpan);
return results;
}
//This also accepts header entries.
public void takeDataLine(String line) {
System.err.println("Data manager taking: "+line);
}
//NOTE: If a date-time is not found where it should be, but is found in the
//next location as to imply that the hash
//was included, remove the hash from said inbound entry.
//ALSO! Headers must be considered, their format is different!