Package org.fcrepo.server.errors

Examples of org.fcrepo.server.errors.ObjectIntegrityException


                    + e.getMessage());
        }
        try {
            xmlReader.parse(new InputSource(in));
        } catch (Exception e) {
            throw new ObjectIntegrityException("Error parsing Method Map datastream"
                    + e.getClass().getName() + ": " + e.getMessage());
        }
    }
View Full Code Here


                                          PrintWriter writer,
                                          String encoding)
            throws ObjectIntegrityException, UnsupportedEncodingException,
            StreamIOException {
        if (in == null) {
            throw new ObjectIntegrityException("Object's inline xml "
                    + "stream cannot be null.");
        }
        try {
            InputStreamReader chars =
                    new InputStreamReader(in, Charset.forName(encoding));
View Full Code Here

                    case 'I':
                        return MODEL.INACTIVE.localName;
                    case 'A':
                        return MODEL.ACTIVE.localName;
                    default:
                        throw new ObjectIntegrityException("Could not determine "
                                                   + "state attribute from '"
                                                   + obj.getState() + "'");
                }
            }
    }
View Full Code Here

     * @throws ObjectIntegrityException
     */
    protected static void validateAudit(AuditRecord audit)
            throws ObjectIntegrityException {
        if (audit.id == null || audit.id.equals("")) {
            throw new ObjectIntegrityException("Audit record must have id.");
        }
        if (audit.date == null || audit.date.equals("")) {
            throw new ObjectIntegrityException("Audit record must have date.");
        }
        if (audit.processType == null || audit.processType.equals("")) {
            throw new ObjectIntegrityException("Audit record must have processType.");
        }
        if (audit.action == null || audit.action.equals("")) {
            throw new ObjectIntegrityException("Audit record must have action.");
        }
        if (audit.componentID == null) {
            audit.componentID = ""; // for backwards compatibility, no error on null
            // throw new ObjectIntegrityException("Audit record must have componentID.");
        }
        if (audit.responsibility == null || audit.responsibility.equals("")) {
            throw new ObjectIntegrityException("Audit record must have responsibility.");
        }
    }
View Full Code Here

                    + ": " + e.getMessage());
        }
        try {
            parser.parse(in, this);
        } catch (SAXException saxe) {
            throw new ObjectIntegrityException("Parse error parsing DC XML Metadata: "
                    + saxe.getMessage());
        } catch (IOException ioe) {
            throw new StreamIOException("Stream error parsing DC XML Metadata: "
                    + ioe.getMessage());
        }
View Full Code Here

                    + e.getMessage());
        }
        try {
            xmlReader.parse(new InputSource(in));
        } catch (Exception e) {
            throw new ObjectIntegrityException("Error parsing DSInputSpec datastream"
                    + e.getClass().getName() + ": " + e.getMessage());
        }
    }
View Full Code Here

                writer.print(">\n");
                DSBinding[] bindings = diss.dsBindMap.dsBindings;
                for (int i = 0; i < bindings.length; i++) {
                    if (bindings[i].bindKeyName == null
                            || bindings[i].bindKeyName.equals("")) {
                        throw new ObjectIntegrityException("Object's disseminator"
                                + " binding map binding must have a binding key name.");
                    }
                    writer.print("<");
                    writer.print(METS.prefix);
                    writer.print(":div TYPE=\"");
                    writer.print(bindings[i].bindKeyName);
                    if (bindings[i].bindLabel != null
                            && !bindings[i].bindLabel.equals("")) {
                        writer.print("\" LABEL=\"");
                        writer.print(StreamUtility.enc(bindings[i].bindLabel));
                    }
                    if (bindings[i].seqNo != null
                            && !bindings[i].seqNo.equals("")) {
                        writer.print("\" ORDER=\"");
                        writer.print(bindings[i].seqNo);
                    }
                    if (bindings[i].datastreamID == null
                            || bindings[i].datastreamID.equals("")) {
                        throw new ObjectIntegrityException("Object's disseminator"
                                + " binding map binding must point to a datastream.");
                    }
                    writer.print("\">\n<");
                    writer.print(METS.prefix);
                    writer.print(":fptr FILEID=\"");
View Full Code Here

    private void addObjectProperties() throws ObjectIntegrityException {
        PID pid;
        try {
            pid = new PID(m_feed.getId().toString());
        } catch (MalformedPIDException e) {
            throw new ObjectIntegrityException(e.getMessage(), e);
        }

        String label = m_feed.getTitle();
        String state =
                m_xpath.valueOf("/a:feed/a:category[@scheme='"
                        + MODEL.STATE.uri + "']/@term", m_feed);
        String createDate =
                m_xpath.valueOf("/a:feed/a:category[@scheme='"
                        + MODEL.CREATED_DATE.uri + "']/@term", m_feed);

        m_obj.setPid(pid.toString());

        try {
            m_obj.setState(DOTranslationUtility.readStateAttribute(state));
        } catch (ParseException e) {
            throw new ObjectIntegrityException("Could not read object state", e);
        }

        m_obj.setLabel(label);
        m_obj.setOwnerId(getOwnerId());
        m_obj.setCreateDate(DateUtility.convertStringToDate(createDate));
View Full Code Here

                    ds.xmlContent = entry.getContent().getBytes(m_encoding); //IOUtils.toByteArray(entry.getContentStream());
                }
            } catch (UnsupportedEncodingException e) {
                throw new StreamIOException(e.getMessage(), e);
            } catch (FileNotFoundException e) {
                throw new ObjectIntegrityException(e.getMessage(), e);
            }
        }

        if (ds.xmlContent != null) {
            ds.DSSize = ds.xmlContent.length;
View Full Code Here

            }
            m_obj.getAuditRecords().addAll(DOTranslationUtility
                    .getAuditRecords(auditTrail));
            auditTrail.close();
        } catch (XMLStreamException e) {
            throw new ObjectIntegrityException(e.getMessage(), e);
        } catch (IOException e) {
            throw new StreamIOException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

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

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.