Changes to the bitstream format metadata are only written to the database when update is called. @author Robert Tansley @version $Revision: 3761 $
update
182183184185186187188189190191192193194195196
public String getFilename(Context context, Deposit deposit, boolean original) throws DSpaceSWORDException { try { BitstreamFormat bf = BitstreamFormat.findByMIMEType(context, deposit.getContentType()); String[] exts = null; if (bf != null) { exts = bf.getExtensions(); } String fn = deposit.getFilename(); if (fn == null || "".equals(fn)) {
699700701702703704705706707708709
b.setSource("Written by FormatFilter " + formatFilter.getClass().getName() + " on " + DCDate.getCurrent() + " (GMT)."); b.setDescription(formatFilter.getDescription()); // Find the proper format BitstreamFormat bf = BitstreamFormat.findByShortDescription(c, formatFilter.getFormatString()); b.setFormat(bf); b.update(); //Inherit policies from the source bitstream
99100101102103104105106107108109
// utility to grovel bitstream formats.. private static void setFormatToMIMEType(Context context, Bitstream bs, String mimeType) throws SQLException { BitstreamFormat bf[] = BitstreamFormat.findNonInternal(context); for (int i = 0; i < bf.length; ++i) { if (bf[i].getMIMEType().equalsIgnoreCase(mimeType)) { bs.setFormat(bf[i]);
240241242243244245246247248249250
throw new PackageValidationException("This disseminator can only handle objects of type ITEM."); Item item = (Item)dso; try { BitstreamFormat pdff = BitstreamFormat.findByShortDescription(context, BITSTREAM_FORMAT_NAME); if (pdff == null) throw new PackageValidationException("Cannot find BitstreamFormat \""+BITSTREAM_FORMAT_NAME+"\""); Bitstream pkgBs = PackageUtils.getBitstreamByFormat(item, pdff, Constants.DEFAULT_BUNDLE_NAME); if (pkgBs == null)
249250251252253254255256257258259
String bsName = resource.getAttributeValue("title"); newBitstream.setName(bsName); // Identify the format String mimeString = resource.getAttributeValue("type"); BitstreamFormat bsFormat = BitstreamFormat.findByMIMEType(context, mimeString); if (bsFormat == null) { bsFormat = FormatIdentifier.guessFormat(context, newBitstream); } newBitstream.setFormat(bsFormat); newBitstream.update();
141142143144145146147148149150151152153
break; } // is this the license? check the format BitstreamFormat bf = bitstreams[0].getFormat(); if (bf.getShortDescription().equals("License")) { System.out.println("Found license!"); if (licenseBundleIndex == -1) {
435436437438439440441442443444445446447448
{ AttributeMap attributes; // ////////////////////////////// // Determine the file attributes BitstreamFormat format = bitstream.getFormat(); String mimeType = null; if (format != null) mimeType = format.getMIMEType(); String checksumType = bitstream.getChecksumAlgorithm(); String checksum = bitstream.getChecksum(); long size = bitstream.getSize(); // ////////////////////////////////
566567568569570571572573574575576
ByteArrayInputStream OREStream = new ByteArrayInputStream(OREString.getBytes()); Bitstream OREBitstream = OREBundle.createBitstream(OREStream); OREBitstream.setName("ORE.xml"); BitstreamFormat bf = FormatIdentifier.guessFormat(ourContext, OREBitstream); OREBitstream.setFormat(bf); OREBitstream.update(); OREBundle.addBitstream(OREBitstream); OREBundle.update();
324325326327328329330331332333334
Element bs = prop.getChild("bitstream", DAV.NS_DSPACE); if (bs != null) { InputStream bis = DAVBitstream.getXmlBitstreamContent( this.context, bs); BitstreamFormat bsf = DAVBitstream.getXmlBitstreamFormat( this.context, bs); if (bis == null || bsf == null) { throw new DAVStatusException(DAV.SC_CONFLICT, "Unacceptable value for logo property.");
275276277278279280281282283284285