private String uploadFile(File file) {
String fileName = file.getName();
ContentRepositoryRegistry registry = ContentRepositoryRegistry.getInstance();
ContentRepository repo = registry.getRepository(LoginManager.getPrimary());
ContentCollection userRoot;
// First try to find the resource, if it exists, then simply upload the
// new bits. Otherwise create the resource and upload the new bits
try {
userRoot = repo.getUserRoot();
ContentNode node = (ContentNode)userRoot.getChild(fileName);
if (node == null) {
node = (ContentNode)userRoot.createChild(fileName, Type.RESOURCE);
}
((ContentResource)node).put(file);
} catch (ContentRepositoryException excp) {
LOGGER.log(Level.WARNING, "Error uploading", excp);
} catch(IOException ie) {