use of org.apache.derby.iapi.services.uuid.UUIDFactory in project derby by apache.
the class CatalogRowFactory method initInfo.
/**
* Initialize info, including array of index names and array of
* index column counts. Called at constructor time.
*
* @param columnCount number of columns in the base table.
* @param catalogName name of the catalog (the case might have to be converted).
* @param indexColumnPositions 2 dim array of ints specifying the base
* column positions for each index.
* @param indexUniqueness Uniqueness of the indices
* @param uuidStrings Array of stringified UUIDs for table and its conglomerates
*/
public void initInfo(int columnCount, String catalogName, int[][] indexColumnPositions, boolean[] indexUniqueness, String[] uuidStrings) {
indexCount = (indexColumnPositions != null) ? indexColumnPositions.length : 0;
this.catalogName = catalogName;
this.columnCount = columnCount;
UUIDFactory uf = getUUIDFactory();
this.tableUUID = uf.recreateUUID(uuidStrings[0]);
this.heapUUID = uf.recreateUUID(uuidStrings[1]);
if (indexCount > 0) {
indexNames = new String[indexCount];
indexUUID = new UUID[indexCount];
for (int ictr = 0; ictr < indexCount; ictr++) {
indexNames[ictr] = generateIndexName(ictr);
indexUUID[ictr] = uf.recreateUUID(uuidStrings[ictr + 2]);
}
this.indexColumnPositions = ArrayUtil.copy2(indexColumnPositions);
this.indexUniqueness = ArrayUtil.copy(indexUniqueness);
}
}
use of org.apache.derby.iapi.services.uuid.UUIDFactory in project derby by apache.
the class BasicDatabase method makeDatabaseID.
protected UUID makeDatabaseID(boolean create, Properties startParams) throws StandardException {
TransactionController tc = af.getTransaction(getContextService().getCurrentContextManager());
String upgradeID = null;
UUID databaseID;
if ((databaseID = (UUID) tc.getProperty(DataDictionary.DATABASE_ID)) == null) {
// no property defined in the Transaction set
// this could be an upgrade, see if it's stored in the service set
UUIDFactory uuidFactory = getMonitor().getUUIDFactory();
upgradeID = startParams.getProperty(DataDictionary.DATABASE_ID);
if (upgradeID == null) {
// just create one
databaseID = uuidFactory.createUUID();
} else {
databaseID = uuidFactory.recreateUUID(upgradeID);
}
tc.setProperty(DataDictionary.DATABASE_ID, databaseID, true);
}
// property set.
if (upgradeID != null)
startParams.remove(DataDictionary.DATABASE_ID);
tc.commit();
tc.destroy();
return databaseID;
}
use of org.apache.derby.iapi.services.uuid.UUIDFactory in project derby by apache.
the class DataDictionaryImpl method initializeCoreInfo.
/**
* Initialized the core info array.
*/
private void initializeCoreInfo() throws StandardException {
TabInfoImpl[] lcoreInfo = coreInfo = new TabInfoImpl[NUM_CORE];
UUIDFactory luuidFactory = uuidFactory;
lcoreInfo[SYSTABLES_CORE_NUM] = new TabInfoImpl(new SYSTABLESRowFactory(luuidFactory, exFactory, dvf));
lcoreInfo[SYSCOLUMNS_CORE_NUM] = new TabInfoImpl(new SYSCOLUMNSRowFactory(this, luuidFactory, exFactory, dvf));
lcoreInfo[SYSCONGLOMERATES_CORE_NUM] = new TabInfoImpl(new SYSCONGLOMERATESRowFactory(luuidFactory, exFactory, dvf));
lcoreInfo[SYSSCHEMAS_CORE_NUM] = new TabInfoImpl(new SYSSCHEMASRowFactory(luuidFactory, exFactory, dvf));
}
use of org.apache.derby.iapi.services.uuid.UUIDFactory in project derby by apache.
the class DataDictionaryImpl method getNonCoreTIByNumber.
/**
* returns the tabinfo for a non core system catalog. Input is a
* catalogNumber (defined in DataDictionary).
*/
protected TabInfoImpl getNonCoreTIByNumber(int catalogNumber) throws StandardException {
int nonCoreNum = catalogNumber - NUM_CORE;
// Look up the TabInfoImpl in the array. This does not have to be
// synchronized, because getting a reference is atomic.
TabInfoImpl retval = noncoreInfo[nonCoreNum];
if (retval == null) {
// If we did not find the TabInfoImpl, get the right one and
// load it into the array. There is a small chance that
// two threads will do this at the same time. The code will
// work properly in that case, since storing a reference
// is atomic (although we could get extra object instantiation
// if two threads come through here at the same time.
UUIDFactory luuidFactory = uuidFactory;
switch(catalogNumber) {
case SYSCONSTRAINTS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSCONSTRAINTSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSKEYS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSKEYSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSDEPENDS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSDEPENDSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSVIEWS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSVIEWSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSCHECKS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSCHECKSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSFOREIGNKEYS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSFOREIGNKEYSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSSTATEMENTS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSSTATEMENTSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSFILES_CATALOG_NUM:
retval = new TabInfoImpl(new SYSFILESRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSALIASES_CATALOG_NUM:
retval = new TabInfoImpl(new SYSALIASESRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSTRIGGERS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSTRIGGERSRowFactory(this, luuidFactory, exFactory, dvf));
break;
case SYSSTATISTICS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSSTATISTICSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSDUMMY1_CATALOG_NUM:
retval = new TabInfoImpl(new SYSDUMMY1RowFactory(luuidFactory, exFactory, dvf));
break;
case SYSTABLEPERMS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSTABLEPERMSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSCOLPERMS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSCOLPERMSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSROUTINEPERMS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSROUTINEPERMSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSROLES_CATALOG_NUM:
retval = new TabInfoImpl(new SYSROLESRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSSEQUENCES_CATALOG_NUM:
retval = new TabInfoImpl(new SYSSEQUENCESRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSPERMS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSPERMSRowFactory(luuidFactory, exFactory, dvf));
break;
case SYSUSERS_CATALOG_NUM:
retval = new TabInfoImpl(new SYSUSERSRowFactory(luuidFactory, exFactory, dvf));
break;
}
initSystemIndexVariables(retval);
noncoreInfo[nonCoreNum] = retval;
}
return retval;
}
use of org.apache.derby.iapi.services.uuid.UUIDFactory in project derby by apache.
the class SYSSTATISTICSRowFactory method buildDescriptor.
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentDesc, DataDictionary dd) throws StandardException {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(row.nColumns() == SYSSTATISTICS_COLUMN_COUNT, "Wrong number of columns for a SYSSTATISTICS row");
}
DataValueDescriptor col;
String scratch;
UUIDFactory uuidFactory = getUUIDFactory();
UUID statUUID, statReferenceUUID, statTableUUID;
String statName;
/* 1st column is UUID */
col = row.getColumn(SYSSTATISTICS_ID);
scratch = col.getString();
statUUID = uuidFactory.recreateUUID(scratch);
/* 2nd column is reference UUID */
col = row.getColumn(SYSSTATISTICS_REFERENCEID);
scratch = col.getString();
statReferenceUUID = uuidFactory.recreateUUID(scratch);
/* 3rd column is table UUID */
col = row.getColumn(SYSSTATISTICS_TABLEID);
scratch = col.getString();
statTableUUID = uuidFactory.recreateUUID(scratch);
/* 4th column is timestamp */
col = row.getColumn(SYSSTATISTICS_TIMESTAMP);
Timestamp updateTime = (Timestamp) col.getObject();
/* 5th column is stat type -- string */
col = row.getColumn(SYSSTATISTICS_TYPE);
String statType = col.getString();
/* 6th column is stat valid -- boolean */
col = row.getColumn(SYSSTATISTICS_VALID);
boolean valid = col.getBoolean();
/* 7th column is column count */
col = row.getColumn(SYSSTATISTICS_COLCOUNT);
int columnCount = col.getInt();
/* 8th column is statistics itself */
col = row.getColumn(SYSSTATISTICS_STAT);
Statistics stat = (Statistics) col.getObject();
return new StatisticsDescriptor(dd, statUUID, statReferenceUUID, // statName, colMap,
statTableUUID, statType, stat, columnCount);
}
Aggregations