final ResourceData resourceData = resourceManager.load(source);
final String mimeType = queryMimeType(resourceData);
if (isValidImage(mimeType))
{
// lets do some voodo ..
final ContentItem item = dataLocation.createItem
(dataNameGenerator.generateName(extractFilename(resourceData), mimeType));
if (item.isWriteable())
{
item.setAttribute(LibRepositoryBoot.REPOSITORY_DOMAIN, LibRepositoryBoot.CONTENT_TYPE, mimeType);
// write it out ..
final InputStream stream = new BufferedInputStream(resourceData.getResourceAsStream(resourceManager));
try
{
final OutputStream outputStream = new BufferedOutputStream(item.getOutputStream());
try
{
IOUtils.getInstance().copyStreams(stream, outputStream);
}
finally