All pastes #446801 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-18 17:51 UTC
rendered paste body
	/**
	* catalogFile
	*
	* Catalog a file, associating it with an existing asset placeholder.
	* 
	* @throws Exception
	*/
	public void catalogFile()
	throws Exception
	{
        // Acquire handles to managers
        AssetManager assetManager = Connector.getAssetManager();
        Cataloger cataloger = Connector.getCataloger();
        
        // Initialize parameters for EMS calls
        Map options = new HashMap();
        Map metadata = new HashMap();
        Collection metadataTemplateList = new ArrayList();
        String assetVersionUuid = "";
        
        // Create some asset placeholders
        assetVersionUuid = assetManager.createAsset(m_userAuth,
                                                    AssetType.IMAGE,
                                                    "Yahoo Logo",
                                                    "Created for JUnit catalogFile test.",
                                                    m_userAuth.getOrgUuid(),
                                                    metadataTemplateList,
                                                    metadata);
        cleanupAssetUuids.add(assetVersionUuid);
        
        // Catalog some files and associate them with the placeholder assets
        URI uri = new URI("http://us.i1.yimg.com/us.yimg.com/i/ww/beta/y3.gif");
        options.put(CatalogingOption.ASSET_VERSION_UUID, assetVersionUuid);
        assetVersionUuid = cataloger.catalogFileAtURI(m_userAuth, uri, options, metadata);
        
        cleanupAssetUuids.add(assetVersionUuid);
	}