Index: lib/spatial/geoserver/WEB-INF/lib/commons-fileupload-1.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/spatial/geoserver/WEB-INF/lib/commons-fileupload-1.2.1.jar
___________________________________________________________________
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: lib/commons-fileupload-1.2.2.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/commons-fileupload-1.2.2.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java	(revision 5842)
+++ src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java	(revision 5843)
@@ -43,7 +43,8 @@
 import org.apache.log4j.Logger;
 import org.apache.maven.artifact.ant.shaded.IOUtil;
 import org.dataone.client.MNode;
-import org.dataone.mimemultipart.MultipartResponseHandler;
+import org.dataone.mimemultipart.MultipartRequest;
+import org.dataone.mimemultipart.MultipartRequestResolver;
 import org.dataone.service.NodeListParser;
 import org.dataone.service.exceptions.BaseException;
 import org.dataone.service.exceptions.IdentifierNotUnique;
@@ -591,97 +592,7 @@
                     status = true;
                 } else if(resource.equals(RESOURCE_REPLICATE)) {
                     System.out.println("processing replicate request");
-                    
-                    if(httpVerb == POST)
-                    {
-                        InputStream is = request.getInputStream();
-                        /*String input = IOUtils.toString(is);
-                        System.out.println("input: " + input);
-                        is = IOUtils.toInputStream(input);*/
-                        
-                        File tmpDir = getTempDirectory();
-                        File tmpSMFile = new File(tmpDir + 
-                                ".sysmeta." + new Date().getTime() + ".tmp");
-                        MultipartResponseHandler mpHandler = 
-                            new MultipartResponseHandler(request, tmpSMFile);
-                        Hashtable parts = mpHandler.getParts();
-                        File f = (File)parts.get("sysmeta");
-                        String sourceNode = (String)parts.get("sourceNode");
-                        FileInputStream fis = new FileInputStream(f);
-                        
-                        //lookup the id in the registry
-                        URL url = new URL("http://cn.dataone.org/cn/node");
-                        InputStream urlis = url.openStream();
-                        Map<String,String> m = NodeListParser.parseNodeListFile(urlis);
-                        String nodeUrl = m.get(sourceNode);
-                        System.out.println("sourceNodeId: " + sourceNode);
-                        System.out.println("resolved sourceNodeUrl: " + nodeUrl);
-                        
-                        if(nodeUrl == null)
-                        {
-                            response.setStatus(500);
-                            response.getOutputStream().write(("Member Node id " + 
-                                    sourceNode + " not found in node registry.").getBytes());
-                            response.getOutputStream().close();
-                        }
-                        
-                        //respond to cn with 200/OK
-                        //String s;
-                        //s = "sysmeta: " + IOUtils.toString(fis);
-                        //s += "\n\n";
-                        response.setStatus(200);
-                        //response.getOutputStream().write(("sourceNode: " + sourceNode + "\n\n").getBytes());
-                        //response.getOutputStream().write(("s: " + s).getBytes());
-                        OutputStream out = response.getOutputStream();
-                        out.write("OK\n".getBytes());
-                        out.write(("sourceNodeId: " + sourceNode + "\n").getBytes());
-                        out.write(("sourceNodeUrl: " + nodeUrl + "\n").getBytes());
-                        out.close();
-                        
-                        //parse the systemMetadata
-                        SystemMetadata sm = (SystemMetadata)deserializeServiceType(SystemMetadata.class, fis);
-                        NodeReference nr = sm.getOriginMemberNode();
-                        nr.setValue(sourceNode);
-                        sm.setOriginMemberNode(nr);
-                        //get the document
-                        AuthToken token = new AuthToken(sessionId);
-                        MNode mnode = new MNode(nodeUrl);
-                        //get the doc from the remote host
-                        InputStream docStream = mnode.get(new AuthToken("public"), sm.getIdentifier());
-                        File outputTmpFile = getTempFile();
-                        FileOutputStream outputTmpFileStream = new FileOutputStream(outputTmpFile);
-                        IOUtils.copy(docStream, outputTmpFileStream);
-                        
-                        //verify checksum
-                        System.out.println("verifying checksum");
-                        String docChecksumStr = CrudService.checksum(
-                                new FileInputStream(outputTmpFile), 
-                                sm.getChecksum().getAlgorithm().name());
-                        System.out.println("original checksum: " + sm.getChecksum().getValue());
-                        System.out.println(" created checksum: " + docChecksumStr);
-                        
-                        //insert the document in local db
-                        System.out.println("creating new doc");
-                        CrudService.getInstance().create(token, 
-                                sm.getIdentifier(), new FileInputStream(outputTmpFile), sm);
-                        //call cn.setReplicationStatus(guid, COMPLETE)
-                        
-                        /*Questions:
-                         * Call is now supposed to look like replicate(token, SystemMetadata, SourceNode)
-                         * how is SystemMetadata encoded?  Multipart?
-                         * 
-                         * Is the token passed used to access MN_A?  How does MN_A
-                         * know it's valid?
-                         * 
-                         * What exactly is happening when setReplicationStatus is called
-                         * to the CN?  Which systemMetadata is being updated?  MN_A or MN_B or both?
-                         * 
-                         * 
-                         * 
-                         */
-                        
-                    }
-                    
+                    replicate(httpVerb, request, response);
                     status = true;
                 }
                     
