// create new doc from PUT input
if (!doc.exists()) {
DocumentManager documentManager = null;
ServiceSelector selector = null;
ResourceType resourceType = null;
try {
selector = (ServiceSelector) this.manager
.lookup(ResourceType.ROLE + "Selector");
documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
DocumentFactory map = getDocumentFactory();
String path = doc.getPath();
// lookupResourceType(extension)
resourceType = lookUpExtension(extension, selector);
ResourceType.Sample sample = resourceType.getSample(resourceType.getSampleNames()[0]);
doc = documentManager.add(map, resourceType, sample.getUri(), getPublication(), doc
.getArea(), path, doc.getLanguage(), extension, doc.getName(), true);
doc.setMimeType(sample.getMimeType());
setMetaData(doc);
} finally {