Strabon
changeset 323:1c07378b4160
added support for KML
line diff
1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Thu Jun 21 23:40:18 2012 +0300 1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Thu Jun 21 23:58:16 2012 +0300 1.3 @@ -1,35 +1,13 @@ 1.4 package org.openrdf.query.algebra.evaluation.function.spatial; 1.5 import java.io.IOException; 1.6 -import java.io.InputStream; 1.7 -import java.io.Reader; 1.8 import java.io.StringReader; 1.9 import java.util.ArrayList; 1.10 -import java.util.List; 1.11 -import java.util.NoSuchElementException; 1.12 1.13 -import javax.annotation.Resource; 1.14 import javax.xml.bind.JAXBContext; 1.15 import javax.xml.bind.JAXBException; 1.16 import javax.xml.bind.Unmarshaller; 1.17 import javax.xml.parsers.ParserConfigurationException; 1.18 1.19 -import org.geotools.feature.collection.AbstractFeatureVisitor; 1.20 -import org.geotools.geometry.jts.JTS; 1.21 -import org.geotools.referencing.CRS; 1.22 -import org.geotools.util.NullProgressListener; 1.23 -import org.geotools.GML; 1.24 -import org.geotools.data.simple.SimpleFeatureCollection; 1.25 -import org.geotools.data.simple.SimpleFeatureIterator; 1.26 -import org.opengis.feature.Feature; 1.27 -import org.opengis.feature.simple.SimpleFeature; 1.28 -import org.geotools.xml.Parser; 1.29 -import org.geotools.xml.Configuration; 1.30 -import org.geotools.gml3.GMLConfiguration; 1.31 -import org.opengis.geometry.MismatchedDimensionException; 1.32 -import org.opengis.referencing.FactoryException; 1.33 -import org.opengis.referencing.crs.CoordinateReferenceSystem; 1.34 -import org.opengis.referencing.operation.MathTransform; 1.35 -import org.opengis.referencing.operation.TransformException; 1.36 import org.openrdf.model.URI; 1.37 import org.openrdf.model.Value; 1.38 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 1.39 @@ -52,7 +30,6 @@ 1.40 1.41 public class StrabonPolyhedron implements Value { 1.42 1.43 - 1.44 private static final long serialVersionUID = 894529468109904724L; 1.45 1.46 public static String CACHEPATH = "";
2.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java Thu Jun 21 23:40:18 2012 +0300 2.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java Thu Jun 21 23:58:16 2012 +0300 2.3 @@ -137,4 +137,5 @@ 2.4 2.5 return output; 2.6 } 2.7 + 2.8 }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsKMLWriter.java Thu Jun 21 23:58:16 2012 +0300 3.3 @@ -0,0 +1,381 @@ 3.4 +package org.openrdf.query.resultio.sparqlxml; 3.5 + 3.6 +import java.io.ByteArrayOutputStream; 3.7 +import java.io.IOException; 3.8 +import java.io.OutputStream; 3.9 +import java.io.UnsupportedEncodingException; 3.10 +import java.util.List; 3.11 + 3.12 +import javax.xml.namespace.QName; 3.13 + 3.14 +import org.geotools.kml.KML; 3.15 +import org.geotools.kml.KMLConfiguration; 3.16 +import org.geotools.xml.Encoder; 3.17 +import org.openrdf.model.Literal; 3.18 +import org.openrdf.model.Value; 3.19 +import org.openrdf.query.Binding; 3.20 +import org.openrdf.query.BindingSet; 3.21 +import org.openrdf.query.TupleQueryResultHandlerException; 3.22 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 3.23 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 3.24 +import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 3.25 +import org.openrdf.query.resultio.TupleQueryResultFormat; 3.26 +import org.openrdf.query.resultio.TupleQueryResultWriter; 3.27 +import org.slf4j.Logger; 3.28 +import org.slf4j.LoggerFactory; 3.29 + 3.30 +import com.vividsolutions.jts.geom.Geometry; 3.31 +import com.vividsolutions.jts.geom.GeometryCollection; 3.32 +import com.vividsolutions.jts.geom.GeometryFactory; 3.33 +import com.vividsolutions.jts.geom.LineString; 3.34 +import com.vividsolutions.jts.geom.MultiLineString; 3.35 +import com.vividsolutions.jts.geom.MultiPoint; 3.36 +import com.vividsolutions.jts.geom.MultiPolygon; 3.37 +import com.vividsolutions.jts.geom.Point; 3.38 +import com.vividsolutions.jts.geom.Polygon; 3.39 +import com.vividsolutions.jts.geom.PrecisionModel; 3.40 +import com.vividsolutions.jts.io.ParseException; 3.41 +import com.vividsolutions.jts.io.WKTReader; 3.42 + 3.43 +/** 3.44 + * 3.45 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 3.46 + * 3.47 + */ 3.48 +public class stSPARQLResultsKMLWriter implements TupleQueryResultWriter { 3.49 + 3.50 + private static final Logger logger = LoggerFactory.getLogger(org.openrdf.query.resultio.sparqlxml.stSPARQLResultsKMLWriter.class); 3.51 + 3.52 + private static final String ROOT_TAG = "kml"; 3.53 + private static final String NAMESPACE = "http://www.opengis.net/kml/2.2"; 3.54 + private static final String RESULT_SET_TAG = "Folder"; 3.55 + 3.56 + private static final String PLACEMARK_TAG = "Placemark"; 3.57 + private static final String NAME_TAG = "name"; 3.58 + private static final String DESC_TAG = "description"; 3.59 + 3.60 + private static final String TABLE_ROW_BEGIN = "<TR>"; 3.61 + private static final String TABLE_ROW_END = "</TR>"; 3.62 + private static final String TABLE_DATA_BEGIN = "<TD>"; 3.63 + private static final String TABLE_DATA_END = "</TD>"; 3.64 + 3.65 + private static final String NEWLINE = "\n"; 3.66 + 3.67 + private static final String TABLE_DESC_BEGIN = "<![CDATA[<TABLE border=\"1\">" + NEWLINE; 3.68 + private static final String TABLE_DESC_END = "</TABLE>]]>" + NEWLINE; 3.69 + 3.70 + private static final String GEOMETRY_NAME = "Geometry"; 3.71 + 3.72 + /** 3.73 + * The underlying XML formatter. 3.74 + */ 3.75 + private stSPARQLXMLWriter xmlWriter; 3.76 + 3.77 + /** 3.78 + * The number of results seen. 3.79 + */ 3.80 + private int nresults; 3.81 + 3.82 + /** 3.83 + * The number of geometries seen. 3.84 + */ 3.85 + private int ngeometries; 3.86 + 3.87 + /** 3.88 + * factory for geometry objects 3.89 + */ 3.90 + //private GeometryFactory gf; 3.91 + 3.92 + /** 3.93 + * The JTS wrapper 3.94 + */ 3.95 + private JTSWrapper jts; 3.96 + 3.97 + /** 3.98 + * Stream for manipulating geometries 3.99 + */ 3.100 + private ByteArrayOutputStream baos; 3.101 + 3.102 + /** 3.103 + * Description string holding the projected variables 3.104 + * of the SPARQL query 3.105 + */ 3.106 + private StringBuilder descHeader; 3.107 + 3.108 + /** 3.109 + * Description string holding the values for the 3.110 + * projected variables of the SPARQL query 3.111 + */ 3.112 + private StringBuilder descData; 3.113 + 3.114 + /** 3.115 + * Indentation used in tags that are constructed manually 3.116 + */ 3.117 + private int depth; 3.118 + 3.119 + /** 3.120 + * Creates an stSPARQLResultsKMLWriter that encodes the SPARQL 3.121 + * results in KML/KMZ. 3.122 + * 3.123 + * TODO: KMZ 3.124 + * 3.125 + * @param out 3.126 + * @throws UnsupportedEncodingException 3.127 + */ 3.128 + public stSPARQLResultsKMLWriter(OutputStream out) throws UnsupportedEncodingException { 3.129 + this(new stSPARQLXMLWriter(out, "UTF-8")); 3.130 + } 3.131 + 3.132 + public stSPARQLResultsKMLWriter(stSPARQLXMLWriter writer) { 3.133 + xmlWriter = writer; 3.134 + xmlWriter.setPrettyPrint(true); 3.135 + 3.136 + depth = 4; 3.137 + 3.138 + //gf = new GeometryFactory(new PrecisionModel(), 4326); 3.139 + jts = JTSWrapper.getInstance(); 3.140 + 3.141 + baos = new ByteArrayOutputStream(); 3.142 + 3.143 + descHeader = new StringBuilder(); 3.144 + descData = new StringBuilder(); 3.145 + 3.146 + nresults = 0; 3.147 + ngeometries = 0; 3.148 + } 3.149 + 3.150 + @Override 3.151 + public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException { 3.152 + try { 3.153 + xmlWriter.startDocument(); 3.154 + 3.155 + xmlWriter.setAttribute("xmlns", NAMESPACE); 3.156 + xmlWriter.startTag(ROOT_TAG); 3.157 + xmlWriter.startTag(RESULT_SET_TAG); 3.158 + } 3.159 + catch (IOException e) { 3.160 + throw new TupleQueryResultHandlerException(e); 3.161 + } 3.162 + } 3.163 + 3.164 + @Override 3.165 + public void endQueryResult() throws TupleQueryResultHandlerException { 3.166 + try { 3.167 + xmlWriter.endTag(RESULT_SET_TAG); 3.168 + xmlWriter.endTag(ROOT_TAG); 3.169 + 3.170 + xmlWriter.endDocument(); 3.171 + 3.172 + baos.close(); 3.173 + } 3.174 + catch (IOException e) { 3.175 + throw new TupleQueryResultHandlerException(e); 3.176 + } 3.177 + } 3.178 + 3.179 + @Override 3.180 + public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException { 3.181 + try { 3.182 + boolean hasDesc = false; 3.183 + 3.184 + // create description table and header 3.185 + indent(descHeader, depth); 3.186 + descHeader.append(TABLE_DESC_BEGIN); 3.187 + indent(descHeader, depth); 3.188 + descHeader.append(TABLE_ROW_BEGIN); 3.189 + 3.190 + // create description table data row 3.191 + descData.append(NEWLINE); 3.192 + indent(descData, depth); 3.193 + descData.append(TABLE_ROW_BEGIN); 3.194 + 3.195 + // write placemark tag 3.196 + xmlWriter.startTag(PLACEMARK_TAG); 3.197 + xmlWriter.textElement(NAME_TAG, GEOMETRY_NAME + nresults + "_" + ngeometries); 3.198 + 3.199 + // parse binding set 3.200 + for (Binding binding : bindingSet) { 3.201 + Value value = binding.getValue(); 3.202 + if (value instanceof Literal) { 3.203 + Literal litValue = (Literal) value; 3.204 + 3.205 + // it's a spatial literal 3.206 + if (litValue.getDatatype().stringValue().equals(StrabonPolyhedron.ogcGeometry)) { 3.207 + // TODO Check for GML (when added to StrabonPolyhedron) 3.208 + ngeometries++; 3.209 + 3.210 + if (logger.isDebugEnabled()) { 3.211 + logger.debug("[Strabon] Found geometry: {}", litValue); 3.212 + } 3.213 + 3.214 + xmlWriter.unescapedText(getKML(value)); 3.215 + 3.216 + } else { // Literal other than geometry 3.217 + if (logger.isDebugEnabled()) { 3.218 + logger.debug("[Strabon.KMLWriter] Found Literal: {}", value); 3.219 + } 3.220 + 3.221 + // mark that we found sth corresponding to the description 3.222 + hasDesc = true; 3.223 + 3.224 + // write description 3.225 + writeDesc(binding); 3.226 + } 3.227 + 3.228 + } else { // URI or BlankNode 3.229 + if (logger.isDebugEnabled()) { 3.230 + logger.debug("[Strabon.KMLWriter] Found URI/BlankNode: {}", value); 3.231 + } 3.232 + 3.233 + // mark that we found sth corresponding to the description 3.234 + hasDesc = true; 3.235 + 3.236 + // write description 3.237 + writeDesc(binding); 3.238 + } 3.239 + } 3.240 + 3.241 + // we have found and constructed a description for this result. Write it down. 3.242 + if (hasDesc) { 3.243 + // close the header of the description 3.244 + descHeader.append(NEWLINE); 3.245 + indent(descHeader, depth); 3.246 + descHeader.append(TABLE_ROW_END); 3.247 + 3.248 + // end the placeholder for the description data 3.249 + descData.append(NEWLINE); 3.250 + indent(descData, depth); 3.251 + descData.append(TABLE_ROW_END); 3.252 + 3.253 + // append to the table header the actual content from 3.254 + // the bindings 3.255 + descHeader.append(descData); 3.256 + 3.257 + // close the table for the description 3.258 + descHeader.append(NEWLINE); 3.259 + indent(descHeader, depth); 3.260 + descHeader.append(TABLE_DESC_END); 3.261 + 3.262 + // begin the "description" tag 3.263 + xmlWriter.startTag(DESC_TAG); 3.264 + 3.265 + // write the actual description 3.266 + xmlWriter.unescapedText(descHeader.toString()); 3.267 + 3.268 + // end the "description" tag 3.269 + xmlWriter.endTag(DESC_TAG); 3.270 + } 3.271 + 3.272 + // clear description string builders 3.273 + descHeader.setLength(0); 3.274 + descData.setLength(0); 3.275 + 3.276 + // write the placemark 3.277 + xmlWriter.endTag(PLACEMARK_TAG); 3.278 + 3.279 + // increase result size 3.280 + nresults++; 3.281 + } 3.282 + catch (IOException e) { 3.283 + throw new TupleQueryResultHandlerException(e); 3.284 + } 3.285 + } 3.286 + 3.287 + private String getKML(Value value) { 3.288 + String kml = ""; 3.289 + QName geometryType = null; 3.290 + Geometry geom = null; 3.291 + 3.292 + // get the KML encoder 3.293 + Encoder encoder = null; 3.294 + 3.295 + try { 3.296 + encoder = new Encoder(new KMLConfiguration()); 3.297 + encoder.setIndenting(true); 3.298 + geom = jts.WKTread(WKTHelper.getWithoutSRID(value.stringValue())); 3.299 + //geom = new WKTReader(gf).read(value.stringValue()); 3.300 + 3.301 + // transform the geometry to 4326 3.302 + geom = jts.transform(geom, WKTHelper.getSRID(value.stringValue()), StrabonPolyhedron.defaultSRID); 3.303 + 3.304 + if (geom instanceof Point) { 3.305 + geometryType = KML.Point; 3.306 + 3.307 + } else if (geom instanceof Polygon) { 3.308 + geometryType = KML.Polygon; 3.309 + 3.310 + } else if (geom instanceof LineString) { 3.311 + geometryType = KML.LineString; 3.312 + 3.313 + } else if (geom instanceof MultiPoint) { 3.314 + geometryType = KML.MultiGeometry; 3.315 + 3.316 + } else if (geom instanceof MultiLineString) { 3.317 + geometryType = KML.MultiGeometry; 3.318 + 3.319 + } else if (geom instanceof MultiPolygon) { 3.320 + geometryType = KML.MultiGeometry; 3.321 + 3.322 + } else if (geom instanceof GeometryCollection) { 3.323 + geometryType = KML.MultiGeometry; 3.324 + 3.325 + } 3.326 + 3.327 + if (geometryType == null) { 3.328 + logger.warn("[Strabon.KMLWriter] Found unknown geometry type."); 3.329 + 3.330 + } else { 3.331 + 3.332 + encoder.encode(geom, geometryType, baos); 3.333 + kml = baos.toString().substring(38).replaceAll(" xmlns:kml=\"http://earth.google.com/kml/2.1\"","").replaceAll("kml:",""); 3.334 + baos.reset(); 3.335 + } 3.336 + 3.337 + } catch (ParseException e) { 3.338 + logger.error("[Strabon.KMLWriter] Parse error exception of geometry: {}", e.getMessage()); 3.339 + 3.340 + } catch (IOException e) { 3.341 + logger.error("[Strabon.KMLWriter] IOException during KML encoding of geometry: {}", e.getMessage()); 3.342 + } 3.343 + 3.344 + return kml; 3.345 + } 3.346 + 3.347 + /** 3.348 + * Adds to the description table information for a binding. 3.349 + * 3.350 + * @param binding 3.351 + */ 3.352 + private void writeDesc(Binding binding) { 3.353 + descHeader.append(NEWLINE); 3.354 + indent(descHeader, depth + 1); 3.355 + descHeader.append(TABLE_DATA_BEGIN); 3.356 + descHeader.append(binding.getName()); 3.357 + descHeader.append(TABLE_DATA_END); 3.358 + 3.359 + descData.append(NEWLINE); 3.360 + indent(descData, depth + 1); 3.361 + descData.append(TABLE_DATA_BEGIN); 3.362 + descData.append(binding.getValue().stringValue()); 3.363 + descData.append(TABLE_DATA_END); 3.364 + 3.365 + } 3.366 + 3.367 + @Override 3.368 + public TupleQueryResultFormat getTupleQueryResultFormat() { 3.369 + return TupleQueryResultFormat.SPARQL; 3.370 + } 3.371 + 3.372 + /** 3.373 + * Adds indentation to the given string builder according to 3.374 + * the specified depth. 3.375 + * 3.376 + * @param sb 3.377 + * @param depth 3.378 + */ 3.379 + private void indent(StringBuilder sb, int depth) { 3.380 + for (int i = 0; i < depth; i++) { 3.381 + sb.append(xmlWriter.getIndentString()); 3.382 + } 3.383 + } 3.384 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLXMLWriter.java Thu Jun 21 23:58:16 2012 +0300 4.3 @@ -0,0 +1,46 @@ 4.4 +package org.openrdf.query.resultio.sparqlxml; 4.5 + 4.6 +import java.io.IOException; 4.7 +import java.io.OutputStream; 4.8 +import java.io.UnsupportedEncodingException; 4.9 +import java.io.Writer; 4.10 + 4.11 +import info.aduna.xml.XMLWriter; 4.12 + 4.13 +/** 4.14 + * @author charnik 4.15 + * 4.16 + */ 4.17 +public class stSPARQLXMLWriter extends XMLWriter { 4.18 + 4.19 + /** 4.20 + * @param writer 4.21 + */ 4.22 + public stSPARQLXMLWriter(Writer writer) { 4.23 + super(writer); 4.24 + } 4.25 + 4.26 + /** 4.27 + * @param outputStream 4.28 + */ 4.29 + public stSPARQLXMLWriter(OutputStream outputStream) { 4.30 + super(outputStream); 4.31 + } 4.32 + 4.33 + /** 4.34 + * @param outputStream 4.35 + * @param charEncoding 4.36 + * @throws UnsupportedEncodingException 4.37 + */ 4.38 + public stSPARQLXMLWriter(OutputStream outputStream, String charEncoding) throws UnsupportedEncodingException { 4.39 + super(outputStream, charEncoding); 4.40 + } 4.41 + 4.42 + /** 4.43 + * Like XMLWriter.text(String text) but without escaping the string. 4.44 + */ 4.45 + public void unescapedText(String text) throws IOException { 4.46 + _write(text); 4.47 + } 4.48 + 4.49 +}
5.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Thu Jun 21 23:40:18 2012 +0300 5.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Thu Jun 21 23:58:16 2012 +0300 5.3 @@ -436,18 +436,17 @@ 5.4 System.out.println(retStream.toString()); 5.5 5.6 } 5.7 - else if ( resultsFormat.equalsIgnoreCase("KML") || resultsFormat.equalsIgnoreCase("KMZ")) { 5.8 + else if (resultsFormat.equalsIgnoreCase("KML")) { 5.9 if (logger.isDebugEnabled()) { 5.10 - logger.debug("Serializing results (KML/KMZ)"); 5.11 + logger.debug("Serializing results (KML)"); 5.12 } 5.13 + 5.14 tupleQuery.evaluate(new stSPARQLResultsKMLWriter(retStream)); 5.15 - if (true) { 5.16 - System.out.println(retStream); 5.17 - return retStream.toString(); 5.18 - } 5.19 + System.out.println(retStream.toString()); 5.20 5.21 + } else if (resultsFormat.equalsIgnoreCase("KMZ")) { 5.22 //GeometryFactory gf = JTSFactoryFinder.getGeometryFactory(null); 5.23 - GeometryFactory gf = new GeometryFactory(new PrecisionModel(),4326); 5.24 + GeometryFactory gf = new GeometryFactory(new PrecisionModel(), 4326); 5.25 WKTReader reader = new WKTReader(gf); 5.26 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 5.27 5.28 @@ -462,9 +461,6 @@ 5.29 } catch (QueryEvaluationException e1) { 5.30 logger.error("[Strabon.query] Error in query evaluation.", e1); 5.31 } 5.32 - //System.out.println("-------------------------------------------"); 5.33 - //System.out.println("- RESULTS -"); 5.34 - //System.out.println("-------------------------------------------"); 5.35 5.36 int resultCounter = 0; 5.37 try { 5.38 @@ -617,32 +613,6 @@ 5.39 sb.insert(0,"<?xml version=\"1.0\" encoding=\"UTF-8\"?> <kml xmlns=\"http://www.opengis.net/kml/2.2\"> <Folder>"); 5.40 sb.append("</Folder></kml>"); 5.41 5.42 - //System.out.println(sb.toString()); 5.43 - //System.out.println(baos.toString()); 5.44 - 5.45 - // StringBuilder sb = new StringBuilder(); 5.46 - // sb.append(baos.toString().replaceAll("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>","")); 5.47 - // sb.insert(0, "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <kml xmlns=\"http://www.opengis.net/kml/2.2\">" + 5.48 - // "<kml:Placemark xmlns:kml=\"http://www.opengis.net/kml/2.2\">"); 5.49 - // sb.append("</kml:Placemark></kml>"); 5.50 - 5.51 - 5.52 - //System.out.println("*******************************"); 5.53 - //sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 5.54 - //System.out.println(sb.toString()); 5.55 - 5.56 - //System.out.println(sb.toString()); 5.57 - 5.58 - //XXX Probably not needed after all 5.59 - // DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 5.60 - // DocumentBuilder builder = factory.newDocumentBuilder(); 5.61 - // StringReader sr = new StringReader(sb.toString()); 5.62 - // Document document = builder.parse(new InputSource(sr)); 5.63 - 5.64 - 5.65 - //System.out.println("-------------------------------------------"); 5.66 - System.out.flush(); 5.67 - 5.68 try { 5.69 //String cstr = new String("aa", "UTF8"); 5.70 // ggarbis: For too large strings (e.g., 44MB) it returns empty string. 5.71 @@ -657,11 +627,7 @@ 5.72 else //KMZ 5.73 { 5.74 //compress 5.75 - //File zfile = new File("/tmp/deleteme.kmz"); 5.76 - //retStream.reset(); 5.77 - //FileOutputStream fos = new FileOutputStream(zfile); 5.78 ZipOutputStream kmzout = new ZipOutputStream(retStream); 5.79 - //ZipOutputStream kmzout = new ZipOutputStream(fos); 5.80 ZipEntry entry = new ZipEntry("doc.kml"); 5.81 5.82 //kmzout.setLevel(6); 5.83 @@ -671,47 +637,6 @@ 5.84 kmzout.closeEntry(); 5.85 kmzout.close(); 5.86 5.87 - //String kmzString = FileUtils.readFileToString(zfile); 5.88 - //writeOut.write(kmzString); 5.89 - /* 5.90 - try { 5.91 - File file = new File("/tmp/tmp.kml"); 5.92 - String filename = "/tmp/tmp.kml"; 5.93 - FileUtils.writeStringToFile(file, newString); 5.94 - 5.95 - File zfile = new File("/tmp/tmp.kmz"); 5.96 - String zipfilename = "/tmp/tmp.kmz"; 5.97 - 5.98 - byte[] buf = new byte[1024]; 5.99 - FileInputStream fis = new FileInputStream(filename); 5.100 - fis.read(buf,0,buf.length); 5.101 - 5.102 - CRC32 crc = new CRC32(); 5.103 - ZipOutputStream s = new ZipOutputStream( 5.104 - (OutputStream)new FileOutputStream(zipfilename)); 5.105 - 5.106 - //s.setLevel(6); 5.107 - 5.108 - ZipEntry entry = new ZipEntry(filename); 5.109 - entry.setSize((long)buf.length); 5.110 - crc.reset(); 5.111 - crc.update(buf); 5.112 - entry.setCrc( crc.getValue()); 5.113 - s.putNextEntry(entry); 5.114 - s.write(buf, 0, buf.length); 5.115 - s.finish(); 5.116 - s.close(); 5.117 - 5.118 - String kmzString = FileUtils.readFileToString(zfile); 5.119 - writeOut.write(kmzString); 5.120 - 5.121 - //FileUtils.forceDelete(file); 5.122 - //FileUtils.forceDelete(zfile); 5.123 - 5.124 - } catch (Exception e) { 5.125 - e.printStackTrace(); 5.126 - } 5.127 - */ 5.128 } 5.129 5.130 } catch (IOException e) {
6.1 --- a/runtime/src/main/resources/log4j.properties Thu Jun 21 23:40:18 2012 +0300 6.2 +++ b/runtime/src/main/resources/log4j.properties Thu Jun 21 23:58:16 2012 +0300 6.3 @@ -16,7 +16,6 @@ 6.4 # Set the logger level of File Appender to WARN 6.5 #log4j.appender.FA.Threshold = WARN 6.6 6.7 - 6.8 # Sesame configuration (debug only Strabon) 6.9 log4j.logger.org.openrdf.query.parser.QueryParserRegistry=INFO 6.10 log4j.logger.org.openrdf.sail.generaldb.managers.TripleTableManager=INFO