edu.uiuc.ncsa.security.storage.sql.package.html Maven / Gradle / Ivy
Classes that setup a specific type of correspondence between java objects and rows of an SQL table.
What does this all do?
One of the most commonly used constructs in Java is a map which associates keys and values (which are java objects).
This is very simply modelled in SQL by having each row of a database correspond to the object and allows us
to manage the data in tables as objects. This special case is pretty easy to manage and this package will
do most all of the grunt work in setting up databases and object creation for you.
How to implement your own example.
- Make your object implement the {@link edu.uiuc.ncsa.security.core.Identifiable} interface. This gives a
way to track objects by unique identifier. This identifier should be the primary key for your database.
- Make a class that extends {@link edu.uiuc.ncsa.security.storage.sql.Table} (or implements
{@link edu.uiuc.ncsa.security.storage.sql.TableInterface}, which is a bit harder). Assuming you
are extending Table, you need to implement one, single method called
{@link edu.uiuc.ncsa.security.storage.sql.TableInterface.createColumnDescriptors}. This tells the
system what columns it should create and what types they have.
- Extend {@link edu.uiuc.ncsa.security.storage.sql.SQLStore}. This has a couple of methods called
populate and depopulate. These methods tell how to take one of your objects and "populate"
it, i.e., set the values. "depopulate" tells how to get the values. read the documentation there.
Once this is done,you should be able to just use one of the admin clients to create your database.