}
public String put(String suggestedPath, Resource resource) throws RegistryException {
boolean transactionSucceeded = false;
RequestContext context = new RequestContext(this, repository, versionRepository);
boolean mustPutChild = false;
try {
// start the transaction
beginTransaction();
ResourcePath resourcePath = new ResourcePath(suggestedPath);
context.setResourcePath(resourcePath);
context.setResource(resource);
if (repository.resourceExists(suggestedPath)) {
context.setOldResource(repository.get(suggestedPath));
}
if (!RegistryConstants.ROOT_PATH.equals(resourcePath.getPath())) {
mustPutChild = true;
registryContext.getHandlerManager().putChild(context);
}
registryContext.getHandlerManager().put(context);
if (!context.isSimulation()) {
String actualPath = context.getActualPath();
if (!context.isProcessingComplete()) {
((ResourceImpl) resource).prepareContentForPut();
actualPath = suggestedPath;
try {
CurrentSession.setAttribute(Repository.IS_LOGGING_ACTIVITY,
context.isLoggingActivity());
repository.put(suggestedPath, resource);
} finally {
CurrentSession.removeAttribute(Repository.IS_LOGGING_ACTIVITY);
}
}