context.getTransactionManager().setTransactionTimeout(86400);
context.beginTransaction();
for (Iterator dataSourceItr = metadata.getDataSourceIterator(); dataSourceItr.hasNext();)
{
DataSource dataSource = (DataSource)dataSourceItr.next();
if (dataSource.isEnabled() && dataSource.getComponent() != null)
{
for (Iterator fragmentItr = dataSource.getFragmentIterator(); fragmentItr.hasNext();)
{
DataSourceFragment fragment = (DataSourceFragment)fragmentItr.next();
String sFragment = (fragment.getName() == null) ? "" : fragment.getName();
context.setFragmentName(sFragment);
SchemaVersion version = ((PersistenceAdapter)dataSource.getComponent()
.getInstance(context)).getVersion(dataSource.getSchema());
if (version != null)
{
if (!metadata.getNamespace().equals(version.getNamespace()))
{
throw new PersistenceException("err.persistence.storageNamespace",
new Object[]{version.getNamespace(), dataSource.getName(),
sFragment, metadata.getNamespace()});
}
if (!metadata.getVersion().equals(version.getVersion()))
{
throw new PersistenceException("err.persistence.storageVersion",
new Object[]{version.getVersion(), dataSource.getName(),
sFragment, metadata.getVersion(), metadata.getNamespace()});
}
}
}
}