Package org.dspace.content.crosswalk

Examples of org.dspace.content.crosswalk.MetadataValidationException


            {
                return (Element) result;
            }
            else
            {
                throw new MetadataValidationException("METSManifest: Failed to resolve XPath, path=\"" + path + "\"");
            }
        }
        catch (JDOMException je)
        {
            throw new MetadataValidationException("METSManifest: Failed to resolve XPath, path=\""+path+"\"", je);
        }
    }
View Full Code Here


        // div@DMDID is actually IDREFS, a space-separated list of IDs:
        Element objDiv = getObjStructDiv();
        String dmds = objDiv.getAttributeValue("DMDID");
        if (dmds == null)
        {
            throw new MetadataValidationException("Invalid METS: Missing reference to Item descriptive metadata, first div on first structmap must have a DMDID attribute.");
        }
       
        return getDmdElements(dmds);
    }
View Full Code Here

                        if (mdWrap != null)
                        {
                            Element bin = mdWrap.getChild("binData", metsNS);
                            if (bin == null)
                            {
                                throw new MetadataValidationException("Invalid METS Manifest: mdWrap element for streaming crosswalk without binData child.");
                            }
                            else
                            {
                                byte value[] = Base64.decodeBase64(bin.getText().getBytes());
                                sxwalk.ingest(context, dso,
                                              new ByteArrayInputStream(value),
                                              mdWrap.getAttributeValue("MIMETYPE"));
                            }
                        }
                        else
                        {
                            throw new MetadataValidationException("Cannot process METS Manifest: " +
                                    "Metadata of type=" + type + " requires a reference to a stream (mdRef), which was not found in " + xmd.getName());
                        }
                    }
                }
                else
                {
                    throw new MetadataValidationException("Cannot process METS Manifest: " +
                            "No crosswalk found for contents of " + xmd.getName() + " element, MDTYPE=" + type);
                }
            }
        }
        catch (CrosswalkObjectNotSupported e)
View Full Code Here

               CrosswalkException, IOException, SQLException, AuthorizeException
    {
        Element file = getElementByXPath("descendant::mets:file[@ID=\""+fileId+"\"]", false);
        if (file == null)
        {
            throw new MetadataValidationException("Failed in Bitstream crosswalk, Could not find file element with ID=" + fileId);
        }

        // In DSpace METS SIP spec, admin metadata is only "highly
        // recommended", not "required", so it is OK if there is no ADMID.
        String amds = file.getAttributeValue("ADMID");
View Full Code Here

               CrosswalkException, IOException, SQLException, AuthorizeException
    {
        Element file = getElementByXPath("descendant::mets:fileGrp[@ADMID=\""+fileId+"\"]", false);
        if (file == null)
        {
            throw new MetadataValidationException("Failed in Bitstream crosswalk, Could not find file element with ID=" + fileId);
        }

        // In DSpace METS SIP spec, admin metadata is only "highly
        // recommended", not "required", so it is OK if there is no ADMID.
        String amds = file.getAttributeValue("ADMID");
View Full Code Here

        throws MetadataValidationException
    {
        String profile = manifest.getProfile();
        if (profile == null)
        {
            throw new MetadataValidationException("Cannot accept METS with no PROFILE attribute!");
        }
        else if (!profile.equals(DSpaceAIPDisseminator.PROFILE_1_0))
        {
            throw new MetadataValidationException("METS has unacceptable PROFILE attribute, profile=" + profile);
        }
    }
View Full Code Here

        }

        // it's an error if there is nothing to crosswalk:
        else
        {
            throw new MetadataValidationException("DSpaceAIPIngester: Could not find an acceptable object-wide DMD section in manifest.");
        }
    }
View Full Code Here

            cos = parser.getDocument();

            // sanity check: PDFBox breaks on encrypted documents, so give up.
            if(cos.getEncryptionDictionary() != null)
            {
                throw new MetadataValidationException("This packager cannot accept an encrypted PDF document.");
            }

            /* PDF to DC "crosswalk":
             *
             * NOTE: This is not in a crosswalk plugin because (a) it isn't
             * useful anywhere else, and more importantly, (b) the source
             * data is not XML so it doesn't fit the plugin's interface.
             *
             * pattern of crosswalk -- PDF dict entries to DC:
             *   Title -> title.null
             *   Author -> contributor.author
             *   CreationDate -> date.created
             *   ModDate -> date.created
             *   Creator -> description.provenance (application that created orig)
             *   Producer -> description.provenance (convertor to pdf)
             *   Subject -> description.abstract
             *   Keywords -> subject.other
             *    date is java.util.Calendar
             */
            PDDocument pd = new PDDocument(cos);
            PDDocumentInformation docinfo = pd.getDocumentInformation();
            String title = docinfo.getTitle();

            // sanity check: item must have a title.
            if (title == null)
            {
                throw new MetadataValidationException("This PDF file is unacceptable, it does not have a value for \"Title\" in its Info dictionary.");
            }
            if (log.isDebugEnabled())
            {
                log.debug("PDF Info dict title=\"" + title + "\"");
            }
View Full Code Here

            // Get inputStream associated with this file
            if (manifestEntry != null)
                return zipPackage.getInputStream(manifestEntry);
            else
            {
                throw new MetadataValidationException("Manifest file references file '"
                                        + path + "' not included in the zip.");
            }
        }
    }
View Full Code Here

                throws MetadataValidationException, IOException
        {
            String path = METSManifest.getFileName(mdref);
            if (packageFile == null)
            {
                throw new MetadataValidationException(
                        "Failed referencing mdRef element, because there is no package specified.");
            }

            // Use the 'getFileInputStream()' method from the
            // AbstractMETSIngester to retrieve the inputstream for the
View Full Code Here

TOP

Related Classes of org.dspace.content.crosswalk.MetadataValidationException

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.