# HG changeset patch # User Raimund Renkert # Date 1311177692 -7200 # Node ID 6db0677a64502fe609b951a47405359248402527 # Parent cdbf2f2dca3588de408cdbd99c6dde70a495c08b# Parent 123ebb293f3a98e06e80519feebb625fb5e938ad Merged with Stephans commits. diff -r 123ebb293f3a -r 6db0677a6450 ChangeLog --- a/ChangeLog Wed Jul 20 17:02:50 2011 +0200 +++ b/ChangeLog Wed Jul 20 18:01:32 2011 +0200 @@ -1,3 +1,16 @@ +2011-07-20 Raimund Renkert + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + Check for database connectio user parameter for SDE connections. + Set default "sde" if attribute is missing. + +2011-07-20 Raimund Renkert + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + If a SDE datasource and a join table is used, check if the join + table contains a "." to verify there could be a database schema. + If no "." is found, abort writing the mapfile. + 2011-07-20 Stephan Holl * website/.htaccess, diff -r 123ebb293f3a -r 6db0677a6450 src/java/de/intevation/mxd/writer/MapScriptWriter.java --- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 20 17:02:50 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Wed Jul 20 18:01:32 2011 +0200 @@ -111,13 +111,15 @@ //Write the map attributes. writeMap(); //Write the layers. - writeLayer(); + boolean ret = writeLayer(); //Save the map. - mapObj cloneMap = map.cloneMap(); - - cloneMap.save(mapFilename); - logger.info("Mapfile created: " + mapFilename); - return true; + if (ret) { + mapObj cloneMap = map.cloneMap(); + cloneMap.save(mapFilename); + logger.info("Mapfile created: " + mapFilename); + return true; + } + return false; } /** @@ -180,7 +182,7 @@ /** * Create layer objects and set the attributes. */ - private void writeLayer() { + private boolean writeLayer() { logger.debug("writeLayer()"); Element mapNode = (Element)XMLUtils.xpath( root, @@ -266,10 +268,16 @@ layer.setConnectionType( MS_CONNECTION_TYPE.MS_PLUGIN.swigValue(), MS_BINDIR + "/ms/plugins/msplugin_sde_93.dll"); + String database_auth = layerElement.getAttribute("database"); + if (database_auth.equals("") || database_auth == null) { + logger.warn("Could not set the database connection user." + + " Setting to \"sde\" as default."); + database_auth = "sde"; + } layer.setConnection( layerElement.getAttribute("server") + "," + "port:" + layerElement.getAttribute("instance") + "," + - layerElement.getAttribute("database") + "," + + database_auth + "," + layerElement.getAttribute("user") + ","); layer.setData( layerElement.getAttribute("data_source") + @@ -278,6 +286,13 @@ layer.setProcessing("CLOSE_CONNECTION=defer"); layer.setProcessing("ATTRIBUTE_QUALIFIED=TRUE"); if(layerElement.hasAttribute("join_table")) { + String join = layerElement.getAttribute("join_table"); + if (join.indexOf(".") <= 0) { + logger.warn ("Incomplete join table in layer " + + layerElement.getAttribute("name") + + ". Aborting."); + return false; + } layer.setProcessing( "JOINTABLE=" + layerElement.getAttribute("join_table")); @@ -318,6 +333,7 @@ //Write classes. writeClass(layer, layerElement); } + return true; } /**