Index: src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java
===================================================================
--- src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java	(revision 1737)
@@ -0,0 +1,137 @@
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUtils;
+import javax.servlet.ServletOutputStream;
+
+import org.ecoinformatics.eml.EMLParser;
+
+import java.io.*;
+import java.util.*;
+
+import com.oreilly.servlet.multipart.*;
+import edu.ucsb.nceas.metacat.*;
+import edu.ucsb.nceas.metacat.MetaCatUtil;
+
+
+public class MetUpload extends HttpServlet
+{
+public void service(HttpServletRequest request, HttpServletResponse response)
+        throws IOException
+{
+	PrintWriter out = null;
+	try {
+  		int id=0;
+
+		out = response.getWriter();
+
+  		String file = new String("");
+		DBConnection dbconn = null;
+	 	File dataDirectory = null;
+	 	MetaCatUtil util = null;
+		String datafilepath = null;
+		String fileName = null;
+		FilePart fPart = null;
+      		MultipartParser parser = new MultipartParser((HttpServletRequest)request, 1024 * 1024);
+      		//MultipartParser parser = new MultipartParser(request, 1024 * 1024);
+		DocumentImplWrapper documentWrapper = null;
+      		Part aPart;
+		String eml_filename=" ",docid=" ";
+		StringReader xml = null;
+		/*String eml_filename=" ",docid=" ";*/
+	    	Hashtable formElements = new Hashtable();
+ 	    	while( (aPart = parser.readNextPart()) != null ) {
+	      		if( aPart.isParam() == true ) {
+          			ParamPart pPart = (ParamPart)aPart;
+	        		String field = pPart.getName();
+          			String value = pPart.getStringValue();
+          			if(field != null) {
+		        		if(value == null)
+			        		value = "";
+            				formElements.put(field, value);
+					docid=value;
+		      		}
+	      		}
+        		else if( aPart.isFile() == true ) {
+		      		fPart = (FilePart)aPart;
+          			String field = fPart.getName();
+		      		fileName = fPart.getFileName();
+          			if(fileName != null) {
+		        		//write the image to a file
+		        		String dir = "/tmp/Upload_data";  
+		        		File theFile = new File(dir, fileName);
+					fPart.writeTo(theFile);
+					eml_filename = dir+"/"+fileName;
+		        		formElements.put(field, fileName);
+           			}
+        		}
+      		}
+	//	out.println( formElements );
+		out.println( docid + " " + eml_filename );
+    		out.println("EML File uploaded");
+/*****************************************************/
+
+
+/* Change for input to metacat */
+
+		util = new MetaCatUtil();
+		datafilepath = util.getOption("datafilepath");
+		dataDirectory = new File(datafilepath);
+	HttpSession sess = request.getSession(true);
+	String username = null;
+	username = (String)sess.getAttribute("username");
+
+	/*
+dbconn=DBConnectionPool.getDBConnection("DocumentImpl.main");
+
+		documentWrapper = new DocumentImplWrapper("", false);
+/*String newdocid = DocumentImpl.write(dbconn, eml_filename, null,
+                                   "null", "INSERT", docid,
+                                   null, null);*/
+	/*xml = new StringReader(eml_filename);
+String newdocid = documentWrapper.write(dbconn, xml, null,
+                                   null, "INSERT", docid,
+                                   null, null);
+if ((docid != null) && (!docid.equals(newdocid))) {
+         
+            System.out.println("New document ID generated!!! ");
+          }*/
+
+ if (DocumentImpl.getDataFileLockGrant(docid))
+ {
+	 DocumentImpl.registerDocument(fileName, "BIN", docid, username);
+
+	 // Save the data file to disk using "docid" as the name
+	 dataDirectory.mkdirs();
+	 File newFile = new File(dataDirectory, docid);
+
+	 long size = fPart.writeTo(newFile);
+	 ForceReplicationHandler frh = new ForceReplicationHandler
+	 				(docid, "insert", false, null);
+
+
+	 // set content type and other response header fields first
+	 out.println("success");
+}
+else 
+	
+	 out.println("failure");
+
+
+
+/****************************************************/
+
+
+  	} catch (Exception e) {
+		out.println("An error occurred.");
+		e.printStackTrace(out);
+  	}
+	
+	out.flush();
+}
+}

Property changes on: src/edu/ucsb/nceas/metacat/harvesterClient/MetUpload.java
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
