public String migratePolicy(InputStream stream, String url)
throws ResourceMigrationException, IOException {
NotificationFactory notificationFactory =
NotificationFactory.getDefaultInstance();
ConfigFactory configFactory = ConfigFactory.getDefaultInstance();
FrameworkFactory frameworkFactory =
FrameworkFactory.getDefaultInstance();
NotificationReporter notifier =
notificationFactory.createLogDispatcherReporter(logger);
ByteArrayOutputCreator outputCreator = new ByteArrayOutputCreator();
ResourceMigrator migrator = configFactory.createDefaultResourceMigrator(
notifier, true);
InputMetadata meta = frameworkFactory.createInputMetadata(url, false);
migrator.migrate(meta, stream, outputCreator);
return outputCreator.getOutputStream().toString();
}