import java.io.File;
import org.geotools.data.DataStoreFinder;
import org.geotools.data.FeatureSource;
import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
public class LoaderShapeFile extends Loader{
private String filename = null;
private File file;
private String tablename = null;
public LoaderShapeFile(String filename)
{
this.filename = filename;
file = new File(filename);
try{
params.put( "url", file.toURI().toURL() );
}catch(Exception e){e.printStackTrace();}
}
public void setTableName(String tablename)
{
this.tablename = tablename;
}
public FeatureSource loadFeatureSource()
{
try{
store = DataStoreFinder.getDataStore(params);
System.out.println("table: " +store.getTypeNames()[0]);
source = store.getFeatureSource(store.getTypeNames()[0]);
}catch(Exception e){e.printStackTrace();}
return source;
}
}