com.joanju.cg.db
Class CuFileTable

java.lang.Object
  extended by com.joanju.cg.db.CuFileTable

public class CuFileTable
extends java.lang.Object

Provides inter-package un-cached access to the cufile table.

Not part of the public API. The cufile table is for compile unit file names. It maps the an id for a lowercase entry from the string table to a mixed case (case-sensitive) compile unit file name. Needed for finding mixed or upper case file names on unix. Is used for working with sets of cu file names, for example, for 'build' sets.


Constructor Summary
CuFileTable()
           
 
Method Summary
static void delete(java.lang.String filename)
          Delete a filename entry from the table if it's there.
static void insert(int cuid, java.lang.String filename)
          Insert a filename entry with a given CUID.
static int insertIfNew(java.lang.String filename)
          Insert a filename entry if it's not already there.
static java.io.File lookupFile(int cuid)
          Lookup the filename for a CUID and return a File for it.
static java.io.File lookupFile(java.lang.String lowername)
          Lookup an entry for an input lowercase name and return a File for it.
static java.lang.String lookupFilename(int cuid)
          Lookup the mixed-case filename for a CUID.
static java.lang.String lookupFilename(java.lang.String lowername)
          Lookup a mixed-case filename from a lowercase string.
static int lookupId(java.lang.String filename)
          Lookup the string id (cuid) for an input CU filename.
static java.util.ArrayList<java.lang.String> queryLike(java.lang.String like)
          Get an ArrayList of filenames matching an SQL LIKE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CuFileTable

public CuFileTable()
Method Detail

delete

public static void delete(java.lang.String filename)
                   throws java.sql.SQLException
Delete a filename entry from the table if it's there.

Throws:
java.sql.SQLException

insert

public static void insert(int cuid,
                          java.lang.String filename)
                   throws java.sql.SQLException
Insert a filename entry with a given CUID. Deletes any old entry that it replaces.

Throws:
java.sql.SQLException

insertIfNew

public static int insertIfNew(java.lang.String filename)
                       throws java.sql.SQLException
Insert a filename entry if it's not already there. Convenience method which takes care of getting the cuid from the StringTable. Returns the CUID.

Throws:
java.sql.SQLException

lookupId

public static int lookupId(java.lang.String filename)
                    throws java.sql.SQLException
Lookup the string id (cuid) for an input CU filename. The input filename is case sensitive. (i.e. If the user has written their application such that it's not portable to unix, this won't work!) Returns zero if it's not there.

Throws:
java.sql.SQLException

lookupFile

public static java.io.File lookupFile(int cuid)
                               throws java.sql.SQLException
Lookup the filename for a CUID and return a File for it. Just a convenience method. Does not test for exists(). Returns null if there's no filename entry for the cuid.

Throws:
java.sql.SQLException

lookupFile

public static java.io.File lookupFile(java.lang.String lowername)
                               throws java.sql.SQLException
Lookup an entry for an input lowercase name and return a File for it. Just a convenience method. Does not test for exists(). Returns null if there's no StringTable entry or CuFileTable entry.

Throws:
java.sql.SQLException

lookupFilename

public static java.lang.String lookupFilename(int cuid)
                                       throws java.sql.SQLException
Lookup the mixed-case filename for a CUID. Returns null if it's not there.

Throws:
java.sql.SQLException

lookupFilename

public static java.lang.String lookupFilename(java.lang.String lowername)
                                       throws java.sql.SQLException
Lookup a mixed-case filename from a lowercase string. Just a convenience method which takes care of looking up the lowercase string id from the StringTable. Returns null if there's no StringTable entry or no CuFileTable entry.

Throws:
java.sql.SQLException

queryLike

public static java.util.ArrayList<java.lang.String> queryLike(java.lang.String like)
                                                       throws java.sql.SQLException
Get an ArrayList of filenames matching an SQL LIKE. (Match one char with _, match any number of chars with %.) ESCAPE is set to backspace '\b' to avoid collisions with file and directory names.

Throws:
java.sql.SQLException


Copyright © 2008 Joanju Software. All Rights Reserved.