int fileSize = part.getSize();
results.put(UPLOADASSET_RETURN_MIMETYPE, mimeType);
results.put(UPLOADASSET_RETURN_FILESIZE, new Integer(fileSize));
ResourcesManager resourcesMgr = new ResourcesManager(document);
if (uploadType.equals("asset")) {
assetFile = new File(resourcesMgr.getPath(), fileName);
if (!resourcesMgr.getPath().exists()) {
resourcesMgr.getPath().mkdirs();
}
}
// must be a content upload then
else {
assetFile = new File(document.getFile().getParent(), fileName);
getLogger().debug("assetFile: " + assetFile);
}
saveAsset(assetFile, part);
if (uploadType.equals("asset")) {
if (canReadMimeType(mimeType)) {
BufferedImage input = ImageIO.read(assetFile);
width = input.getWidth();
height = input.getHeight();
}
dublinCoreParams.put("format", mimeType);
dublinCoreParams.put("extent", Integer.toString(fileSize));
lenyaMetaParams.put("width", Integer.toString(width));
lenyaMetaParams.put("height", Integer.toString(height));
// create an extra file containing the meta description for
// the asset.
File metaDataFile = new File(resourcesMgr.getPath(), fileName + ".meta");
createMetaData(metaDataFile, dublinCoreParams, lenyaMetaParams);
}
return Collections.unmodifiableMap(results);
}