diff -rp ./dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java ../dspace-3.2-src-release(modified)/./dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java
*** ./dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java	Wed Jul 24 13:43:56 2013
--- ../dspace-3.2-src-release(modified)/./dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java	Fri Apr 11 12:56:23 2014
*************** public abstract class AbstractMETSIngest
*** 791,796 ****
--- 791,797 ----
              // Create the bitstream in the bundle & initialize its name
              Bitstream bitstream = bundle.createBitstream(fileStream);
              bitstream.setName(path);
+             bitstream.setSource(path);
  
               // Set bitstream sequence id, if known
              String seqID = mfile.getAttributeValue("SEQ");
diff -rp ./dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java ../dspace-3.2-src-release(modified)/./dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java
*** ./dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java	Wed Jul 24 13:43:56 2013
--- ../dspace-3.2-src-release(modified)/./dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java	Fri Apr 11 12:57:52 2014
*************** public class PackageUtils
*** 169,174 ****
--- 169,179 ----
              lb = bundles[0];
          }
  
+         // dont add default license if there already is licenses in the license collection
+         if(lb.getBitstreams().length > 0 && license == null) {
+             return;
+         }
+ 
          //Create the License bitstream
          Bitstream lbs = lb.createBitstream(lis);
          lis.close();
Only in ../dspace-3.2-src-release(modified)/./dspace-jspui: dspace-jspui.iml
Only in ../dspace-3.2-src-release(modified)/./dspace-lni/dspace-lni-client: dspace-lni-client.iml
Only in ../dspace-3.2-src-release(modified)/./dspace-lni: dspace-lni.iml
diff -rp ./dspace-lni/src/main/java/org/dspace/app/dav/DAVBitstream.java ../dspace-3.2-src-release(modified)/./dspace-lni/src/main/java/org/dspace/app/dav/DAVBitstream.java
*** ./dspace-lni/src/main/java/org/dspace/app/dav/DAVBitstream.java	Wed Jul 24 13:43:56 2013
--- ../dspace-3.2-src-release(modified)/./dspace-lni/src/main/java/org/dspace/app/dav/DAVBitstream.java	Fri Apr 11 12:55:40 2014
*************** import org.apache.commons.codec.binary.B
*** 22,35 ****
  import org.apache.log4j.Logger;
  import org.dspace.authorize.AuthorizeException;
  import org.dspace.authorize.AuthorizeManager;
! import org.dspace.content.Bitstream;
! import org.dspace.content.BitstreamFormat;
! import org.dspace.content.Bundle;
! import org.dspace.content.Item;
  import org.dspace.core.Constants;
  import org.dspace.core.Context;
  import org.dspace.core.LogManager;
  import org.dspace.core.Utils;
  import org.jdom.Element;
  import org.jdom.Namespace;
  
--- 22,33 ----
  import org.apache.log4j.Logger;
  import org.dspace.authorize.AuthorizeException;
  import org.dspace.authorize.AuthorizeManager;
! import org.dspace.content.*;
  import org.dspace.core.Constants;
  import org.dspace.core.Context;
  import org.dspace.core.LogManager;
  import org.dspace.core.Utils;
+ import org.dspace.eperson.EPerson;
  import org.jdom.Element;
  import org.jdom.Namespace;
  
