use of org.apache.derby.iapi.sql.depend.Dependency in project derby by apache.
the class BasicDependencyManager method getDependencyDescriptorList.
/**
* Turn a list of DependencyDescriptors into a list of Dependencies.
*
* @param storedList The List of DependencyDescriptors representing
* stored dependencies.
* @param providerForList The provider if this list is being created
* for a list of dependents. Null otherwise.
*
* @return List The converted List
*
* @exception StandardException thrown if something goes wrong
*/
private List<Dependency> getDependencyDescriptorList(List<DependencyDescriptor> storedList, Provider providerForList) throws StandardException {
List<Dependency> retval = new ArrayList<Dependency>();
if (!storedList.isEmpty()) {
/* For each DependencyDescriptor, we need to instantiate
* object descriptors of the appropriate type for both
* the dependent and provider, create a Dependency with
* that Dependent and Provider and substitute the Dependency
* back into the same place in the List
* so that the call gets an enumerations of Dependencys.
*/
for (DependencyDescriptor depDesc : storedList) {
Dependent tempD;
Provider tempP;
DependableFinder finder = depDesc.getDependentFinder();
tempD = (Dependent) finder.getDependable(dd, depDesc.getUUID());
if (providerForList != null) {
// Use the provider being passed in.
tempP = providerForList;
// Sanity check the object identifiers match.
if (SanityManager.DEBUG) {
if (!tempP.getObjectID().equals(depDesc.getProviderID())) {
SanityManager.THROWASSERT("mismatch providers");
}
}
} else {
finder = depDesc.getProviderFinder();
tempP = (Provider) finder.getDependable(dd, depDesc.getProviderID());
}
retval.add(new BasicDependency(tempD, tempP));
}
}
return retval;
}
use of org.apache.derby.iapi.sql.depend.Dependency in project derby by apache.
the class BasicDependencyManager method getProviders.
/**
* Returns a list of all providers that this dependent has (even invalid
* ones). Includes all dependency types.
*
* @param d the dependent
* @return A list of providers (possibly empty).
* @throws StandardException thrown if something goes wrong
*/
private List<Provider> getProviders(Dependent d) throws StandardException {
List<Provider> provs = new ArrayList<Provider>();
synchronized (this) {
List deps = (List) dependents.get(d.getObjectID());
if (deps != null) {
Iterator depsIter = deps.iterator();
while (depsIter.hasNext()) {
provs.add(((Dependency) depsIter.next()).getProvider());
}
}
}
// into consideration as well.
if (d.isPersistent()) {
List<Dependency> storedList = getDependencyDescriptorList(dd.getDependentsDescriptorList(d.getObjectID().toString()), (Provider) null);
Iterator<Dependency> depIter = storedList.iterator();
while (depIter.hasNext()) {
provs.add((depIter.next()).getProvider());
}
}
return provs;
}
Aggregations