synchronized (this)
{
long now = System.currentTimeMillis();
// Get fully-qualified name for this table (regardless of whether it is specified by user)
DatastoreIdentifier tableId = ((AbstractTable)table).getDatastoreIdentifierFullyQualified();
List cols = null;
// Check if we already have valid info for this table in the cache
if (now >= columnInfoReadTimestamp &&
now < columnInfoReadTimestamp + COLUMN_INFO_EXPIRATION_MS)
{
cols = (List) columnInfoByColumnName.get(tableId.getIdentifier()+column.getIdentifier());
if (cols != null)
{
for(int i=0; i<cols.size(); i++)
{
String[] c = RDBMSStoreHelper.splitColumnIdentifierName(((RDBMSAdapter)this.getDatastoreAdapter()).getCatalogSeparator(), column.getIdentifier());
String columnName = column.getIdentifier();
if (c[RDBMSStoreHelper.TABLE_IDENTIFIER_COLUMN] != null)
{
columnName = c[RDBMSStoreHelper.TABLE_IDENTIFIER_COLUMN];
}
ColumnInfo ci = (ColumnInfo) cols.get(i);
if (ci.getColumnName().equals(columnName))
{
colInfo = ci;
}
}
}
}
// Refresh the cache if we have no/stale info for that table
if (cols == null)
{
//TODO have a cache of columnInfo by column name
colInfo = RDBMSStoreHelper.getColumnInfoForColumnName(this, table, conn, column);
if (colInfo == null)
{
JPOXLogger.DATASTORE_SCHEMA.info(LOCALISER_RDBMS.msg("050031", column.getIdentifier(), table));
}
else
{
columnInfoByColumnName.put(tableId.getIdentifier()+column.getIdentifier(), colInfo);
if (JPOXLogger.DATASTORE_SCHEMA.isDebugEnabled())
{
JPOXLogger.DATASTORE_SCHEMA.debug(LOCALISER_RDBMS.msg("050033", colInfo.getColumnName(), table));
}
}