retval.expectedCatalogVersion = context.catalog.getCatalogVersion();
// compute the diff in StringBuilder
CatalogDiffEngine diff = new CatalogDiffEngine(context.catalog, newCatalog);
if (!diff.supported()) {
throw new Exception("The requested catalog change is not a supported change at this time. " + diff.errors());
}
// since diff commands can be stupidly big, compress them here
retval.encodedDiffCommands = Encoder.compressAndBase64Encode(diff.commands());
// check if the resulting string is small enough to fit in our parameter sets (about 2mb)