Remove/change some public methods.

This commit is contained in:
Ann Priestman 2017-11-14 11:32:19 -05:00
parent a46d369f7e
commit 2bb24e3d4d
3 changed files with 31 additions and 55 deletions

View File

@ -150,11 +150,11 @@ public class EamGlobalSet {
* Return the FileKnown status as a KnownFilesType * Return the FileKnown status as a KnownFilesType
* @return KNOWN or KNOWN_BAD * @return KNOWN or KNOWN_BAD
*/ */
public HashDbManager.HashDatabase.KnownFilesType getKnownStatus(){ public HashDbManager.HashDb.KnownFilesType getKnownStatus(){
if(fileKnownStatus.equals(TskData.FileKnown.BAD)){ if(fileKnownStatus.equals(TskData.FileKnown.BAD)){
return HashDbManager.HashDatabase.KnownFilesType.KNOWN_BAD; return HashDbManager.HashDb.KnownFilesType.KNOWN_BAD;
} }
return HashDbManager.HashDatabase.KnownFilesType.KNOWN; return HashDbManager.HashDb.KnownFilesType.KNOWN;
} }
/** /**

View File

@ -692,11 +692,6 @@ public class HashDbManager implements PropertyChangeListener {
INDEXING_DONE INDEXING_DONE
} }
enum DatabaseType{
FILE,
CENTRAL_REPOSITORY
};
public String getHashSetName(); public String getHashSetName();
public String getDisplayName(); public String getDisplayName();
@ -709,11 +704,11 @@ public class HashDbManager implements PropertyChangeListener {
public boolean getDefaultSearchDuringIngest(); public boolean getDefaultSearchDuringIngest();
void setSearchDuringIngest(boolean useForIngest); public void setSearchDuringIngest(boolean useForIngest);
public boolean getSendIngestMessages(); public boolean getSendIngestMessages();
void setSendIngestMessages(boolean showInboxMessages); public void setSendIngestMessages(boolean showInboxMessages);
/** /**
* Indicates whether the hash database accepts updates. * Indicates whether the hash database accepts updates.
@ -750,8 +745,6 @@ public class HashDbManager implements PropertyChangeListener {
*/ */
public boolean isValid() throws TskCoreException; public boolean isValid() throws TskCoreException;
public int getHandle();
public String getIndexPath() throws TskCoreException; public String getIndexPath() throws TskCoreException;
public boolean hasIndexOnly() throws TskCoreException; public boolean hasIndexOnly() throws TskCoreException;
@ -762,14 +755,11 @@ public class HashDbManager implements PropertyChangeListener {
public void removePropertyChangeListener(PropertyChangeListener pcl); public void removePropertyChangeListener(PropertyChangeListener pcl);
void close() throws TskCoreException; public void close() throws TskCoreException;
@Override @Override
public String toString(); public String toString();
DatabaseType getDatabaseType();
} }
/** /**
@ -817,8 +807,7 @@ public class HashDbManager implements PropertyChangeListener {
propertyChangeSupport.removePropertyChangeListener(pcl); propertyChangeSupport.removePropertyChangeListener(pcl);
} }
@Override int getHandle(){
public int getHandle(){
return handle; return handle;
} }
@ -840,12 +829,8 @@ public class HashDbManager implements PropertyChangeListener {
public void setIndexing(boolean indexing){ public void setIndexing(boolean indexing){
this.indexing = indexing; this.indexing = indexing;
} }
@Override
public DatabaseType getDatabaseType(){
return DatabaseType.FILE;
}
@Override
public String getIndexPath() throws TskCoreException { public String getIndexPath() throws TskCoreException {
return SleuthkitJNI.getHashDatabaseIndexPath(handle); return SleuthkitJNI.getHashDatabaseIndexPath(handle);
} }
@ -996,7 +981,7 @@ public class HashDbManager implements PropertyChangeListener {
return hasIndex(); return hasIndex();
} }
public boolean hasIndex() throws TskCoreException { boolean hasIndex() throws TskCoreException {
return SleuthkitJNI.hashDatabaseHasLookupIndex(handle); return SleuthkitJNI.hashDatabaseHasLookupIndex(handle);
} }
@ -1005,11 +990,11 @@ public class HashDbManager implements PropertyChangeListener {
return SleuthkitJNI.hashDatabaseIsIndexOnly(handle); return SleuthkitJNI.hashDatabaseIsIndexOnly(handle);
} }
public boolean canBeReIndexed() throws TskCoreException { boolean canBeReIndexed() throws TskCoreException {
return SleuthkitJNI.hashDatabaseCanBeReindexed(handle); return SleuthkitJNI.hashDatabaseCanBeReindexed(handle);
} }
public boolean isIndexing() { boolean isIndexing() {
return indexing; return indexing;
} }
@ -1117,11 +1102,6 @@ public class HashDbManager implements PropertyChangeListener {
propertyChangeSupport.removePropertyChangeListener(pcl); propertyChangeSupport.removePropertyChangeListener(pcl);
} }
@Override
public int getHandle(){
return 0;
}
@Override @Override
public boolean hasIndexOnly() throws TskCoreException{ public boolean hasIndexOnly() throws TskCoreException{
return true; return true;
@ -1137,15 +1117,15 @@ public class HashDbManager implements PropertyChangeListener {
return getHashSetName() + " " + getVersion(); return getHashSetName() + " " + getVersion();
} }
public String getVersion(){ String getVersion(){
return version; return version;
} }
public String getOrgName(){ String getOrgName(){
return orgName; return orgName;
} }
public int getReferenceSetID(){ int getReferenceSetID(){
return referenceSetID; return referenceSetID;
} }
@ -1153,11 +1133,6 @@ public class HashDbManager implements PropertyChangeListener {
public String getDatabasePath() throws TskCoreException { public String getDatabasePath() throws TskCoreException {
return ""; return "";
} }
@Override
public DatabaseType getDatabaseType(){
return DatabaseType.CENTRAL_REPOSITORY;
}
@Override @Override
public String getIndexPath() throws TskCoreException { public String getIndexPath() throws TskCoreException {
@ -1311,7 +1286,6 @@ public class HashDbManager implements PropertyChangeListener {
* Returns whether this database can be enabled. * Returns whether this database can be enabled.
* *
* @return true if is valid, false otherwise * @return true if is valid, false otherwise
* @throws TskCoreException
*/ */
@Override @Override
public boolean isValid() { public boolean isValid() {

View File

@ -36,8 +36,8 @@ import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.XMLUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.DatabaseType;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.CentralRepoHashDb; import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.CentralRepoHashDb;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDatabase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -297,6 +297,11 @@ final class HashLookupSettings implements Serializable {
*/ */
static final class HashDbInfo implements Serializable { static final class HashDbInfo implements Serializable {
enum DatabaseType{
FILE,
CENTRAL_REPOSITORY
};
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final String hashSetName; private final String hashSetName;
private final HashDbManager.HashDatabase.KnownFilesType knownFilesType; private final HashDbManager.HashDatabase.KnownFilesType knownFilesType;
@ -466,7 +471,8 @@ final class HashLookupSettings implements Serializable {
return false; return false;
} }
if( ! this.dbType.equals(hashDb.getDatabaseType())){ if((this.dbType == DatabaseType.CENTRAL_REPOSITORY) && (! (hashDb instanceof CentralRepoHashDb))
|| (this.dbType == DatabaseType.FILE) && (! (hashDb instanceof HashDatabase))){
return false; return false;
} }
@ -474,19 +480,15 @@ final class HashLookupSettings implements Serializable {
return false; return false;
} }
if(this.dbType.equals(DatabaseType.FILE)){ if(hashDb instanceof CentralRepoHashDb){
// FILE types will always have unique names, so no more testing required CentralRepoHashDb crDb = (CentralRepoHashDb) hashDb;
return true; if(this.referenceSetID != crDb.getReferenceSetID()){
} return false;
}
// Central repo tests
CentralRepoHashDb crDb = (CentralRepoHashDb) hashDb; if(! version.equals(crDb.getVersion())){
if(this.referenceSetID != crDb.getReferenceSetID()){ return false;
return false; }
}
if(! version.equals(crDb.getVersion())){
return false;
} }
return true; return true;