Unfortunately leaving these out would violate a must condition in the assignment instructions, namely: 'Your data access class [...] must implement the following interface [...]'. That interface gives specific requirements for what the lock method must do, and being an interface it provides a contract between your Data class and any users of your Data class. Failing to implement the interface could result in automatic failure.
If I use a versions table to implement an Optimistic Locking mechanism I don’t think there will be a need to implement:
public void lock(int recNo)
public void unlock(int recNo)
public boolean isLocked(int recNo)
Article J2SE 5.0 in a Nutshell
Java 2 Platform Standard Edition (J2SE) 5.0 ("Tiger")
Throughout this exercise, you must use exclusively the Java 2 platform. You may develop your code using any implementation of the Java 2 platform, but the submission that you return must have been tested and shown to work under a production (not development) version of the Sun Microsystems' Java 2 platform and that platform must not have been superseded by a new production version for more than 18 months by the time you make your submission.
The Sun website says that you may not use NIO, but most (if not all) of the current instructions do not have this restriction. The official word from Sun is that if your instructions do not forbid the use of NIO, then you may use it in your submission.
Careful with FileChannel - this is part of the java.nio package which is not to be used in the development of the project.
APIs relevant to the assignment
The assignment generally requires that you can write code using the Java programming language, using any and all constructions. You must also be able to make reasonable use of the following additional facilities and APIs:
* Thread handling and synchronization
* Swing (and AWT to the extent necessary to support Swing)
* Standard file IO (java.io, not java.nio)
* Either: Socket-based network programming and serialization _or_ Java RMI (Java Remote Method Invocation) (your choice of one or the other, not both).
The following APIs and facilities may not be used:
* Enterprise JavaBeans
* Servlets, JSP technology, or any other web-oriented APIs
* NIO, the New IO facilities
* Java DataBase Connectivity (JDBC) and SQL
* Java IDL API and CORBA
* Third party software libraries or tools (such as browsers)