@@ -696,11 +607,121 @@
             }
         } catch (Exception e) {
             logMetacat.error(e.getMessage());
+            System.out.println("Error in ResourceHandler.handle(): " + e.getMessage());
             e.printStackTrace();
         }
     }
     
     /**
+     * handle the /replicate action
+     * @param httpVerb
+     * @param request
+     * @param response
+     * @throws Exception
+     */
+    private void replicate(int httpVerb, HttpServletRequest request, HttpServletResponse response)
+        throws Exception
+    {
+        if(httpVerb == POST)
+        {
+            System.out.println("in POST replicate()");
+            /*InputStream is = request.getInputStream();
+            String input = IOUtils.toString(is);
+            System.out.println("input: " + input);
+            is = IOUtils.toInputStream(input);*/
+            
+            File tmpDir = getTempDirectory();
+            File tmpSMFile = new File(tmpDir + 
+                    ".sysmeta." + new Date().getTime() + ".tmp");
+            System.out.println("1");
+            MultipartRequestResolver mrr = new MultipartRequestResolver(tmpDir.getAbsolutePath());
+            System.out.println("2");
+            MultipartRequest mr = mrr.resolveMultipart(request);
+            System.out.println("3");
+            Map<String, File> files = mr.getMultipartFiles();
+            System.out.println("4");
+            Map<String, List<String>> params = mr.getMultipartParameters();
+            File f = files.get("sysmeta");
+            System.out.println("file: " + f.getAbsolutePath());
+            String sourceNode = params.get("sourceNode").get(0);
+            System.out.println("sourceNode: " + sourceNode);
+            FileInputStream fis = new FileInputStream(f);
+            
+            //lookup the id in the registry
+            URL url = new URL("http://cn.dataone.org/cn/node");
+            InputStream urlis = url.openStream();
+            Map<String,String> m = NodeListParser.parseNodeListFile(urlis);
+            String nodeUrl = m.get(sourceNode);
+            System.out.println("sourceNodeId: " + sourceNode);
+            System.out.println("resolved sourceNodeUrl: " + nodeUrl);
+            
+            if(nodeUrl == null)
+            {
+                response.setStatus(500);
+                response.getOutputStream().write(("Member Node id " + 
+                        sourceNode + " not found in node registry.").getBytes());
+                response.getOutputStream().close();
+            }
+            
+            //respond to cn with 200/OK
+            //String s;
+            //s = "sysmeta: " + IOUtils.toString(fis);
+            //s += "\n\n";
+            response.setStatus(200);
+            //response.getOutputStream().write(("sourceNode: " + sourceNode + "\n\n").getBytes());
+            //response.getOutputStream().write(("s: " + s).getBytes());
+            OutputStream out = response.getOutputStream();
+            out.write("OK\n".getBytes());
+            out.write(("sourceNodeId: " + sourceNode + "\n").getBytes());
+            out.write(("sourceNodeUrl: " + nodeUrl + "\n").getBytes());
+            out.close();
+            
+            //parse the systemMetadata
+            SystemMetadata sm = (SystemMetadata)deserializeServiceType(SystemMetadata.class, fis);
+            NodeReference nr = sm.getOriginMemberNode();
+            nr.setValue(sourceNode);
+            sm.setOriginMemberNode(nr);
+            //get the document
+            AuthToken token = new AuthToken(sessionId);
+            MNode mnode = new MNode(nodeUrl);
+            //get the doc from the remote host
+            InputStream docStream = mnode.get(new AuthToken("public"), sm.getIdentifier());
+            File outputTmpFile = getTempFile();
+            FileOutputStream outputTmpFileStream = new FileOutputStream(outputTmpFile);
+            IOUtils.copy(docStream, outputTmpFileStream);
+            
+            //verify checksum
+            System.out.println("verifying checksum");
+            String docChecksumStr = CrudService.checksum(
+                    new FileInputStream(outputTmpFile), 
+                    sm.getChecksum().getAlgorithm().name());
+            System.out.println("original checksum: " + sm.getChecksum().getValue());
+            System.out.println(" created checksum: " + docChecksumStr);
+            
+            //insert the document in local db
+            System.out.println("creating new doc");
+            CrudService.getInstance().create(token, 
+                    sm.getIdentifier(), new FileInputStream(outputTmpFile), sm);
+            //call cn.setReplicationStatus(guid, COMPLETE)
+            
+            /*Questions:
+             * Call is now supposed to look like replicate(token, SystemMetadata, SourceNode)
+             * how is SystemMetadata encoded?  Multipart?
+             * 
+             * Is the token passed used to access MN_A?  How does MN_A
+             * know it's valid?
+             * 
+             * What exactly is happening when setReplicationStatus is called
+             * to the CN?  Which systemMetadata is being updated?  MN_A or MN_B or both?
+             * 
+             * 
+             * 
+             */
+            
+        }
+    }
+    
+    /**
      * create the root node registry response.  
      * @throws JiBXException
      * @throws IOException
@@ -1201,7 +1222,7 @@
                             endTime = null;
                         }
                     }
-                    else if(name.equals("objectFormat") && value != null)
+                    else if(name.equals("objectFormat") && value != null) 
                     {
                         objectFormat = ObjectFormat.convert(value[0]);
                     }
