mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
11535: Fix ETHREEOH-519, ETHREEOH-23, ETHREEOH-24, ETHREEOH-58, ETHREEOH-449, ETHREEOH-30, ETHREEOH-19, ETHREEOH-561, ETHREEOH-537, ETHREEOH-567, ETHREEOH-568, ETHREEOH-113, ETHREEOH-130, ETHREEOH-115, ETHREEOH-566, ETHREEOH-572, ETHREEOH-82. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12450 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
@@ -147,7 +149,7 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
|
||||
*/
|
||||
public ServerModel getDescription()
|
||||
{
|
||||
return new RepositoryServerModel(descriptorService.getCurrentRepositoryDescriptor());
|
||||
return new RepositoryServerModel(descriptorService.getCurrentRepositoryDescriptor(), descriptorService.getServerDescriptor());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -301,13 +303,53 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
|
||||
{
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Begin transaction: " + description.getRequiredTransaction());
|
||||
|
||||
script.execute(scriptReq, scriptRes);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("End transaction: " + description.getRequiredTransaction());
|
||||
try
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Begin retry transaction block: " + description.getRequiredTransaction());
|
||||
|
||||
script.execute(scriptReq, scriptRes);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Transaction exception: " + description.getRequiredTransaction() + ": " + e.getMessage());
|
||||
// Note: user transaction shouldn't be null, but just in case inside this exception handler
|
||||
UserTransaction userTrx = RetryingTransactionHelper.getActiveUserTransaction();
|
||||
if (userTrx != null)
|
||||
{
|
||||
logger.debug("Transaction status: " + userTrx.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
UserTransaction userTrx = RetryingTransactionHelper.getActiveUserTransaction();
|
||||
if (userTrx != null)
|
||||
{
|
||||
if (userTrx.getStatus() != Status.STATUS_MARKED_ROLLBACK)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Marking web script transaction for rollback");
|
||||
try
|
||||
{
|
||||
userTrx.setRollbackOnly();
|
||||
}
|
||||
catch(Throwable re)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Caught and ignoring exception during marking for rollback: " + re.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// re-throw original exception for retry
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("End retry transaction block: " + description.getRequiredTransaction());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ import org.alfresco.web.scripts.ServerModel;
|
||||
*/
|
||||
public class RepositoryServerModel implements ServerModel
|
||||
{
|
||||
private Descriptor currentDescriptor;
|
||||
private Descriptor serverDescriptor;
|
||||
|
||||
/**
|
||||
@@ -42,8 +43,9 @@ public class RepositoryServerModel implements ServerModel
|
||||
*
|
||||
* @param serverDescriptor
|
||||
*/
|
||||
/*package*/ RepositoryServerModel(Descriptor serverDescriptor)
|
||||
/*package*/ RepositoryServerModel(Descriptor currentDescriptor, Descriptor serverDescriptor)
|
||||
{
|
||||
this.currentDescriptor = currentDescriptor;
|
||||
this.serverDescriptor = serverDescriptor;
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return serverDescriptor.getId();
|
||||
return currentDescriptor.getId();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -68,7 +70,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return serverDescriptor.getName();
|
||||
return currentDescriptor.getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -76,7 +78,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getVersionMajor()
|
||||
{
|
||||
return serverDescriptor.getVersionMajor();
|
||||
return currentDescriptor.getVersionMajor();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -84,7 +86,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getVersionMinor()
|
||||
{
|
||||
return serverDescriptor.getVersionMinor();
|
||||
return currentDescriptor.getVersionMinor();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -92,7 +94,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getVersionRevision()
|
||||
{
|
||||
return serverDescriptor.getVersionRevision();
|
||||
return currentDescriptor.getVersionRevision();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -100,7 +102,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getVersionLabel()
|
||||
{
|
||||
return serverDescriptor.getVersionLabel();
|
||||
return currentDescriptor.getVersionLabel();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -108,7 +110,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getVersionBuild()
|
||||
{
|
||||
return serverDescriptor.getVersionBuild();
|
||||
return currentDescriptor.getVersionBuild();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -116,7 +118,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public String getVersion()
|
||||
{
|
||||
return serverDescriptor.getVersion();
|
||||
return currentDescriptor.getVersion();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -132,7 +134,7 @@ public class RepositoryServerModel implements ServerModel
|
||||
*/
|
||||
public int getSchema()
|
||||
{
|
||||
return serverDescriptor.getSchema();
|
||||
return currentDescriptor.getSchema();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -204,27 +204,7 @@ public class StreamContent extends AbstractWebScript
|
||||
}
|
||||
catch(Throwable e)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("Caught exception & redirecting to status template: " + e.getMessage());
|
||||
|
||||
// extract status code, if specified
|
||||
int statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
if (e instanceof WebScriptException)
|
||||
{
|
||||
statusCode = ((WebScriptException)e).getStatus();
|
||||
}
|
||||
|
||||
// send status
|
||||
Status status = new Status();
|
||||
status.setCode(statusCode);
|
||||
status.setMessage(e.getMessage());
|
||||
status.setException(e);
|
||||
Cache cache = new Cache();
|
||||
cache.setNeverCache(true);
|
||||
Map<String, Object> customModel = new HashMap<String, Object>(8, 1.0f);
|
||||
customModel.put("status", status);
|
||||
Map<String, Object> templateModel = createTemplateParameters(req, res, customModel);
|
||||
sendStatus(req, res, status, cache, format, templateModel);
|
||||
throw createStatusException(e, req, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user