Package org.fcrepo.server.errors

Examples of org.fcrepo.server.errors.ObjectValidityException


                            + "The message was " + "\"" + e.getMessage() + "\"";
            Validation validation = new Validation("unknown");
            List<String> problems = new ArrayList<String>();
            problems.add(msg);
            validation.setObjectProblems(problems);
            throw new ObjectValidityException(msg, validation, e);
        } catch (Exception e) {
            String msg =
                    "DOValidatorXMLSchema returned error.\n"
                            + "The underlying error was a "
                            + e.getClass().getName() + ".\n"
View Full Code Here


    if (!contentmodels.contains(objectUri)) {

    Validation validation = doValidate(context, currentObjectReader, new Date(), contentmodels);

      if (!validation.isValid()) {
        throw new ObjectValidityException("ECM validation failure", validation);

      }
    }

  }
View Full Code Here

          Validation validation = new Validation("unknown");
          List<String> probs = new ArrayList<String>();
          probs.add("Schematron validation failed:" + e.getMessage());
          validation.setObjectProblems(probs);
            logger.error("Schematron validation failed", e);
            throw new ObjectValidityException(e.getMessage(), validation);
        }

        if (!result.isValid()) {
            String msg = null;
            try {
                msg = result.getXMLResult();
            } catch (Exception e) {
                logger.warn("Error getting XML result of schematron validation failure", e);
            }
          Validation validation = new Validation("unknown");
          List<String> probs = new ArrayList<String>();
          if (msg != null) {
            probs.add(msg);
          } else {
            probs.add("Unknown schematron error.  Error getting XML results of schematron validation");
          }
            throw new ObjectValidityException(msg, validation);
        }
    }
View Full Code Here

                    tfactory.newTransformer(preprocessorSource);
            ptransformer.setParameter("phase", phase);
            ptransformer.transform(rulesSource, new StreamResult(out));
        } catch (TransformerException e) {
            logger.error("Schematron validation failed", e);
            throw new ObjectValidityException(e.getMessage());
        }
        return XmlTransformUtility.getTemplates(
            new StreamSource(
                new ByteArrayInputStream(out.toByteArray())));
    }
View Full Code Here

                        entry.getValue(),e);
            }
        }
        m_ruleSchemaMap = ruleSchemaMap;
        if (tempDir == null) {
            throw new ObjectValidityException("[DOValidatorImpl] ERROR in constructor: "
                    + "tempDir is null.");
        }
        if (schematronPreprocessorPath == null) {
            throw new ObjectValidityException("[DOValidatorImpl] ERROR in constructor. "
                    + "schematronPreprocessorPath is null.");
        }
        m_tempDir = new File(tempDir);
        if (!m_tempDir.exists() && !m_tempDir.mkdirs()) {
            throw new GeneralException("Cannot read or create tempDir at " +
View Full Code Here

                                );
                    }
                    File objectAsFile = streamtoFile(objectAsStream);
                    validate(objectAsFile, format, validationType, phase);
                } catch (IOException ioe) {
                    throw new ObjectValidityException("[DOValidatorImpl]: "
                            + "ERROR in validate(InputStream objectAsStream...). " + ioe.getMessage());
                }
                break;
            case VALIDATE_XML_SCHEMA:
                validateXMLSchema(objectAsStream, m_xmlSchemaMap.get(format));
View Full Code Here

                throw new GeneralException("[DOValidatorImpl] " + msg + ":"
                        + validationType);
            }
        } catch (IOException ioe) {
            logger.error("VALIDATE: ERROR - failed validations.", ioe);
            throw new ObjectValidityException("[DOValidatorImpl]: validate(File input...). "
                    + ioe.getMessage());
        } finally {
            cleanUp(objectAsFile);
        }
    }
View Full Code Here

        if (!m_xmlSchemaMap.containsKey(format)) {
          Validation validation = new Validation("unknown");
          List<String> probs = new ArrayList<String>();
          probs.add("Unsupported format: " + format);
          validation.setObjectProblems(probs);
            throw new ObjectValidityException("Unsupported format: " + format, validation);
        }
    }
View Full Code Here

        } catch (ObjectValidityException e) {
            logger.error("VALIDATE: ERROR - failed XML Schema validation.", e);
            throw e;
        } catch (Exception e) {
            logger.error("VALIDATE: ERROR - failed XML Schema validation.", e);
            throw new ObjectValidityException("[DOValidatorImpl]: validateXMLSchema. "
                    + e.getMessage());
        }
        logger.debug("VALIDATE: SUCCESS - passed XML Schema validation.");
    }
View Full Code Here

                      e);
            throw e;
        } catch (Exception e) {
            logger.error("VALIDATE: ERROR - failed Schematron rules validation.",
                      e);
            throw new ObjectValidityException("[DOValidatorImpl]: "
                    + "failed Schematron rules validation. " + e.getMessage());
        }
        logger.debug("VALIDATE: SUCCESS - passed Schematron rules validation.");
    }
View Full Code Here

TOP

Related Classes of org.fcrepo.server.errors.ObjectValidityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.