Index: DefaultMapContextManager.java
===================================================================
--- DefaultMapContextManager.java	(revision 47739)
+++ DefaultMapContextManager.java	(revision 47740)
@@ -102,6 +102,7 @@
 import org.gvsig.tools.resourcesstorage.ResourcesStorage;
 import org.gvsig.tools.resourcesstorage.ResourcesStorage.Resource;
 import org.gvsig.tools.swing.api.TransparencySupport;
+import org.gvsig.tools.util.Factory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -125,7 +126,7 @@
 
     private final Map<String, Map<Class<ILegend>,Class<ILegendWriter>>> legendWriters = new LinkedHashMap<>();
     
-    private final Map<Class,Class<? extends FLayer>> layerClassFromStoreClass = new HashMap<>();
+    private final Map<Object,Class<? extends FLayer>> layerClassFromStoreClass = new HashMap<>();
 
     private final Map<String,String> iconLayers = new HashMap(); //  (Map<String storeProviderName, String iconName>)
 
@@ -691,18 +692,41 @@
         this.layerClassFromStoreClass.put(theClass, layerClass);
         return true;
     }    
+
+    @Override
+    public boolean registerLayer(Factory<FLayer> factory) {
+        this.layerClassFromStoreClass.put(factory, null);
+        return true;
+    }
     
+    private FLayer newLayer(DataStore dataStore) {
+        for (Map.Entry<Object, Class<? extends FLayer>> entry : layerClassFromStoreClass.entrySet()) {
+            Object  currentKey = entry.getKey();
+            if( currentKey instanceof Factory ) {
+                Factory<FLayer> factory = (Factory<FLayer>) currentKey;
+                FLayer layer = factory.create(dataStore.getParameters(), dataStore);
+                if( layer != null ) {
+                    return layer;
+                }
+            }
+        }
+        return null;
+    }
+    
     private Class<? extends FLayer> getLayerClass(
             Class keyClass) {
         Class<? extends FLayer> layerClass = this.layerClassFromStoreClass.get(keyClass);
         if( layerClass!=null ) {
             return layerClass;
         }
-        for (Map.Entry<Class, Class<? extends FLayer>> entry : layerClassFromStoreClass.entrySet()) {
-            Class  currentKeyClass = entry.getKey();
-            layerClass = entry.getValue();
-            if( currentKeyClass.isAssignableFrom(keyClass) ) {
-                return layerClass;
+        for (Map.Entry<Object, Class<? extends FLayer>> entry : layerClassFromStoreClass.entrySet()) {
+            Object  currentKey = entry.getKey();
+            if( currentKey instanceof Class ) {
+                Class  currentKeyClass = (Class) currentKey;
+                layerClass = entry.getValue();
+                if( currentKeyClass.isAssignableFrom(keyClass) ) {
+                    return layerClass;
+                }
             }
         }
         return null;
@@ -814,24 +838,24 @@
                     }
                 }
             }
-            
-            Class<? extends FLayer> layerClass = this.getLayerClass(dataStore.getParameters().getClass());
-            if (layerClass == null) {
-                layerClass = this.getLayerClass(dataStore.getProviderFactory().getClass());
+            FLayer layer = this.newLayer(dataStore);
+            if( layer == null ) {
+                Class<? extends FLayer> layerClass = this.getLayerClass(dataStore.getParameters().getClass());
                 if (layerClass == null) {
-                    layerClass = this.getLayerClass(dataStore.getClass());
+                    layerClass = this.getLayerClass(dataStore.getProviderFactory().getClass());
+                    if (layerClass == null) {
+                        layerClass = this.getLayerClass(dataStore.getClass());
+                    }
+                    if (layerClass == null) {
+                        throw new CantRetrieveLayerByStoreException(layerName, dataStore.getName());
+                    }
                 }
-                if (layerClass == null) {
-                    throw new CantRetrieveLayerByStoreException(layerName, dataStore.getName());
+                try {
+                    layer = (FLayer) layerClass.newInstance();
+                } catch (InstantiationException | IllegalAccessException e) {
+                    throw new LoadLayerException(layerName, e);
                 }
             }
-            FLayer layer;
-            try {
-                layer = (FLayer) layerClass.newInstance();
-            } catch (InstantiationException | IllegalAccessException e) {
-                throw new LoadLayerException(layerName, e);
-            }
-
             layer.setName(layerName);
             ((SingleLayer) layer).setDataStore(dataStore);
             if (projection != null) {
