Well if it stopping when it checks the params then it will not even try to
connect sigh ... here is the code?
Q: Can you see anything that would prevent your params being accepted?
Q: is the postgis-versioned jar in libs? Try removing it to see if that helps
with the checkDBType
Q: Do you have the geotools source code to walk through this in a debugger? It
would be good to know *which* param it is not accepting?
1) JDBCDataStoreFactory
public boolean canProcess(Map params) {
if (!super.canProcess(params)) {
return false; // was not in agreement with getParametersInfo
}
return checkDBType(params);
}
2) super.canProcess(params)
public boolean canProcess( Map params ) {
if (params == null) {
return false;
}
Param arrayParameters[] = getParametersInfo();
for (int i = 0; i < arrayParameters.length; i++) {
Param param = arrayParameters[i];
Object value;
if( !params.containsKey( param.key ) ){
if( param.required ){
return false; // missing required key!
} else {
continue;
}
}
try {
value = param.lookUp( params );
} catch (IOException e) {
// could not upconvert/parse to expected type!
// even if this parameter is not required
// we are going to refuse to process
// these params
return false;
}
if( value == null ){
if (param.required) {
return (false);
}
} else {
if ( !param.type.isInstance( value )){
return false; // value was not of the required type
}
}
}
return true;
}
3) PostgisNGDataStoreFactory.checkDBType
protected boolean checkDBType(Map params) {
if (super.checkDBType(params)) {
//check for old factory
try {
Class.forName("org.geotools.data.postgis.PostgisDataStoreFactory");
//old factory is around, let it handle the connection
return false;
}
catch(ClassNotFoundException e) {
//old factory is not around, handle this connection
return true;
}
}
else {
//check for postgisng as well
return checkDBType(params, "postgisng");
}
}
--
Jody Garnett
On Monday, 19 September 2011 at 12:04 PM, poultee wrote:
> On 9/19/2011 5:02 PM, poultee wrote:
> > I seriously can not understand why it won't return anything other than null
> > for a service(it's pasted from one of the udig dev guide pages after all
> > http://udig.refractions.net:8080/confluence/display/DEV/2+Catalog#2Catalog-LocalCatalog
> > )...looks like i'm going to try and use PostgisService2 directly.
>
> i have also tried
> IRepository local = CatalogPlugin.getDefault().getLocal();
> URL aa = new URL (null,
> "jdbc.postgis://postgres:12345@localhost:5432/postgis",
> CorePlugin.RELAXED_HANDLER);
> IService service = local.acquire( aa, new NullProgressMonitor() ); // saw
> it here
> https://github.com/uDig/udig-platform/blob/master/tutorials/net.refractions.udig.tutorials.examples/src/net/refractions/udig/tutorials/examples/CatalogExample.java,
> and it returns null for "service"
>
> instead of
>
> java.util.Map<String,Serializable> params = new
> HashMap<String,Serializable>();
> params.put("dbtype", "postgis"); // must be "postgis"
> params.put("host", "localhost"); // the name or ip address of the machine
> running PostGIS
> params.put("port", new Integer(5432)); // the port that PostGIS is running
> on (generally 5432)
> params.put("database", "postgis"); // the name of the database to connect
> to.
> params.put("user", "postgres"); // the user to connect with
> params.put("passwd", "12345");
>
> IRepository local = CatalogPlugin.getDefault().getLocal();
> IService service = local.acquire( params, new NullProgressMonitor() ); //
> should not be null but it is
>
>
> but it still does not work ...
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel