Пример #1
0
  /*
   * (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;
  }
Пример #2
0
  @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;
  }
Пример #4
0
  /**
   * Obtains a map of resource Attributes.
   *
   * @param context the message context
   * @return map of resource Attributes
   * @throws OperationHandlerException
   * @throws URISyntaxException
   */
  protected Map<URI, AttributeValue> getResources(SOAPMessageContext context)
      throws OperationHandlerException, URISyntaxException {
    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);
    }
    Map<URI, AttributeValue> resAttr = ResourceAttributes.getResources(pid);
    logger.debug("Extracted SOAP Request Objects");
    return resAttr;
  }
Пример #5
0
  /*
   * (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;
  }