import org.geotools.arcsde.ArcSDEDataStoreFactory;
import org.geotools.data.DataStore;
import org.geotools.data.FeatureSource;
public class LoaderArcSDE extends Loader {
private String dbtype = "arcsde";
private String server = "brian";
private String port = "5151";
private String database = "";
private String user = "gisadmin";
private String password = "gisadmin";
ArcSDEDataStoreFactory factory = new ArcSDEDataStoreFactory();
private String tablename = "GISADMIN.BDA";
public LoaderArcSDE()
{
params.put("dbtype", dbtype);
params.put("server", server);
params.put("port", port);
params.put("database", database); // this was OK as blank in my example
params.put("user", user);
params.put("password", password);
}
public LoaderArcSDE(String dbtype, String Server, String port,
String database, String user, String password)
{
params.put("dbtype", dbtype);
params.put("server", server);
params.put("port", port);
params.put("database", database); // this was OK as blank in my example
params.put("user", user);
params.put("password", password);
}
public void setTableName(String tablename)
{
this.tablename = tablename;
}
public FeatureSource loadFeatureSource()
{
try{
store = (DataStore) factory.createDataStore(params);
source = store.getFeatureSource(tablename);
}catch(Exception e){e.printStackTrace();}
return source;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//
// String[] names = store.getTypeNames();
//
// for (String name: names)
// System.out.println(name);
//
// source = store.getFeatureSource(tableName);
}
}