*************** class DAVBitstream extends DAVDSpaceObje
*** 663,670 ****
      protected int deleteInternal() throws DAVStatusException, SQLException,
              AuthorizeException, IOException
      {
!         throw new DAVStatusException(HttpServletResponse.SC_NOT_IMPLEMENTED,
!                 "DELETE method not implemented for BitStream.");
      }
  
      /* (non-Javadoc)
--- 661,686 ----
      protected int deleteInternal() throws DAVStatusException, SQLException,
              AuthorizeException, IOException
      {
!         if(this.bitstream.getBundles().length > 0) {
!             final Bundle bundle = bitstream.getBundles()[0];
!             if(bundle.getItems().length > 0) {
!                 final Item item = bundle.getItems()[0];
!                 final EPerson currentUser = context.getCurrentUser();
!                 final StringBuilder sb = new StringBuilder();
! 
!                 sb.append("Updated by " + currentUser.getFullName() + " (" + currentUser.getEmail() + ") on " + DCDate.getCurrent() + ":");
!                 sb.append(" File \"").append(this.bitstream.getName()).append("\" was removed.");
!                 item.addMetadata("dc", "description", "provenance", "en", sb.toString());
!                 item.update();
!             }
!         }
!         for (Bundle bundle : this.bitstream.getBundles())
!         {
!             bundle.removeBitstream(this.bitstream);
!             bundle.update();
!         }
!         this.context.commit();
!         return HttpServletResponse.SC_OK; // HTTP OK
      }
  
      /* (non-Javadoc)
diff -rp ./dspace-lni/src/main/java/org/dspace/app/dav/DAVItem.java ../dspace-3.2-src-release(modified)/./dspace-lni/src/main/java/org/dspace/app/dav/DAVItem.java
*** ./dspace-lni/src/main/java/org/dspace/app/dav/DAVItem.java	Wed Jul 24 13:43:56 2013
--- ../dspace-3.2-src-release(modified)/./dspace-lni/src/main/java/org/dspace/app/dav/DAVItem.java	Fri Apr 11 13:01:47 2014
***************
*** 7,42 ****
   */
  package org.dspace.app.dav;
  
! import java.io.ByteArrayOutputStream;
! import java.io.File;
! import java.io.FileInputStream;
! import java.io.IOException;
  import java.sql.SQLException;
! import java.util.ArrayList;
! import java.util.List;
! import java.util.Vector;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.log4j.Logger;
  import org.dspace.authorize.AuthorizeException;
  import org.dspace.authorize.AuthorizeManager;
! import org.dspace.content.Bitstream;
! import org.dspace.content.Bundle;
  import org.dspace.content.Collection;
- import org.dspace.content.DCValue;
- import org.dspace.content.Item;
  import org.dspace.content.crosswalk.CrosswalkException;
! import org.dspace.content.packager.PackageDisseminator;
! import org.dspace.content.packager.PackageException;
! import org.dspace.content.packager.PackageParameters;
  import org.dspace.core.ConfigurationManager;
  import org.dspace.core.Constants;
  import org.dspace.core.Context;
  import org.dspace.core.PluginManager;
  import org.dspace.core.Utils;
  import org.dspace.eperson.EPerson;
  import org.dspace.license.CreativeCommons;
  import org.jdom.Element;
  import org.jdom.Namespace;
--- 7,40 ----
   */
  package org.dspace.app.dav;
  
! import java.io.*;
  import java.sql.SQLException;
! import java.util.*;
! import java.util.regex.Matcher;
! import java.util.regex.Pattern;
! import java.util.zip.ZipEntry;
! import java.util.zip.ZipFile;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
+ import org.apache.commons.io.IOUtils;
+ import org.apache.commons.lang.NotImplementedException;
  import org.apache.log4j.Logger;
  import org.dspace.authorize.AuthorizeException;
  import org.dspace.authorize.AuthorizeManager;
! import org.dspace.content.*;
  import org.dspace.content.Collection;
  import org.dspace.content.crosswalk.CrosswalkException;
! import org.dspace.content.crosswalk.MetadataValidationException;
! import org.dspace.content.packager.*;
  import org.dspace.core.ConfigurationManager;
  import org.dspace.core.Constants;
  import org.dspace.core.Context;
  import org.dspace.core.PluginManager;
  import org.dspace.core.Utils;
  import org.dspace.eperson.EPerson;
+ import org.dspace.handle.HandleManager;
  import org.dspace.license.CreativeCommons;
  import org.jdom.Element;
  import org.jdom.Namespace;
*************** class DAVItem extends DAVDSpaceObject
*** 102,107 ****
--- 100,117 ----
          allProps.add(withdrawnProperty);
      }
  
