}
/* Generate the UUID for the backing index. This will become the
* constraint's name, if no name was specified.
*/
UUIDFactory uuidFactory = dd.getUUIDFactory();
/* Create the index, if there's one for this constraint */
if (indexAction != null)
{
if ( indexAction.getIndexName() == null )
{
/* Set the index name */
backingIndexName = uuidFactory.createUUID().toString();
indexAction.setIndexName(backingIndexName);
}
else { backingIndexName = indexAction.getIndexName(); }
/* Create the index */
indexAction.executeConstantAction(activation);
/* Get the conglomerate descriptor for the backing index */
conglomDescs = td.getConglomerateDescriptors();
for (int index = 0; index < conglomDescs.length; index++)
{
conglomDesc = conglomDescs[index];
/* Check for conglomerate being an index first, since
* name is null for heap.
*/
if (conglomDesc.isIndex() &&
backingIndexName.equals(conglomDesc.getConglomerateName()))
{
break;
}
}
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(conglomDesc != null,
"conglomDesc is expected to be non-null after search for backing index");
SanityManager.ASSERT(conglomDesc.isIndex(),
"conglomDesc is expected to be indexable after search for backing index");
SanityManager.ASSERT(conglomDesc.getConglomerateName().equals(backingIndexName),
"conglomDesc name expected to be the same as backing index name after search for backing index");
}
indexId = conglomDesc.getUUID();
}
// if no constraintId was specified, we should generate one. this handles
// the two cases of Source creation and Target replication. At the source
// database, we allocate a new UUID. At the Target, we just use the UUID that
// the Source sent along.
UUID constraintId = uuidFactory.createUUID();
/* Now, lets create the constraint descriptor */
DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
switch (constraintType)
{