<repository name="default"
factory="org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory">
<repository name="default">
+ <pool minPoolSize="0" maxPoolSize="20"
+ blockingTimeoutMillis="100" idleTimeoutMinutes="10" />
<clustering enabled="false" delay="1000" />
<binaryStore path="" />
<!-- The transactional datasource for Nuxeo -->
<repository name="lifesci_domain"
factory="org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory">
<repository name="lifesci_domain">
+ <pool minPoolSize="0" maxPoolSize="20"
+ blockingTimeoutMillis="100" idleTimeoutMinutes="10" />
<clustering enabled="false" delay="1000" />
<binaryStore path="" />
<!-- The transactional datasource for Nuxeo -->
db.nuxeo.user.password=${env.DB_PASSWORD_NUXEO}\r
db.cspace.user=cspace\r
db.cspace.user.password=${env.DB_PASSWORD_CSPACE}\r
-db.host=dba-postgres-qa-21.ist.berkeley.edu\r
+#db.host=dba-postgres-qa-21.ist.berkeley.edu\r
+#db.host=173.255.228.202\r
+db.host=169.229.248.106\r
+#db.host=169.229.199.44\r
db.jdbc.baseurl=jdbc:${db}://${db.host}:${db.port}\r
\r
#\r
import java.util.List;
import java.util.Map;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+
import org.collectionspace.services.client.IClientQueryParams;
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.workflow.WorkflowClient;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMain;
}
}
- protected Specifier getSpecifier(String specifierIn, String method, String op) throws WebApplicationException {
+ protected Specifier getSpecifier(String specifierIn, String method, String op) throws CSWebApplicationException {
if (logger.isDebugEnabled()) {
logger.debug("getSpecifier called by: " + method + " with specifier: " + specifierIn);
}
Response response = Response.status(Response.Status.BAD_REQUEST).entity(
op + " failed on bad or missing Authority specifier").type(
"text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
/**
Response response = Response.status(Response.Status.NOT_FOUND).entity(
"Get failed, the requested Authority specifier:" + specifier + ": was not found.").type(
"text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
return result.getBytes();
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.GET_FAILED);
}
+
if (result == null) {
Response response = Response.status(Response.Status.NOT_FOUND).entity(
"Get failed, the requested AuthorityItem specifier:" + itemspecifier + ": was not found.").type(
"text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
+
return result.getBytes();
}
Response response = Response.status(Response.Status.NOT_FOUND).entity(
"Get failed, the requested Item CSID:" + itemspecifier + ": was not found.").type(
"text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
return authRefDocList;
}
import org.collectionspace.services.common.context.ServiceContextFactory;
import org.collectionspace.services.common.storage.StorageClient;
import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl;
+import org.collectionspace.services.common.CSWebApplicationException;
+
import org.jboss.resteasy.util.HttpResponseCodes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
if(RoleClient.IMMUTABLE.equals(role.getMetadataProtection())) {
Response response =
Response.status(Response.Status.FORBIDDEN).entity("Role: "+csid+" is immutable.").type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
return (Role)update(csid, theUpdate, Role.class);
} catch (Exception e) {
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.publicitem.PublicItemUtil;
import org.collectionspace.services.nuxeo.client.java.CommonList;
+import org.collectionspace.services.common.CSWebApplicationException;
+
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
private InputStream getBlobContent(ServiceContext ctx,
String csid,
String derivativeTerm,
- StringBuffer outMimeType) throws WebApplicationException {
+ StringBuffer outMimeType) throws CSWebApplicationException {
InputStream result = null;
try {
Response response = Response.status(
Response.Status.INTERNAL_SERVER_ERROR).entity(
"Index failed. Could not get the contents for the Blob.").type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
return result;
if (result == null) {
Response response = Response.status(Response.Status.NOT_FOUND).entity(
ServiceMessages.READ_FAILED + ServiceMessages.resourceNotFoundMsg(csid)).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.READ_FAILED, csid);
if (result == null) {
Response response = Response.status(Response.Status.NOT_FOUND).entity(
ServiceMessages.READ_FAILED + ServiceMessages.resourceNotFoundMsg(csid)).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.READ_FAILED, csid);
import javax.ws.rs.core.Response;\r
import javax.ws.rs.core.UriInfo;\r
\r
+import org.collectionspace.services.common.CSWebApplicationException;\r
import org.collectionspace.services.common.api.Tools;\r
import org.collectionspace.services.common.context.ServiceContext;\r
import org.collectionspace.services.common.context.ServiceContextProperties;\r
import org.collectionspace.services.common.security.UnauthorizedException;\r
import org.collectionspace.services.common.storage.StorageClient;\r
import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl;\r
+\r
import org.jboss.resteasy.core.ResourceMethod;\r
import org.jboss.resteasy.spi.HttpRequest;\r
\r
return result;\r
}\r
\r
- public void checkResult(Object resultToCheck, String csid, String serviceMessage) throws WebApplicationException {\r
+ public void checkResult(Object resultToCheck, String csid, String serviceMessage) throws CSWebApplicationException {\r
if (resultToCheck == null) {\r
Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
serviceMessage + "csid=" + csid\r
+ ": was not found.").type(\r
"text/plain").build();\r
- throw new WebApplicationException(response);\r
+ throw new CSWebApplicationException(response);\r
}\r
}\r
\r
- protected void ensureCSID(String csid, String crudType) throws WebApplicationException {\r
+ protected void ensureCSID(String csid, String crudType) throws CSWebApplicationException {\r
ensureCSID(csid, crudType, "csid");\r
}\r
\r
- protected void ensureCSID(String csid, String crudType, String whichCsid) throws WebApplicationException {\r
+ protected void ensureCSID(String csid, String crudType, String whichCsid) throws CSWebApplicationException {\r
if (logger.isDebugEnabled()) {\r
logger.debug(crudType + " for " + getClass().getName() + " with csid=" + csid);\r
}\r
if (csid == null || "".equals(csid)) {\r
logger.error(crudType + " for " + getClass().getName() + " missing csid!");\r
Response response = Response.status(Response.Status.BAD_REQUEST).entity(crudType + " failed on " + getClass().getName() + ' '+whichCsid+'=' + csid).type("text/plain").build();\r
- throw new WebApplicationException(response);\r
+ throw new CSWebApplicationException(response);\r
}\r
}\r
\r
- protected WebApplicationException bigReThrow(Exception e, String serviceMsg) throws WebApplicationException {\r
+ protected CSWebApplicationException bigReThrow(Exception e, String serviceMsg) throws CSWebApplicationException {\r
return bigReThrow(e, serviceMsg, "");\r
}\r
\r
- protected WebApplicationException bigReThrow(Exception e, String serviceMsg, String csid) throws WebApplicationException {\r
+ protected CSWebApplicationException bigReThrow(Exception e, String serviceMsg, String csid) throws CSWebApplicationException {\r
boolean logException = true;\r
- WebApplicationException result = null;\r
+ CSWebApplicationException result = null;\r
Response response;\r
- \r
String detail = Tools.errorToString(e, true);\r
String detailNoTrace = Tools.errorToString(e, true, 3);\r
+ \r
if (e instanceof UnauthorizedException) {\r
response = Response.status(Response.Status.UNAUTHORIZED).entity(serviceMsg + e.getMessage()).type("text/plain").build();\r
- result = new WebApplicationException(response);\r
+ result = new CSWebApplicationException(e, response);\r
\r
} else if (e instanceof DocumentNotFoundException) {\r
//\r
//\r
logException = false;\r
response = Response.status(Response.Status.NOT_FOUND).entity(serviceMsg + " on " + getClass().getName() + " csid=" + csid).type("text/plain").build();\r
- result = new WebApplicationException(response);\r
+ result = new CSWebApplicationException(e, response);\r
\r
} else if (e instanceof TransactionException) {\r
int code = ((TransactionException) e).getErrorCode();\r
response = Response.status(code).entity(e.getMessage()).type("text/plain").build();\r
- result = new WebApplicationException(response);\r
+ result = new CSWebApplicationException(e, response);\r
\r
} else if (e instanceof BadRequestException) {\r
int code = ((BadRequestException) e).getErrorCode();\r
// CSPACE-1110\r
response = Response.status(code).entity(serviceMsg + e.getMessage()).type("text/plain").build();\r
// return new WebApplicationException(e, code);\r
- result = new WebApplicationException(response);\r
+ result = new CSWebApplicationException(e, response);\r
\r
} else if (e instanceof DocumentException) {\r
int code = ((DocumentException) e).getErrorCode();\r
// CSPACE-1110\r
response = Response.status(code).entity(serviceMsg + e.getMessage()).type("text/plain").build();\r
// return new WebApplicationException(e, code);\r
- result = new WebApplicationException(response);\r
+ result = new CSWebApplicationException(e, response);\r
\r
- } else if (e instanceof WebApplicationException) {\r
+ } else if (e instanceof CSWebApplicationException) {\r
// subresource may have already thrown this exception\r
// so just pass it on\r
- result = (WebApplicationException) e;\r
+ result = (CSWebApplicationException) e;\r
\r
} else { // e is now instanceof Exception\r
response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(serviceMsg + " detail: " + detailNoTrace).type("text/plain").build();\r
- result = new WebApplicationException(response);\r
+ result = new CSWebApplicationException(e, response);\r
}\r
//\r
// Some exceptions like DocumentNotFoundException won't be logged unless we're in 'trace' mode\r
if (result == null) {\r
Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
ServiceMessages.READ_FAILED + ServiceMessages.resourceNotFoundMsg(csid)).type("text/plain").build();\r
- throw new WebApplicationException(response);\r
+ throw new CSWebApplicationException(response);\r
}\r
} catch (Exception e) {\r
throw bigReThrow(e, ServiceMessages.READ_FAILED, csid);\r
package org.collectionspace.services.common.profile;\r
\r
import java.io.IOException;\r
+import java.net.SocketException;\r
+\r
import javax.servlet.Filter;\r
import javax.servlet.FilterChain;\r
import javax.servlet.FilterConfig;\r
import javax.servlet.http.HttpServletRequest;\r
//import javax.servlet.ServletContext;\r
\r
+\r
import org.collectionspace.services.client.Profiler;\r
import org.collectionspace.services.common.ServletTools;\r
-\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
FilterConfig filterConfig = null;\r
\r
private final String CLASS_NAME = this.getClass().getSimpleName();\r
+ private static final int MAX_RETRY_SECONDS = 5;\r
+\r
\r
/* (non-Javadoc)\r
* @see javax.servlet.Filter#destroy()\r
profiler.log(csvMsg, FORMAT_LOG_MESSAGE);\r
\r
// Process the request.\r
- chain.doFilter(request, response);\r
+ //chain.doFilter(request, response);\r
+ try {\r
+ invoke(request, response, chain);\r
+ } catch (Throwable e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
\r
// Stop timing and log performance-related metrics.\r
profiler.stop();\r
profiler.reset();\r
}\r
}\r
+ \r
+ public void invoke(ServletRequest request, ServletResponse response,\r
+ FilterChain chain) throws Throwable {\r
+ Throwable lastException = null;\r
+ int attempt = 0;\r
+\r
+ long quittingTime = System.currentTimeMillis() + MAX_RETRY_SECONDS * 1000;\r
+ do {\r
+ try {\r
+ // proceed to original method call\r
+ chain.doFilter(request, response);\r
+ String contentType = response.getContentType();\r
+ lastException = null;\r
+ break;\r
+ } catch (Exception e) {\r
+ lastException = e;\r
+ if (exceptionChainContains(lastException, SocketException.class) == false) {\r
+ // Break if the exception chain does not contain a\r
+ // SocketException.\r
+ break;\r
+ }\r
+ attempt++;\r
+ System.out\r
+ .println(String\r
+ .format("'%s' URL request failed with exception '%s' at attemp '%d'",\r
+ ServletTools.getURL((HttpServletRequest) request),\r
+ lastException.getClass().getName(),\r
+ attempt));\r
+ }\r
+ } while (System.currentTimeMillis() < quittingTime);\r
+\r
+ if (lastException != null) {\r
+ throw lastException;\r
+ }\r
+\r
+ System.out.println("Success!");\r
+ }\r
+ \r
+ private boolean exceptionChainContains(Throwable exceptionChain,\r
+ Class<?> target) {\r
+ boolean result = false;\r
+ Throwable top = exceptionChain;\r
+\r
+ while (top != null) {\r
+ System.out.println(top.getClass().getCanonicalName());\r
+ if (target.isInstance(top) == true) {\r
+ result = true;\r
+ break;\r
+ }\r
+ top = top.getCause();\r
+ }\r
+\r
+ return result;\r
+ }\r
+ \r
\r
/* (non-Javadoc)\r
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)\r
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ServiceMessages;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.relation.nuxeo.RelationsUtils;
import org.collectionspace.services.relation.RelationsCommon;
import org.collectionspace.services.relation.RelationsCommonList;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
String subjectCsid, String subjectType,
String predicate,
String objectCsid,
- String objectType) throws WebApplicationException {
+ String objectType) throws CSWebApplicationException {
try {
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(uriInfo);
if (parentCtx != null) { // If the parent context has an open repository session then use it
import org.collectionspace.services.authorization.CSpaceResource;
import org.collectionspace.services.authorization.URIResourceImpl;
import org.collectionspace.services.client.workflow.WorkflowClient;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.CollectionSpaceResource;
import org.collectionspace.services.common.document.JaxbUtils;
import org.collectionspace.services.common.storage.jpa.JpaStorageUtils;
import org.collectionspace.services.common.security.SecurityUtils;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
@Override
public ServerResponse preProcess(HttpRequest request, ResourceMethod resourceMethod)
- throws Failure, WebApplicationException {
+ throws Failure, CSWebApplicationException {
ServerResponse result = null; // A null value essentially means success for this method
if (isAnonymousRequest(request, resourceMethod) == true) {
final int servicesResourceLen = servicesResource.length();
String httpMethod = request.getHttpMethod();
String uriPath = request.getUri().getPath();
+
if (logger.isDebugEnabled()) {
String fullRequest = request.getUri().getRequestUri().toString();
int servicesResourceIdx = fullRequest.indexOf(servicesResource);
String relativeRequest = (servicesResourceIdx<=0)? fullRequest
- :fullRequest.substring(servicesResourceIdx+servicesResourceLen);
+ : fullRequest.substring(servicesResourceIdx+servicesResourceLen);
logger.debug("received " + httpMethod + " on " + relativeRequest);
}
+
String resName = SecurityUtils.getResourceName(request.getUri());
String resEntity = SecurityUtils.getResourceEntity(resName);
+ " user=" + AuthN.get().getUserId());
Response response = Response.status(
Response.Status.FORBIDDEN).entity(uriPath + " " + httpMethod).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
} else {
//
// They passed the first round of security checks, so now let's check to see if they're trying
+ " user=" + AuthN.get().getUserId());
Response response = Response.status(
Response.Status.FORBIDDEN).entity(uriPath + " " + httpMethod).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
}
}
/**
* checkActive check if account is active
- * @throws WebApplicationException
+ * @throws CSWebApplicationException
*/
- private void checkActive() throws WebApplicationException {
+ private void checkActive() throws CSWebApplicationException {
String userId = AuthN.get().getUserId();
+
+ if (true)
+ throw new CSWebApplicationException(new java.net.SocketException("An faux exception thrown for testing."));
+
try {
// Need to ensure that user is associated to a tenant
String tenantId = AuthN.get().getCurrentTenantId();
// indicates that authorization has been refused for those credentials.
Response response = Response.status(
Response.Status.UNAUTHORIZED).entity(msg).type("text/plain").build();
- throw new WebApplicationException(ise, response);
+ throw new CSWebApplicationException(ise, response);
}
+
try {
//can't use JAXB here as this runs from the common jar which cannot
//depend upon the account service
String msg = "User's account not found, userId=" + userId;
Response response = Response.status(
Response.Status.FORBIDDEN).entity(msg).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
Object status = JaxbUtils.getValue(account, "getStatus");
if (status != null) {
String msg = "User's account is inactive, userId=" + userId;
Response response = Response.status(
Response.Status.FORBIDDEN).entity(msg).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
}
String msg = "User's account is in invalid state, userId=" + userId;
Response response = Response.status(
Response.Status.FORBIDDEN).entity(msg).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(e, response);
}
}
//
// Nuxeo login support
//
public ServerResponse nuxeoPreProcess(HttpRequest request, ResourceMethod resourceMethod)
- throws Failure, WebApplicationException {
+ throws Failure, CSWebApplicationException {
try {
nuxeoLogin();
} catch (LoginException e) {
logger.error(msg, e);
Response response = Response.status(
Response.Status.INTERNAL_SERVER_ERROR).entity(msg).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(e, response);
}
return null;
if (logger.isDebugEnabled()) {
logger.debug("could not find entity (2) with where=" + whereClause, e);
}
- //returns null
+ throw e;
} finally {
if (em != null) {
releaseEntityManagerFactory(emf);
import org.collectionspace.services.client.Profiler;
import org.collectionspace.services.client.RelationClient;
import org.collectionspace.services.client.workflow.WorkflowClient;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.config.ServiceConfigUtils;
import org.collectionspace.services.relation.RelationsDocListItem;
import org.collectionspace.services.relation.RelationshipType;
import org.dom4j.Element;
-
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentModelList;
import org.nuxeo.ecm.core.api.model.PropertyException;
import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Response.Status.INTERNAL_SERVER_ERROR).entity(
"Failed to retrieve authority references").type(
"text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(e, response);
}
return authRefList;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import javax.sql.rowset.CachedRowSet;
+import javax.sql.rowset.CachedRowSet;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MultivaluedMap;
import org.collectionspace.services.common.storage.PreparedStatementSimpleBuilder;
import org.collectionspace.services.lifecycle.TransitionDef;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-
import org.collectionspace.services.common.document.BadRequestException;
import org.collectionspace.services.common.document.DocumentException;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentWrapperImpl;
import org.collectionspace.services.common.document.TransactionException;
import org.collectionspace.services.config.tenant.RepositoryDomainType;
-
import org.nuxeo.common.utils.IdUtils;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
//
import org.apache.chemistry.opencmis.commons.server.CallContext;
import org.apache.chemistry.opencmis.server.impl.CallContextImpl;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ServiceMain;
import org.collectionspace.services.common.api.Tools;
import org.collectionspace.services.common.config.ConfigUtils;
import org.collectionspace.services.config.tenant.TenantBindingType;
import org.nuxeo.ecm.core.opencmis.impl.server.NuxeoCmisService;
import org.nuxeo.ecm.core.opencmis.impl.server.NuxeoRepository;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
throw de;
} catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug("Caught exception ", e);
+ logger.debug("Caught exception ", e); // REM - 1/17/2014: Check for org.nuxeo.ecm.core.api.ClientException and re-attempt
}
throw new DocumentException(e);
} finally {
throw bre;
} catch (DocumentException de) {
throw de;
- } catch (WebApplicationException wae) {
+ } catch (CSWebApplicationException wae) {
throw wae;
} catch (Exception e) {
if (logger.isDebugEnabled()) {
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+
import org.collectionspace.services.client.*;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.StoredValuesUriTemplate;
import org.collectionspace.services.common.UriTemplateFactory;
import org.collectionspace.services.common.UriTemplateRegistryKey;
}
if (result == null) {
Response response = Response.status(Response.Status.NOT_FOUND).entity("Get failed, the requested Contact CSID:" + csid + ": was not found.").type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
return result.toXML();
}
//import javax.xml.bind.JAXBContext;\r
//import javax.xml.bind.Marshaller;\r
\r
+\r
+import org.collectionspace.services.common.CSWebApplicationException;\r
import org.collectionspace.services.common.query.QueryManager;\r
//import org.collectionspace.services.common.NuxeoClientType;\r
/*import org.collectionspace.services.common.ServiceMain;\r
if(logger.isDebugEnabled()){\r
verbose("getQuery with csid=" + csid);\r
}\r
- if(csid == null || "".equals(csid)){\r
+ if (csid == null || "".equals(csid)){\r
logger.error("getQuery: missing csid!");\r
Response response = Response.status(Response.Status.BAD_REQUEST).entity(\r
"get failed on getQuery csid=" + csid).type(\r
"text/plain").build();\r
- throw new WebApplicationException(response);\r
+ throw new CSWebApplicationException(response);\r
}\r
\r
try {\r
Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
"Get failed on query csid=" + csid).type(\r
"text/plain").build();\r
- throw new WebApplicationException(response);\r
+ throw new CSWebApplicationException(e, response);\r
}\r
\r
- if(false){\r
+ if (false) { // REM - 1/29/2014 : Huh? Why is this essentially commented out? Should probably clean up.\r
Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
"Get failed, the requested CSID:" + csid + ": was not found.").type(\r
"text/plain").build();\r
- throw new WebApplicationException(response);\r
+ throw new CSWebApplicationException(response);\r
}\r
\r
// return intakeObject;\r
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.ReportClient;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
Response response = Response.status(Response.Status.BAD_REQUEST).entity(
"invoke failed on Report csid=" + csid).type(
"text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
if (logger.isTraceEnabled()) {
import java.util.Map;
import javax.ws.rs.core.MediaType;
-
import javax.naming.NamingException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.ReportClient;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ServiceMain;
import org.collectionspace.services.common.api.JEEServerDeployment;
import org.collectionspace.services.common.api.FileTools;
Response response = Response.status(
Response.Status.INTERNAL_SERVER_ERROR).entity(
"Invoke failed (SQL problem) on Report csid=" + reportCSID).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(sqle, response);
} catch (JRException jre) {
if (logger.isDebugEnabled()) {
logger.debug("JR Exception: " + jre.getLocalizedMessage() + " Cause: "+jre.getCause());
Response response = Response.status(
Response.Status.INTERNAL_SERVER_ERROR).entity(
"Invoke failed (Jasper problem) on Report csid=" + reportCSID).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(jre, response);
} catch (FileNotFoundException fnfe) {
if (logger.isDebugEnabled()) {
logger.debug("FileNotFoundException: " + fnfe.getLocalizedMessage());
Response response = Response.status(
Response.Status.INTERNAL_SERVER_ERROR).entity(
"Invoke failed (SQL problem) on Report csid=" + reportCSID).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(fnfe, response);
} finally {
- if(conn!=null) {
+ if (conn!=null) {
try {
- conn.close();
+ conn.close();
} catch (SQLException sqle) {
// SQLExceptions can be chained. We have at least one exception, so
// set up a loop to make sure we let the user know about all of them
import org.collectionspace.services.client.ServiceGroupClient;
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ServiceMain;
import org.collectionspace.services.common.ServiceMessages;
// 404 if there are no mappings.
Response response = Response.status(Response.Status.NOT_FOUND).entity(
ServiceMessages.READ_FAILED + ServiceMessages.resourceNotFoundMsg(groupname)).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
//Otherwise, build the response with a list
ServicegroupsCommon common = new ServicegroupsCommon();
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ServiceMain;
import org.collectionspace.services.common.ServiceMessages;
import org.collectionspace.services.common.StoredValuesUriTemplate;
Response response = Response.status(Response.Status.NOT_FOUND).entity(
ServiceMessages.READ_FAILED +
ServiceMessages.resourceNotFoundMsg(implode(serviceGroupNames, ","))).type("text/plain").build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
servicebindings = SecurityUtils.getReadableServiceBindingsForCurrentUser(servicebindings);
// Build the list of docTypes for allowed serviceBindings
logger.debug("Caught exception ", e);
}
throw new DocumentException(e);
- }
+ }
+
return list;
}
package org.collectionspace.services.workflow;
import org.collectionspace.services.client.workflow.WorkflowClient;
+import org.collectionspace.services.common.CSWebApplicationException;
import org.collectionspace.services.common.ResourceBase;
import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
Response response = Response.status(Response.Status.BAD_REQUEST)
.entity(ServiceMessages.GET_LIST_UNSUPPORTED).type("text/plain")
.build();
- throw new WebApplicationException(response);
+ throw new CSWebApplicationException(response);
}
}