+     // value of mets.submission.preserveManifest config key
+     private static final boolean preserveManifest =
+             ConfigurationManager.getBooleanProperty("mets.submission.preserveManifest", false);
+ 
+ 
+     private static final java.util.Collection<String> SYSTEM_DC_META = Collections.unmodifiableCollection(Arrays.asList(new String[]{
+             "dc.description.provenance"
+             , "dc.identifier.uri"
+             , "dc.date.accessioned"
+             , "dc.date.available"
+     }));
+ 
      /* (non-Javadoc)
       * @see org.dspace.app.dav.DAVResource#getAllProperties()
       */
*************** class DAVItem extends DAVDSpaceObject
*** 508,521 ****
      }
  
      /* (non-Javadoc)
!      * @see org.dspace.app.dav.DAVResource#put()
!      */
      @Override
      protected void put() throws SQLException, AuthorizeException,
              IOException, DAVStatusException
      {
!         throw new DAVStatusException(HttpServletResponse.SC_NOT_IMPLEMENTED,
!                 "PUT is not implemented for Item.");
      }
  
      /**
--- 518,945 ----
      }
  
      /* (non-Javadoc)
!     * @see org.dspace.app.dav.DAVResource#put()
!     */
      @Override
      protected void put() throws SQLException, AuthorizeException,
              IOException, DAVStatusException
      {
! 
!         AuthorizeManager.authorizeAction(context, item, Constants.WRITE);
!         final PackageParameters params = PackageParameters.create(this.request);
!         params.setWorkflowEnabled(true);
! 
!         File tempFile = null;
!         try {
! 
!             final String containsMetaData = this.request.getParameter("metadata");
! 
!             boolean updatedMetadata = false;
!             final List<String> addedCollections = new ArrayList<String>();
!             final List<String> removedCollections = new ArrayList<String>();
!             final List<String> addedFiles = new ArrayList<String>();
! 
!             // Handle collections
!             final String collectionsString = this.request.getParameter("collections");
!             if(collectionsString != null){
!                 final List<String> collections = Arrays.asList(collectionsString.split(","));
! 
!                 // Link to new collections
!                 for (String collectionHandle : collections) {
!                     boolean found = false;
!                     for (Collection collection : item.getCollections()) {
!                         if(collection.getHandle().equals(collectionHandle)) {
!                             found = true;
!                             break;
!                         }
!                     }
!                     if(!found) {
!                         final DSpaceObject collectionDso = HandleManager.resolveToObject(context, collectionHandle);
!                         if(collectionDso == null)
!                             throw new DAVStatusException(HttpServletResponse.SC_NOT_FOUND,
!                                     "Cannot resolve handle \"" + collectionHandle + "\"");
!                         final DAVCollection destination = new DAVCollection(context, request, response, pathElt, (Collection) collectionDso);
!                         addItemToCollection(context, item, destination, true);
!                         addedCollections.add(collectionDso.getName() + "(" + collectionHandle + ")");
!                     }
!                 }
! 
!                 // Remove from old collections
!                 for (Collection collection : item.getCollections()) {
!                     if(collections.contains(collection.getHandle()))
!                         continue;
!                     collection.removeItem(this.item);
!                     collection.update();
!                     removedCollections.add(collection.getName() + "(" + collection.getHandle() + ")");
!                 }
!             }
! 
!             // Update metadata and files according to mets package
!             if(!"false".equals(containsMetaData)) {
!                 // Ensure that we are recieving a METS package
!                 // XXX should be generalized to extend beyound METS packages
!                 String packageType = this.request.getParameter("package");
!                 if (packageType == null)
!                 {
!                     packageType = this.request.getContentType();
!                 }
!                 if (packageType == null)
!                 {
!                     throw new DAVStatusException(
!                             HttpServletResponse.SC_BAD_REQUEST,
!                             "Cannot determine package type, need content-type header or package param");
!                 } else if (!"METS".equals(packageType))
!                 {
!                     throw new DAVStatusException(
!                             HttpServletResponse.SC_BAD_REQUEST,
!                             "Item update cannot handle package of type " + packageType + " only METS packages are accepted");
!                 }
! 
!                 // Write zip data to file
!                 final ZipFile zipFile;
!                 {
!                     tempFile = File.createTempFile(getClass().getSimpleName(), ".zip");
!                     final FileOutputStream output = new FileOutputStream(tempFile);
!                     IOUtils.copyLarge(request.getInputStream(), output);
!                     output.close();
!                     zipFile = new ZipFile(tempFile);
!                 }
! 
!                 // Parse METS manifest
!                 final METSManifest manifest;
!                 {
!                     final ZipEntry manifestFileZipEntry = zipFile.getEntry(METSManifest.MANIFEST_FILE);
!                     if(manifestFileZipEntry == null) {
!                         throw new DAVStatusException(
!                                 HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
!                                 "METS package didnt contain manifest file " + METSManifest.MANIFEST_FILE);
!                     }
!                     manifest = METSManifest.create(zipFile.getInputStream(manifestFileZipEntry), false, "pure");
!                 }
! 
!                 { // Update metadata if found in METS manifest
!                     if(manifest.getItemDmds().length > 0) {
!                         clearNonSystemMetadata();
!                         crosswalkObjectDmd(context, item, manifest, new METSManifest.Mdref() {
!                             @Override
!                             public InputStream getInputStream(Element mdRef)
!                                     throws MetadataValidationException, PackageValidationException,
!                                     IOException, SQLException, AuthorizeException {
!                                 throw new NotImplementedException();
!                             }
!                         }, manifest.getItemDmds(), params);
!                         updatedMetadata = true;
! 
!                         // Save mets manifest if configured
!                         if(preserveManifest) {
!                             // Find metadata bundle
!                             Bundle mdBundle;
!                             {
!                                 Bundle[] bundles = item.getBundles(Constants.METADATA_BUNDLE_NAME);
!                                 if(bundles.length > 0)
!                                     mdBundle = bundles[0];
!                                 else
!                                     mdBundle = item.createBundle(Constants.METADATA_BUNDLE_NAME);
!                             }
! 
!                             // Remove old mets file
!                             final Bitstream oldMetsFile = mdBundle.getBitstreamByName(METSManifest.MANIFEST_FILE);
!                             if(oldMetsFile != null)
!                                 mdBundle.removeBitstream(oldMetsFile);
! 
!                             // Add new file
!                             final ZipEntry manifestFileZipEntry = zipFile.getEntry(METSManifest.MANIFEST_FILE);
!                             Bitstream bs = mdBundle.createBitstream(zipFile.getInputStream(manifestFileZipEntry));
!                             bs.setName(METSManifest.MANIFEST_FILE);
!                             bs.setSource(METSManifest.MANIFEST_FILE);
!                             bs.setFormat(PackageUtils.findOrCreateBitstreamFormat(
!                                     context, "DSpace METS SIP", "application/xml",
!                                     "DSpace METS SIP package manifest"));
!                         }
!                     }
!                 }
! 
!                 { // Cleanup current licenses if update contains a license
!                     boolean foundLicenseFile = false;
!                     final List<Element> manifestContentFiles = manifest.getContentFiles();
!                     for (Element manifestContentFile : manifestContentFiles) {
!                         final String bundleName = METSManifest.getBundleName(manifestContentFile);
!                         if(Constants.LICENSE_BUNDLE_NAME.equals(bundleName)) {
!                             foundLicenseFile = true;
!                             break;
!                         }
!                     }
! 
!                     if(foundLicenseFile) {
!                         // found license, clean up current licenses
!                         final Bundle licenseBundle = item.getBundles(Constants.LICENSE_BUNDLE_NAME)[0];
!                         for (Bitstream licenseBitstream : licenseBundle.getBitstreams()) {
!                             licenseBundle.removeBitstream(licenseBitstream);
!                         }
!                         licenseBundle.update();
!                     }
!                 }
! 
!                 { // Add files found in METS manifest
!                     final List<Element> manifestContentFiles = manifest.getContentFiles();
!                     for (Element manifestContentFile : manifestContentFiles) {
!                         Bitstream bitstream = processFile(manifest, params, manifestContentFile, zipFile);
!                         if(!bitstream.getBundles()[0].getName().equals(Constants.LICENSE_BUNDLE_NAME))
!                             addedFiles.add(bitstream.getName()); // only register non license files
!                     }
!                 }
!             }
! 
!             boolean changed = updatedMetadata || addedFiles.size() > 0 || addedCollections.size() > 0 || removedCollections.size() > 0;
!             { // Add new provenance message (dc.description.provenance)
!                 if(changed) {
!                     final EPerson currentUser = context.getCurrentUser();
!                     final StringBuilder sb = new StringBuilder();
!                     sb.append("Updated by " + currentUser.getFullName() + " (" + currentUser.getEmail() + ") on " + DCDate.getCurrent() + ":");
!                     if(updatedMetadata)
!                         sb.append(" Metadata was updated.");
!                     for (String fileName : addedFiles)
!                         sb.append(" File \"").append(fileName).append("\" was added.");
!                     for (String collection : addedCollections)
!                         sb.append(" Item was added to collection \"").append(collection).append("\".");
!                     for (String collection : removedCollections)
!                         sb.append(" Item was removed from collection \"").append(collection).append("\".");
!                     item.addMetadata("dc", "description", "provenance", "en", sb.toString());
!                 }
!             }
! 
!             // Calculate location
!             String location = null;
!             {
!                 String handle = HandleManager.findHandle(this.context, item);
!                 String end = (handle != null) ? DAVDSpaceObject
!                         .getPathElt(handle) : DAVItem.getPathElt(item);
!                 DAVItem newItem = new DAVItem(this.context, this.request, this.response,
!                         makeChildPath(end), item);
!                 location = newItem.hrefURL();
!             }
! 
!             if(changed) {
!                 item.update();
!                 this.context.commit();
!                 log.info("Updated Item, location=" + location);
!             } else {
!                 this.context.abort();
!                 log.info("No changes to item, location=" + location);
!             }
!             this.response.setHeader("Location", location);
!             this.response.setStatus(HttpServletResponse.SC_CREATED);
! 
!         } catch(Exception ex) {
!             throw new DAVStatusException(
!                     HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
!                     "Got exception processing update", ex);
!         } finally {
!             if(tempFile != null){
!                 tempFile.delete();
!             }
!         }
!     }
! 
! 
!     @SuppressWarnings("static-access")
!     private Bitstream processFile(METSManifest manifest, PackageParameters params, Element manifestContentFile, ZipFile zipFile) throws Exception {
! 
!         // Create the bundle that the file should belong to
!         final String bundleName = manifest.getBundleName(manifestContentFile);
!         Bundle bundle;
!         Bundle bns[] = item.getBundles(bundleName);
!         if (bns != null && bns.length > 0)
!             bundle = bns[0];
!         else
!             bundle = item.createBundle(bundleName);
! 
!         // Create the bit stream
!         final String fileName = METSManifest.getFileName(manifestContentFile);
!         final ZipEntry fileZipEntry = zipFile.getEntry(fileName);
!         if(fileZipEntry == null)
!             throw new Exception("Unable to find zip entry for " + fileName);
! 
!         final Bitstream bitstream = bundle.createBitstream(zipFile.getInputStream(fileZipEntry));
! 
!         // Set bitstream file name
!         int lastSlash = fileName.lastIndexOf('/');
!         if (lastSlash >= 0  && lastSlash+1 < fileName.length())
!             bitstream.setName(fileName.substring(lastSlash+1));
!         else
!             bitstream.setName(fileName);
! 
!         // Set Default bitstream format:
!         //  1. attempt to guess from MIME type
!         //  2. if that fails, guess from "name" extension.
!         String mimeType = manifestContentFile.getAttributeValue("MIMETYPE");
!         BitstreamFormat bf = (mimeType == null) ? null :
!                 BitstreamFormat.findByMIMEType(context, mimeType);
!         if (bf == null)
!             bf = FormatIdentifier.guessFormat(context, bitstream);
!         bitstream.setFormat(bf);
! 
!         bitstream.setSource(fileName);
!         //bitstream.setSequenceID(bundle.getBitstreams().length);
! 
!         manifest.crosswalkBitstream(context, params, bitstream, manifestContentFile.getAttributeValue("ID"), null);
! 
!         bitstream.update();
!         return bitstream;
!     }
! 
!     /**
!      * Clear all non-system metadata on the item
!      */
!     private void clearNonSystemMetadata() {
!         DCValue[] metadata = item.getMetadata("dc", Item.ANY, Item.ANY, Item.ANY);
!         item.clearMetadata("dc", Item.ANY, Item.ANY, Item.ANY);
! 
!         // Fix to problem where dateAccessioned and dateAvailable have been wiped in a previous update.
!         boolean restoreDateAccessioned = true;
!         boolean restoreDateAvailable = true;
!         for (DCValue dcValue : metadata) {
!             final String key = createKey(dcValue);
!             if ("dc.date.accessioned".equals(key)) { // record is ok, no need to restore data
!                 restoreDateAccessioned = false;
!             } else if ("dc.date.available".equals(key)) { // record is ok, no need to restore data
!                 restoreDateAvailable = false;
!             }
!         }
! 
!         for (DCValue dcValue : metadata) {
!             final String key = createKey(dcValue);
! 
!             if(SYSTEM_DC_META.contains(key)) { // Only add metadata
!                 if("dc.identifier.uri".equals(key)) {
!                     if(dcValue.value == null || !dcValue.value.startsWith("http://hdl.handle.net"))
!                         continue; // and only add the system uri
!                 } else if ("dc.description.provenance".equals(key) && dcValue.value != null) {
!                     if (restoreDateAccessioned && dcValue.value.startsWith("Submitted by")) {
!                         try {
!                             final Pattern pattern = Pattern.compile("Submitted by .* on (.*)");
!                             Matcher matcher = pattern.matcher(dcValue.value);
!                             if (matcher.find() && matcher.groupCount() == 1) {
!                                 item.addMetadata("dc", "date", "accessioned", null, matcher.group(1));
!                             }
!                         } catch (Exception e) {
!                             log.error("Could not extract dc.date.accessioned from dc.description.provenance value " + dcValue.value, e);
!                         }
!                     } else if (restoreDateAvailable && dcValue.value.startsWith("Made available in")) {
!                         try {
!                             final Pattern pattern = Pattern.compile("Made available in .* on ([^(]*)");
!                             Matcher matcher = pattern.matcher(dcValue.value);
!                             if (matcher.find() && matcher.groupCount() == 1) {
!                                 item.addMetadata("dc", "date", "available", null, matcher.group(1));
!                             }
!                         } catch (Exception e) {
!                             log.error("Could not extract dc.date.available from dc.description.provenance value " + dcValue.value, e);
!                         }
!                     }
!                 }
!                 item.addMetadata(dcValue.schema, dcValue.element, dcValue.qualifier, dcValue.language, dcValue.value);
!             }
!         }
!     }
! 
!     private String createKey(DCValue dcValue) {
!         final String key = dcValue.schema + "." + dcValue.element + (dcValue.qualifier != null ? "." + dcValue.qualifier : "");
!         return key;
!     }
! 
!     /**
!      * Choose DMD section(s) to crosswalk.
!      * <p>
!      * The algorithm is:<br>
!      * 1. Use whatever the <code>dmd</code> parameter specifies as the primary DMD.<br>
!      * 2. If (1) is unspecified, find MODS (preferably) or DC as primary DMD.<br>
!      * 3. If (1) or (2) succeeds, crosswalk it and ignore all other DMDs with
!      *    same GROUPID<br>
!      * 4. Crosswalk remaining DMDs not eliminated already.
!      *
!      * XXX stolen from DSpaceMETSIngester
!      */
!     public void crosswalkObjectDmd(Context context, DSpaceObject dso,
!                                    METSManifest manifest,
!                                    METSManifest.Mdref callback,
!                                    Element dmds[], PackageParameters params)
!             throws CrosswalkException, PackageValidationException,
!             AuthorizeException, SQLException, IOException
!     {
!         int found = -1;
! 
!         // Check to see what dmdSec the user specified in the 'dmd' parameter
!         String userDmd = null;
!         if (params != null)
!         {
!             userDmd = params.getProperty("dmd");
!         }
!         if (userDmd != null && userDmd.length() > 0)
!         {
!             for (int i = 0; i < dmds.length; ++i)
!             {
!                 if (userDmd.equalsIgnoreCase(manifest.getMdType(dmds[i])))
!                 {
!                     found = i;
!                 }
!             }
!         }
! 
!         // MODS is preferred, if nothing specified by user
!         if (found == -1)
!         {
!             for (int i = 0; i < dmds.length; ++i)
!             {
!                 //NOTE: METS standard actually says this should be MODS (all uppercase). But,
!                 // just in case, we're going to be a bit more forgiving.
!                 if ("MODS".equalsIgnoreCase(manifest.getMdType(dmds[i])))
!                 {
!                     found = i;
!                 }
!             }
!         }
! 
!         // DC acceptable if no MODS
!         if (found == -1)
!         {
!             for (int i = 0; i < dmds.length; ++i)
!             {
!                 //NOTE: METS standard actually says this should be DC (all uppercase). But,
!                 // just in case, we're going to be a bit more forgiving.
!                 if ("DC".equalsIgnoreCase(manifest.getMdType(dmds[i])))
!                 {
!                     found = i;
!                 }
!             }
!         }
! 
!         String groupID = null;
!         if (found >= 0)
!         {
!             manifest.crosswalkItemDmd(context, params, dso, dmds[found], callback);
!             groupID = dmds[found].getAttributeValue("GROUPID");
! 
!             if (groupID != null)
!             {
!                 for (int i = 0; i < dmds.length; ++i)
!                 {
!                     String g = dmds[i].getAttributeValue("GROUPID");
!                     if (g != null && !g.equals(groupID))
!                     {
!                         manifest.crosswalkItemDmd(context, params, dso, dmds[i], callback);
!                     }
!                 }
!             }
!         }
!         else
!         {
!             // otherwise take the first.  Don't xwalk more than one because
!             // each xwalk _adds_ metadata, and could add duplicate fields.
!             if (dmds.length > 0)
!             {
!                 manifest.crosswalkItemDmd(context, params, dso, dmds[0], callback);
!             }
!         }
      }
  
      /**
*************** class DAVItem extends DAVDSpaceObject
*** 609,621 ****
      }
  
      /* (non-Javadoc)
!      * @see org.dspace.app.dav.DAVResource#deleteInternal()
!      */
      @Override
      protected int deleteInternal() throws DAVStatusException, SQLException,
              AuthorizeException, IOException
      {
!         this.item.withdraw();
          return HttpServletResponse.SC_OK; // HTTP OK
      }
  
