Package edu.uiuc.ncsa.security.storage.sql

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.

  1. Make your object implement the Identifiable interface. This gives a way to track objects by unique identifier. This identifier should be the primary key for your database. FYI: A standard uuid can be used as an identifer, just pass it as a string.
  2. Make a class that extends edu.uiuc.ncsa.security.storage.sql.Table (or implements 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 edu.uiuc.ncsa.security.storage.sql.TableInterface.createColumnDescriptors. This tells the system what columns it should create and what types they have.
  3. Extend 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.