private String writeRaw(final ResourceKey source) throws IOException
{
try
{
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 =
resourceData.getResourceAsStream(resourceManager);
final OutputStream outputStream = item.getOutputStream();
IOUtils.getInstance().copyStreams
(stream, outputStream);
outputStream.close();
stream.close();