Hi,

Just made a hackish modification for database users.
Up to now, a project containing DataStoreDataSource
layers or DataStoreQueryDataSource layers could no
more be opened if connections become invalid.

It now imports empty layers instead, keeping the invalid
connection and, more important, the SQL query and the
styles attached to the layer.
You still cannot connect to your new database, but you
can change connection parameters with the following
script (only tested with DataStoreQueryDataSource)

need r3482

Michaël

// ----------------------------------------------
// This script will change database connections
// for selected layers
// Use case : you have an old project containing
// many database connections and/or queries, but
// your database, or password has changed.
// You can still load the project (it will throw
// exceptions and create empty layers), and use
// this script to change database connections.
// ----------------------------------------------
import 
com.vividsolutions.jump.workbench.ui.plugin.datastore.DataStoreQueryDataSource;
for (lyr : wc.layerNamePanel.selectedLayers) {
     ds = lyr.dataSourceQuery.dataSource;
     if (ds instanceof DataStoreQueryDataSource || ds instanceof 
DataStoreDataSource) {
         //print(ds.properties.get("Connection 
Descriptor").parameterList.schema.names);
         ds.properties.get("Connection 
Descriptor").parameterList.setParameter("Server",  "new_server");
         ds.properties.get("Connection 
Descriptor").parameterList.setParameter("Server",  "new_port");
         ds.properties.get("Connection 
Descriptor").parameterList.setParameter("Database","new_name");
         ds.properties.get("Connection 
Descriptor").parameterList.setParameter("User",    "new_user");
         ds.properties.get("Connection 
Descriptor").parameterList.setParameter("Password","new_pwd");
     }
}

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to