/*
 * Copyright (C) 2011 B3Partners B.V.
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */
package nl.b3p.viewer.config.services;

import java.io.IOException;
import java.util.List;
import javax.persistence.*;
/**
 *
 * @author jytte
 */
@Entity
@DiscriminatorValue(ArcXMLFeatureSource.PROTOCOL)
public class ArcXMLFeatureSource extends FeatureSource {
    public static final String PROTOCOL = "arcxml";
    
    @Basic
    private String serviceName;

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    @Override
    List<String> calculateUniqueValues(SimpleFeatureType sft, String attributeName, int maxFeatures) throws IOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    org.geotools.data.FeatureSource openGeoToolsFeatureSource(SimpleFeatureType sft) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}

@@ -771,45 +771,388 @@
 ava.
-util.List;%0Aimport javax.persistence.*
+net.URL;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport javax.persistence.*;%0Aimport nl.b3p.geotools.data.arcims.ArcIMSDataStore;%0Aimport nl.b3p.geotools.data.arcims.ArcIMSDataStoreFactory;%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0Aimport org.geotools.data.DataStore;%0Aimport org.geotools.data.DataStoreFinder
 ;%0A/*
@@ -1292,16 +1292,98 @@
 ource %7B%0A
+    private static final Log log = LogFactory.getLog(ArcXMLFeatureSource.class);%0A%0A
     publ
@@ -1639,32 +1639,896 @@
 iceName;%0A    %7D%0A%0A
+    %0A    public DataStore createDataStore() throws Exception %7B%0A        Map params = new HashMap();%0A%0A        params.put(ArcIMSDataStoreFactory.PARAM_URL.key, new URL(getUrl()));%0A        params.put(ArcIMSDataStoreFactory.PARAM_SERVICENAME.key, serviceName);%0A        %0A        params.put(ArcIMSDataStoreFactory.PARAM_USER, getUsername());%0A        params.put(ArcIMSDataStoreFactory.PARAM_PASSWD, getPassword());%0A        %0A        log.debug(%22Opening datastore using parameters: %22 + params);%0A        try %7B%0A            DataStore ds = DataStoreFinder.getDataStore(params);      %0A            if(ds == null) %7B%0A                throw new Exception(%22Cannot open datastore using parameters %22 + params);%0A            %7D%0A            return ds;%0A        %7D catch(Exception e) %7B%0A            throw new Exception(%22Cannot open datastore using parameters %22 + params, e);%0A        %7D%0A    %7D%0A    %0A
     @Override%0A  
@@ -2828,78 +2828,122 @@
 ft) 
-%7B%0A        throw new UnsupportedOperationException(%22Not supported yet.%22
+throws Exception %7B%0A        DataStore ds = createDataStore();%0A%0A        return ds.getFeatureSource(sft.getTypeName()
 );%0A 

use ArcIMS DataStore