--- 1033,1050 ----
      }
  
      /* (non-Javadoc)
!     * @see org.dspace.app.dav.DAVResource#deleteInternal()
!     */
      @Override
      protected int deleteInternal() throws DAVStatusException, SQLException,
              AuthorizeException, IOException
      {
!         for (Collection collection : item.getCollections())
!         {
!             collection.removeItem(this.item);
!             collection.update();
!         }
!         this.context.commit();
          return HttpServletResponse.SC_OK; // HTTP OK
      }
  
diff -rp ./dspace-lni/src/main/webapp/WEB-INF/web.xml ../dspace-3.2-src-release(modified)/./dspace-lni/src/main/webapp/WEB-INF/web.xml
*** ./dspace-lni/src/main/webapp/WEB-INF/web.xml	Wed Jul 24 13:43:56 2013
--- ../dspace-3.2-src-release(modified)/./dspace-lni/src/main/webapp/WEB-INF/web.xml	Fri Apr 11 15:08:21 2014
***************
*** 21,26 ****
--- 21,42 ----
      </description>
    </context-param>
  
+ 
+     <!-- new ConfigurationService initialization for dspace.dir -->
+         <context-param>
+             <param-name>dspace.dir</param-name>
+             <param-value>${dspace.dir}</param-value>
+             <description>
+                 The location of the main DSpace configuration file
+             </description>
+         </context-param>
+ 
+ 
+         <!-- kernel start listener (from impl), starts up the kernel for standalong webapps -->
+         <listener>
+             <listener-class>org.dspace.servicemanager.servlet.DSpaceKernelServletContextListener</listener-class>
+         </listener>
+ 
    <!-- 
     Listener to initialise DSpace configuration and clean up the application 
    -->
