Index: src/org/fao/gast/lib/MefLib.java
===================================================================
--- src/org/fao/gast/lib/MefLib.java	(revision 1677)
+++ src/org/fao/gast/lib/MefLib.java	(working copy)
@@ -30,6 +30,8 @@
 import java.util.List;
 import java.util.UUID;
 import jeeves.resources.dbms.Dbms;
+
+import org.fao.geonet.kernel.mef.MEFFileVisitor;
 import org.fao.geonet.kernel.mef.MEFLib;
 import org.fao.geonet.kernel.mef.MEFVisitor;
 import org.fao.geonet.util.ISODate;
@@ -53,7 +55,7 @@
 
 		Lib.log.info("Adding MEF file : "+ mefFile.getAbsolutePath());
 
-		MEFLib.visit(mefFile, new MEFVisitor()
+		MEFLib.visit(mefFile, new MEFFileVisitor(), new MEFVisitor()
 		{
 			public void handleMetadata(Element mdata) throws Exception
 			{
Index: src/org/fao/geonet/constants/Params.java
===================================================================
--- src/org/fao/geonet/constants/Params.java	(revision 1677)
+++ src/org/fao/geonet/constants/Params.java	(working copy)
@@ -73,6 +73,10 @@
 	public static final String COUNTRY      = "country";
 	public static final String KIND         = "kind";
 	public static final String RATING       = "rating";
+	public static final String FILE_TYPE    = "file_type";
+	public static final String GENERATE_UUID= "generateUUID";
+	public static final String UUID_ACTION  = "uuidAction";
+	public static final String NOTHING      = "nothing";
 
 	public static final String SCALING              = "scaling";
 	public static final String SCALING_DIR          = "scalingDir";
Index: src/org/fao/geonet/kernel/harvest/harvester/geonet/Aligner.java
===================================================================
--- src/org/fao/geonet/kernel/harvest/harvester/geonet/Aligner.java	(revision 1677)
+++ src/org/fao/geonet/kernel/harvest/harvester/geonet/Aligner.java	(working copy)
@@ -44,6 +44,7 @@
 import org.fao.geonet.kernel.harvest.harvester.GroupMapper;
 import org.fao.geonet.kernel.harvest.harvester.RecordInfo;
 import org.fao.geonet.kernel.harvest.harvester.UUIDMapper;
+import org.fao.geonet.kernel.mef.MEFFileVisitor;
 import org.fao.geonet.kernel.mef.MEFLib;
 import org.fao.geonet.kernel.mef.MEFVisitor;
 import org.fao.geonet.lib.Lib;
@@ -179,7 +180,7 @@
 
 		try
 		{
-			MEFLib.visit(mefFile, new MEFVisitor()
+			MEFLib.visit(mefFile, new MEFFileVisitor(), new MEFVisitor()
 			{
 				public void handleMetadata(Element mdata) throws Exception
 				{
@@ -432,7 +433,7 @@
 
 			try
 			{
-				MEFLib.visit(mefFile, new MEFVisitor()
+				MEFLib.visit(mefFile, new MEFFileVisitor(), new MEFVisitor()
 				{
 					public void handleMetadata(Element mdata) throws Exception
 					{
Index: src/org/fao/geonet/kernel/mef/FileVisitor.java
===================================================================
--- src/org/fao/geonet/kernel/mef/FileVisitor.java	(revision 0)
+++ src/org/fao/geonet/kernel/mef/FileVisitor.java	(revision 0)
@@ -0,0 +1,99 @@
+//=============================================================================
+//===	Copyright (C) 2001-2007 Food and Agriculture Organization of the
+//===	United Nations (FAO-UN), United Nations World Food Programme (WFP)
+//===	and United Nations Environment Programme (UNEP)
+//===
+//===	This program is free software; you can redistribute it and/or modify
+//===	it under the terms of the GNU General Public License as published by
+//===	the Free Software Foundation; either version 2 of the License, or (at
+//===	your option) any later version.
+//===
+//===	This program is distributed in the hope that it will be useful, but
+//===	WITHOUT ANY WARRANTY; without even the implied warranty of
+//===	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//===	General Public License for more details.
+//===
+//===	You should have received a copy of the GNU General Public License
+//===	along with this program; if not, write to the Free Software
+//===	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//===
+//===	Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
+//===	Rome - Italy. email: geonetwork@osgeo.org
+//==============================================================================
+
+package org.fao.geonet.kernel.mef;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import org.jdom.Element;
+
+
+//=============================================================================
+
+public interface FileVisitor
+{
+	// --------------------------------------------------------------------------
+	// ---
+	// --- API methods
+	// ---
+	// --------------------------------------------------------------------------
+
+	public void visit(File mefFile, MEFVisitor v) throws Exception;
+
+	// --------------------------------------------------------------------------
+
+	public Element handleXml(File mefFile, MEFVisitor v) throws Exception ;
+
+	// --------------------------------------------------------------------------
+
+	public void handleBin(File mefFile, MEFVisitor v, Element info) throws Exception ;
+
+	// --------------------------------------------------------------------------
+
+}
+
+// =============================================================================
+
+class InputStreamBridge extends InputStream
+{
+	// --------------------------------------------------------------------------
+	// ---
+	// --- Constructor
+	// ---
+	// --------------------------------------------------------------------------
+
+	public InputStreamBridge(InputStream is)
+	{
+		this.is = is;
+	}
+
+	// --------------------------------------------------------------------------
+	// ---
+	// --- Bridging methods
+	// ---
+	// --------------------------------------------------------------------------
+
+	public int read() throws IOException { return is.read(); }
+
+	public int available() throws IOException { return is.available(); }
+
+	// --- this *must* be empty to work with zip files
+	public void close() throws IOException {}
+
+	public synchronized void mark(int readlimit) { is.mark(readlimit); }
+
+	public synchronized void reset() throws IOException { is.reset(); }
+
+	public boolean markSupported() {	return is.markSupported(); }
+
+	// --------------------------------------------------------------------------
+	// ---
+	// --- Variables
+	// ---
+	// --------------------------------------------------------------------------
+
+	private InputStream is; 
+}
+// =============================================================================
+
Index: src/org/fao/geonet/kernel/mef/Importer.java
===================================================================
--- src/org/fao/geonet/kernel/mef/Importer.java	(revision 1677)
+++ src/org/fao/geonet/kernel/mef/Importer.java	(working copy)
@@ -35,13 +35,16 @@
 import jeeves.server.context.ServiceContext;
 import jeeves.utils.BinaryFile;
 import jeeves.utils.Log;
+import jeeves.utils.Util;
 import jeeves.utils.Xml;
 
 import org.fao.geonet.GeonetContext;
 import org.fao.geonet.constants.Geonet;
+import org.fao.geonet.constants.Params;
 import org.fao.geonet.kernel.DataManager;
 import org.fao.geonet.lib.Lib;
 import org.fao.geonet.util.ISODate;
+import org.fao.oaipmh.exceptions.BadArgumentException;
 import org.jdom.Element;
 
 //=============================================================================
@@ -54,7 +57,10 @@
 	//---
 	//--------------------------------------------------------------------------
 
-	public static int doImport(final ServiceContext context, File mefFile) throws Exception
+	private static final String SingleFileType = "single";
+	private static final String MefFileType    = "mef";
+	
+	public static int doImport(final Element params, final ServiceContext context, File mefFile, final String stylePath) throws Exception
 	{
 		final GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
 		final DataManager   dm = gc.getDataManager();
@@ -63,10 +69,21 @@
 
 		final String  id[] = { ""   };
 		final Element md[] = { null };
+		
+		String fileType = Util.getParam(params,Params.FILE_TYPE, MefFileType);
+		
+		FileVisitor visitor = null;
+		
+		if (fileType.equals(SingleFileType))
+			visitor = new XMLFileVisitor();
+		else if (fileType.equals(MefFileType))
+			visitor = new MEFFileVisitor();
+		else
+			throw new BadArgumentException("Missing file type parameter!!");
 
 		//--- import metadata from MEF file
 
-		MEFLib.visit(mefFile, new MEFVisitor()
+		MEFLib.visit(mefFile, visitor, new MEFVisitor()
 		{
 			public void handleMetadata(Element metadata) throws Exception
 			{
@@ -78,27 +95,85 @@
 
 			public void handleInfo(Element info) throws Exception
 			{
-				Element general = info.getChild("general");
+				String uuid = null;
+				String createDate = null;
+				String changeDate = null;
+				String source = null;
+				String sourceName = null;
+				String schema = null;
+				String isTemplate = null;
+				String rating = null;
+				String popularity = null;
+				String groupId = null;
+				Element categs = null;
+				Element privileges = null;
+				// Element group = null;
+
+				boolean dcore = false;
+				boolean fgdc = false;
+				boolean iso115 = false;
+				boolean iso139 = false;
+				
+				// Handle non MEF files insertion
+				if (info.getChildren().size() == 0) {
+					
+					schema = Util.getParam(params, Params.SCHEMA);
+					source = Util.getParam(params, Params.SITE_ID, gc
+							.getSiteId());
+					isTemplate = Util.getParam(params, Params.TEMPLATE, "n");
 
-				String uuid       = general.getChildText("uuid");
-				String createDate = general.getChildText("createDate");
-				String changeDate = general.getChildText("changeDate");
-				String source     = general.getChildText("siteId");
-				String sourceName = general.getChildText("siteName");
-				String schema     = general.getChildText("schema");
-				String isTemplate = general.getChildText("isTemplate").equals("true") ? "y" : "n";
-				String rating     = general.getChildText("rating");
-				String popularity = general.getChildText("popularity");
+					categs = new Element("categories");
+					categs.addContent((new Element("category")).setAttribute(
+							"name", Util.getParam(params, Params.CATEGORY)));
+					
+					groupId = Util.getParam(params, Params.GROUP);
+					privileges =  new Element("group");
+					privileges.addContent(new Element("operation").setAttribute("name", "view"));
+					privileges.addContent(new Element("operation").setAttribute("name", "download"));
+					privileges.addContent(new Element("operation").setAttribute("name", "notify"));
+					privileges.addContent(new Element("operation").setAttribute("name", "dynamic"));
+					privileges.addContent(new Element("operation").setAttribute("name", "featured"));
+					
+					String style = Util.getParam(params, Params.STYLESHEET);
+					
+					// Apply a stylesheet transformation if requested
+					if (!style.equals("_none_"))
+			        	md[0] = Xml.transform(md[0],stylePath+"/"+style);
+					
+					// Get the Metadata uuid
+					if (isTemplate.equals("n"))
+						uuid = dm.extractUUID(schema, md[0]);
+					
+				} else {
 
-				boolean dcore  = schema.equals("dublin-core");
-				boolean fgdc   = schema.equals("fgdc-std");
-				boolean iso115 = schema.equals("iso19115");
-				boolean iso139 = schema.equals("iso19139");
+					categs = info.getChild("categories");
+					privileges = info.getChild("privileges");
 
+					Element general = info.getChild("general");
+	
+					uuid       = general.getChildText("uuid");
+					createDate = general.getChildText("createDate");
+					changeDate = general.getChildText("changeDate");
+					source     = general.getChildText("siteId");
+					sourceName = general.getChildText("siteName");
+					schema     = general.getChildText("schema");
+					isTemplate = general.getChildText("isTemplate").equals("true") ? "y" : "n";
+					rating     = general.getChildText("rating");
+					popularity = general.getChildText("popularity");
+	
+				}
+
+				dcore  = schema.equals("dublin-core");
+				fgdc   = schema.equals("fgdc-std");
+				iso115 = schema.equals("iso19115");
+				iso139 = schema.equals("iso19139");
+				
 				if (!dcore && !fgdc && !iso115 && !iso139)
 					throw new Exception("Unknown schema format : "+schema);
 
-				if (uuid == null)
+				String uuidAction = Util.getParam(params, Params.UUID_ACTION);
+				
+				if (uuid == null || uuid.equals("") || uuidAction.equals(Params.GENERATE_UUID))
 				{
 					uuid   = UUID.randomUUID().toString();
 					source = null;
@@ -117,7 +192,17 @@
 					Lib.sources.update(dbms, source, sourceName, true);
 				}
 
-				Log.debug(Geonet.MEF, "Adding metadata with uuid="+ uuid);
+				try {
+					if (dm.existsMetadataUuid(dbms, uuid) && !uuidAction.equals(Params.NOTHING)) { 
+						dm.deleteMetadata(dbms, dm.getMetadataId(dbms, uuid)) ;
+						context.debug("Deleting existing metadata with UUID : " + uuid );
+					}
+				}
+				catch (Exception e) {
+					throw new Exception(" Existing metadata with same UUID could not be deleted.");
+				}
+				
+				context.debug("Adding metadata with uuid="+ uuid);
 
 				id[0] = dm.insertMetadataExt(dbms, schema, md[0], context.getSerialFactory(),
 													  source, createDate, changeDate, uuid,
@@ -140,8 +225,13 @@
 				new File(pubDir).mkdirs();
 				new File(priDir).mkdirs();
 
-				addCategories(dm, dbms, id[0], info.getChild("categories"));
-				addPrivileges(dm, dbms, id[0], info.getChild("privileges"));
+				addCategories(dm, dbms, id[0], categs);
+				
+				if (groupId == null)
+					addPrivileges(dm, dbms, id[0], privileges);
+				else 
+					addOperations(dm, dbms, privileges, id[0], groupId);
+				
 				dm.indexMetadata(dbms, id[0]);
 			}
 
@@ -274,7 +364,7 @@
 		{
 			Element entity = (Element) e;
 
-			if (entity.getChildText("name").equals(name))
+			if (entity.getChildText("name").equals(name) || entity.getChildText("id").equals(name))
 				return entity.getChildText("id");
 		}
 
Index: src/org/fao/geonet/kernel/mef/MEFFileVisitor.java
===================================================================
--- src/org/fao/geonet/kernel/mef/MEFFileVisitor.java	(revision 0)
+++ src/org/fao/geonet/kernel/mef/MEFFileVisitor.java	(revision 0)
@@ -0,0 +1,169 @@
+//=============================================================================
+//===	Copyright (C) 2001-2007 Food and Agriculture Organization of the
+//===	United Nations (FAO-UN), United Nations World Food Programme (WFP)
+//===	and United Nations Environment Programme (UNEP)
+//===
+//===	This program is free software; you can redistribute it and/or modify
+//===	it under the terms of the GNU General Public License as published by
+//===	the Free Software Foundation; either version 2 of the License, or (at
+//===	your option) any later version.
+//===
+//===	This program is distributed in the hope that it will be useful, but
+//===	WITHOUT ANY WARRANTY; without even the implied warranty of
+//===	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//===	General Public License for more details.
+//===
+//===	You should have received a copy of the GNU General Public License
+//===	along with this program; if not, write to the Free Software
+//===	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//===
+//===	Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
+//===	Rome - Italy. email: geonetwork@osgeo.org
+//==============================================================================
+
+package org.fao.geonet.kernel.mef;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import jeeves.exceptions.BadFormatEx;
+import jeeves.utils.Xml;
+import org.jdom.Element;
+
+import static org.fao.geonet.kernel.mef.MEFConstants.*;
+
+//=============================================================================
+
+public class MEFFileVisitor implements FileVisitor
+{
+	//--------------------------------------------------------------------------
+	//---
+	//--- API methods
+	//---
+	//--------------------------------------------------------------------------
+
+	public void visit(File mefFile, MEFVisitor v) throws Exception
+	{
+		Element info = handleXml(mefFile, v);
+		handleBin(mefFile, v, info);
+	}
+
+	//--------------------------------------------------------------------------
+
+	public Element handleXml(File mefFile, MEFVisitor v) throws Exception
+	{
+		ZipInputStream    zis = new ZipInputStream(new FileInputStream(mefFile));
+		InputStreamBridge isb = new InputStreamBridge(zis);
+
+		ZipEntry entry;
+
+		Element md   = null;
+		Element info = null;
+
+		try
+		{
+			while ((entry=zis.getNextEntry()) != null)
+			{
+				String name = entry.getName();
+
+				if (name.equals(FILE_METADATA))
+					md = Xml.loadStream(isb);
+
+				else if (name.equals(FILE_INFO))
+					info = Xml.loadStream(isb);
+
+				zis.closeEntry();
+			}
+		}
+		finally
+		{
+			safeClose(zis);
+		}
+
+		if (md == null)
+			throw new BadFormatEx("Missing metadata file : "+ FILE_METADATA);
+
+		if (info == null)
+			throw new BadFormatEx("Missing info file : "+ FILE_INFO);
+
+		v.handleMetadata(md);
+		v.handleInfo(info);
+
+		return info;
+	}
+
+	//--------------------------------------------------------------------------
+
+	public void handleBin(File mefFile, MEFVisitor v, Element info) throws Exception
+	{
+		ZipInputStream    zis = new ZipInputStream(new FileInputStream(mefFile));
+		InputStreamBridge isb = new InputStreamBridge(zis);
+
+		List pubFiles = info.getChild("public") .getChildren();
+		List prvFiles = info.getChild("private").getChildren();
+
+		ZipEntry entry;
+
+		try
+		{
+			while ((entry=zis.getNextEntry()) != null)
+			{
+				String fullName   = entry.getName();
+				String simpleName = new File(fullName).getName();
+
+				if (fullName.equals(DIR_PUBLIC) || fullName.equals(DIR_PRIVATE))
+					continue;
+
+				if (fullName.startsWith(DIR_PUBLIC))
+					v.handlePublicFile(simpleName, getChangeDate(pubFiles, simpleName), isb);
+
+				else if (fullName.startsWith(DIR_PRIVATE))
+					v.handlePrivateFile(simpleName, getChangeDate(prvFiles, simpleName), isb);
+
+				zis.closeEntry();
+			}
+		}
+		finally
+		{
+			safeClose(zis);
+		}
+	}
+
+	//--------------------------------------------------------------------------
+
+	private static String getChangeDate(List files, String fileName) throws Exception
+	{
+		for (Object f : files)
+		{
+			Element file = (Element) f;
+			String  name = file.getAttributeValue("name");
+			String  date = file.getAttributeValue("changeDate");
+
+			if (name.equals(fileName))
+				return date;
+		}
+
+		throw new Exception("File not found in info.xml : "+ fileName);
+	}
+
+	//--------------------------------------------------------------------------
+
+	private static void safeClose(ZipInputStream zis)
+	{
+		try
+		{
+			zis.close();
+		}
+		catch (IOException e)
+		{
+			e.printStackTrace();
+		}
+	}
+
+}
+
+//=============================================================================
+
Index: src/org/fao/geonet/kernel/mef/MEFLib.java
===================================================================
--- src/org/fao/geonet/kernel/mef/MEFLib.java	(revision 1677)
+++ src/org/fao/geonet/kernel/mef/MEFLib.java	(working copy)
@@ -25,6 +25,8 @@
 
 import java.io.File;
 
+import org.jdom.Element;
+
 import jeeves.exceptions.BadInputEx;
 import jeeves.exceptions.BadParameterEx;
 import jeeves.exceptions.MissingParameterEx;
@@ -40,9 +42,9 @@
 	//---
 	//--------------------------------------------------------------------------
 
-	public static int doImport(ServiceContext context, File mefFile) throws Exception
+	public static int doImport(Element params, ServiceContext context, File mefFile, String stylePath) throws Exception
 	{
-		return Importer.doImport(context, mefFile);
+		return Importer.doImport(params, context, mefFile, stylePath);
 	}
 
 	//--------------------------------------------------------------------------
@@ -55,9 +57,9 @@
 
 	//--------------------------------------------------------------------------
 
-	public static void visit(File mefFile, MEFVisitor v) throws Exception
+	public static void visit(File mefFile, FileVisitor fvisitor, MEFVisitor v) throws Exception
 	{
-		Visitor.visit(mefFile, v);
+		fvisitor.visit(mefFile, v);
 	}
 
 	//--------------------------------------------------------------------------
Index: src/org/fao/geonet/kernel/mef/Visitor.java
===================================================================
--- src/org/fao/geonet/kernel/mef/Visitor.java	(revision 1677)
+++ src/org/fao/geonet/kernel/mef/Visitor.java	(working copy)
@@ -1,212 +0,0 @@
-//=============================================================================
-//===	Copyright (C) 2001-2007 Food and Agriculture Organization of the
-//===	United Nations (FAO-UN), United Nations World Food Programme (WFP)
-//===	and United Nations Environment Programme (UNEP)
-//===
-//===	This program is free software; you can redistribute it and/or modify
-//===	it under the terms of the GNU General Public License as published by
-//===	the Free Software Foundation; either version 2 of the License, or (at
-//===	your option) any later version.
-//===
-//===	This program is distributed in the hope that it will be useful, but
-//===	WITHOUT ANY WARRANTY; without even the implied warranty of
-//===	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-//===	General Public License for more details.
-//===
-//===	You should have received a copy of the GNU General Public License
-//===	along with this program; if not, write to the Free Software
-//===	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-//===
-//===	Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
-//===	Rome - Italy. email: geonetwork@osgeo.org
-//==============================================================================
-
-package org.fao.geonet.kernel.mef;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import jeeves.exceptions.BadFormatEx;
-import jeeves.utils.Xml;
-import org.jdom.Element;
-
-import static org.fao.geonet.kernel.mef.MEFConstants.*;
-
-//=============================================================================
-
-public class Visitor
-{
-	//--------------------------------------------------------------------------
-	//---
-	//--- API methods
-	//---
-	//--------------------------------------------------------------------------
-
-	public static void visit(File mefFile, MEFVisitor v) throws Exception
-	{
-		Element info = handleXml(mefFile, v);
-		handleBin(mefFile, v, info);
-	}
-
-	//--------------------------------------------------------------------------
-
-	private static Element handleXml(File mefFile, MEFVisitor v) throws Exception
-	{
-		ZipInputStream    zis = new ZipInputStream(new FileInputStream(mefFile));
-		InputStreamBridge isb = new InputStreamBridge(zis);
-
-		ZipEntry entry;
-
-		Element md   = null;
-		Element info = null;
-
-		try
-		{
-			while ((entry=zis.getNextEntry()) != null)
-			{
-				String name = entry.getName();
-
-				if (name.equals(FILE_METADATA))
-					md = Xml.loadStream(isb);
-
-				else if (name.equals(FILE_INFO))
-					info = Xml.loadStream(isb);
-
-				zis.closeEntry();
-			}
-		}
-		finally
-		{
-			safeClose(zis);
-		}
-
-		if (md == null)
-			throw new BadFormatEx("Missing metadata file : "+ FILE_METADATA);
-
-		if (info == null)
-			throw new BadFormatEx("Missing info file : "+ FILE_INFO);
-
-		v.handleMetadata(md);
-		v.handleInfo(info);
-
-		return info;
-	}
-
-	//--------------------------------------------------------------------------
-
-	private static void handleBin(File mefFile, MEFVisitor v, Element info) throws Exception
-	{
-		ZipInputStream    zis = new ZipInputStream(new FileInputStream(mefFile));
-		InputStreamBridge isb = new InputStreamBridge(zis);
-
-		List pubFiles = info.getChild("public") .getChildren();
-		List prvFiles = info.getChild("private").getChildren();
-
-		ZipEntry entry;
-
-		try
-		{
-			while ((entry=zis.getNextEntry()) != null)
-			{
-				String fullName   = entry.getName();
-				String simpleName = new File(fullName).getName();
-
-				if (fullName.equals(DIR_PUBLIC) || fullName.equals(DIR_PRIVATE))
-					continue;
-
-				if (fullName.startsWith(DIR_PUBLIC))
-					v.handlePublicFile(simpleName, getChangeDate(pubFiles, simpleName), isb);
-
-				else if (fullName.startsWith(DIR_PRIVATE))
-					v.handlePrivateFile(simpleName, getChangeDate(prvFiles, simpleName), isb);
-
-				zis.closeEntry();
-			}
-		}
-		finally
-		{
-			safeClose(zis);
-		}
-	}
-
-	//--------------------------------------------------------------------------
-
-	private static String getChangeDate(List files, String fileName) throws Exception
-	{
-		for (Object f : files)
-		{
-			Element file = (Element) f;
-			String  name = file.getAttributeValue("name");
-			String  date = file.getAttributeValue("changeDate");
-
-			if (name.equals(fileName))
-				return date;
-		}
-
-		throw new Exception("File not found in info.xml : "+ fileName);
-	}
-
-	//--------------------------------------------------------------------------
-
-	private static void safeClose(ZipInputStream zis)
-	{
-		try
-		{
-			zis.close();
-		}
-		catch (IOException e)
-		{
-			e.printStackTrace();
-		}
-	}
-}
-
-//=============================================================================
-
-class InputStreamBridge extends InputStream
-{
-	//--------------------------------------------------------------------------
-	//---
-	//--- Constructor
-	//---
-	//--------------------------------------------------------------------------
-
-	public InputStreamBridge(InputStream is)
-	{
-		this.is = is;
-	}
-
-	//--------------------------------------------------------------------------
-	//---
-	//--- Bridging methods
-	//---
-	//--------------------------------------------------------------------------
-
-	public int read() throws IOException { return is.read(); }
-
-	public int available() throws IOException { return is.available(); }
-
-	//--- this *must* be empty to work with zip files
-	public void close() throws IOException {}
-
-	public synchronized void mark(int readlimit) { is.mark(readlimit); }
-
-	public synchronized void reset() throws IOException { is.reset(); }
-
-	public boolean markSupported() {	return is.markSupported(); }
-
-	//--------------------------------------------------------------------------
-	//---
-	//--- Variables
-	//---
-	//--------------------------------------------------------------------------
-
-	private InputStream is;
-}
-
-//=============================================================================
-
Index: src/org/fao/geonet/kernel/mef/XMLFileVisitor.java
===================================================================
--- src/org/fao/geonet/kernel/mef/XMLFileVisitor.java	(revision 0)
+++ src/org/fao/geonet/kernel/mef/XMLFileVisitor.java	(revision 0)
@@ -0,0 +1,43 @@
+package org.fao.geonet.kernel.mef;
+
+import java.io.File;
+
+import jeeves.exceptions.BadFormatEx;
+import jeeves.utils.Xml;
+
+import org.jdom.Element;
+
+public class XMLFileVisitor implements FileVisitor {
+	
+	// --------------------------------------------------------------------------
+	// ---
+	// --- API methods
+	// ---
+	// --------------------------------------------------------------------------
+
+	public void visit(File mefFile, MEFVisitor v) throws Exception {
+		Element info = handleXml(mefFile, v);
+	}
+
+	// --------------------------------------------------------------------------
+
+	public Element handleXml(File mefFile, MEFVisitor v)
+			throws Exception {
+				
+		Element md = null;
+		Element info = null;
+
+		md = Xml.loadFile(mefFile);
+		info = new Element("info");
+
+		if (md == null)
+			throw new BadFormatEx("Missing xml metadata file .");
+
+		v.handleMetadata(md);
+		v.handleInfo(info);
+
+		return info;
+	}
+	
+	public void handleBin(File mefFile, MEFVisitor v, Element info) throws Exception {}
+}
Index: src/org/fao/geonet/services/mef/Import.java
===================================================================
--- src/org/fao/geonet/services/mef/Import.java	(revision 1677)
+++ src/org/fao/geonet/services/mef/Import.java	(working copy)
@@ -28,6 +28,8 @@
 import jeeves.server.ServiceConfig;
 import jeeves.server.context.ServiceContext;
 import jeeves.utils.Util;
+
+import org.fao.geonet.constants.Geonet;
 import org.fao.geonet.kernel.mef.MEFLib;
 import org.jdom.Element;
 
@@ -35,7 +37,11 @@
 
 public class Import implements Service
 {
-	public void init(String appPath, ServiceConfig params) throws Exception {}
+	private String stylePath;
+	
+	public void init(String appPath, ServiceConfig params) throws Exception {
+		this.stylePath = appPath + Geonet.Path.IMPORT_STYLESHEETS;
+	}
 
 	//--------------------------------------------------------------------------
 	//---
@@ -49,7 +55,7 @@
 		String uploadDir = context.getUploadDir();
 
 		File file = new File(uploadDir, mefFile);
-		int  id   = MEFLib.doImport(context, file);
+		int  id   = MEFLib.doImport(params, context, file, stylePath);
 
 		file.delete();
 
Index: web/geonetwork/loc/ar/xml/strings.xml
===================================================================
--- web/geonetwork/loc/ar/xml/strings.xml	(revision 1677)
+++ web/geonetwork/loc/ar/xml/strings.xml	(working copy)
@@ -118,6 +118,7 @@
 	 <feedbackComments>تعليقات</feedbackComments>
 	<feedbackRequest>الرجاء ادخال بياناتك قبل التحميل</feedbackRequest>
 	<file>ملف</file>
+	<fileType>File type:</fileType>
 	<firstName>الاسم الأول</firstName>
 	<foundWords>Number of terms found:</foundWords>
 	<fr>Français</fr> <!-- Do not translate! -->
@@ -130,6 +131,7 @@
 	<fuzzyPrecise>Precise</fuzzyPrecise>
 	<general>عام</general>
 	<generalInfo>معلومات عامة</generalInfo>
+	<generateUUID>Generate UUID for inserted metadata</generateUUID>
 	<georss>فتح GeoRSS</georss>
 	<group>مجموعة</group>
 	<groupManagement>إدارة مجموعة</groupManagement>
@@ -175,6 +177,9 @@
 	<!-- end intermap tooltips -->
 	<infoTitle>معلومات</infoTitle>
 	<insert>إدخال</insert>
+	<insertFileMode>File Upload</insertFileMode>
+    <insertMode>Insert mode:</insertMode>
+    <insertPasteMode>Copy/Paste</insertPasteMode>
 	<interactiveMap>خريطة تفاعلية</interactiveMap>
 	<interMapInfo>
 		<h1>معلومات على الخريطة التفاعلية</h1> You can find interactive maps by searching in GeoNetwork
@@ -277,6 +282,7 @@
  <mapViewerOpen>Open Map Viewer</mapViewerOpen>
 	<max>الحد الأعلى</max>
 	<mdUpdateError>تحرير الخطأ</mdUpdateError>
+	<mefFile>MEF file</mefFile>
 	<message>اسم الدخول وكلمة المرور غير صحيحتين<br/>اضغط على زر رجوع وحاول مرة أخرى</message>
 	<messageMdUpdateError>عفواً نتج خطأ أثناء عملية تحرير البيانات الأساسية</messageMdUpdateError>
 	<messageChanged>البيانات الاساسية تم تعديلها بواسطة مستخدم آخر، الرجاء اعادة المحاولة</messageChanged>
@@ -297,6 +303,7 @@
 	<newCategory>إضافة تصنيف جديد</newCategory>
 	<newMdDes>أضافة بيانات اساسية جديدة منسوخة من قالب</newMdDes>
 	<newMetadata>بيانات اساسية Metadata جديدة</newMetadata>
+	<newMdInsert>New metadata inserted : </newMdInsert>
 	<newPassword>كلمة سر جديدة</newPassword>
 	<newUser>اضافة مستخدم جديد لقاعدة البيانات</newUser>
 	<next>Next</next>
@@ -308,6 +315,7 @@
 	<noInfo>عفواً، لا توجد معلومات متوفرة</noInfo>
 	<noLogin>لم تتمكن من الدخول</noLogin>
 	<northbc>الاحداثيات الشمالية</northbc>
+	<nothing>No action on import</nothing>
 <!--  <nteaphome>موقع مشروع البيئة الاقليمي</nteaphome> -->
 	<online>خريطة تفاعلية</online>
 	<onlink>روابط حية</onlink>
@@ -318,6 +326,7 @@
 	<output>Output</output>
 	<outputType id="full">Full</outputType>
 	<outputType id="text">Text only</outputType>
+	<overwrite>Overwrite metadata with same UUID</overwrite>
 	<paper>ورقية</paper>
 	<partial>تغطية جزئية</partial>
 	<partialCooordinate>احداثيات جزئية</partialCooordinate>
@@ -410,6 +419,7 @@
 	<simple>خيارات أقل</simple>
 	<simpleTab>العرض الافتراضي</simpleTab>
 	<simpleTabEditor>المحرر الافتراضي</simpleTabEditor>
+	<singleFile>Single File (XML, SLD, WMC...)</singleFile>
 	<siteId>رقم الموقع المميز</siteId>
 	<site>الموقع</site>
 	<sort>Sort</sort>
@@ -492,6 +502,7 @@
 	<username>اسم الدخول</username>
 	<userPw>تغيير كلمة المرور</userPw>
 	<userPwDes>امنح المستخدم الحالة امكانية تغير كلمة المرور</userPwDes>
+	<uuidAction>Import actions: </uuidAction>
 	<validate>تفيير</validate>
 	<validityBegins>التقييم يبدأ</validityBegins>
 	<validityEnds>وينتهي</validityEnds>
Index: web/geonetwork/loc/cn/xml/strings.xml
===================================================================
--- web/geonetwork/loc/cn/xml/strings.xml	(revision 1677)
+++ web/geonetwork/loc/cn/xml/strings.xml	(working copy)
@@ -216,12 +216,14 @@
 	<feedbackComments>反馈/建议</feedbackComments>
 	<feedbackRequest>下在前请提供您的详细信息</feedbackRequest>
 	<file>文件</file>
+	<fileType>File type:</fileType>
 	<firstName>名</firstName>
 	<fr>Français</fr> <!-- Do not translate! -->
 	<freeKeyword>关键词</freeKeyword>
 	<from>输入起始日期 : </from>
 	<general>常规</general>
 	<generalInfo>常规信息</generalInfo>
+	<generateUUID>Generate UUID for inserted metadata</generateUUID>
 	<georss>打开GeoRSS馈入</georss>
 	<group>用户组</group>
 	<groupManagement>用户组管理</groupManagement>
@@ -258,6 +260,9 @@
 	<import>导入</import>
 	<infoTitle>信息</infoTitle>
 	<insert>插入</insert>
+	<insertFileMode>File Upload</insertFileMode>
+    <insertMode>Insert mode:</insertMode>
+    <insertPasteMode>Copy/Paste</insertPasteMode>
 	<interactiveMap>在线地图</interactiveMap>
 	<interMapInfo>
 		<h1>交互地图中的信息</h1> 可以在GeoNetwork中搜索带有交互地图的空间数据，也可直接连接到事先定义好的地图服务器，实现交互地图的访问。<p/> 支持的地图服务器包括与 <a href="http://www.opengeospatial.org" class="sm" target="_blank">Open GeoSpatial® Consortium</a> 规范一致的WMS服务器和 <a href="http://www.esri.com" class="sm" target="_blank">ESRI® ArcIMS</a>服务器。</interMapInfo>
@@ -337,6 +342,7 @@
 	<mapViewerOpen>Open Map Viewer</mapViewerOpen>
 	<max>最大值</max>
 	<mdUpdateError>更新错误</mdUpdateError>
+	<mefFile>MEF file</mefFile>
 	<message>用户名或口令有误。<br/>点击“回退”按钮重试。</message>
 	<messageMdUpdateError>很遗憾，元数据更新时出现错误。</messageMdUpdateError>
 	<messageChanged>元数据已被其他用户修改，请重试。</messageChanged>
@@ -356,6 +362,7 @@
 	<newCategory>新增类型</newCategory>
 	<newMdDes>根据模板向系统新增元数据</newMdDes>
 	<newMetadata>新建元数据</newMetadata>
+	<newMdInsert>New metadata inserted : </newMdInsert>
 	<newPassword>新口令</newPassword>
 	<newUser>新增用户</newUser>
 	<next>Next</next>
@@ -364,10 +371,12 @@
 	<noInfo>对不起，没有信息</noInfo>
 	<noLogin>您还未登录</noLogin>
 	<northbc>覆盖范围北边坐标</northbc>
+	<nothing>No action on import</nothing>
 	<online>在线交互地图</online>
 	<onlink>在线链接</onlink>
 	<operation>操作</operation>
 	<organisation>组织/部门</organisation>
+	<overwrite>Overwrite metadata with same UUID</overwrite>
 	<paper>硬拷贝</paper>
 	<partial>部分重叠</partial>
 	<partialCooordinate>局部坐标</partialCooordinate>
@@ -442,6 +451,7 @@
 	<simple>简单搜索</simple>
 	<simpleTab>默认试图</simpleTab>
 	<simpleTabEditor>默认编辑器</simpleTabEditor>
+	<singleFile>Single File (XML, SLD, WMC...)</singleFile>
 	<siteId>站点ID</siteId>
 	<site>网站</site>
 	<southbc>覆盖范围南边坐标</southbc>
@@ -479,6 +489,7 @@
 	<username>用户名</username>
 	<userPw>修改口令</userPw>
 	<userPwDes>允许该用户修改口令</userPwDes>
+	<uuidAction>Import actions: </uuidAction>
 	<validate>有效性检查</validate>
 	<validityBegins>有效期自</validityBegins>
 	<validityEnds>有效期至</validityEnds>
Index: web/geonetwork/loc/de/xml/strings.xml
===================================================================
--- web/geonetwork/loc/de/xml/strings.xml	(revision 1677)
+++ web/geonetwork/loc/de/xml/strings.xml	(working copy)
@@ -184,6 +184,7 @@
 	<feedbackComments>Feedback / Kommentare</feedbackComments>
 	<feedbackRequest>Bitte geben Sie Ihre Kontaktdaten vor dem Download ein</feedbackRequest>
 	<file>Datei</file>
+	<fileType>File type:</fileType>
 	<firstName>Vorname</firstName>
 	<fr>Français</fr> <!-- Do not translate! -->
 	<de>Deutsch</de>
@@ -191,6 +192,7 @@
 	<from>Von</from>
 	<general>Generell</general>
 	<generalInfo>Generelle Information</generalInfo>
+	<generateUUID>Generate UUID for inserted metadata</generateUUID>
 	<georss>Öffnen eines GeoRSS feed</georss>
 	<group>Gruppe</group>
 	<groupManagement>Gruppen Management</groupManagement>
@@ -230,6 +232,9 @@
 	<import>Import</import>
 	<infoTitle>Info</infoTitle>
 	<insert>Einfügen</insert>
+	<insertFileMode>File Upload</insertFileMode>
+    <insertMode>Insert mode:</insertMode>
+    <insertPasteMode>Copy/Paste</insertPasteMode>
 	<interactiveMap>Interaktive Karte</interactiveMap>
 	<simpleMap>einfacher Viewer</simpleMap>
 	<advancedMap>erweiterter Viewer</advancedMap>
@@ -302,6 +307,7 @@
 	<mapViewerOpen>Kartenviewer öffnen</mapViewerOpen>
 	<max>Maximum</max>
 	<mdUpdateError>Updatefehler</mdUpdateError>
+	<mefFile>MEF file</mefFile>
 	<message>Benutzername oder Passwort ist falsch.<br/>Drücken Sie den 'zurück' Button und versuchen Sie es erneut.</message>
 	<messageMdUpdateError>Sorry, an error occurred while updating metadata.</messageMdUpdateError>
 	<messageChanged>The metadata has been changed by another user. Please retry.</messageChanged>
@@ -321,6 +327,7 @@
 	<newCategory>Neue Kategorie Hinzufügen</newCategory>
 	<newMdDes>Neue Metadaten hinzufügen</newMdDes>
 	<newMetadata>Neue Metadaten</newMetadata>
+	<newMdInsert>New metadata inserted : </newMdInsert>
 	<newPassword>Neues Passwort</newPassword>
 	<newUser>Benutzer hinzufügen</newUser>
 	<next>Next</next>
@@ -329,11 +336,13 @@
 	<noInfo>Entschuldigung, keine Informationen verfügbar</noInfo>
 	<noLogin>Sie sind nicht angemeldet</noLogin>
 	<northbc>nördliche Grenzkoordinate</northbc>
+	<nothing>No action on import</nothing>
 	<online>Interaktive Karte</online>
 	<onlink>Online Linkage</onlink>
 	<opensearch>GeoNetwork opensearch service allow search to be made into the metadata catalog.</opensearch>
 	<operation>Operation</operation>
 	<organisation>Organisation / Abteilung</organisation>
+	<overwrite>Overwrite metadata with same UUID</overwrite>
 	<paper>Analog</paper>
 	<partial>teilweise Überschneidung</partial>
 	<partialCooordinate>Partial coordinates </partialCooordinate>
@@ -423,6 +432,7 @@
 	<simple>einfache Suche</simple>
 	<simpleTab>Default Ansicht</simpleTab>
 	<simpleTabEditor>Default Editor</simpleTabEditor>
+	<singleFile>Single File (XML, SLD, WMC...)</singleFile>
 	<siteId>Seiten ID</siteId>
 	<site>Seite</site>
 	<southbc>südliche Grenzkoordinate</southbc>
@@ -461,6 +471,7 @@
 	<username>Benutzername </username>
 	<userPw>Passwort ändern</userPw>
 	<userPwDes>Benutzerpasswort für Metadatenkatalog ändern</userPwDes>
+	<uuidAction>Import actions: </uuidAction>
 	<validate>Validieren</validate>
 	<validityBegins>Gültigkeit ab</validityBegins>
 	<validityEnds>und endet</validityEnds>
Index: web/geonetwork/loc/en/xml/strings.xml
===================================================================
--- web/geonetwork/loc/en/xml/strings.xml	(revision 1677)
+++ web/geonetwork/loc/en/xml/strings.xml	(working copy)
@@ -191,12 +191,14 @@
 	<feedbackComments>Feedback / comments</feedbackComments>
 	<feedbackRequest>Please provide your details before downloading</feedbackRequest>
 	<file>File</file>
+	<fileType>File type:</fileType>
 	<firstName>First Name</firstName>
 	<fr>Français</fr> <!-- Do not translate! -->
 	<freeKeyword>Free Keywords</freeKeyword>
 	<from>From</from>
 	<general>General</general>
 	<generalInfo>General information</generalInfo>
+	<generateUUID>Generate UUID for inserted metadata</generateUUID>
 	<georss>Open a GeoRSS feed</georss>
 	<group>Group</group>
 	<groupManagement>Group management</groupManagement>
@@ -236,6 +238,9 @@
 	<import>Import</import>
 	<infoTitle>Info</infoTitle>
 	<insert>Insert</insert>
+	<insertFileMode>File Upload</insertFileMode>
+    <insertMode>Insert mode:</insertMode>
+    <insertPasteMode>Copy/Paste</insertPasteMode>
 	<interactiveMap>Interactive Map</interactiveMap>	
 	<interMapInfo>
 		<h1>Info in interactive maps</h1> You can find interactive maps by searching in GeoNetwork for digital data with an interactive map, or directly connet to a pre-configured map server. <p/> Supported map servers are <a href="http://www.opengeospatial.org" class="sm" target="_blank">Open GeoSpatial® Consortium</a> compliant WMS Map Servers and <a href="http://www.esri.com" class="sm" target="_blank">ESRI® ArcIMS</a>.</interMapInfo>
@@ -320,6 +325,7 @@
 	<mapViewerOpen>Open Map Viewer</mapViewerOpen>
 	<max>Maximum</max>
 	<mdUpdateError>Update error</mdUpdateError>
+	<mefFile>MEF file</mefFile>
 	<message>The username or the password is wrong.<br/>Press the 'back' button and try again.</message>
 	<messageMdUpdateError>Sorry, an error occurred while updating metadata.</messageMdUpdateError>
 	<messageChanged>The metadata has been changed by another user. Please retry.</messageChanged>
@@ -339,6 +345,7 @@
 	<newCategory>Add a new category</newCategory>
 	<newMdDes>Adds a new metadata into geonetwork copying it from a template</newMdDes>
 	<newMetadata>New metadata</newMetadata>
+	<newMdInsert>New metadata inserted : </newMdInsert>
 	<newPassword>New Password</newPassword>
 	<newUser>Add a new user</newUser>
 	<next>Next</next>
@@ -347,11 +354,13 @@
 	<noInfo>Sorry, no info available</noInfo>
 	<noLogin>You are not logged in</noLogin>
 	<northbc>North Bounding Coordinate</northbc>
+	<nothing>No action on import</nothing>
 	<online>Interactive map</online>
 	<onlink>Online Linkage</onlink>
 	<opensearch>GeoNetwork opensearch service allow search to be made into the metadata catalog.</opensearch>
 	<operation>Operation</operation>
 	<organisation>Organisation / department</organisation>
+	<overwrite>Overwrite metadata with same UUID</overwrite>
 	<paper>Hard copy</paper>
 	<partial>Partially overlapping</partial>
 	<partialCooordinate>Partial coordinates </partialCooordinate>
@@ -441,6 +450,7 @@
 	<simple>Simple search</simple>
 	<simpleTab>Default view</simpleTab>
 	<simpleTabEditor>Default editor</simpleTabEditor>
+	<singleFile>Single File (XML, SLD, WMC...)</singleFile>
 	<siteId>Site ID</siteId>
 	<site>Site</site>
 	<southbc>South Bounding Coordinate</southbc>
@@ -479,6 +489,7 @@
 	<username>Username</username>
 	<userPw>Change password</userPw>
 	<userPwDes>Allow current user to change password</userPwDes>
+	<uuidAction>Import actions: </uuidAction>
 	<validate>Validate</validate>
 	<validityBegins>Validity begins</validityBegins>
 	<validityEnds>and ends</validityEnds>
Index: web/geonetwork/loc/es/xml/strings.xml
===================================================================
--- web/geonetwork/loc/es/xml/strings.xml	(revision 1677)
+++ web/geonetwork/loc/es/xml/strings.xml	(working copy)
@@ -212,12 +212,14 @@
 	<feedbackComments>Avisos / comentarios</feedbackComments> -->
 	<feedbackRequest>Por favor, proporcione sus datos antes de descargar los datos</feedbackRequest>
 	<file>Fichero</file>
+	<fileType>File type:</fileType>
 	<firstName>Nombre</firstName>
 	<fr>Français</fr> <!-- Do not translate! -->
 	<freeKeyword>Palabras libres</freeKeyword>
 	<from>De</from>
 	<general>General</general>
 	<generalInfo>Información general</generalInfo>
+	<generateUUID>Generate UUID for inserted metadata</generateUUID>
 	<georss>Abrir alimentación GeoRSS</georss>
 <!--	<group>Grupo</group> -->
 	<group>Grupo de usuarios</group>
@@ -253,6 +255,9 @@
 	<import>Importar</import>
 	<infoTitle>Información</infoTitle>
 	<insert>Insertar</insert>
+	<insertFileMode>File Upload</insertFileMode>
+    <insertMode>Insert mode:</insertMode>
+    <insertPasteMode>Copy/Paste</insertPasteMode>
 	<interactiveMap>Mapa interactivo</interactiveMap>
 	<interMapInfo>
 		<h1>Información sobre servidores de mapas</h1>
@@ -340,6 +345,7 @@
 	<mapViewerOpen>Abrir el visualizador de mapas</mapViewerOpen>
 	<max>Máximo</max>
 	<mdUpdateError>Actualizar error</mdUpdateError>
+	<mefFile>MEF file</mefFile>
 	<message>El nombre de usuario o la contaseña son incorrectos.<br/>Presione el botón 'atrás' e intentelo de nuevo.</message>
 	<messageChanged>El metadato ha sido modificado por otro usuario. Intentelo de nuevo por favor.</messageChanged>
 	<messageDownload>Gracias por su interés. Pulse sobre el botón de descarga para recoger los datos</messageDownload>
@@ -359,6 +365,7 @@
 	<newGroup>Añade un grupo</newGroup>
 	<newMdDes>Añade un nuevo metadato</newMdDes>
 	<newMetadata>Nuevo Metadato</newMetadata>
+	<newMdInsert>New metadata inserted : </newMdInsert>
 	<newPassword>Nueva contraseña</newPassword>
 	<newUser>Añade un nuevo usuario a la Base de datos</newUser>
 	<next>Next</next>
@@ -367,10 +374,12 @@
 	<noLogin>No está identificado como usuario</noLogin>
 	<none>nada</none>
 	<northbc>Coordenada Norte</northbc>
+	<nothing>No action on import</nothing>
 	<online>Mapa Interactivo</online>
 	<onlink>Recurso en línea</onlink>
 	<operation>Opciones</operation>
 	<!-- <organisation>Organización / departamento</organisation> -->
+	<overwrite>Overwrite metadata with same UUID</overwrite>
 	<paper>Copia impresa</paper>
 	<partial>Parcialmente contenido</partial>
 	<partialCooordinate>Coordenadas parciales </partialCooordinate>
@@ -458,6 +467,7 @@
 	<simple>Búsqueda Simple</simple>
 	<simpleTab>Vista predefinida</simpleTab>
 	<simpleTabEditor>Vista del editor de Metadatos predefinida</simpleTabEditor>
+	<singleFile>Single File (XML, SLD, WMC...)</singleFile>
 	<site>Lugar</site>
 	<siteId>Id del lugar</siteId>
 	<southbc>Coordenada Sur</southbc>
@@ -495,6 +505,7 @@
 	<username>Usuario</username>
 	<userPw>Cambio de contraseña</userPw>
 	<userPwDes>Permite a los usuarios cambiar la contraseña</userPwDes>
+	<uuidAction>Import actions: </uuidAction>
 	<validate>Validar</validate>
 	<validityBegins>Comienzo</validityBegins>
 	<validityEnds>y fin válidos</validityEnds>
Index: web/geonetwork/loc/fr/xml/strings.xml
===================================================================
--- web/geonetwork/loc/fr/xml/strings.xml	(revision 1677)
+++ web/geonetwork/loc/fr/xml/strings.xml	(working copy)
@@ -209,12 +209,14 @@
 	<feedbackComments>Retour / commentaires</feedbackComments>
 	<feedbackRequest>Merci de préciser vos coordonnées avant le téléchargement des données</feedbackRequest>
 	<file>Fichier</file>
+	<fileType>Type de fichier:</fileType>
 	<firstName>Prénom</firstName>
 	<fr>Français</fr> <!-- Do not translate! -->
 	<freeKeyword>Mot-clés libres</freeKeyword>
 	<from>Début</from>
 	<general>Général</general>
 	<generalInfo>Information générale</generalInfo>
+	<generateUUID>Générer un nouvel identifiant pour les métadonnées insérées</generateUUID>
 	<georss>Ouvrez flux GeoRSS</georss>
 	<group>Groupe</group>
 	<groupManagement>Gestion des groupes</groupManagement>
@@ -250,6 +252,9 @@
 	<import>Importer</import>
 	<infoTitle>Info</infoTitle>
 	<insert>Insérer</insert>
+	<insertFileMode>Import de fichiers</insertFileMode>
+    <insertMode>Mode d'insertion:</insertMode>
+    <insertPasteMode>Copier/Coller</insertPasteMode>
 	<interactiveMap>Carte interactive</interactiveMap>
 	<interMapInfo>
 		<h1>Information et cartes interactives</h1>
@@ -350,6 +355,7 @@
 	<mapViewerOpen>Afficher la carte</mapViewerOpen>
 	<max>Maximum</max>
 	<mdUpdateError>Erreur de mise à jour</mdUpdateError>
+	<mefFile>Fichier MEF</mefFile>
 	<message>Le nom ou mot de passe est incorrect.<br/>Appuyer sur le bouton 'retour'.</message>
 	<messageMdUpdateError>Désolé, une erreur s'est produite lors de la mise à jour des métadonnées.</messageMdUpdateError>
 	<messageChanged>La fiche de métadonnées a été modifié par un autre utilisateur. Essayez à nouveau.</messageChanged>
@@ -369,6 +375,7 @@
 	<newCategory>Ajouter une catégorie</newCategory>
 	<newMdDes>Ajouter une fiche de métadonnées</newMdDes>
 	<newMetadata>Nouvelle métadonnée</newMetadata>
+	<newMdInsert>Nouvelle métadonnée inserée : </newMdInsert>
 	<newPassword>Nouveau mot de passe</newPassword>
 	<newUser>Ajouter un utilisateur</newUser>
 	<next>Next</next>
@@ -377,11 +384,13 @@
 	<noInfo>Désolé, pas d'information disponible</noInfo>
 	<noLogin>Vous n'étes pas connecté.</noLogin>
 	<northbc>Coordonnée nord de l'emprise</northbc>
+	<nothing>Aucune action à l'import</nothing>
 	<online>Carte interactive</online>
 	<onlink>Liens</onlink>
 	<operation>Opération</operation>
 <!--	<organisation>Organisation / départment</organisation> -->
     <options>Options</options>
+    <overwrite>Ecraser les métadonnées de même identifiant</overwrite>
 	<paper>Copie papier</paper>
 	<partial>Recouvert partiellement</partial>
 	<partialCooordinate>Coordonnées partielles</partialCooordinate>
@@ -470,6 +479,7 @@
 	<simple>Recherche simple</simple>
 	<simpleTab>Vue par défaut</simpleTab>
 	<simpleTabEditor>Editeur par défaut</simpleTabEditor>
+	<singleFile>Fichier simple (XML, SLD, WMC...)</singleFile>
 	<siteId>Identifiant</siteId>
 	<site>Site</site>
 	<southbc>Coordonnée sud de l'emprise</southbc>
@@ -507,6 +517,7 @@
 	<username>Nom d'utilisateur</username>
 	<userPw>Modifier le mot de passe</userPw>
 	<userPwDes>Autoriser l'utilisateur en cours de changer le mot de passe</userPwDes>
+	<uuidAction>Actions à l'import: </uuidAction>
 	<validate>Valider</validate>
 	<validityBegins>Date de début de validité</validityBegins>
 	<validityEnds> et fin </validityEnds>
Index: web/geonetwork/xsl/error.xsl
===================================================================
--- web/geonetwork/xsl/error.xsl	(revision 1677)
+++ web/geonetwork/xsl/error.xsl	(working copy)
@@ -11,7 +11,7 @@
 			<h2><xsl:value-of select="/root/gui/error/heading"/></h2>
 			<p id="error"><xsl:value-of select="/root/gui/error/message"/></p>
 			<p id="stacktrace"><xsl:value-of select="/root/error/class"/> : <xsl:value-of select="/root/error/message"/></p>
-			<p><button class="content" onclick="JavaScript:goBack()"><xsl:value-of select="/root/gui/strings/backToPreviousPage"/></button></p>
+			<p><button id="goBack" class="content" onclick="JavaScript:goBack()"><xsl:value-of select="/root/gui/strings/backToPreviousPage"/></button></p>
 		</div>
 	</xsl:template>
 	
Index: web/geonetwork/xsl/metadata-insert-form.xsl
===================================================================
--- web/geonetwork/xsl/metadata-insert-form.xsl	(revision 1677)
+++ web/geonetwork/xsl/metadata-insert-form.xsl	(working copy)
@@ -10,7 +10,13 @@
 		<script type="text/javascript" language="JavaScript">
 			function init()
 			{
-				typeChanged();
+				var modeValue = getModeValue();
+                
+                typeChanged();
+                insertMode(modeValue);
+                
+                if (modeValue == 1)
+                    updateForm();
 			}
 
 			function typeChanged()
@@ -18,8 +24,132 @@
 				var type = $F('metadata.type');
 
 				if (type == 's')	Element.show('metadata.title');
-					else				Element.hide('metadata.title');
+					else			Element.hide('metadata.title');
 			}
+			
+			function getModeValue()
+            {
+                for (var i=0; i &lt; document.xmlinsert.insert_mode.length; i++)
+                {
+                    if (document.xmlinsert.insert_mode[i].checked)
+                    {
+                        var modeValue = document.xmlinsert.insert_mode[i].value;
+                    }
+                }
+                return modeValue;
+            }
+            
+            function getFileValue()
+            {
+                for (var i=0; i &lt; document.xmlinsert.file_type.length; i++)
+                {
+                    if (document.xmlinsert.file_type[i].checked)
+                    {
+                        var fileValue = document.xmlinsert.file_type[i].value;
+                    }
+                }
+                return fileValue;
+            }
+            
+            function updateForm() {
+                var fileType = getFileValue();
+                
+                if (fileType == 'single')       displayAllForm(true);
+                else if (fileType == 'mef')     displayAllForm(false);
+            }
+            
+            function insertMode(value){
+                if (value == 0) {
+                    Element.hide('gn.fileUp');
+                    Element.show('gn.xmlUp');
+                    $('gn.fileType').style.display='none';
+                    $('gn.uuidAction').style.display='none';
+                    document.xmlinsert.action=Env.locService+"/metadata.insert";
+                    document.xmlinsert.target='_self';
+                } else {
+                    Element.hide('gn.xmlUp');
+                    Element.show('gn.fileUp');
+                    $('gn.fileType').style.display='';
+                    $('gn.uuidAction').style.display='';
+                    document.xmlinsert.enctype="multipart/form-data";
+                    document.xmlinsert.action=Env.locService+"/mef.import";
+                    document.xmlinsert.target='upFrame';
+                }
+            }
+            
+            function displayAllForm(show){
+                var display;
+
+                if (show == true) 
+                    display='';
+                else 
+                    display='none';
+                
+                displayElement('gn.type',display);
+                displayElement('gn.stylesheet',display);
+                displayElement('gn.destSchema',display);
+                displayElement('gn.validate',display);
+                displayElement('gn.groups',display);
+                displayElement('gn.categories',display);
+            }
+            
+            function displayElement(id, value) {
+                if ($(id))
+                    $(id).style.display=value;
+            }
+            
+            function doFileUpload() {
+                var response = $('upFrame').contentWindow.document;
+                var elt;
+                if (response.XMLDocument) {
+                	elt = response.XMLDocument.selectSingleNode('ok');
+                } else {
+                	elt = response.getElementsByTagName('ok')[0]; 
+                }
+                var error = $('upFrame').contentWindow.document.getElementById('error');
+                
+                if (elt != null || error != null) {
+                	$('btInsert').style.display='none';
+                    $('gn.insertTable').style.display = 'none';
+                	if (elt != null) {
+                		var id;
+                		if (response.XMLDocument)
+                			id= elt.text;
+                		else
+                			id = elt.firstChild.nodeValue;
+                	createResponseForm(id);
+                	} else if (error != null){
+                		$('back').style.display='none';
+                		displayError(error);
+                	}
+                    $('gn.result').style.display = 'block';
+                }   
+            }
+            
+            function createResponseForm(value) {
+                var contentElt = $('gn.resultContent');
+                var id = document.createTextNode(value);
+                var element = document.createElement("a");
+                var space = document.createTextNode("&#160;");
+                
+                element.setAttribute("href", Env.locService+"/metadata.show?id="+value+"&amp;currTab=simple");
+                element.appendChild(id);
+                
+                contentElt.appendChild(element);
+                contentElt.appendChild(space);
+            }
+            
+            function displayError(errorDiv) {
+            	var content = $('gn.resultContent');
+            	$('gn.resultTitle').innerHTML = "" ;
+           		if (!$('error')) {
+           			content.appendChild(errorDiv);
+           			$('goBack').onclick = function () { 
+           				load('metadata.xmlinsert.form');
+           			};
+           		}
+            }
+            
             var schema = new Array (
             <xsl:for-each select="/root/gui/schemas/name">
                <xsl:sort select="."/>
@@ -48,17 +178,92 @@
 		<xsl:call-template name="formLayout">
 			<xsl:with-param name="title" select="/root/gui/strings/xmlInsert"/>
 			<xsl:with-param name="content">
-				<form name="xmlinsert" accept-charset="UTF-8" method="post" action="{/root/gui/locService}/metadata.insert">
+				<form name="xmlinsert" accept-charset="UTF-8" method="post" action="{/root/gui/locService}/metadata.insert" enctype="multipart/form-data">
 					<input type="submit" style="display: none;" />
-					<table>
+					<table id="gn.insertTable">
 						<tr>
-							<th class="padded" valign="top"><xsl:value-of select="/root/gui/strings/metadata"/></th>
-							<td class="padded"><textarea class="content" name="data" cols="80" rows="20"/></td>
-						</tr>
-
+                            <th class="padded" valign="top"><xsl:value-of select="/root/gui/strings/insertMode"/></th>
+                            <td>
+                                <table>
+                                    <tr>
+                                        <td class="padded">
+                                            <input type="radio" id="insertPasteMode" name="insert_mode" value="0" 
+                                                onclick="$('singleFile').checked=true;displayAllForm(true);insertMode(this.value)" checked="true"/>
+                                            <label for="insertPasteMode"><xsl:value-of select="/root/gui/strings/insertPasteMode"/></label>
+                                            <xsl:text>&#160;</xsl:text>
+                                        </td>
+                                        <td class="padded">
+                                            <input type="radio" id="insertFileMode" name="insert_mode" value="1" 
+                                                onclick="insertMode(this.value)"/>
+                                            <label for="insertFileMode"><xsl:value-of select="/root/gui/strings/insertFileMode"/></label>
+                                        </td>
+                                    </tr>
+                                </table>
+                            </td>
+                        </tr>
+                        <tr id="gn.fileType">
+                            <th class="padded" valign="top"><xsl:value-of select="/root/gui/strings/fileType"/></th>
+                            <td>
+                                <table>
+                                    <tr>
+                                        <td class="padded">
+                                            <input type="radio" id="singleFile" name="file_type" value="single" onclick="displayAllForm(this.checked)" checked="true"/>
+                                            <label for="singleFile"><xsl:value-of select="/root/gui/strings/singleFile"/></label>
+                                            <xsl:text>&#160;</xsl:text>
+                                        </td>
+                                        <td class="padded">
+                                            <input type="radio" id="mefFile" name="file_type" value="mef" onclick="displayAllForm(false)"/>
+                                            <label for="mefFile"><xsl:value-of select="/root/gui/strings/mefFile"/></label>
+                                            <xsl:text>&#160;</xsl:text>
+                                        </td>
+                                    </tr>
+                                </table>
+                            </td>
+                        </tr>
+                        <tr>
+                            <th class="padded" valign="top"><xsl:value-of select="/root/gui/strings/metadata"/></th>
+                            <td class="padded">
+                                <span id="gn.xmlUp" style="display:none">
+                                    <textarea class="content" name="data" cols="80" rows="20"/>
+                                </span>
+                                <span id="gn.fileUp" style="display:none">
+                                    <input type="file" accept="*.xml, *.zip, *.mef" class="content" size="60" name="mefFile" value=""/>
+                                </span>
+                            </td>
+                        </tr>
+						
+						<!-- uuid constraints -->
+                        
+                        <tr id="gn.uuidAction">
+                            <th class="padded" valign="top"><xsl:value-of select="/root/gui/strings/uuidAction"/></th>
+                            <td>
+                                <table>
+                                    <tr>
+                                        <td class="padded">
+                                            <input type="radio" id="nothing" name="uuidAction" value="nothing" checked="true" />
+                                            <label for="nothing"><xsl:value-of select="/root/gui/strings/nothing"/></label>
+                                            <xsl:text>&#160;</xsl:text>
+                                        </td>
+                                    </tr><tr>
+                                        <td class="padded">
+                                            <input type="radio" id="overwrite" name="uuidAction" value="overwrite" />
+                                            <label for="overwrite"><xsl:value-of select="/root/gui/strings/overwrite"/></label>
+                                            <xsl:text>&#160;</xsl:text>
+                                        </td>
+                                    </tr><tr>
+                                        <td class="padded">
+                                            <input type="radio" id="generateUUID" name="uuidAction" value="generateUUID" />
+                                            <label for="generateUUID"><xsl:value-of select="/root/gui/strings/generateUUID"/></label>
+                                            <xsl:text>&#160;</xsl:text>
+                                        </td>
+                                    </tr>
+                                </table>
+                            </td>
+                        </tr>
+						
 						<!-- type -->
 
-						<tr>
+						<tr id="gn.type">
 							<th class="padded" valign="top"><xsl:value-of select="/root/gui/strings/type"/></th>
 							<td>
 								<select class="content" name="template" size="1" id="metadata.type" onchange="typeChanged()">
@@ -77,7 +282,7 @@
 
 						<!-- stylesheet -->
 
-						<tr>
+						<tr id="gn.stylesheet">
 							<th class="padded"><xsl:value-of select="/root/gui/strings/styleSheet"/></th>
 							<td class="padded">
 								<select class="content" id="styleSheet" name="styleSheet" size="1" onchange="updateSchema();">
@@ -96,7 +301,7 @@
 
 						<!-- destination schema -->
 
-						<tr>
+						<tr id="gn.destSchema">
 							<th class="padded"><xsl:value-of select="/root/gui/strings/desSchema"/></th>
 							<td class="padded">
 								<select class="content" id="schema" name="schema" size="1">
@@ -112,7 +317,7 @@
 
 						<!-- validate --> 
 
-						<tr>
+						<tr id="gn.validate">
 							<th class="padded"><xsl:value-of select="/root/gui/strings/validate"/></th>
 							<td><input class="content" type="checkbox" name="validate"/></td>
 						</tr>
@@ -121,7 +326,7 @@
 
 						<xsl:variable name="lang" select="/root/gui/language"/>
 
-						<tr>
+						<tr id="gn.groups">
 							<th class="padded"><xsl:value-of select="/root/gui/strings/group"/></th>
 							<td class="padded">
 								<select class="content" name="group" size="1">
@@ -136,7 +341,7 @@
 
 						<!-- categories -->
 
-						<tr>
+						<tr id="gn.categories">
 							<th class="padded"><xsl:value-of select="/root/gui/strings/category"/></th>
 							<td class="padded">
 								<select class="content" name="category" size="1">
@@ -153,12 +358,21 @@
 							</td>
 						</tr>
 					</table>
+					<iframe id="upFrame" name="upFrame" width="200p" height="100p" onload="javascript:doFileUpload();" style="display:none;"/>
+                    <table id="gn.result" style="display:none;">
+	                    <tr>
+	                        <th id="gn.resultTitle" class="padded-content">
+	                            <h2><xsl:value-of select="/root/gui/strings/newMdInsert" /></h2>
+	                        </th>
+	                        <td id="gn.resultContent" class="padded-content" />
+	                    </tr>
+                    </table>
 				</form>
 			</xsl:with-param>
 			<xsl:with-param name="buttons">
-				<button class="content" onclick="goBack()"><xsl:value-of select="/root/gui/strings/back"/></button>
+				<button class="content" onclick="goBack()" id="back"><xsl:value-of select="/root/gui/strings/back"/></button>
 				&#160;
-				<button class="content" onclick="goSubmit('xmlinsert')"><xsl:value-of select="/root/gui/strings/insert"/></button>
+				<button class="content" onclick="goSubmit('xmlinsert')" id="btInsert"><xsl:value-of select="/root/gui/strings/insert"/></button>
 			</xsl:with-param>
 		</xsl:call-template>
 	</xsl:template>

