Cataloger cataloger = Connector.getCataloger();
Map options = new HashMap();
Map metadata = new HashMap();
options.put(CatalogingOption.DONT_MAKE_DEFAULT_RENDITIONS, Boolean.TRUE);
URI uri = new URI("http://upload.wikimedia.org/wikipedia/meta/2/2a/Nohat-logo-nowords-bgwhite-200px.jpg");
String assetVersionUuid = cataloger.catalogFileAtURI(m_userAuth, uri, options, metadata);
cleanupAssetUuids.add(assetVersionUuid);
// After catalogFileAtURI() returns, the asset version will have a status of Status.IN_PROGRESS.
// When the asynchronous FRB tasks (thumbnailing, making proxies, embedded metadata and file property extraction)
// have completed, the status will change to Status.COMPLETE.
// No renditions will be auto-generated, there is no embedded metadata, and we don't care about file properties,
// so there's no reason to wait for the status to change.
// Now add the renditions.
// Create a bunch of random files to use as renditions
URI renditionURIs[] = new URI[] {
new URI("http://upload.wikimedia.org/wikipedia/meta/thumb/7/7c/Wikipedia-word.png/174px-Wikipedia-word.png"),
new URI("http://pl.wikipedia.org/images/wikimedia-button.png"),
new URI("http://pl.wikipedia.org/skins-1.5/common/images/poweredby_mediawiki_88x31.png")
};
String renditionUuid = "";
for(int i=0; i<renditionURIs.length; ++i) {
renditionUuid = cataloger.catalogRenditionAtURI(m_userAuth, assetVersionUuid, renditionURIs[i],
"story", new Long(i), Collections.EMPTY_MAP);
}
// Note that catalogRenditionAtURI is synchronous.
// The asset version now has 3 renditions, each with an index, 0-2.
// The renditions all have their scale attribute set to 'storyboard'.
// Information about an asset's renditions can be retrieved through the various
// getRendition...() methods in AssetManager. The rendition data itself
// can be accessed through the Download servlet with URLs like:
// http://localhost:8080/ems/Download?uuid=<assetVersionUuuid>&xpart=storyboard&idx=4
// Note that 'xpart' is the scale and should referred to by its constant DownloadServlet.SCALE_PARAM
// and 'idx' is the index and should referred to by its constant DownloadServlet.INDEX_PARAM
// Renditions can also be downloaded by their UUID:
// http://localhost:8080/ems/Download?uuid=<renditionUuid>
//
// Modifying a rendition must be done by MetadataManager.setAttributes()