Examples of MetadataValidationException


Examples of nexj.core.meta.MetadataValidationException

         compile(machine);
      }
      catch (CompilerException e)
      {
         MetadataValidationException x = new MetadataValidationException(e);
         String sFullName = getFullName();

         x.setTypeName(getTypeName());
         x.setProperty(getPropName(), sFullName);

         String sURL = ((CompilerException)e).getURL();

         if (sURL != null && sURL.startsWith(getURLPrefix()))
         {
            x.setProperty("step", sURL.substring(getURLPrefix().length() + sFullName.length() + 1));
         }

         throw x;
      }
      finally
View Full Code Here

Examples of nexj.core.meta.MetadataValidationException

         return new Compiler().compile(code, m_posMap, machine, false);
      }
      catch (CompilerException e)
      {
         MetadataValidationException x = new MetadataValidationException(e);

         setProperties(x);

         String sURL = e.getURL();

         if (sURL != null)
         {
            int i = URL_PREFIX.length() + m_sName.length() + 1;
            int k = sURL.indexOf('.', i);

            if (k >= 0)
            {
               int m = sURL.indexOf('.', k + 1);

               if (m >= 0)
               {
                  x.setProperty("argument", sURL.substring(m + 1));
               }
               else
               {
                  m = sURL.length();
               }

               x.setProperty("mapping", sURL.substring(k + 1, m));
            }
            else
            {
               x.setProperty("script", sURL.substring(i));
            }
         }

         throw x;
      }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

        public Bitstream getBitstreamForMdRef(Element mdref)
            throws MetadataValidationException, IOException, SQLException, AuthorizeException
        {
            String path = METSManifest.getFileName(mdref);
            if (mdBundle == null)
                throw new MetadataValidationException("Failed referencing mdRef element, because there were no metadata files.");
            return mdBundle.getBitstreamByName(path);
        }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

        public InputStream getInputStream(Element mdref)
            throws MetadataValidationException, IOException, SQLException, AuthorizeException
        {
            Bitstream mdbs = getBitstreamForMdRef(mdref);
            if (mdbs == null)
                throw new MetadataValidationException("Failed dereferencing bitstream for mdRef element="+mdref.toString());
            return mdbs.retrieve();
        }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

    void checkManifest(METSManifest manifest)
        throws MetadataValidationException
    {
        String profile = manifest.getProfile();
        if (profile == null)
            throw new MetadataValidationException("Cannot accept METS with no PROFILE attribute!");
        else if (!profile.startsWith(PROFILE_START))
            throw new MetadataValidationException("METS has unacceptable PROFILE value, profile="+profile);
    }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

            log.debug(outputPretty.outputString(metsDocument));
              */
        }
        catch (JDOMException je)
        {
            throw new MetadataValidationException("Error validating METS in "
                    + is.toString(),  je);
        }

        return new METSManifest(builder, metsDocument.getRootElement());
    }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

        if (contentFiles != null)
            return contentFiles;

        Element fileSec = mets.getChild("fileSec", metsNS);
        if (fileSec == null)
            throw new MetadataValidationException("Invalid METS Manifest: DSpace requires a fileSec element, but it is missing.");

        contentFiles = new ArrayList();
        Iterator fgi = fileSec.getChildren("fileGrp", metsNS).iterator();
        while (fgi.hasNext())
        {
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

                xpath.addNamespace(metsNS);
                mdFiles = xpath.selectNodes(mets);
            }
            catch (JDOMException je)
            {
                throw new MetadataValidationException("Failed while searching for mdRef elements in manifest: ", je);
            }
        }
        return mdFiles;
    }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

        throws MetadataValidationException
    {
        Element fg = file.getParentElement();
        String fgUse = fg.getAttributeValue("USE");
        if (fgUse == null)
            throw new MetadataValidationException("Invalid METS Manifest: every fileGrp element must have a USE attribute.");
        return normalizeBundleName(fgUse);
    }
View Full Code Here

Examples of org.dspace.content.crosswalk.MetadataValidationException

            ref = file.getChild("FLocat", metsNS);
            if (ref == null)
            {
                // check for forbidden FContent child first:
                if (file.getChild("FContent", metsNS) == null)
                    throw new MetadataValidationException("Invalid METS Manifest: Every file element must have FLocat child.");
                else
                    throw new MetadataValidationException("Invalid METS Manifest: file element has forbidden FContent child, only FLocat is allowed.");
            }
        }
        else if (file.getName().equals("mdRef"))
            ref = file;
        else
            throw new MetadataValidationException("getFileName() called with recognized element type: "+file.toString());
        String loctype = ref.getAttributeValue("LOCTYPE");
        if (loctype != null && loctype.equals("URL"))
        {
            String result = ref.getAttributeValue("href", xlinkNS);
            if (result == null)
                throw new MetadataValidationException("Invalid METS Manifest: FLocat/mdRef is missing the required xlink:href attribute.");
            return result;
        }
        throw new MetadataValidationException("Invalid METS Manifest: FLocat/mdRef does not have LOCTYPE=\"URL\" attribute.");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.