Package edu.caltech.nanodb.commands
Class VerifyCommand
- java.lang.Object
-
- edu.caltech.nanodb.commands.Command
-
- edu.caltech.nanodb.commands.VerifyCommand
-
public class VerifyCommand extends Command
This Command class represents the VERIFY SQL command, which verifies a table's representation (along with any indexes) to ensure that all structural details are valid. This is not a standard SQL command, but it is very useful for verifying student implementations of file structures.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.caltech.nanodb.commands.Command
Command.Type
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private java.util.LinkedHashSet<java.lang.String>
tableNames
Table names are kept in a set so that we don't need to worry about a particular table being specified multiple times.
-
Constructor Summary
Constructors Constructor Description VerifyCommand()
Construct a new VERIFY command with an empty table list.VerifyCommand(java.lang.String tableName)
Construct a new VERIFY command to verify the specified table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTable(java.lang.String tableName)
Add a table to the list of tables to verify.void
execute(NanoDBServer server)
Actually performs the command.java.util.Set<java.lang.String>
getTableNames()
Returns the set of tables to verify in an unmodifiable set.java.lang.String
toString()
Prints a simple representation of the verify command, including the names of the tables to be verified.-
Methods inherited from class edu.caltech.nanodb.commands.Command
getCommandType
-
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
A logging object for reporting anything interesting that happens.
-
tableNames
private java.util.LinkedHashSet<java.lang.String> tableNames
Table names are kept in a set so that we don't need to worry about a particular table being specified multiple times.
-
-
Constructor Detail
-
VerifyCommand
public VerifyCommand()
Construct a new VERIFY command with an empty table list. Tables can be added to the internal list using theaddTable(java.lang.String)
method.
-
VerifyCommand
public VerifyCommand(java.lang.String tableName)
Construct a new VERIFY command to verify the specified table.- Parameters:
tableName
- the name of the table to verify.
-
-
Method Detail
-
addTable
public void addTable(java.lang.String tableName)
Add a table to the list of tables to verify.- Parameters:
tableName
- the name of the table to verify.
-
getTableNames
public java.util.Set<java.lang.String> getTableNames()
Returns the set of tables to verify in an unmodifiable set.- Returns:
- the set of tables to verify in an unmodifiable set.
-
execute
public void execute(NanoDBServer server) throws ExecutionException
Description copied from class:Command
Actually performs the command.- Specified by:
execute
in classCommand
- Throws:
ExecutionException
- if an issue occurs during command execution
-
toString
public java.lang.String toString()
Prints a simple representation of the verify command, including the names of the tables to be verified.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representing this verify command
-
-