/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.b3p.geotools.data.arcims;

import java.io.IOException;
import java.io.Serializable;
import java.net.URL;
import java.util.Map;
import org.geotools.data.AbstractDataStoreFactory;
import org.geotools.data.DataStore;
import org.geotools.data.DataStoreFactorySpi;

/**
 *
 * @author Matthijs Laan
 */
public class ArcIMSDataStoreFactory extends AbstractDataStoreFactory {
    
    public static final DataStoreFactorySpi.Param URL = new Param("url", URL.class, "URL to a ArcIMS service");
    public static final DataStoreFactorySpi.Param SERVICENAME = new Param("service_name", String.class, "ServiceName parameter if not in URL", false);    
    public static final DataStoreFactorySpi.Param USER = new Param("user", String.class, "Username", false);    
    public static final DataStoreFactorySpi.Param PASSWD = new Param("passwd", String.class, "Password", false);    
    public static final DataStoreFactorySpi.Param TIMEOUT = new Param("timeout", Integer.class, "Timeout in ms; default 30000", false);
    
    @Override
    public DataStore createDataStore(Map<String, Serializable> params) throws IOException {
        return createNewDataStore(params);
    }

    @Override
    public DataStore createNewDataStore(Map<String, Serializable> params) throws IOException {
        return new ArcIMSDataStore(
                (URL)params.get(URL.key), 
                (String)params.get(SERVICENAME.key),
                (String)params.get(USER.key),
                (String)params.get(PASSWD.key),
                (Integer)params.get(TIMEOUT.key));
    }

    @Override
    public String getDescription() {
        return "ArcIMS data store";
    }

    @Override
    public Param[] getParametersInfo() {
        return new Param[] { URL, SERVICENAME, USER, PASSWD, TIMEOUT };
    }    
}

@@ -363,16 +363,78 @@
 torySpi;
+%0Aimport org.opengis.referencing.crs.CoordinateReferenceSystem;
 %0A%0A/**%0A *
@@ -628,17 +628,8 @@
 s, %22
-URL to a 
 ArcI
@@ -638,16 +638,20 @@
  service
+ URL
 %22);%0A    
@@ -1167,16 +1167,161 @@
 false);%0A
+    public static final DataStoreFactorySpi.Param CRS = new Param(%22crs%22, CoordinateReferenceSystem.class, %22Coordinate reference system%22, false);%0A
     %0A   
@@ -1856,16 +1856,89 @@
 OUT.key)
+,%0A                (CoordinateReferenceSystem)params.get(CRS.key)%0A        
 );%0A    %7D
@@ -2084,24 +2084,24 @@
 ersInfo() %7B%0A
-
         retu
@@ -2156,16 +2156,21 @@
  TIMEOUT
+, CRS
  %7D;%0A    

add CRS parameter