NuxeoBasedResource resource = (NuxeoBasedResource) getResourceMap().get(serviceName);
- resource.update(getResourceMap(), createUriInfo(), csid, payload);
+ resource.update(getServiceContext(), getResourceMap(), createUriInfo(), csid, payload);
}
else if (uriParts.length == 5) {
String serviceName = uriParts[1];
if (items.equals("items")) {
AuthorityResource<?, ?> resource = (AuthorityResource<?, ?>) getResourceMap().get(serviceName);
- resource.updateAuthorityItem(getResourceMap(), createUriInfo(), vocabularyCsid, csid, payload);
+ resource.updateAuthorityItem(getServiceContext(), getResourceMap(), createUriInfo(), vocabularyCsid, csid, payload);
}
}
else {
logger.debug("Looking up DataSource instance in JNDI with name: " + dataSourceName);
}
- envCtx = (Context) ctx.lookup("java:comp/env");
- DataSource ds = (DataSource) envCtx.lookup("jdbc/" + dataSourceName);
- if (ds == null) {
- throw new IllegalArgumentException("DataSource instance not found: " + dataSourceName);
- } else {
- result = ds;
- // now cache this DataSource instance for future references
- cachedDataSources.put(dataSourceName, result);
- }
+ try {
+ envCtx = (Context) ctx.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/" + dataSourceName);
+ if (ds == null) {
+ throw new IllegalArgumentException("DataSource instance not found: " + dataSourceName);
+ } else {
+ result = ds;
+ // now cache this DataSource instance for future references
+ cachedDataSources.put(dataSourceName, result);
+ }
+ } finally { // We should explicitly close both context instances
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (Exception e) {
+ logger.error("Error getting DataSource for: " + dataSourceName, e);
+ }
+ }
+ if (envCtx != null) {
+ try {
+ envCtx.close();
+ } catch (Exception e) {
+ logger.error("Error getting DataSource for: " + dataSourceName, e);
+ }
+ }
+ }
}
if (result != null) {
return result;
}
+ private String getInvocationContextLogging(InvocationContext invContext, Map<String, Object> params) {
+ String outputMIME = invContext.getOutputMIME();
+ String mode = invContext.getMode();
+ String updateCoreValues = invContext.getUpdateCoreValues();
+ String docType = invContext.getDocType();
+ String singleCSID = invContext.getSingleCSID();
+ String groupCSID = invContext.getGroupCSID();
+ String listCSIDs = invContext.getListCSIDs() == null ? "" : invContext.getListCSIDs().toString();
+
+ String result =
+ "{MIME type: " + outputMIME +
+ "\n \t Context mode: " + mode +
+ "\n \t Update Core Values: " + updateCoreValues +
+ "\n \t Document type: " + docType +
+ "\n \t CSID: " + singleCSID +
+ "\n \t Group CSID: " + groupCSID +
+ "\n \t List CSIDs: " + listCSIDs +
+ "\n \t Parameters: " + params.toString() + "}";
+ return result;
+ }
+
public InputStream invokeReport(
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
String csid,
+invocationMode);
}
+ logger.debug("The invocation context is: \n " + getInvocationContextLogging(invContext, params));
+ logger.debug("The report is being called with the following parameters, which are being passed to Jasper: \n" + params.toString());
+ logger.debug("The mode being passed to Jasper is: " + invocationMode);
+
NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
repoSession = this.getRepositorySession();
if (repoSession == null) {