/* * (non-Javadoc) * @see * org.fcrepo.server.security.xacml.pep.rest.filters.RESTFilter#handleRequest(javax.servlet * .http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public RequestCtx handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { RequestCtx req = null; Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>(); Map<URI, AttributeValue> resAttr; try { resAttr = ResourceAttributes.getRepositoryResources(); actions.put(Constants.ACTION.ID.getURI(), Constants.ACTION.GET_NEXT_PID.getStringAttribute()); actions.put(Constants.ACTION.API.getURI(), Constants.ACTION.APIM.getStringAttribute()); req = getContextHandler() .buildRequest(getSubjects(request), actions, resAttr, getEnvironment(request)); LogUtil.statLog( request.getRemoteUser(), Constants.ACTION.GET_NEXT_PID.uri, Constants.FEDORA_REPOSITORY_PID.uri, null); } catch (Exception e) { logger.error(e.getMessage(), e); CXFUtility.getFault(e); } return req; }
@Override public RequestCtx handleRequest(SOAPMessageContext context) throws OperationHandlerException { logger.debug("GetObjectProfileHandler/handleRequest!"); RequestCtx req = null; Object oMap = null; String pid = null; String asOfDateTime = null; try { oMap = getSOAPRequestObjects(context); logger.debug("Retrieved SOAP Request Objects"); } catch (SoapFault af) { logger.error("Error obtaining SOAP Request Objects", af); throw new OperationHandlerException("Error obtaining SOAP Request Objects", af); } try { pid = (String) callGetter("getPid", oMap); asOfDateTime = (String) callGetter("getAsOfDateTime", oMap); } catch (Exception e) { logger.error("Error obtaining parameters", e); throw new OperationHandlerException("Error obtaining parameters.", e); } Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>(); Map<URI, AttributeValue> resAttr; try { resAttr = ResourceAttributes.getResources(pid); if (asOfDateTime != null && !"".equals(asOfDateTime)) { resAttr.put( Constants.DATASTREAM.AS_OF_DATETIME.getURI(), DateTimeAttribute.getInstance(asOfDateTime)); } actions.put(Constants.ACTION.ID.getURI(), Constants.ACTION.VALIDATE.getStringAttribute()); actions.put(Constants.ACTION.API.getURI(), Constants.ACTION.APIM.getStringAttribute()); req = getContextHandler() .buildRequest(getSubjects(context), actions, resAttr, getEnvironment(context)); LogUtil.statLog( getUser(context), Constants.ACTION.VALIDATE.getURI().toASCIIString(), pid, null); } catch (Exception e) { logger.error(e.getMessage(), e); throw new OperationHandlerException(e.getMessage(), e); } return req; }
@Override public RequestCtx handleRequest(SOAPMessageContext context) throws OperationHandlerException { logger.debug("GetObjectXMLHandler/handleRequest!"); RequestCtx req = null; Object oMap = null; String pid = null; try { oMap = getSOAPRequestObjects(context); logger.debug("Retrieved SOAP Request Objects"); } catch (SoapFault af) { logger.error("Error obtaining SOAP Request Objects", af); throw new OperationHandlerException("Error obtaining SOAP Request Objects", af); } try { pid = (String) callGetter("getPid", oMap); } catch (Exception e) { logger.error("Error obtaining parameters", e); throw new OperationHandlerException("Error obtaining parameters.", e); } logger.debug("Extracted SOAP Request Objects"); Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>(); Map<URI, AttributeValue> resAttr; try { resAttr = ResourceAttributes.getResources(pid); actions.put( Constants.ACTION.ID.getURI(), Constants.ACTION.GET_OBJECT_XML.getStringAttribute()); actions.put(Constants.ACTION.API.getURI(), Constants.ACTION.APIM.getStringAttribute()); req = getContextHandler() .buildRequest(getSubjects(context), actions, resAttr, getEnvironment(context)); LogUtil.statLog(getUser(context), Constants.ACTION.GET_OBJECT_XML.uri, pid, null); } catch (Exception e) { logger.error(e.getMessage(), e); throw new OperationHandlerException(e.getMessage(), e); } return req; }
/* * (non-Javadoc) * @see * org.fcrepo.server.security.xacml.pep.rest.filters.RESTFilter#handleRequest(javax.servlet * .http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public RequestCtx handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (logger.isDebugEnabled()) { logger.debug("{}/handleRequest!", this.getClass().getName()); } String format = request.getParameter("format"); RequestCtx req = null; Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>(); Map<URI, AttributeValue> resAttr; try { resAttr = ResourceAttributes.getRepositoryResources(); if (format != null && !"".equals(format)) { resAttr.put(Constants.OBJECT.FORMAT_URI.getURI(), new StringAttribute(format)); } actions.put(Constants.ACTION.ID.getURI(), Constants.ACTION.INGEST.getStringAttribute()); actions.put(Constants.ACTION.API.getURI(), Constants.ACTION.APIM.getStringAttribute()); req = getContextHandler() .buildRequest(getSubjects(request), actions, resAttr, getEnvironment(request)); LogUtil.statLog( request.getRemoteUser(), Constants.ACTION.INGEST.uri, Constants.FEDORA_REPOSITORY_PID.uri, null); } catch (Exception e) { logger.error(e.getMessage(), e); throw new ServletException(e.getMessage(), e); } return req; }
/* * (non-Javadoc) * @see * org.fcrepo.server.security.xacml.pep.rest.filters.RESTFilter#handleRequest(javax.servlet * .http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public RequestCtx handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (logger.isDebugEnabled()) { logger.debug(this.getClass().getName() + "/handleRequest!"); } String path = request.getPathInfo(); String[] parts = path.split("/"); String pid = parts[1]; String dsid = parts[3]; String startDT = request.getParameter("startDT"); String endDT = request.getParameter("endDT"); RequestCtx req = null; Map<URI, AttributeValue> actions = new HashMap<URI, AttributeValue>(); Map<URI, AttributeValue> resAttr = new HashMap<URI, AttributeValue>(); try { if (pid != null && !"".equals(pid)) { resAttr.put(Constants.OBJECT.PID.getURI(), new StringAttribute(pid)); } if (pid != null && !"".equals(pid)) { resAttr.put(new URI(XACML_RESOURCE_ID), new AnyURIAttribute(new URI(pid))); } if (dsid != null && !"".equals(dsid)) { resAttr.put(Constants.DATASTREAM.ID.getURI(), new StringAttribute(dsid)); } if (startDT != null && !"".equals(startDT)) { resAttr.put( Constants.DATASTREAM.CREATED_DATETIME.getURI(), DateTimeAttribute.getInstance(startDT)); } if (endDT != null && !"".equals(endDT)) { resAttr.put( Constants.DATASTREAM.AS_OF_DATETIME.getURI(), DateTimeAttribute.getInstance(endDT)); } actions.put( Constants.ACTION.ID.getURI(), new StringAttribute(Constants.ACTION.PURGE_DATASTREAM.getURI().toASCIIString())); actions.put( Constants.ACTION.API.getURI(), new StringAttribute(Constants.ACTION.APIM.getURI().toASCIIString())); // modifying the FeSL policy datastream requires policy management permissions if (dsid != null && dsid.equals(FedoraPolicyStore.FESL_POLICY_DATASTREAM)) { actions.put( Constants.ACTION.ID.getURI(), new StringAttribute(Constants.ACTION.MANAGE_POLICIES.getURI().toASCIIString())); } req = getContextHandler() .buildRequest(getSubjects(request), actions, resAttr, getEnvironment(request)); LogUtil.statLog( request.getRemoteUser(), Constants.ACTION.PURGE_DATASTREAM.getURI().toASCIIString(), pid, dsid); } catch (Exception e) { logger.error(e.getMessage(), e); throw new ServletException(e.getMessage(), e); } return req; }