diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCache.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCache.java index 3d4d29b8bd..819c43b3af 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCache.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCache.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -56,8 +55,8 @@ public abstract class ArcGISCompactCache { * @param zoom Zoom levl * @param row Row * @param col Column - * @return String containing complete path without file extension in the form of - * .../Lzz/RrrrrCcccc with the number of c and r at least 4. + * @return String containing complete path without file extension in the form of .../Lzz/RrrrrCcccc with the number + * of c and r at least 4. */ protected String buildBundleFilePath(int zoom, int row, int col) { StringBuilder bundlePath = new StringBuilder(pathToCacheRoot); @@ -96,9 +95,8 @@ protected String buildBundleFilePath(int zoom, int row, int col) { * @param filePath Path to file * @param offset Read at offset * @param length Read length bytes - * @return ByteBuffer that contains read bytes and has byte order set to little endian. The - * length of the byte buffer is multiple of 4, so getInt() and getLong() can be used even - * when fewer bytes are read. + * @return ByteBuffer that contains read bytes and has byte order set to little endian. The length of the byte + * buffer is multiple of 4, so getInt() and getLong() can be used even when fewer bytes are read. */ protected ByteBuffer readFromLittleEndianFile(String filePath, long offset, int length) { ByteBuffer result = null; diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV1.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV1.java index 96836bedbe..63a17fbb28 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV1.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV1.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -21,13 +20,12 @@ /** * Implementation of ArcGIS compact caches for ArcGIS 10.0 - 10.2 * - *

The compact cache consists of bundle index files (*.bundlx) and bundle files (*.bundle), that - * contain the actual image data. Every .bundlx file contains a 16 byte header and 16 byte footer. - * Between header and footer is 128x128 matrix (16384 tiles) of 5 byte offsets. Every offset points - * to a 4 byte word in the corresponding .bundle file which contains the size of the tile image - * data. The actual image data starts at offset+4. If the size is zero there is no image data - * available and the index entry is not used. If the map cache has more than 128 rows or columns it - * is divided into several .bundlx and .bundle files. + *

The compact cache consists of bundle index files (*.bundlx) and bundle files (*.bundle), that contain the actual + * image data. Every .bundlx file contains a 16 byte header and 16 byte footer. Between header and footer is 128x128 + * matrix (16384 tiles) of 5 byte offsets. Every offset points to a 4 byte word in the corresponding .bundle file which + * contains the size of the tile image data. The actual image data starts at offset+4. If the size is zero there is no + * image data available and the index entry is not used. If the map cache has more than 128 rows or columns it is + * divided into several .bundlx and .bundle files. * * @author Bjoern Saxe */ @@ -39,12 +37,11 @@ public class ArcGISCompactCacheV1 extends ArcGISCompactCache { /** * Constructs new ArcGIS 10.0-10.2 compact cache. * - * @param pathToCacheRoot Path to compact cache directory (usually ".../_alllayers/"). Path must - * contain directories for zoom levels (named "Lxx"). + * @param pathToCacheRoot Path to compact cache directory (usually ".../_alllayers/"). Path must contain directories + * for zoom levels (named "Lxx"). */ public ArcGISCompactCacheV1(String pathToCacheRoot) { - if (pathToCacheRoot.endsWith("" + File.separatorChar)) - this.pathToCacheRoot = pathToCacheRoot; + if (pathToCacheRoot.endsWith("" + File.separatorChar)) this.pathToCacheRoot = pathToCacheRoot; else this.pathToCacheRoot = pathToCacheRoot + File.separatorChar; indexCache = new BundlxCache(10000); @@ -60,16 +57,14 @@ public Resource getBundleFileResource(int zoom, int row, int col) { Resource res = null; if ((entry = indexCache.get(key)) != null) { - if (entry.size > 0) - res = new BundleFileResource(entry.pathToBundleFile, entry.offset, entry.size); + if (entry.size > 0) res = new BundleFileResource(entry.pathToBundleFile, entry.offset, entry.size); } else { String basePath = buildBundleFilePath(zoom, row, col); String pathToBundlxFile = basePath + BUNDLX_EXT; String pathToBundleFile = basePath + BUNDLE_EXT; - if (!(new File(pathToBundleFile)).exists() || !(new File(pathToBundlxFile)).exists()) - return null; + if (!(new File(pathToBundleFile)).exists() || !(new File(pathToBundlxFile)).exists()) return null; long tileOffset = readTileStartOffset(pathToBundlxFile, row, col); int tileSize = readTileSize(pathToBundleFile, tileOffset); @@ -89,8 +84,7 @@ public Resource getBundleFileResource(int zoom, int row, int col) { private long readTileStartOffset(String bundlxFile, int row, int col) { int index = BUNDLX_MAXIDX * (col % BUNDLX_MAXIDX) + (row % BUNDLX_MAXIDX); - ByteBuffer idxBytes = - readFromLittleEndianFile(bundlxFile, (index * 5) + COMPACT_CACHE_HEADER_LENGTH, 5); + ByteBuffer idxBytes = readFromLittleEndianFile(bundlxFile, (index * 5) + COMPACT_CACHE_HEADER_LENGTH, 5); return idxBytes.getLong(); } diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV2.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV2.java index afaa438305..f8bdae82cf 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV2.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheV2.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -22,14 +21,12 @@ /** * Implementation of ArcGIS compact caches for ArcGIS 10.3 * - *

The compact cache consists of bundle files (*.bundle), that contain an index and the actual - * image data. Every .bundle file starts with a 64 byte header. After the header 128x128 matrix - * (16384 tiles) of 8 byte words. The first 5 bytes of every word is the offset that points to the - * tile image data inside the same .bundle file. The next 3 bytes is the size of the image data. The - * size of the image data is repeated at offset-4 in 4 byte word. Unused index entries use - * 04|00|00|00|00|00|00|00. If the size is zero than there is no image data available and the index - * entry is. If the map cache has more than 128 rows or columns it is divided into several .bundle - * files. + *

The compact cache consists of bundle files (*.bundle), that contain an index and the actual image data. Every + * .bundle file starts with a 64 byte header. After the header 128x128 matrix (16384 tiles) of 8 byte words. The first 5 + * bytes of every word is the offset that points to the tile image data inside the same .bundle file. The next 3 bytes + * is the size of the image data. The size of the image data is repeated at offset-4 in 4 byte word. Unused index + * entries use 04|00|00|00|00|00|00|00. If the size is zero than there is no image data available and the index entry + * is. If the map cache has more than 128 rows or columns it is divided into several .bundle files. * * @author Bjoern Saxe */ @@ -41,12 +38,11 @@ public class ArcGISCompactCacheV2 extends ArcGISCompactCache { /** * Constructs new ArcGIS 10.3 compact cache. * - * @param pathToCacheRoot Path to compact cache directory (usually ".../_alllayers/"). Path must - * contain directories for zoom levels (named "Lxx"). + * @param pathToCacheRoot Path to compact cache directory (usually ".../_alllayers/"). Path must contain directories + * for zoom levels (named "Lxx"). */ public ArcGISCompactCacheV2(String pathToCacheRoot) { - if (pathToCacheRoot.endsWith("" + File.separatorChar)) - this.pathToCacheRoot = pathToCacheRoot; + if (pathToCacheRoot.endsWith("" + File.separatorChar)) this.pathToCacheRoot = pathToCacheRoot; else this.pathToCacheRoot = pathToCacheRoot + File.separatorChar; indexCache = new BundlxCache(10000); @@ -62,8 +58,7 @@ public Resource getBundleFileResource(int zoom, int row, int col) { Resource res = null; if ((entry = indexCache.get(key)) != null) { - if (entry.size > 0) - res = new BundleFileResource(entry.pathToBundleFile, entry.offset, entry.size); + if (entry.size > 0) res = new BundleFileResource(entry.pathToBundleFile, entry.offset, entry.size); } else { String basePath = buildBundleFilePath(zoom, row, col); @@ -73,8 +68,7 @@ public Resource getBundleFileResource(int zoom, int row, int col) { entry = createCacheEntry(pathToBundleFile, row, col); - if (entry.size > 0) - res = new BundleFileResource(pathToBundleFile, entry.offset, entry.size); + if (entry.size > 0) res = new BundleFileResource(pathToBundleFile, entry.offset, entry.size); indexCache.put(key, entry); } @@ -87,8 +81,7 @@ private BundlxCache.CacheEntry createCacheEntry(String bundleFile, int row, int int index = BUNDLX_MAXIDX * (row % BUNDLX_MAXIDX) + (col % BUNDLX_MAXIDX); // to save one addtional read, we read all 8 bytes in one read - ByteBuffer offsetAndSize = - readFromLittleEndianFile(bundleFile, (index * 8) + COMPACT_CACHE_HEADER_LENGTH, 8); + ByteBuffer offsetAndSize = readFromLittleEndianFile(bundleFile, (index * 8) + COMPACT_CACHE_HEADER_LENGTH, 8); byte[] offsetBytes = new byte[8]; byte[] sizeBytes = new byte[4]; @@ -96,7 +89,8 @@ private BundlxCache.CacheEntry createCacheEntry(String bundleFile, int row, int offsetAndSize.get(offsetBytes, 0, 5); offsetAndSize.get(sizeBytes, 0, 3); - long tileOffset = ByteBuffer.wrap(offsetBytes).order(ByteOrder.LITTLE_ENDIAN).getLong(); + long tileOffset = + ByteBuffer.wrap(offsetBytes).order(ByteOrder.LITTLE_ENDIAN).getLong(); int tileSize = ByteBuffer.wrap(sizeBytes).order(ByteOrder.LITTLE_ENDIAN).getInt(); return new BundlxCache.CacheEntry(bundleFile, tileOffset, tileSize); diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundleFileResource.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundleFileResource.java index d61391e9da..8cd34bdfa5 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundleFileResource.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundleFileResource.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -57,7 +56,8 @@ public long transferTo(WritableByteChannel target) throws IOException { FileChannel in = fin.getChannel()) { final long size = tileSize; long written = 0; - while ((written += in.transferTo(tileOffset + written, size, target)) < size) ; + while ((written += in.transferTo(tileOffset + written, size, target)) < size) + ; return size; } } diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundlxCache.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundlxCache.java index ff71e4281e..909beb6662 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundlxCache.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/compact/BundlxCache.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -20,8 +19,8 @@ /** * Cache that stores data from .bundlx files. * - *

Zoom, row, and column of the tile are used as key. Entries contain the path to the .bundle - * file, the size of the tile and the offset of the image data inside the .bundle file. + *

Zoom, row, and column of the tile are used as key. Entries contain the path to the .bundle file, the size of the + * tile and the offset of the image data inside the .bundle file. * * @author Bjoern Saxe */ @@ -79,8 +78,8 @@ public CacheEntry(String pathToBundleFile, long offset, int size) { /** * Cache that stores the path ot the . * - * @param maxSize Maximum size of cache. If the size of the cache equals maxSize, adding a new - * entry will remove the least recently used entry from the cache. + * @param maxSize Maximum size of cache. If the size of the cache equals maxSize, adding a new entry will remove the + * least recently used entry from the cache. */ public BundlxCache(int maxSize) { indexCache = CacheBuilder.newBuilder().maximumSize(maxSize).build(); @@ -90,8 +89,7 @@ public BundlxCache(int maxSize) { * Get the entry for a key from the cache. * * @param key Key. - * @return Returns the entry. Returns null if the key has a null value or if the key has no - * entry. + * @return Returns the entry. Returns null if the key has a null value or if the key has no entry. */ public synchronized CacheEntry get(CacheKey key) { return indexCache.getIfPresent(key); diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfo.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfo.java index 1901a60da9..bfe9ec921a 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfo.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfoPersister.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfoPersister.java index ebf1151e84..360f162f0c 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfoPersister.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheInfoPersister.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -86,8 +85,7 @@ public BoundingBox parseLayerBounds(final Reader layerBoundsFile) { EnvelopeN envN = (EnvelopeN) getConfiguredXStream().fromXML(layerBoundsFile); - BoundingBox bbox = - new BoundingBox(envN.getXmin(), envN.getYmin(), envN.getXmax(), envN.getYmax()); + BoundingBox bbox = new BoundingBox(envN.getXmin(), envN.getYmin(), envN.getXmax(), envN.getYmax()); return bbox; } diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheStorageInfo.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheStorageInfo.java index bc3c967d18..34f76b9df9 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheStorageInfo.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/CacheStorageInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -17,9 +16,8 @@ /** * Represents a {@code CacheStorageInfo} element in an ArcGIS tile cache config file. * - *

This element exists from ArcGIS 10.0 onwards, and defines whether the cache is in "exploded" - * or "compact" format. As the "compact" format is not documented by ESRI, we only support the - * "exploded" format. + *

This element exists from ArcGIS 10.0 onwards, and defines whether the cache is in "exploded" or "compact" format. + * As the "compact" format is not documented by ESRI, we only support the "exploded" format. * *

XML representation: * @@ -51,10 +49,7 @@ private Object readResolve() { return this; } - /** - * The storage format defined in the config file, defaults to {@link #EXPLODED_FORMAT_CODE - * exploded format} - */ + /** The storage format defined in the config file, defaults to {@link #EXPLODED_FORMAT_CODE exploded format} */ public String getStorageFormat() { return storageFormat; } diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/EnvelopeN.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/EnvelopeN.java index 8157a85478..07c609c862 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/EnvelopeN.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/EnvelopeN.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/LODInfo.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/LODInfo.java index 74730181b4..f19cf84727 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/LODInfo.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/LODInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/SpatialReference.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/SpatialReference.java index cc7883f464..772318211e 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/SpatialReference.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/SpatialReference.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileCacheInfo.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileCacheInfo.java index 175dd46d02..97acfd95e6 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileCacheInfo.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileCacheInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileImageInfo.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileImageInfo.java index 65e659f17e..a151f52960 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileImageInfo.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileImageInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileOrigin.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileOrigin.java index 0d602bf632..0a376fabc7 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileOrigin.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/config/TileOrigin.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -17,10 +16,9 @@ /** * Represents a {@code TileOrigin} element in an ArcGIS cache config file. * - *

The upper left point on the tiling grid. The tiling origin is usually not the point where - * tiles begin to be created; that only happens in the full extent of the map. Usually the tiling - * origin is far outside the map to ensure that the map area will be covered and that other caches - * with the same tiling origin can overlay your cache. + *

The upper left point on the tiling grid. The tiling origin is usually not the point where tiles begin to be + * created; that only happens in the full extent of the map. Usually the tiling origin is far outside the map to ensure + * that the map area will be covered and that other caches with the same tiling origin can overlay your cache. * *

XML Structure: * diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheGridsetConfiguration.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheGridsetConfiguration.java index 78bf00c8a9..4297494b12 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheGridsetConfiguration.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheGridsetConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheLayer.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheLayer.java index 1caeb04b55..c518ddb3e0 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheLayer.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISCacheLayer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -72,15 +71,13 @@ public class ArcGISCacheLayer extends AbstractTileLayer { private File tilingScheme; /** - * Optional, location of the actual tiles folder. If not provided defaults to the {@code - * _alllayers} directory at the same location than the {@link #getTilingScheme() conf.xml} - * tiling scheme. + * Optional, location of the actual tiles folder. If not provided defaults to the {@code _alllayers} directory at + * the same location than the {@link #getTilingScheme() conf.xml} tiling scheme. */ private File tileCachePath; /** - * Optional, configure whether or not the z-values should be hex-encoded or not. If not provided - * defaults to false + * Optional, configure whether or not the z-values should be hex-encoded or not. If not provided defaults to false */ private Boolean hexZoom; @@ -122,18 +119,17 @@ public void setTilingScheme(final File tilingScheme) { } /** - * Returns the location of the actual tiles folder, or {@code null} if not provided, in which - * case defaults internally to the {@code _alllayers} directory at the same location than the - * {@link #getTilingScheme() conf.xml} tiling scheme. + * Returns the location of the actual tiles folder, or {@code null} if not provided, in which case defaults + * internally to the {@code _alllayers} directory at the same location than the {@link #getTilingScheme() conf.xml} + * tiling scheme. */ public File getTileCachePath() { return tileCachePath; } /** - * Options, location of the actual tiles folder. If not provided defaults to the {@code - * _alllayers} directory at the same location than the {@link #getTilingScheme() conf.xml} - * tiling scheme. + * Options, location of the actual tiles folder. If not provided defaults to the {@code _alllayers} directory at the + * same location than the {@link #getTilingScheme() conf.xml} tiling scheme. */ public void setTileCachePath(File tileCachePath) { this.tileCachePath = tileCachePath; @@ -148,8 +144,7 @@ public void setHexZoom(boolean hexZoom) { } /** - * @return {@code true} if success. Note this method's return type should be void. It's not - * checked anywhere + * @return {@code true} if success. Note this method's return type should be void. It's not checked anywhere * @see org.geowebcache.layer.TileLayer#initialize(org.geowebcache.grid.GridSetBroker) */ @Override @@ -158,20 +153,16 @@ protected boolean initializeInternal(GridSetBroker gridSetBroker) { this.enabled = true; } if (this.tilingScheme == null) { - throw new IllegalStateException( - "tilingScheme has not been set. It should point to the ArcGIS " - + "cache tiling scheme file for this layer (conf.xml)"); + throw new IllegalStateException("tilingScheme has not been set. It should point to the ArcGIS " + + "cache tiling scheme file for this layer (conf.xml)"); } if (tileCachePath != null) { - if (!tileCachePath.exists() - || !tileCachePath.isDirectory() - || !tileCachePath.canRead()) { - throw new IllegalStateException( - "tileCachePath property for layer '" - + getName() - + "' is set to '" - + tileCachePath - + "' but the directory either does not exist or is not readable"); + if (!tileCachePath.exists() || !tileCachePath.isDirectory() || !tileCachePath.canRead()) { + throw new IllegalStateException("tileCachePath property for layer '" + + getName() + + "' is set to '" + + tileCachePath + + "' but the directory either does not exist or is not readable"); } } if (this.hexZoom == null) { @@ -182,8 +173,7 @@ protected boolean initializeInternal(GridSetBroker gridSetBroker) { cacheInfo = tilingSchemeLoader.load(new FileReader(tilingScheme)); File layerBoundsFile = new File(tilingScheme.getParentFile(), "conf.cdi"); if (!layerBoundsFile.exists()) { - throw new RuntimeException( - "Layer bounds file not found: " + layerBoundsFile.getAbsolutePath()); + throw new RuntimeException("Layer bounds file not found: " + layerBoundsFile.getAbsolutePath()); } log.info("Parsing layer bounds for " + getName()); this.layerBounds = tilingSchemeLoader.parseLayerBounds(new FileReader(layerBoundsFile)); @@ -204,14 +194,12 @@ protected boolean initializeInternal(GridSetBroker gridSetBroker) { } } } catch (FileNotFoundException e) { - throw new IllegalStateException( - "Tiling scheme file not found: " + tilingScheme.getAbsolutePath()); + throw new IllegalStateException("Tiling scheme file not found: " + tilingScheme.getAbsolutePath()); } - log.info( - "Configuring layer " - + getName() - + " out of the ArcGIS tiling scheme " - + tilingScheme.getAbsolutePath()); + log.info("Configuring layer " + + getName() + + " out of the ArcGIS tiling scheme " + + tilingScheme.getAbsolutePath()); super.subSets = createGridSubsets(gridSetBroker); super.formats = loadMimeTypes(); @@ -251,8 +239,7 @@ private HashMap createGridSubsets(final GridSetBroker gridSe Integer zoomStart = lodInfos.get(0).getLevelID(); Integer zoomStop = lodInfos.get(lodInfos.size() - 1).getLevelID(); - GridSubset subSet = - GridSubsetFactory.createGridSubSet(gridSet, this.layerBounds, zoomStart, zoomStop); + GridSubset subSet = GridSubsetFactory.createGridSubSet(gridSet, this.layerBounds, zoomStart, zoomStop); HashMap subsets = new HashMap<>(); subsets.put(gridSet.getName(), subSet); @@ -453,27 +440,19 @@ private Resource readFile(File fh) { return res; } - /** - * @see org.geowebcache.layer.TileLayer#getNoncachedTile(org.geowebcache.conveyor.ConveyorTile) - */ + /** @see org.geowebcache.layer.TileLayer#getNoncachedTile(org.geowebcache.conveyor.ConveyorTile) */ @Override public ConveyorTile getNoncachedTile(ConveyorTile tile) throws GeoWebCacheException { throw new UnsupportedOperationException(); } - /** - * @see org.geowebcache.layer.TileLayer#seedTile(org.geowebcache.conveyor.ConveyorTile, boolean) - */ + /** @see org.geowebcache.layer.TileLayer#seedTile(org.geowebcache.conveyor.ConveyorTile, boolean) */ @Override - public void seedTile(ConveyorTile tile, boolean tryCache) - throws GeoWebCacheException, IOException { + public void seedTile(ConveyorTile tile, boolean tryCache) throws GeoWebCacheException, IOException { throw new UnsupportedOperationException(); } - /** - * @see - * org.geowebcache.layer.TileLayer#doNonMetatilingRequest(org.geowebcache.conveyor.ConveyorTile) - */ + /** @see org.geowebcache.layer.TileLayer#doNonMetatilingRequest(org.geowebcache.conveyor.ConveyorTile) */ @Override public ConveyorTile doNonMetatilingRequest(ConveyorTile tile) throws GeoWebCacheException { throw new UnsupportedOperationException(); @@ -485,11 +464,7 @@ public String getStyles() { return null; } - /** - * @see - * org.geowebcache.layer.TileLayer#setExpirationHeader(javax.servlet.http.HttpServletResponse, - * int) - */ + /** @see org.geowebcache.layer.TileLayer#setExpirationHeader(javax.servlet.http.HttpServletResponse, int) */ @Override public void setExpirationHeader(HttpServletResponse response, int zoomLevel) { /* diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProvider.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProvider.java index 8d47bf3122..bf47cdf67a 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProvider.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -19,8 +18,8 @@ import org.geowebcache.config.XMLConfigurationProvider; /** - * Implementation of the {@link XMLConfigurationProvider} extension point to extend the {@code - * geowebcache.xml} configuration file with {@code arcgisLayer} layers. + * Implementation of the {@link XMLConfigurationProvider} extension point to extend the {@code geowebcache.xml} + * configuration file with {@code arcgisLayer} layers. * * @author Gabriel Roldan */ diff --git a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java index 7f3a319db0..db83c042c2 100644 --- a/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java +++ b/geowebcache/arcgiscache/src/main/java/org/geowebcache/arcgis/layer/GridSetBuilder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -34,8 +33,7 @@ class GridSetBuilder { /** Creates a {@link GridSet} out of a ArcGIS tiling scheme */ - public GridSet buildGridset( - final String layerName, final CacheInfo info, final BoundingBox layerBounds) { + public GridSet buildGridset(final String layerName, final CacheInfo info, final BoundingBox layerBounds) { Assert.notNull(layerName, "Layer name must be non null"); Assert.notNull(info, "Layer name must be non null"); @@ -106,20 +104,19 @@ public GridSet buildGridset( } String gridsetName = srs.toString() + "_" + layerName; - GridSet layerGridset = - GridSetFactory.createGridSet( - gridsetName, - srs, - gridSetExtent, - alignTopLeft, - resolutions, - scaleDenominators, - metersPerUnit, - pixelSize, - scaleNames, - tileWidth, - tileHeight, - yCoordinateFirst); + GridSet layerGridset = GridSetFactory.createGridSet( + gridsetName, + srs, + gridSetExtent, + alignTopLeft, + resolutions, + scaleDenominators, + metersPerUnit, + pixelSize, + scaleNames, + tileWidth, + tileHeight, + yCoordinateFirst); return layerGridset; } diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheTest.java index 603925fb7f..42cebc55b6 100755 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/compact/ArcGISCompactCacheTest.java @@ -13,42 +13,26 @@ * *

10.0 - 10.2 cache * - *

zoom level | min row | max row | min col | max col | | | | 5 | 10 | 13 | 4 | 10 | | | | 6 | 22 - * | 28 | 10 | 21 + *

zoom level | min row | max row | min col | max col | | | | 5 | 10 | 13 | 4 | 10 | | | | 6 | 22 | 28 | 10 | 21 * - *

- image format is JPEG - tile size for (5,12,7) is 6342 bytes - tile size for (6,25,17) is - * 6308 bytes + *

- image format is JPEG - tile size for (5,12,7) is 6342 bytes - tile size for (6,25,17) is 6308 bytes * *

10.3 cache * - *

zoom level | min row | max row | min col | max col | | | | 4 | 5 | 6 | 2 | 5 | | | | 5 | 10 | - * 13 | 4 | 10 + *

zoom level | min row | max row | min col | max col | | | | 4 | 5 | 6 | 2 | 5 | | | | 5 | 10 | 13 | 4 | 10 * - *

- image format is JPEG - tile size for (4,5,4) is 7288 bytes - tile size for (5,11,5) is 6055 - * bytes + *

- image format is JPEG - tile size for (4,5,4) is 7288 bytes - tile size for (5,11,5) is 6055 bytes * *

Not verifiable with this unit test because the supplied test cache is too small: * - *

- zoom levels can contain more than one .bundle/.bundlx file - row and column numbers have at - * least 4 digits in bundle file name, but with really big caches row and column numbers can have - * more than 4 digits + *

- zoom levels can contain more than one .bundle/.bundlx file - row and column numbers have at least 4 digits in + * bundle file name, but with really big caches row and column numbers can have more than 4 digits * * @author Bjoern Saxe */ public class ArcGISCompactCacheTest { private static final byte[] JFIFHeader = { - (byte) 0xFF, - (byte) 0xD8, - (byte) 0xFF, - (byte) 0xE0, - 0x00, - 0x10, - 0x4A, - 0x46, - 0x49, - 0x46, - 0x00, - 0x01 + (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, (byte) 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01 }; @Test diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/config/CacheInfoPersisterTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/config/CacheInfoPersisterTest.java index 171ee49101..a0b8918400 100644 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/config/CacheInfoPersisterTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/config/CacheInfoPersisterTest.java @@ -13,23 +13,22 @@ public class CacheInfoPersisterTest { @Test public void testLoadSpatialReference() { - String spatialRef = - "" // - + " PROJCS["NZGD_2000_New_Zealand_Transverse_Mercator",GEOGCS["GCS_NZGD_2000",DATUM["D_NZGD_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1600000.0],PARAMETER["False_Northing",10000000.0],PARAMETER["Central_Meridian",173.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["EPSG",2193]]" // - + " -4020900" // - + " 1900" // - + " 450445547.3910538" // - + " 0.5" // - + " 1" // - + " -100000" // - + " 10000" // - + " 0.0037383177570093459" // - + " 2" // - + " 2" // - + " true" // - + " 2193" // - + " 2193" // - + ""; + String spatialRef = "" // + + " PROJCS["NZGD_2000_New_Zealand_Transverse_Mercator",GEOGCS["GCS_NZGD_2000",DATUM["D_NZGD_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1600000.0],PARAMETER["False_Northing",10000000.0],PARAMETER["Central_Meridian",173.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["EPSG",2193]]" // + + " -4020900" // + + " 1900" // + + " 450445547.3910538" // + + " 0.5" // + + " 1" // + + " -100000" // + + " 10000" // + + " 0.0037383177570093459" // + + " 2" // + + " 2" // + + " true" // + + " 2193" // + + " 2193" // + + ""; CacheInfoPersister persister = new CacheInfoPersister(); XStream xs = persister.getConfiguredXStream(); @@ -55,11 +54,10 @@ public void testLoadSpatialReference() { @Test public void testLoadTileOrigin() { - String tileOrigin = - "" // - + " -4020900" // - + " 19998100" // - + ""; + String tileOrigin = "" // + + " -4020900" // + + " 19998100" // + + ""; CacheInfoPersister persister = new CacheInfoPersister(); XStream xs = persister.getConfiguredXStream(); TileOrigin to = (TileOrigin) xs.fromXML(new StringReader(tileOrigin)); @@ -70,23 +68,22 @@ public void testLoadTileOrigin() { @Test public void testLoadTileCacheInfo() { - String tileCacheInfo = - "" // - + " " // - + " " // - + " " // - + " -4020900" // - + " 19998100" // - + " " // - + " 512" // - + " 512" // - + " 96" // - + " 96" // - + " " // - + " " // - + " " // - + " " // - + ""; + String tileCacheInfo = "" // + + " " // + + " " // + + " " // + + " -4020900" // + + " 19998100" // + + " " // + + " 512" // + + " 512" // + + " 96" // + + " 96" // + + " " // + + " " // + + " " // + + " " // + + ""; CacheInfoPersister persister = new CacheInfoPersister(); XStream xs = persister.getConfiguredXStream(); @@ -104,12 +101,11 @@ public void testLoadTileCacheInfo() { @Test public void testLoadLODInfo() { - String lodInfo = - "" // - + " 10" // - + " 6000000" // - + " 1587.5031750063501" // - + ""; + String lodInfo = "" // + + " 10" // + + " 6000000" // + + " 1587.5031750063501" // + + ""; CacheInfoPersister persister = new CacheInfoPersister(); XStream xs = persister.getConfiguredXStream(); @@ -122,14 +118,13 @@ public void testLoadLODInfo() { @Test public void testLoadTileImageInfo() { - String tileImageInfo = - "" // - + " JPEG" // - + " 80" // - + " true" // - + " 1" // - + " 0" // - + ""; + String tileImageInfo = "" // + + " JPEG" // + + " 80" // + + " true" // + + " 1" // + + " 0" // + + ""; CacheInfoPersister persister = new CacheInfoPersister(); XStream xs = persister.getConfiguredXStream(); @@ -144,11 +139,10 @@ public void testLoadTileImageInfo() { @Test public void testLoadCacheStorageInfo() { - String cacheStorageInfo = - "" // - + " esriMapCacheStorageModeExploded" // - + " 10" // - + ""; + String cacheStorageInfo = "" // + + " esriMapCacheStorageModeExploded" // + + " 10" // + + ""; CacheInfoPersister persister = new CacheInfoPersister(); XStream xs = persister.getConfiguredXStream(); diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISCacheLayerTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISCacheLayerTest.java index 25ebd8ee4e..714335deb4 100644 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISCacheLayerTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISCacheLayerTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2022 */ @@ -31,7 +30,8 @@ import org.springframework.context.ApplicationContext; public class ArcGISCacheLayerTest { - @Rule public TemporaryFolder temp = new TemporaryFolder(); + @Rule + public TemporaryFolder temp = new TemporaryFolder(); @Test public void testArcGISCacheLayerInitialization() throws Exception { diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProviderTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProviderTest.java index eca0488fed..0e67dd86ca 100644 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProviderTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/ArcGISLayerXMLConfigurationProviderTest.java @@ -13,15 +13,12 @@ public class ArcGISLayerXMLConfigurationProviderTest { public void testGetConfiguredXStream() { final Map aliases = new HashMap<>(); - XStream xs = - new ArcGISLayerXMLConfigurationProvider() - .getConfiguredXStream( - new GeoWebCacheXStream() { - @Override - public void alias(String alias, Class c) { - aliases.put(alias, c); - } - }); + XStream xs = new ArcGISLayerXMLConfigurationProvider().getConfiguredXStream(new GeoWebCacheXStream() { + @Override + public void alias(String alias, Class c) { + aliases.put(alias, c); + } + }); Assert.assertNotNull(xs); Assert.assertEquals(ArcGISCacheLayer.class, aliases.get("arcgisLayer")); diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java index 963c67b0bf..5117e53518 100644 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -44,8 +43,7 @@ import org.hamcrest.Matchers; import org.junit.Test; -public class XMLConfigurationLayerConformanceWithArcGisLayersTest - extends XMLConfigurationLayerConformanceTest { +public class XMLConfigurationLayerConformanceWithArcGisLayersTest extends XMLConfigurationLayerConformanceTest { @Override public void setUpTestUnit() throws Exception { @@ -105,15 +103,13 @@ public ConveyorTile getNoncachedTile(ConveyorTile tile) throws GeoWebCacheExcept } @Override - public void seedTile(ConveyorTile tile, boolean tryCache) - throws GeoWebCacheException, IOException { + public void seedTile(ConveyorTile tile, boolean tryCache) throws GeoWebCacheException, IOException { // TODO Auto-generated method stub } @Override - public ConveyorTile doNonMetatilingRequest(ConveyorTile tile) - throws GeoWebCacheException { + public ConveyorTile doNonMetatilingRequest(ConveyorTile tile) throws GeoWebCacheException { // TODO Auto-generated method stub return null; } @@ -123,17 +119,12 @@ public ConveyorTile doNonMetatilingRequest(ConveyorTile tile) @Override protected Matcher infoEquals(TileLayer expected) { return new CustomMatcher<>( - "ArcGISCacheLayer matching " - + expected.getName() - + " with " - + expected.getBackendTimeout()) { + "ArcGISCacheLayer matching " + expected.getName() + " with " + expected.getBackendTimeout()) { @Override public boolean matches(Object item) { return item instanceof ArcGISCacheLayer - && ((ArcGISCacheLayer) item) - .getBackendTimeout() - .equals(expected.getBackendTimeout()); + && ((ArcGISCacheLayer) item).getBackendTimeout().equals(expected.getBackendTimeout()); } }; } @@ -166,22 +157,16 @@ protected void makeConfigFile() throws Exception { configDir = temp.getRoot(); configFile = temp.newFile("geowebcache.xml"); - URL source = - XMLConfigurationLayerConformanceWithArcGisLayersTest.class.getResource( - "geowebcache.xml"); + URL source = XMLConfigurationLayerConformanceWithArcGisLayersTest.class.getResource("geowebcache.xml"); try (Stream lines = Files.lines(Paths.get(source.toURI()))) { - List replaced = - lines.map( - line -> { - String tilingSchemePath = - resourceAsFile("/compactcache/Conf.xml") - .getAbsolutePath(); - // no need to use replaceAll and involve regex - // replacement rules - return line.replace( - "TILING_SCHEME_PATH", tilingSchemePath); - }) - .collect(Collectors.toList()); + List replaced = lines.map(line -> { + String tilingSchemePath = + resourceAsFile("/compactcache/Conf.xml").getAbsolutePath(); + // no need to use replaceAll and involve regex + // replacement rules + return line.replace("TILING_SCHEME_PATH", tilingSchemePath); + }) + .collect(Collectors.toList()); Files.write(configFile.toPath(), replaced); } } @@ -190,11 +175,8 @@ protected void makeConfigFile() throws Exception { @Override protected TileLayerConfiguration getConfig(MockWepAppContextRule extensions) throws Exception { extensions.addBean( - "ArcGISLayerConfigProvider", - new ArcGISLayerXMLConfigurationProvider(), - XMLConfigurationProvider.class); - ArcGISCacheGridsetConfiguration arcGISCacheGridsetConfiguration = - new ArcGISCacheGridsetConfiguration(); + "ArcGISLayerConfigProvider", new ArcGISLayerXMLConfigurationProvider(), XMLConfigurationProvider.class); + ArcGISCacheGridsetConfiguration arcGISCacheGridsetConfiguration = new ArcGISCacheGridsetConfiguration(); extensions.addBean( "ArcGISLayerGridSetConfiguration", arcGISCacheGridsetConfiguration, @@ -210,10 +192,7 @@ public void testGetExistingHasGridset() throws Exception { Optional retrieved = getInfo(config, getExistingInfo()); assertThat( retrieved, - isPresent( - hasProperty( - "gridSubsets", - Matchers.containsInAnyOrder("EPSG:3857_testExisting")))); + isPresent(hasProperty("gridSubsets", Matchers.containsInAnyOrder("EPSG:3857_testExisting")))); } @Test diff --git a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStore.java b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStore.java index a3a08f8ec4..14d105cbab 100644 --- a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStore.java +++ b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -69,8 +68,7 @@ public class AzureBlobStore implements BlobStore { private volatile boolean shutDown = false; - public AzureBlobStore( - AzureBlobStoreData configuration, TileLayerDispatcher layers, LockProvider lockProvider) + public AzureBlobStore(AzureBlobStoreData configuration, TileLayerDispatcher layers, LockProvider lockProvider) throws StorageException { this.client = new AzureClient(configuration); @@ -81,16 +79,13 @@ public AzureBlobStore( boolean emptyFolder = !client.prefixExists(prefix); boolean existingMetadata = client.blobExists(keyBuilder.storeMetadata()); - CompositeBlobStore.checkSuitability( - configuration.getLocation(), existingMetadata, emptyFolder); + CompositeBlobStore.checkSuitability(configuration.getLocation(), existingMetadata, emptyFolder); // Just a marker to indicate this is a GWC cache. client.putProperties(keyBuilder.storeMetadata(), new Properties()); // deletes are a complicated beast, we have a dedicated class to run them - deleteManager = - new DeleteManager( - client, lockProvider, keyBuilder, configuration.getMaxConnections()); + deleteManager = new DeleteManager(client, lockProvider, keyBuilder, configuration.getMaxConnections()); deleteManager.issuePendingBulkDeletes(); } @@ -114,24 +109,21 @@ public boolean delete(String layerName) throws StorageException { } @Override - public boolean deleteByParametersId(String layerName, String parametersId) - throws StorageException { + public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { checkNotNull(layerName, "layerName"); checkNotNull(parametersId, "parametersId"); - boolean prefixExists = - keyBuilder.forParameters(layerName, parametersId).stream() - .map( - prefix -> { - try { - return deleteManager.scheduleAsyncDelete(prefix); - } catch (StorageException e) { - throw new UncheckedIOException(e); - } - }) - .reduce(Boolean::logicalOr) // Don't use Stream.anyMatch as it would short - // circuit - .orElse(false); + boolean prefixExists = keyBuilder.forParameters(layerName, parametersId).stream() + .map(prefix -> { + try { + return deleteManager.scheduleAsyncDelete(prefix); + } catch (StorageException e) { + throw new UncheckedIOException(e); + } + }) + .reduce(Boolean::logicalOr) // Don't use Stream.anyMatch as it would short + // circuit + .orElse(false); if (prefixExists) { listeners.sendParametersDeleted(layerName, parametersId); } @@ -139,8 +131,7 @@ public boolean deleteByParametersId(String layerName, String parametersId) } @Override - public boolean deleteByGridsetId(final String layerName, final String gridSetId) - throws StorageException { + public boolean deleteByGridsetId(final String layerName, final String gridSetId) throws StorageException { checkNotNull(layerName, "layerName"); checkNotNull(gridSetId, "gridSetId"); @@ -200,33 +191,26 @@ public boolean delete(TileRange tileRange) throws StorageException { } // open an iterator oer tile locations, to avoid memory accumulation - final Iterator tileLocations = - new AbstractIterator<>() { + final Iterator tileLocations = new AbstractIterator<>() { - // TileRange iterator with 1x1 meta tiling factor - private TileRangeIterator trIter = - new TileRangeIterator(tileRange, new int[] {1, 1}); + // TileRange iterator with 1x1 meta tiling factor + private TileRangeIterator trIter = new TileRangeIterator(tileRange, new int[] {1, 1}); - @Override - protected long[] computeNext() { - long[] gridLoc = trIter.nextMetaGridLocation(new long[3]); - return gridLoc == null ? endOfData() : gridLoc; - } - }; + @Override + protected long[] computeNext() { + long[] gridLoc = trIter.nextMetaGridLocation(new long[3]); + return gridLoc == null ? endOfData() : gridLoc; + } + }; // if no listeners, we don't need to gather extra tile info, use a dedicated fast path if (listeners.isEmpty()) { // if there are no listeners, don't bother requesting every tile // metadata to notify the listeners - Iterator keysIterator = - Iterators.transform( - tileLocations, - tl -> - keyBuilder.forLocation( - coordsPrefix, tl, tileRange.getMimeType())); + Iterator keysIterator = Iterators.transform( + tileLocations, tl -> keyBuilder.forLocation(coordsPrefix, tl, tileRange.getMimeType())); // split the iteration in parts to avoid memory accumulation - Iterator> partition = - Iterators.partition(keysIterator, DeleteManager.PAGE_SIZE); + Iterator> partition = Iterators.partition(keysIterator, DeleteManager.PAGE_SIZE); while (partition.hasNext() && !shutDown) { List locations = partition.next(); @@ -242,18 +226,12 @@ protected long[] computeNext() { String format = tileRange.getMimeType().getFormat(); Map parameters = tileRange.getParameters(); - Iterator> tilesIterator = - Iterators.transform( - tileLocations, - xyz -> { - TileObject tile = - TileObject.createQueryTileObject( - layerName, xyz, gridSetId, format, parameters); - tile.setParametersId(tileRange.getParametersId()); - return (Callable) () -> delete(tile); - }); - Iterator>> partition = - Iterators.partition(tilesIterator, DeleteManager.PAGE_SIZE); + Iterator> tilesIterator = Iterators.transform(tileLocations, xyz -> { + TileObject tile = TileObject.createQueryTileObject(layerName, xyz, gridSetId, format, parameters); + tile.setParametersId(tileRange.getParametersId()); + return (Callable) () -> delete(tile); + }); + Iterator>> partition = Iterators.partition(tilesIterator, DeleteManager.PAGE_SIZE); // once a page of callables is ready, run them in parallel on the delete manager while (partition.hasNext() && !shutDown) { @@ -322,11 +300,7 @@ public void put(TileObject obj) throws StorageException { client.upload(key, data, mimeType); } catch (StorageException e) { throw new StorageException( - "Failed to upload tile to Azure on container " - + client.getContainerName() - + " and key " - + key, - e); + "Failed to upload tile to Azure on container " + client.getContainerName() + " and key " + key, e); } catch (IOException e) { throw new StorageException("Error obtaining date from TileObject " + obj); } @@ -354,8 +328,7 @@ private String getMimeType(TileObject obj) { return mimeType; } - private void putParametersMetadata( - String layerName, String parametersId, Map parameters) { + private void putParametersMetadata(String layerName, String parametersId, Map parameters) { assert (isNull(parametersId) == isNull(parameters)); if (isNull(parametersId)) { return; diff --git a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreConfigProvider.java b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreConfigProvider.java index 972d1548a0..8be31e96ac 100644 --- a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreConfigProvider.java +++ b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreConfigProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ diff --git a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreData.java b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreData.java index db30d793c2..b31d44d64f 100644 --- a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreData.java +++ b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreData.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Fernando Mino, GeoSolutions, Copyright 2019 */ @@ -18,10 +17,7 @@ import java.net.Proxy; import org.geowebcache.GeoWebCacheEnvironment; -/** - * Azure Blobstore type-resolved data from a {@link AzureBlobStoreInfo} using enviroment variables - * if enabled. - */ +/** Azure Blobstore type-resolved data from a {@link AzureBlobStoreInfo} using enviroment variables if enabled. */ public class AzureBlobStoreData { private String container; @@ -38,14 +34,11 @@ public class AzureBlobStoreData { public AzureBlobStoreData() {} - public AzureBlobStoreData( - final AzureBlobStoreInfo storeInfo, final GeoWebCacheEnvironment environment) { + public AzureBlobStoreData(final AzureBlobStoreInfo storeInfo, final GeoWebCacheEnvironment environment) { environment .resolveValueIfEnabled(storeInfo.getContainer(), String.class) .ifPresent(x -> this.container = x); - environment - .resolveValueIfEnabled(storeInfo.getPrefix(), String.class) - .ifPresent(x -> this.prefix = x); + environment.resolveValueIfEnabled(storeInfo.getPrefix(), String.class).ifPresent(x -> this.prefix = x); environment .resolveValueIfEnabled(storeInfo.getAccountName(), String.class) .ifPresent(x -> this.accountName = x); @@ -175,9 +168,7 @@ public String getLocation() { Proxy getProxy() { if (proxyHost != null) { - return new Proxy( - Proxy.Type.HTTP, - new InetSocketAddress(proxyHost, proxyPort != null ? proxyPort : 8888)); + return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort != null ? proxyPort : 8888)); } return null; } diff --git a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreInfo.java b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreInfo.java index dcbadc6b3b..43978b6369 100644 --- a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreInfo.java +++ b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureBlobStoreInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -34,9 +33,8 @@ public class AzureBlobStoreInfo extends BlobStoreInfo { private static final long serialVersionUID = -8068069256598987874L; /** - * Max number of connections used inside the Netty HTTP client. Might seem a lot, but when - * deleting we have to issue a delete on each single tile, so we need a large parallelism to - * make that feasible + * Max number of connections used inside the Netty HTTP client. Might seem a lot, but when deleting we have to issue + * a delete on each single tile, so we need a large parallelism to make that feasible */ public static final int DEFAULT_CONNECTIONS = 100; @@ -107,8 +105,7 @@ public void setServiceURL(String serviceURL) { } /** - * Returns the base prefix, which is a prefix path to use as the root to store tiles under the - * container. + * Returns the base prefix, which is a prefix path to use as the root to store tiles under the container. * * @return optional string for a "base prefix" */ @@ -131,9 +128,7 @@ public void setMaxConnections(String maxConnections) { this.maxConnections = maxConnections; } - /** - * @return whether to use HTTPS (true) or HTTP (false) when talking to Azure (defaults to true) - */ + /** @return whether to use HTTPS (true) or HTTP (false) when talking to Azure (defaults to true) */ public Boolean isUseHTTPS() { return useHTTPS; } @@ -183,8 +178,7 @@ public void setProxyPort(String proxyPort) { /** * Returns the optional proxy user name to use if connecting through a proxy. * - * @return The optional proxy user name the configured client will use if connecting through a - * proxy. + * @return The optional proxy user name the configured client will use if connecting through a proxy. */ @Nullable public String getProxyUsername() { @@ -220,18 +214,13 @@ public void setProxyPassword(String proxyPassword) { } @Override - public BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) - throws StorageException { + public BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) throws StorageException { checkNotNull(layers); checkState(getName() != null); - checkState( - isEnabled(), - "Can't call AzureBlobStoreConfig.createInstance() is blob store is not enabled"); - if (log.isLoggable(Level.FINE)) - log.fine("Creating Azure Blob Store instance [name=" + getName() + "]"); + checkState(isEnabled(), "Can't call AzureBlobStoreConfig.createInstance() is blob store is not enabled"); + if (log.isLoggable(Level.FINE)) log.fine("Creating Azure Blob Store instance [name=" + getName() + "]"); final AzureBlobStoreData storeData = - new AzureBlobStoreData( - this, GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class)); + new AzureBlobStoreData(this, GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class)); return new AzureBlobStore(storeData, layers, lockProvider); } diff --git a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureClient.java b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureClient.java index eb8b3ad524..69ee385c2c 100644 --- a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureClient.java +++ b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/AzureClient.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -93,11 +92,10 @@ BlobServiceClient createBlobServiceClient(AzureBlobStoreData configuration) { AzureNamedKeyCredential creds = getCredentials(configuration); ClientOptions clientOpts = new ClientOptions(); HttpClient httpClient = createHttpClient(configuration); - BlobServiceClientBuilder builder = - new BlobServiceClientBuilder() - .endpoint(serviceURL) - .clientOptions(clientOpts) - .httpClient(httpClient); + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .endpoint(serviceURL) + .clientOptions(clientOpts) + .httpClient(httpClient); if (null != creds) { builder = builder.credential(creds); } @@ -193,9 +191,7 @@ public Properties getProperties(String key) { byte[] bytes = getBytes(key); if (bytes != null) { try { - properties.load( - new InputStreamReader( - new ByteArrayInputStream(bytes), StandardCharsets.UTF_8)); + properties.load(new InputStreamReader(new ByteArrayInputStream(bytes), StandardCharsets.UTF_8)); } catch (IOException e) { throw new UncheckedIOException(e); } @@ -211,13 +207,11 @@ public void putProperties(String resourceKey, Properties properties) throws Stor try { upload(resourceKey, data, contentType); } catch (StorageException e) { - throw new StorageException( - "Failed to update e property file at " + resourceKey, e.getCause()); + throw new StorageException("Failed to update e property file at " + resourceKey, e.getCause()); } } - public void upload(String resourceKey, BinaryData data, String contentType) - throws StorageException { + public void upload(String resourceKey, BinaryData data, String contentType) throws StorageException { BlockBlobSimpleUploadOptions upload = new BlockBlobSimpleUploadOptions(data); upload.setHeaders(new BlobHttpHeaders().setContentType(contentType)); @@ -233,8 +227,7 @@ public void upload(String resourceKey, BinaryData data, String contentType) } int status = response.getStatusCode(); if (!HttpStatus.valueOf(status).is2xxSuccessful()) { - throw new StorageException( - "Upload request failed with status " + status + " on resource " + resourceKey); + throw new StorageException("Upload request failed with status " + status + " on resource " + resourceKey); } } @@ -258,8 +251,8 @@ public boolean prefixExists(String prefix) { /** * @param prefix - * @return an internally paged Stream, with the default items-per-page setting of {@link - * ListBlobsOptions#getMaxResultsPerPage() 5000} + * @return an internally paged Stream, with the default items-per-page setting of + * {@link ListBlobsOptions#getMaxResultsPerPage() 5000} */ public Stream listBlobs(String prefix) { return listBlobs(prefix, 5_000); @@ -267,8 +260,8 @@ public Stream listBlobs(String prefix) { /** * @param prefix - * @param maxResultsPerPage used to control how many items Azure will return per page. It's not - * the max results to return entirely, so use it with caution. + * @param maxResultsPerPage used to control how many items Azure will return per page. It's not the max results to + * return entirely, so use it with caution. * @return an internally paged (as per {@code maxResultsPerPage}) Stream. */ public Stream listBlobs(String prefix, int maxResultsPerPage) { diff --git a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/DeleteManager.java b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/DeleteManager.java index 0c5e4204d6..b1795be83c 100644 --- a/geowebcache/azureblob/src/main/java/org/geowebcache/azure/DeleteManager.java +++ b/geowebcache/azureblob/src/main/java/org/geowebcache/azure/DeleteManager.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -48,21 +47,18 @@ import org.geowebcache.util.TMSKeyBuilder; /** - * Class handling deletes, which are normally handled in an asynchronous way in all other stores as - * well. These are bulk operations like deleting an entire layer, or a rangeset, with potentially - * million of tiles involved. + * Class handling deletes, which are normally handled in an asynchronous way in all other stores as well. These are bulk + * operations like deleting an entire layer, or a rangeset, with potentially million of tiles involved. * - *

Unfortunately the Azure BLOB API has no concept of bulk delete, and no concept of containment - * either, so tiles have to be enumerated one by one and a delete issued on each one. This calls for - * a parallel execution, and requires avoiding accumulation of references to all tiles that need - * removing in memory, as they could be millions or more, hence code that tries to run over the - * tiles in pages + *

Unfortunately the Azure BLOB API has no concept of bulk delete, and no concept of containment either, so tiles + * have to be enumerated one by one and a delete issued on each one. This calls for a parallel execution, and requires + * avoiding accumulation of references to all tiles that need removing in memory, as they could be millions or more, + * hence code that tries to run over the tiles in pages */ class DeleteManager implements Closeable { /** - * the page size here is not about limiting the requests, but ensures that we don't end up using - * too much memory while processing millions of tiles, that would be otherwise all queued on the - * {@link ExecutorService} + * the page size here is not about limiting the requests, but ensures that we don't end up using too much memory + * while processing millions of tiles, that would be otherwise all queued on the {@link ExecutorService} */ static final int PAGE_SIZE = 1000; @@ -73,26 +69,20 @@ class DeleteManager implements Closeable { private ExecutorService deleteExecutor; private Map pendingDeletesKeyTime = new ConcurrentHashMap<>(); - public DeleteManager( - AzureClient client, LockProvider locks, TMSKeyBuilder keyBuilder, int maxConnections) { + public DeleteManager(AzureClient client, LockProvider locks, TMSKeyBuilder keyBuilder, int maxConnections) { this.keyBuilder = keyBuilder; this.client = client; this.locks = locks; this.concurrency = maxConnections; - this.deleteExecutor = - createDeleteExecutorService(client.getContainerName(), maxConnections); + this.deleteExecutor = createDeleteExecutorService(client.getContainerName(), maxConnections); } - private static ExecutorService createDeleteExecutorService( - String containerName, int parallelism) { - ThreadFactory tf = - new ThreadFactoryBuilder() - .setDaemon(true) - .setNameFormat( - "GWC AzureBlobStore bulk delete thread-%d. Container: " - + containerName) - .setPriority(Thread.MIN_PRIORITY) - .build(); + private static ExecutorService createDeleteExecutorService(String containerName, int parallelism) { + ThreadFactory tf = new ThreadFactoryBuilder() + .setDaemon(true) + .setNameFormat("GWC AzureBlobStore bulk delete thread-%d. Container: " + containerName) + .setPriority(Thread.MIN_PRIORITY) + .build(); return Executors.newFixedThreadPool(parallelism, tf); } @@ -102,9 +92,7 @@ private long currentTimeSeconds() { return Instant.now().getEpochSecond(); } - /** - * Executes the provided iterator of callables on the delete executor, returning their results - */ + /** Executes the provided iterator of callables on the delete executor, returning their results */ public void executeParallel(List> callables) throws StorageException { List> futures = new ArrayList<>(); for (Callable callable : callables) { @@ -119,10 +107,7 @@ public void executeParallel(List> callables) throws StorageException } } - /** - * Executes the removal of the specified keys in a parallel fashion, returning the number of - * removed keys - */ + /** Executes the removal of the specified keys in a parallel fashion, returning the number of removed keys */ public Long deleteParallel(List keys) throws StorageException { try { return new KeysBulkDelete(keys).call(); @@ -133,10 +118,9 @@ public Long deleteParallel(List keys) throws StorageException { public boolean scheduleAsyncDelete(final String prefix) throws StorageException { final long timestamp = currentTimeSeconds(); - String msg = - String.format( - "Issuing bulk delete on '%s/%s' for objects older than %d", - client.getContainerName(), prefix, timestamp); + String msg = String.format( + "Issuing bulk delete on '%s/%s' for objects older than %d", + client.getContainerName(), prefix, timestamp); log.info(msg); try { @@ -174,10 +158,9 @@ public void issuePendingBulkDeletes() throws StorageException { final String prefix = e.getKey().toString(); final long timestamp = Long.parseLong(e.getValue().toString()); if (log.isLoggable(Level.INFO)) - log.info( - String.format( - "Restarting pending bulk delete on '%s/%s':%d", - client.getContainerName(), prefix, timestamp)); + log.info(String.format( + "Restarting pending bulk delete on '%s/%s':%d", + client.getContainerName(), prefix, timestamp)); if (!asyncDelete(prefix, timestamp)) { deletesToClear.add(prefix); } @@ -235,10 +218,8 @@ public Long call() throws Exception { try { checkInterrupted(); if (log.isLoggable(Level.INFO)) - log.info( - String.format( - "Running bulk delete on '%s/%s':%d", - client.getContainerName(), prefix, timestamp)); + log.info(String.format( + "Running bulk delete on '%s/%s':%d", client.getContainerName(), prefix, timestamp)); BlobContainerClient container = client.getContainer(); @@ -256,10 +237,9 @@ public Long call() throws Exception { } } } catch (InterruptedException | IllegalStateException e) { - log.info( - String.format( - "Azure bulk delete aborted for '%s/%s'. Will resume on next startup.", - client.getContainerName(), prefix)); + log.info(String.format( + "Azure bulk delete aborted for '%s/%s'. Will resume on next startup.", + client.getContainerName(), prefix)); throw e; } catch (RuntimeException e) { log.log( @@ -272,10 +252,9 @@ public Long call() throws Exception { } if (log.isLoggable(Level.INFO)) - log.info( - String.format( - "Finished bulk delete on '%s/%s':%d. %d objects deleted", - client.getContainerName(), prefix, timestamp, count)); + log.info(String.format( + "Finished bulk delete on '%s/%s':%d. %d objects deleted", + client.getContainerName(), prefix, timestamp, count)); clearPendingBulkDelete(prefix, timestamp); return count; @@ -287,8 +266,7 @@ private boolean equalOrAfter(BlobItem blobItem) { return timestamp >= lastModifiedSecs; } - private void clearPendingBulkDelete(final String prefix, final long timestamp) - throws GeoWebCacheException { + private void clearPendingBulkDelete(final String prefix, final long timestamp) throws GeoWebCacheException { Long taskTime = pendingDeletesKeyTime.get(prefix); if (taskTime == null) { return; // someone else cleared it up for us. A task that run after this one but @@ -303,15 +281,13 @@ private void clearPendingBulkDelete(final String prefix, final long timestamp) try { Properties deletes = client.getProperties(pendingDeletesKey); String storedVal = (String) deletes.remove(prefix); - long storedTimestamp = - storedVal == null ? Long.MIN_VALUE : Long.parseLong(storedVal); + long storedTimestamp = storedVal == null ? Long.MIN_VALUE : Long.parseLong(storedVal); if (timestamp >= storedTimestamp) { client.putProperties(pendingDeletesKey, deletes); } else if (log.isLoggable(Level.INFO)) { - log.info( - String.format( - "bulk delete finished but there's a newer one ongoing for container '%s/%s'", - client.getContainerName(), prefix)); + log.info(String.format( + "bulk delete finished but there's a newer one ongoing for container '%s/%s'", + client.getContainerName(), prefix)); } } catch (StorageException e) { throw new UncheckedIOException(e); @@ -320,21 +296,16 @@ private void clearPendingBulkDelete(final String prefix, final long timestamp) } } - private long deleteItems( - BlobContainerClient container, List segment, Predicate filter) + private long deleteItems(BlobContainerClient container, List segment, Predicate filter) throws ExecutionException, InterruptedException { - List> collect = - segment.stream() - .filter(filter) - .map( - item -> - deleteExecutor.submit( - () -> { - deleteItem(container, item.getName()); - return null; - })) - .collect(Collectors.toList()); + List> collect = segment.stream() + .filter(filter) + .map(item -> deleteExecutor.submit(() -> { + deleteItem(container, item.getName()); + return null; + })) + .collect(Collectors.toList()); for (Future f : collect) { f.get(); @@ -357,11 +328,9 @@ public Long call() throws Exception { try { checkInterrupted(); if (log.isLoggable(Level.FINER)) { - log.finer( - String.format( - "Running delete delete on list of items on '%s':%s ... (only the first 100 items listed)", - client.getContainerName(), - keys.subList(0, Math.min(keys.size(), 100)))); + log.finer(String.format( + "Running delete delete on list of items on '%s':%s ... (only the first 100 items listed)", + client.getContainerName(), keys.subList(0, Math.min(keys.size(), 100)))); } BlobContainerClient container = client.getContainer(); @@ -378,19 +347,16 @@ public Long call() throws Exception { } if (log.isLoggable(Level.INFO)) - log.info( - String.format( - "Finished bulk delete on %s, %d objects deleted", - client.getContainerName(), count)); + log.info(String.format( + "Finished bulk delete on %s, %d objects deleted", client.getContainerName(), count)); return count; } private long deleteItems(BlobContainerClient container, List itemNames) throws ExecutionException, InterruptedException { - List> collect = - itemNames.stream() - .map(item -> deleteExecutor.submit(() -> deleteItem(container, item))) - .collect(Collectors.toList()); + List> collect = itemNames.stream() + .map(item -> deleteExecutor.submit(() -> deleteItem(container, item))) + .collect(Collectors.toList()); for (Future f : collect) { f.get(); diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConfigProviderTest.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConfigProviderTest.java index 81af95560a..9bb82f3611 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConfigProviderTest.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConfigProviderTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -34,8 +33,7 @@ public void setUp() throws Exception { System.setProperty("CONNECTIONS", "30"); System.setProperty("ENABLED", "true"); System.setProperty("ALLOW_ENV_PARAMETRIZATION", "true"); - ClassPathXmlApplicationContext context = - new ClassPathXmlApplicationContext("appContextTestAzure.xml"); + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("appContextTestAzure.xml"); GeoWebCacheExtensions gse = new GeoWebCacheExtensions(); gse.setApplicationContext(context); diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConformanceTest.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConformanceTest.java index e38cc0ad92..ddcca34d62 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConformanceTest.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreConformanceTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -48,23 +47,19 @@ public void createTestUnit() throws Exception { TileLayerDispatcher layers = createMock(TileLayerDispatcher.class); LockProvider lockProvider = new NoOpLockProvider(); Stream.of("testLayer", "testLayer1", "testLayer2") - .map( - name -> { - TileLayer mock = createMock(name, TileLayer.class); - expect(mock.getName()).andStubReturn(name); - expect(mock.getId()).andStubReturn(name); - expect(mock.getGridSubsets()) - .andStubReturn(Collections.singleton("testGridSet")); - expect(mock.getMimeTypes()) - .andStubReturn( - Arrays.asList(org.geowebcache.mime.ImageMime.png)); - try { - expect(layers.getTileLayer(eq(name))).andStubReturn(mock); - } catch (GeoWebCacheException e) { - fail(); - } - return mock; - }) + .map(name -> { + TileLayer mock = createMock(name, TileLayer.class); + expect(mock.getName()).andStubReturn(name); + expect(mock.getId()).andStubReturn(name); + expect(mock.getGridSubsets()).andStubReturn(Collections.singleton("testGridSet")); + expect(mock.getMimeTypes()).andStubReturn(Arrays.asList(org.geowebcache.mime.ImageMime.png)); + try { + expect(layers.getTileLayer(eq(name))).andStubReturn(mock); + } catch (GeoWebCacheException e) { + fail(); + } + return mock; + }) .forEach(EasyMock::replay); replay(layers); store = new AzureBlobStore(config, layers, lockProvider); diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreDataTest.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreDataTest.java index bafee3db62..de94fa5d3e 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreDataTest.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreDataTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Fernando Mino, GeoSolutions, Copyright 2019 */ @@ -33,8 +32,7 @@ public void setUp() throws Exception { System.setProperty("ACCOUNT_KEY", "MYKEY"); System.setProperty("CONNECTIONS", "30"); System.setProperty("ALLOW_ENV_PARAMETRIZATION", "true"); - ClassPathXmlApplicationContext context = - new ClassPathXmlApplicationContext("appContextTestAzure.xml"); + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("appContextTestAzure.xml"); GeoWebCacheExtensions gse = new GeoWebCacheExtensions(); gse.setApplicationContext(context); } @@ -50,8 +48,7 @@ public void tearDown() throws Exception { @Test public void testEnvironmentProperties() { - GeoWebCacheEnvironment typedEnvironment = - GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class); + GeoWebCacheEnvironment typedEnvironment = GeoWebCacheExtensions.bean(GeoWebCacheEnvironment.class); final AzureBlobStoreInfo storeInfo = new AzureBlobStoreInfo("info1"); storeInfo.setContainer("${CONTAINER}"); storeInfo.setAccountName("${ACCOUNT_NAME}"); diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreIntegrationTest.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreIntegrationTest.java index 5906f9e7b2..6b2dab5d51 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreIntegrationTest.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreIntegrationTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -285,8 +284,7 @@ public void testDeleteLayer() throws Exception { // check the tiles are gone too, give it up to 100 seconds long start = System.currentTimeMillis(); boolean t20Deleted = false, t21Deleted = false, t22Deleted = false; - while (System.currentTimeMillis() - start < 100000 - && (!t20Deleted || !t21Deleted || !t22Deleted)) { + while (System.currentTimeMillis() - start < 100000 && (!t20Deleted || !t21Deleted || !t22Deleted)) { if (!t20Deleted) { tile.getXYZ()[0] = 20; @@ -325,34 +323,21 @@ public void testDeleteGridSubset() throws Exception { // deletion by gridset is asynch, so we might have to wait a bit boolean t4326PngDeleted = false, t4326JpegDeleted = false; long start = System.currentTimeMillis(); - while (System.currentTimeMillis() - start < 100000 - && (!t4326PngDeleted || !t4326JpegDeleted)) { + while (System.currentTimeMillis() - start < 100000 && (!t4326PngDeleted || !t4326JpegDeleted)) { if (!t4326PngDeleted) { - t4326PngDeleted = - !blobStore.get(queryTile(DEFAULT_LAYER, "EPSG:4326", "png", 0, 0, 0)); + t4326PngDeleted = !blobStore.get(queryTile(DEFAULT_LAYER, "EPSG:4326", "png", 0, 0, 0)); } if (!t4326JpegDeleted) { t4326JpegDeleted = - !blobStore.get( - queryTile( - DEFAULT_LAYER, - "EPSG:4326", - "jpeg", - 0, - 0, - 0, - "param", - "value")); + !blobStore.get(queryTile(DEFAULT_LAYER, "EPSG:4326", "jpeg", 0, 0, 0, "param", "value")); } } assertTrue(t4326PngDeleted); assertTrue(t4326JpegDeleted); // these two should not have been touched assertTrue(blobStore.get(queryTile(DEFAULT_LAYER, "EPSG:3857", "png", 0, 0, 0))); - assertTrue( - blobStore.get( - queryTile(DEFAULT_LAYER, "EPSG:3857", "jpeg", 0, 0, 0, "param", "value"))); + assertTrue(blobStore.get(queryTile(DEFAULT_LAYER, "EPSG:3857", "jpeg", 0, 0, 0, "param", "value"))); } @Test @@ -366,8 +351,7 @@ public void testLayerMetadata() { } @Test - public void testTruncateShortCutsIfNoTilesInParametersPrefix() - throws StorageException, MimeException { + public void testTruncateShortCutsIfNoTilesInParametersPrefix() throws StorageException, MimeException { final int zoomStart = 0; final int zoomStop = 1; seed(zoomStart, zoomStop); @@ -375,8 +359,7 @@ public void testTruncateShortCutsIfNoTilesInParametersPrefix() blobStore.addListener(listener); GridSet gridset = - new GridSetBroker(Collections.singletonList(new DefaultGridsets(false, false))) - .getWorldEpsg4326(); + new GridSetBroker(Collections.singletonList(new DefaultGridsets(false, false))).getWorldEpsg4326(); GridSubset gridSubSet = GridSubsetFactory.createGridSubSet(gridset); long[][] rangeBounds = { // @@ -388,14 +371,7 @@ public void testTruncateShortCutsIfNoTilesInParametersPrefix() // use a parameters map for which there're no tiles Map parameters = ImmutableMap.of("someparam", "somevalue"); TileRange tileRange = - tileRange( - DEFAULT_LAYER, - DEFAULT_GRIDSET, - zoomStart, - zoomStop, - rangeBounds, - mimeType, - parameters); + tileRange(DEFAULT_LAYER, DEFAULT_GRIDSET, zoomStart, zoomStop, rangeBounds, mimeType, parameters); assertFalse(blobStore.delete(tileRange)); verify(listener, times(0)) @@ -411,8 +387,7 @@ public void testTruncateShortCutsIfNoTilesInParametersPrefix() } @Test - public void testTruncateShortCutsIfNoTilesInGridsetPrefix() - throws StorageException, MimeException { + public void testTruncateShortCutsIfNoTilesInGridsetPrefix() throws StorageException, MimeException { final int zoomStart = 0; final int zoomStop = 1; @@ -422,8 +397,7 @@ public void testTruncateShortCutsIfNoTilesInGridsetPrefix() // use a gridset for which there're no tiles GridSet gridset = - new GridSetBroker(Collections.singletonList(new DefaultGridsets(false, true))) - .getWorldEpsg3857(); + new GridSetBroker(Collections.singletonList(new DefaultGridsets(false, true))).getWorldEpsg3857(); GridSubset gridSubSet = GridSubsetFactory.createGridSubSet(gridset); long[][] rangeBounds = { // @@ -435,26 +409,12 @@ public void testTruncateShortCutsIfNoTilesInGridsetPrefix() Map parameters = null; TileRange tileRange = - tileRange( - DEFAULT_LAYER, - gridset.getName(), - zoomStart, - zoomStop, - rangeBounds, - mimeType, - parameters); + tileRange(DEFAULT_LAYER, gridset.getName(), zoomStart, zoomStop, rangeBounds, mimeType, parameters); assertFalse(blobStore.delete(tileRange)); verify(listener, times(0)) .tileDeleted( - anyString(), - anyString(), - anyString(), - anyString(), - anyLong(), - anyLong(), - anyInt(), - anyLong()); + anyString(), anyString(), anyString(), anyString(), anyLong(), anyLong(), anyInt(), anyLong()); } /** Seed levels 0 to 2, truncate levels 0 and 1, check level 2 didn't get deleted */ @@ -466,8 +426,7 @@ public void testTruncateRespectsLevels() throws StorageException, MimeException // use a gridset for which there're no tiles GridSet gridset = - new GridSetBroker(Collections.singletonList(new DefaultGridsets(false, true))) - .getWorldEpsg3857(); + new GridSetBroker(Collections.singletonList(new DefaultGridsets(false, true))).getWorldEpsg3857(); GridSubset gridSubSet = GridSubsetFactory.createGridSubSet(gridset); long[][] rangeBounds = gridSubSet.getCoverages(); @@ -483,15 +442,8 @@ public void testTruncateRespectsLevels() throws StorageException, MimeException final int truncateStart = 0, truncateStop = 1; - TileRange tileRange = - tileRange( - DEFAULT_LAYER, - gridset.getName(), - truncateStart, - truncateStop, - rangeBounds, - mimeType, - parameters); + TileRange tileRange = tileRange( + DEFAULT_LAYER, gridset.getName(), truncateStart, truncateStop, rangeBounds, mimeType, parameters); assertTrue(blobStore.delete(tileRange)); @@ -513,10 +465,7 @@ private static String anyStringOrNull() { return or(isNull(), anyString()); } - /** - * If there are not {@link BlobStoreListener}s, use an optimized code path (not calling delete() - * for each tile) - */ + /** If there are not {@link BlobStoreListener}s, use an optimized code path (not calling delete() for each tile) */ @Test @SuppressWarnings("unchecked") public void testTruncateOptimizationIfNoListeners() throws StorageException, MimeException { @@ -538,15 +487,8 @@ public void testTruncateOptimizationIfNoListeners() throws StorageException, Mim final int truncateStart = 0, truncateStop = 1; - TileRange tileRange = - tileRange( - DEFAULT_LAYER, - DEFAULT_GRIDSET, - truncateStart, - truncateStop, - rangeBounds, - mimeType, - parameters); + TileRange tileRange = tileRange( + DEFAULT_LAYER, DEFAULT_GRIDSET, truncateStart, truncateStop, rangeBounds, mimeType, parameters); @SuppressWarnings("PMD.CloseResource") // closed by the store DeleteManager deleteManager = Mockito.spy(blobStore.deleteManager); @@ -580,14 +522,7 @@ private TileRange tileRange( Map parameters) { TileRange tileRange = - new TileRange( - layerName, - gridSetId, - zoomStart, - zoomStop, - rangeBounds, - mimeType, - parameters); + new TileRange(layerName, gridSetId, zoomStart, zoomStop, rangeBounds, mimeType, parameters); return tileRange; } @@ -596,15 +531,10 @@ private void seed(int zoomStart, int zoomStop) throws StorageException { } private void seed( - int zoomStart, - int zoomStop, - String gridset, - String formatExtension, - Map parameters) + int zoomStart, int zoomStop, String gridset, String formatExtension, Map parameters) throws StorageException { - Preconditions.checkArgument( - zoomStop < 5, "don't use high zoom levels for integration testing"); + Preconditions.checkArgument(zoomStop < 5, "don't use high zoom levels for integration testing"); for (int z = zoomStart; z <= zoomStop; z++) { int max = (int) Math.pow(2, z); for (int x = 0; x < max; x++) { @@ -617,12 +547,7 @@ private void seed( } private TileObject put( - long x, - long y, - int z, - String gridset, - String formatExtension, - Map parameters) + long x, long y, int z, String gridset, String formatExtension, Map parameters) throws StorageException { return put(x, y, z, DEFAULT_LAYER, gridset, formatExtension, parameters); } @@ -648,19 +573,12 @@ private TileObject queryTile(long x, long y, int z) { return queryTile(DEFAULT_LAYER, DEFAULT_GRIDSET, DEFAULT_FORMAT, x, y, z); } - private TileObject queryTile( - String layer, String gridset, String extension, long x, long y, int z) { + private TileObject queryTile(String layer, String gridset, String extension, long x, long y, int z) { return queryTile(layer, gridset, extension, x, y, z, (Map) null); } private TileObject queryTile( - String layer, - String gridset, - String extension, - long x, - long y, - int z, - String... parameters) { + String layer, String gridset, String extension, long x, long y, int z, String... parameters) { Map parametersMap = null; if (parameters != null) { @@ -673,13 +591,7 @@ private TileObject queryTile( } private TileObject queryTile( - String layer, - String gridset, - String extension, - long x, - long y, - int z, - Map parameters) { + String layer, String gridset, String extension, long x, long y, int z, Map parameters) { String format; try { @@ -688,9 +600,7 @@ private TileObject queryTile( throw new RuntimeException(e); } - TileObject tile = - TileObject.createQueryTileObject( - layer, new long[] {x, y, z}, gridset, format, parameters); + TileObject tile = TileObject.createQueryTileObject(layer, new long[] {x, y, z}, gridset, format, parameters); return tile; } } diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreSuitabilityTest.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreSuitabilityTest.java index ea56ca3d92..75a8a0fa60 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreSuitabilityTest.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/AzureBlobStoreSuitabilityTest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2018 */ @@ -84,11 +83,9 @@ public BlobStore create(Object dir) throws Exception { for (String path : (String[]) dir) { String fullPath = info.getPrefix() + "/" + path; BinaryData data = BinaryData.fromString("testAbc"); - Response response = - getClient() - .getBlockBlobClient(fullPath) - .uploadWithResponse( - new BlockBlobSimpleUploadOptions(data), null, Context.NONE); + Response response = getClient() + .getBlockBlobClient(fullPath) + .uploadWithResponse(new BlockBlobSimpleUploadOptions(data), null, Context.NONE); assertTrue(HttpStatus.valueOf(response.getStatusCode()).is2xxSuccessful()); } return new AzureBlobStore(info, tld, locks); diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreConformanceIT.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreConformanceIT.java index aae6b52cdd..4babeb11f2 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreConformanceIT.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreConformanceIT.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2024 */ @@ -25,8 +24,7 @@ * Runs {@link AzureBlobStoreConformanceTest} tests against a local ephemeral Docker container using * {@link AzuriteContainer}. * - *

If there's no Docker environment, the test is {@link AzuriteContainer#disabledWithoutDocker() - * ignored} + *

If there's no Docker environment, the test is {@link AzuriteContainer#disabledWithoutDocker() ignored} */ public class AzuriteAzureBlobStoreConformanceIT extends AzureBlobStoreConformanceTest { @@ -34,7 +32,8 @@ public class AzuriteAzureBlobStoreConformanceIT extends AzureBlobStoreConformanc public static AzuriteContainer azurite = AzuriteContainer.latest().disabledWithoutDocker(); /** Used to get a per-test case Azure container */ - @Rule public TestName testName = new TestName(); + @Rule + public TestName testName = new TestName(); @Override protected AzureBlobStoreData getConfiguration() { diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreIntegrationIT.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreIntegrationIT.java index ac5ca2763d..5a2e030629 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreIntegrationIT.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreIntegrationIT.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2024 */ @@ -25,8 +24,7 @@ * Runs {@link AzureBlobStoreIntegrationTest} tests against a local ephemeral Docker container using * {@link AzuriteContainer}. * - *

If there's no Docker environment, the test is {@link AzuriteContainer#disabledWithoutDocker() - * ignored} + *

If there's no Docker environment, the test is {@link AzuriteContainer#disabledWithoutDocker() ignored} */ public class AzuriteAzureBlobStoreIntegrationIT extends AzureBlobStoreIntegrationTest { @@ -34,7 +32,8 @@ public class AzuriteAzureBlobStoreIntegrationIT extends AzureBlobStoreIntegratio public static AzuriteContainer azurite = AzuriteContainer.latest().disabledWithoutDocker(); /** Used to get a per-test case Azure container */ - @Rule public TestName testName = new TestName(); + @Rule + public TestName testName = new TestName(); @Override protected AzureBlobStoreData getConfiguration() { diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreSuitabilityIT.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreSuitabilityIT.java index ed7298e8d8..6a78054f22 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreSuitabilityIT.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/container/AzuriteAzureBlobStoreSuitabilityIT.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2024 */ @@ -29,8 +28,7 @@ * Runs {@link AzureBlobStoreConformanceTest} tests against a local ephemeral Docker container using * {@link AzuriteContainer}. * - *

If there's no Docker environment, the test is {@link AzuriteContainer#disabledWithoutDocker() - * ignored} + *

If there's no Docker environment, the test is {@link AzuriteContainer#disabledWithoutDocker() ignored} */ public class AzuriteAzureBlobStoreSuitabilityIT extends AzureBlobStoreSuitabilityTest { @@ -38,7 +36,8 @@ public class AzuriteAzureBlobStoreSuitabilityIT extends AzureBlobStoreSuitabilit public static AzuriteContainer azurite = AzuriteContainer.latest().disabledWithoutDocker(); /** Used to get a per-test case Azure container */ - @Rule public TestName testName = new TestName(); + @Rule + public TestName testName = new TestName(); @Override protected AzureBlobStoreData getConfiguration() { diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreConformanceIT.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreConformanceIT.java index ab89916d5b..d2fe450a1a 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreConformanceIT.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreConformanceIT.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -23,8 +22,7 @@ public class OnlineAzureBlobStoreConformanceIT extends AzureBlobStoreConformance public PropertiesLoader testConfigLoader = new PropertiesLoader(); @Rule - public TemporaryAzureFolder tempFolder = - new TemporaryAzureFolder(testConfigLoader.getProperties()); + public TemporaryAzureFolder tempFolder = new TemporaryAzureFolder(testConfigLoader.getProperties()); @Override protected AzureBlobStoreData getConfiguration() { diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreIntegrationIT.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreIntegrationIT.java index 9571021536..45a0b1e7ab 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreIntegrationIT.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreIntegrationIT.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -27,8 +26,7 @@ public class OnlineAzureBlobStoreIntegrationIT extends AzureBlobStoreIntegration private PropertiesLoader testConfigLoader = new PropertiesLoader(); @Rule - public TemporaryAzureFolder tempFolder = - new TemporaryAzureFolder(testConfigLoader.getProperties()); + public TemporaryAzureFolder tempFolder = new TemporaryAzureFolder(testConfigLoader.getProperties()); @Override protected AzureBlobStoreData getConfiguration() { diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreSuitabilityIT.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreSuitabilityIT.java index c996d07529..793bf8f602 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreSuitabilityIT.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/OnlineAzureBlobStoreSuitabilityIT.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2018 */ @@ -32,8 +31,7 @@ public class OnlineAzureBlobStoreSuitabilityIT extends AzureBlobStoreSuitability public PropertiesLoader testConfigLoader = new PropertiesLoader(); @Rule - public TemporaryAzureFolder tempFolder = - new TemporaryAzureFolder(testConfigLoader.getProperties()); + public TemporaryAzureFolder tempFolder = new TemporaryAzureFolder(testConfigLoader.getProperties()); @Override protected AzureBlobStoreData getConfiguration() { diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/PropertiesLoader.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/PropertiesLoader.java index 80c9887ce9..8ea67e9429 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/PropertiesLoader.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/PropertiesLoader.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -26,14 +25,13 @@ import org.geotools.util.logging.Logging; /** - * Loads the configuration from a properties file {@code $HOME/.gwc_azure_tests.properties}, which - * must exist and contain entries for {@code container}, {@code accountName}, and {@code - * accountKey}. + * Loads the configuration from a properties file {@code $HOME/.gwc_azure_tests.properties}, which must exist and + * contain entries for {@code container}, {@code accountName}, and {@code accountKey}. * *

If the file doesn't exist, the returned {@link #getProperties()} will be empty. * - *

If the file does exist and doesn't contain one of the required keys, the constructor fails - * with an {@link IllegalArgumentException}. + *

If the file does exist and doesn't contain one of the required keys, the constructor fails with an + * {@link IllegalArgumentException}. */ public class PropertiesLoader { @@ -44,8 +42,7 @@ public class PropertiesLoader { public PropertiesLoader() { String home = System.getProperty("user.home"); File configFile = new File(home, ".gwc_azure_tests.properties"); - log.info( - "Loading Azure tests config. File must have keys 'container', 'accountName', and 'accountKey'"); + log.info("Loading Azure tests config. File must have keys 'container', 'accountName', and 'accountKey'"); if (configFile.exists()) { try (InputStream in = new FileInputStream(configFile)) { properties.load(in); @@ -59,15 +56,11 @@ public PropertiesLoader() { null != properties.getProperty("accountKey"), "accountKey not provided in config file " + configFile.getAbsolutePath()); } catch (IOException e) { - log.log( - Level.SEVERE, - "Error loading Azure tests config: " + configFile.getAbsolutePath(), - e); + log.log(Level.SEVERE, "Error loading Azure tests config: " + configFile.getAbsolutePath(), e); } } else { - log.warning( - "Azure storage config file not found. Azure Azure tests will be ignored. " - + configFile.getAbsolutePath()); + log.warning("Azure storage config file not found. Azure Azure tests will be ignored. " + + configFile.getAbsolutePath()); } } diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/TemporaryAzureFolder.java b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/TemporaryAzureFolder.java index c6d8222b76..2344011740 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/TemporaryAzureFolder.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/azure/tests/online/TemporaryAzureFolder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -27,8 +26,8 @@ import org.junit.rules.ExternalResource; /** - * The TemporaryAzureFolder provides a path prefix for Azure storage and deletes all resources under - * the given prefix at shutdown. + * The TemporaryAzureFolder provides a path prefix for Azure storage and deletes all resources under the given prefix at + * shutdown. */ public class TemporaryAzureFolder extends ExternalResource { @@ -116,13 +115,10 @@ public void delete() { } try (Stream blobs = client.listBlobs(temporaryPrefix)) { - blobs.forEach( - blob -> { - BlockBlobClient blockBlobURL = client.getBlockBlobClient(blob.getName()); - assertTrue( - "Expected success while deleting " + blob.getName(), - blockBlobURL.deleteIfExists()); - }); + blobs.forEach(blob -> { + BlockBlobClient blockBlobURL = client.getBlockBlobClient(blob.getName()); + assertTrue("Expected success while deleting " + blob.getName(), blockBlobURL.deleteIfExists()); + }); } } diff --git a/geowebcache/azureblob/src/test/java/org/geowebcache/testcontainers/azure/AzuriteContainer.java b/geowebcache/azureblob/src/test/java/org/geowebcache/testcontainers/azure/AzuriteContainer.java index 857122c6fe..82466f2ff5 100644 --- a/geowebcache/azureblob/src/test/java/org/geowebcache/testcontainers/azure/AzuriteContainer.java +++ b/geowebcache/azureblob/src/test/java/org/geowebcache/testcontainers/azure/AzuriteContainer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2024 */ @@ -31,20 +30,18 @@ /** * Testcontainers container for AWS Azurite Azure - * Storage Emulator. + * "https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite">Azurite Azure Storage Emulator. * *

Runs the Azurite * Docker image for local Azure Storage development with testcontainers. * - *

Azurite sets up the following well-known account and key for the Azure Storage Emulator, - * available through {@link #getAccountName()} and {@link #getAccountKey()}: + *

Azurite sets up the following well-known account and key for the Azure Storage Emulator, available through + * {@link #getAccountName()} and {@link #getAccountKey()}: * *

    *
  • Account name: {@code devstoreaccount1} - *
  • Account key: {@code - * Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==} + *
  • Account key: {@code Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==} *
* *

Usage: For Junit 4, use it as a {@code @Rule} or {@code @ClassRule}: @@ -101,8 +98,8 @@ public static AzuriteContainer latest() { /** * Disables the tests using this testcontainer if there's no Docker environment available. * - *

Same effect as JUnit 5's {@code - * org.testcontainers.junit.jupiter.@Testcontainers(disabledWithoutDocker = true)} + *

Same effect as JUnit 5's {@code org.testcontainers.junit.jupiter.@Testcontainers(disabledWithoutDocker = + * true)} */ public AzuriteContainer disabledWithoutDocker() { this.disabledWithoutDocker = true; @@ -110,9 +107,9 @@ public AzuriteContainer disabledWithoutDocker() { } /** - * Overrides to apply the {@link Assume assumption} checking the Docker environment is available - * if {@link #disabledWithoutDocker() enabled}, so this test container can be used as a {@code - * ClassRule @ClassRule} and hence avoid running a container for each test case. + * Overrides to apply the {@link Assume assumption} checking the Docker environment is available if + * {@link #disabledWithoutDocker() enabled}, so this test container can be used as a {@code ClassRule @ClassRule} + * and hence avoid running a container for each test case. */ @Override @SuppressWarnings("deprecation") @@ -137,12 +134,11 @@ public String getAccountKey() { /** * Returns the localhost port where the azurite blob storage service is running. * - *

when in {@link #legacy() legacy} mode, a small http proxy is run and the proxy port is - * returned. The proxy fixes some protocol issues. For instance, re-writes the returned response - * headers {@code etag}, {@code last-modified}, and {@code content-type}, as {@code Etag}, - * {@code Last-Modified}, and {@code Content-Type}, respectively, as expected by the Netty - * version the legacy {@code com.microsoft.azure:azure-storage-blob} dependency transitively - * carries over. + *

when in {@link #legacy() legacy} mode, a small http proxy is run and the proxy port is returned. The proxy + * fixes some protocol issues. For instance, re-writes the returned response headers {@code etag}, + * {@code last-modified}, and {@code content-type}, as {@code Etag}, {@code Last-Modified}, and + * {@code Content-Type}, respectively, as expected by the Netty version the legacy + * {@code com.microsoft.azure:azure-storage-blob} dependency transitively carries over. */ public int getBlobsPort() { return super.getMappedPort(blobsPort); diff --git a/geowebcache/core/src/main/java/org/geowebcache/ClientStreamAbortedException.java b/geowebcache/core/src/main/java/org/geowebcache/ClientStreamAbortedException.java index 9aa31a2377..87046325b9 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/ClientStreamAbortedException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/ClientStreamAbortedException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -17,12 +16,11 @@ import java.io.IOException; /** - * An IOException that means a {@link - * ServiceStrategy#getDestination(javax.servlet.http.HttpServletResponse) ServiceStrategy's - * destination} IO operation has been abruptly interrupted while writing a response. + * An IOException that means a {@link ServiceStrategy#getDestination(javax.servlet.http.HttpServletResponse) + * ServiceStrategy's destination} IO operation has been abruptly interrupted while writing a response. * - *

This exception serves as an indicator to the dispatching system that there's no need to report - * the exception back to the client. + *

This exception serves as an indicator to the dispatching system that there's no need to report the exception back + * to the client. * * @author Gabriel Roldan (TOPP) * @version $Id$ diff --git a/geowebcache/core/src/main/java/org/geowebcache/DispatcherOutputStream.java b/geowebcache/core/src/main/java/org/geowebcache/DispatcherOutputStream.java index 623d764d87..15e548e14a 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/DispatcherOutputStream.java +++ b/geowebcache/core/src/main/java/org/geowebcache/DispatcherOutputStream.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -20,9 +19,8 @@ import javax.servlet.WriteListener; /** - * A wrapper for a Dispatcher destination output stream that signals {@link IOException}s thrown - * while writing to the underlying destination as ignorable for OWS exception reporting, by throwing - * a {@link ClientStreamAbortedException}. + * A wrapper for a Dispatcher destination output stream that signals {@link IOException}s thrown while writing to the + * underlying destination as ignorable for OWS exception reporting, by throwing a {@link ClientStreamAbortedException}. * * @author Gabriel Roldan (TOPP) * @version $Id$ diff --git a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCache.java b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCache.java index b85fc47c47..da047338f6 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCache.java +++ b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCache.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -18,8 +17,7 @@ public class GeoWebCache { /** @return current the GWC version */ - @SuppressWarnings( - "deprecation") // Package.getPackage is deprecated in java 11 but replacement is not + @SuppressWarnings("deprecation") // Package.getPackage is deprecated in java 11 but replacement is not // available in Java 8 public static String getVersion() { Package versionInfo = Package.getPackage("org.geowebcache"); @@ -28,8 +26,7 @@ public static String getVersion() { } /** @return the current build revision number/hash */ - @SuppressWarnings( - "deprecation") // Package.getPackage is deprecated in java 11 but replacement is not + @SuppressWarnings("deprecation") // Package.getPackage is deprecated in java 11 but replacement is not // available in Java 8 public static String getBuildRevision() { Package versionInfo = Package.getPackage("org.geowebcache"); diff --git a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheDispatcher.java b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheDispatcher.java index 3d155116fa..d271c7af25 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheDispatcher.java +++ b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheDispatcher.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -137,10 +136,7 @@ public void setDefaultStorageFinder(DefaultStorageFinder defaultStorageFinder) { this.defaultStorageFinder = defaultStorageFinder; } - /** - * GeoServer and other solutions that embedded this dispatcher will prepend a path, this is used - * to remove it. - */ + /** GeoServer and other solutions that embedded this dispatcher will prepend a path, this is used to remove it. */ public void setServletPrefix(String servletPrefix) { if (!servletPrefix.startsWith("/")) { this.servletPrefix = "/" + servletPrefix; @@ -150,20 +146,16 @@ public void setServletPrefix(String servletPrefix) { LOG.config("Invoked setServletPrefix(" + servletPrefix + ")"); } - /** - * GeoServer and other solutions that embedded this dispatcher will prepend a path, this is used - * to remove it. - */ + /** GeoServer and other solutions that embedded this dispatcher will prepend a path, this is used to remove it. */ public String getServletPrefix() { return servletPrefix; } /** - * Services convert HTTP requests into the internal grid representation and specify what layer - * the response should come from. + * Services convert HTTP requests into the internal grid representation and specify what layer the response should + * come from. * - *

The application context is scanned for objects extending Service, thereby making it easy - * to add new services. + *

The application context is scanned for objects extending Service, thereby making it easy to add new services. */ private Map loadServices() { LOG.info("Loading GWC Service extensions..."); @@ -174,15 +166,12 @@ private Map loadServices() { for (Service aService : plugins) { services.put(aService.getPathName(), aService); } - LOG.info( - "Done loading GWC Service extensions. Found : " - + new ArrayList<>(services.keySet())); + LOG.info("Done loading GWC Service extensions. Found : " + new ArrayList<>(services.keySet())); return services; } private void loadBlankTile() { - String blankTilePath = - defaultStorageFinder.findEnvVar(DefaultStorageFinder.GWC_BLANK_TILE_PATH); + String blankTilePath = defaultStorageFinder.findEnvVar(DefaultStorageFinder.GWC_BLANK_TILE_PATH); if (blankTilePath != null) { File fh = new File(blankTilePath); @@ -260,16 +249,15 @@ String normalizeURL(HttpServletRequest request) { *

If a tile is requested the request will be handed off to handleServiceRequest. */ @Override - protected ModelAndView handleRequestInternal( - HttpServletRequest request, HttpServletResponse originalResponse) throws Exception { + protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse originalResponse) + throws Exception { - HttpServletResponseWrapper response = - new HttpServletResponseWrapper(originalResponse) { - @Override - public ServletOutputStream getOutputStream() throws IOException { - return new DispatcherOutputStream(super.getOutputStream()); - } - }; + HttpServletResponseWrapper response = new HttpServletResponseWrapper(originalResponse) { + @Override + public ServletOutputStream getOutputStream() throws IOException { + return new DispatcherOutputStream(super.getOutputStream()); + } + }; // Break the request into components, {type, service name} String[] requestComps = null; @@ -290,8 +278,7 @@ public ServletOutputStream getOutputStream() throws IOException { || requestComps[0].equalsIgnoreCase(TYPE_DEMO + "s")) { handleDemoRequest(requestComps[1], request, response); } else { - ResponseUtils.writeErrorPage( - response, 404, "Unknown path: " + requestComps[0], runtimeStats); + ResponseUtils.writeErrorPage(response, 404, "Unknown path: " + requestComps[0], runtimeStats); } } catch (HttpErrorCodeException e) { ResponseUtils.writeFixedResponse( @@ -361,10 +348,7 @@ private boolean isClientStreamAbortedException(Throwable t) { return false; } - /** - * Destroy function, has to be referenced in bean declaration: ... - */ + /** Destroy function, has to be referenced in bean declaration: ... */ public void destroy() { LOG.fine("GeoWebCacheDispatcher.destroy() was invoked, shutting down."); } @@ -390,8 +374,7 @@ private String[] parseRequest(String servletPath) throws GeoWebCacheException { } /** This is the main method for handling service requests. See comments in the code. */ - private void handleServiceRequest( - String serviceStr, HttpServletRequest request, HttpServletResponse response) + private void handleServiceRequest(String serviceStr, HttpServletRequest request, HttpServletResponse response) throws Exception { Conveyor conv = null; @@ -407,11 +390,7 @@ private void handleServiceRequest( if (Objects.nonNull(layerName)) { layer = tileLayerDispatcher.getTileLayer(layerName); if (!layer.isEnabled()) { - throw new OWSException( - 400, - "InvalidParameterValue", - "LAYERS", - "Layer '" + layerName + "' is disabled"); + throw new OWSException(400, "InvalidParameterValue", "LAYERS", "Layer '" + layerName + "' is disabled"); } if (conv instanceof ConveyorTile) { ((ConveyorTile) conv).setTileLayer(layer); @@ -426,17 +405,11 @@ private void handleServiceRequest( service.handleRequest(conv); } else { ResponseUtils.writeTile( - getSecurityDispatcher(), - conv, - layerName, - tileLayerDispatcher, - defaultStorageFinder, - runtimeStats); + getSecurityDispatcher(), conv, layerName, tileLayerDispatcher, defaultStorageFinder, runtimeStats); } } - private void handleDemoRequest( - String action, HttpServletRequest request, HttpServletResponse response) + private void handleDemoRequest(String action, HttpServletRequest request, HttpServletResponse response) throws GeoWebCacheException { Demo.makeMap(tileLayerDispatcher, gridSetBroker, action, request, response); } @@ -489,48 +462,35 @@ private void handleFrontPage(HttpServletRequest request, HttpServletResponse res commitId = "{NO BUILD INFO IN MANIFEST}"; } - str.append( - "\n" - + ServletUtils.gwcHtmlHeader(baseUrl, "GWC Home") - + "\n" - + ServletUtils.gwcHtmlLogoLink(baseUrl)); - str.append( - "

Welcome to GeoWebCache version " - + version - + ", build " - + commitId - + "

\n"); - str.append( - "

GeoWebCache is an advanced tile cache for WMS servers."); + str.append("\n" + + ServletUtils.gwcHtmlHeader(baseUrl, "GWC Home") + + "\n" + + ServletUtils.gwcHtmlLogoLink(baseUrl)); + str.append("

Welcome to GeoWebCache version " + version + ", build " + commitId + "

\n"); + str.append("

GeoWebCache is an advanced tile cache for WMS servers."); str.append( "It supports a large variety of protocols and formats, including WMS-C, WMTS, KML, Google Maps and Virtual Earth.

"); str.append("

Automatically Generated Demos:

\n"); str.append( - "\n"); + "\n"); str.append("

GetCapabilities:

\n"); - str.append( - "\n"); if (runtimeStats != null) { str.append("

Runtime Statistics

\n"); str.append(runtimeStats.getHTMLStats()); str.append("\n"); } - if (!Boolean.parseBoolean( - GeoWebCacheExtensions.getProperty("GEOWEBCACHE_HIDE_STORAGE_LOCATIONS"))) { + if (!Boolean.parseBoolean(GeoWebCacheExtensions.getProperty("GEOWEBCACHE_HIDE_STORAGE_LOCATIONS"))) { appendStorageLocations(str); } @@ -539,8 +499,7 @@ private void handleFrontPage(HttpServletRequest request, HttpServletResponse res } str.append("\n"); - ResponseUtils.writePage( - response, 200, str.toString(), runtimeStats, MediaType.TEXT_HTML_VALUE); + ResponseUtils.writePage(response, 200, str.toString(), runtimeStats, MediaType.TEXT_HTML_VALUE); } private void appendStorageLocations(StringBuilder str) { @@ -602,8 +561,8 @@ private void appendStorageLocations(StringBuilder str) { } /** - * This method appends the cache statistics to the GWC homepage if the blobstore used is an - * instance of the {@link MemoryBlobStore} class + * This method appends the cache statistics to the GWC homepage if the blobstore used is an instance of the + * {@link MemoryBlobStore} class * * @param strGlobal Input {@link StringBuilder} containing the HTML for the GWC homepage */ @@ -667,9 +626,8 @@ private void appendInternalCacheStats(StringBuilder strGlobal) { str.append(""); - str.append( - "\n"); str.append(""); @@ -692,25 +650,20 @@ private void appendInternalCacheStats(StringBuilder strGlobal) { str.append(""); - str.append( - "\n"); str.append(""); - str.append( - "\n"); str.append(""); - str.append( - "\n"); str.append(""); diff --git a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheEnvironment.java b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheEnvironment.java index dbff374ceb..e3c7ba4bd2 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheEnvironment.java +++ b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheEnvironment.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Alessio Fabiani, GeoSolutions S.A.S., Copyright 2017 */ @@ -27,8 +26,7 @@ import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; /** - * Utility class uses to process GeoWebCache configuration workflow through external environment - * variables. + * Utility class uses to process GeoWebCache configuration workflow through external environment variables. * *

This class must be used everytime we need to resolve a configuration placeholder at runtime. * @@ -40,8 +38,8 @@ * * * - * It must be a singleton, and must not be loaded lazily. Furthermore, this bean must be loaded - * before any beans that use it. + * It must be a singleton, and must not be loaded lazily. Furthermore, this bean must be loaded before any beans that + * use it. * * @author Alessio Fabiani, GeoSolutions */ @@ -53,8 +51,8 @@ public class GeoWebCacheEnvironment { private static final Constants constants = new Constants(PlaceholderConfigurerSupport.class); /** - * Constant set via System Environment in order to instruct GeoWebCache to make use or not of - * the config placeholders translation. + * Constant set via System Environment in order to instruct GeoWebCache to make use or not of the config + * placeholders translation. * *

Default to FALSE */ @@ -63,15 +61,13 @@ public class GeoWebCacheEnvironment { private static final String nullValue = "null"; - private final PropertyPlaceholderHelper helper = - new PropertyPlaceholderHelper( - constants.asString("DEFAULT_PLACEHOLDER_PREFIX"), - constants.asString("DEFAULT_PLACEHOLDER_SUFFIX"), - constants.asString("DEFAULT_VALUE_SEPARATOR"), - true); + private final PropertyPlaceholderHelper helper = new PropertyPlaceholderHelper( + constants.asString("DEFAULT_PLACEHOLDER_PREFIX"), + constants.asString("DEFAULT_PLACEHOLDER_SUFFIX"), + constants.asString("DEFAULT_VALUE_SEPARATOR"), + true); - private final PlaceholderResolver resolver = - placeholderName -> resolvePlaceholder(placeholderName); + private final PlaceholderResolver resolver = placeholderName -> resolvePlaceholder(placeholderName); private Properties props; @@ -126,11 +122,10 @@ protected String resolveStringValue(String strVal) throws BeansException { } /** - * Translates placeholders in the form of Spring Property placemark ${...} into their real - * values. + * Translates placeholders in the form of Spring Property placemark ${...} into their real values. * - *

The method first looks for System variables which take precedence on local ones, then into - * internal props injected through the applicationContext. + *

The method first looks for System variables which take precedence on local ones, then into internal props + * injected through the applicationContext. */ public Object resolveValue(Object value) { if (value != null) { @@ -170,13 +165,11 @@ public Optional resolveValueIfEnabled(final String value, Integer intValue = Integer.valueOf(resultValue); return (Optional) Optional.of(intValue); } catch (NumberFormatException ex) { - throw new IllegalArgumentException( - "Illegal String parameter: Resolved value is not an integer.", ex); + throw new IllegalArgumentException("Illegal String parameter: Resolved value is not an integer.", ex); } } else if (type.isAssignableFrom(Boolean.class)) { if (!validateBoolean(resultValue)) - throw new IllegalArgumentException( - "Illegal String parameter: Resolved value is not a boolean."); + throw new IllegalArgumentException("Illegal String parameter: Resolved value is not a boolean."); Boolean boolValue = Boolean.valueOf(value); return (Optional) Optional.of(boolValue); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheException.java b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheException.java index 3f1508bf1b..39eb5aa0c1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensionPriority.java b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensionPriority.java index 27a03aed7e..1e3c6f8f64 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensionPriority.java +++ b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensionPriority.java @@ -1,22 +1,20 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ package org.geowebcache; /** - * Interface implemented by extensions which require control over the order in which they are - * processed. + * Interface implemented by extensions which require control over the order in which they are processed. * *

This the same interface of GeoServer extension priority. */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensions.java b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensions.java index 8cee7cd9ac..056988ba43 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensions.java +++ b/geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheExtensions.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -42,11 +41,10 @@ *

  *         <bean id="gwowebCacheExtensions" class="org.geowebcache.GeoWebCacheExtensions"/>
  *         
- * It must be a singleton, and must not be loaded lazily. Furthermore, this bean must be - * loaded before any beans that use it. + * It must be a singleton, and must not be loaded lazily. Furthermore, this bean must be loaded before any beans + * that use it. * - *

Priority will be respected for extensions that implement {@link GeoWebCacheExtensionPriority} - * interface. + *

Priority will be respected for extensions that implement {@link GeoWebCacheExtensionPriority} interface. * * @author Gabriel Roldan based on GeoServer's {@code GeoServerExtensions} */ @@ -56,9 +54,8 @@ public class GeoWebCacheExtensions implements ApplicationContextAware, Applicati private static Logger LOGGER = Logging.getLogger(GeoWebCacheExtensions.class.getName()); /** - * Caches the names of the beans for a particular type, so that the lookup (expensive) wont' be - * needed. We cache names instead of beans because doing the latter we would break the - * "singleton=false" directive of some beans + * Caches the names of the beans for a particular type, so that the lookup (expensive) wont' be needed. We cache + * names instead of beans because doing the latter we would break the "singleton=false" directive of some beans */ static WeakHashMap, String[]> extensionsCache = new WeakHashMap<>(40); @@ -68,8 +65,8 @@ public class GeoWebCacheExtensions implements ApplicationContextAware, Applicati /** * Sets the web application context to be used for looking up extensions. * - *

This method is called by the spring container, and should never be called by client code. - * If client needs to supply a particular context, methods which take a context are available. + *

This method is called by the spring container, and should never be called by client code. If client needs to + * supply a particular context, methods which take a context are available. * *

This is the context that is used for methods which dont supply their own context. */ @@ -88,8 +85,7 @@ public void setApplicationContext(ApplicationContext context) throws BeansExcept * @return A collection of the extensions, or an empty collection. */ @SuppressWarnings("unchecked") - public static final List extensions( - Class extensionPoint, ApplicationContext context) { + public static final List extensions(Class extensionPoint, ApplicationContext context) { String[] names; if (GeoWebCacheExtensions.context == context) { names = extensionsCache.get(extensionPoint); @@ -128,12 +124,11 @@ public static final List extensions( } /** - * Return all bean names that correspond to the provided extension type. If the provided - * extensions type implements the {@link GeoWebCacheExtensionPriority} interface, they are - * returned sorted by priority + * Return all bean names that correspond to the provided extension type. If the provided extensions type implements + * the {@link GeoWebCacheExtensionPriority} interface, they are returned sorted by priority * - *

We return the bean names and not the beans themselves because we cache the beans by name - * rather than the bean itself to avoid breaking the singleton directive. + *

We return the bean names and not the beans themselves because we cache the beans by name rather than the bean + * itself to avoid breaking the singleton directive. * * @param extensionType type of beans to return * @return Array of sorted bean names @@ -143,16 +138,14 @@ public static String[] getBeansNamesOrderedByPriority(Class extensionType } /** - * We lookup all the beans names that correspond to the provided extension type. If the provided - * extensions type implements the {@link GeoWebCacheExtensionPriority} interface we sort the - * beans names by their priority. + * We lookup all the beans names that correspond to the provided extension type. If the provided extensions type + * implements the {@link GeoWebCacheExtensionPriority} interface we sort the beans names by their priority. * - *

We return the bean names and not the beans themselves because we cache the beans by name - * rather than the bean itself to avoid breaking the singleton directive. + *

We return the bean names and not the beans themselves because we cache the beans by name rather than the bean + * itself to avoid breaking the singleton directive. */ @SuppressWarnings("unchecked") - private static String[] getBeansNamesOrderedByPriority( - Class extensionType, ApplicationContext context) { + private static String[] getBeansNamesOrderedByPriority(Class extensionType, ApplicationContext context) { // asking spring for a map that will contains all beans that match the extensions type // indexed by their name Map beans = context.getBeansOfType(extensionType); @@ -163,22 +156,16 @@ private static String[] getBeansNamesOrderedByPriority( // this extension type is priority aware List> beansEntries = new ArrayList<>(beans.entrySet()); // sorting beans by their priority - Collections.sort( - beansEntries, - (extensionA, extensionB) -> { - GeoWebCacheExtensionPriority extensionPriorityA = - ((Map.Entry) extensionA) - .getValue(); - GeoWebCacheExtensionPriority extensionPriorityB = - ((Map.Entry) extensionB) - .getValue(); - if (extensionPriorityA.getPriority() < extensionPriorityB.getPriority()) { - return -1; - } - return extensionPriorityA.getPriority() == extensionPriorityB.getPriority() - ? 0 - : 1; - }); + Collections.sort(beansEntries, (extensionA, extensionB) -> { + GeoWebCacheExtensionPriority extensionPriorityA = + ((Map.Entry) extensionA).getValue(); + GeoWebCacheExtensionPriority extensionPriorityB = + ((Map.Entry) extensionB).getValue(); + if (extensionPriorityA.getPriority() < extensionPriorityB.getPriority()) { + return -1; + } + return extensionPriorityA.getPriority() == extensionPriorityB.getPriority() ? 0 : 1; + }); // returning only the beans names return beansEntries.stream().map(Map.Entry::getKey).toArray(String[]::new); } @@ -186,8 +173,8 @@ private static String[] getBeansNamesOrderedByPriority( /** * Loads all extensions implementing or extending extensionPoint. * - *

This method uses the "default" application context to perform the lookup. See {@link - * #setApplicationContext(ApplicationContext)}. + *

This method uses the "default" application context to perform the lookup. See + * {@link #setApplicationContext(ApplicationContext)}. * * @param extensionPoint The class or interface of the extensions. * @return A collection of the extensions, or an empty collection. @@ -204,11 +191,7 @@ public static final List extensions(Class extensionPoint) { public static List configurations( Class extensionPoint, ApplicationContext context) { return extensions(extensionPoint, context).stream() - .sorted( - (x, y) -> - Integer.signum( - x.getPriority(extensionPoint) - - y.getPriority(extensionPoint))) + .sorted((x, y) -> Integer.signum(x.getPriority(extensionPoint) - y.getPriority(extensionPoint))) .collect(Collectors.toList()); } @@ -237,10 +220,7 @@ public static void reinitialize(ApplicationContext context) { + ((BaseConfiguration) bean).getLocation(), e); } else { - LOGGER.log( - Level.SEVERE, - "Error while preparing bean to reinitialize " + bean.toString(), - e); + LOGGER.log(Level.SEVERE, "Error while preparing bean to reinitialize " + bean.toString(), e); } } } @@ -257,8 +237,7 @@ public static void reinitialize(ApplicationContext context) { + ((BaseConfiguration) bean).getLocation(), e); } else { - LOGGER.log( - Level.SEVERE, "Error while reinitializing bean " + bean.toString(), e); + LOGGER.log(Level.SEVERE, "Error while reinitializing bean " + bean.toString(), e); } } } @@ -278,12 +257,11 @@ public static final Object bean(String name, ApplicationContext context) { /** * Loads a single bean by its type. * - *

This method returns null if there is no such bean. An exception is thrown if multiple - * beans of the specified type exist. + *

This method returns null if there is no such bean. An exception is thrown if multiple beans of the specified + * type exist. * * @param type THe type of the bean to lookup. - * @throws IllegalArgumentException If there are multiple beans of the specified type in the - * context. + * @throws IllegalArgumentException If there are multiple beans of the specified type in the context. */ public static final T bean(Class type) throws IllegalArgumentException { checkContext(context); @@ -293,16 +271,14 @@ public static final T bean(Class type) throws IllegalArgumentException { /** * Loads a single bean by its type from the specified application context. * - *

This method returns null if there is no such bean. An exception is thrown if multiple - * beans of the specified type exist. + *

This method returns null if there is no such bean. An exception is thrown if multiple beans of the specified + * type exist. * * @param type THe type of the bean to lookup. * @param context The application context - * @throws IllegalArgumentException If there are multiple beans of the specified type in the - * context. + * @throws IllegalArgumentException If there are multiple beans of the specified type in the context. */ - public static final T bean(Class type, ApplicationContext context) - throws IllegalArgumentException { + public static final T bean(Class type, ApplicationContext context) throws IllegalArgumentException { List beans = extensions(type, context); if (beans.isEmpty()) { return null; @@ -328,11 +304,11 @@ static void checkContext(ApplicationContext context) { } /** - * Looks up for a named string property in the order defined by {@link #getProperty(String, - * ApplicationContext)} using the internally cached spring application context. + * Looks up for a named string property in the order defined by {@link #getProperty(String, ApplicationContext)} + * using the internally cached spring application context. * - *

Care should be taken when using this method. It should not be called during startup or - * from tests cases as the internal context will not have been set. + *

Care should be taken when using this method. It should not be called during startup or from tests cases as the + * internal context will not have been set. * * @param propertyName The property name to lookup. * @return The property value, or null if not found @@ -387,9 +363,7 @@ public static String getProperty(String propertyName, ServletContext context) { // than strictly necessary final String[] typeStrs = { - "Java environment variable ", - "Servlet context parameter ", - "System environment variable " + "Java environment variable ", "Servlet context parameter ", "System environment variable " }; String result = null; diff --git a/geowebcache/core/src/main/java/org/geowebcache/ReinitializingBean.java b/geowebcache/core/src/main/java/org/geowebcache/ReinitializingBean.java index ecaf9f7fba..e9f804a352 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/ReinitializingBean.java +++ b/geowebcache/core/src/main/java/org/geowebcache/ReinitializingBean.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/UncheckedGeoWebCacheException.java b/geowebcache/core/src/main/java/org/geowebcache/UncheckedGeoWebCacheException.java index 68e6b4213a..2d6b670259 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/UncheckedGeoWebCacheException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/UncheckedGeoWebCacheException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/BaseConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/BaseConfiguration.java index 1cb334990c..efe672a230 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/BaseConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/BaseConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -19,8 +18,7 @@ import org.springframework.beans.factory.InitializingBean; /** Superinterface for GeoWebCache configuration beans, defining basic shared functionality */ -public interface BaseConfiguration - extends InitializingBean, ReinitializingBean, GeoWebCacheExtensionPriority { +public interface BaseConfiguration extends InitializingBean, ReinitializingBean, GeoWebCacheExtensionPriority { /** Default priority for configuration beans. Lower values will have higher priority. */ public static final int BASE_PRIORITY = 50; @@ -29,10 +27,9 @@ public interface BaseConfiguration String getIdentifier(); /** - * The location is a string identifying where this configuration is persisted - * TileLayerConfiguration implementations may choose whatever form is appropriate to their - * persistence mechanism and callers should not assume any particular format. In many but not - * all cases this will be a URL or filesystem path. + * The location is a string identifying where this configuration is persisted TileLayerConfiguration implementations + * may choose whatever form is appropriate to their persistence mechanism and callers should not assume any + * particular format. In many but not all cases this will be a URL or filesystem path. * * @return Location string for this configuration */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfiguration.java index 2afa9b6671..1a038f574d 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -25,18 +24,16 @@ public interface BlobStoreConfiguration extends BaseConfiguration { /** * Retrieves currently configured BlobStores. * - * @return A List of {@link BlobStoreInfo}s currently configured via backend configuration - * providers. + * @return A List of {@link BlobStoreInfo}s currently configured via backend configuration providers. */ List getBlobStores(); /** * Add and persist a {@link BlobStoreInfo} to this configuration. * - * @param info The {@link BlobStoreInfo} configuration to add and persist into the backend - * configuration provider. - * @throws IllegalArgumentException If the info is not a valid BlobStoreInfo, or can't be - * added/persisted for some reason (for example, an info with the same name already exists). + * @param info The {@link BlobStoreInfo} configuration to add and persist into the backend configuration provider. + * @throws IllegalArgumentException If the info is not a valid BlobStoreInfo, or can't be added/persisted for some + * reason (for example, an info with the same name already exists). */ void addBlobStore(BlobStoreInfo info) throws IllegalArgumentException; @@ -44,31 +41,27 @@ public interface BlobStoreConfiguration extends BaseConfiguration { * Remove a {@link BlobStoreInfo} from this configuration. * * @param name String representation of the id of the BlobStore to remove. This - * @throws NoSuchElementException If there is no BlobStore config identified by the provided - * name. - * @throws IllegalArgumentException If this configuration can't, for some reason, remove the - * blob store identified by the supplied name (for example, the configuration is read-only). + * @throws NoSuchElementException If there is no BlobStore config identified by the provided name. + * @throws IllegalArgumentException If this configuration can't, for some reason, remove the blob store identified + * by the supplied name (for example, the configuration is read-only). */ void removeBlobStore(String name) throws NoSuchElementException, IllegalArgumentException; /** * Modifies a {@link BlobStoreInfo} in this configuration. * - * @param info The {@link BlobStoreInfo} that should be used to update an existing BlobStoreInfo - * with the same name/id. - * @throws NoSuchElementException If there is no BlobStore config identified by the provided - * name. - * @throws IllegalArgumentException If this configuration can't, for some reason, modify the - * blob store identified by the supplied name (for example, the configuration is read-only). + * @param info The {@link BlobStoreInfo} that should be used to update an existing BlobStoreInfo with the same + * name/id. + * @throws NoSuchElementException If there is no BlobStore config identified by the provided name. + * @throws IllegalArgumentException If this configuration can't, for some reason, modify the blob store identified + * by the supplied name (for example, the configuration is read-only). */ - void modifyBlobStore(BlobStoreInfo info) - throws NoSuchElementException, IllegalArgumentException; + void modifyBlobStore(BlobStoreInfo info) throws NoSuchElementException, IllegalArgumentException; /** * Retrieve a set of {@link BlobStoreInfo} names in this configuration. * - * @return A Set of names that can be used to identify each of the {@link BlobStoreInfo}s - * currently configured. + * @return A Set of names that can be used to identify each of the {@link BlobStoreInfo}s currently configured. */ Set getBlobStoreNames(); @@ -83,8 +76,7 @@ void modifyBlobStore(BlobStoreInfo info) * Retrieves a {@link BlobStoreInfo} from this configuration. * * @param name The name that identifies the desired {@link BlobStoreInfo}. - * @return An Optional wrapping the desired {@link BlobStoreInfo}, or Empty if it does not - * exist. + * @return An Optional wrapping the desired {@link BlobStoreInfo}, or Empty if it does not exist. */ Optional getBlobStore(String name); @@ -92,8 +84,8 @@ void modifyBlobStore(BlobStoreInfo info) * Indicates if this configuration can persist the supplied {@link BlobStoreInfo}. * * @param info a {@link BlobStoreInfo} to be persisted. - * @return True if the supplied {@link BlobStoreInfo} can be persisted, false otherwise. - * Implementations might return false if, for example, this configuration is read-only. + * @return True if the supplied {@link BlobStoreInfo} can be persisted, false otherwise. Implementations might + * return false if, for example, this configuration is read-only. */ boolean canSave(BlobStoreInfo info); @@ -101,15 +93,12 @@ void modifyBlobStore(BlobStoreInfo info) * Replaces a {@link BlobStoreInfo}'s name with a new name. * * @param oldName The name that identifies the {@link BlobStoreInfo} to be renamed. - * @param newName The name that should replace the current name of the {@link BlobStoreInfo} - * identified by oldName. - * @throws NoSuchElementException If there is no BlobStore config identified by the provided - * oldName. - * @throws IllegalArgumentException If this configuration can't, for some reason, rename the - * blob store identified by the supplied name (for example, newName is null or invalid). + * @param newName The name that should replace the current name of the {@link BlobStoreInfo} identified by oldName. + * @throws NoSuchElementException If there is no BlobStore config identified by the provided oldName. + * @throws IllegalArgumentException If this configuration can't, for some reason, rename the blob store identified + * by the supplied name (for example, newName is null or invalid). */ - void renameBlobStore(String oldName, String newName) - throws NoSuchElementException, IllegalArgumentException; + void renameBlobStore(String oldName, String newName) throws NoSuchElementException, IllegalArgumentException; /** * Indicates if this configurations contains a {@link BlobStoreInfo) identified by a given name. @@ -121,8 +110,6 @@ void renameBlobStore(String oldName, String newName) /** Adds a {@link BlobStoreConfigurationListener} to this configuration. */ void addBlobStoreListener(BlobStoreConfigurationListener listener); - /** - * Removes a {@link BlobStoreConfigurationListener} from this configuration, if it is present. - */ + /** Removes a {@link BlobStoreConfigurationListener} from this configuration, if it is present. */ void removeBlobStoreListener(BlobStoreConfigurationListener listener); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfigurationListener.java b/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfigurationListener.java index abf7606c0f..8ae350cf5b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfigurationListener.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreConfigurationListener.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -19,28 +18,26 @@ import org.geowebcache.storage.UnsuitableStorageException; /** - * Indicates a class should listen to {@link BlobStoreConfiguration} change events. Implementations - * of this class are responsible for registering themselves via {@link - * org.geowebcache.storage.BlobStoreAggregator} + * Indicates a class should listen to {@link BlobStoreConfiguration} change events. Implementations of this class are + * responsible for registering themselves via {@link org.geowebcache.storage.BlobStoreAggregator} */ public interface BlobStoreConfigurationListener { /** * @param newBlobStore The configuration for the blobstore that was added - * @throws UnsuitableStorageException The blobstore is attempting to use an illegal storage - * location and the change should be rolled back. + * @throws UnsuitableStorageException The blobstore is attempting to use an illegal storage location and the change + * should be rolled back. */ void handleAddBlobStore(BlobStoreInfo newBlobStore) throws UnsuitableStorageException, GeoWebCacheException, IOException; /** @param removedBlobStore The old configuration for the blobstore that was removed */ - void handleRemoveBlobStore(BlobStoreInfo removedBlobStore) - throws GeoWebCacheException, IOException; + void handleRemoveBlobStore(BlobStoreInfo removedBlobStore) throws GeoWebCacheException, IOException; /** * @param modifiedBlobStore The new configuration for the blobstore - * @throws UnsuitableStorageException The blobstore is attempting to use an illegal storage - * location and the change should be rolled back. + * @throws UnsuitableStorageException The blobstore is attempting to use an illegal storage location and the change + * should be rolled back. */ void handleModifyBlobStore(BlobStoreInfo modifiedBlobStore) throws UnsuitableStorageException, GeoWebCacheException, IOException; diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreInfo.java b/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreInfo.java index a00946dc9a..972a4f3617 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreInfo.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/BlobStoreInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Gabriel Roldan, Boundless Spatial Inc, Copyright 2015 */ @@ -24,17 +23,15 @@ /** * Base class for configuration and factory of concrete {@link BlobStore} implementations. * - *

Each realization of {@link BlobStore} should have a matching {@link BlobStoreInfo} subclass - * that acts both as configuration and {@link #createInstance(TileLayerDispatcher, LockProvider)} - * factory}. + *

Each realization of {@link BlobStore} should have a matching {@link BlobStoreInfo} subclass that acts both as + * configuration and {@link #createInstance(TileLayerDispatcher, LockProvider)} factory}. * - *

Instances of this concrete subclasses of this class are meant to be obtained from {@link - * BlobStoreAggregator#getBlobStores()}. + *

Instances of this concrete subclasses of this class are meant to be obtained from + * {@link BlobStoreAggregator#getBlobStores()}. * - *

When a blob store is defined in a module other than core, it is advisable that whatever {@code - * XStream} configuration needed for correct parsing and encoding of the configuration object is - * contributed through an {@link XMLConfigurationProvider}, such as class to xml element name - * aliasing, attribute mappings, etc. + *

When a blob store is defined in a module other than core, it is advisable that whatever {@code XStream} + * configuration needed for correct parsing and encoding of the configuration object is contributed through an + * {@link XMLConfigurationProvider}, such as class to xml element name aliasing, attribute mappings, etc. * * @since 1.8 * @see FileBlobStoreInfo @@ -67,10 +64,7 @@ public String getName() { return name; } - /** - * @return the unique identifier for the blob store; which {@link TileLayer#getBlobStoreId()} - * refers to. - */ + /** @return the unique identifier for the blob store; which {@link TileLayer#getBlobStoreId()} refers to. */ public String getId() { return getName(); } @@ -108,18 +102,16 @@ public void setEnabled(boolean enabled) { } /** - * @return whether the blob store defined by these settings is the default one (i.e. the one - * used when {@code TileLayer#getBlobStoreId() == null}, and hence used to preserve - * backwards compatibility). + * @return whether the blob store defined by these settings is the default one (i.e. the one used when + * {@code TileLayer#getBlobStoreId() == null}, and hence used to preserve backwards compatibility). */ public boolean isDefault() { return _default; } /** - * Sets whether the blob store defined by these settings is the default one (i.e. the one used - * when {@code TileLayer#getBlobStoreId() == null}, and hence used to preserve backwards - * compatibility). + * Sets whether the blob store defined by these settings is the default one (i.e. the one used when + * {@code TileLayer#getBlobStoreId() == null}, and hence used to preserve backwards compatibility). * * @param def True if this BlobStoreInfo should be the default, false otherwise. */ @@ -140,15 +132,13 @@ public Object clone() { } /** - * Factory method for this class of blobstore, configured as per this configuration object - * properties. + * Factory method for this class of blobstore, configured as per this configuration object properties. * *

May only be called if {@link #isEnabled() == true}. * * @return A BlobStore implementation. * @throws StorageException if the blob store can't be created with this configuration settings - * @throws IllegalStateException if {@link #isEnabled() isEnabled() == false} or {@link #getId() - * getId() == null} + * @throws IllegalStateException if {@link #isEnabled() isEnabled() == false} or {@link #getId() getId() == null} */ public abstract BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) throws StorageException; diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationAggregator.java b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationAggregator.java index 2a21a296d0..7c78ceb609 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationAggregator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationAggregator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationException.java b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationException.java index ffb31f4799..7750cdd5eb 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -17,8 +16,8 @@ import org.geowebcache.GeoWebCacheException; /** - * An exception which indicates there was an error accessing a {@link BaseConfiguration - * configuration} or {@link Info configuration object}. + * An exception which indicates there was an error accessing a {@link BaseConfiguration configuration} or {@link Info + * configuration object}. */ public class ConfigurationException extends GeoWebCacheException { diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationPersistenceException.java b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationPersistenceException.java index 12b4c3dd1c..4a6c75d6bd 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationPersistenceException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationPersistenceException.java @@ -1,22 +1,21 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ package org.geowebcache.config; /** - * An exception which indicates there was an error persisting a {@link Info configuration object} to - * a {@link BaseConfiguration configuration}. + * An exception which indicates there was an error persisting a {@link Info configuration object} to a + * {@link BaseConfiguration configuration}. */ public class ConfigurationPersistenceException extends RuntimeException { diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationResourceProvider.java b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationResourceProvider.java index fb00152ff4..eeae21aa7c 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationResourceProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ConfigurationResourceProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Niels Charlier Copyright 2015 */ @@ -41,11 +40,11 @@ public interface ConfigurationResourceProvider { public String getLocation() throws IOException; /** - * Allows to set the location of the template file to create geowebcache.xml from when it's not - * found in the cache directory. + * Allows to set the location of the template file to create geowebcache.xml from when it's not found in the cache + * directory. * - * @param templateLocation location of the template geowebcache.xml file, must be a classpath - * location. If not set defaults to /geowebcache.xml + * @param templateLocation location of the template geowebcache.xml file, must be a classpath location. If not set + * defaults to /geowebcache.xml */ public void setTemplate(String templateLocation); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ContextualConfigurationProvider.java b/geowebcache/core/src/main/java/org/geowebcache/config/ContextualConfigurationProvider.java index a1db13d3b7..89f05d82d1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ContextualConfigurationProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ContextualConfigurationProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java b/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java index 905fb0f4f9..ab4c7366a8 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -77,10 +76,10 @@ public GridSet worldMercatorWGS84Quad() { /** * Construct the default gridsets bean * - * @param useEPSG900913 Whether or not to use "EPSG:900913" as the name of the default web - * mercator instead if "EPSG:3857". Only used if useGWC11xNames is true - * @param useGWC11xNames Whether to use the legacy GeoWebCache 1.1.x naming scheme (EPSG codes) - * for the default gridset names. Otherwise + * @param useEPSG900913 Whether or not to use "EPSG:900913" as the name of the default web mercator instead if + * "EPSG:3857". Only used if useGWC11xNames is true + * @param useGWC11xNames Whether to use the legacy GeoWebCache 1.1.x naming scheme (EPSG codes) for the default + * gridset names. Otherwise */ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { @@ -96,86 +95,76 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { } } - WORLD_EPSG4326 = - GridSetFactory.createGridSet( - unprojectedName, - SRS.getEPSG4326(), - BoundingBox.WORLD4326, - false, - GridSetFactory.DEFAULT_LEVELS, - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - 256, - 256, - true); - WORLD_EPSG4326.setDescription( - "A default WGS84 tile matrix set where the first zoom level " - + "covers the world with two tiles on the horizontal axis and one tile " - + "over the vertical axis and each subsequent zoom level is calculated by half " - + "the resolution of its previous one. Tiles are 256px wide."); + WORLD_EPSG4326 = GridSetFactory.createGridSet( + unprojectedName, + SRS.getEPSG4326(), + BoundingBox.WORLD4326, + false, + GridSetFactory.DEFAULT_LEVELS, + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + 256, + 256, + true); + WORLD_EPSG4326.setDescription("A default WGS84 tile matrix set where the first zoom level " + + "covers the world with two tiles on the horizontal axis and one tile " + + "over the vertical axis and each subsequent zoom level is calculated by half " + + "the resolution of its previous one. Tiles are 256px wide."); addInternal(WORLD_EPSG4326); - WORLD_EPSG4326x2 = - GridSetFactory.createGridSet( - unprojectedName + "x2", - SRS.getEPSG4326(), - BoundingBox.WORLD4326, - false, - GridSetFactory.DEFAULT_LEVELS, - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - 512, - 512, - true); - WORLD_EPSG4326x2.setDescription( - "A default WGS84 tile matrix set where the first zoom level " - + "covers the world with two tiles on the horizontal axis and one tile " - + "over the vertical axis and each subsequent zoom level is calculated by half " - + "the resolution of its previous one. Tiles are 512px wide."); + WORLD_EPSG4326x2 = GridSetFactory.createGridSet( + unprojectedName + "x2", + SRS.getEPSG4326(), + BoundingBox.WORLD4326, + false, + GridSetFactory.DEFAULT_LEVELS, + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + 512, + 512, + true); + WORLD_EPSG4326x2.setDescription("A default WGS84 tile matrix set where the first zoom level " + + "covers the world with two tiles on the horizontal axis and one tile " + + "over the vertical axis and each subsequent zoom level is calculated by half " + + "the resolution of its previous one. Tiles are 512px wide."); addInternal(WORLD_EPSG4326x2); final SRS googleMapsCompatibleSRS = useEPSG900913 ? SRS.getEPSG900913() : SRS.getEPSG3857(); - log.fine( - "Adding " - + googleMapsCompatibleSRS - + " grid set for Spherical Mercator / GoogleMapsCompatible"); - - WORLD_EPSG3857 = - GridSetFactory.createGridSet( - mercatorName, - googleMapsCompatibleSRS, - BoundingBox.WORLD3857, - false, - commonPractice900913Resolutions(), - null, - 1.0D, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - null, - 256, - 256, - false); - WORLD_EPSG3857.setDescription( - "This well-known scale set has been defined to be compatible with Google Maps and" - + " Microsoft Live Map projections and zoom levels. Level 0 allows representing the whole " - + "world in a single 256x256 pixels. The next level represents the whole world in 2x2 tiles " - + "of 256x256 pixels and so on in powers of 2. Scale denominator is only accurate near the equator."); + log.fine("Adding " + googleMapsCompatibleSRS + " grid set for Spherical Mercator / GoogleMapsCompatible"); + + WORLD_EPSG3857 = GridSetFactory.createGridSet( + mercatorName, + googleMapsCompatibleSRS, + BoundingBox.WORLD3857, + false, + commonPractice900913Resolutions(), + null, + 1.0D, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + null, + 256, + 256, + false); + WORLD_EPSG3857.setDescription("This well-known scale set has been defined to be compatible with Google Maps and" + + " Microsoft Live Map projections and zoom levels. Level 0 allows representing the whole " + + "world in a single 256x256 pixels. The next level represents the whole world in 2x2 tiles " + + "of 256x256 pixels and so on in powers of 2. Scale denominator is only accurate near the equator."); addInternal(WORLD_EPSG3857); - WORLD_EPSG3857x2 = - GridSetFactory.createGridSet( - mercatorName + "x2", - googleMapsCompatibleSRS, - BoundingBox.WORLD3857, - false, - halveResolutions(commonPractice900913Resolutions()), - null, - 1.0D, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - null, - 512, - 512, - false); + WORLD_EPSG3857x2 = GridSetFactory.createGridSet( + mercatorName + "x2", + googleMapsCompatibleSRS, + BoundingBox.WORLD3857, + false, + halveResolutions(commonPractice900913Resolutions()), + null, + 1.0D, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + null, + 512, + 512, + false); WORLD_EPSG3857x2.setDescription( "This well-known scale set has been defined to be compatible with Google Maps and" + " Microsoft Live Map projections and zoom levels. Level 0 allows representing the whole " @@ -184,65 +173,60 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { addInternal(WORLD_EPSG3857x2); log.fine("Adding GlobalCRS84Pixel"); - GridSet GlobalCRS84Pixel = - GridSetFactory.createGridSet( - "GlobalCRS84Pixel", - SRS.getEPSG4326(), - BoundingBox.WORLD4326, - true, - scalesCRS84PixelResolutions(), - null, - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - null, - 256, - 256, - true); - GlobalCRS84Pixel.setDescription( - "This well-known scale set has been defined for global cartographic products. " - + "Rounded pixel sizes have been chosen for intuitive cartographic representation of raster data. " - + "Some values have been chosen to coincide with original pixel size of commonly used global" - + "products like STRM (1\" and 3\"), GTOPO (30\") or ETOPO (2' and 5'). Scale denominator" - + "and approximated pixel size in meters are only accurate near the equator."); + GridSet GlobalCRS84Pixel = GridSetFactory.createGridSet( + "GlobalCRS84Pixel", + SRS.getEPSG4326(), + BoundingBox.WORLD4326, + true, + scalesCRS84PixelResolutions(), + null, + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + null, + 256, + 256, + true); + GlobalCRS84Pixel.setDescription("This well-known scale set has been defined for global cartographic products. " + + "Rounded pixel sizes have been chosen for intuitive cartographic representation of raster data. " + + "Some values have been chosen to coincide with original pixel size of commonly used global" + + "products like STRM (1\" and 3\"), GTOPO (30\") or ETOPO (2' and 5'). Scale denominator" + + "and approximated pixel size in meters are only accurate near the equator."); addInternal(GlobalCRS84Pixel); log.fine("Adding GlobalCRS84Scale"); - GridSet GlobalCRS84Scale = - GridSetFactory.createGridSet( - "GlobalCRS84Scale", - SRS.getEPSG4326(), - BoundingBox.WORLD4326, - true, - null, - scalesCRS84ScaleDenominators(), - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - null, - 256, - 256, - true); - GlobalCRS84Scale.setDescription( - "This well-known scale set has been defined for global cartographic products. " - + "Rounded scales have been chosen for intuitive cartographic representation of vector data. " - + "Scale denominator is only accurate near the equator."); + GridSet GlobalCRS84Scale = GridSetFactory.createGridSet( + "GlobalCRS84Scale", + SRS.getEPSG4326(), + BoundingBox.WORLD4326, + true, + null, + scalesCRS84ScaleDenominators(), + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + null, + 256, + 256, + true); + GlobalCRS84Scale.setDescription("This well-known scale set has been defined for global cartographic products. " + + "Rounded scales have been chosen for intuitive cartographic representation of vector data. " + + "Scale denominator is only accurate near the equator."); addInternal(GlobalCRS84Scale); log.fine("Adding GoogleCRS84Quad"); - GridSet GoogleCRS84Quad = - GridSetFactory.createGridSet( - "GoogleCRS84Quad", - SRS.getEPSG4326(), - BoundingBox.WORLD4326, - true, - null, - scalesCRS84QuadScaleDenominators(), - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - null, - 256, - 256, - true); + GridSet GoogleCRS84Quad = GridSetFactory.createGridSet( + "GoogleCRS84Quad", + SRS.getEPSG4326(), + BoundingBox.WORLD4326, + true, + null, + scalesCRS84QuadScaleDenominators(), + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + null, + 256, + 256, + true); GoogleCRS84Quad.setDescription( "This well-known scale set has been defined to allow quadtree " + "pyramids in CRS84. Level 0 allows representing the whole world " @@ -253,49 +237,48 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { addInternal(GoogleCRS84Quad); log.fine("Adding OGC TMS WebMercatorQuad"); - WEB_MERCATOR_QUAD = - GridSetFactory.createGridSet( - "WebMercatorQuad", - SRS.getEPSG3857(), - BoundingBox.WORLD3857, - true, - null, - new double[] { - 559082264.028717, - 279541132.014358, - 139770566.007179, - 69885283.0035897, - 34942641.5017948, - 17471320.7508974, - 8735660.37544871, - 4367830.18772435, - 2183915.09386217, - 1091957.54693108, - 545978.773465544, - 272989.386732772, - 136494.693366386, - 68247.346683193, - 34123.6733415964, - 17061.8366707982, - 8530.91833539913, - 4265.45916769956, - 2132.72958384978, - 1066.36479192489, - 533.182395962445, - 266.591197981222, - 133.295598990611, - 66.6477994953056, - 33.3238997476528 - }, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" - }, - 256, - 256, - true); + WEB_MERCATOR_QUAD = GridSetFactory.createGridSet( + "WebMercatorQuad", + SRS.getEPSG3857(), + BoundingBox.WORLD3857, + true, + null, + new double[] { + 559082264.028717, + 279541132.014358, + 139770566.007179, + 69885283.0035897, + 34942641.5017948, + 17471320.7508974, + 8735660.37544871, + 4367830.18772435, + 2183915.09386217, + 1091957.54693108, + 545978.773465544, + 272989.386732772, + 136494.693366386, + 68247.346683193, + 34123.6733415964, + 17061.8366707982, + 8530.91833539913, + 4265.45916769956, + 2132.72958384978, + 1066.36479192489, + 533.182395962445, + 266.591197981222, + 133.295598990611, + 66.6477994953056, + 33.3238997476528 + }, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", + "18", "19", "20", "21", "22", "23", "24" + }, + 256, + 256, + true); // copied from the OGC TMS spec WEB_MERCATOR_QUAD.setDescription( "This tile matrix set is the most used tile matrix set in the mass market: for example, by Google Maps, Microsoft Bing Maps and Open Street Map tiles. Nevertheless, it has been long criticized because it is a based on a spherical Mercator instead of an ellipsoid. The use of WebMercatorQuad should be limited to visualization. Any additional use (including distance measurements, routing etc.) needs to use the Mercator spherical expressions to transform the coordinate to an appropriate CRS first. The risks caused by imprecision in the use of Web Mercator is also emphasized by the US National Geospatial Agency (NGA). NGA has issued an Advisory Notice on web Mercator (http://earth-info.nga.mil/GandG/wgs84/web_mercator/index.html) that says that “it may cause geo-location / geo-coordinate errors up to 40,000 meters. This erroneous geospatial positioning information poses an unacceptable risk to global safety of navigation activities, and department of defense, intelligence community, and allied partner systems, missions, and operations that require accurate and precise positioning and navigation information.” The use of WorldMercatorWGS84Quad is recommended."); @@ -303,42 +286,41 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { addx2Gridset(WEB_MERCATOR_QUAD); log.fine("Adding OGC TMS WorldCRS84Quad"); - WORLD_CRS84_QUAD = - GridSetFactory.createGridSet( - "WorldCRS84Quad", - SRS.getEPSG4326(), - BoundingBox.WORLD4326, - true, - null, - new double[] { - 279541132.0143589, - 139770566.0071794, - 69885283.00358972, - 34942641.50179486, - 17471320.75089743, - 8735660.375448715, - 4367830.187724357, - 2183915.093862179, - 1091957.546931089, - 545978.7734655447, - 272989.3867327723, - 136494.6933663862, - 68247.34668319309, - 34123.67334159654, - 17061.83667079827, - 8530.918335399136, - 4265.459167699568, - 2132.729583849784, - }, - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18" - }, - 256, - 256, - true); + WORLD_CRS84_QUAD = GridSetFactory.createGridSet( + "WorldCRS84Quad", + SRS.getEPSG4326(), + BoundingBox.WORLD4326, + true, + null, + new double[] { + 279541132.0143589, + 139770566.0071794, + 69885283.00358972, + 34942641.50179486, + 17471320.75089743, + 8735660.375448715, + 4367830.187724357, + 2183915.093862179, + 1091957.546931089, + 545978.7734655447, + 272989.3867327723, + 136494.6933663862, + 68247.34668319309, + 34123.67334159654, + 17061.83667079827, + 8530.918335399136, + 4265.459167699568, + 2132.729583849784, + }, + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", + "18" + }, + 256, + 256, + true); // copied from the OGC TMS spec WORLD_CRS84_QUAD.setDescription( "This Tile Matrix Set defines tiles in the Equirectangular Plate Carrée projection in the CRS84 CRS for the whole world."); @@ -346,53 +328,48 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { addx2Gridset(WORLD_CRS84_QUAD); log.fine("Adding OGC TMS WorldMercatorWGS84Quad"); - WORLD_MERCATOR_WGS84_QUAD = - GridSetFactory.createGridSet( - "WorldMercatorWGS84Quad", - SRS.getSRS(3395), - new BoundingBox( - -20037508.3427892, - -20037508.3427892, - 20037508.3427892, - 20037508.3427892), - true, - null, - new double[] { - 559082264.028717, - 279541132.014358, - 139770566.007179, - 69885283.0035897, - 34942641.5017948, - 17471320.7508974, - 8735660.37544871, - 4367830.18772435, - 2183915.09386217, - 1091957.54693108, - 545978.773465544, - 272989.386732772, - 136494.693366386, - 68247.346683193, - 34123.6733415964, - 17061.8366707982, - 8530.91833539913, - 4265.45916769956, - 2132.72958384978, - 1066.36479192489, - 533.182395962445, - 266.591197981222, - 133.295598990611, - 66.6477994953056, - 33.3238997476528, - }, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" - }, - 256, - 256, - true); + WORLD_MERCATOR_WGS84_QUAD = GridSetFactory.createGridSet( + "WorldMercatorWGS84Quad", + SRS.getSRS(3395), + new BoundingBox(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892), + true, + null, + new double[] { + 559082264.028717, + 279541132.014358, + 139770566.007179, + 69885283.0035897, + 34942641.5017948, + 17471320.7508974, + 8735660.37544871, + 4367830.18772435, + 2183915.09386217, + 1091957.54693108, + 545978.773465544, + 272989.386732772, + 136494.693366386, + 68247.346683193, + 34123.6733415964, + 17061.8366707982, + 8530.91833539913, + 4265.45916769956, + 2132.72958384978, + 1066.36479192489, + 533.182395962445, + 266.591197981222, + 133.295598990611, + 66.6477994953056, + 33.3238997476528, + }, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", + "18", "19", "20", "21", "22", "23", "24" + }, + 256, + 256, + true); // not from the spec, it does not have one WORLD_MERCATOR_WGS84_QUAD.setDescription( "This Tile Matrix Set defines tiles in the Mercator projection in the WGS84 CRS for the whole world."); @@ -430,32 +407,25 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { // the 60 UTM zones from the OGC TMS specification for (int i = 1; i <= 60; i++) { String id = "UTM" + (i < 10 ? "0" : "") + i + "WGS84Quad"; - GridSet utmGridset = - GridSetFactory.createGridSet( - id, - SRS.getSRS(32600 + i), - new BoundingBox( - -9501965.72931276, - -20003931.4586255, - 10501965.7293128, - 20003931.4586255), - true, - null, - UTM_SCALES, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", - "24" - }, - 256, - 256, - true); + GridSet utmGridset = GridSetFactory.createGridSet( + id, + SRS.getSRS(32600 + i), + new BoundingBox(-9501965.72931276, -20003931.4586255, 10501965.7293128, 20003931.4586255), + true, + null, + UTM_SCALES, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", + "17", "18", "19", "20", "21", "22", "23", "24" + }, + 256, + 256, + true); // not from the spec, it does not have one utmGridset.setDescription( - "This Tile Matrix Set defines tiles in the Universal Transverse Mercator, zone " - + i); + "This Tile Matrix Set defines tiles in the Universal Transverse Mercator, zone " + i); addInternal(utmGridset); addx2Gridset(utmGridset); } @@ -489,26 +459,23 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { 54.68446545, 27.34223273 }; - BoundingBox upsBounds = - new BoundingBox( - -14440759.350252, -14440759.350252, 18440759.350252, 18440759.350252); - final GridSet upsArctic = - GridSetFactory.createGridSet( - "UPSArcticWGS84Quad", - SRS.getSRS(5041), - upsBounds, - true, - null, - upsScales, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" - }, - 256, - 256, - true); + BoundingBox upsBounds = new BoundingBox(-14440759.350252, -14440759.350252, 18440759.350252, 18440759.350252); + final GridSet upsArctic = GridSetFactory.createGridSet( + "UPSArcticWGS84Quad", + SRS.getSRS(5041), + upsBounds, + true, + null, + upsScales, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", + "18", "19", "20", "21", "22", "23", "24" + }, + 256, + 256, + true); // not from the spec, it does not have one upsArctic.setDescription( "This Tile Matrix Set defines tiles in the Universal Polar Stereographics for the arctic"); @@ -517,23 +484,22 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { // UPS antarctic log.fine("Adding OGC TMS UPSAntarcticWGS84Quad"); - final GridSet upsAntarctic = - GridSetFactory.createGridSet( - "UPSAntarcticWGS84Quad", - SRS.getSRS(5042), - upsBounds, - true, - null, - upsScales, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" - }, - 256, - 256, - true); + final GridSet upsAntarctic = GridSetFactory.createGridSet( + "UPSAntarcticWGS84Quad", + SRS.getSRS(5042), + upsBounds, + true, + null, + upsScales, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", + "18", "19", "20", "21", "22", "23", "24" + }, + 256, + 256, + true); // not from the spec, it does not have one upsAntarctic.setDescription( "This Tile Matrix Set defines tiles in the Universal Polar Stereographics for the Antarctic"); @@ -541,95 +507,85 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { addx2Gridset(upsAntarctic); log.fine("Adding OGC TMS EuropeanETRS89_LAEAQuad"); - GridSet euETRS89LaeaQuad = - GridSetFactory.createGridSet( - "EuropeanETRS89_LAEAQuad", - SRS.getSRS(3035), - new BoundingBox(2000000.0, 1000000.0, 6500000, 5500000.0), - true, - null, - new double[] { - 62779017.857142866, - 31389508.928571433, - 15694754.464285716, - 7847377.232142858, - 3923688.616071429, - 1961844.3080357146, - 980922.1540178573, - 490461.07700892864, - 245230.53850446432, - 122615.26925223216, - 61307.63462611608, - 30653.81731305804, - 15326.90865652902, - 7663.45432826451, - 3831.727164132255, - 1915.8635820661275, - }, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15" - }, - 256, - 256, - true); + GridSet euETRS89LaeaQuad = GridSetFactory.createGridSet( + "EuropeanETRS89_LAEAQuad", + SRS.getSRS(3035), + new BoundingBox(2000000.0, 1000000.0, 6500000, 5500000.0), + true, + null, + new double[] { + 62779017.857142866, + 31389508.928571433, + 15694754.464285716, + 7847377.232142858, + 3923688.616071429, + 1961844.3080357146, + 980922.1540178573, + 490461.07700892864, + 245230.53850446432, + 122615.26925223216, + 61307.63462611608, + 30653.81731305804, + 15326.90865652902, + 7663.45432826451, + 3831.727164132255, + 1915.8635820661275, + }, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"}, + 256, + 256, + true); // not from the spec, it does not have one euETRS89LaeaQuad.setDescription("Lambert Azimuthal Equal Area ETRS89 for Europe"); addInternal(euETRS89LaeaQuad); addx2Gridset(euETRS89LaeaQuad); log.fine("Adding OGC TMS CanadianNAD83_LCC"); - GridSet canadianNAD83Lcc = - GridSetFactory.createGridSet( - "CanadianNAD83_LCC", - SRS.getSRS(3978), - new BoundingBox( - -7786476.885838887, - -5153821.09213678, - 7148753.233541353, - 7928343.534071138), - true, - null, - new double[] { - 137016643.080905, - 80320101.1163925, - 47247118.3037603, - 28348270.9822562, - 16536491.4063161, - 9449423.66075207, - 5669654.19645125, - 3307298.28126323, - 1889884.73215041, - 1133930.83929025, - 661459.656252643, - 396875.793751586, - 236235.591518802, - 137016.643080905, - 80320.1011163925, - 47247.1183037603, - 28348.2709822562, - 16536.4914063161, - 9449.42366075207, - 5669.65419645125, - 3307.29828126323, - 1889.88473215041, - 1133.93083929025, - 661.459656252643, - 396.875793751586, - 236.235591518802 - }, - 1d, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - new String[] { - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", - "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", - "25" - }, - 256, - 256, - true); + GridSet canadianNAD83Lcc = GridSetFactory.createGridSet( + "CanadianNAD83_LCC", + SRS.getSRS(3978), + new BoundingBox(-7786476.885838887, -5153821.09213678, 7148753.233541353, 7928343.534071138), + true, + null, + new double[] { + 137016643.080905, + 80320101.1163925, + 47247118.3037603, + 28348270.9822562, + 16536491.4063161, + 9449423.66075207, + 5669654.19645125, + 3307298.28126323, + 1889884.73215041, + 1133930.83929025, + 661459.656252643, + 396875.793751586, + 236235.591518802, + 137016.643080905, + 80320.1011163925, + 47247.1183037603, + 28348.2709822562, + 16536.4914063161, + 9449.42366075207, + 5669.65419645125, + 3307.29828126323, + 1889.88473215041, + 1133.93083929025, + 661.459656252643, + 396.875793751586, + 236.235591518802 + }, + 1d, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + new String[] { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", + "18", "19", "20", "21", "22", "23", "24", "25" + }, + 256, + 256, + true); // not from the spec, it does not have one canadianNAD83Lcc.setDescription("Lambert Conformal Conic for Canada"); addInternal(canadianNAD83Lcc); @@ -648,20 +604,19 @@ private void addx2Gridset(GridSet base) { scaleNames[i] = base.getGrid(i).getName(); } - GridSet x2 = - GridSetFactory.createGridSet( - base.getName() + "x2", - base.getSrs(), - base.getOriginalExtent(), - base.isTopLeftAligned(), - null, - scales, - base.getMetersPerUnit(), - base.getPixelSize(), - scaleNames, - 512, - 512, - base.isyCoordinateFirst()); + GridSet x2 = GridSetFactory.createGridSet( + base.getName() + "x2", + base.getSrs(), + base.getOriginalExtent(), + base.isTopLeftAligned(), + null, + scales, + base.getMetersPerUnit(), + base.getPixelSize(), + scaleNames, + 512, + 512, + base.isyCoordinateFirst()); addInternal(x2); } @@ -777,8 +732,8 @@ private double[] scalesCRS84ScaleDenominators() { // // return scalesCRS84Pixel; double[] scalesCRS84Pixel = { - 500E6, 250E6, 100E6, 50E6, 25E6, 10E6, 5E6, 2.5E6, 1E6, 500E3, 250E3, 100E3, 50E3, 25E3, - 10E3, 5E3, 2.5E3, 1000, 500, 250, 100 + 500E6, 250E6, 100E6, 50E6, 25E6, 10E6, 5E6, 2.5E6, 1E6, 500E3, 250E3, 100E3, 50E3, 25E3, 10E3, 5E3, 2.5E3, + 1000, 500, 250, 100 }; return scalesCRS84Pixel; diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/DefaultingConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/DefaultingConfiguration.java index 995211cd7d..e0bd2c74cd 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/DefaultingConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/DefaultingConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -20,9 +19,8 @@ public interface DefaultingConfiguration extends BaseConfiguration { /** - * TileLayerConfiguration objects lacking their own defaults can delegate to this. Should set - * values in the default geowebcache.xml to the TileLayer configuration, and fall back on - * implemented default values if missing. + * TileLayerConfiguration objects lacking their own defaults can delegate to this. Should set values in the default + * geowebcache.xml to the TileLayer configuration, and fall back on implemented default values if missing. */ void setDefaultValues(TileLayer layer); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/FileBlobStoreInfo.java b/geowebcache/core/src/main/java/org/geowebcache/config/FileBlobStoreInfo.java index 8f89e4b45d..44f614eda5 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/FileBlobStoreInfo.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/FileBlobStoreInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Gabriel Roldan, Boundless Spatial Inc, Copyright 2015 */ @@ -74,25 +73,21 @@ public void setBaseDirectory(String baseDirectory) { } /** - * A positive integer representing the file system block size (usually 4096, 8292, or 16384, - * depending on the file system) of the - * file system where the {@link #getBaseDirectory() base directory} resides. + * A positive integer representing the file system block size (usually 4096, 8292, or 16384, depending on the file system) of the file system where the + * {@link #getBaseDirectory() base directory} resides. * - *

This value is used to pad the size of tile files to the actual size of the file on disk - * before notifying {@link BlobStoreListener#tileDeleted}, {@link BlobStoreListener#tileStored}, - * or {@link BlobStoreListener#tileUpdated}. + *

This value is used to pad the size of tile files to the actual size of the file on disk before notifying + * {@link BlobStoreListener#tileDeleted}, {@link BlobStoreListener#tileStored}, or + * {@link BlobStoreListener#tileUpdated}. * - * @return the block size of the file system where the {@link #getBaseDirectory() base - * directory} resides. + * @return the block size of the file system where the {@link #getBaseDirectory() base directory} resides. */ public int getFileSystemBlockSize() { return fileSystemBlockSize; } - /** - * Sets the block size of the file system where the {@link #getBaseDirectory() base directory} - * resides. - */ + /** Sets the block size of the file system where the {@link #getBaseDirectory() base directory} resides. */ public void setFileSystemBlockSize(int fileSystemBlockSize) { this.fileSystemBlockSize = fileSystemBlockSize; } @@ -123,33 +118,22 @@ public String toString() { /** @see BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider) */ @Override - public BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) - throws StorageException { + public BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) throws StorageException { checkState(getName() != null, "id not set"); - checkState( - isEnabled(), - "Can't call FileBlobStoreConfig.createInstance() is blob store is not enabled"); + checkState(isEnabled(), "Can't call FileBlobStoreConfig.createInstance() is blob store is not enabled"); checkState(baseDirectory != null, "baseDirectory not provided"); - checkState( - fileSystemBlockSize >= 0, - "fileSystemBlockSize must be a positive integer: %s", - fileSystemBlockSize); + checkState(fileSystemBlockSize >= 0, "fileSystemBlockSize must be a positive integer: %s", fileSystemBlockSize); FileBlobStore fileBlobStore; if (pathGeneratorType == null || pathGeneratorType == PathGeneratorType.DEFAULT) { - fileBlobStore = - new FileBlobStore(baseDirectory, new DefaultFilePathGenerator(baseDirectory)); + fileBlobStore = new FileBlobStore(baseDirectory, new DefaultFilePathGenerator(baseDirectory)); } else if (pathGeneratorType == PathGeneratorType.TMS) { - fileBlobStore = - new FileBlobStore( - baseDirectory, - new XYZFilePathGenerator( - baseDirectory, layers, XYZFilePathGenerator.Convention.TMS)); + fileBlobStore = new FileBlobStore( + baseDirectory, + new XYZFilePathGenerator(baseDirectory, layers, XYZFilePathGenerator.Convention.TMS)); } else { - fileBlobStore = - new FileBlobStore( - baseDirectory, - new XYZFilePathGenerator( - baseDirectory, layers, XYZFilePathGenerator.Convention.XYZ)); + fileBlobStore = new FileBlobStore( + baseDirectory, + new XYZFilePathGenerator(baseDirectory, layers, XYZFilePathGenerator.Convention.XYZ)); } if (fileSystemBlockSize > 0) { fileBlobStore.setBlockSize(fileSystemBlockSize); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/GeoWebCacheConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/GeoWebCacheConfiguration.java index 872d4724db..1a4bcaf556 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/GeoWebCacheConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/GeoWebCacheConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -91,8 +90,7 @@ private Object readResolve() { xmlns = "http://geowebcache.org/schema/" + getVersion(); - xsi_schemaLocation = - xmlns + " http://geowebcache.org/schema/" + getVersion() + "/geowebcache.xsd"; + xsi_schemaLocation = xmlns + " http://geowebcache.org/schema/" + getVersion() + "/geowebcache.xsd"; if (layers == null) { layers = new ArrayList<>(); @@ -117,8 +115,7 @@ public String getVersion() { public void setVersion(String version) { this.version = version; xmlns = "http://geowebcache.org/schema/" + version; - xsi_schemaLocation = - xmlns + " http://geowebcache.org/schema/" + version + "/geowebcache.xsd"; + xsi_schemaLocation = xmlns + " http://geowebcache.org/schema/" + version + "/geowebcache.xsd"; } /** @see ServerConfiguration#getBackendTimeout() */ @@ -186,10 +183,7 @@ public ServiceInformation getServiceInformation() { return serviceInformation; } - /** - * @see ServerConfiguration#setServiceInformation(ServiceInformation) the serviceInformation to - * set - */ + /** @see ServerConfiguration#setServiceInformation(ServiceInformation) the serviceInformation to set */ public void setServiceInformation(ServiceInformation serviceInformation) { this.serviceInformation = serviceInformation; } @@ -231,14 +225,11 @@ public LockProvider getLockProvider() { Object provider = GeoWebCacheExtensions.bean(lockProvider); if (provider == null) { throw new RuntimeException( - "Could not find lock provider " - + lockProvider - + " in the spring application context"); + "Could not find lock provider " + lockProvider + " in the spring application context"); } else if (!(provider instanceof LockProvider)) { - throw new RuntimeException( - "Found bean " - + lockProvider - + " in the spring application context, but it was not a LockProvider"); + throw new RuntimeException("Found bean " + + lockProvider + + " in the spring application context, but it was not a LockProvider"); } else { lockProviderInstance = (LockProvider) provider; } @@ -279,8 +270,7 @@ public void setFullWMS(Boolean fullWMS) { } /** - * If this method returns NULL CITE strict compliance mode should not be considered for WMTS - * service implementation. + * If this method returns NULL CITE strict compliance mode should not be considered for WMTS service implementation. * * @return may return TRUE, FALSE or NULL */ @@ -289,11 +279,9 @@ public boolean isWmtsCiteCompliant() { } /** - * Can be used to force WMTS service implementation to be strictly compliant with the - * correspondent CITE tests. + * Can be used to force WMTS service implementation to be strictly compliant with the correspondent CITE tests. * - * @param wmtsCiteCompliant TRUE or FALSE, activating or deactivation CITE strict compliance - * mode for WMTS + * @param wmtsCiteCompliant TRUE or FALSE, activating or deactivation CITE strict compliance mode for WMTS */ public void setWmtsCiteCompliant(boolean wmtsCiteCompliant) { this.wmtsCiteCompliant = wmtsCiteCompliant; diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/GridSetConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/GridSetConfiguration.java index 6f6ce697ca..22bac273ac 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/GridSetConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/GridSetConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -43,12 +42,11 @@ default Set getGridSetNames() { * Adds a new {@link GridSet} to the configuration * * @param gridSet the gridset to add - * @throws IllegalArgumentException if this configuration is not capable of saving the specific - * type of gridset given, or if any required piece of information is missing or invalid in - * the gridset (for example, a missing or duplicated name or id, etc). + * @throws IllegalArgumentException if this configuration is not capable of saving the specific type of gridset + * given, or if any required piece of information is missing or invalid in the gridset (for example, a missing + * or duplicated name or id, etc). */ - void addGridSet(final GridSet gridSet) - throws UnsupportedOperationException, IllegalArgumentException; + void addGridSet(final GridSet gridSet) throws UnsupportedOperationException, IllegalArgumentException; /** * Removes an existing gridset from the configuration @@ -56,16 +54,15 @@ void addGridSet(final GridSet gridSet) * @throws NoSuchElementException If there is no existing gridset by that name. * @throws UnsupportedOperationException if removing this gridset is not supported */ - void removeGridSet(String gridSetName) - throws NoSuchElementException, UnsupportedOperationException; + void removeGridSet(String gridSetName) throws NoSuchElementException, UnsupportedOperationException; /** * Changes a gridset * * @param gridSet The modified gridset. Should have the same name as an existing gridset. - * @throws IllegalArgumentException if this configuration is not able to save the specific type - * of gridset given, or if any required piece of information is missing or invalid in the - * gridset (for example, a missing name or id, etc). + * @throws IllegalArgumentException if this configuration is not able to save the specific type of gridset given, or + * if any required piece of information is missing or invalid in the gridset (for example, a missing name or id, + * etc). * @throws NoSuchElementException If there is no existing gridset by that name. * @throws UnsupportedOperationException if removing this gridset is not supported */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/Info.java b/geowebcache/core/src/main/java/org/geowebcache/config/Info.java index bc70500176..c6b2abd5f1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/Info.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/Info.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ListenerCollection.java b/geowebcache/core/src/main/java/org/geowebcache/config/ListenerCollection.java index a94149ed75..7f96fcf8fc 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ListenerCollection.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ListenerCollection.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -49,28 +48,23 @@ public static interface HandlerMethod { } /** - * Perform an operation on each listener. If one throws an exception, the others will still - * execute. If more than one exception is thrown, the last will be the one propagated, with the - * others added as suppressed exceptions. If an Error is thrown, it will be propagated - * immediately. + * Perform an operation on each listener. If one throws an exception, the others will still execute. If more than + * one exception is thrown, the last will be the one propagated, with the others added as suppressed exceptions. If + * an Error is thrown, it will be propagated immediately. */ - public synchronized void safeForEach(HandlerMethod method) - throws GeoWebCacheException, IOException { - LinkedList exceptions = - listeners.stream() - .map( - l -> { - try { - method.callOn(l); - return Optional.empty(); - } catch (Exception ex) { - return Optional.of(ex); - } - }) - .filter(Optional::isPresent) - .map(Optional::get) - .collect( - Collectors.collectingAndThen(Collectors.toList(), LinkedList::new)); + public synchronized void safeForEach(HandlerMethod method) throws GeoWebCacheException, IOException { + LinkedList exceptions = listeners.stream() + .map(l -> { + try { + method.callOn(l); + return Optional.empty(); + } catch (Exception ex) { + return Optional.of(ex); + } + }) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.collectingAndThen(Collectors.toList(), LinkedList::new)); if (!exceptions.isEmpty()) { Iterator it = exceptions.descendingIterator(); Exception ex = it.next(); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/ServerConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/ServerConfiguration.java index 3cc862cea9..7503d152f0 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/ServerConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/ServerConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -21,14 +20,12 @@ /** * Interface for managing global server configuration information. * - *

In general, a running GeoWebCache application should only include a single instance of - * ServerConfiguration + *

In general, a running GeoWebCache application should only include a single instance of ServerConfiguration */ public interface ServerConfiguration extends BaseConfiguration { /** - * Service information such as you or your company's details that you want provided in - * capabilities documents. + * Service information such as you or your company's details that you want provided in capabilities documents. * * @return ServiceInformation for the ServerConfiguration */ @@ -38,9 +35,8 @@ public interface ServerConfiguration extends BaseConfiguration { void setServiceInformation(ServiceInformation serviceInfo) throws IOException; /** - * Runtime statistics run, by default, every three second and provide data about how many - * requests the system has been serving in the past 3, 15 and 60 seconds, as well as aggregate - * numbers. + * Runtime statistics run, by default, every three second and provide data about how many requests the system has + * been serving in the past 3, 15 and 60 seconds, as well as aggregate numbers. * * @return True or False if disabled */ @@ -70,25 +66,22 @@ public interface ServerConfiguration extends BaseConfiguration { void setFullWMS(Boolean isFullWMS) throws IOException; /** - * If this method returns NULL CITE strict compliance mode should not be considered for WMTS - * service implementation. + * If this method returns NULL CITE strict compliance mode should not be considered for WMTS service implementation. * * @return may return TRUE, FALSE or NULL */ Boolean isWmtsCiteCompliant(); /** - * Can be used to force WMTS service implementation to be strictly compliant with the - * correspondent CITE tests. + * Can be used to force WMTS service implementation to be strictly compliant with the correspondent CITE tests. * - * @param wmtsCiteStrictCompliant TRUE or FALSE, activating or deactivation CITE strict - * compliance mode for WMTS + * @param wmtsCiteStrictCompliant TRUE or FALSE, activating or deactivation CITE strict compliance mode for WMTS */ void setWmtsCiteCompliant(Boolean wmtsCiteStrictCompliant) throws IOException; /** - * The backend timeout is the number of seconds GWC will wait for a backend server to return - * something before closing the connection. + * The backend timeout is the number of seconds GWC will wait for a backend server to return something before + * closing the connection. * * @return The backend timeout for this configuration. */ @@ -98,8 +91,8 @@ public interface ServerConfiguration extends BaseConfiguration { void setBackendTimeout(Integer backendTimeout) throws IOException; /** - * Determines whether cached=false is allowed for requests going through the WMS service, - * including converters such as Google Maps. + * Determines whether cached=false is allowed for requests going through the WMS service, including converters such + * as Google Maps. * * @return True or False */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/SimpleGridSetConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/SimpleGridSetConfiguration.java index f38fce8a74..55452951b0 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/SimpleGridSetConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/SimpleGridSetConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -44,14 +43,12 @@ public Collection getGridSets() { } @Override - public void addGridSet(GridSet gridSet) - throws UnsupportedOperationException, IllegalArgumentException { + public void addGridSet(GridSet gridSet) throws UnsupportedOperationException, IllegalArgumentException { throw new UnsupportedOperationException(); } @Override - public void removeGridSet(String gridSetName) - throws NoSuchElementException, UnsupportedOperationException { + public void removeGridSet(String gridSetName) throws NoSuchElementException, UnsupportedOperationException { throw new UnsupportedOperationException(); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/TileLayerConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/TileLayerConfiguration.java index 8817dcb8ba..795e156564 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/TileLayerConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/TileLayerConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -26,8 +25,7 @@ /** * A layer provider for {@link TileLayerDispatcher}. * - *

Implementations must be singletons discoverable through {@link GeoWebCacheExtensions} (i.e. - * spring beans) + *

Implementations must be singletons discoverable through {@link GeoWebCacheExtensions} (i.e. spring beans) */ public interface TileLayerConfiguration extends BaseConfiguration { @@ -39,12 +37,10 @@ public interface TileLayerConfiguration extends BaseConfiguration { Collection getLayers(); /** - * Gets a single {@link TileLayer} from the configuration, using the layer's unique name as a - * key. + * Gets a single {@link TileLayer} from the configuration, using the layer's unique name as a key. * * @param layerName the layer name - * @return the layer named {@code layerIdent} or {@code null} if no such layer exists in this - * configuration + * @return the layer named {@code layerIdent} or {@code null} if no such layer exists in this configuration */ Optional getLayer(String layerName); @@ -73,8 +69,7 @@ public interface TileLayerConfiguration extends BaseConfiguration { /** * Replaces an existing tile layer of the same name with this tile layer. * - * @param tl the modified tile layer. Its name must be the same as a tile layer that already - * exists. + * @param tl the modified tile layer. Its name must be the same as a tile layer that already exists. * @throws NoSuchElementException If no tile layer with a matching name exists. */ void modifyLayer(TileLayer tl) throws NoSuchElementException; @@ -87,17 +82,15 @@ public interface TileLayerConfiguration extends BaseConfiguration { * @throws NoSuchElementException If no tile layer with a matching name exists. * @throws IllegalArgumentException If a tile layer with the new name already exists */ - void renameLayer(String oldName, String newName) - throws NoSuchElementException, IllegalArgumentException; + void renameLayer(String oldName, String newName) throws NoSuchElementException, IllegalArgumentException; /** - * Adds the given tile layer to this configuration, provided {@link #canSave(TileLayer) - * canSave(tl) == true}. + * Adds the given tile layer to this configuration, provided {@link #canSave(TileLayer) canSave(tl) == true}. * * @param tl the tile layer to add to the configuration - * @throws IllegalArgumentException if this configuration is not able of saving the specific - * type of layer given, or if any required piece of information is missing or invalid in the - * layer (for example, a missing or duplicated name or id, etc). + * @throws IllegalArgumentException if this configuration is not able of saving the specific type of layer given, or + * if any required piece of information is missing or invalid in the layer (for example, a missing or duplicated + * name or id, etc). */ void addLayer(TileLayer tl) throws IllegalArgumentException; @@ -113,9 +106,9 @@ void renameLayer(String oldName, String newName) * Whether the configuration is capable of saving the provided tile layer. * * @param tl a tile layer to be added or saved - * @return {@code true} if this configuration is capable of saving the given tile layer, {@code - * false} otherwise (usually this check is based on an instanceof check, as different - * configurations may be specialized on different kinds of layers). + * @return {@code true} if this configuration is capable of saving the given tile layer, {@code false} otherwise + * (usually this check is based on an instanceof check, as different configurations may be specialized on + * different kinds of layers). */ boolean canSave(TileLayer tl); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfiguration.java index 7bb2a81639..6206baaa3b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, Marius Suta, The Open Planning Project, Copyright 2008 */ @@ -102,10 +101,9 @@ /** * XMLConfiguration class responsible for reading/writing layer configurations to and from XML file * - *

NOTE {@link #setGridSetBroker(GridSetBroker)} MUST have been called before any other method is - * used, otherwise this configuration is in an inconsistent and unpredictable state, and will throw - * an {@link IllegalStateException}. This is set automatically by Spring through the use of {@link - * Autowired} + *

NOTE {@link #setGridSetBroker(GridSetBroker)} MUST have been called before any other method is used, otherwise + * this configuration is in an inconsistent and unpredictable state, and will throw an {@link IllegalStateException}. + * This is set automatically by Spring through the use of {@link Autowired} */ public class XMLConfiguration implements TileLayerConfiguration, @@ -132,16 +130,14 @@ public class XMLConfiguration private GridSetBroker gridSetBroker; - private ListenerCollection blobStoreListeners = - new ListenerCollection<>(); + private ListenerCollection blobStoreListeners = new ListenerCollection<>(); /** * Base Constructor with custom {@link ConfigurationResourceProvider}. * * @param appCtx use to lookup {@link XMLConfigurationProvider} extensions, may be {@code null} */ - public XMLConfiguration( - final ApplicationContextProvider appCtx, final ConfigurationResourceProvider inFac) { + public XMLConfiguration(final ApplicationContextProvider appCtx, final ConfigurationResourceProvider inFac) { this.context = appCtx == null ? null : appCtx.getApplicationContext(); this.resourceProvider = inFac; } @@ -159,34 +155,23 @@ public XMLConfiguration( this( appCtx, new XMLFileResourceProvider( - DEFAULT_CONFIGURATION_FILE_NAME, - appCtx, - configFileDirectory, - storageDirFinder)); + DEFAULT_CONFIGURATION_FILE_NAME, appCtx, configFileDirectory, storageDirFinder)); resourceProvider.setTemplate("/" + DEFAULT_CONFIGURATION_FILE_NAME); } /** - * Constructor that will look for {@code geowebcache.xml} at the directory defined by {@code - * storageDirFinder} + * Constructor that will look for {@code geowebcache.xml} at the directory defined by {@code storageDirFinder} * * @param appCtx use to lookup {@link XMLConfigurationProvider} extenions, may be {@code null} */ - public XMLConfiguration( - final ApplicationContextProvider appCtx, final DefaultStorageFinder storageDirFinder) + public XMLConfiguration(final ApplicationContextProvider appCtx, final DefaultStorageFinder storageDirFinder) throws ConfigurationException { - this( - appCtx, - new XMLFileResourceProvider( - DEFAULT_CONFIGURATION_FILE_NAME, appCtx, storageDirFinder)); + this(appCtx, new XMLFileResourceProvider(DEFAULT_CONFIGURATION_FILE_NAME, appCtx, storageDirFinder)); resourceProvider.setTemplate("/" + DEFAULT_CONFIGURATION_FILE_NAME); } - /** - * Constructor that will accept an absolute or relative path for finding {@code geowebcache.xml} - */ - public XMLConfiguration( - final ApplicationContextProvider appCtx, final String configFileDirectory) + /** Constructor that will accept an absolute or relative path for finding {@code geowebcache.xml} */ + public XMLConfiguration(final ApplicationContextProvider appCtx, final String configFileDirectory) throws ConfigurationException { this(appCtx, configFileDirectory, null); } @@ -276,29 +261,22 @@ public void setDefaultValues(TileLayer layer) { } catch (MalformedURLException e) { log.log( Level.SEVERE, - "could not parse proxy URL " - + wl.getProxyUrl() - + " ! continuing WITHOUT proxy!", + "could not parse proxy URL " + wl.getProxyUrl() + " ! continuing WITHOUT proxy!", e); } final WMSHttpHelper sourceHelper; if (wl.getHttpUsername() != null) { - sourceHelper = - new WMSHttpHelper(wl.getHttpUsername(), wl.getHttpPassword(), proxyUrl); - log.fine( - "Using per-layer HTTP credentials for " - + wl.getName() - + ", " - + "username " - + wl.getHttpUsername()); + sourceHelper = new WMSHttpHelper(wl.getHttpUsername(), wl.getHttpPassword(), proxyUrl); + log.fine("Using per-layer HTTP credentials for " + + wl.getName() + + ", " + + "username " + + wl.getHttpUsername()); } else if (getGwcConfig().getHttpUsername() != null) { - sourceHelper = - new WMSHttpHelper( - getGwcConfig().getHttpUsername(), - getGwcConfig().getHttpPassword(), - proxyUrl); + sourceHelper = new WMSHttpHelper( + getGwcConfig().getHttpUsername(), getGwcConfig().getHttpPassword(), proxyUrl); log.fine("Using global HTTP credentials for " + wl.getName()); } else { sourceHelper = new WMSHttpHelper(null, null, proxyUrl); @@ -317,18 +295,15 @@ private GeoWebCacheConfiguration loadConfiguration() throws ConfigurationExcepti return loadConfiguration(in); } } catch (IOException e) { - throw new ConfigurationException( - "Error parsing config file " + resourceProvider.getId(), e); + throw new ConfigurationException("Error parsing config file " + resourceProvider.getId(), e); } } - private GeoWebCacheConfiguration loadConfiguration(InputStream xmlFile) - throws IOException, ConfigurationException { + private GeoWebCacheConfiguration loadConfiguration(InputStream xmlFile) throws IOException, ConfigurationException { Node rootNode = loadDocument(xmlFile); XStream xs = getConfiguredXStreamWithContext(new GeoWebCacheXStream(), Context.PERSIST); - GeoWebCacheConfiguration config = - (GeoWebCacheConfiguration) xs.unmarshal(new DomReader((Element) rootNode)); + GeoWebCacheConfiguration config = (GeoWebCacheConfiguration) xs.unmarshal(new DomReader((Element) rootNode)); return config; } @@ -340,10 +315,7 @@ private synchronized void save() throws IOException { try { resourceProvider.backup(); } catch (Exception e) { - log.log( - Level.WARNING, - "Error creating back up of configuration file " + resourceProvider.getId(), - e); + log.log(Level.WARNING, "Error creating back up of configuration file " + resourceProvider.getId(), e); } persistToFile(); @@ -363,9 +335,7 @@ public XStream getConfiguredXStreamWithContext( } public static XStream getConfiguredXStreamWithContext( - XStream xs, - WebApplicationContext context, - ContextualConfigurationProvider.Context providerContext) { + XStream xs, WebApplicationContext context, ContextualConfigurationProvider.Context providerContext) { { // Allow any implementation of these extension points @@ -460,8 +430,7 @@ public static XStream getConfiguredXStreamWithContext( && // Check if the context is applicable for the provider (providerContext == null - || !((ContextualConfigurationProvider) extension) - .appliesTo(providerContext))) { + || !((ContextualConfigurationProvider) extension).appliesTo(providerContext))) { // If so, try the next one continue; } @@ -494,13 +463,8 @@ private void persistToFile() throws IOException { } catch (FileNotFoundException fnfe) { throw fnfe; } catch (IOException e) { - throw (IOException) - new IOException( - "Error writing to " - + resourceProvider.getId() - + ": " - + e.getMessage()) - .initCause(e); + throw (IOException) new IOException("Error writing to " + resourceProvider.getId() + ": " + e.getMessage()) + .initCause(e); } log.info("Wrote configuration to " + resourceProvider.getId()); @@ -522,8 +486,7 @@ protected boolean canSaveIfNotTransient(TileLayer tl) { if (tl instanceof WMSLayer) { return true; } - return GeoWebCacheExtensions.extensions(XMLConfigurationProvider.class, this.context) - .stream() + return GeoWebCacheExtensions.extensions(XMLConfigurationProvider.class, this.context).stream() .anyMatch(provider -> provider.canSave(tl)); } @@ -590,19 +553,14 @@ public synchronized void modifyLayer(TileLayer tl) throws NoSuchElementException } protected TileLayer findLayer(String layerName) throws NoSuchElementException { - TileLayer layer = - getLayer(layerName) - .orElseThrow( - () -> - new NoSuchElementException( - "Layer " + layerName + " does not exist")); + TileLayer layer = getLayer(layerName) + .orElseThrow(() -> new NoSuchElementException("Layer " + layerName + " does not exist")); return layer; } /** @see TileLayerConfiguration#renameLayer(String, String) */ @Override - public void renameLayer(String oldName, String newName) - throws NoSuchElementException, IllegalArgumentException { + public void renameLayer(String oldName, String newName) throws NoSuchElementException, IllegalArgumentException { throw new UnsupportedOperationException( "renameLayer is not supported by " + getClass().getSimpleName()); } @@ -634,8 +592,7 @@ public synchronized void removeLayer(final String layerName) } /** */ - private synchronized void addOrReplaceGridSet(final XMLGridSet gridSet) - throws IllegalArgumentException { + private synchronized void addOrReplaceGridSet(final XMLGridSet gridSet) throws IllegalArgumentException { final String gridsetName = gridSet.getName(); List xmlGridSets = getGwcConfig().getGridSets(); @@ -758,9 +715,7 @@ private static Node checkAndTransform(Document doc) throws ConfigurationExceptio // Check again after transform if (!rootNode.getNodeName().equals("gwcConfiguration")) { - log.log( - Level.SEVERE, - "Unable to parse file, expected gwcConfiguration at root after transform."); + log.log(Level.SEVERE, "Unable to parse file, expected gwcConfiguration at root after transform."); throw new ConfigurationException("Unable to parse after transform."); } else { // Parsing the schema file @@ -869,29 +824,24 @@ private void updateLayers() { private void loadGridSets() { if (getGwcConfig().getGridSets() != null) { - this.gridSets = - getGwcConfig().getGridSets().stream() - .map( - (xmlGridSet) -> { - if (log.isLoggable(Level.FINE)) { - log.fine("Reading " + xmlGridSet.getName()); - } - - GridSet gridSet = xmlGridSet.makeGridSet(); - - log.info("Read GridSet " + gridSet.getName()); - return gridSet; - }) - .collect( - Collectors.toMap( - GridSet::getName, - Function.identity(), - (GridSet x, GridSet y) -> { - throw new IllegalStateException( - "Gridsets with duplicate name " - + x.getName()); - }, - HashMap::new)); + this.gridSets = getGwcConfig().getGridSets().stream() + .map((xmlGridSet) -> { + if (log.isLoggable(Level.FINE)) { + log.fine("Reading " + xmlGridSet.getName()); + } + + GridSet gridSet = xmlGridSet.makeGridSet(); + + log.info("Read GridSet " + gridSet.getName()); + return gridSet; + }) + .collect(Collectors.toMap( + GridSet::getName, + Function.identity(), + (GridSet x, GridSet y) -> { + throw new IllegalStateException("Gridsets with duplicate name " + x.getName()); + }, + HashMap::new)); } } @@ -989,28 +939,23 @@ public void setFullWMS(Boolean isFullWMS) throws IOException { @Override public List getBlobStores() { // need to return an unmodifiable list of unmodifiable BlobStoreInfos - return Collections.unmodifiableList( - getGwcConfig().getBlobStores().stream() - .map( - (info) -> { - return (BlobStoreInfo) info.clone(); - }) - .collect(Collectors.toList())); + return Collections.unmodifiableList(getGwcConfig().getBlobStores().stream() + .map((info) -> { + return (BlobStoreInfo) info.clone(); + }) + .collect(Collectors.toList())); } /** @see BlobStoreConfiguration#addBlobStore(org.geowebcache.config.BlobStoreInfo) */ @Override public synchronized void addBlobStore(BlobStoreInfo info) { if (info.getName() == null) { - throw new IllegalArgumentException( - "Failed to add BlobStoreInfo. A BlobStoreInfo name cannot be null"); + throw new IllegalArgumentException("Failed to add BlobStoreInfo. A BlobStoreInfo name cannot be null"); } // ensure there isn't a BlobStoreInfo with the same name already if (getBlobStoreNames().contains(info.getName())) { - throw new IllegalArgumentException( - String.format( - "Failed to add BlobStoreInfo. A BlobStoreInfo with name \"%s\" already exists", - info.getName())); + throw new IllegalArgumentException(String.format( + "Failed to add BlobStoreInfo. A BlobStoreInfo with name \"%s\" already exists", info.getName())); } // add the BlobStoreInfo final List blobStores = getGwcConfig().getBlobStores(); @@ -1021,14 +966,12 @@ public synchronized void addBlobStore(BlobStoreInfo info) { } catch (IOException ioe) { // save failed, roll back the add blobStores.remove(info); - throw new ConfigurationPersistenceException( - String.format("Unable to add BlobStoreInfo \"%s\"", info), ioe); + throw new ConfigurationPersistenceException(String.format("Unable to add BlobStoreInfo \"%s\"", info), ioe); } try { - blobStoreListeners.safeForEach( - listener -> { - listener.handleAddBlobStore(info); - }); + blobStoreListeners.safeForEach(listener -> { + listener.handleAddBlobStore(info); + }); } catch (IOException | GeoWebCacheException e) { if (ExceptionUtils.isOrSuppresses(e, UnsuitableStorageException.class)) { // Can't store here, roll back @@ -1044,14 +987,9 @@ public synchronized void addBlobStore(BlobStoreInfo info) { @Override public synchronized void removeBlobStore(String name) { // ensure there is a BlobStoreInfo with the name - final BlobStoreInfo infoToRemove = - getBlobStore(name) - .orElseThrow( - () -> - new NoSuchElementException( - String.format( - "Failed to remove BlobStoreInfo. A BlobStoreInfo with name \"%s\" does not exist.", - name))); + final BlobStoreInfo infoToRemove = getBlobStore(name) + .orElseThrow(() -> new NoSuchElementException(String.format( + "Failed to remove BlobStoreInfo. A BlobStoreInfo with name \"%s\" does not exist.", name))); // remove the BlobStoreInfo final List blobStores = getGwcConfig().getBlobStores(); blobStores.remove(infoToRemove); @@ -1065,10 +1003,9 @@ public synchronized void removeBlobStore(String name) { String.format("Unable to remove BlobStoreInfo \"%s\"", name), ioe); } try { - blobStoreListeners.safeForEach( - listener -> { - listener.handleRemoveBlobStore(infoToRemove); - }); + blobStoreListeners.safeForEach(listener -> { + listener.handleRemoveBlobStore(infoToRemove); + }); } catch (IOException | GeoWebCacheException e) { throw new ConfigurationPersistenceException(e); } @@ -1083,10 +1020,9 @@ public synchronized void modifyBlobStore(BlobStoreInfo info) { // ensure there is a BlobStoreInfo with the name final Optional optionalInfo = getBlobStore(info.getName()); if (!optionalInfo.isPresent()) { - throw new NoSuchElementException( - String.format( - "Failed to modify BlobStoreInfo. A BlobStoreInfo with name \"%s\" does not exist.", - info.getName())); + throw new NoSuchElementException(String.format( + "Failed to modify BlobStoreInfo. A BlobStoreInfo with name \"%s\" does not exist.", + info.getName())); } // remove existing and add the new one final List blobStores = getGwcConfig().getBlobStores(); @@ -1104,10 +1040,9 @@ public synchronized void modifyBlobStore(BlobStoreInfo info) { String.format("Unable to modify BlobStoreInfo \"%s\"", info.getName()), ioe); } try { - blobStoreListeners.safeForEach( - listener -> { - listener.handleModifyBlobStore(info); - }); + blobStoreListeners.safeForEach(listener -> { + listener.handleModifyBlobStore(info); + }); } catch (IOException | GeoWebCacheException e) { if (ExceptionUtils.isOrSuppresses(e, UnsuitableStorageException.class)) { // Can't store here, roll back @@ -1130,10 +1065,9 @@ public int getBlobStoreCount() { @Override public Set getBlobStoreNames() { return getGwcConfig().getBlobStores().stream() - .map( - (info) -> { - return info.getName(); - }) + .map((info) -> { + return info.getName(); + }) .collect(Collectors.toSet()); } @@ -1165,9 +1099,7 @@ public void renameBlobStore(String oldName, String newName) final Optional newInfo = getBlobStore(newName); if (newInfo.isPresent()) { throw new IllegalArgumentException( - "BlobStoreInfo rename unsuccessful. A BlobStoreInfo with name \"" - + newName - + "\" already exists."); + "BlobStoreInfo rename unsuccessful. A BlobStoreInfo with name \"" + newName + "\" already exists."); } // get the list of BlobStoreInfos final List blobStoreInfos = getGwcConfig().getBlobStores(); @@ -1190,9 +1122,7 @@ public void renameBlobStore(String oldName, String newName) // if we didn't remove one, it wasn't in there to be removed if (blobStoreInfoToRename == null) { throw new NoSuchElementException( - "BlobStoreInfo rename unsuccessful. No BlobStoreInfo with name \"" - + oldName - + "\" exists."); + "BlobStoreInfo rename unsuccessful. No BlobStoreInfo with name \"" + oldName + "\" exists."); } // rename it and add it back to the list // for BlobStoreInfo instances, "name" and "id" are the same thing. @@ -1203,10 +1133,7 @@ public void renameBlobStore(String oldName, String newName) save(); if (log.isLoggable(Level.FINER)) { - log.finer( - String.format( - "BlobStoreInfo rename from \"%s\" to \"%s\" successful.", - oldName, newName)); + log.finer(String.format("BlobStoreInfo rename from \"%s\" to \"%s\" successful.", oldName, newName)); } } catch (IOException ioe) { // save didn't work, need to roll things back @@ -1223,25 +1150,20 @@ public void renameBlobStore(String oldName, String newName) if (blobStoreInfoToRevert == null) { // we're really messed up now as we couldn't find the BlobStoreInfo that was just // renamed. - throw new ConfigurationPersistenceException( - String.format( - "Error reverting BlobStoreInfo modification. Could not revert rename from \"%s\" to \"%s\"", - oldName, newName)); + throw new ConfigurationPersistenceException(String.format( + "Error reverting BlobStoreInfo modification. Could not revert rename from \"%s\" to \"%s\"", + oldName, newName)); } // revert the name and add it back to the list blobStoreInfoToRevert.setName(oldName); blobStoreInfos.add(blobStoreInfoToRevert); throw new ConfigurationPersistenceException( - String.format( - "Unable to rename BlobStoreInfo from \"%s\" to \"%s\"", - oldName, newName), - ioe); + String.format("Unable to rename BlobStoreInfo from \"%s\" to \"%s\"", oldName, newName), ioe); } try { - blobStoreListeners.safeForEach( - listener -> { - listener.handleRenameBlobStore(oldName, blobStoreInfoToRename); - }); + blobStoreListeners.safeForEach(listener -> { + listener.handleRenameBlobStore(oldName, blobStoreInfoToRename); + }); } catch (IOException | GeoWebCacheException e) { throw new ConfigurationPersistenceException( String.format( @@ -1294,10 +1216,7 @@ private GeoWebCacheConfiguration getGwcConfig() { } } catch (ConfigurationException e) { throw new IllegalStateException( - "Configuration " - + getIdentifier() - + " is not fully initialized and lazy initialization failed", - e); + "Configuration " + getIdentifier() + " is not fully initialized and lazy initialization failed", e); } return gwcConfig; } @@ -1318,11 +1237,9 @@ public Boolean isWmtsCiteCompliant() { } /** - * Can be used to force WMTS service implementation to be strictly compliant with the - * correspondent CITE tests. + * Can be used to force WMTS service implementation to be strictly compliant with the correspondent CITE tests. * - * @param wmtsCiteStrictCompliant TRUE or FALSE, activating or deactivation CITE strict - * compliance mode for WMTS + * @param wmtsCiteStrictCompliant TRUE or FALSE, activating or deactivation CITE strict compliance mode for WMTS */ @Override public void setWmtsCiteCompliant(Boolean wmtsCiteStrictCompliant) throws IOException { @@ -1420,8 +1337,7 @@ public synchronized void removeGridSet(String gridSetName) { assert Objects.isNull(gsRemoved) == Objects.isNull(xgsRemoved); if (Objects.isNull(gsRemoved)) { - throw new NoSuchElementException( - "Could not remeove GridSet " + gridSetName + " as it does not exist"); + throw new NoSuchElementException("Could not remeove GridSet " + gridSetName + " as it does not exist"); } try { @@ -1429,8 +1345,7 @@ public synchronized void removeGridSet(String gridSetName) { } catch (IOException ex) { getGridSetsInternal().put(gridSetName, gsRemoved); getGwcConfig().getGridSets().add(xgsRemoved); - throw new ConfigurationPersistenceException( - "Could not persist removal of Gridset " + gridSetName, ex); + throw new ConfigurationPersistenceException("Could not persist removal of Gridset " + gridSetName, ex); } } @@ -1453,9 +1368,7 @@ protected Map getGridSetsInternal() { @Override public Collection getGridSets() { - return getGridSetsInternal().values().stream() - .map(GridSet::new) - .collect(Collectors.toList()); + return getGridSetsInternal().values().stream().map(GridSet::new).collect(Collectors.toList()); } @Override diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfigurationProvider.java b/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfigurationProvider.java index f08a333517..b31080eaca 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfigurationProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/XMLConfigurationProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -17,21 +16,18 @@ import com.thoughtworks.xstream.XStream; /** - * Extension point for {@link XMLConfiguration} to allow decoupled modules to contribute to the - * configuration set up in order to extend the {@code geowebcache.xml} contents with new constructs. + * Extension point for {@link XMLConfiguration} to allow decoupled modules to contribute to the configuration set up in + * order to extend the {@code geowebcache.xml} contents with new constructs. * * @author Gabriel Roldan */ public interface XMLConfigurationProvider { /** - * Allows an extension to enhance the {@link XMLConfiguration} XStream persister to handle new - * contructs. + * Allows an extension to enhance the {@link XMLConfiguration} XStream persister to handle new contructs. * - * @param xs the XStream persister configured with the default elements from {@link - * XMLConfiguration} - * @return the modified (possibly the same) XStream persister with the extension point's added - * xml mappings + * @param xs the XStream persister configured with the default elements from {@link XMLConfiguration} + * @return the modified (possibly the same) XStream persister with the extension point's added xml mappings */ XStream getConfiguredXStream(XStream xs); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/XMLFileResourceProvider.java b/geowebcache/core/src/main/java/org/geowebcache/config/XMLFileResourceProvider.java index e039bb4d8e..15c42a0493 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/XMLFileResourceProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/XMLFileResourceProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, Marius Suta, The Open Planning Project, Copyright 2008 - 2015 * @author Niels Charlier @@ -65,8 +64,7 @@ public XMLFileResourceProvider( throws ConfigurationException { if (configFileDirectory == null && storageDirFinder == null) { - throw new NullPointerException( - "At least one of configFileDirectory or storageDirFinder must not be null"); + throw new NullPointerException("At least one of configFileDirectory or storageDirFinder must not be null"); } this.context = appCtx; @@ -76,24 +74,19 @@ public XMLFileResourceProvider( // Use the given path if (new File(configFileDirectory).isAbsolute()) { - log.config( - "Provided configuration directory as absolute path '" - + configFileDirectory - + "'"); + log.config("Provided configuration directory as absolute path '" + configFileDirectory + "'"); this.configDirectory = new File(configFileDirectory); } else { ServletContext servletContext = context.getServletContext(); if (servletContext != null) { String baseDir = servletContext.getRealPath(""); - log.config( - "Provided configuration directory relative to servlet context '" - + baseDir - + "': " - + configFileDirectory); + log.config("Provided configuration directory relative to servlet context '" + + baseDir + + "': " + + configFileDirectory); this.configDirectory = new File(baseDir, configFileDirectory); } else { - throw new IllegalStateException( - "Unexpected, cannot locate the config directory"); + throw new IllegalStateException("Unexpected, cannot locate the config directory"); } } } else { @@ -117,8 +110,7 @@ public XMLFileResourceProvider( } /** - * Constructor that will look for {@code geowebcache.xml} at the directory defined by {@code - * storageDirFinder} + * Constructor that will look for {@code geowebcache.xml} at the directory defined by {@code storageDirFinder} * * @param appCtx use to lookup {@link XMLConfigurationProvider} extenions, may be {@code null} */ @@ -127,16 +119,11 @@ public XMLFileResourceProvider( final ApplicationContextProvider appCtx, final DefaultStorageFinder storageDirFinder) throws ConfigurationException { - this( - configFileName, - appCtx, - getConfigDirVar(appCtx.getApplicationContext()), - storageDirFinder); + this(configFileName, appCtx, getConfigDirVar(appCtx.getApplicationContext()), storageDirFinder); } /** - * Constructor that will look for {@code geowebcache.xml} at the directory defined by {@code - * storageDirFinder} + * Constructor that will look for {@code geowebcache.xml} at the directory defined by {@code storageDirFinder} * * @param appCtx use to lookup {@link XMLConfigurationProvider} extenions, may be {@code null} */ @@ -183,16 +170,13 @@ private File findConfigFile() throws IOException { } if (!configDirectory.exists() && !configDirectory.mkdirs()) { - throw new IOException( - "TileLayerConfiguration directory does not exist and cannot be created: '" - + configDirectory.getAbsolutePath() - + "'"); + throw new IOException("TileLayerConfiguration directory does not exist and cannot be created: '" + + configDirectory.getAbsolutePath() + + "'"); } if (!configDirectory.canWrite()) { throw new IOException( - "TileLayerConfiguration directory is not writable: '" - + configDirectory.getAbsolutePath() - + "'"); + "TileLayerConfiguration directory is not writable: '" + configDirectory.getAbsolutePath() + "'"); } File xmlFile = new File(configDirectory, configFileName); @@ -216,11 +200,10 @@ private File findOrCreateConfFile() throws IOException { if (xmlFile.exists()) { log.config("Found configuration file in " + configDirectory.getAbsolutePath()); } else if (templateLocation != null) { - log.warning( - "Found no configuration file in config directory, will create one at '" - + xmlFile.getAbsolutePath() - + "' from template " - + getClass().getResource(templateLocation).toExternalForm()); + log.warning("Found no configuration file in config directory, will create one at '" + + xmlFile.getAbsolutePath() + + "' from template " + + getClass().getResource(templateLocation).toExternalForm()); // grab template from classpath try { try (InputStream templateStream = getClass().getResourceAsStream(templateLocation); @@ -229,8 +212,7 @@ private File findOrCreateConfFile() throws IOException { output.flush(); } } catch (IOException e) { - throw new IOException( - "Error copying template config to " + xmlFile.getAbsolutePath(), e); + throw new IOException("Error copying template config to " + xmlFile.getAbsolutePath(), e); } } @@ -244,28 +226,21 @@ private void backUpConfig(final File xmlFile) throws IOException { log.fine("Backing up config file " + xmlFile.getName() + " to " + backUpFileName); - String[] previousBackUps = - parentFile.list( - (dir, name) -> { - if (configFileName.equals(name)) { - return false; - } - if (name.startsWith(configFileName) && name.endsWith(".bak")) { - return true; - } - return false; - }); + String[] previousBackUps = parentFile.list((dir, name) -> { + if (configFileName.equals(name)) { + return false; + } + if (name.startsWith(configFileName) && name.endsWith(".bak")) { + return true; + } + return false; + }); final int maxBackups = 10; if (previousBackUps != null && previousBackUps.length > maxBackups) { Arrays.sort(previousBackUps); String oldest = previousBackUps[0]; - log.fine( - "Deleting oldest config backup " - + oldest - + " to keep a maximum of " - + maxBackups - + " backups."); + log.fine("Deleting oldest config backup " + oldest + " to keep a maximum of " + maxBackups + " backups."); new File(parentFile, oldest).delete(); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSet.java b/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSet.java index d7d99d7d0d..c1707cab07 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSet.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSet.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -67,10 +66,13 @@ public XMLGridSet() { public XMLGridSet(XMLGridSet orig) { setAlignTopLeft(orig.getAlignTopLeft()); setExtent(orig.getExtent() == null ? null : new BoundingBox(orig.getExtent())); - setResolutions(orig.getResolutions() == null ? null : orig.getResolutions().clone()); + setResolutions( + orig.getResolutions() == null ? null : orig.getResolutions().clone()); setLevels(orig.getLevels()); setScaleDenominators( - orig.getScaleDenominators() == null ? null : orig.getScaleDenominators().clone()); + orig.getScaleDenominators() == null + ? null + : orig.getScaleDenominators().clone()); setMetersPerUnit(orig.getMetersPerUnit()); setName(orig.getName()); setDescription(orig.getDescription()); @@ -185,38 +187,36 @@ public GridSet makeGridSet() { Boolean yCoordinateFirst = getYCoordinateFirst(); if (getResolutions() != null || getScaleDenominators() != null) { - gridSet = - GridSetFactory.createGridSet( - name, - srs, - extent, - alignTopLeft, - resolutions, - scaleDenominators, - metersPerUnit, - pixelSize, - scaleNames, - tileWidth, - tileHeight, - yCoordinateFirst); + gridSet = GridSetFactory.createGridSet( + name, + srs, + extent, + alignTopLeft, + resolutions, + scaleDenominators, + metersPerUnit, + pixelSize, + scaleNames, + tileWidth, + tileHeight, + yCoordinateFirst); } else { if (getLevels() == null) { setLevels(18); } Integer levels = getLevels(); - gridSet = - GridSetFactory.createGridSet( - name, - srs, - extent, - alignTopLeft, - levels, - metersPerUnit, - pixelSize, - tileWidth, - tileHeight, - yCoordinateFirst); + gridSet = GridSetFactory.createGridSet( + name, + srs, + extent, + alignTopLeft, + levels, + metersPerUnit, + pixelSize, + tileWidth, + tileHeight, + yCoordinateFirst); } gridSet.setDescription(getDescription()); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSubset.java b/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSubset.java index 73b81043f5..e612895237 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSubset.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/XMLGridSubset.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -70,10 +69,7 @@ public XMLGridSubset(XMLGridSubset sset) { /** Builds an XMLGridSubset out of a {@link GridSubset} */ public XMLGridSubset(GridSubset sset) { setGridSetName(sset.getName()); - setExtent( - sset.getOriginalExtent() == null - ? null - : new BoundingBox(sset.getOriginalExtent())); + setExtent(sset.getOriginalExtent() == null ? null : new BoundingBox(sset.getOriginalExtent())); setZoomStart(sset.getZoomStart()); setZoomStop(sset.getZoomStop()); setMinCachedLevel(sset.getMinCachedZoom()); @@ -94,12 +90,7 @@ public GridSubset getGridSubSet(GridSetBroker gridSetBroker) { return null; } return GridSubsetFactory.createGridSubSet( - gridSet, - getExtent(), - getZoomStart(), - getZoomStop(), - minCachedLevel, - maxCachedLevel); + gridSet, getExtent(), getZoomStart(), getZoomStop(), minCachedLevel, maxCachedLevel); } public String getGridSetName() { diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/XMLOldGrid.java b/geowebcache/core/src/main/java/org/geowebcache/config/XMLOldGrid.java index f4b2e11378..7b72e939ff 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/XMLOldGrid.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/XMLOldGrid.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -27,13 +26,9 @@ /** * This class exists mainly to parse the old XML objects using XStream * - *

The problem is that it cannot use the GridSetBroker, so we end up with one GridSet per layer - * anyway. + *

The problem is that it cannot use the GridSetBroker, so we end up with one GridSet per layer anyway. */ -@SuppressFBWarnings({ - "NP_UNWRITTEN_FIELD", - "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", - "UWF_NULL_FIELD" +@SuppressFBWarnings({"NP_UNWRITTEN_FIELD", "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_NULL_FIELD" }) // field assignment done by XStream public class XMLOldGrid implements Serializable { @@ -72,52 +67,45 @@ public GridSubset convertToGridSubset(GridSetBroker gridSetBroker) { GridSet gridSet; - if (srs.equals(SRS.getEPSG4326()) - && gridBounds.equals(BoundingBox.WORLD4326) - && resolutions == null) { + if (srs.equals(SRS.getEPSG4326()) && gridBounds.equals(BoundingBox.WORLD4326) && resolutions == null) { gridSet = gridSetBroker.getWorldEpsg4326(); - } else if (srs.equals(SRS.getEPSG3857()) - && gridBounds.equals(BoundingBox.WORLD3857) - && resolutions == null) { + } else if (srs.equals(SRS.getEPSG3857()) && gridBounds.equals(BoundingBox.WORLD3857) && resolutions == null) { gridSet = gridSetBroker.getWorldEpsg3857(); } else { if (resolutions != null) { - gridSet = - GridSetFactory.createGridSet( - srs.toString(), - srs, - gridBounds, - false, - resolutions, - null, - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - null, - 256, - 256, - false); + gridSet = GridSetFactory.createGridSet( + srs.toString(), + srs, + gridBounds, + false, + resolutions, + null, + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + null, + 256, + 256, + false); } else { if (zoomStop == null) { zoomStop = 30; } - gridSet = - GridSetFactory.createGridSet( - srs.toString(), - srs, - gridBounds, - false, - zoomStop + 1, - null, - GridSetFactory.DEFAULT_PIXEL_SIZE_METER, - 256, - 256, - false); + gridSet = GridSetFactory.createGridSet( + srs.toString(), + srs, + gridBounds, + false, + zoomStop + 1, + null, + GridSetFactory.DEFAULT_PIXEL_SIZE_METER, + 256, + 256, + false); } } - GridSubset gridSubset = - GridSubsetFactory.createGridSubSet(gridSet, dataBounds, zoomStart, zoomStop); + GridSubset gridSubset = GridSubsetFactory.createGridSubSet(gridSet, dataBounds, zoomStart, zoomStop); return gridSubset; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfo.java b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfo.java index 1d1ebd597d..6335cbac08 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfo.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfo.java @@ -1,22 +1,21 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Nuno Oliveira, GeoSolutions S.A.S., Copyright 2017 */ package org.geowebcache.config.legends; /** - * Simple container for the information related with a style legends. Builder {@link - * LegendInfoBuilder} should be used to create instances of this class. + * Simple container for the information related with a style legends. Builder {@link LegendInfoBuilder} should be used + * to create instances of this class. */ public class LegendInfo { diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfoBuilder.java b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfoBuilder.java index bfd077d6d8..5346b4ce70 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfoBuilder.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendInfoBuilder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Nuno Oliveira, GeoSolutions S.A.S., Copyright 2017 */ @@ -123,13 +122,11 @@ public LegendInfo build() { String finalStyleName = styleName == null ? "" : styleName; // building the legend url String finalUrl = buildFinalUrl(finalStyleName, finalWidth, finalHeight, finalFormat); - return new LegendInfo( - finalStyleName, finalWidth, finalHeight, finalFormat, finalUrl, minScale, maxScale); + return new LegendInfo(finalStyleName, finalWidth, finalHeight, finalFormat, finalUrl, minScale, maxScale); } /** Helper method that builds the legend get url using the available info. */ - private String buildFinalUrl( - String finalStyleName, Integer finalWidth, Integer finalHeight, String finalFormat) { + private String buildFinalUrl(String finalStyleName, Integer finalWidth, Integer finalHeight, String finalFormat) { if (completeUrl != null) { // we have a complete url so let's just return it return completeUrl; @@ -156,8 +153,8 @@ private String buildFinalUrl( } /** - * Helper method check's if a quote separating the base url from the query parameters needs to - * be added to the url or not. + * Helper method check's if a quote separating the base url from the query parameters needs to be added to the url + * or not. */ private String addQuoteMark(String finalUrl) { if (finalUrl.indexOf("?") == finalUrl.length() - 1) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendRawInfo.java b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendRawInfo.java index fe75050391..9aa3247006 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendRawInfo.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendRawInfo.java @@ -1,23 +1,19 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Nuno Oliveira, GeoSolutions S.A.S., Copyright 2017 */ package org.geowebcache.config.legends; -/** - * Contains the raw information about a style legend as it may appear in the XML configuration for - * example. - */ +/** Contains the raw information about a style legend as it may appear in the XML configuration for example. */ public class LegendRawInfo { private String style; @@ -93,16 +89,9 @@ public void setMaxScale(Double maxScale) { this.maxScale = maxScale; } - /** - * Build the concrete legend information using the provided layer information and defaults - * values. - */ + /** Build the concrete legend information using the provided layer information and defaults values. */ public LegendInfo getLegendInfo( - String layerName, - String layerUrl, - Integer defaultWidth, - Integer defaultHeight, - String defaultFormat) { + String layerName, String layerUrl, Integer defaultWidth, Integer defaultHeight, String defaultFormat) { return new LegendInfoBuilder() .withLayerName(layerName) .withLayerUrl(layerUrl) @@ -130,10 +119,8 @@ public boolean equals(Object other) { if (height != null ? !height.equals(that.height) : that.height != null) return false; if (format != null ? !format.equals(that.format) : that.format != null) return false; if (url != null ? !url.equals(that.url) : that.url != null) return false; - if (completeUrl != null ? !completeUrl.equals(that.completeUrl) : that.completeUrl != null) - return false; - if (minScale != null ? !minScale.equals(that.minScale) : that.minScale != null) - return false; + if (completeUrl != null ? !completeUrl.equals(that.completeUrl) : that.completeUrl != null) return false; + if (minScale != null ? !minScale.equals(that.minScale) : that.minScale != null) return false; return maxScale != null ? maxScale.equals(that.maxScale) : that.maxScale == null; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfo.java b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfo.java index 5fd9bf651a..30009a6c21 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfo.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Nuno Oliveira, GeoSolutions S.A.S., Copyright 2017 */ @@ -61,16 +60,15 @@ public List getLegendsRawInfo() { } /** - * Builds the concrete legends info for each raw legend info using the provided layer - * information. The returned map index the legend info per layer. + * Builds the concrete legends info for each raw legend info using the provided layer information. The returned map + * index the legend info per layer. */ public Map getLegendsInfo(String layerName, String layerUrl) { Map legendsInfo = new HashMap<>(); for (LegendRawInfo legendRawInfo : legendsRawInfo) { legendsInfo.put( legendRawInfo.getStyle(), - legendRawInfo.getLegendInfo( - layerName, layerUrl, defaultWidth, defaultHeight, defaultFormat)); + legendRawInfo.getLegendInfo(layerName, layerUrl, defaultWidth, defaultHeight, defaultFormat)); } return legendsInfo; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfoConverter.java b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfoConverter.java index 971f086929..eb5b1f3011 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfoConverter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/legends/LegendsRawInfoConverter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Nuno Oliveira, GeoSolutions S.A.S., Copyright 2017 */ @@ -24,8 +23,7 @@ public class LegendsRawInfoConverter implements Converter { @Override - public void marshal( - Object source, HierarchicalStreamWriter writer, MarshallingContext context) { + public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { LegendsRawInfo legendsRawInfo = (LegendsRawInfo) source; // encode default values writer.addAttribute("defaultWidth", String.valueOf(legendsRawInfo.getDefaultWidth())); diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceContact.java b/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceContact.java index 14412af45a..9b781eac53 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceContact.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceContact.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceInformation.java b/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceInformation.java index d8ebe54457..9cd7a2c980 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceInformation.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceInformation.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceProvider.java b/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceProvider.java index 60d0edd140..5019304f25 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/meta/ServiceProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/controller/GeoWebCacheDispatcherController.java b/geowebcache/core/src/main/java/org/geowebcache/controller/GeoWebCacheDispatcherController.java index a093edc8af..086ddd8508 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/controller/GeoWebCacheDispatcherController.java +++ b/geowebcache/core/src/main/java/org/geowebcache/controller/GeoWebCacheDispatcherController.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -39,8 +38,7 @@ public class GeoWebCacheDispatcherController { private GeoWebCacheDispatcher gwcDispatcher; @RequestMapping(path = {"", "/home", "/service/**", "/demo/**", "/proxy/**"}) - public void handleRestApiRequest(HttpServletRequest request, HttpServletResponse response) - throws Exception { + public void handleRestApiRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { gwcDispatcher.handleRequest( new HttpServletRequestWrapper(request) { @Override diff --git a/geowebcache/core/src/main/java/org/geowebcache/conveyor/Conveyor.java b/geowebcache/core/src/main/java/org/geowebcache/conveyor/Conveyor.java index 93fcf446dc..115e4e2a88 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/conveyor/Conveyor.java +++ b/geowebcache/core/src/main/java/org/geowebcache/conveyor/Conveyor.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -19,9 +18,7 @@ import org.geowebcache.mime.MimeType; import org.geowebcache.storage.StorageBroker; -/** - * Represents a request against a tile service and carries the information needed to complete it. - */ +/** Represents a request against a tile service and carries the information needed to complete it. */ public abstract class Conveyor { /** Should the request represented by this conveyor be handled by the service or the layer */ @@ -66,8 +63,7 @@ public static enum CacheResult { protected CacheResult cacheResult; - protected Conveyor( - String layerId, StorageBroker sb, HttpServletRequest srq, HttpServletResponse srp) { + protected Conveyor(String layerId, StorageBroker sb, HttpServletRequest srq, HttpServletResponse srp) { this.layerId = layerId; storageBroker = sb; servletReq = srq; diff --git a/geowebcache/core/src/main/java/org/geowebcache/conveyor/ConveyorTile.java b/geowebcache/core/src/main/java/org/geowebcache/conveyor/ConveyorTile.java index 0baf3e2c74..4c0bb4b8a9 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/conveyor/ConveyorTile.java +++ b/geowebcache/core/src/main/java/org/geowebcache/conveyor/ConveyorTile.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -60,10 +59,7 @@ public class ConveyorTile extends Conveyor implements TileResponseReceiver { private boolean isMetaTileCacheOnly; public ConveyorTile( - StorageBroker sb, - String layerId, - HttpServletRequest servletReq, - HttpServletResponse servletResp) { + StorageBroker sb, String layerId, HttpServletRequest servletReq, HttpServletResponse servletResp) { super(layerId, sb, servletReq, servletResp); } @@ -78,15 +74,7 @@ public ConveyorTile( Map filteringParameters, HttpServletRequest servletReq, HttpServletResponse servletResp) { - this( - sb, - layerId, - gridSetId, - tileIndex, - mimeType, - filteringParameters, - servletReq, - servletResp); + this(sb, layerId, gridSetId, tileIndex, mimeType, filteringParameters, servletReq, servletResp); this.fullParameters = fullParameters; } @@ -116,9 +104,7 @@ public ConveyorTile( this.filteringParameters = filteringParameters; - stObj = - TileObject.createQueryTileObject( - layerId, idx, gridSetId, mimeType.getFormat(), filteringParameters); + stObj = TileObject.createQueryTileObject(layerId, idx, gridSetId, mimeType.getFormat(), filteringParameters); } public Map getFilteringParameters() { diff --git a/geowebcache/core/src/main/java/org/geowebcache/demo/Demo.java b/geowebcache/core/src/main/java/org/geowebcache/demo/Demo.java index 135892dd70..df3d073db8 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/demo/Demo.java +++ b/geowebcache/core/src/main/java/org/geowebcache/demo/Demo.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -74,8 +73,7 @@ public static void makeMap( String rawGridSet = request.getParameter("gridSet"); String gridSetStr = null; - if (rawGridSet != null) - gridSetStr = ServletUtils.URLDecode(rawGridSet, request.getCharacterEncoding()); + if (rawGridSet != null) gridSetStr = ServletUtils.URLDecode(rawGridSet, request.getCharacterEncoding()); if (gridSetStr == null) { gridSetStr = request.getParameter("srs"); @@ -101,8 +99,7 @@ public static void makeMap( if (request.getRequestURI().endsWith("/")) { try { String reqUri = request.getRequestURI(); - response.sendRedirect( - response.encodeRedirectURL(reqUri.substring(0, reqUri.length() - 1))); + response.sendRedirect(response.encodeRedirectURL(reqUri.substring(0, reqUri.length() - 1))); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error sending redirect response", e); } @@ -121,8 +118,7 @@ public static void makeMap( } } - private static String generateHTML( - TileLayerDispatcher tileLayerDispatcher, GridSetBroker gridSetBroker) + private static String generateHTML(TileLayerDispatcher tileLayerDispatcher, GridSetBroker gridSetBroker) throws GeoWebCacheException { String reloadPath = "rest/reload"; String truncatePath = "rest/masstruncate"; @@ -133,47 +129,43 @@ private static String generateHTML( buf.append(ServletUtils.gwcHtmlHeader("", "GWC Demos")); buf.append("\n"); buf.append(ServletUtils.gwcHtmlLogoLink("")); - buf.append( - "

Total number of requests:" - + (requestCount >= 0 ? requestCount + "" : "Unavailable")); + str.append("
Total number of requests:" + + (requestCount >= 0 ? requestCount + "" : "Unavailable")); str.append("
Total number of evicted tiles:" - + (evictionCount >= 0 ? evictionCount + "" : "Unavailable")); + str.append("
Total number of evicted tiles:" + + (evictionCount >= 0 ? evictionCount + "" : "Unavailable")); str.append("
Cache Memory occupation:" - + (currentMemory >= 0 ? currentMemory + " %" : "Unavailable")); + str.append("
Cache Memory occupation:" + + (currentMemory >= 0 ? currentMemory + " %" : "Unavailable")); str.append("
Cache Actual Size/ Total Size :" - + (totalSize >= 0 && actualSize >= 0 - ? actualSize + " / " + totalSize + " Mb" - : "Unavailable")); + str.append("
Cache Actual Size/ Total Size :" + + (totalSize >= 0 && actualSize >= 0 ? actualSize + " / " + totalSize + " Mb" : "Unavailable")); str.append("
\n" - + "\n" - + "\n" - + "\n"); + buf.append("
Layer name:Enabled:Grids Sets:
\n" + + "\n" + + "\n" + + "\n"); buf.append("\n"); tableRows(buf, tileLayerDispatcher, gridSetBroker); buf.append("
Layer name:Enabled:Grids Sets:
\n"); buf.append("
"); - buf.append( - "These are just quick demos. GeoWebCache also supports:
\n" - + "
  • WMTS, TMS, Virtual Earth and Google Maps
  • \n" - + "
  • Proxying GetFeatureInfo, GetLegend and other WMS requests
  • \n" - + "
  • Advanced request and parameter filters
  • \n" - + "
  • Output format adjustments, such as compression level
  • \n" - + "
  • Adjustable expiration headers and automatic cache expiration
  • \n" - + "
  • RESTful interface for seeding and configuration (beta)
  • \n" - + "
\n" - + "
\n" - + "Reload TileLayerConfiguration:
\n" - + "

You can reload the configuration by pressing the following button. " - + "The username / password is configured in WEB-INF/user.properties, or the admin " - + " user in GeoServer if you are using the plugin.

\n" - + "
These are just quick demos. GeoWebCache also supports:
\n" + + "
  • WMTS, TMS, Virtual Earth and Google Maps
  • \n" + + "
  • Proxying GetFeatureInfo, GetLegend and other WMS requests
  • \n" + + "
  • Advanced request and parameter filters
  • \n" + + "
  • Output format adjustments, such as compression level
  • \n" + + "
  • Adjustable expiration headers and automatic cache expiration
  • \n" + + "
  • RESTful interface for seeding and configuration (beta)
  • \n" + + "
\n" + + "
\n" + + "Reload TileLayerConfiguration:
\n" + + "

You can reload the configuration by pressing the following button. " + + "The username / password is configured in WEB-INF/user.properties, or the admin " + + " user in GeoServer if you are using the plugin.

\n" + + "" - + "" - + "" - + "
" - + "
Truncate All Layers:
\n" - + "

Truncate all layers" - + "

" + + "" + + "" + + "
" + + "
Truncate All Layers:
\n" + + "

Truncate all layers" + + "

\" value=\"\"/>" - + "" - + "

" - + ""); + .append("\" method=\"post\">\" value=\"\"/>" + + "" + + "
" + + ""); return buf.toString(); } @@ -192,9 +184,7 @@ private static void tableRows( buf.append("") .append(escapedLayerName) .append("
\n"); - buf.append("Seed this layer\n"); + buf.append("Seed this layer\n"); buf.append("").append(layer.isEnabled()).append(""); buf.append(""); @@ -208,16 +198,10 @@ private static void tableRows( buf.append(""); str.append("\n"); - str.append( - "\n"); @@ -196,9 +186,8 @@ public String getHTMLStats() { str.append(" (" + totalWMS / (runningTime) + "/s ) "); str.append("\n"); - str.append( - "\n"); @@ -211,8 +200,7 @@ public String getHTMLStats() { str.append(""); } - str.append( - "\n"); - str.append( - ""); str.append(""); - str.append( - "\n"); - str.append( - "\n"); + str.append("\n"); } str.append(""); str.append(""); - str.append( - ""); + str.append(""); - str.append( - ""); + str.append(""); str.append(""); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStore.java b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStore.java index 5851e38be5..484b194f9e 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStore.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2009 */ @@ -31,8 +30,7 @@ /** * Manages the persistence of the actual data contained in cacheable objects (tiles, WFS responses). * - *

Blobstores may assume that the StorageObjects passed to them are completely filled in except - * for the blob fields. + *

Blobstores may assume that the StorageObjects passed to them are completely filled in except for the blob fields. */ public interface BlobStore { static Logger log = Logging.getLogger(BlobStore.class.getName()); @@ -50,8 +48,7 @@ public interface BlobStore { * * @return {@literal true} if successful, {@literal false} otherwise */ - public boolean deleteByGridsetId(final String layerName, final String gridSetId) - throws StorageException; + public boolean deleteByGridsetId(final String layerName, final String gridSetId) throws StorageException; /** * Delete the cache for the named layer and parameters. @@ -59,8 +56,8 @@ public boolean deleteByGridsetId(final String layerName, final String gridSetId) * @param parameters Complete filtered parameters to generate the ID * @return {@literal true} if successful, {@literal false} otherwise */ - public default boolean deleteByParameters( - final String layerName, final Map parameters) throws StorageException { + public default boolean deleteByParameters(final String layerName, final Map parameters) + throws StorageException { return deleteByParametersId(layerName, ParametersUtils.getId(parameters)); } @@ -69,12 +66,11 @@ public default boolean deleteByParameters( * * @return {@literal true} if successful, {@literal false} otherwise */ - public boolean deleteByParametersId(final String layerName, String parametersId) - throws StorageException; + public boolean deleteByParametersId(final String layerName, String parametersId) throws StorageException; /** - * Delete the cached blob associated with the specified TileObject. The passed in object itself - * will not be modified. + * Delete the cached blob associated with the specified TileObject. The passed in object itself will not be + * modified. * * @return {@literal true} if successful, {@literal false} otherwise */ @@ -120,8 +116,7 @@ public boolean deleteByParametersId(final String layerName, String parametersId) public boolean removeListener(BlobStoreListener listener); /** Get the cached parameter maps for a layer */ - public default Set> getParameters(String layerName) - throws StorageException { + public default Set> getParameters(String layerName) throws StorageException { return getParametersMapping(layerName).values().stream() .filter(Optional::isPresent) .map(Optional::get) @@ -131,9 +126,9 @@ public default Set> getParameters(String layerName) /** * Get the IDs of the cached parameter maps for a layer. * - *

Stores that predate 1.12 should implement this to provide any parameters for which maps - * are not available. Stores not using {@link ParametersUtils#getId(Map)} or which have more - * efficient ways to provide it should also implement it. + *

Stores that predate 1.12 should implement this to provide any parameters for which maps are not available. + * Stores not using {@link ParametersUtils#getId(Map)} or which have more efficient ways to provide it should also + * implement it. */ public default Set getParameterIds(String layerName) throws StorageException { return getParametersMapping(layerName).keySet(); @@ -145,34 +140,26 @@ public default Set getParameterIds(String layerName) throws StorageExcep * @param oldLayerName the old name of the layer * @param newLayerName the new name * @return {@literal true} if successful or the layer didn't exist, {@literal false} otherwise - * @throws StorageException if {@code newLayerName} already exists or the rename can't be - * accomplished for other reason + * @throws StorageException if {@code newLayerName} already exists or the rename can't be accomplished for other + * reason */ public boolean rename(String oldLayerName, String newLayerName) throws StorageException; - /** - * @return the value of the stored metadata for the given layer and key, or {@code null} if no - * such value exists - */ + /** @return the value of the stored metadata for the given layer and key, or {@code null} if no such value exists */ public String getLayerMetadata(String layerName, String key); /** Stores a metadata key/value pair for the given layer */ public void putLayerMetadata(String layerName, String key, String value); - /** - * @return {@code true} if the blobstore has a layer named {@code layerName} in use, {@code - * false} otherwise - */ + /** @return {@code true} if the blobstore has a layer named {@code layerName} in use, {@code false} otherwise */ public boolean layerExists(String layerName); /** - * Gets the mapping from parameter IDs to parameter maps. For cache parameter IDs that lack - * reverse mappings (as produced by GWC before 1.12) the ID will map to an empty {@link - * Optional}. + * Gets the mapping from parameter IDs to parameter maps. For cache parameter IDs that lack reverse mappings (as + * produced by GWC before 1.12) the ID will map to an empty {@link Optional}. * * @param layerName The layer to look up. - * @return A map from parameter IDs to {@link Optional}s containing parameter maps, or empty - * {@link Optional}s. + * @return A map from parameter IDs to {@link Optional}s containing parameter maps, or empty {@link Optional}s. * @since 1.12 */ Map>> getParametersMapping(String layerName); @@ -184,44 +171,40 @@ public default boolean purgeOrphans(TileLayer layer) throws StorageException { final List parameterFilters = layer.getParameterFilters(); // Given known parameter mapping, figures out if the parameters need to be purged - final Function, Boolean> parametersNeedPurge = - parameters -> { - return parameters.size() != parameterFilters.size() - || // Should have the same number of parameters as the layer has - // filters - parameterFilters.stream() - .allMatch( - pfilter -> { // Do all the parameter filters on the - // layer consider their parameter legal - final String key = pfilter.getKey(); - final String value = parameters.get(key); - if (Objects.isNull(value)) { - return true; // No parameter for this filter - // so purge - } - return !pfilter.isFilteredValue( - value); // purge if it's not a filtered - // value - }); - }; + final Function, Boolean> parametersNeedPurge = parameters -> { + return parameters.size() != parameterFilters.size() + || // Should have the same number of parameters as the layer has + // filters + parameterFilters.stream() + .allMatch( + pfilter -> { // Do all the parameter filters on the + // layer consider their parameter legal + final String key = pfilter.getKey(); + final String value = parameters.get(key); + if (Objects.isNull(value)) { + return true; // No parameter for this filter + // so purge + } + return !pfilter.isFilteredValue(value); // purge if it's not a filtered + // value + }); + }; return getParametersMapping(layer.getName()).entrySet().stream() - .filter( - parameterMapping -> { - return parameterMapping - .getValue() - .map(parametersNeedPurge) - .orElse(true); // Don't have the original values so purge - }) + .filter(parameterMapping -> { + return parameterMapping + .getValue() + .map(parametersNeedPurge) + .orElse(true); // Don't have the original values so purge + }) .map(Map.Entry::getKey) // The parameter id - .map( - id -> { - try { - return this.deleteByParametersId(layer.getName(), id); - } catch (StorageException e) { - throw new UncheckedIOException(e); - } - }) + .map(id -> { + try { + return this.deleteByParametersId(layer.getName(), id); + } catch (StorageException e) { + throw new UncheckedIOException(e); + } + }) .reduce((x, y) -> x || y) // OR results without short circuiting .orElse(false); } catch (UncheckedIOException ex) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreAggregator.java b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreAggregator.java index bc6d841ae2..25d7549b94 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreAggregator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreAggregator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2018 */ @@ -59,8 +58,7 @@ public BlobStoreAggregator() { } /** - * Add a new {@link BlobStoreConfiguration} to the BlobStoreAggregator configs configuration - * list. + * Add a new {@link BlobStoreConfiguration} to the BlobStoreAggregator configs configuration list. * * @param config a new {@link BlobStoreConfiguration} to add to the configs list */ @@ -99,27 +97,22 @@ public BlobStoreInfo getBlobStore(final String blobStoreName) throws GeoWebCache .filter(Optional::isPresent) .map(Optional::get) .findFirst() - .orElseThrow( - () -> - new GeoWebCacheException( - "Thread " - + Thread.currentThread().getName() - + " Unknown blob store " - + blobStoreName - + ". Check the logfiles," - + " it may not have loaded properly.")); + .orElseThrow(() -> new GeoWebCacheException("Thread " + + Thread.currentThread().getName() + + " Unknown blob store " + + blobStoreName + + ". Check the logfiles," + + " it may not have loaded properly.")); } /** - * * Reinitialization is tricky, because we can't really just lock all the blobstores, because - * this would cause people to queue on something that we may not want to exist post reinit. + * * Reinitialization is tricky, because we can't really just lock all the blobstores, because this would cause + * people to queue on something that we may not want to exist post reinit. * - *

So we'll just set the current blobstore set free, ready for garbage collection, and - * generate a new one. + *

So we'll just set the current blobstore set free, ready for garbage collection, and generate a new one. */ public void reInit() { - List extensions = - GeoWebCacheExtensions.extensions(BlobStoreConfiguration.class); + List extensions = GeoWebCacheExtensions.extensions(BlobStoreConfiguration.class); this.configs = new ArrayList<>(extensions); this.layers = GeoWebCacheExtensions.bean(TileLayerDispatcher.class); initialize(); @@ -140,8 +133,7 @@ public int getBlobStoreCount() { /** * Retrieve a list of all {@link BlobStoreInfo} names for each configuration. * - * @return A list of names that can be used to identify each of the {@link BlobStoreInfo}s - * currently configured. + * @return A list of names that can be used to identify each of the {@link BlobStoreInfo}s currently configured. */ public List getBlobStoreNames() { List names = new ArrayList<>(); @@ -152,16 +144,16 @@ public List getBlobStoreNames() { } /** - * Returns a list of all the blob stores. The consumer may still have to initialize each blob - * stores! + * Returns a list of all the blob stores. The consumer may still have to initialize each blob stores! * - *

Modifications to the returned blob stores do not change the internal list of blob stores, - * but blob stores ARE mutable. + *

Modifications to the returned blob stores do not change the internal list of blob stores, but blob stores ARE + * mutable. * * @return a list view of this blob store aggregators's internal blob stores */ public Iterable getBlobStores() { - List> perConfigBlobStores = new ArrayList<>(getConfigs().size()); + List> perConfigBlobStores = + new ArrayList<>(getConfigs().size()); for (BlobStoreConfiguration config : getConfigs()) { perConfigBlobStores.add(config.getBlobStores()); @@ -180,18 +172,14 @@ private void initialize() { private int initialize(BlobStoreConfiguration config) { if (config == null) { - throw new IllegalStateException( - "BlobStoreConfiguration got a null GWC configuration object"); + throw new IllegalStateException("BlobStoreConfiguration got a null GWC configuration object"); } String configIdent; try { configIdent = config.getIdentifier(); } catch (Exception gwce) { - log.log( - Level.SEVERE, - "Error obtaining identify from BlobStoreConfiguration " + config, - gwce); + log.log(Level.SEVERE, "Error obtaining identify from BlobStoreConfiguration " + config, gwce); return 0; } @@ -203,10 +191,7 @@ private int initialize(BlobStoreConfiguration config) { int blobStoreCount = config.getBlobStoreCount(); if (blobStoreCount <= 0) { - log.config( - "BlobStoreConfiguration " - + config.getIdentifier() - + " contained no blob store infos."); + log.config("BlobStoreConfiguration " + config.getIdentifier() + " contained no blob store infos."); } // Check whether there is any general service information @@ -218,8 +203,7 @@ private int initialize(BlobStoreConfiguration config) { } /** - * Service information such as you or your company's details that you want provided in - * capabilities documents. + * Service information such as you or your company's details that you want provided in capabilities documents. * * @return ServiceInformation */ @@ -233,29 +217,26 @@ public void destroy() throws Exception { } /** - * Finds out which {@link BlobStoreConfiguration} contains the given blob store, removes it, and - * saves the configuration. + * Finds out which {@link BlobStoreConfiguration} contains the given blob store, removes it, and saves the + * configuration. * * @param blobStoreName the name of the blob store to remove */ - public synchronized void removeBlobStore(final String blobStoreName) - throws IllegalArgumentException { + public synchronized void removeBlobStore(final String blobStoreName) throws IllegalArgumentException { for (BlobStoreConfiguration config : getConfigs()) { if (config.containsBlobStore(blobStoreName)) { config.removeBlobStore(blobStoreName); return; } } - throw new NoSuchElementException( - "No configuration found containing blob store " + blobStoreName); + throw new NoSuchElementException("No configuration found containing blob store " + blobStoreName); } /** - * Adds a blob store and returns the {@link BlobStoreConfiguration} to which the blob stores was - * added. + * Adds a blob store and returns the {@link BlobStoreConfiguration} to which the blob stores was added. * * @param bs the blob store to add - * @throws IllegalArgumentException if the given blob store can't be added to any configuration - * managed by this blob store aggregator. + * @throws IllegalArgumentException if the given blob store can't be added to any configuration managed by this blob + * store aggregator. */ public synchronized void addBlobStore(final BlobStoreInfo bs) throws IllegalArgumentException { for (BlobStoreConfiguration c : getConfigs()) { @@ -288,50 +269,42 @@ public synchronized void renameBlobStore(final String oldName, final String newN } /** - * Replaces the given blob store and returns the Blob Store's configuration, saving the - * configuration. + * Replaces the given blob store and returns the Blob Store's configuration, saving the configuration. * * @param bs The blob store to modify */ - public synchronized void modifyBlobStore(final BlobStoreInfo bs) - throws IllegalArgumentException { + public synchronized void modifyBlobStore(final BlobStoreInfo bs) throws IllegalArgumentException { BlobStoreConfiguration config = getConfiguration(bs); // TODO: this won't work with GetCapabilitiesConfiguration config.modifyBlobStore(bs); } /** - * Returns the BlobStoreConfiguration for the given BlobStoreInfo, if found in list of blob - * store configurations. + * Returns the BlobStoreConfiguration for the given BlobStoreInfo, if found in list of blob store configurations. * * @param bs BlobStoreInfo for this configuration * @return The BlobStoreConfiguration for BlobStoreInfo */ - public BlobStoreConfiguration getConfiguration(BlobStoreInfo bs) - throws IllegalArgumentException { + public BlobStoreConfiguration getConfiguration(BlobStoreInfo bs) throws IllegalArgumentException { Assert.notNull(bs, "blobStore is null"); return getConfiguration(bs.getName()); } /** - * Returns the BlobStoreConfiguration for the given Blob Store Name, if found in list of blob - * store configurations. + * Returns the BlobStoreConfiguration for the given Blob Store Name, if found in list of blob store configurations. */ - public BlobStoreConfiguration getConfiguration(final String blobStoreName) - throws IllegalArgumentException { + public BlobStoreConfiguration getConfiguration(final String blobStoreName) throws IllegalArgumentException { Assert.notNull(blobStoreName, "blobStoreName is null"); for (BlobStoreConfiguration c : getConfigs()) { if (c.containsBlobStore(blobStoreName)) { return c; } } - throw new IllegalArgumentException( - "No configuration found containing blob store " + blobStoreName); + throw new IllegalArgumentException("No configuration found containing blob store " + blobStoreName); } /** - * Adds a {@link BlobStoreConfigurationListener} to each {@link BlobStoreConfiguration} tracked - * by this aggregator + * Adds a {@link BlobStoreConfigurationListener} to each {@link BlobStoreConfiguration} tracked by this aggregator * * @param listener the listener */ @@ -342,8 +315,8 @@ public void addListener(BlobStoreConfigurationListener listener) { } /** - * Removes a {@link BlobStoreConfigurationListener} from each {@link BlobStoreConfiguration} - * tracked by this aggregator + * Removes a {@link BlobStoreConfigurationListener} from each {@link BlobStoreConfiguration} tracked by this + * aggregator * * @param listener the listener */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListener.java b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListener.java index 9f082a2dd3..10a4735e98 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListener.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListener.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -21,8 +20,8 @@ /** * Listener interface for {@link BlobStore} events. * - *

Implementations can be added to the blob store(s) through the {@link - * StorageBroker#addBlobStoreListener(BlobStoreListener) StorageBroker} + *

Implementations can be added to the blob store(s) through the + * {@link StorageBroker#addBlobStoreListener(BlobStoreListener) StorageBroker} */ public interface BlobStoreListener { @@ -31,14 +30,13 @@ public interface BlobStoreListener { * * @param layerName {@link TileLayer#getName() name} of the layer for the stored tile * @param gridSetId {@link GridSet#getName() name} of the gridset for the stored tile - * @param blobFormat {@link MimeType#getFormat() format name} of the mime type for the stored - * tile + * @param blobFormat {@link MimeType#getFormat() format name} of the mime type for the stored tile * @param parametersId {@link TileObject#getParametersId() parameters id} for the stored tile * @param x X ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile * @param y Y ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile * @param z Z ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile - * @param blobSize the actual storage size the blob uses in the blob store's backend storage; - * which may or may not equal to the encoded tile size, depending on the storage mechanism + * @param blobSize the actual storage size the blob uses in the blob store's backend storage; which may or may not + * equal to the encoded tile size, depending on the storage mechanism */ void tileStored( String layerName, @@ -55,14 +53,13 @@ void tileStored( * * @param layerName {@link TileLayer#getName() name} of the layer for the stored tile * @param gridSetId {@link GridSet#getName() name} of the gridset for the stored tile - * @param blobFormat {@link MimeType#getFormat() format name} of the mime type for the stored - * tile + * @param blobFormat {@link MimeType#getFormat() format name} of the mime type for the stored tile * @param parametersId {@link TileObject#getParametersId() parameters id} for the stored tile * @param x X ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile * @param y Y ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile * @param z Z ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile - * @param blobSize the actual blob size freed from the blob store's backend storage; which may - * or may not equal to the encoded tile size, depending on the storage mechanism + * @param blobSize the actual blob size freed from the blob store's backend storage; which may or may not equal to + * the encoded tile size, depending on the storage mechanism */ void tileDeleted( String layerName, @@ -79,14 +76,13 @@ void tileDeleted( * * @param layerName {@link TileLayer#getName() name} of the layer for the stored tile * @param gridSetId {@link GridSet#getName() name} of the gridset for the stored tile - * @param blobFormat {@link MimeType#getFormat() format name} of the mime type for the stored - * tile + * @param blobFormat {@link MimeType#getFormat() format name} of the mime type for the stored tile * @param parametersId {@link TileObject#getParametersId() parameters id} for the stored tile * @param x X ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile * @param y Y ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile * @param z Z ordinate of the {@link TileObject#getXYZ() grid location} for the stored tile - * @param blobSize the actual storage size the blob uses in the blob store's backend storage; - * which may or may not equal to the encoded tile size, depending on the storage mechanism + * @param blobSize the actual storage size the blob uses in the blob store's backend storage; which may or may not + * equal to the encoded tile size, depending on the storage mechanism * @param oldSize the size of the replaced blob */ void tileUpdated( @@ -100,27 +96,24 @@ void tileUpdated( long blobSize, long oldSize); - /** - * Notifies that the layer named {@code layerName} has been whipped out from the blob store's - * backend storage. - */ + /** Notifies that the layer named {@code layerName} has been whipped out from the blob store's backend storage. */ void layerDeleted(String layerName); /** - * Notifies that the layer named {@code oldLayerName} has been renamed as {@code newLayerName} - * in the blob store's backend storage. + * Notifies that the layer named {@code oldLayerName} has been renamed as {@code newLayerName} in the blob store's + * backend storage. */ void layerRenamed(String oldLayerName, String newLayerName); /** - * Notifies that all tiles for the gridset {@code gridsetId} of layer {@code layerName} have - * been deleted in the blob store's backend storage. + * Notifies that all tiles for the gridset {@code gridsetId} of layer {@code layerName} have been deleted in the + * blob store's backend storage. */ void gridSubsetDeleted(String layerName, String gridSetId); /** - * Notifies that all tiles for the parameter ID {@code parametersId} of layer {@code layerName} - * have been deleted in the blob store's backend storage. + * Notifies that all tiles for the parameter ID {@code parametersId} of layer {@code layerName} have been deleted in + * the blob store's backend storage. */ void parametersDeleted(String layerName, String parametersId); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListenerList.java b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListenerList.java index 1f5c8a554d..b94d0955e2 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListenerList.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/BlobStoreListenerList.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -41,31 +40,27 @@ public synchronized boolean removeListener(BlobStoreListener listener) { } public void sendLayerDeleted(String layerName) { - listeners.forEach( - listener -> { - listener.layerDeleted(layerName); - }); + listeners.forEach(listener -> { + listener.layerDeleted(layerName); + }); } public void sendLayerRenamed(String oldLayerName, String newLayerName) { - listeners.forEach( - listener -> { - listener.layerRenamed(oldLayerName, newLayerName); - }); + listeners.forEach(listener -> { + listener.layerRenamed(oldLayerName, newLayerName); + }); } public void sendGridSubsetDeleted(String layerName, String gridSetId) { - listeners.forEach( - listener -> { - listener.gridSubsetDeleted(layerName, gridSetId); - }); + listeners.forEach(listener -> { + listener.gridSubsetDeleted(layerName, gridSetId); + }); } public void sendParametersDeleted(String layerName, String parametersId) { - listeners.forEach( - listener -> { - listener.parametersDeleted(layerName, parametersId); - }); + listeners.forEach(listener -> { + listener.parametersDeleted(layerName, parametersId); + }); } public void sendTileDeleted( @@ -77,11 +72,9 @@ public void sendTileDeleted( long y, int z, long length) { - listeners.forEach( - listener -> { - listener.tileDeleted( - layerName, gridSetId, blobFormat, parametersId, x, y, z, length); - }); + listeners.forEach(listener -> { + listener.tileDeleted(layerName, gridSetId, blobFormat, parametersId, x, y, z, length); + }); } public void sendTileDeleted(final TileObject stObj) { @@ -93,8 +86,7 @@ public void sendTileDeleted(final TileObject stObj) { final String paramsId = stObj.getParametersId(); final int blobSize = stObj.getBlobSize(); - sendTileDeleted( - layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize); + sendTileDeleted(layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize); } public void sendTileStored( @@ -106,11 +98,9 @@ public void sendTileStored( long y, int z, long length) { - listeners.forEach( - listener -> { - listener.tileStored( - layerName, gridSetId, blobFormat, parametersId, x, y, z, length); - }); + listeners.forEach(listener -> { + listener.tileStored(layerName, gridSetId, blobFormat, parametersId, x, y, z, length); + }); } public void sendTileStored(final TileObject stObj) { @@ -122,8 +112,7 @@ public void sendTileStored(final TileObject stObj) { final String paramsId = stObj.getParametersId(); final int blobSize = stObj.getBlobSize(); - sendTileStored( - layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize); + sendTileStored(layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize); } public void sendTileUpdated( @@ -136,19 +125,9 @@ public void sendTileUpdated( int z, long blobSize, long oldSize) { - listeners.forEach( - listener -> { - listener.tileUpdated( - layerName, - gridSetId, - blobFormat, - parametersId, - x, - y, - z, - blobSize, - oldSize); - }); + listeners.forEach(listener -> { + listener.tileUpdated(layerName, gridSetId, blobFormat, parametersId, x, y, z, blobSize, oldSize); + }); } public void sendTileUpdated(final TileObject stObj, final long oldSize) { @@ -160,15 +139,6 @@ public void sendTileUpdated(final TileObject stObj, final long oldSize) { final String paramsId = stObj.getParametersId(); final int blobSize = stObj.getBlobSize(); - sendTileUpdated( - layerName, - gridSetId, - blobFormat, - paramsId, - xyz[0], - xyz[1], - (int) xyz[2], - blobSize, - oldSize); + sendTileUpdated(layerName, gridSetId, blobFormat, paramsId, xyz[0], xyz[1], (int) xyz[2], blobSize, oldSize); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/CompositeBlobStore.java b/geowebcache/core/src/main/java/org/geowebcache/storage/CompositeBlobStore.java index fcf96ceb95..45a07b54c3 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/CompositeBlobStore.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/CompositeBlobStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Gabriel Roldan, Boundless Spatial Inc, Copyright 2015 */ @@ -43,30 +42,29 @@ /** * A composite {@link BlobStore} that multiplexes tile operations to configured blobstores based on - * {@link BlobStoreInfo#getId() blobstore id} and TileLayers {@link TileLayer#getBlobStoreId() - * BlobStoreId} matches. + * {@link BlobStoreInfo#getId() blobstore id} and TileLayers {@link TileLayer#getBlobStoreId() BlobStoreId} matches. * - *

Tile operations for {@link TileLayer}s with no configured {@link TileLayer#getBlobStoreId() - * BlobStoreId} (i.e. {@code null}) are redirected to the "default blob store", which is either - * the one configured as the {@link BlobStoreInfo#isDefault() default} one, or a {@link - * FileBlobStore} following the {@link DefaultStorageFinder#getDefaultPath() legacy cache directory - * lookup mechanism}, if no blobstore is set as default. + *

Tile operations for {@link TileLayer}s with no configured {@link TileLayer#getBlobStoreId() BlobStoreId} (i.e. + * {@code null}) are redirected to the "default blob store", which is either the one configured as the + * {@link BlobStoreInfo#isDefault() default} one, or a {@link FileBlobStore} following the + * {@link DefaultStorageFinder#getDefaultPath() legacy cache directory lookup mechanism}, if no blobstore is set as + * default. * - *

At construction time, {@link BlobStore} instances will be created for all {@link - * BlobStoreInfo#isEnabled() enabled} configs. + *

At construction time, {@link BlobStore} instances will be created for all {@link BlobStoreInfo#isEnabled() + * enabled} configs. * * @since 1.8 */ public class CompositeBlobStore implements BlobStore, BlobStoreConfigurationListener { - static final String GEOWEBCACHE_BLOBSTORE_SUITABILITY_CHECK = - "GEOWEBCACHE_BLOBSTORE_SUITABILITY_CHECK"; + static final String GEOWEBCACHE_BLOBSTORE_SUITABILITY_CHECK = "GEOWEBCACHE_BLOBSTORE_SUITABILITY_CHECK"; private static Logger log = Logging.getLogger(CompositeBlobStore.class.getName()); public static final String DEFAULT_STORE_DEFAULT_ID = "_DEFAULT_STORE_"; - @VisibleForTesting Map blobStores = new ConcurrentHashMap<>(); + @VisibleForTesting + Map blobStores = new ConcurrentHashMap<>(); private TileLayerDispatcher layers; @@ -103,14 +101,10 @@ public static enum StoreSuitabilityCheck { } @VisibleForTesting - static final ThreadLocal storeSuitability = - ThreadLocal.withInitial( - () -> - Optional.ofNullable( - GeoWebCacheExtensions.getProperty( - GEOWEBCACHE_BLOBSTORE_SUITABILITY_CHECK)) - .map(StoreSuitabilityCheck::valueOf) - .orElse(StoreSuitabilityCheck.EXISTING)); + static final ThreadLocal storeSuitability = ThreadLocal.withInitial( + () -> Optional.ofNullable(GeoWebCacheExtensions.getProperty(GEOWEBCACHE_BLOBSTORE_SUITABILITY_CHECK)) + .map(StoreSuitabilityCheck::valueOf) + .orElse(StoreSuitabilityCheck.EXISTING)); /** Specifies how new blob stores should check the existing content of their persistence. */ public static StoreSuitabilityCheck getStoreSuitabilityCheck() { @@ -118,21 +112,19 @@ public static StoreSuitabilityCheck getStoreSuitabilityCheck() { } /** - * Create a composite blob store that multiplexes tile operations to configured blobstores based - * on {@link BlobStoreInfo#getId() blobstore id} and TileLayers {@link - * TileLayer#getBlobStoreId() BlobStoreId} matches. + * Create a composite blob store that multiplexes tile operations to configured blobstores based on + * {@link BlobStoreInfo#getId() blobstore id} and TileLayers {@link TileLayer#getBlobStoreId() BlobStoreId} matches. * * @param layers used to get the layer's {@link TileLayer#getBlobStoreId() blobstore id} - * @param defaultStorageFinder to resolve the location of the cache directory for the legacy - * blob store when no {@link BlobStoreInfo#isDefault() default blob store} is given - * @param blobStoreAggregator the configuration as read from {@code geowebcache.xml} containing - * the configured {@link BlobStoreAggregator#getBlobStores() blob stores} - * @throws ConfigurationException if there's a configuration error like a store confing having - * no id, or two store configs having the same id, or more than one store config being - * marked as the default one, or the default store is not {@link BlobStoreInfo#isEnabled() - * enabled} - * @throws StorageException if the live {@code BlobStore} instance can't be {@link - * BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider)} created} of an enabled + * @param defaultStorageFinder to resolve the location of the cache directory for the legacy blob store when no + * {@link BlobStoreInfo#isDefault() default blob store} is given + * @param blobStoreAggregator the configuration as read from {@code geowebcache.xml} containing the configured + * {@link BlobStoreAggregator#getBlobStores() blob stores} + * @throws ConfigurationException if there's a configuration error like a store confing having no id, or two store + * configs having the same id, or more than one store config being marked as the default one, or the default + * store is not {@link BlobStoreInfo#isEnabled() enabled} + * @throws StorageException if the live {@code BlobStore} instance can't be + * {@link BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider)} created} of an enabled * {@link BlobStoreInfo} */ public CompositeBlobStore( @@ -214,49 +206,45 @@ private void destroy(Map blobStores) { /** Adds the listener to all enabled blob stores */ @Override public void addListener(BlobStoreListener listener) { - readAction( - () -> { - this.listeners.addListener( - listener); // save it for later in case setBlobStores is - // called - for (LiveStore bs : blobStores.values()) { - if (bs.config.isEnabled()) { - bs.liveInstance.addListener(listener); - } - } - }); + readAction(() -> { + this.listeners.addListener(listener); // save it for later in case setBlobStores is + // called + for (LiveStore bs : blobStores.values()) { + if (bs.config.isEnabled()) { + bs.liveInstance.addListener(listener); + } + } + }); } /** Removes the listener from all the enabled blob stores */ @Override public boolean removeListener(BlobStoreListener listener) { - return readFunction( - () -> { - this.listeners.removeListener(listener); - return blobStores.values().stream() - .filter(bs -> bs.config.isEnabled()) - .map(bs -> bs.liveInstance.removeListener(listener)) - .collect(Collectors.reducing((x, y) -> x || y)) // Don't use anyMatch or - // findFirst as we don't want it - // to shortcut - .orElse(false); - }); + return readFunction(() -> { + this.listeners.removeListener(listener); + return blobStores.values().stream() + .filter(bs -> bs.config.isEnabled()) + .map(bs -> bs.liveInstance.removeListener(listener)) + .collect(Collectors.reducing((x, y) -> x || y)) // Don't use anyMatch or + // findFirst as we don't want it + // to shortcut + .orElse(false); + }); } @Override public boolean rename(String oldLayerName, String newLayerName) throws StorageException { - return readFunctionUnsafe( - () -> { - for (LiveStore bs : blobStores.values()) { - BlobStoreInfo config = bs.config; - if (config.isEnabled()) { - if (bs.liveInstance.rename(oldLayerName, newLayerName)) { - return true; - } - } + return readFunctionUnsafe(() -> { + for (LiveStore bs : blobStores.values()) { + BlobStoreInfo config = bs.config; + if (config.isEnabled()) { + if (bs.liveInstance.rename(oldLayerName, newLayerName)) { + return true; } - return false; - }); + } + } + return false; + }); } @Override @@ -266,21 +254,15 @@ public String getLayerMetadata(String layerName, String key) { @Override public void putLayerMetadata(String layerName, String key, String value) { - readAction( - () -> { - store(layerName).putLayerMetadata(layerName, key, value); - }); + readAction(() -> { + store(layerName).putLayerMetadata(layerName, key, value); + }); } @Override public boolean layerExists(String layerName) { - return readFunction( - () -> - blobStores.values().stream() - .anyMatch( - bs -> - bs.config.isEnabled() - && bs.liveInstance.layerExists(layerName))); + return readFunction(() -> blobStores.values().stream() + .anyMatch(bs -> bs.config.isEnabled() && bs.liveInstance.layerExists(layerName))); } private BlobStore store(String layerId) throws StorageException { @@ -292,8 +274,7 @@ private BlobStore store(String layerId) throws StorageException { throw new StorageException(e.getMessage(), e); } if (!store.config.isEnabled()) { - throw new StorageException( - "Attempted to use a blob store that's disabled: " + store.config.getName()); + throw new StorageException("Attempted to use a blob store that's disabled: " + store.config.getName()); } return store.liveInstance; @@ -352,14 +333,13 @@ public void setBlobStores(Iterable configs) * Loads the blob stores from the list of configuration objects * * @param configs the list of blob store configurations - * @return a mapping of blob store id to {@link LiveStore} containing the configuration itself - * and the live instance if the blob store is enabled - * @throws ConfigurationException if there's a configuration error like a store confing having - * no id, or two store configs having the same id, or more than one store config being - * marked as the default one, or the default store is not {@link BlobStoreInfo#isEnabled() - * enabled} - * @throws StorageException if the live {@code BlobStore} instance can't be {@link - * BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider)} created} of an enabled + * @return a mapping of blob store id to {@link LiveStore} containing the configuration itself and the live instance + * if the blob store is enabled + * @throws ConfigurationException if there's a configuration error like a store confing having no id, or two store + * configs having the same id, or more than one store config being marked as the default one, or the default + * store is not {@link BlobStoreInfo#isEnabled() enabled} + * @throws StorageException if the live {@code BlobStore} instance can't be + * {@link BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider)} created} of an enabled * {@link BlobStoreInfo} */ Map loadBlobStores(Iterable configs) @@ -380,8 +360,7 @@ Map loadBlobStores(Iterable configs) config.setBaseDirectory(defaultStorageFinder.getDefaultPath()); BlobStore store = new FileBlobStore(config.getBaseDirectory()); - stores.put( - CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID, new LiveStore(config, store)); + stores.put(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID, new LiveStore(config, store)); } } catch (ConfigurationException | StorageException e) { destroy(stores); @@ -397,12 +376,11 @@ Map loadBlobStores(Iterable configs) * @param stores The map of names to {@link LiveStore}s to load into * @param config blob store configuration * @return The LiveStore that was created and added to stores - * @throws ConfigurationException if there's a configuration error like a store confing having - * no id, or two store configs having the same id, or more than one store config being - * marked as the default one, or the default store is not {@link BlobStoreInfo#isEnabled() - * enabled} - * @throws StorageException if the live {@code BlobStore} instance can't be {@link - * BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider)} created} of an enabled + * @throws ConfigurationException if there's a configuration error like a store confing having no id, or two store + * configs having the same id, or more than one store config being marked as the default one, or the default + * store is not {@link BlobStoreInfo#isEnabled() enabled} + * @throws StorageException if the live {@code BlobStore} instance can't be + * {@link BlobStoreInfo#createInstance(TileLayerDispatcher, LockProvider)} created} of an enabled * {@link BlobStoreInfo} */ private LiveStore loadBlobStore(Map stores, BlobStoreInfo config) @@ -410,20 +388,17 @@ private LiveStore loadBlobStore(Map stores, BlobStoreInfo con final String id = config.getName(); final boolean enabled = config.isEnabled(); - LiveStore defaultStore = - stores.getOrDefault(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID, null); + LiveStore defaultStore = stores.getOrDefault(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID, null); if (Strings.isNullOrEmpty(id)) { throw new ConfigurationException("No id provided for blob store " + config); } if (stores.containsKey(id)) { - throw new ConfigurationException( - "Duplicate blob store id: " + id + ". Check your configuration."); + throw new ConfigurationException("Duplicate blob store id: " + id + ". Check your configuration."); } if (CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID.equals(id)) { - throw new ConfigurationException( - CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID - + " is a reserved identifier, please don't use it in the configuration"); + throw new ConfigurationException(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID + + " is a reserved identifier, please don't use it in the configuration"); } BlobStore store = null; @@ -437,27 +412,21 @@ private LiveStore loadBlobStore(Map stores, BlobStoreInfo con if (config.isDefault()) { if (defaultStore == null || defaultStore.config.getName().equals(config.getName())) { if (!enabled) { - throw new ConfigurationException( - "The default blob store can't be disabled: " + config.getName()); + throw new ConfigurationException("The default blob store can't be disabled: " + config.getName()); } stores.put(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID, liveStore); } else { throw new ConfigurationException( - "Duplicate default blob store: " - + defaultStore.config.getName() - + " and " - + config.getName()); + "Duplicate default blob store: " + defaultStore.config.getName() + " and " + config.getName()); } } return liveStore; } @Override - public boolean deleteByParametersId(String layerName, String parametersId) - throws StorageException { - return readFunctionUnsafe( - () -> store(layerName).deleteByParametersId(layerName, parametersId)); + public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { + return readFunctionUnsafe(() -> store(layerName).deleteByParametersId(layerName, parametersId)); } @Override @@ -498,21 +467,17 @@ protected T readFunction(StorageAccessor function) { } protected void readActionUnsafe(StorageAction function) throws StorageException { - readFunctionUnsafe( - (StorageAccessor) - () -> { - function.run(); - return null; - }); + readFunctionUnsafe((StorageAccessor) () -> { + function.run(); + return null; + }); } protected void readAction(StorageAction function) { - readFunction( - (StorageAccessor) - () -> { - function.run(); - return null; - }); + readFunction((StorageAccessor) () -> { + function.run(); + return null; + }); } @Override @@ -521,8 +486,7 @@ public Map>> getParametersMapping(String la } @Override - public void handleAddBlobStore(BlobStoreInfo newBlobStore) - throws ConfigurationException, StorageException { + public void handleAddBlobStore(BlobStoreInfo newBlobStore) throws ConfigurationException, StorageException { if (newBlobStore.isDefault()) { loadBlobStoreOverwritingDefault(blobStores, newBlobStore); } else { @@ -531,26 +495,26 @@ public void handleAddBlobStore(BlobStoreInfo newBlobStore) } @Override - public void handleRemoveBlobStore(BlobStoreInfo removedBlobStore) - throws ConfigurationException, StorageException { + public void handleRemoveBlobStore(BlobStoreInfo removedBlobStore) throws ConfigurationException, StorageException { if (removedBlobStore .getName() .equals(blobStores.get(DEFAULT_STORE_DEFAULT_ID).config.getName())) { - throw new ConfigurationException( - "The default blob store can't be removed: " + removedBlobStore.getName()); + throw new ConfigurationException("The default blob store can't be removed: " + removedBlobStore.getName()); } blobStores.remove(removedBlobStore.getName()); } @Override - public void handleModifyBlobStore(BlobStoreInfo modifiedBlobStore) - throws ConfigurationException, StorageException { + public void handleModifyBlobStore(BlobStoreInfo modifiedBlobStore) throws ConfigurationException, StorageException { LiveStore removedStore = blobStores.remove(modifiedBlobStore.getName()); try { if (modifiedBlobStore.isDefault() && !modifiedBlobStore .getName() - .equals(blobStores.get(DEFAULT_STORE_DEFAULT_ID).config.getName())) { + .equals(blobStores + .get(DEFAULT_STORE_DEFAULT_ID) + .config + .getName())) { loadBlobStoreOverwritingDefault(blobStores, modifiedBlobStore); } else { loadBlobStore(blobStores, modifiedBlobStore); @@ -594,22 +558,19 @@ public void handleRenameBlobStore(String oldName, BlobStoreInfo modifiedBlobStor } /** - * Sets the old default blob store to no longer be the default, and adds a new blob store as the - * default. + * Sets the old default blob store to no longer be the default, and adds a new blob store as the default. * - *

1) Removes DEFAULT_STORE_DEFAULT_ID from blobStores 2) Calls {@link #loadBlobStore(Map, - * BlobStoreInfo)} 3) Calls setDefault(false) on the config of the old default LiveStore, then - * saves this modified config via the aggregator 4) If anything goes wrong, reverts these - * changes + *

1) Removes DEFAULT_STORE_DEFAULT_ID from blobStores 2) Calls {@link #loadBlobStore(Map, BlobStoreInfo)} 3) + * Calls setDefault(false) on the config of the old default LiveStore, then saves this modified config via the + * aggregator 4) If anything goes wrong, reverts these changes * - *

THIS METHOD SHOULD ONLY BE CALLED IF THE CONFIG ARGUMENT HAS default=true AND - * WAS NOT ALREADY THE DEFAULT BLOB STORE. + *

THIS METHOD SHOULD ONLY BE CALLED IF THE CONFIG ARGUMENT HAS default=true AND WAS NOT ALREADY THE + * DEFAULT BLOB STORE. * * @param stores The blobStores map to update * @param config The new default blob store */ - private void loadBlobStoreOverwritingDefault( - Map stores, BlobStoreInfo config) + private void loadBlobStoreOverwritingDefault(Map stores, BlobStoreInfo config) throws StorageException, ConfigurationException { LiveStore oldDefaultStore = stores.get(DEFAULT_STORE_DEFAULT_ID); try { @@ -629,8 +590,7 @@ private void loadBlobStoreOverwritingDefault( } /** - * Throws UnsuitableStorageException if the specified storage does not meet the current - * suitability check level + * Throws UnsuitableStorageException if the specified storage does not meet the current suitability check level * * @param location Location of the storage for heuman readable error messages * @param exists The storage is already a GWC cache @@ -646,9 +606,7 @@ public static void checkSuitability(String location, final boolean exists, boole case EMPTY: if (!empty) { throw new UnsuitableStorageException( - "Attempted to create Blob Store in " - + location - + " but it was not empty"); + "Attempted to create Blob Store in " + location + " but it was not empty"); } case NONE: } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/DefaultStorageBroker.java b/geowebcache/core/src/main/java/org/geowebcache/storage/DefaultStorageBroker.java index a3ab8e29dd..782459483b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/DefaultStorageBroker.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/DefaultStorageBroker.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2009 */ @@ -22,8 +21,8 @@ import org.geowebcache.layer.TileLayer; /** - * Handles cacheable objects (tiles, wfs responses) both in terms of data storage and metadata - * storage, delegating most work to a {@link BlobStore} + * Handles cacheable objects (tiles, wfs responses) both in terms of data storage and metadata storage, delegating most + * work to a {@link BlobStore} */ public class DefaultStorageBroker implements StorageBroker { private static Logger log = Logging.getLogger(DefaultStorageBroker.class.getName()); @@ -53,8 +52,7 @@ public boolean delete(String layerName) throws StorageException { } @Override - public boolean deleteByGridSetId(final String layerName, final String gridSetId) - throws StorageException { + public boolean deleteByGridSetId(final String layerName, final String gridSetId) throws StorageException { return blobStore.deleteByGridsetId(layerName, gridSetId); } @@ -65,8 +63,7 @@ public boolean deleteByParameters(final String layerName, final MapThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2009 */ @@ -26,8 +25,8 @@ import org.springframework.web.context.WebApplicationContext; /** - * Locates the position of the GeoWebCache file cache inspecting system variables, the servlet - * context and environment variables + * Locates the position of the GeoWebCache file cache inspecting system variables, the servlet context and environment + * variables */ public class DefaultStorageFinder { public static final String GWC_CACHE_DIR = "GEOWEBCACHE_CACHE_DIR"; @@ -129,13 +128,12 @@ private void determineDefaultPrefix() { String tmpDir = System.getProperty("java.io.tmpdir"); if (tmpDir != null) { File temp = new File(tmpDir, "geowebcache"); - logMsg = - "Reverting to java.io.tmpdir '" - + temp.getAbsolutePath() - + "' for storage. " - + "Please set " - + GWC_CACHE_DIR - + "."; + logMsg = "Reverting to java.io.tmpdir '" + + temp.getAbsolutePath() + + "' for storage. " + + "Please set " + + GWC_CACHE_DIR + + "."; if (!temp.exists() && !temp.mkdirs()) { throw new RuntimeException("Can't create " + temp.getAbsolutePath()); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/DiscontinuousTileRange.java b/geowebcache/core/src/main/java/org/geowebcache/storage/DiscontinuousTileRange.java index ca646c931c..0bf608d7a7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/DiscontinuousTileRange.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/DiscontinuousTileRange.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2010 */ @@ -31,14 +30,7 @@ public DiscontinuousTileRange( MimeType mimeType, Map parameters) { - super( - layerName, - gridSetId, - zoomStart, - zoomStop, - rasterMask.getGridCoverages(), - mimeType, - parameters); + super(layerName, gridSetId, zoomStart, zoomStop, rasterMask.getGridCoverages(), mimeType, parameters); this.mask = rasterMask; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java b/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java index 6a8e0ec00a..598adf6ef3 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -111,155 +110,133 @@ private void migrateParameters(JdbcTemplate template, final File root) { + " join parameters on parameters.id = tiles.parameters_id\n" + "group by layer, gridset, z, parameters, parameters_id"; - final long total = - Optional.ofNullable( - template.queryForObject( - "select count(*) from (" + query + ")", Long.class)) - .orElse(0l); + final long total = Optional.ofNullable( + template.queryForObject("select count(*) from (" + query + ")", Long.class)) + .orElse(0l); log.info("Migrating " + total + " parameters from the metastore to the file system"); - template.query( - query, - new RowCallbackHandler() { - - long count = 0; - - @Override - public void processRow(ResultSet rs) throws SQLException { - String layer = rs.getString(1); - String gridset = rs.getString(2); - int z = rs.getInt(3); - String paramsKvp = rs.getString(4); - String paramsId = rs.getString(5); - - String sha = getParamsSha1(paramsKvp); - - // move the folders containing params - File origin = new File(buildFolderPath(root, layer, gridset, z, paramsId)); - File destination = new File(buildFolderPath(root, layer, gridset, z, sha)); - org.geowebcache.util.FileUtils.renameFile(origin, destination); - - count++; - if (count % 1000 == 0 || count >= total) { - log.info( - "Migrated " - + count - + "/" - + total - + " parameters from the metastore to the file system"); - } - } + template.query(query, new RowCallbackHandler() { - private String buildFolderPath( - final File root, String layer, String gridset, int z, String paramsId) { - // build the old path - StringBuilder path = new StringBuilder(); - path.append(root.getPath()); - path.append(File.separatorChar); - appendFiltered(layer, path); - path.append(File.separatorChar); - FilePathUtils.appendGridsetZoomLevelDir(gridset, z, path); - path.append('_'); - path.append(paramsId); - path.append(File.separatorChar); - - return path.toString(); - } + long count = 0; - private String getParamsSha1(String paramsKvp) { - Map params = toMap(paramsKvp); - return ParametersUtils.getId(params); - } + @Override + public void processRow(ResultSet rs) throws SQLException { + String layer = rs.getString(1); + String gridset = rs.getString(2); + int z = rs.getInt(3); + String paramsKvp = rs.getString(4); + String paramsId = rs.getString(5); - /** - * Parses the param list stored in the db to a parameter list (since this is - * coming from the database the assumption is that the contents are sane) - */ - private Map toMap(String paramsKvp) { - // TODO: wondering, shall we URL decode the values?? - Map result = new HashMap<>(); - String[] kvps = paramsKvp.split("&"); - for (String kvp : kvps) { - if (kvp != null && !"".equals(kvp)) { - String[] kv = kvp.split("="); - result.put(kv[0], kv[1]); - } - } - - return result; + String sha = getParamsSha1(paramsKvp); + + // move the folders containing params + File origin = new File(buildFolderPath(root, layer, gridset, z, paramsId)); + File destination = new File(buildFolderPath(root, layer, gridset, z, sha)); + org.geowebcache.util.FileUtils.renameFile(origin, destination); + + count++; + if (count % 1000 == 0 || count >= total) { + log.info("Migrated " + count + "/" + total + " parameters from the metastore to the file system"); + } + } + + private String buildFolderPath(final File root, String layer, String gridset, int z, String paramsId) { + // build the old path + StringBuilder path = new StringBuilder(); + path.append(root.getPath()); + path.append(File.separatorChar); + appendFiltered(layer, path); + path.append(File.separatorChar); + FilePathUtils.appendGridsetZoomLevelDir(gridset, z, path); + path.append('_'); + path.append(paramsId); + path.append(File.separatorChar); + + return path.toString(); + } + + private String getParamsSha1(String paramsKvp) { + Map params = toMap(paramsKvp); + return ParametersUtils.getId(params); + } + + /** + * Parses the param list stored in the db to a parameter list (since this is coming from the database the + * assumption is that the contents are sane) + */ + private Map toMap(String paramsKvp) { + // TODO: wondering, shall we URL decode the values?? + Map result = new HashMap<>(); + String[] kvps = paramsKvp.split("&"); + for (String kvp : kvps) { + if (kvp != null && !"".equals(kvp)) { + String[] kv = kvp.split("="); + result.put(kv[0], kv[1]); } - }); + } + + return result; + } + }); } private void migrateTileDates(JdbcTemplate template, final FilePathGenerator generator) { - String query = - "select layers.value as layer, gridsets.value as gridset, " - + "tiles.parameters_id, tiles.z, tiles.x, tiles.y, created, formats.value as format \n" - + "from tiles join layers on layers.id = tiles.layer_id \n" - + "join gridsets on gridsets.id = tiles.gridset_id \n" - + "join formats on formats.id = tiles.format_id \n" - + "order by layer_id, parameters_id, gridset, z, x, y"; - - final long total = - Optional.ofNullable( - template.queryForObject( - "select count(*) from (" + query + ")", Long.class)) - .orElse(0l); - log.info( - "Migrating " - + total - + " tile creation dates from the metastore to the file system"); - - template.query( - query, - new RowCallbackHandler() { - - int count = 0; - - @Override - public void processRow(ResultSet rs) throws SQLException { - // read the result set - String layer = rs.getString(1); - String gridset = rs.getString(2); - String paramsId = rs.getString(3); - long z = rs.getLong(4); - long x = rs.getLong(5); - long y = rs.getLong(6); - long created = rs.getLong(7); - String format = rs.getString(8); - - // create the tile and thus the tile path - TileObject tile = - TileObject.createCompleteTileObject( - layer, new long[] {x, y, z}, gridset, format, null, null); - tile.setParametersId(paramsId); - try { - File file = generator.tilePath(tile, MimeType.createFromFormat(format)); - - // update the last modified according to the date - if (file.exists()) { - file.setLastModified(created); - } - } catch (MimeException e) { - log.log( - Level.SEVERE, - "Failed to locate mime type for format '" - + format - + "', this should never happen!"); - } catch (GeoWebCacheException e) { - log.log(Level.SEVERE, "Failed to compute tile path", e); - } - - count++; - if (count % 10000 == 0 || count >= total) { - log.info( - "Migrated " - + count - + "/" - + total - + " tile creation dates from the metastore to the file system"); - } + String query = "select layers.value as layer, gridsets.value as gridset, " + + "tiles.parameters_id, tiles.z, tiles.x, tiles.y, created, formats.value as format \n" + + "from tiles join layers on layers.id = tiles.layer_id \n" + + "join gridsets on gridsets.id = tiles.gridset_id \n" + + "join formats on formats.id = tiles.format_id \n" + + "order by layer_id, parameters_id, gridset, z, x, y"; + + final long total = Optional.ofNullable( + template.queryForObject("select count(*) from (" + query + ")", Long.class)) + .orElse(0l); + log.info("Migrating " + total + " tile creation dates from the metastore to the file system"); + + template.query(query, new RowCallbackHandler() { + + int count = 0; + + @Override + public void processRow(ResultSet rs) throws SQLException { + // read the result set + String layer = rs.getString(1); + String gridset = rs.getString(2); + String paramsId = rs.getString(3); + long z = rs.getLong(4); + long x = rs.getLong(5); + long y = rs.getLong(6); + long created = rs.getLong(7); + String format = rs.getString(8); + + // create the tile and thus the tile path + TileObject tile = + TileObject.createCompleteTileObject(layer, new long[] {x, y, z}, gridset, format, null, null); + tile.setParametersId(paramsId); + try { + File file = generator.tilePath(tile, MimeType.createFromFormat(format)); + + // update the last modified according to the date + if (file.exists()) { + file.setLastModified(created); } - }); + } catch (MimeException e) { + log.log( + Level.SEVERE, + "Failed to locate mime type for format '" + format + "', this should never happen!"); + } catch (GeoWebCacheException e) { + log.log(Level.SEVERE, "Failed to compute tile path", e); + } + + count++; + if (count % 10000 == 0 || count >= total) { + log.info("Migrated " + + count + + "/" + + total + + " tile creation dates from the metastore to the file system"); + } + } + }); } private String getVariable(String variable, String defaultValue) { @@ -271,16 +248,13 @@ private String getVariable(String variable, String defaultValue) { } } - private Connection getMetaStoreConnection(File root) - throws ClassNotFoundException, SQLException { + private Connection getMetaStoreConnection(File root) throws ClassNotFoundException, SQLException { try { String username = getVariable(DefaultStorageFinder.GWC_METASTORE_USERNAME, "sa"); String password = getVariable(DefaultStorageFinder.GWC_METASTORE_PASSWORD, ""); String defaultJDBCURL = getDefaultJDBCURL(root); - String jdbcString = - getVariable(DefaultStorageFinder.GWC_METASTORE_JDBC_URL, defaultJDBCURL); - String driver = - getVariable(DefaultStorageFinder.GWC_METASTORE_DRIVER_CLASS, "org.h2.Driver"); + String jdbcString = getVariable(DefaultStorageFinder.GWC_METASTORE_JDBC_URL, defaultJDBCURL); + String driver = getVariable(DefaultStorageFinder.GWC_METASTORE_DRIVER_CLASS, "org.h2.Driver"); if (defaultJDBCURL.equals(jdbcString)) { defaultLocation = true; @@ -303,15 +277,11 @@ private Connection getMetaStoreConnection(File root) return DriverManager.getConnection(jdbcString, username, password); } catch (ClassNotFoundException e) { Level logLevel = Level.WARNING; - if (getVariable(DefaultStorageFinder.GWC_METASTORE_DRIVER_CLASS, null) == null) - logLevel = Level.FINE; + if (getVariable(DefaultStorageFinder.GWC_METASTORE_DRIVER_CLASS, null) == null) logLevel = Level.FINE; log.log(logLevel, "Could not find the metastore driver, skipping migration", e); return null; } catch (SQLException e) { - log.log( - Level.WARNING, - "Failed to connect to the legacy metastore, skipping migration", - e); + log.log(Level.WARNING, "Failed to connect to the legacy metastore, skipping migration", e); return null; } } @@ -324,8 +294,7 @@ private File getDefaultH2Path(File root) { private String getDefaultJDBCURL(File root) { String path = root.getPath() + File.separator + "meta_jdbc_h2"; - String jdbcString = - "jdbc:h2:file:" + path + File.separator + "gwc_metastore" + ";TRACE_LEVEL_FILE=0"; + String jdbcString = "jdbc:h2:file:" + path + File.separator + "gwc_metastore" + ";TRACE_LEVEL_FILE=0"; return jdbcString; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/RasterMask.java b/geowebcache/core/src/main/java/org/geowebcache/storage/RasterMask.java index 9d9dd2bda0..01c4eddb04 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/RasterMask.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/RasterMask.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Gabriel Roldan, OpenGeo, Copyright 2010 * @author Arne Kepp, OpenGeo, Copyright 2010 @@ -21,8 +20,8 @@ public class RasterMask implements TileRangeMask { /** - * By zoom level bitmasked images where every pixel represents a tile in the level's {@link - * GridSubset#getCoverages() grid coverage}. + * By zoom level bitmasked images where every pixel represents a tile in the level's + * {@link GridSubset#getCoverages() grid coverage}. */ private final BufferedImage[] byLevelMasks; @@ -39,34 +38,26 @@ public class RasterMask implements TileRangeMask { * * @see #RasterMask(BufferedImage[], long[][], long[][], int) */ - public RasterMask( - BufferedImage[] byLevelMasks, long[][] fullCoverage, final long[][] coveredBounds) { + public RasterMask(BufferedImage[] byLevelMasks, long[][] fullCoverage, final long[][] coveredBounds) { this(byLevelMasks, fullCoverage, coveredBounds, 0); } /** * Creates a RasterMask based on a set of bitmask images and covered tile grid bounds; * - *

The number of zoom levels is determined by the length of the {@code gridCoverages} array. - * The length of the {@code byLevelMasks} might be lower than the actual zoom levels, meaning - * the values for any zoom level for which a masking image is not provided will be interpolated - * from the higher resolution available one. + *

The number of zoom levels is determined by the length of the {@code gridCoverages} array. The length of the + * {@code byLevelMasks} might be lower than the actual zoom levels, meaning the values for any zoom level for which + * a masking image is not provided will be interpolated from the higher resolution available one. * - *

Also, note each bounding box in {@code gridCoverages} may represent a smaller area than - * its bitmasked image, which represents the whole tile range for the layer at a specific zoom - * level. + *

Also, note each bounding box in {@code gridCoverages} may represent a smaller area than its bitmasked image, + * which represents the whole tile range for the layer at a specific zoom level. * - * @param fullCoverage the full grid subsets coverage, needed to compute downsampled pixel - * locations + * @param fullCoverage the full grid subsets coverage, needed to compute downsampled pixel locations * @param coveredBounds by level bounds enclosing the area that has pixels set in the masks - * @param noDataValue raster sample value to be considered as no-data (eg, tile is not set at - * the pixel location) + * @param noDataValue raster sample value to be considered as no-data (eg, tile is not set at the pixel location) */ public RasterMask( - BufferedImage[] byLevelMasks, - long[][] fullCoverage, - final long[][] coveredBounds, - final int noDataValue) { + BufferedImage[] byLevelMasks, long[][] fullCoverage, final long[][] coveredBounds, final int noDataValue) { this.byLevelMasks = byLevelMasks; this.fullCoverage = fullCoverage; this.coveredBounds = coveredBounds; @@ -90,10 +81,7 @@ public boolean lookup(final long x, final long y, final int z) { int level = z; long[] coverage = getGridCoverages()[level]; - if (tileX < coverage[0] - || tileX > coverage[2] - || tileY < coverage[1] - || tileY > coverage[3]) { + if (tileX < coverage[0] || tileX > coverage[2] || tileY < coverage[1] || tileY > coverage[3]) { return false; } @@ -123,10 +111,7 @@ public boolean lookup(final long x, final long y, final int z) { private boolean isTileSet(long tileX, long tileY, int level) { long[] coverage = getGridCoverages()[level]; - if (tileX < coverage[0] - || tileX > coverage[2] - || tileY < coverage[1] - || tileY > coverage[3]) { + if (tileX < coverage[0] || tileX > coverage[2] || tileY < coverage[1] || tileY > coverage[3]) { return false; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/StorageBroker.java b/geowebcache/core/src/main/java/org/geowebcache/storage/StorageBroker.java index 1a74c5450b..9c10675d1b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/StorageBroker.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/StorageBroker.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -29,9 +28,9 @@ public interface StorageBroker { boolean delete(String layerName) throws StorageException; /** - * Completely deletes the cache for a layer/gridset combination; differs from truncate that the - * layer doesn't need to have a gridSubset associated for the given gridset at runtime (in order - * to handle the deletion of a layer's gridsubset) + * Completely deletes the cache for a layer/gridset combination; differs from truncate that the layer doesn't need + * to have a gridSubset associated for the given gridset at runtime (in order to handle the deletion of a layer's + * gridsubset) */ boolean deleteByGridSetId(String layerName, String gridSetId) throws StorageException; @@ -39,8 +38,7 @@ public interface StorageBroker { boolean deleteByParametersId(String layerName, String parametersId) throws StorageException; /** Completely deletes the cache for a layer/parameters combination */ - boolean deleteByParameters(String layerName, Map parameters) - throws StorageException; + boolean deleteByParameters(String layerName, Map parameters) throws StorageException; boolean rename(String oldLayerName, String newLayerName) throws StorageException; @@ -74,15 +72,14 @@ boolean deleteByParameters(String layerName, Map parameters) Set getCachedParameterIds(String layerName) throws StorageException; /** - * Get the set of map cached for the given layer, for those parameterizations that have reverse - * mappings (Created by GWC 1.12 or later) + * Get the set of map cached for the given layer, for those parameterizations that have reverse mappings (Created by + * GWC 1.12 or later) */ Set> getCachedParameters(String layerName) throws StorageException; /** - * Purge parameter caches from the layer if they are unreachable by its current parameter - * filters. The store may purge gridsets and formats as well. These additional purges may be - * guaranteed in future. + * Purge parameter caches from the layer if they are unreachable by its current parameter filters. The store may + * purge gridsets and formats as well. These additional purges may be guaranteed in future. */ boolean purgeOrphans(final TileLayer layer) throws StorageException; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/StorageException.java b/geowebcache/core/src/main/java/org/geowebcache/storage/StorageException.java index 6d879fe546..bc4216e7de 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/StorageException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/StorageException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/StorageObject.java b/geowebcache/core/src/main/java/org/geowebcache/storage/StorageObject.java index a9184e80a6..726c09d13b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/StorageObject.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/StorageObject.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2009 */ @@ -67,9 +66,8 @@ public void setBlobFormat(String blobFormat) { } /** - * Used to set the size of the blob when the tile is created, and the actual storage size once - * the {@link BlobStore} saves it, so notifications to {@link BlobStoreListener}s are sent with - * the actual storage size. + * Used to set the size of the blob when the tile is created, and the actual storage size once the {@link BlobStore} + * saves it, so notifications to {@link BlobStoreListener}s are sent with the actual storage size. * * @param blob_size the size of tile as stored in the backend storage mechanism. */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/TileObject.java b/geowebcache/core/src/main/java/org/geowebcache/storage/TileObject.java index bdb7c0a75e..61765fb9cc 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/TileObject.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/TileObject.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2009 */ @@ -21,9 +20,8 @@ import org.geowebcache.io.Resource; /** - * Represents a specific tile in a {@link GridSet}, identified by xyz. Normally the contents can be - * either an image or a regionated KML tile, the class is format agnostic and carries a {@link - * Resource} object with the data. + * Represents a specific tile in a {@link GridSet}, identified by xyz. Normally the contents can be either an image or a + * regionated KML tile, the class is format agnostic and carries a {@link Resource} object with the data. */ public class TileObject extends StorageObject implements Serializable { /** serialVersionUID */ @@ -44,11 +42,7 @@ public class TileObject extends StorageObject implements Serializable { String gridSetId; public static TileObject createQueryTileObject( - String layerName, - long[] xyz, - String gridSetId, - String format, - Map parameters) { + String layerName, long[] xyz, String gridSetId, String format, Map parameters) { TileObject obj = new TileObject(); obj.layer_name = layerName; @@ -111,9 +105,7 @@ public String getParametersId() { return this.parameters_id; } - /** - * The BlobStore is responsible for setting this based on the value of {@link #getParameters()} - */ + /** The BlobStore is responsible for setting this based on the value of {@link #getParameters()} */ public void setParametersId(String parameters_id) { this.parameters_id = parameters_id; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/TileRange.java b/geowebcache/core/src/main/java/org/geowebcache/storage/TileRange.java index 439f38b370..45f904b4d2 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/TileRange.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/TileRange.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -20,8 +19,8 @@ import org.geowebcache.mime.MimeType; /** - * A 3 dimensional tile range inside a grid set, specified by a range of zooms for fast filtering - * and a set of (zoom level,xy bounds) specifications + * A 3 dimensional tile range inside a grid set, specified by a range of zooms for fast filtering and a set of (zoom + * level,xy bounds) specifications */ public class TileRange { private final String layerName; @@ -164,8 +163,7 @@ public long[] rangeBounds(final int zoomLevel) { } long[] zlevelBounds = rangeBounds.get(Integer.valueOf(zoomLevel)); if (zlevelBounds == null) { - throw new IllegalStateException( - "Found no range bounds for z level " + zoomLevel + ": " + rangeBounds); + throw new IllegalStateException("Found no range bounds for z level " + zoomLevel + ": " + rangeBounds); } return zlevelBounds; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeIterator.java b/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeIterator.java index 9f7ca97bd1..79777582f1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeIterator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeIterator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne OpenGeo 2010 */ @@ -32,10 +31,7 @@ public class TileRangeIterator { private volatile long[] lastGridLoc; - /** - * Note that the bounds of the tile range must already be expanded to the meta tile factors for - * this to work. - */ + /** Note that the bounds of the tile range must already be expanded to the meta tile factors for this to work. */ public TileRangeIterator(TileRange tr, int[] metaTilingFactors) { this.tr = tr; this.metaX = metaTilingFactors[0]; @@ -54,17 +50,15 @@ public TileRange getTileRange() { } /** - * This loops over all the possible metatile locations and returns a tile location within each - * metatile. + * This loops over all the possible metatile locations and returns a tile location within each metatile. * - *

If the TileRange object provided is a DiscontinuousTileRange implementation, each location - * is checked against the filter of that class. + *

If the TileRange object provided is a DiscontinuousTileRange implementation, each location is checked against + * the filter of that class. * - * @param gridLoc as an optimization, re-use the previous gridLoc. It will be changed and used - * as the return value. The values passed in will not impact the result. For the first call, - * use a new 3 element array. - * @return {@code null} if there're no more tiles to return, the next grid location in the - * iterator otherwise. The array has three elements: {x,y,z} + * @param gridLoc as an optimization, re-use the previous gridLoc. It will be changed and used as the return value. + * The values passed in will not impact the result. For the first call, use a new 3 element array. + * @return {@code null} if there're no more tiles to return, the next grid location in the iterator otherwise. The + * array has three elements: {x,y,z} */ public synchronized long[] nextMetaGridLocation(final long[] gridLoc) { long[] levelBounds; @@ -123,8 +117,7 @@ public synchronized long[] nextMetaGridLocation(final long[] gridLoc) { private int tilesForLocation(long x, long y, long[] levelBounds) { long boundsMaxX = levelBounds[2]; long boundsMaxY = levelBounds[3]; - return (int) Math.min(metaX, 1 + (boundsMaxX - x)) - * (int) Math.min(metaY, 1 + (boundsMaxY - y)); + return (int) Math.min(metaX, 1 + (boundsMaxX - x)) * (int) Math.min(metaY, 1 + (boundsMaxY - y)); } private int tilesForLocation(long[] gridLoc, long[] levelBounds) { @@ -132,8 +125,8 @@ private int tilesForLocation(long[] gridLoc, long[] levelBounds) { } /** - * Checks whether this grid location, or any on the same meta tile, should be included according - * to the DiscontinuousTileRange + * Checks whether this grid location, or any on the same meta tile, should be included according to the + * DiscontinuousTileRange */ private boolean checkGridLocation(long[] gridLoc) { if (dtr == null) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeMask.java b/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeMask.java index d37254042e..68b0397e10 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeMask.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/TileRangeMask.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2014 */ @@ -17,8 +16,8 @@ import org.geowebcache.seed.GWCTask; /** - * A mask applied to a {@link DiscontinuousTileRange} to limit which tiles are seeded/truncated out - * of the range's full coverage by means of a {@link TileRangeIterator}. + * A mask applied to a {@link DiscontinuousTileRange} to limit which tiles are seeded/truncated out of the range's full + * coverage by means of a {@link TileRangeIterator}. * * @see RasterMask * @see TileRangeIterator diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/TransientCache.java b/geowebcache/core/src/main/java/org/geowebcache/storage/TransientCache.java index 9ae019ff57..9b2e6294a5 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/TransientCache.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/TransientCache.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -46,22 +45,21 @@ public class TransientCache { private Ticker ticker = Ticker.systemTicker(); /** - * A path generator that uses the key set as its key to build keys suitable for usage in the in - * memory transient cache + * A path generator that uses the key set as its key to build keys suitable for usage in the in memory transient + * cache */ private static FilePathGenerator keyGenerator = new DefaultFilePathGenerator(""); - private Map cache = - new LinkedHashMap<>() { + private Map cache = new LinkedHashMap<>() { - /** serialVersionUID */ - private static final long serialVersionUID = -4106644240603796847L; + /** serialVersionUID */ + private static final long serialVersionUID = -4106644240603796847L; - @Override - protected boolean removeEldestEntry(Entry eldest) { - return removeEntries(eldest); - } - }; + @Override + protected boolean removeEldestEntry(Entry eldest) { + return removeEntries(eldest); + } + }; /** * @param maxTiles Maximum number of tiles in cache diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/UnsuitableStorageException.java b/geowebcache/core/src/main/java/org/geowebcache/storage/UnsuitableStorageException.java index aec9a2bf91..75a70e44c7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/UnsuitableStorageException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/UnsuitableStorageException.java @@ -1,22 +1,20 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ package org.geowebcache.storage; /** - * Thrown when a Blobstore was initialized with persistance that is unsuitable, such as a non-empty - * directory + * Thrown when a Blobstore was initialized with persistance that is unsuitable, such as a non-empty directory * * @author smithkm */ @@ -39,9 +37,7 @@ public static void checkSuitability(String location, final boolean exists, boole case EMPTY: if (!empty) { throw new UnsuitableStorageException( - "Attempted to create Blob Store in " - + location - + " but it was not empty"); + "Attempted to create Blob Store in " + location + " but it was not empty"); } case NONE: } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathFilter.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathFilter.java index 5e00cd1c25..dbe461ec56 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -59,8 +58,7 @@ public DefaultFilePathFilter(TileRange trObj) throws StorageException { } /** - * Assumes it will get fed something like path: name: *EPSG_2163_01/0_0 01_01.png *EPSG_2163_01/ - * 0_0 * EPSG_2163_01 + * Assumes it will get fed something like path: name: *EPSG_2163_01/0_0 01_01.png *EPSG_2163_01/ 0_0 * EPSG_2163_01 * * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String) */ @@ -83,8 +81,7 @@ public boolean accept(File parent, String fileName) { } /** - * Example: nyc_01, nyc_05_1,EPSG_2163_01, EPSG_2163_01_7 (i.e. {@code - * _[_]}) + * Example: nyc_01, nyc_05_1,EPSG_2163_01, EPSG_2163_01_7 (i.e. {@code _[_]}) */ private boolean acceptZoomLevelDir(String name) { if (!name.startsWith(gridSetPrefix)) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathGenerator.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathGenerator.java index 33e082e390..50f78963fa 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathGenerator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/DefaultFilePathGenerator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -104,8 +103,7 @@ public File tilePath(TileObject tile, MimeType mimeType) { } @Override - public void visitRange(File layerDirectory, TileRange range, TileFileVisitor visitor) - throws StorageException { + public void visitRange(File layerDirectory, TileRange range, TileFileVisitor visitor) throws StorageException { final FilenameFilter tileFinder = new DefaultFilePathFilter(range); File[] srsZoomDirs = listFilesNullSafe(layerDirectory, tileFinder); diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java index 0d57555d53..19c3455524 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2009 */ @@ -71,16 +70,14 @@ public class FileBlobStore implements BlobStore { /** - * Interface for writing files. This is used to abstract the writing of files to allow different - * types of file writes, while keeping the same general machinery (write on temp file, rename to - * final file). + * Interface for writing files. This is used to abstract the writing of files to allow different types of file + * writes, while keeping the same general machinery (write on temp file, rename to final file). */ interface FileWriter { void write(File file) throws IOException; } - private static Logger log = - Logging.getLogger(org.geowebcache.storage.blobstore.file.FileBlobStore.class.getName()); + private static Logger log = Logging.getLogger(org.geowebcache.storage.blobstore.file.FileBlobStore.class.getName()); static final int DEFAULT_DISK_BLOCK_SIZE = 4096; @@ -104,8 +101,7 @@ interface FileWriter { private TempFileNameGenerator tmpGenerator = new TempFileNameGenerator(); - public FileBlobStore(DefaultStorageFinder defStoreFinder) - throws StorageException, ConfigurationException { + public FileBlobStore(DefaultStorageFinder defStoreFinder) throws StorageException, ConfigurationException { this(defStoreFinder.getDefaultPath()); } @@ -152,10 +148,7 @@ public FileBlobStore(String rootPath, FilePathGenerator pathGenerator) throws St // In future it should store key value pairs. metadataFile.createNewFile(); } catch (IOException e) { - log.log( - Level.SEVERE, - "Error while writing blobstore metadata file " + metadataFile.getPath(), - e); + log.log(Level.SEVERE, "Error while writing blobstore metadata file " + metadataFile.getPath(), e); } stagingArea = new File(path, "_gwc_in_progress_deletes_"); @@ -170,8 +163,7 @@ private void issuePendingDeletes() { } if (!stagingArea.isDirectory() || !stagingArea.canWrite()) { throw new IllegalStateException( - "Staging area is not writable or is not a directory: " - + stagingArea.getAbsolutePath()); + "Staging area is not writable or is not a directory: " + stagingArea.getAbsolutePath()); } File[] pendings = listFilesNullSafe(stagingArea); for (File directory : pendings) { @@ -186,8 +178,7 @@ private void deletePending(final File pendingDeleteDirectory) { } private void createDeleteExecutorService() { - CustomizableThreadFactory tf = - new CustomizableThreadFactory("GWC FileStore delete " + "directory thread-"); + CustomizableThreadFactory tf = new CustomizableThreadFactory("GWC FileStore delete " + "directory thread-"); tf.setDaemon(true); tf.setThreadPriority(Thread.MIN_PRIORITY); deleteExecutorService = Executors.newFixedThreadPool(1); @@ -214,15 +205,11 @@ public void run() { try { deleteDirectory(directory); } catch (IOException e) { - log.log( - Level.WARNING, - "Exception occurred while deleting '" + directory.getAbsolutePath() + "'", - e); + log.log(Level.WARNING, "Exception occurred while deleting '" + directory.getAbsolutePath() + "'", e); } catch (InterruptedException e) { - log.info( - "FileStore delete background service interrupted while deleting '" - + directory.getAbsolutePath() - + "'. Process will be resumed at next start up"); + log.info("FileStore delete background service interrupted while deleting '" + + directory.getAbsolutePath() + + "'. Process will be resumed at next start up"); Thread.currentThread().interrupt(); } } @@ -267,8 +254,7 @@ public boolean delete(final String layerName) throws StorageException { return ret; } - private boolean stageDelete(final File source, final String targetName) - throws StorageException { + private boolean stageDelete(final File source, final String targetName) throws StorageException { if (!source.exists() || !source.canWrite()) { log.info(source + " does not exist or is not writable"); @@ -276,8 +262,7 @@ private boolean stageDelete(final File source, final String targetName) } if (!stagingArea.exists() && !stagingArea.mkdirs()) { - throw new StorageException( - "Can't create staging directory for deletes: " + stagingArea.getAbsolutePath()); + throw new StorageException("Can't create staging directory for deletes: " + stagingArea.getAbsolutePath()); } File tmpFolder = new File(stagingArea, targetName); @@ -289,23 +274,19 @@ private boolean stageDelete(final File source, final String targetName) } boolean renamed = FileUtils.renameFile(source, tmpFolder); if (!renamed) { - throw new IllegalStateException( - "Can't rename " - + source.getAbsolutePath() - + " to " - + tmpFolder.getAbsolutePath() - + " for deletion"); + throw new IllegalStateException("Can't rename " + + source.getAbsolutePath() + + " to " + + tmpFolder.getAbsolutePath() + + " for deletion"); } deletePending(tmpFolder); return true; } - /** - * @see org.geowebcache.storage.BlobStore#deleteByGridsetId(java.lang.String, java.lang.String) - */ + /** @see org.geowebcache.storage.BlobStore#deleteByGridsetId(java.lang.String, java.lang.String) */ @Override - public boolean deleteByGridsetId(final String layerName, final String gridSetId) - throws StorageException { + public boolean deleteByGridsetId(final String layerName, final String gridSetId) throws StorageException { final File layerPath = getLayerPath(layerName); if (!layerPath.exists() || !layerPath.canWrite()) { @@ -314,14 +295,13 @@ public boolean deleteByGridsetId(final String layerName, final String gridSetId) } final String filteredGridSetId = filteredGridSetId(gridSetId); - FileFilter filter = - pathname -> { - if (!pathname.isDirectory()) { - return false; - } - String dirName = pathname.getName(); - return dirName.startsWith(filteredGridSetId); - }; + FileFilter filter = pathname -> { + if (!pathname.isDirectory()) { + return false; + } + String dirName = pathname.getName(); + return dirName.startsWith(filteredGridSetId); + }; File[] gridSubsetCaches = listFilesNullSafe(layerPath, filter); for (File gridSubsetCache : gridSubsetCaches) { @@ -337,25 +317,22 @@ public boolean deleteByGridsetId(final String layerName, final String gridSetId) /** * Renames the layer directory for layer {@code oldLayerName} to {@code newLayerName} * - * @return true if the directory for the layer was renamed, or the original directory didn't - * exist in first place. {@code false} if the original directory exists but can't be renamed - * to the target directory + * @return true if the directory for the layer was renamed, or the original directory didn't exist in first place. + * {@code false} if the original directory exists but can't be renamed to the target directory * @throws StorageException if the target directory already exists * @see org.geowebcache.storage.BlobStore#rename */ @Override - public boolean rename(final String oldLayerName, final String newLayerName) - throws StorageException { + public boolean rename(final String oldLayerName, final String newLayerName) throws StorageException { final File oldLayerPath = getLayerPath(oldLayerName); final File newLayerPath = getLayerPath(newLayerName); if (newLayerPath.exists()) { - throw new StorageException( - "Can't rename layer directory " - + oldLayerPath - + " to " - + newLayerPath - + ". Target directory already exists"); + throw new StorageException("Can't rename layer directory " + + oldLayerPath + + " to " + + newLayerPath + + ". Target directory already exists"); } if (!oldLayerPath.exists()) { this.listeners.sendLayerRenamed(oldLayerName, newLayerName); @@ -369,8 +346,7 @@ public boolean rename(final String oldLayerName, final String newLayerName) if (renamed) { this.listeners.sendLayerRenamed(oldLayerName, newLayerName); } else { - throw new StorageException( - "Couldn't rename layer directory " + oldLayerPath + " to " + newLayerPath); + throw new StorageException("Couldn't rename layer directory " + oldLayerPath + " to " + newLayerPath); } return renamed; } @@ -436,35 +412,24 @@ public boolean delete(TileRange trObj) throws StorageException { final String parametersId = trObj.getParametersId(); AtomicLong count = new AtomicLong(); - pathGenerator.visitRange( - layerPath, - trObj, - new TileFileVisitor() { - - @Override - public void visitFile(File tile, long x, long y, int z) { - long length = tile.length(); - boolean deleted = tile.delete(); - if (deleted) { - listeners.sendTileDeleted( - layerName, - gridSetId, - blobFormat, - parametersId, - x, - y, - z, - padSize(length)); - count.incrementAndGet(); - } - } + pathGenerator.visitRange(layerPath, trObj, new TileFileVisitor() { + + @Override + public void visitFile(File tile, long x, long y, int z) { + long length = tile.length(); + boolean deleted = tile.delete(); + if (deleted) { + listeners.sendTileDeleted(layerName, gridSetId, blobFormat, parametersId, x, y, z, padSize(length)); + count.incrementAndGet(); + } + } - @Override - public void postVisitDirectory(File dir) { - // will delete only if empty - dir.delete(); - } - }); + @Override + public void postVisitDirectory(File dir) { + // will delete only if empty + dir.delete(); + } + }); log.info("Truncated " + count + " tiles"); @@ -507,10 +472,7 @@ public void put(TileObject stObj) throws StorageException { try { fh.setLastModified(stObj.getCreated()); } catch (Exception e) { - log.log( - Level.FINE, - "Failed to set the last modified time to match the tile request time", - e); + log.log(Level.FINE, "Failed to set the last modified time to match the tile request time", e); } } @@ -527,8 +489,7 @@ public void put(TileObject stObj) throws StorageException { } } - private void putParametersMetadata( - String layerName, String parametersId, Map parameters) + private void putParametersMetadata(String layerName, String parametersId, Map parameters) throws StorageException { // check if we even need to use any IO if (parametersId == null || parameters == null || parameters.isEmpty()) return; @@ -536,26 +497,20 @@ private void putParametersMetadata( File parametersFile = parametersFile(layerName, parametersId); if (parametersFile.exists()) return; - writeFile( - parametersFile, - false, - file -> { - Properties properties = new Properties(); - parameters.forEach(properties::setProperty); - try (OutputStream os = new FileOutputStream(file)) { - properties.store(os, "Parameters values for identifier: " + parametersId); - } - }); + writeFile(parametersFile, false, file -> { + Properties properties = new Properties(); + parameters.forEach(properties::setProperty); + try (OutputStream os = new FileOutputStream(file)) { + properties.store(os, "Parameters values for identifier: " + parametersId); + } + }); } private File parametersFile(String layerName, String parametersId) { - String path = - FilePathUtils.buildPath( - this.path, - layerName, - PARAMETERS_METADATA_OBJECT_PREFIX - + parametersId - + PARAMETERS_METADATA_OBJECT_SUFFIX); + String path = FilePathUtils.buildPath( + this.path, + layerName, + PARAMETERS_METADATA_OBJECT_PREFIX + parametersId + PARAMETERS_METADATA_OBJECT_SUFFIX); return new File(path); } @@ -592,25 +547,21 @@ private Resource readFile(File fh) throws StorageException { } private void writeTile(File target, TileObject stObj, boolean existed) throws StorageException { - writeFile( - target, - existed, - file -> { - try (FileOutputStream fos = new FileOutputStream(file); - FileChannel channel = fos.getChannel()) { - stObj.getBlob().transferTo(channel); - } - }); + writeFile(target, existed, file -> { + try (FileOutputStream fos = new FileOutputStream(file); + FileChannel channel = fos.getChannel()) { + stObj.getBlob().transferTo(channel); + } + }); } /** - * Writes into the target file by first creating a temporary file, filling it with the writer, - * and then renaming it to the target file. + * Writes into the target file by first creating a temporary file, filling it with the writer, and then renaming it + * to the target file. * * @throws StorageException */ - private void writeFile(File target, boolean existed, FileWriter writer) - throws StorageException { + private void writeFile(File target, boolean existed, FileWriter writer) throws StorageException { // first write to temp file tmp.mkdirs(); File temp = new File(tmp, tmpGenerator.newName()); @@ -635,10 +586,7 @@ private void writeFile(File target, boolean existed, FileWriter writer) } } finally { if (temp != null) { - log.warning( - "Tile " - + target.getPath() - + " was already written by another thread/process"); + log.warning("Tile " + target.getPath() + " was already written by another thread/process"); temp.delete(); } } @@ -662,8 +610,8 @@ public boolean removeListener(BlobStoreListener listener) { } /** - * This method will recursively create the missing directories and call the listeners - * directoryCreated method for each created directory. + * This method will recursively create the missing directories and call the listeners directoryCreated method for + * each created directory. */ private boolean mkdirs(File path, TileObject stObj) { /* if the terminal directory already exists, answer false */ @@ -689,9 +637,7 @@ private boolean mkdirs(File path, TileObject stObj) { return false; } - /** - * @see org.geowebcache.storage.BlobStore#getLayerMetadata(java.lang.String, java.lang.String) - */ + /** @see org.geowebcache.storage.BlobStore#getLayerMetadata(java.lang.String, java.lang.String) */ @Override public String getLayerMetadata(final String layerName, final String key) { try { @@ -711,10 +657,7 @@ private static String urlDecUtf8(String value) { return value; } - /** - * @see org.geowebcache.storage.BlobStore#putLayerMetadata(java.lang.String, java.lang.String, - * java.lang.String) - */ + /** @see org.geowebcache.storage.BlobStore#putLayerMetadata(java.lang.String, java.lang.String, java.lang.String) */ @Override public void putLayerMetadata(final String layerName, final String key, final String value) { try { @@ -732,13 +675,12 @@ public boolean layerExists(String layerName) { } /** - * Specify the file system block size, used to pad out tile lenghts to whole blocks when - * reporting {@link BlobStoreListener#tileDeleted tileDeleted}, {@link - * BlobStoreListener#tileStored tileStored}, or {@link BlobStoreListener#tileUpdated - * tileUpdated} events. + * Specify the file system block size, used to pad out tile lenghts to whole blocks when reporting + * {@link BlobStoreListener#tileDeleted tileDeleted}, {@link BlobStoreListener#tileStored tileStored}, or + * {@link BlobStoreListener#tileUpdated tileUpdated} events. * - * @param fileSystemBlockSize the size of a filesystem block; must be a positive integer, - * usually a power of 2 greater or equal to 512. + * @param fileSystemBlockSize the size of a filesystem block; must be a positive integer, usually a power of 2 + * greater or equal to 512. */ public void setBlockSize(int fileSystemBlockSize) { Preconditions.checkArgument(fileSystemBlockSize > 0); @@ -761,8 +703,7 @@ private long padSize(long fileSize) { } @Override - public boolean deleteByParametersId(String layerName, String parametersId) - throws StorageException { + public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { final File layerPath = getLayerPath(layerName); if (!layerPath.exists() || !layerPath.canWrite()) { @@ -779,23 +720,18 @@ public boolean deleteByParametersId(String layerName, String parametersId) } catch (IOException e) { log.log( Level.WARNING, - String.format( - "Failed to clean up metadata for parameters %s in layer %s", - parametersId, layerName), + String.format("Failed to clean up metadata for parameters %s in layer %s", parametersId, layerName), e); } // delete the caches - File[] parameterCaches = - listFilesNullSafe( - layerPath, - (pathname) -> { - if (!pathname.isDirectory()) { - return false; - } - String dirName = pathname.getName(); - return dirName.endsWith(parametersId); - }); + File[] parameterCaches = listFilesNullSafe(layerPath, (pathname) -> { + if (!pathname.isDirectory()) { + return false; + } + String dirName = pathname.getName(); + return dirName.endsWith(parametersId); + }); for (File parameterCache : parameterCaches) { String target = filteredLayerName(layerName) + "_" + parameterCache.getName(); @@ -807,15 +743,14 @@ public boolean deleteByParametersId(String layerName, String parametersId) return true; } - private Stream layerChildStream( - final String layerName, DirectoryStream.Filter filter) throws IOException { + private Stream layerChildStream(final String layerName, DirectoryStream.Filter filter) + throws IOException { final File layerPath = getLayerPath(layerName); if (!layerPath.exists()) { return Stream.of(); } @SuppressWarnings("PMD.CloseResource") // wrapped and closed in the return value - final DirectoryStream layerDirStream = - Files.newDirectoryStream(layerPath.toPath(), filter); + final DirectoryStream layerDirStream = Files.newDirectoryStream(layerPath.toPath(), filter); return StreamSupport.stream(layerDirStream.spliterator(), false) .onClose( // Delegate closing so that when the returned stream is closed, so is the // underlying DirectoryStream @@ -828,11 +763,9 @@ private Stream layerChildStream( }); } - public boolean isParameterIdCached(String layerName, final String parametersId) - throws IOException { + public boolean isParameterIdCached(String layerName, final String parametersId) throws IOException { try (Stream layerChildStream = - layerChildStream( - layerName, (p) -> Files.isDirectory(p) && p.endsWith(parametersId))) { + layerChildStream(layerName, (p) -> Files.isDirectory(p) && p.endsWith(parametersId))) { return layerChildStream.findAny().isPresent(); } } @@ -849,19 +782,15 @@ public Map>> getParametersMapping(String la log.fine("Optimistic read of metadata mappings failed"); return null; } - Map>> result = - parameterIds.stream() - .collect( - Collectors.toMap( - (id) -> id, - (id) -> { - String kvp = p.get("parameters." + id); - if (Objects.isNull(kvp)) { - return Optional.empty(); - } - kvp = urlDecUtf8(kvp); - return Optional.of(ParametersUtils.getMap(kvp)); - })); + Map>> result = parameterIds.stream() + .collect(Collectors.toMap((id) -> id, (id) -> { + String kvp = p.get("parameters." + id); + if (Objects.isNull(kvp)) { + return Optional.empty(); + } + kvp = urlDecUtf8(kvp); + return Optional.of(ParametersUtils.getMap(kvp)); + })); // go look for the current parameter files too though, and overwrite the legacy metadata for (String parameterId : parameterIds) { @@ -882,8 +811,8 @@ public Map>> getParametersMapping(String la private static Map propertiesToMap(Properties properties) { return properties.entrySet().stream() - .collect( - Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString())); + .collect(Collectors.toMap( + e -> e.getKey().toString(), e -> e.getValue().toString())); } static final int paramIdLength = @@ -891,8 +820,7 @@ private static Map propertiesToMap(Properties properties) { @Override public Set getParameterIds(String layerName) { - try (Stream layerChildStream = - layerChildStream(layerName, (p) -> Files.isDirectory(p))) { + try (Stream layerChildStream = layerChildStream(layerName, (p) -> Files.isDirectory(p))) { return layerChildStream .map(p -> p.getFileName().toString()) .map(s -> s.substring(s.lastIndexOf('_') + 1)) diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathGenerator.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathGenerator.java index 3ac54b3f75..8fc51e693f 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathGenerator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathGenerator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -28,9 +27,8 @@ public interface FilePathGenerator { File tilePath(TileObject tile, MimeType mimeType) throws GeoWebCacheException; /** - * Visits a directory containing a layer, hitting all tiles matching the tile range, and - * invoking the visitor on them. + * Visits a directory containing a layer, hitting all tiles matching the tile range, and invoking the visitor on + * them. */ - void visitRange(File layerDirectory, TileRange range, TileFileVisitor visitor) - throws StorageException; + void visitRange(File layerDirectory, TileRange range, TileFileVisitor visitor) throws StorageException; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathUtils.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathUtils.java index ea19da4d3c..16abb030d1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FilePathUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2008 */ @@ -32,10 +31,7 @@ public static String zeroPadder(long number, int order) { return sb.toString(); } - /** - * Silly way to pad numbers with leading zeros, since I don't know a fast way of doing this in - * Java. - */ + /** Silly way to pad numbers with leading zeros, since I don't know a fast way of doing this in Java. */ public static void zeroPadder(long number, int order, StringBuilder padding) { int numberOrder = 1; @@ -92,8 +88,7 @@ public static int findZoomLevel(final String gridsetPrefix, final String dirName try { return Integer.parseInt(zlevel); } catch (NumberFormatException e) { - throw new RuntimeException( - String.format("unable to find zoom level in '%s'", gridsetPrefix), e); + throw new RuntimeException(String.format("unable to find zoom level in '%s'", gridsetPrefix), e); } } @@ -120,9 +115,8 @@ public static void appendGridsetZoomLevelDir(String gridSetId, long z, StringBui } /** - * Returns a path built from a root and a list of components. The components are appended to the - * root with a {@link File#separatorChar} in between. The root is trusted not to need escaping, - * all other bits are filtered. + * Returns a path built from a root and a list of components. The components are appended to the root with a + * {@link File#separatorChar} in between. The root is trusted not to need escaping, all other bits are filtered. */ public static String buildPath(String root, String... components) { StringBuilder path = new StringBuilder(256); diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/LayerMetadataStore.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/LayerMetadataStore.java index 71aedb9332..e0d76ae83d 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/LayerMetadataStore.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/LayerMetadataStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Jose Macchi / Geosolutions 2009 */ @@ -50,17 +49,14 @@ public class LayerMetadataStore { private static Logger log = Logging.getLogger(LayerMetadataStore.class.getName()); - public static final String PROPERTY_METADATA_MAX_RW_ATTEMPTS = - "gwc.layermetadatastore.maxRWAttempts"; + public static final String PROPERTY_METADATA_MAX_RW_ATTEMPTS = "gwc.layermetadatastore.maxRWAttempts"; - public static final String PROPERTY_WAIT_AFTER_RENAME = - "gwc.layermetadatastore.waitAfterRename"; + public static final String PROPERTY_WAIT_AFTER_RENAME = "gwc.layermetadatastore.waitAfterRename"; static final int METADATA_MAX_RW_ATTEMPTS = Integer.parseInt(System.getProperty(PROPERTY_METADATA_MAX_RW_ATTEMPTS, "50")); - static final int WAIT_AFTER_RENAME = - Integer.parseInt(System.getProperty(PROPERTY_WAIT_AFTER_RENAME, "50")); + static final int WAIT_AFTER_RENAME = Integer.parseInt(System.getProperty(PROPERTY_WAIT_AFTER_RENAME, "50")); static final String METADATA_GZIP_EXTENSION = ".gz"; @@ -72,10 +68,9 @@ public class LayerMetadataStore { private static final int lockShardSize = 32; /** handling of local-process concurrent access to layer metadata files */ - private ReadWriteLock[] locks = - IntStream.range(0, lockShardSize) - .mapToObj(i -> new ReentrantReadWriteLock()) - .toArray(ReadWriteLock[]::new); + private ReadWriteLock[] locks = IntStream.range(0, lockShardSize) + .mapToObj(i -> new ReentrantReadWriteLock()) + .toArray(ReadWriteLock[]::new); public LayerMetadataStore(String rootPath, File tmpPath) { this.path = rootPath; @@ -97,11 +92,9 @@ public String getEntry(final String layerName, final String key) throws IOExcept /** * @throws IOException - * @see org.geowebcache.storage.BlobStore#putLayerMetadata(java.lang.String, java.lang.String, - * java.lang.String) + * @see org.geowebcache.storage.BlobStore#putLayerMetadata(java.lang.String, java.lang.String, java.lang.String) */ - public void putEntry(final String layerName, final String key, final String value) - throws IOException { + public void putEntry(final String layerName, final String key, final String value) throws IOException { final File metadataFile = resolveMetadataFile(layerName); Properties metadata = loadLayerMetadata(metadataFile); @@ -135,10 +128,9 @@ private static String urlDecUtf8(String value) { } private int resolveLockBucket(File file) { - long consistentFileNameHash = - Hashing.farmHashFingerprint64() - .hashString(file.getAbsolutePath(), StandardCharsets.UTF_8) - .asLong(); + long consistentFileNameHash = Hashing.farmHashFingerprint64() + .hashString(file.getAbsolutePath(), StandardCharsets.UTF_8) + .asLong(); int bucket = Hashing.consistentHash(consistentFileNameHash, locks.length); return bucket; } @@ -148,15 +140,14 @@ private ReadWriteLock getLock(File file) { } /** - * Performs the actual update of the metatada, making sure only the provided key/value pair is - * updated in case another process modified the metadata file since it was loaded by the caller - * code + * Performs the actual update of the metatada, making sure only the provided key/value pair is updated in case + * another process modified the metadata file since it was loaded by the caller code * * @throws IOException */ @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE") - private void writeMetadataOptimisticLock( - final String key, final String value, final File metadataFile) throws IOException { + private void writeMetadataOptimisticLock(final String key, final String value, final File metadataFile) + throws IOException { final ReadWriteLock rwLock = getLock(metadataFile); final int maxAttempts = LayerMetadataStore.METADATA_MAX_RW_ATTEMPTS; Properties metadata = loadLayerMetadata(metadataFile); @@ -178,39 +169,30 @@ private void writeMetadataOptimisticLock( // compare content between renamed file and memory content Properties metadataAfterRename = loadLayerMetadata(metadataFile); if (!metadata.equals(metadataAfterRename)) { - log.fine( - "Renamed file content differs from expected saved content.\nCurrent:" - + metadataAfterRename.toString() - + "\nExpected: " - + metadata.toString()); + log.fine("Renamed file content differs from expected saved content.\nCurrent:" + + metadataAfterRename.toString() + + "\nExpected: " + + metadata.toString()); attempt++; } else { - log.fine( - "Temporary file renamed successfully (metadata: " - + metadata.toString() - + ")"); + log.fine("Temporary file renamed successfully (metadata: " + metadata.toString() + ")"); return; } } else { - log.info( - "Reattempting to write metadata file, because an error while renaming metadata file " - + metadataFile.getPath()); + log.info("Reattempting to write metadata file, because an error while renaming metadata file " + + metadataFile.getPath()); attempt++; } tempFile.delete(); } else { - log.fine( - "Reattempting to write metadata file since timestamp changed (metadata: " - + metadata.toString() - + ")"); + log.fine("Reattempting to write metadata file since timestamp changed (metadata: " + + metadata.toString() + + ")"); } // another process beat us, reload // next line triggers a false-positive DLS_DEAD_LOCAL_STORE if (metadata.isEmpty()) { - log.fine( - "Reattempting to write metadata file with empty metadata: " - + metadata.toString() - + ")"); + log.fine("Reattempting to write metadata file with empty metadata: " + metadata.toString() + ")"); } metadata = loadLayerMetadata(metadataFile); lastModified = metadataFile.lastModified(); @@ -229,8 +211,7 @@ private void writeMetadataOptimisticLock( private File writeTempMetadataFile(Properties metadata) { tmp.mkdirs(); try { - final File metadataFile = - File.createTempFile("tmp", LayerMetadataStore.METADATA_GZIP_EXTENSION, tmp); + final File metadataFile = File.createTempFile("tmp", LayerMetadataStore.METADATA_GZIP_EXTENSION, tmp); return this.writeMetadataFile(metadata, metadataFile); } catch (IOException e) { log.log(Level.SEVERE, "Cannot create temporary file"); @@ -264,22 +245,19 @@ private void createParentIfNeeded(File metadataFile) { File parentDir = metadataFile.getParentFile(); if (!parentDir.exists() && !parentDir.mkdirs()) { if (!parentDir.exists()) - throw new IllegalStateException( - "Unable to create parent directory " + parentDir.getAbsolutePath()); + throw new IllegalStateException("Unable to create parent directory " + parentDir.getAbsolutePath()); } } private Writer compressingWriter(File file) throws FileNotFoundException, IOException { - return new OutputStreamWriter( - new GZIPOutputStream(new FileOutputStream(file)), StandardCharsets.UTF_8); + return new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(file)), StandardCharsets.UTF_8); } private Properties getUncompressedLayerMetadata(final File metadataFile) throws IOException { return loadLayerMetadata(metadataFile, this::open); } - private Properties loadLayerMetadata(File metadataFile, Function isProvider) - throws IOException { + private Properties loadLayerMetadata(File metadataFile, Function isProvider) throws IOException { // out-of-process concurrency control final int maxAttempts = LayerMetadataStore.METADATA_MAX_RW_ATTEMPTS; long lastModified = metadataFile.lastModified(); @@ -297,10 +275,9 @@ private Properties loadLayerMetadata(File metadataFile, FunctionThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2020 */ @@ -18,8 +17,8 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * Generates temporary file names with the help of random UUIDS and a counter, to avoid scalablity - * issues in pure random UUID generation + * Generates temporary file names with the help of random UUIDS and a counter, to avoid scalablity issues in pure random + * UUID generation */ class TempFileNameGenerator { diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/TileFileVisitor.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/TileFileVisitor.java index 56ec950e7d..f3dc9691ac 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/TileFileVisitor.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/TileFileVisitor.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -16,10 +15,7 @@ import java.io.File; -/** - * Visitor for a hierarchy of tile files. Roughly inspired by Java own {@link - * java.nio.file.FileVisitor} - */ +/** Visitor for a hierarchy of tile files. Roughly inspired by Java own {@link java.nio.file.FileVisitor} */ public interface TileFileVisitor { /** Invoked before visitng a directory */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathFilter.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathFilter.java index 4059e468a3..9762086b00 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -40,8 +39,7 @@ public class XYZFilePathFilter implements FilenameFilter { * * @param trObj the range to find */ - public XYZFilePathFilter(TileRange trObj, XYZFilePathGenerator generator) - throws StorageException { + public XYZFilePathFilter(TileRange trObj, XYZFilePathGenerator generator) throws StorageException { this.tr = trObj; this.generator = generator; diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathGenerator.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathGenerator.java index 05451f7f66..850a6a0040 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathGenerator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/XYZFilePathGenerator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -55,8 +54,7 @@ public enum Convention { protected final String cacheRoot; private final Convention convention; - public XYZFilePathGenerator( - String cacheRoot, TileLayerDispatcher layers, Convention convention) { + public XYZFilePathGenerator(String cacheRoot, TileLayerDispatcher layers, Convention convention) { this.cacheRoot = cacheRoot; this.layers = layers; this.convention = convention; @@ -110,12 +108,11 @@ public File tilePath(TileObject tile, MimeType mimeType) throws GeoWebCacheExcep } /** - * This method abstract going from internal tile grid (TMS) to storage tile grid (could be - * slippy). One method is all it needs only because the TMS vs Slippy conventions have - * symmetrical map, e.g., the same extact operation goes both directions + * This method abstract going from internal tile grid (TMS) to storage tile grid (could be slippy). One method is + * all it needs only because the TMS vs Slippy conventions have symmetrical map, e.g., the same extact operation + * goes both directions */ - protected long getY(String layerName, String gridSetId, long x, long y, int z) - throws GeoWebCacheException { + protected long getY(String layerName, String gridSetId, long x, long y, int z) throws GeoWebCacheException { if (convention == Convention.TMS) { return y; } else { @@ -128,8 +125,7 @@ protected long getY(String layerName, String gridSetId, long x, long y, int z) } @Override - public void visitRange(File layerDirectory, TileRange range, TileFileVisitor visitor) - throws StorageException { + public void visitRange(File layerDirectory, TileRange range, TileFileVisitor visitor) throws StorageException { final FilenameFilter tileFinder = new XYZFilePathFilter(range, this); // list directories with gridset and param identifiers for (File gridsetParamDir : listFilesNullSafe(layerDirectory, tileFinder)) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheConfiguration.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheConfiguration.java index e14eac563c..42887c46d6 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheConfiguration.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheConfiguration.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheProvider.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheProvider.java index 3040b3ac37..8bca9fc083 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -19,10 +18,10 @@ import org.geowebcache.storage.blobstore.memory.CacheConfiguration.EvictionPolicy; /** - * Interface providing access to a cache object. It must be used by the {@link MemoryBlobStore} - * class for caching {@link TileObject} instances. This cache should be configured only with the - * setConfiguration method and should be modified by calling in sequence: resetCache() and - * setConfiguration(). Users should be able to add and remove Layers that should not be cached. + * Interface providing access to a cache object. It must be used by the {@link MemoryBlobStore} class for caching + * {@link TileObject} instances. This cache should be configured only with the setConfiguration method and should be + * modified by calling in sequence: resetCache() and setConfiguration(). Users should be able to add and remove Layers + * that should not be cached. * * @author Nicola Lagomarsini GeoSolutions */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheStatistics.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheStatistics.java index 49d1644030..c0a47e2255 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheStatistics.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/CacheStatistics.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/MemoryBlobStore.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/MemoryBlobStore.java index 4e5847e655..5711749ab0 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/MemoryBlobStore.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/MemoryBlobStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -46,12 +45,11 @@ import org.springframework.context.ApplicationContextAware; /** - * This class is an implementation of the {@link BlobStore} interface wrapping another {@link - * BlobStore} implementation and supporting in memory caching. Caching is provided by an input - * {@link CacheProvider} object. It must be pointed out that this Blobstore has an asynchronous - * relation with the underlying wrapped {@link BlobStore}. In fact, each operation on the wrapped - * {@link BlobStore} is scheduled in a queue and will be done by an executor thread. Operations that - * require a boolean value will have to wait until previous tasks are completed. + * This class is an implementation of the {@link BlobStore} interface wrapping another {@link BlobStore} implementation + * and supporting in memory caching. Caching is provided by an input {@link CacheProvider} object. It must be pointed + * out that this Blobstore has an asynchronous relation with the underlying wrapped {@link BlobStore}. In fact, each + * operation on the wrapped {@link BlobStore} is scheduled in a queue and will be done by an executor thread. Operations + * that require a boolean value will have to wait until previous tasks are completed. * * @author Nicola Lagomarsini Geosolutions */ @@ -69,28 +67,21 @@ public class MemoryBlobStore implements BlobStore, ApplicationContextAware { /** Executor service used for scheduling cacheProvider store operations like put,delete,... */ private final ExecutorService executorService; - /** - * Optional name used for searching the bean related to the CacheProvider to set in the - * ApplicationContext - */ + /** Optional name used for searching the bean related to the CacheProvider to set in the ApplicationContext */ private String cacheBeanName; /** Boolean used for Application Context initialization */ private AtomicBoolean cacheAlreadySet; - /** - * {@link ReentrantReadWriteLock} used for handling concurrency when accessing the - * cacheProvider. - */ + /** {@link ReentrantReadWriteLock} used for handling concurrency when accessing the cacheProvider. */ private final ReentrantReadWriteLock lock; /** {@link WriteLock} used for scheduling the access to the {@link MemoryBlobStore} state */ private final WriteLock blobStoreStateLock; /** - * {@link ReadLock} used for granting access to operations which does not change the {@link - * MemoryBlobStore} state, but can change the state of its components like {@link CacheProvider} - * and {@link BlobStore} + * {@link ReadLock} used for granting access to operations which does not change the {@link MemoryBlobStore} state, + * but can change the state of its components like {@link CacheProvider} and {@link BlobStore} */ private final ReadLock componentsStateLock; @@ -156,8 +147,7 @@ public boolean deleteByGridsetId(String layerName, String gridSetId) throws Stor log.fine("Scheduling GridSet: " + gridSetId + " removal for Layer: " + layerName); } // Remove selected gridsets - executorService.submit( - new BlobStoreTask(store, BlobStoreAction.DELETE_GRIDSET, layerName, gridSetId)); + executorService.submit(new BlobStoreTask(store, BlobStoreAction.DELETE_GRIDSET, layerName, gridSetId)); return true; } finally { componentsStateLock.unlock(); @@ -189,31 +179,29 @@ public boolean delete(TileRange obj) throws StorageException { componentsStateLock.lock(); try { if (log.isLoggable(Level.FINE)) { - log.fine( - "Removing TileObjects for Layer: " - + obj.getLayerName() - + ", min/max levels: " - + "[" - + obj.getZoomStart() - + ", " - + obj.getZoomStop() - + "], Gridset: " - + obj.getGridSetId()); + log.fine("Removing TileObjects for Layer: " + + obj.getLayerName() + + ", min/max levels: " + + "[" + + obj.getZoomStart() + + ", " + + obj.getZoomStop() + + "], Gridset: " + + obj.getGridSetId()); } // Remove layer for the cacheProvider cacheProvider.removeLayer(obj.getLayerName()); // Remove selected TileObject if (log.isLoggable(Level.FINE)) { - log.fine( - "Scheduling removal of TileObjects for Layer: " - + obj.getLayerName() - + ", min/max levels: " - + "[" - + obj.getZoomStart() - + ", " - + obj.getZoomStop() - + "], Gridset: " - + obj.getGridSetId()); + log.fine("Scheduling removal of TileObjects for Layer: " + + obj.getLayerName() + + ", min/max levels: " + + "[" + + obj.getZoomStart() + + ", " + + obj.getZoomStop() + + "], Gridset: " + + obj.getGridSetId()); } // Remove selected TileRange executorService.submit(new BlobStoreTask(store, BlobStoreAction.DELETE_RANGE, obj)); @@ -234,10 +222,7 @@ public boolean get(TileObject obj) throws StorageException { boolean found = false; if (cached == null) { if (log.isLoggable(Level.FINE)) { - log.fine( - "TileObject:" - + obj - + " not found. Try to get it from the wrapped blobstore"); + log.fine("TileObject:" + obj + " not found. Try to get it from the wrapped blobstore"); } // Try if it can be found in the system. Wait other scheduled tasks found = executeBlobStoreTask(BlobStoreAction.GET, store, obj); @@ -375,8 +360,7 @@ public boolean rename(String oldLayerName, String newLayerName) throws StorageEx log.fine("Executing Layer rename task"); } // Variable containing the execution result - boolean executed = - executeBlobStoreTask(BlobStoreAction.RENAME, store, oldLayerName, newLayerName); + boolean executed = executeBlobStoreTask(BlobStoreAction.RENAME, store, oldLayerName, newLayerName); return executed; } finally { componentsStateLock.unlock(); @@ -471,8 +455,7 @@ public void setCacheProvider(CacheProvider cache) { } /** - * * This method is used for converting a {@link TileObject} {@link Resource} into a {@link - * ByteArrayResource}. + * * This method is used for converting a {@link TileObject} {@link Resource} into a {@link ByteArrayResource}. * * @return a TileObject with resource stored in a Byte Array */ @@ -504,20 +487,19 @@ private TileObject getByteResourceTile(TileObject obj) throws StorageException { finalBlob.setLastModified(blob.getLastModified()); // Creation of a new Resource - TileObject cached = - TileObject.createCompleteTileObject( - obj.getLayerName(), - obj.getXYZ(), - obj.getGridSetId(), - obj.getBlobFormat(), - obj.getParameters(), - finalBlob); + TileObject cached = TileObject.createCompleteTileObject( + obj.getLayerName(), + obj.getXYZ(), + obj.getGridSetId(), + obj.getBlobFormat(), + obj.getParameters(), + finalBlob); return cached; } /** - * Setter for the Cache Provider name, note that this cannot be used in combination with the - * setCacheProvider method in the application Context initialization + * Setter for the Cache Provider name, note that this cannot be used in combination with the setCacheProvider method + * in the application Context initialization */ public void setCacheBeanName(String cacheBeanName) { blobStoreStateLock.lock(); @@ -544,8 +526,7 @@ public void setApplicationContext(ApplicationContext applicationContext) throws if (cacheBeanName != null && !cacheBeanName.isEmpty()) { for (String beanDef : beans) { if (cacheBeanName.equalsIgnoreCase(beanDef)) { - CacheProvider bean = - applicationContext.getBean(beanDef, CacheProvider.class); + CacheProvider bean = applicationContext.getBean(beanDef, CacheProvider.class); if (bean.isAvailable()) { setCacheProvider(bean); configured = true; @@ -565,8 +546,7 @@ public void setApplicationContext(ApplicationContext applicationContext) throws // If two are present and at least one of them is not guava, then it is used if (!configured && beanSize == 2) { for (String beanDef : beans) { - CacheProvider bean = - applicationContext.getBean(beanDef, CacheProvider.class); + CacheProvider bean = applicationContext.getBean(beanDef, CacheProvider.class); if (!(bean instanceof GuavaCacheProvider) && bean.isAvailable()) { setCacheProvider(bean); configured = true; @@ -576,8 +556,7 @@ public void setApplicationContext(ApplicationContext applicationContext) throws // Try again and search if at least a GuavaCacheProvider is present if (!configured) { for (String beanDef : beans) { - CacheProvider bean = - applicationContext.getBean(beanDef, CacheProvider.class); + CacheProvider bean = applicationContext.getBean(beanDef, CacheProvider.class); if (bean.isAvailable()) { setCacheProvider(bean); configured = true; @@ -618,8 +597,8 @@ private boolean executeBlobStoreTask(BlobStoreAction action, BlobStore store, Ob } /** - * {@link Callable} implementation used for creating various tasks to submit to the {@link - * MemoryBlobStore} executor service. + * {@link Callable} implementation used for creating various tasks to submit to the {@link MemoryBlobStore} executor + * service. * * @author Nicola Lagomarsini GeoSolutions */ @@ -656,16 +635,15 @@ public Boolean call() throws Exception { } /** - * Enum containing all the possible operations that can be executed by a {@link BlobStoreTask}. - * Each operation must implement the "executeOperation" method. + * Enum containing all the possible operations that can be executed by a {@link BlobStoreTask}. Each operation must + * implement the "executeOperation" method. * * @author Nicola Lagomarsini GeoSolutions */ public enum BlobStoreAction { PUT { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { if (objs == null || objs.length < 1 || !(objs[0] instanceof TileObject)) { return false; } @@ -675,8 +653,7 @@ public boolean executeOperation(BlobStore store, Object... objs) }, GET { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { if (objs == null || objs.length < 1 || !(objs[0] instanceof TileObject)) { return false; } @@ -685,8 +662,7 @@ public boolean executeOperation(BlobStore store, Object... objs) }, DELETE_SINGLE { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { if (objs == null || objs.length < 1 || !(objs[0] instanceof TileObject)) { return false; } @@ -695,8 +671,7 @@ public boolean executeOperation(BlobStore store, Object... objs) }, DELETE_RANGE { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { if (objs == null || objs.length < 1 || !(objs[0] instanceof TileRange)) { return false; } @@ -705,12 +680,8 @@ public boolean executeOperation(BlobStore store, Object... objs) }, DELETE_GRIDSET { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { - if (objs == null - || objs.length < 2 - || !(objs[0] instanceof String) - || !(objs[1] instanceof String)) { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { + if (objs == null || objs.length < 2 || !(objs[0] instanceof String) || !(objs[1] instanceof String)) { return false; } return store.deleteByGridsetId((String) objs[0], (String) objs[1]); @@ -718,12 +689,8 @@ public boolean executeOperation(BlobStore store, Object... objs) }, DELETE_PARAMS_ID { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { - if (objs == null - || objs.length < 2 - || !(objs[0] instanceof String) - || !(objs[1] instanceof String)) { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { + if (objs == null || objs.length < 2 || !(objs[0] instanceof String) || !(objs[1] instanceof String)) { return false; } return store.deleteByParametersId((String) objs[0], (String) objs[1]); @@ -731,8 +698,7 @@ public boolean executeOperation(BlobStore store, Object... objs) }, DELETE_LAYER { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { if (objs == null || objs.length < 1 || !(objs[0] instanceof String)) { return false; } @@ -741,28 +707,22 @@ public boolean executeOperation(BlobStore store, Object... objs) }, CLEAR { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { store.clear(); return true; } }, DESTROY { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { store.destroy(); return true; } }, RENAME { @Override - public boolean executeOperation(BlobStore store, Object... objs) - throws StorageException { - if (objs == null - || objs.length < 2 - || !(objs[0] instanceof String) - || !(objs[1] instanceof String)) { + public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { + if (objs == null || objs.length < 2 || !(objs[0] instanceof String) || !(objs[1] instanceof String)) { return false; } return store.rename((String) objs[0], (String) objs[1]); @@ -774,13 +734,11 @@ public boolean executeOperation(BlobStore store, Object... objs) * * @return operation result */ - public abstract boolean executeOperation(BlobStore store, Object... objs) - throws StorageException; + public abstract boolean executeOperation(BlobStore store, Object... objs) throws StorageException; } @Override - public boolean deleteByParametersId(String layerName, String parametersId) - throws StorageException { + public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { componentsStateLock.lock(); try { if (log.isLoggable(Level.FINE)) { @@ -789,16 +747,10 @@ public boolean deleteByParametersId(String layerName, String parametersId) // Remove the layer from the cacheProvider cacheProvider.removeLayer(layerName); if (log.isLoggable(Level.FINE)) { - log.fine( - "Scheduling Parameters: " - + parametersId - + " removal for Layer: " - + layerName); + log.fine("Scheduling Parameters: " + parametersId + " removal for Layer: " + layerName); } // Remove selected parameters - executorService.submit( - new BlobStoreTask( - store, BlobStoreAction.DELETE_PARAMS_ID, layerName, parametersId)); + executorService.submit(new BlobStoreTask(store, BlobStoreAction.DELETE_PARAMS_ID, layerName, parametersId)); return true; } finally { componentsStateLock.unlock(); diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/NullBlobStore.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/NullBlobStore.java index 07ab4cb465..b49654f37e 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/NullBlobStore.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/NullBlobStore.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -33,10 +32,9 @@ import org.geowebcache.storage.TileRange; /** - * This class is an implementation of the {@link BlobStore} interface which does not store anything - * on the file system and can be used for doing a pure in memory caching of the {@link TileObject}s. - * This class simply stores the layer metadata in a {@link Map} object. The other operations are not - * executed. + * This class is an implementation of the {@link BlobStore} interface which does not store anything on the file system + * and can be used for doing a pure in memory caching of the {@link TileObject}s. This class simply stores the layer + * metadata in a {@link Map} object. The other operations are not executed. * * @author Nicola Lagomarsini Geosolutions */ @@ -146,8 +144,7 @@ public boolean layerExists(String layerName) { } @Override - public boolean deleteByParametersId(String layerName, String parametersId) - throws StorageException { + public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { return true; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/guava/GuavaCacheProvider.java b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/guava/GuavaCacheProvider.java index b476fef1f9..52f768874e 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/guava/GuavaCacheProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/memory/guava/GuavaCacheProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -44,8 +43,8 @@ import org.geowebcache.util.SuppressFBWarnings; /** - * This class is an implementation of the {@link CacheProvider} interface using a backing Guava - * {@link Cache} object. This implementation requires to be configured with the configure() method. + * This class is an implementation of the {@link CacheProvider} interface using a backing Guava {@link Cache} object. + * This implementation requires to be configured with the configure() method. * * @author Nicola Lagomarsini Geosolutions */ @@ -66,12 +65,8 @@ public class GuavaCacheProvider implements CacheProvider { private static final String GUAVA_NAME = "Guava Cache"; /** Array containing the supported Policies */ - public static final List POLICIES = - Collections.unmodifiableList( - Arrays.asList( - EvictionPolicy.NULL, - EvictionPolicy.EXPIRE_AFTER_ACCESS, - EvictionPolicy.EXPIRE_AFTER_WRITE)); + public static final List POLICIES = Collections.unmodifiableList( + Arrays.asList(EvictionPolicy.NULL, EvictionPolicy.EXPIRE_AFTER_ACCESS, EvictionPolicy.EXPIRE_AFTER_WRITE)); /** * This class handles the {@link CacheStats} object returned by the guava cache. @@ -83,8 +78,7 @@ public static class GuavaCacheStatistics extends CacheStatistics { /** serialVersionUID */ private static final long serialVersionUID = 1L; - public GuavaCacheStatistics( - CacheStats stats, double currentSpace, long actualSize, long totalSize) { + public GuavaCacheStatistics(CacheStats stats, double currentSpace, long actualSize, long totalSize) { this.setEvictionCount(stats.evictionCount()); this.setHitCount(stats.hitCount()); this.setMissCount(stats.missCount()); @@ -106,10 +100,7 @@ public GuavaCacheStatistics( /** {@link AtomicBoolean} used for ensuring that the Cache has already been configured */ private AtomicBoolean configured; - /** - * {@link AtomicLong} used for checking the number of active operations to wait when resetting - * the cache - */ + /** {@link AtomicLong} used for checking the number of active operations to wait when resetting the cache */ private AtomicLong actualOperations; /** Internal concurrent Set used for saving the names of the Layers that must not be cached */ @@ -149,39 +140,33 @@ private void initCache(CacheConfiguration configuration) { // Create the CacheBuilder CacheBuilder builder = CacheBuilder.newBuilder(); // Add weigher - Weigher weigher = - (key, value) -> { - currentSize.addAndGet(value.getBlobSize()); - return value.getBlobSize(); - }; + Weigher weigher = (key, value) -> { + currentSize.addAndGet(value.getBlobSize()); + return value.getBlobSize(); + }; // Create the builder - CacheBuilder newBuilder = - builder.maximumWeight(maxMemory) - .recordStats() - .weigher(weigher) - .concurrencyLevel(concurrency) - .removalListener( - notification -> { - // TODO This operation is not atomic - TileObject obj = notification.getValue(); - // Update the current size - currentSize.addAndGet(-obj.getBlobSize()); - final String tileKey = generateTileKey(obj); - final String layerName = obj.getLayerName(); - multimap.removeTile(layerName, tileKey); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.fine( - "Removed tile " - + tileKey - + " for layer " - + layerName - + " due to reason:" - + notification.getCause().toString()); - LOGGER.fine( - "Removed tile was evicted? " - + notification.wasEvicted()); - } - }); + CacheBuilder newBuilder = builder.maximumWeight(maxMemory) + .recordStats() + .weigher(weigher) + .concurrencyLevel(concurrency) + .removalListener(notification -> { + // TODO This operation is not atomic + TileObject obj = notification.getValue(); + // Update the current size + currentSize.addAndGet(-obj.getBlobSize()); + final String tileKey = generateTileKey(obj); + final String layerName = obj.getLayerName(); + multimap.removeTile(layerName, tileKey); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.fine("Removed tile " + + tileKey + + " for layer " + + layerName + + " due to reason:" + + notification.getCause().toString()); + LOGGER.fine("Removed tile was evicted? " + notification.wasEvicted()); + } + }); // Handle eviction policy boolean configuredPolicy = false; if (policy != null && evictionTime > 0) { @@ -211,22 +196,21 @@ private void initCache(CacheConfiguration configuration) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Configuring Scheduled Task for cache eviction"); } - Runnable command = - () -> { - if (configured.get()) { - // Increment the number of current operations - // This behavior is used in order to wait - // the end of all the operations after setting - // the configured parameter to false - actualOperations.incrementAndGet(); - try { - cache.cleanUp(); - } finally { - // Decrement the number of current operations. - actualOperations.decrementAndGet(); - } - } - }; + Runnable command = () -> { + if (configured.get()) { + // Increment the number of current operations + // This behavior is used in order to wait + // the end of all the operations after setting + // the configured parameter to false + actualOperations.incrementAndGet(); + try { + cache.cleanUp(); + } finally { + // Decrement the number of current operations. + actualOperations.decrementAndGet(); + } + } + }; // Initialization of the internal Scheduler task for scheduling cache cleanup scheduledPool = Executors.newScheduledThreadPool(CORE_POOL_SIZE); scheduledPool.scheduleAtFixedRate(command, 10, evictionTime + 1, TimeUnit.SECONDS); @@ -467,13 +451,7 @@ public CacheStatistics getStatistics() { try { // Get cache statistics long actualSize = currentSize.get(); - long currentSpace = - (long) - (100L - - (1L) - * (100 - * ((1.0d) * (maxMemory - actualSize)) - / maxMemory)); + long currentSpace = (long) (100L - (1L) * (100 * ((1.0d) * (maxMemory - actualSize)) / maxMemory)); if (currentSpace < 0) { currentSpace = 0; } @@ -500,14 +478,13 @@ public CacheStatistics getStatistics() { public static String generateTileKey(TileObject obj) { Map parameters = obj.getParameters(); - StringBuilder builder = - new StringBuilder(obj.getLayerName()) - .append(SEPARATOR) - .append(obj.getGridSetId()) - .append(SEPARATOR) - .append(Arrays.toString(obj.getXYZ())) - .append(SEPARATOR) - .append(obj.getBlobFormat()); + StringBuilder builder = new StringBuilder(obj.getLayerName()) + .append(SEPARATOR) + .append(obj.getGridSetId()) + .append(SEPARATOR) + .append(Arrays.toString(obj.getXYZ())) + .append(SEPARATOR) + .append(obj.getBlobFormat()); // If parameters are present they must be handled if (parameters != null && !parameters.isEmpty()) { @@ -603,10 +580,10 @@ public boolean isAvailable() { } /** - * Internal class representing a concurrent multimap which associates to each Layer name the - * related {@link TileObject} cache keys. This map is useful when trying to remove a Layer, - * because it returns quicly all the cached keys of the selected layer, without having to cycle - * on the cache and checking if each TileObject belongs to the selected Layer. + * Internal class representing a concurrent multimap which associates to each Layer name the related + * {@link TileObject} cache keys. This map is useful when trying to remove a Layer, because it returns quicly all + * the cached keys of the selected layer, without having to cycle on the cache and checking if each TileObject + * belongs to the selected Layer. * * @author Nicola Lagomarsini, GeoSolutions */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/AccountingOutputStream.java b/geowebcache/core/src/main/java/org/geowebcache/util/AccountingOutputStream.java index 76d37768c6..b32a323f3c 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/AccountingOutputStream.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/AccountingOutputStream.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -68,8 +67,8 @@ public int getCount() { /** * This method can be used to determine if data can be written without blocking. * - * @return true if a write to this ServletOutputStream will succeed, - * otherwise returns false. + * @return true if a write to this ServletOutputStream will succeed, otherwise returns + * false. * @since Servlet 3.1 */ @Override @@ -78,11 +77,10 @@ public boolean isReady() { } /** - * Instructs the ServletOutputStream to invoke the provided {@link WriteListener} - * when it is possible to write + * Instructs the ServletOutputStream to invoke the provided {@link WriteListener} when it is possible + * to write * - * @param writeListener the {@link WriteListener} that should be notified when it's possible to - * write + * @param writeListener the {@link WriteListener} that should be notified when it's possible to write * @throws IllegalStateException if one of the following conditions is true *

    *
  • the associated request is neither upgraded nor the async started diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/ApplicationContextProvider.java b/geowebcache/core/src/main/java/org/geowebcache/util/ApplicationContextProvider.java index b268ee1211..22ed568f4d 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/ApplicationContextProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/ApplicationContextProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 *

    How can this be necessary... @@ -46,16 +45,11 @@ public String getSystemVar(String varName, String defaultValue) { throw new RuntimeException(msg); } - String tmpVar = - Optional.ofNullable(ctx.getServletContext()) - .map(sc -> sc.getInitParameter(varName)) - .orElse(null); + String tmpVar = Optional.ofNullable(ctx.getServletContext()) + .map(sc -> sc.getInitParameter(varName)) + .orElse(null); if (tmpVar != null && tmpVar.length() > 7) { - log.info( - "Using servlet init context parameter to configure " - + varName - + " to " - + tmpVar); + log.info("Using servlet init context parameter to configure " + varName + " to " + tmpVar); return tmpVar; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/ByteUtils.java b/geowebcache/core/src/main/java/org/geowebcache/util/ByteUtils.java index 3b91695b85..14e07dab39 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/ByteUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/ByteUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterable.java b/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterable.java index ee90f72c8a..c1907bacb2 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterable.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterable.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterator.java b/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterator.java index 1fd12b96a2..e2051a9bc3 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterator.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/CompositeIterator.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/ExceptionUtils.java b/geowebcache/core/src/main/java/org/geowebcache/util/ExceptionUtils.java index a31c62fe23..450d221e4d 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/ExceptionUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/ExceptionUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2018 */ @@ -21,12 +20,8 @@ public class ExceptionUtils { private ExceptionUtils() {} - /** - * Returns true if the provided throwable is of the specified class, or if any of those is - * suppresses is. - */ + /** Returns true if the provided throwable is of the specified class, or if any of those is suppresses is. */ public static boolean isOrSuppresses(T e, Class klazz) { - return Streams.concat(Stream.of(e), Arrays.stream(e.getSuppressed())) - .anyMatch(klazz::isInstance); + return Streams.concat(Stream.of(e), Arrays.stream(e.getSuppressed())).anyMatch(klazz::isInstance); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/FileUtils.java b/geowebcache/core/src/main/java/org/geowebcache/util/FileUtils.java index 71f4daf89c..11b58d8753 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/FileUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/FileUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -55,20 +54,19 @@ public static boolean rmFileCacheDir(File path, ExtensionFileLister extfl) { } /** - * Traverses the directory denoted by {@code path} recursively and calls {@code filter.accept} - * on each child, files first, subdirectories next. + * Traverses the directory denoted by {@code path} recursively and calls {@code filter.accept} on each child, files + * first, subdirectories next. * - *

    For a child directory to be traversed, the {@code filter.accept(File)} method shall have - * returned {@code true}, otherwise the child directory is skipped. + *

    For a child directory to be traversed, the {@code filter.accept(File)} method shall have returned + * {@code true}, otherwise the child directory is skipped. * - *

    This method guarantees that {@code filter.accept} will be called first for all files in a - * directory and then for all it's sub directories. + *

    This method guarantees that {@code filter.accept} will be called first for all files in a directory and then + * for all it's sub directories. * *

    * - * @param filter used to implement the visitor pattern. The accept method may contain any - * desired logic, it will be called for all files and directories inside {@code path}, - * recursively + * @param filter used to implement the visitor pattern. The accept method may contain any desired logic, it will be + * called for all files and directories inside {@code path}, recursively */ public static void traverseDepth(final File path, final FileFilter filter) { if (path == null) { @@ -79,8 +77,7 @@ public static void traverseDepth(final File path, final FileFilter filter) { } if (!path.exists() || !path.isDirectory() || !path.canRead()) { throw new IllegalArgumentException( - path.getAbsolutePath() - + " either does not exist, or is not a readable directory"); + path.getAbsolutePath() + " either does not exist, or is not a readable directory"); } // Use path.list() instead of path.listFiles() to avoid the simultaneous creation of // thousands of File objects as well as its String objects for the path name. Faster and @@ -107,9 +104,9 @@ public static void traverseDepth(final File path, final FileFilter filter) { } /** - * Utility method for renaming Files using Java 7 {@link Files}.move() method which provides an - * atomical file renaming. If an exception occurred during the renaming, the method will - * fallback to the old File().renameTo() method and will log a Message. + * Utility method for renaming Files using Java 7 {@link Files}.move() method which provides an atomical file + * renaming. If an exception occurred during the renaming, the method will fallback to the old File().renameTo() + * method and will log a Message. * * @return a boolean indicating if the rename operation has succeded */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/GWCVars.java b/geowebcache/core/src/main/java/org/geowebcache/util/GWCVars.java index 3eef962bd5..561e7ce2bd 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/GWCVars.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/GWCVars.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ @@ -41,8 +40,8 @@ public class GWCVars { public static final int CACHE_USE_WMS_BACKEND_VALUE = -4; /** - * enum containing and describing the possible sources of lookup for "environment variables", in - * order of precedence. + * enum containing and describing the possible sources of lookup for "environment variables", in order of + * precedence. */ public static enum VariableType { ENV("Java system property") { @@ -53,8 +52,7 @@ public static enum VariableType { SERVLET("servlet context parameter") { protected @Override String apply(ApplicationContext context, String varName) { if (context instanceof WebApplicationContext) { - ServletContext servletContext = - ((WebApplicationContext) context).getServletContext(); + ServletContext servletContext = ((WebApplicationContext) context).getServletContext(); return servletContext == null ? null : servletContext.getInitParameter(varName); } return null; @@ -79,8 +77,8 @@ public String getSource() { protected abstract String apply(ApplicationContext context, String varName); /** - * @return a non-null {@literal Variable} with the evaluated value for the given variable - * name, possibly {@literal null}. + * @return a non-null {@literal Variable} with the evaluated value for the given variable name, possibly + * {@literal null}. */ Variable get(ApplicationContext context, String varName) { return Variable.ofNullable(this, varName, this.apply(context, varName)); @@ -122,9 +120,8 @@ static Variable ofNullable(VariableType type, String name, String nullableValue) } /** - * The first non-null value for the given variable name in the order of lookup precedence - * defined by {@link VariableType} (that is, Java system property -> servlet context parameter - * -> system environment variable) + * The first non-null value for the given variable name in the order of lookup precedence defined by + * {@link VariableType} (that is, Java system property -> servlet context parameter -> system environment variable) */ public static String findEnvVar(ApplicationContext context, String varStr) { return lookup(context, varStr) @@ -136,8 +133,8 @@ public static String findEnvVar(ApplicationContext context, String varStr) { } /** - * @return all the results of a given variable look up in order of precedence, without filtering - * for null (i.e. not set) values + * @return all the results of a given variable look up in order of precedence, without filtering for null (i.e. not + * set) values */ public static List findVariable(ApplicationContext context, String varName) { return lookup(context, varName).collect(Collectors.toList()); diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/HttpClientBuilder.java b/geowebcache/core/src/main/java/org/geowebcache/util/HttpClientBuilder.java index 8045bda577..c939e2ffbe 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/HttpClientBuilder.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/HttpClientBuilder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Lennart Juette, PTV AG (http://www.ptvag.com) 2010 */ @@ -36,8 +35,7 @@ public class HttpClientBuilder { private AuthScope authscope = null; private Integer backendTimeoutMillis = null; - private static final HttpClientConnectionManager connectionManager = - new PoolingHttpClientConnectionManager(); + private static final HttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); private boolean doAuthentication = false; @@ -52,31 +50,24 @@ public HttpClientBuilder() { /** * Instantiates a new http client builder * - * @param url The server url, or null if no authentication is required or if the client is going - * to be used against a single server only + * @param url The server url, or null if no authentication is required or if the client is going to be used against + * a single server only */ public HttpClientBuilder( - URL url, - Integer backendTimeout, - String httpUsername, - String httpPassword, - URL proxyUrl, - int concurrency) { + URL url, Integer backendTimeout, String httpUsername, String httpPassword, URL proxyUrl, int concurrency) { if (url != null) { - this.setHttpCredentials( - httpUsername, httpPassword, new AuthScope(url.getHost(), url.getPort())); + this.setHttpCredentials(httpUsername, httpPassword, new AuthScope(url.getHost(), url.getPort())); } else { this.setHttpCredentials(httpUsername, httpPassword, AuthScope.ANY); } this.setBackendTimeout(backendTimeout); - setConnectionConfig( - RequestConfig.custom() - .setCookieSpec(CookieSpecs.DEFAULT) - .setExpectContinueEnabled(true) - .setSocketTimeout(backendTimeoutMillis) - .setConnectTimeout(backendTimeoutMillis) - .setRedirectsEnabled(true) - .build()); + setConnectionConfig(RequestConfig.custom() + .setCookieSpec(CookieSpecs.DEFAULT) + .setExpectContinueEnabled(true) + .setSocketTimeout(backendTimeoutMillis) + .setConnectTimeout(backendTimeoutMillis) + .setRedirectsEnabled(true) + .build()); clientBuilder = org.apache.http.impl.client.HttpClientBuilder.create(); clientBuilder.useSystemProperties(); @@ -128,10 +119,7 @@ public HttpClient buildClient() { return httpClient; } - /** - * returns true if this builder was configured to pass HTTP credentials to the generated - * HttpClient. - */ + /** returns true if this builder was configured to pass HTTP credentials to the generated HttpClient. */ public boolean isDoAuthentication() { return doAuthentication; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/IOUtils.java b/geowebcache/core/src/main/java/org/geowebcache/util/IOUtils.java index adff898e40..bea7d6eb38 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/IOUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/IOUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime - GeoSolutions 2019 */ @@ -21,8 +20,8 @@ public class IOUtils { /** - * A replacement for commons-io closeQuietly, for those rare cases in which the quiet closing - * behavior is actually needed and try-with-resources won't do the expected job + * A replacement for commons-io closeQuietly, for those rare cases in which the quiet closing behavior is actually + * needed and try-with-resources won't do the expected job */ public static void closeQuietly(Closeable clo) { if (clo != null) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/LoggingContextListener.java b/geowebcache/core/src/main/java/org/geowebcache/util/LoggingContextListener.java index ce4d4bde74..74e35d37a7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/LoggingContextListener.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/LoggingContextListener.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Jody Garnett - GeoCat 2022 */ @@ -146,9 +145,8 @@ public void contextDestroyed(ServletContextEvent sce) { /** * Looks up property from system property, context parameter, or value variable. * - *

    This is a light-weight search following the same precedence as {@link - * GWCVars#findEnvVar(ApplicationContext, String)} variable lookup: system properties, servlet - * init parameters, environmental variables. + *

    This is a light-weight search following the same precedence as {@link GWCVars#findEnvVar(ApplicationContext, + * String)} variable lookup: system properties, servlet init parameters, environmental variables. * * @param context Web context * @param name Property name @@ -161,9 +159,8 @@ public static String getProperty(ServletContext context, String name) { /** * Looks up property from system property, context parameter, or value variable. * - *

    This is a light-weight search following the same precedence as {@link - * GWCVars#findEnvVar(ApplicationContext, String)} variable lookup: system properties, servlet - * init parameters, environmental variables. + *

    This is a light-weight search following the same precedence as {@link GWCVars#findEnvVar(ApplicationContext, + * String)} variable lookup: system properties, servlet init parameters, environmental variables. * * @param context Web context * @param name Property name @@ -196,8 +193,7 @@ public static String getProperty(ServletContext context, String name, String def } /** - * Mirror workflow of {@code LoggingManager.readConfiguration()} to determine java util logging - * configuration. + * Mirror workflow of {@code LoggingManager.readConfiguration()} to determine java util logging configuration. * * @return java util logging configuration */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/NullURLMangler.java b/geowebcache/core/src/main/java/org/geowebcache/util/NullURLMangler.java index b7d439bd44..6d6b98eba7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/NullURLMangler.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/NullURLMangler.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ @@ -27,11 +26,7 @@ public String buildURL(String baseURL, String contextPath, String path) { if (context == null || context.isEmpty()) { return StringUtils.strip(baseURL, "/") + "/" + StringUtils.strip(path, "/"); } else { - return StringUtils.strip(baseURL, "/") - + "/" - + context - + "/" - + StringUtils.strip(path, "/"); + return StringUtils.strip(baseURL, "/") + "/" + context + "/" + StringUtils.strip(path, "/"); } } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/ResponseUtils.java b/geowebcache/core/src/main/java/org/geowebcache/util/ResponseUtils.java index 5a1a7dc14c..5c3a0911a6 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/ResponseUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/ResponseUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Sandro Salari, GeoSolutions S.A.S., Copyright 2017 */ @@ -51,8 +50,8 @@ import org.springframework.http.MediaType; /** - * Utility methods that can be used to write a string as http response
    The response can be a - * valid one or contains an error status code
    The HTTP response can be rendered as HTML or XML + * Utility methods that can be used to write a string as http response
    The response can be a valid one or contains + * an error status code
    The HTTP response can be rendered as HTML or XML * * @author sandr */ @@ -63,9 +62,8 @@ public final class ResponseUtils { private ResponseUtils() {} /** - * Helper method that will get a tile from the target service that correspond to the conveyor - * data. Security permissions will be checked and the tile will be directly wrote to the output - * stream. + * Helper method that will get a tile from the target service that correspond to the conveyor data. Security + * permissions will be checked and the tile will be directly wrote to the output stream. * * @param secDispatcher security dispatcher * @param conv tile request information @@ -176,8 +174,7 @@ private static void writeData(ConveyorTile tile, RuntimeStats runtimeStats) thro } int contentLength = (int) (blob == null ? -1 : blob.getSize()); - writeFixedResponse( - servletResp, httpCode, mimeType, blob, cacheResult, contentLength, runtimeStats); + writeFixedResponse(servletResp, httpCode, mimeType, blob, cacheResult, contentLength, runtimeStats); } private static void writeEmpty( @@ -206,24 +203,12 @@ private static void writeEmpty( // handle no-content in case we have to return no result at all (e.g., expected for pbf) int status = emptyTileContents == null ? 204 : 200; - writeFixedResponse( - tile.servletResp, - status, - mimeType, - emptyTileContents, - CacheResult.OTHER, - runtimeStats); + writeFixedResponse(tile.servletResp, status, mimeType, emptyTileContents, CacheResult.OTHER, runtimeStats); } - /** - * Writes a transparent, 8 bit PNG to avoid having clients like OpenLayers showing lots of pink - * tiles - */ + /** Writes a transparent, 8 bit PNG to avoid having clients like OpenLayers showing lots of pink tiles */ private static void writeEmpty( - DefaultStorageFinder defaultStorageFinder, - ConveyorTile tile, - String message, - RuntimeStats runtimeStats) { + DefaultStorageFinder defaultStorageFinder, ConveyorTile tile, String message, RuntimeStats runtimeStats) { writeEmpty( defaultStorageFinder, tile, @@ -252,13 +237,11 @@ public static void writeFixedResponse( RuntimeStats runtimeStats) { int contentLength = (int) (resource == null ? -1 : resource.getSize()); - writeFixedResponse( - response, httpCode, contentType, resource, cacheRes, contentLength, runtimeStats); + writeFixedResponse(response, httpCode, contentType, resource, cacheRes, contentLength, runtimeStats); } /** - * Helper method that writes an HTTP response setting the provided HTTP code. Using the provided - * content length. + * Helper method that writes an HTTP response setting the provided HTTP code. Using the provided content length. * * @param response HTTP response * @param httpCode HTTP status code @@ -295,8 +278,7 @@ public static void writeFixedResponse( private static ByteArrayResource loadBlankTile(DefaultStorageFinder defaultStorageFinder) { ByteArrayResource blankTile = null; - String blankTilePath = - defaultStorageFinder.findEnvVar(DefaultStorageFinder.GWC_BLANK_TILE_PATH); + String blankTilePath = defaultStorageFinder.findEnvVar(DefaultStorageFinder.GWC_BLANK_TILE_PATH); if (blankTilePath != null) { File fh = new File(blankTilePath); @@ -353,28 +335,24 @@ private static void loadBlankTile(Resource blankTile, URL source) throws IOExcep * @param errorMsg the actual error message, human readable */ public static void writeErrorPage( - HttpServletResponse response, - int httpCode, - String errorMsg, - RuntimeStats runtimeStats) { + HttpServletResponse response, int httpCode, String errorMsg, RuntimeStats runtimeStats) { log.fine(errorMsg); - errorMsg = - "\n" - + ServletUtils.gwcHtmlHeader("../", "GWC Error") - + "\n" - + ServletUtils.gwcHtmlLogoLink("../") - + "

    " - + httpCode - + ": " - + ServletUtils.disableHTMLTags(errorMsg) - + "

    " - + "\n"; + errorMsg = "\n" + + ServletUtils.gwcHtmlHeader("../", "GWC Error") + + "\n" + + ServletUtils.gwcHtmlLogoLink("../") + + "

    " + + httpCode + + ": " + + ServletUtils.disableHTMLTags(errorMsg) + + "

    " + + "\n"; writePage(response, httpCode, errorMsg, runtimeStats, MediaType.TEXT_HTML_VALUE); } /** - * Writes an HTTP response setting as it content the provided exception message encoded in XML. - * The original error is also logged. + * Writes an HTTP response setting as it content the provided exception message encoded in XML. The original error + * is also logged. * * @param response HTTP response * @param httpCode HTTP status code @@ -382,17 +360,13 @@ public static void writeErrorPage( * @param runtimeStats runtime statistics */ public static void writeErrorAsXML( - HttpServletResponse response, - int httpCode, - String errorMsg, - RuntimeStats runtimeStats) { + HttpServletResponse response, int httpCode, String errorMsg, RuntimeStats runtimeStats) { log.fine(errorMsg); writePage(response, httpCode, errorMsg, runtimeStats, MediaType.APPLICATION_XML_VALUE); } /** - * Writes an HTTP response setting as it content the provided message and using the provided - * content type. + * Writes an HTTP response setting as it content the provided message and using the provided content type. * * @param response HTTP response * @param httpCode HTTP status code @@ -401,16 +375,11 @@ public static void writeErrorAsXML( * @param contentType HTTP response content type */ public static void writePage( - HttpServletResponse response, - int httpCode, - String message, - RuntimeStats runtimeStats, - String contentType) { + HttpServletResponse response, int httpCode, String message, RuntimeStats runtimeStats, String contentType) { Resource res = null; if (message != null) { res = new ByteArrayResource(message.getBytes()); } - ResponseUtils.writeFixedResponse( - response, httpCode, contentType, res, CacheResult.OTHER, runtimeStats); + ResponseUtils.writeFixedResponse(response, httpCode, contentType, res, CacheResult.OTHER, runtimeStats); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/ServletUtils.java b/geowebcache/core/src/main/java/org/geowebcache/util/ServletUtils.java index 9a463e6658..54b9a3555b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/ServletUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/ServletUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -36,8 +35,7 @@ import org.geotools.util.logging.Logging; public class ServletUtils { - private static Logger log = - Logging.getLogger(org.geowebcache.util.ServletUtils.class.toString()); + private static Logger log = Logging.getLogger(org.geowebcache.util.ServletUtils.class.toString()); // Calendar objects are unfortunately expensive and not thread safe :( private static Calendar calendar = new GregorianCalendar(); @@ -81,8 +79,7 @@ public static String stringFromMap(Map map, String encoding, S } /** Case insensitive lookup for a couple of strings, drops everything else */ - public static String[][] selectedStringArraysFromMap( - Map map, String encoding, String[] keys) { + public static String[][] selectedStringArraysFromMap(Map map, String encoding, String[] keys) { String[][] retAr = new String[keys.length][]; Iterator> iter = map.entrySet().iterator(); @@ -104,20 +101,17 @@ public static String[][] selectedStringArraysFromMap( /** * Case insensitive lookup for a couple of strings, drops everything else * - * @return map subset containing (URL decoded) values for {@code keys}, with keys normalized to - * upper case + * @return map subset containing (URL decoded) values for {@code keys}, with keys normalized to upper case */ @SuppressWarnings("unchecked") - public static Map selectedStringsFromMap( - Map map, String encoding, String... keys) { + public static Map selectedStringsFromMap(Map map, String encoding, String... keys) { map = new CaseInsensitiveMap<>(map); Map selected = new CaseInsensitiveMap<>(); for (String key : keys) { Object value = map.get(key); if (value != null) { - String sValue = - value instanceof String[] ? ((String[]) value)[0] : String.valueOf(value); + String sValue = value instanceof String[] ? ((String[]) value)[0] : String.valueOf(value); selected.put(key.toUpperCase(), URLDecode(sValue, encoding)); } } @@ -156,13 +150,12 @@ public static Map selectedStringsFromMap( * @param tmpBufferSize how many bytes to read at a time, -1 = 1024 * @return a compacted buffer with all the data */ - public static byte[] readStream(InputStream is, int bufferHint, int tmpBufferSize) - throws IOException { + public static byte[] readStream(InputStream is, int bufferHint, int tmpBufferSize) throws IOException { return readStream(is, bufferHint, tmpBufferSize, true); } - public static byte[] readStream( - InputStream is, int bufferHint, int tmpBufferSize, boolean close) throws IOException { + public static byte[] readStream(InputStream is, int bufferHint, int tmpBufferSize, boolean close) + throws IOException { byte[] buffer = null; if (bufferHint > 0) { buffer = new byte[bufferHint]; @@ -220,8 +213,7 @@ public static String formatTimestamp(long timestamp) { String ret; synchronized (calendar) { if (ServletUtils.format == null) { - ServletUtils.format = - new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + ServletUtils.format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); ServletUtils.format.setTimeZone(ServletUtils.timeZone); } @@ -241,8 +233,7 @@ public static long parseExpiresHeader(String expiresHeader) { synchronized (calendar) { if (ServletUtils.format == null) { - ServletUtils.format = - new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + ServletUtils.format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); ServletUtils.format.setTimeZone(ServletUtils.timeZone); } @@ -365,10 +356,7 @@ public static String gwcHtmlHeader(String relBasePath, String pageTitle, String .append(relBasePath) .append("rest/web/gwc.css\" type=\"text/css\"/>\n"); if (jsFile != null) { - builder.append("\n"); + builder.append("\n"); } builder.append("\n"); return builder.toString(); @@ -378,9 +366,7 @@ public static String gwcHtmlLogoLink(String relBasePath) { StringBuilder builder = new StringBuilder(); builder.append("

    \n"); return builder.toString(); @@ -443,8 +429,7 @@ public static String getServletBaseURL(HttpServletRequest req, String servletPre } /** Generate the context path of the request, less the specified trailing path */ - public static String getServletContextPath( - HttpServletRequest req, String trailingPath, String servletPrefix) { + public static String getServletContextPath(HttpServletRequest req, String trailingPath, String servletPrefix) { String reqUrl = req.getRequestURL().toString(); String servletBase = ServletUtils.getServletBaseURL(req, servletPrefix); int prefixIdx = servletBase.length(); @@ -457,8 +442,7 @@ public static String getServletContextPath( } /** Generate the context path of the request, try the specified trailing path */ - public static String getServletContextPath( - HttpServletRequest req, String[] trailingPaths, String servletPrefix) { + public static String getServletContextPath(HttpServletRequest req, String[] trailingPaths, String servletPrefix) { String context = ""; for (String trailingPath : trailingPaths) { context = getServletContextPath(req, trailingPath, servletPrefix); diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/Sleeper.java b/geowebcache/core/src/main/java/org/geowebcache/util/Sleeper.java index c2dc7e0b7a..fb7d318cea 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/Sleeper.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/Sleeper.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, Copyright 2017 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/SuppressFBWarnings.java b/geowebcache/core/src/main/java/org/geowebcache/util/SuppressFBWarnings.java index 47786410f8..397b79fccf 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/SuppressFBWarnings.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/SuppressFBWarnings.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime / GeoSolutions 2019 */ @@ -18,14 +17,13 @@ import java.lang.annotation.RetentionPolicy; /** - * Allows to suppress SpotBugs/FindBugs warnings without depending on external jars, the tools match - * by annotatin name + * Allows to suppress SpotBugs/FindBugs warnings without depending on external jars, the tools match by annotatin name */ @Retention(RetentionPolicy.CLASS) public @interface SuppressFBWarnings { /** - * The set of FindBugs warnings that are to be suppressed in annotated element. The value can be - * a bug category, kind or pattern. + * The set of FindBugs warnings that are to be suppressed in annotated element. The value can be a bug category, + * kind or pattern. */ String[] value() default {}; diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/TMSKeyBuilder.java b/geowebcache/core/src/main/java/org/geowebcache/util/TMSKeyBuilder.java index c7b1f81f91..5364400c57 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/TMSKeyBuilder.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/TMSKeyBuilder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2019 */ @@ -77,9 +76,7 @@ public Set layerFormats(String layerName) { } catch (GeoWebCacheException e) { throw new RuntimeException(e); } - return layer.getMimeTypes().stream() - .map(MimeType::getFileExtension) - .collect(Collectors.toSet()); + return layer.getMimeTypes().stream().map(MimeType::getFileExtension).collect(Collectors.toSet()); } public String forTile(TileObject obj) { @@ -117,17 +114,7 @@ public String forTile(TileObject obj) { // Key format, comprised of // {@code ///////.} - String key = - join( - false, - prefix, - layer, - gridset, - shortFormat, - parametersId, - z, - x, - y + "." + extension); + String key = join(false, prefix, layer, gridset, shortFormat, parametersId, z, x, y + "." + extension); return key; } @@ -181,9 +168,7 @@ public String parametersMetadata(final String layerName, final String parameters false, prefix, layerId, - PARAMETERS_METADATA_OBJECT_PREFIX - + parametersId - + PARAMETERS_METADATA_OBJECT_SUFFIX); + PARAMETERS_METADATA_OBJECT_PREFIX + parametersId + PARAMETERS_METADATA_OBJECT_SUFFIX); } public String parametersMetadataPrefix(final String layerName) { @@ -192,8 +177,7 @@ public String parametersMetadataPrefix(final String layerName) { } /** - * @return the key prefix up to the coordinates (i.e. {@code - * "////"}) + * @return the key prefix up to the coordinates (i.e. {@code "////"}) */ public String coordinatesPrefix(TileRange obj, boolean endWithSlash) { checkNotNull(obj.getLayerName()); diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/URLMangler.java b/geowebcache/core/src/main/java/org/geowebcache/util/URLMangler.java index 271eecbf3b..8739b83921 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/URLMangler.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/URLMangler.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Robert Marianski, OpenGeo, 20012 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/util/URLs.java b/geowebcache/core/src/main/java/org/geowebcache/util/URLs.java index ba63849488..163c3dafb4 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/util/URLs.java +++ b/geowebcache/core/src/main/java/org/geowebcache/util/URLs.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Gabriel Roldan, Camptocamp, Copyright 2023 */ @@ -33,14 +32,14 @@ private URLs() { * href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/net/URL.html#constructor-deprecation">deprecated * in Java 21. * - *

    Note a {@link URISyntaxException} will be rethrown as {@link MalformedURLException} to - * preserve the behavior of code that used to call {@code new URL(String)} and expected either a - * {@code MalformedURLException} or its super type {@code java.io.IOException}. + *

    Note a {@link URISyntaxException} will be rethrown as {@link MalformedURLException} to preserve the behavior + * of code that used to call {@code new URL(String)} and expected either a {@code MalformedURLException} or its + * super type {@code java.io.IOException}. * * @param url a URL string to build a {@link URL} from * @return the URL built from the argument - * @throws MalformedURLException if {code}url{code} is not a valid {@link URI} nor a valid - * {@link URL} as per {@link URI#toURL()} + * @throws MalformedURLException if {code}url{code} is not a valid {@link URI} nor a valid {@link URL} as per + * {@link URI#toURL()} */ public static URL of(String url) throws MalformedURLException { try { diff --git a/geowebcache/core/src/test/java/org/geowebcache/DemoTest.java b/geowebcache/core/src/test/java/org/geowebcache/DemoTest.java index c5d6dde10c..a4b33c6cb1 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/DemoTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/DemoTest.java @@ -47,23 +47,11 @@ public void testAdvertised() throws GeoWebCacheException, IOException { // Creating an advertised Layer and an unadvertised one HashMap subSets = new HashMap<>(); TileLayer advertisedLayer = - new WMSLayer( - "testAdv", null, null, null, null, subSets, null, null, null, false, null); + new WMSLayer("testAdv", null, null, null, null, subSets, null, null, null, false, null); advertisedLayer.setEnabled(true); advertisedLayer.setAdvertised(true); TileLayer unAdvertisedLayer = - new WMSLayer( - "testNotAdv", - null, - null, - null, - null, - subSets, - null, - null, - null, - false, - null); + new WMSLayer("testNotAdv", null, null, null, null, subSets, null, null, null, false, null); unAdvertisedLayer.setEnabled(true); unAdvertisedLayer.setAdvertised(false); @@ -115,8 +103,7 @@ public void testEscapingWithoutLayer() throws Exception { when(layer.getGridSubsets()).thenReturn(gridSubsets); when(layer.getGridSubset(epsg4326)).thenReturn(subSet2); when(layer.getGridSubset(unescapedSubset)).thenReturn(subSet1); - when(layer.getMimeTypes()) - .thenReturn(Collections.singletonList(MimeType.createFromFormat("image/png"))); + when(layer.getMimeTypes()).thenReturn(Collections.singletonList(MimeType.createFromFormat("image/png"))); TileLayerDispatcher tld = mock(TileLayerDispatcher.class); when(tld.getLayerNames()).thenReturn(Collections.singleton(unescapedLayer)); @@ -217,8 +204,7 @@ public void testRemovedInlineJavaScript() throws Exception { Demo.makeMap(tld, null, "layer", new MockHttpServletRequest(), response); String result = response.getContentAsString(); - assertThat( - result, containsString("")); + assertThat(result, containsString("")); assertThat(result, containsString("")); assertThat(result, not(containsString("

").append(gridSetName); buf.append("OpenLayers: ["); - buf.append( - layer.getMimeTypes().stream() - .filter(type -> type.supportsTiling() || type.isVector()) - .map( - type -> - generateDemoUrl( - escapedLayerName, - escapeHtml4(gridSubset.getName()), - type)) - .collect(Collectors.joining(", "))); + buf.append(layer.getMimeTypes().stream() + .filter(type -> type.supportsTiling() || type.isVector()) + .map(type -> generateDemoUrl(escapedLayerName, escapeHtml4(gridSubset.getName()), type)) + .collect(Collectors.joining(", "))); buf.append("]\n"); @@ -236,29 +220,19 @@ private static void outputKMLSupport(StringBuffer buf, TileLayer layer) { buf.append("   KML: ["); String prefix = ""; - buf.append( - layer.getMimeTypes().stream() - .filter( - type -> - type instanceof ImageMime - || type == XMLMime.kml - || type == XMLMime.kmz) - .map( - type -> { - if (type == XMLMime.kmz) { - return String.format( - "kmz", - prefix, escapeHtml4(layer.getName())); - } else { - return String.format( - "%s", - prefix, - escapeHtml4(layer.getName()), - type.getFileExtension(), - type.getFileExtension()); - } - }) - .collect(Collectors.joining(", "))); + buf.append(layer.getMimeTypes().stream() + .filter(type -> type instanceof ImageMime || type == XMLMime.kml || type == XMLMime.kmz) + .map(type -> { + if (type == XMLMime.kmz) { + return String.format( + "kmz", prefix, escapeHtml4(layer.getName())); + } else { + return String.format( + "%s", + prefix, escapeHtml4(layer.getName()), type.getFileExtension(), type.getFileExtension()); + } + }) + .collect(Collectors.joining(", "))); buf.append("]"); } @@ -300,24 +274,21 @@ private static String generateHTML(TileLayer layer, String gridSetStr, String fo buf.append(" ").append(escapeHtml4(gridSubset.getName())); buf.append(" ").append(escapeHtml4(formatStr)); buf.append("\n"); - buf.append( - "\n"); + buf.append("\n"); buf.append("\n"); - buf.append("\n"); + buf.append("\n"); buf.append("\n"); buf.append("\n" + "\n"); buf.append("
") @@ -325,14 +296,13 @@ private static String generateHTML(TileLayer layer, String gridSetStr, String fo .append("
\n"); buf.append("
\n" + "
\n"); - buf.append( - "
\n" - + "
\n" - + " Attributes\n" - + " \n" - + "
\n" - + "
\n" - + "
"); + buf.append("
\n" + + "
\n" + + " Attributes\n" + + " \n" + + "
\n" + + "
\n" + + "
"); // add parameters in hidden inputs makeHiddenInput(buf, "dpi", Double.toString(gridSubset.getDotsPerInch())); @@ -346,9 +316,7 @@ private static String generateHTML(TileLayer layer, String gridSetStr, String fo makeHiddenInput( buf, "gridNamesNumeric", - String.valueOf( - Arrays.stream(gridSubset.getGridNames()) - .allMatch(n -> StringUtils.isNumeric(n)))); + String.valueOf(Arrays.stream(gridSubset.getGridNames()).allMatch(n -> StringUtils.isNumeric(n)))); makeHiddenInput(buf, "format", formatStr); makeHiddenInput(buf, "layerName", layerName); makeHiddenInput(buf, "SRS", gridSubset.getSRS().toString()); @@ -360,8 +328,7 @@ private static String generateHTML(TileLayer layer, String gridSetStr, String fo } else if (doubleEquals(mpu, 0.3048)) { unit = "ft"; // Use the average of equatorial and polar radius, and a large margin of error - } else if (doubleEquals( - mpu, Math.PI * (6378137 + 6356752) / 360, Math.PI * (6378137 - 6356752) / 360)) { + } else if (doubleEquals(mpu, Math.PI * (6378137 + 6356752) / 360, Math.PI * (6378137 - 6356752) / 360)) { unit = "degrees"; } makeHiddenInput(buf, "unit", unit); @@ -465,8 +432,7 @@ private static String makeModifiableParameters(TileLayer tl) { return doc.toString(); } - private static Map makeParametersMap( - String defaultValue, List legalValues) { + private static Map makeParametersMap(String defaultValue, List legalValues) { Map map = new TreeMap<>(); for (String s : legalValues) { map.put(s, s); @@ -483,8 +449,7 @@ private static void makeHiddenInput(StringBuilder doc, String id, String value) .append("\" />\n"); } - private static void makePullDown( - StringBuilder doc, String id, Map keysValues, String defaultKey) { + private static void makePullDown(StringBuilder doc, String id, Map keysValues, String defaultKey) { doc.append("\n"); + doc.append("\n"); } private static boolean doubleEquals(double d1, double d2) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizer.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizer.java index 1d2eb7171d..fc9777a503 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizer.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, Copyright 2015 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizingParameterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizingParameterFilter.java index d6c54e8d0b..c7b0899918 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizingParameterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/CaseNormalizingParameterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -85,10 +84,6 @@ public boolean equals(Object obj) { @Override public String toString() { - return "CaseNormalizingParameterFilter [normalize=" - + normalize - + ", " - + super.toString() - + "]"; + return "CaseNormalizingParameterFilter [normalize=" + normalize + ", " + super.toString() + "]"; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/FloatParameterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/FloatParameterFilter.java index 0d6ae90bb0..9eacb671cc 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/FloatParameterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/FloatParameterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -62,8 +61,8 @@ protected Float getDefaultThreshold() { } /** - * @return the values the parameter can take. Altering this list is deprecated and in future it - * will be unmodifiable; use {@link #setValues(List)} instead. + * @return the values the parameter can take. Altering this list is deprecated and in future it will be + * unmodifiable; use {@link #setValues(List)} instead. */ public List getValues() { // TODO: apply Collections.unmodifiableList(...) @@ -122,15 +121,14 @@ public String apply(@Nullable String str) throws ParameterException { return Float.toString(best); } - throw new ParameterException( - "Closest match for " - + super.getKey() - + "=" - + str - + " is " - + best - + ", but this exceeds the threshold of " - + threshold); + throw new ParameterException("Closest match for " + + super.getKey() + + "=" + + str + + " is " + + best + + ", but this exceeds the threshold of " + + threshold); } @Override @@ -180,12 +178,6 @@ public boolean equals(Object obj) { @Override public String toString() { - return "FloatParameterFilter [values=" - + values - + ", threshold=" - + threshold - + ", " - + super.toString() - + "]"; + return "FloatParameterFilter [values=" + values + ", threshold=" + threshold + ", " + super.toString() + "]"; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/IntegerParameterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/IntegerParameterFilter.java index 6d5d31ec35..442cb0a1d3 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/IntegerParameterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/IntegerParameterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, Copyright 2015 *

Based on FloatParameterFilter: Arne Kepp, The Open Planning Project, Copyright 2009 @@ -62,8 +61,8 @@ protected Integer getDefaultThreshold() { } /** - * @return the values the parameter can take. Altering this list is deprecated and in future it - * will be unmodifiable; use {@link #setValues(List)} instead. + * @return the values the parameter can take. Altering this list is deprecated and in future it will be + * unmodifiable; use {@link #setValues(List)} instead. */ public List getValues() { // TODO: apply Collections.unmodifiableList(...) @@ -122,15 +121,14 @@ public String apply(@Nullable String str) throws ParameterException { return Integer.toString(best); } - throw new ParameterException( - "Closest match for " - + super.getKey() - + "=" - + str - + " is " - + best - + ", but this exceeds the threshold of " - + threshold); + throw new ParameterException("Closest match for " + + super.getKey() + + "=" + + str + + " is " + + best + + ", but this exceeds the threshold of " + + threshold); } @Override @@ -180,12 +178,6 @@ public boolean equals(Object obj) { @Override public String toString() { - return "IntegerParameterFilter [values=" - + values - + ", threshold=" - + threshold - + ", " - + super.toString() - + "]"; + return "IntegerParameterFilter [values=" + values + ", threshold=" + threshold + ", " + super.toString() + "]"; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterException.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterException.java index f69ce9dcfe..e00bd271b1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterFilter.java index 0de53ce45e..7282cf3dab 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParameterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -73,12 +72,11 @@ public ParameterFilter clone() { /** * Checks whether a given parameter value applies to this filter. * - *

Calls {@link #apply(String)} and checks for {@link ParameterException}. Subclasses should - * override if a more efficient check is available. + *

Calls {@link #apply(String)} and checks for {@link ParameterException}. Subclasses should override if a more + * efficient check is available. * * @param parameterValue the value to check if applies to this parameter filter - * @return {@code true} if {@code parameterValue} is valid according to this filter, {@code - * false} otherwise + * @return {@code true} if {@code parameterValue} is valid according to this filter, {@code false} otherwise */ public boolean applies(@Nullable String parameterValue) { try { @@ -92,11 +90,9 @@ public boolean applies(@Nullable String parameterValue) { /** * Apply the filter to the specified parameter value. * - * @param str the value of the parameter to filter. {@literal null} if the parameter was - * unspecified. + * @param str the value of the parameter to filter. {@literal null} if the parameter was unspecified. * @return one of the legal values - * @throws ParameterException if the parameter value could not be reduced to one of the legal - * values. + * @throws ParameterException if the parameter value could not be reduced to one of the legal values. */ public abstract String apply(@Nullable String str) throws ParameterException; @@ -111,8 +107,7 @@ public boolean applies(@Nullable String parameterValue) { public void setKey(String key) { Preconditions.checkNotNull(key); Preconditions.checkArgument(!key.isEmpty(), "ParameterFilter key must be non-empty"); - Preconditions.checkState( - this.key == null, "The key for this ParameterFilter has already been set"); + Preconditions.checkState(this.key == null, "The key for this ParameterFilter has already been set"); this.key = key; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParametersUtils.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParametersUtils.java index 4a23d9a4df..e1d7035374 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParametersUtils.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/ParametersUtils.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -32,9 +31,8 @@ public class ParametersUtils { /** - * This should be treated as an opaque Identifier and should not be parsed, it is used to to - * maintain compatibility with old caches. For any other uses, {@link #getKvp(Map)} is preferred - * as it uses safe escaping of values. + * This should be treated as an opaque Identifier and should not be parsed, it is used to to maintain compatibility + * with old caches. For any other uses, {@link #getKvp(Map)} is preferred as it uses safe escaping of values. */ public static String getLegacyParametersKvp(Map parameters) { StringBuilder sb = new StringBuilder(); @@ -92,8 +90,7 @@ public static String getKvp(Map parameters) { /** * Turns the a sorted KVP string into a parameter map. * - *

This should only be used for parsing strings created by {@link #getKvp(Map)} not for - * parsing raw query strings + *

This should only be used for parsing strings created by {@link #getKvp(Map)} not for parsing raw query strings */ public static Map getMap(String kvp) { return Arrays.stream(kvp.split("&")) diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/RegexParameterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/RegexParameterFilter.java index 7601e9ff35..7180b45553 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/RegexParameterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/RegexParameterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -83,8 +82,7 @@ public String apply(String str) throws ParameterException { * Checks whether a given parameter value applies to this filter. * * @param parameterValue the value to check if applies to this parameter filter - * @return {@code true} if {@code parameterValue} is valid according to this filter, {@code - * false} otherwise + * @return {@code true} if {@code parameterValue} is valid according to this filter, {@code false} otherwise */ @Override public boolean applies(@Nullable String parameterValue) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/StringParameterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/StringParameterFilter.java index cc5286f6c8..ea09a0f75f 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/StringParameterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/parameters/StringParameterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -79,8 +78,7 @@ public void setValues(List values) { * Checks whether a given parameter value applies to this filter. * * @param parameterValue the value to check if applies to this parameter filter - * @return {@code true} if {@code parameterValue} is valid according to this filter, {@code - * false} otherwise + * @return {@code true} if {@code parameterValue} is valid according to this filter, {@code false} otherwise */ @Override public boolean applies(@Nullable String parameterValue) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/BlankTileException.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/BlankTileException.java index 23d8160d7e..b5ff467880 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/BlankTileException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/BlankTileException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/CircularExtentFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/CircularExtentFilter.java index 8a2cdc46d1..40a20fa5b4 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/CircularExtentFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/CircularExtentFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -74,14 +73,12 @@ public void initialize(TileLayer layer) throws GeoWebCacheException { } @Override - public void update(TileLayer layer, String gridSetId, int zoomStart, int zoomStop) - throws GeoWebCacheException { + public void update(TileLayer layer, String gridSetId, int zoomStart, int zoomStop) throws GeoWebCacheException { // Do nothing } @Override - public void update(byte[] filterData, TileLayer layer, String gridSetId, int z) - throws GeoWebCacheException { + public void update(byte[] filterData, TileLayer layer, String gridSetId, int z) throws GeoWebCacheException { // Do nothing } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/FileRasterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/FileRasterFilter.java index fc874f61f5..e3872af5c1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/FileRasterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/FileRasterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -56,8 +55,7 @@ protected BufferedImage loadMatrix(TileLayer layer, String gridSetId, int zoomLe File fh = new File(createFilePath(gridSetId, zoomLevel)); if (!fh.exists() || !fh.canRead()) { - throw new GeoWebCacheException( - fh.getAbsolutePath() + " does not exist or is not readable"); + throw new GeoWebCacheException(fh.getAbsolutePath() + " does not exist or is not readable"); } BufferedImage img = ImageIO.read(fh); @@ -65,16 +63,15 @@ protected BufferedImage loadMatrix(TileLayer layer, String gridSetId, int zoomLe int[] widthHeight = calculateWidthHeight(layer.getGridSubset(gridSetId), zoomLevel); if (img.getWidth() != widthHeight[0] || img.getHeight() != widthHeight[1]) { - String msg = - fh.getAbsolutePath() - + " has dimensions " - + img.getWidth() - + "," - + img.getHeight() - + ", expected " - + widthHeight[0] - + "," - + widthHeight[1]; + String msg = fh.getAbsolutePath() + + " has dimensions " + + img.getWidth() + + "," + + img.getHeight() + + ", expected " + + widthHeight[0] + + "," + + widthHeight[1]; throw new GeoWebCacheException(msg); } @@ -83,21 +80,12 @@ protected BufferedImage loadMatrix(TileLayer layer, String gridSetId, int zoomLe private String createFilePath(String gridSetId, int zoomLevel) { String path = - storagePath - + File.separator - + this.getName() - + "_" - + gridSetId - + "_" - + zoomLevel - + "." - + fileExtension; + storagePath + File.separator + this.getName() + "_" + gridSetId + "_" + zoomLevel + "." + fileExtension; return path; } - public void saveMatrix(byte[] data, TileLayer layer, String gridSetId, int zoomLevel) - throws IOException { + public void saveMatrix(byte[] data, TileLayer layer, String gridSetId, int zoomLevel) throws IOException { // Persist File fh = new File(createFilePath(gridSetId, zoomLevel)); try (FileOutputStream fos = new FileOutputStream(fh)) { @@ -106,31 +94,25 @@ public void saveMatrix(byte[] data, TileLayer layer, String gridSetId, int zoomL } @Override - public void update(byte[] filterData, TileLayer layer, String gridSetId, int z) - throws GeoWebCacheException { + public void update(byte[] filterData, TileLayer layer, String gridSetId, int z) throws GeoWebCacheException { try { saveMatrix(filterData, layer, gridSetId, z); } catch (IOException e) { throw new GeoWebCacheException( - this.getName() - + " encountered an error while persisting matrix, " - + e.getMessage()); + this.getName() + " encountered an error while persisting matrix, " + e.getMessage()); } try { super.setMatrix(layer, gridSetId, z, true); } catch (IOException e) { throw new GeoWebCacheException( - this.getName() - + " encountered an error while loading matrix, " - + e.getMessage()); + this.getName() + " encountered an error while loading matrix, " + e.getMessage()); } } @Override - public void update(TileLayer layer, String gridSetId, int zoomStart, int zoomStop) - throws GeoWebCacheException { + public void update(TileLayer layer, String gridSetId, int zoomStart, int zoomStop) throws GeoWebCacheException { throw new GeoWebCacheException( "TileLayer layer, String gridSetId, int z) is not appropriate for FileRasterFilters"); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/GreenTileException.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/GreenTileException.java index c8c6966bcf..5ff4500559 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/GreenTileException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/GreenTileException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/RasterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/RasterFilter.java index 4f0b047395..908623f4f1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/RasterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/RasterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -28,14 +27,13 @@ import org.geowebcache.layer.TileLayer; /** - * A raster filter allows to optimize data loading by avoiding the generation of requests and the - * caching of empty tiles for tiles that are inside the definition area of the layer but that are - * known (via external information) to contain no data + * A raster filter allows to optimize data loading by avoiding the generation of requests and the caching of empty tiles + * for tiles that are inside the definition area of the layer but that are known (via external information) to contain + * no data * *

To conserve memory, the layer bounds are used. * - *

The raster must match the dimensions of the zoomlevel and use 0x000000 for tiles that are - * valid. + *

The raster must match the dimensions of the zoomlevel and use 0x000000 for tiles that are valid. */ public abstract class RasterFilter extends RequestFilter { @@ -149,9 +147,7 @@ public void apply(ConveyorTile convTile) throws RequestFilterException { idx[2] = zoomStop; } - if (matrices == null - || matrices.get(gridSetId) == null - || matrices.get(gridSetId)[(int) idx[2]] == null) { + if (matrices == null || matrices.get(gridSetId) == null || matrices.get(gridSetId)[(int) idx[2]] == null) { try { setMatrix(convTile.getLayer(), gridSetId, (int) idx[2], false); } catch (Exception e) { @@ -166,11 +162,7 @@ public void apply(ConveyorTile convTile) throws RequestFilterException { + " : " + e.getMessage()); throw new RequestFilterException( - this, - 500, - "Failed while trying to load filter for " - + idx[2] - + ", please check the logs"); + this, 500, "Failed while trying to load filter for " + idx[2] + ", please check the logs"); } } @@ -242,8 +234,8 @@ private boolean lookup(GridSubset grid, long[] idx) { } /** - * Performs a lookup against an internal raster. The sampling is actually done against 4 pixels, - * idx should already have been modified to use one level higher than strictly necessary. + * Performs a lookup against an internal raster. The sampling is actually done against 4 pixels, idx should already + * have been modified to use one level higher than strictly necessary. */ private boolean lookupQuad(GridSubset grid, long[] idx) { BufferedImage mat = matrices.get(grid.getName())[(int) idx[2]]; @@ -281,17 +273,7 @@ private boolean lookupQuad(GridSubset grid, long[] idx) { } } } catch (ArrayIndexOutOfBoundsException aioob) { - log.log( - Level.SEVERE, - "x:" - + x - + " y:" - + y - + " (" - + mat.getWidth() - + " " - + mat.getHeight() - + ")"); + log.log(Level.SEVERE, "x:" + x + " y:" + y + " (" + mat.getWidth() + " " + mat.getHeight() + ")"); } } @@ -350,17 +332,7 @@ private boolean lookupSubsample(GridSubset grid, long[] idx, int zoomDiff) { y = startY; } } catch (ArrayIndexOutOfBoundsException aioob) { - log.log( - Level.SEVERE, - "x:" - + x - + " y:" - + y - + " (" - + mat.getWidth() - + " " - + mat.getHeight() - + ")"); + log.log(Level.SEVERE, "x:" + x + " y:" + y + " (" + mat.getWidth() + " " + mat.getHeight() + ")"); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilter.java index 5e9618ce95..0ac6a94dd0 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -29,9 +28,7 @@ public abstract class RequestFilter implements Serializable { /** Apply the filter to the */ public abstract void apply(ConveyorTile convTile) throws RequestFilterException; - /** - * The name of the filter, as chosen by the user. It should be unique, but this is not enforced. - */ + /** The name of the filter, as chosen by the user. It should be unique, but this is not enforced. */ public String getName() { return name; } @@ -45,8 +42,8 @@ void setName(String name) { public abstract void initialize(TileLayer layer) throws GeoWebCacheException; /** - * Optional updates, filters should implement at least one. The first two are used for filters - * that can update themselves (eg. WMSRasterFilter), the last one for those that need input. + * Optional updates, filters should implement at least one. The first two are used for filters that can update + * themselves (eg. WMSRasterFilter), the last one for those that need input. */ public abstract boolean update(TileLayer layer, String gridSetId); diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilterException.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilterException.java index 184a60f22c..b5c942cf4f 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilterException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/RequestFilterException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/request/WMSRasterFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/request/WMSRasterFilter.java index c72cdecef9..0071556001 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/request/WMSRasterFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/request/WMSRasterFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -101,15 +100,14 @@ protected BufferedImage loadMatrix(TileLayer tlayer, String gridSetId, int z) String urlStr = layer.getWMSurl()[0]; Map requestParams = wmsParams(layer, gridSet, z, widthHeight); - log.info( - "Updated WMS raster filter, zoom level " - + z - + " for " - + getName() - + " (" - + layer.getName() - + ") , " - + urlStr); + log.info("Updated WMS raster filter, zoom level " + + z + + " for " + + getName() + + " (" + + layer.getName() + + ") , " + + urlStr); URL wmsUrl = URLs.of(urlStr); @@ -120,9 +118,7 @@ protected BufferedImage loadMatrix(TileLayer tlayer, String gridSetId, int z) HttpResponse httpResponse = null; BufferedImage img = null; - httpResponse = - srcHelper.executeRequest( - wmsUrl, requestParams, backendTimeout, WMSLayer.HttpRequestMode.Get); + httpResponse = srcHelper.executeRequest(wmsUrl, requestParams, backendTimeout, WMSLayer.HttpRequestMode.Get); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != 200) { @@ -130,12 +126,11 @@ protected BufferedImage loadMatrix(TileLayer tlayer, String gridSetId, int z) } if (!httpResponse.getFirstHeader("Content-Type").getValue().startsWith("image/")) { - throw new GeoWebCacheException( - "Unexpected response content type " - + httpResponse.getFirstHeader("Content-Type").getValue() - + " , request was " - + urlStr - + "\n"); + throw new GeoWebCacheException("Unexpected response content type " + + httpResponse.getFirstHeader("Content-Type").getValue() + + " , request was " + + urlStr + + "\n"); } byte[] ret = ServletUtils.readStream(httpResponse.getEntity().getContent(), 16384, 2048); @@ -145,16 +140,15 @@ protected BufferedImage loadMatrix(TileLayer tlayer, String gridSetId, int z) img = ImageIO.read(is); if (img.getWidth() != widthHeight[0] || img.getHeight() != widthHeight[1]) { - String msg = - "WMS raster filter has dimensions " - + img.getWidth() - + "," - + img.getHeight() - + ", expected " - + widthHeight[0] - + "," - + widthHeight[1] - + "\n"; + String msg = "WMS raster filter has dimensions " + + img.getWidth() + + "," + + img.getHeight() + + ", expected " + + widthHeight[0] + + "," + + widthHeight[1] + + "\n"; throw new GeoWebCacheException(msg); } @@ -162,8 +156,7 @@ protected BufferedImage loadMatrix(TileLayer tlayer, String gridSetId, int z) } /** Generates the URL used to create the lookup raster */ - protected Map wmsParams( - WMSLayer layer, GridSubset gridSubset, int z, int[] widthHeight) + protected Map wmsParams(WMSLayer layer, GridSubset gridSubset, int z, int[] widthHeight) throws GeoWebCacheException { BoundingBox bbox = gridSubset.getCoverageBounds(z); @@ -197,8 +190,7 @@ protected Map wmsParams( } @Override - public void update(byte[] filterData, TileLayer layer, String gridSetId, int z) - throws GeoWebCacheException { + public void update(byte[] filterData, TileLayer layer, String gridSetId, int z) throws GeoWebCacheException { throw new GeoWebCacheException( "update(byte[] filterData, TileLayer layer, String gridSetId, int z) is not appropriate for WMSRasterFilters"); } @@ -216,8 +208,7 @@ public boolean update(TileLayer layer, String gridSetId) { } @Override - public void update(TileLayer layer, String gridSetId, int zStart, int zStop) - throws GeoWebCacheException { + public void update(TileLayer layer, String gridSetId, int zStart, int zStop) throws GeoWebCacheException { for (int z = zStart; z <= zStop; z++) { try { this.setMatrix(layer, gridSetId, z, true); diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityDispatcher.java b/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityDispatcher.java index 6b8ae0065a..2fb3a0f1fd 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityDispatcher.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityDispatcher.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -43,8 +42,7 @@ public Collection getFilters() { * * @throws SecurityException if any of the filter throw it */ - public void checkSecurity(final ConveyorTile tile) - throws SecurityException, GeoWebCacheException { + public void checkSecurity(final ConveyorTile tile) throws SecurityException, GeoWebCacheException { final TileLayer layer = tile.getLayer(); final GridSubset gridSubset = tile.getGridSubset(); final BoundingBox bounds; @@ -68,8 +66,7 @@ public void checkSecurity(final ConveyorTile tile) public void checkSecurity(TileLayer layer, @Nullable BoundingBox extent, @Nullable SRS srs) throws SecurityException, GeoWebCacheException { if (Objects.isNull(extent) != Objects.isNull(srs)) { - throw new NullPointerException( - "Extent and srs must either both be null or both be non-null"); + throw new NullPointerException("Extent and srs must either both be null or both be non-null"); } for (SecurityFilter filter : getFilters()) { filter.checkSecurity(layer, extent, srs); @@ -77,8 +74,7 @@ public void checkSecurity(TileLayer layer, @Nullable BoundingBox extent, @Nullab } @Override - public void setApplicationContext(final ApplicationContext applicationContext) - throws BeansException { + public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityFilter.java b/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityFilter.java index 64fcfe4927..cf8e773364 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/filter/security/SecurityFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -23,8 +22,7 @@ public interface SecurityFilter { /** - * Check that the the specified extent is allowed for the specified layer and throw an exception - * if not. + * Check that the the specified extent is allowed for the specified layer and throw an exception if not. * * @throws SecurityException if the request is not allowed. */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBox.java b/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBox.java index 9a42811814..20ed77c974 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBox.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBox.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Chris Whitney, Copyright 2011 */ @@ -43,13 +42,11 @@ private NumberFormat getCoordinateFormatter() { public static final BoundingBox WORLD4326 = new BoundingBox(-180.0, -90.0, 180.0, 90.0); - public static final BoundingBox WORLD3857 = - new BoundingBox(-20037508.34, -20037508.34, 20037508.34, 20037508.34); + public static final BoundingBox WORLD3857 = new BoundingBox(-20037508.34, -20037508.34, 20037508.34, 20037508.34); // exactly as defined in the OGC TMS specification public static final BoundingBox WORLD3857_TMS = - new BoundingBox( - -20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892); + new BoundingBox(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892); // minx, miny, maxx, maxy private double[] coords = new double[4]; @@ -166,14 +163,7 @@ public void setFromBBOXString(String BBOX, int recWatch) { * @return a readable string */ public String getReadableString() { - return "Min X: " - + coords[0] - + " Min Y: " - + coords[1] - + " Max X: " - + coords[2] - + " Max Y: " - + coords[3]; + return "Min X: " + coords[0] + " Min Y: " + coords[1] + " Max X: " + coords[2] + " Max Y: " + coords[3]; } /** Returns a comma separated value String suitable for URL output */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBoxException.java b/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBoxException.java index 115fe9c7db..9eb69f607e 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBoxException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/BoundingBoxException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/Grid.java b/geowebcache/core/src/main/java/org/geowebcache/grid/Grid.java index 25c8f95aac..327dd3c014 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/Grid.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/Grid.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -42,8 +41,7 @@ public boolean equals(Object obj) { if (numTilesHigh != other.numTilesHigh) return false; - if (Math.abs(other.resolution - resolution) / Math.abs(other.resolution + resolution) - > 0.005) return false; + if (Math.abs(other.resolution - resolution) / Math.abs(other.resolution + resolution) > 0.005) return false; return true; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridAlignmentMismatchException.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridAlignmentMismatchException.java index f3d5709f79..488dea9987 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridAlignmentMismatchException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridAlignmentMismatchException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, Copyright 2010 */ @@ -17,18 +16,17 @@ public class GridAlignmentMismatchException extends GridMismatchException { public GridAlignmentMismatchException(double x, long posX, double y, long posY) { - super( - "X,Y values for the tile index were calculated to be {" - + x - + ", " - + y - + "} " - + " which had to be rounded to {" - + posX - + ", " - + posY - + "} " - + " and exceeds the threshold of 10%. Perhaps the client is using" - + " the wrong origin ?"); + super("X,Y values for the tile index were calculated to be {" + + x + + ", " + + y + + "} " + + " which had to be rounded to {" + + posX + + ", " + + posY + + "} " + + " and exceeds the threshold of 10%. Perhaps the client is using" + + " the wrong origin ?"); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridCoverage.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridCoverage.java index b2542d1394..26402d8f71 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridCoverage.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridCoverage.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -30,8 +29,7 @@ protected GridCoverage(long[] coverage) { * Find the intersection of the given rectangle with the coverage * * @param rectangle Array of long, minx,miny,maxx,maxy,level, in tile coordinates. - * @return Array of long representing the intersection, minx,miny,maxx,maxy,level, in tile - * coordinates + * @return Array of long representing the intersection, minx,miny,maxx,maxy,level, in tile coordinates */ protected long[] getIntersection(long[] rectangle) { // TODO: should check that the rectangle has 5 elements and that the fifth (level) matches diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridMismatchException.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridMismatchException.java index 3f9732fd15..2f932856ec 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridMismatchException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridMismatchException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSet.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSet.java index b4cdf60290..4fc5842120 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSet.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSet.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -32,15 +31,10 @@ public class GridSet implements Info { private int tileHeight; - /** - * Whether the y-coordinate of {@link #tileOrigin()} is at the top (true) or at the bottom - * (false) - */ + /** Whether the y-coordinate of {@link #tileOrigin()} is at the top (true) or at the bottom (false) */ protected boolean yBaseToggle = false; - /** - * By default the coordinates are {x,y}, this flag reverses the output for WMTS getcapabilities - */ + /** By default the coordinates are {x,y}, this flag reverses the output for WMTS getcapabilities */ private boolean yCoordinateFirst = false; private boolean scaleWarning = false; @@ -56,8 +50,8 @@ public class GridSet implements Info { private String description; /** - * {@code true} if the resolutions are preserved and the scaleDenominators calculated, {@code - * false} if the resolutions are calculated based on the sacale denominators. + * {@code true} if the resolutions are preserved and the scaleDenominators calculated, {@code false} if the + * resolutions are calculated based on the sacale denominators. */ private boolean resolutionsPreserved; @@ -93,17 +87,16 @@ void setOriginalExtent(BoundingBox originalExtent) { } /** - * @return {@code true} if the resolutions are preserved and the scaleDenominators calculated, - * {@code false} if the resolutions are calculated based on the sacale denominators. + * @return {@code true} if the resolutions are preserved and the scaleDenominators calculated, {@code false} if the + * resolutions are calculated based on the sacale denominators. */ public boolean isResolutionsPreserved() { return resolutionsPreserved; } /** - * @param resolutionsPreserved {@code true} if the resolutions are preserved and the - * scaleDenominators calculated, {@code false} if the resolutions are calculated based on - * the sacale denominators. + * @param resolutionsPreserved {@code true} if the resolutions are preserved and the scaleDenominators calculated, + * {@code false} if the resolutions are calculated based on the sacale denominators. */ void setResolutionsPreserved(boolean resolutionsPreserved) { this.resolutionsPreserved = resolutionsPreserved; @@ -125,12 +118,11 @@ public BoundingBox boundsFromIndex(long[] tileIndex) { double height = grid.getResolution() * getTileHeight(); final double[] tileOrigin = tileOrigin(); - BoundingBox tileBounds = - new BoundingBox( - tileOrigin[0] + width * tileX, - tileOrigin[1] + height * (tileY), - tileOrigin[0] + width * (tileX + 1), - tileOrigin[1] + height * (tileY + 1)); + BoundingBox tileBounds = new BoundingBox( + tileOrigin[0] + width * tileX, + tileOrigin[1] + height * (tileY), + tileOrigin[0] + width * (tileX + 1), + tileOrigin[1] + height * (tileY + 1)); return tileBounds; } @@ -192,8 +184,7 @@ protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchExcepti return closestIndex(bestLevel, tileBounds); } - protected long[] closestIndex(int level, BoundingBox tileBounds) - throws GridAlignmentMismatchException { + protected long[] closestIndex(int level, BoundingBox tileBounds) throws GridAlignmentMismatchException { Grid grid = getGrid(level); double width = grid.getResolution() * getTileWidth(); @@ -234,8 +225,7 @@ public long[] closestRectangle(BoundingBox rectangleBounds) { double countX = rectWidth / (grid.getResolution() * getTileWidth()); double countY = rectHeight / (grid.getResolution() * getTileHeight()); - double error = - Math.abs(countX - Math.round(countX)) + Math.abs(countY - Math.round(countY)); + double error = Math.abs(countX - Math.round(countX)) + Math.abs(countY - Math.round(countY)); if (error < bestError) { bestError = error; @@ -253,8 +243,7 @@ public long[] closestRectangle(BoundingBox rectangleBounds) { * * @param level integer zoom level to consider tiles at * @param rectangeBounds rectangle to match - * @return Array of long, the rectangle of tiles in tile coordinates: {minx, miny, maxx, maxy, - * level} + * @return Array of long, the rectangle of tiles in tile coordinates: {minx, miny, maxx, maxy, level} */ protected long[] closestRectangle(int level, BoundingBox rectangeBounds) { Grid grid = getGrid(level); @@ -286,16 +275,15 @@ public boolean equals(Object obj) { if (this == other) return true; - boolean equals = - Objects.equals(getSrs(), other.getSrs()) - && Objects.equals(getName(), other.getName()) - && Objects.equals(getDescription(), other.getDescription()) - && Objects.equals(getTileWidth(), other.getTileWidth()) - && Objects.equals(getTileHeight(), other.getTileHeight()) - && Objects.equals(isTopLeftAligned(), other.isTopLeftAligned()) - && Objects.equals(isyCoordinateFirst(), other.isyCoordinateFirst()) - && Objects.equals(getOriginalExtent(), other.getOriginalExtent()) - && Arrays.equals(gridLevels, other.gridLevels); + boolean equals = Objects.equals(getSrs(), other.getSrs()) + && Objects.equals(getName(), other.getName()) + && Objects.equals(getDescription(), other.getDescription()) + && Objects.equals(getTileWidth(), other.getTileWidth()) + && Objects.equals(getTileHeight(), other.getTileHeight()) + && Objects.equals(isTopLeftAligned(), other.isTopLeftAligned()) + && Objects.equals(isyCoordinateFirst(), other.isyCoordinateFirst()) + && Objects.equals(getOriginalExtent(), other.getOriginalExtent()) + && Arrays.equals(gridLevels, other.gridLevels); return equals; } @@ -327,8 +315,7 @@ public BoundingBox getBounds() { } /** - * Returns the top left corner of the grid in the order used by the coordinate system. (Bad - * idea) + * Returns the top left corner of the grid in the order used by the coordinate system. (Bad idea) * *

Used for WMTS GetCapabilities */ @@ -412,11 +399,10 @@ void setGridLevels(Grid[] gridLevels) { } /** - * The base cordinates in x/y order, used to map tile indexes to coordinate bounding boxes. - * These can either be top left or bottom left, so must be kept private. + * The base cordinates in x/y order, used to map tile indexes to coordinate bounding boxes. These can either be top + * left or bottom left, so must be kept private. * - *

This is a derived property of {@link #getOriginalExtent()} and {@link - * #isTopLeftAligned()}. + *

This is a derived property of {@link #getOriginalExtent()} and {@link #isTopLeftAligned()}. */ public double[] tileOrigin() { BoundingBox extent = getOriginalExtent(); @@ -514,15 +500,13 @@ void setTileHeight(int tileHeight) { } /** - * Evaluates wheter this GridSet is different enough from {@code another} so that if this - * GridSet were replaced by {@code another} all layers referencing this GridSet should be - * truncated. + * Evaluates wheter this GridSet is different enough from {@code another} so that if this GridSet were replaced by + * {@code another} all layers referencing this GridSet should be truncated. * - *

The rule is, if any of the following properties differ: {@link #getBounds()}, {@link - * #isTopLeftAligned()}, {@link #getTileHeight()}, {@link #getTileWidth()}, {@link #getSrs()}, - * OR none of the previously mentiond properties differ and the grid levels are different, - * except if both the grids of {@code another} are a superset of the grids of this gridset (i.e. - * they are all the same but {@code another} just has more zoom levels}. + *

The rule is, if any of the following properties differ: {@link #getBounds()}, {@link #isTopLeftAligned()}, + * {@link #getTileHeight()}, {@link #getTileWidth()}, {@link #getSrs()}, OR none of the previously mentiond + * properties differ and the grid levels are different, except if both the grids of {@code another} are a superset + * of the grids of this gridset (i.e. they are all the same but {@code another} just has more zoom levels}. * * @return {@code true} if */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetBroker.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetBroker.java index 661f765408..755139e790 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetBroker.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetBroker.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -38,9 +37,7 @@ /** Exposes {@link GridSet}s from all {@link GridSetConfiguration}s */ public class GridSetBroker - implements ConfigurationAggregator, - ApplicationContextAware, - InitializingBean { + implements ConfigurationAggregator, ApplicationContextAware, InitializingBean { private static Logger log = Logging.getLogger(GridSetBroker.class.getName()); private List configurations; @@ -53,12 +50,11 @@ public GridSetBroker() {} public GridSetBroker(List configurations) { this.configurations = configurations; - defaults = - configurations.stream() - .filter(DefaultGridsets.class::isInstance) - .findFirst() - .map(DefaultGridsets.class::cast) - .get(); + defaults = configurations.stream() + .filter(DefaultGridsets.class::isInstance) + .findFirst() + .map(DefaultGridsets.class::cast) + .get(); } @Override @@ -101,12 +97,11 @@ public Collection getGridSets() { return getConfigurations().stream() .map(GridSetConfiguration::getGridSets) .flatMap(Collection::stream) - .collect( - Collectors.toMap( - GridSet::getName, - g -> g, - (g1, g2) -> g1, // Prefer the first one - HashMap::new)) + .collect(Collectors.toMap( + GridSet::getName, + g -> g, + (g1, g2) -> g1, // Prefer the first one + HashMap::new)) .values(); } @@ -120,37 +115,32 @@ public void addGridSet(GridSet gridSet) { getConfigurations().stream() .filter(c -> c.canSave(gridSet)) .findFirst() - .orElseThrow( - () -> - new UnsupportedOperationException( - "No Configuration is able to save gridset " - + gridSet.getName())) + .orElseThrow(() -> new UnsupportedOperationException( + "No Configuration is able to save gridset " + gridSet.getName())) .addGridSet(gridSet); } /** * Blindly removes a gridset from this gridset broker. * - *

This method doesn't check whether there's any layer referencing the gridset nor removes it - * from the {@link XMLConfiguration}. + *

This method doesn't check whether there's any layer referencing the gridset nor removes it from the + * {@link XMLConfiguration}. */ public synchronized GridSet remove(final String gridSetName) { return getGridSet(gridSetName) - .map( - g -> { - removeGridSet(gridSetName); - return g; - }) + .map(g -> { + removeGridSet(gridSetName); + return g; + }) .orElse(null); } public synchronized void removeGridSet(final String gridSetName) { getConfigurations().stream() .filter(c -> c.getGridSet(gridSetName).isPresent()) - .forEach( - c -> { - c.removeGridSet(gridSetName); - }); + .forEach(c -> { + c.removeGridSet(gridSetName); + }); } public DefaultGridsets getDefaults() { @@ -162,12 +152,10 @@ public DefaultGridsets getDefaults() { getConfigurations(DefaultGridsets.class).iterator(); defaults = it.next(); if (it.hasNext()) { - log.warning( - "GridSetBroker has more than one DefaultGridSets configuration"); + log.warning("GridSetBroker has more than one DefaultGridSets configuration"); } } catch (NoSuchElementException ex) { - throw new IllegalStateException( - "GridSetBroker has no DefaultGridsets configuration", ex); + throw new IllegalStateException("GridSetBroker has no DefaultGridsets configuration", ex); } } } @@ -211,8 +199,7 @@ public GridSet getWorldEpsg3857() { @Override @SuppressWarnings("unchecked") - public List getConfigurations( - Class type) { + public List getConfigurations(Class type) { return (List) getConfigurations().stream().filter(type::isInstance).collect(Collectors.toList()); } @@ -220,21 +207,17 @@ public List getConfigurations( private Collection getConfigurations() { // We set DefaultGridsets in the constructor, need to account for it. if (this.configurations == null - || (this.configurations.size() == 1 - && this.configurations.get(0) instanceof DefaultGridsets)) { + || (this.configurations.size() == 1 && this.configurations.get(0) instanceof DefaultGridsets)) { synchronized (this) { if (this.configurations == null || (this.configurations.size() == 1 && this.configurations.get(0).equals(defaults))) { if (Objects.nonNull(applicationContext)) { configurations = - GeoWebCacheExtensions.configurations( - GridSetConfiguration.class, applicationContext); + GeoWebCacheExtensions.configurations(GridSetConfiguration.class, applicationContext); } else { - log.fine( - "GridSetBroker.initialize() called without having set application context"); - configurations = - GeoWebCacheExtensions.configurations(GridSetConfiguration.class); + log.fine("GridSetBroker.initialize() called without having set application context"); + configurations = GeoWebCacheExtensions.configurations(GridSetConfiguration.class); } if (defaults != null && !configurations.contains(defaults)) { configurations.add(defaults); diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetFactory.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetFactory.java index 8e0befd441..cad7565105 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetFactory.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSetFactory.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -47,8 +46,8 @@ private static GridSet baseGridSet(String name, SRS srs, int tileWidth, int tile } /** - * Note that you should provide EITHER resolutions or scales. Providing both will cause a - * precondition violation exception. + * Note that you should provide EITHER resolutions or scales. Providing both will cause a precondition violation + * exception. */ public static GridSet createGridSet( final String name, @@ -77,31 +76,29 @@ public static GridSet createGridSet( for (int i = 1; resolutions != null && i < resolutions.length; i++) { if (resolutions[i] >= resolutions[i - 1]) { - throw new IllegalArgumentException( - "Each resolution should be lower than it's prior one. Res[" - + i - + "] == " - + resolutions[i] - + ", Res[" - + (i - 1) - + "] == " - + resolutions[i - 1] - + "."); + throw new IllegalArgumentException("Each resolution should be lower than it's prior one. Res[" + + i + + "] == " + + resolutions[i] + + ", Res[" + + (i - 1) + + "] == " + + resolutions[i - 1] + + "."); } } for (int i = 1; scaleDenoms != null && i < scaleDenoms.length; i++) { if (scaleDenoms[i] >= scaleDenoms[i - 1]) { - throw new IllegalArgumentException( - "Each scale denominator should be lower than it's prior one. Scale[" - + i - + "] == " - + scaleDenoms[i] - + ", Scale[" - + (i - 1) - + "] == " - + scaleDenoms[i - 1] - + "."); + throw new IllegalArgumentException("Each scale denominator should be lower than it's prior one. Scale[" + + i + + "] == " + + scaleDenoms[i] + + ", Scale[" + + (i - 1) + + "] == " + + scaleDenoms[i - 1] + + "."); } } @@ -123,17 +120,15 @@ public static GridSet createGridSet( gridSet.setMetersPerUnit(EPSG3857_TO_METERS); } else { if (resolutions == null) { - log.config( - "GridSet " - + name - + " was defined without metersPerUnit, assuming 1m/unit." - + " All scales will be off if this is incorrect."); + log.config("GridSet " + + name + + " was defined without metersPerUnit, assuming 1m/unit." + + " All scales will be off if this is incorrect."); } else { - log.config( - "GridSet " - + name - + " was defined without metersPerUnit. " - + "Assuming 1m per SRS unit for WMTS scale output."); + log.config("GridSet " + + name + + " was defined without metersPerUnit. " + + "Assuming 1m per SRS unit for WMTS scale output."); gridSet.setScaleWarning(true); } @@ -157,17 +152,14 @@ public static GridSet createGridSet( curGrid.setResolution(pixelSize * (scaleDenoms[i] / gridSet.getMetersPerUnit())); } else { curGrid.setResolution(resolutions[i]); - curGrid.setScaleDenominator( - (resolutions[i] * gridSet.getMetersPerUnit()) / DEFAULT_PIXEL_SIZE_METER); + curGrid.setScaleDenominator((resolutions[i] * gridSet.getMetersPerUnit()) / DEFAULT_PIXEL_SIZE_METER); } final double mapUnitWidth = tileWidth * curGrid.getResolution(); final double mapUnitHeight = tileHeight * curGrid.getResolution(); - final long tilesWide = - (long) Math.ceil((extent.getWidth() - mapUnitWidth * 0.01) / mapUnitWidth); - final long tilesHigh = - (long) Math.ceil((extent.getHeight() - mapUnitHeight * 0.01) / mapUnitHeight); + final long tilesWide = (long) Math.ceil((extent.getWidth() - mapUnitWidth * 0.01) / mapUnitWidth); + final long tilesHigh = (long) Math.ceil((extent.getHeight() - mapUnitHeight * 0.01) / mapUnitHeight); curGrid.setNumTilesWide(tilesWide); curGrid.setNumTilesHigh(tilesHigh); diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubset.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubset.java index fcdf8e8e82..e3939f45ac 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubset.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubset.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -41,10 +40,7 @@ public class GridSubset { private final Integer maxCachedZoom; protected GridSubset( - GridSet gridSet, - Map coverages, - BoundingBox originalExtent, - boolean fullCoverage) { + GridSet gridSet, Map coverages, BoundingBox originalExtent, boolean fullCoverage) { this(gridSet, coverages, originalExtent, fullCoverage, null, null); } @@ -99,8 +95,7 @@ public long[] closestRectangle(BoundingBox rectangleBounds) { * Indicates whether this gridsubset coverage contains the given tile * * @param index the tile index to check for coverage inclusion - * @return {@code true} if {@code index} is inside this grid subset's coverage, {@code false} - * otherwise + * @return {@code true} if {@code index} is inside this grid subset's coverage, {@code false} otherwise */ public boolean covers(long[] index) { final int level = (int) index[2]; @@ -109,10 +104,7 @@ public boolean covers(long[] index) { return false; } - if (index[0] >= coverage[0] - && index[0] <= coverage[2] - && index[1] >= coverage[1] - && index[1] <= coverage[3]) { + if (index[0] >= coverage[0] && index[0] <= coverage[2] && index[1] >= coverage[1] && index[1] <= coverage[3]) { return true; } @@ -135,8 +127,7 @@ public void checkCoverage(long[] index) throws OutsideCoverageException { public void checkTileDimensions(int width, int height) throws TileDimensionsMismatchException { if (width != gridSet.getTileWidth() || height != gridSet.getTileHeight()) { - throw new TileDimensionsMismatchException( - width, height, gridSet.getTileWidth(), gridSet.getTileWidth()); + throw new TileDimensionsMismatchException(width, height, gridSet.getTileWidth(), gridSet.getTileWidth()); } } @@ -332,14 +323,12 @@ public long[][] getSubGrid(long[] gridLoc) throws GeoWebCacheException { if ((idx - firstLevel + 1) <= zoomStop) { // Check whether this grid is doubling - double resolutionCheck = - gridSet.getGrid(idx).getResolution() / 2 - - gridSet.getGrid(idx + 1).getResolution(); + double resolutionCheck = gridSet.getGrid(idx).getResolution() / 2 + - gridSet.getGrid(idx + 1).getResolution(); if (Math.abs(resolutionCheck) > gridSet.getGrid(idx + 1).getResolution() * 0.025) { throw new GeoWebCacheException( - "The resolution is not decreasing by a factor of two for " - + this.getName()); + "The resolution is not decreasing by a factor of two for " + this.getName()); } else { long[] coverage = getCoverage(idx + 1); @@ -385,8 +374,8 @@ public int getTileWidth() { } /** - * WMTS is indexed from top left hand corner. We will still return {minx,miny,maxx,maxy}, but - * note that the y positions have been reversed + * WMTS is indexed from top left hand corner. We will still return {minx,miny,maxx,maxy}, but note that the y + * positions have been reversed */ // TODO: this is specific to WMTS, move it somewhere on the wmts module // TODO: Does this need to be public? diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubsetFactory.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubsetFactory.java index be3a925f91..66bfabd6bf 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubsetFactory.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridSubsetFactory.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -24,9 +23,7 @@ public class GridSubsetFactory { public static GridSubset createGridSubSet(GridSet gridSet) { - GridSubset ret = - createGridSubSet( - gridSet, gridSet.getOriginalExtent(), 0, gridSet.getNumLevels() - 1); + GridSubset ret = createGridSubSet(gridSet, gridSet.getOriginalExtent(), 0, gridSet.getNumLevels() - 1); return ret; } @@ -54,15 +51,14 @@ public static GridSubset createGridSubSet( if (zoomStop == null) { zoomStop = maxLevel; } else if (zoomStop > maxLevel) { - String message = - "Requested to create GridSubset with zoomStop " - + zoomStop - + " for GridSet " - + gridSet.getName() - + " whose max zoom level is " - + maxLevel - + ". Limiting GridSubset to zoomStop = " - + maxLevel; + String message = "Requested to create GridSubset with zoomStop " + + zoomStop + + " for GridSet " + + gridSet.getName() + + " whose max zoom level is " + + maxLevel + + ". Limiting GridSubset to zoomStop = " + + maxLevel; log.warning(message); zoomStop = maxLevel; } @@ -96,14 +92,7 @@ public static GridSubset createGridSubSet( originalExtent = gridSetBounds; } - GridSubset ret = - new GridSubset( - gridSet, - coverages, - originalExtent, - fullCoverage, - minCachedZoom, - maxCachedZoom); + GridSubset ret = new GridSubset(gridSet, coverages, originalExtent, fullCoverage, minCachedZoom, maxCachedZoom); return ret; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/GridUtil.java b/geowebcache/core/src/main/java/org/geowebcache/grid/GridUtil.java index 15d7e94016..02f22e95d5 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/GridUtil.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/GridUtil.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -19,8 +18,8 @@ public class GridUtil { /** - * @return null if none matches, the gridset with a tile index closest to the requested bounds - * and dimensions otherwise + * @return null if none matches, the gridset with a tile index closest to the requested bounds and dimensions + * otherwise */ public static GridSubset findBestMatchingGrid( final BoundingBox reqBounds, @@ -37,8 +36,7 @@ public static GridSubset findBestMatchingGrid( final int tileWidth = crsMatch.getTileWidth(); final int tileHeight = crsMatch.getTileHeight(); if ((expectedTileWidth != null && expectedTileWidth.intValue() != tileWidth) - || (expectedTileHeight != null - && expectedTileHeight.intValue() != tileHeight)) { + || (expectedTileHeight != null && expectedTileHeight.intValue() != tileHeight)) { // don't even consider it continue; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/OutsideCoverageException.java b/geowebcache/core/src/main/java/org/geowebcache/grid/OutsideCoverageException.java index 7fd4d85b26..6da6a8883a 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/OutsideCoverageException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/OutsideCoverageException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -22,21 +21,13 @@ public class OutsideCoverageException extends GeoWebCacheException { private static final long serialVersionUID = -2465389680194367974L; public OutsideCoverageException(long[] index, long firstLevel, long lastLevel) { - super( - "Zoom level was " - + index[2] - + ", but value has to be in [" - + firstLevel - + "," - + lastLevel - + "]"); + super("Zoom level was " + index[2] + ", but value has to be in [" + firstLevel + "," + lastLevel + "]"); } public OutsideCoverageException(long[] index, long[] coverage) { - super( - "Coverage [minx,miny,maxx,maxy] is " - + Arrays.toString(coverage) - + ", index [x,y,z] is " - + Arrays.toString(index)); + super("Coverage [minx,miny,maxx,maxy] is " + + Arrays.toString(coverage) + + ", index [x,y,z] is " + + Arrays.toString(index)); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/ResolutionMismatchException.java b/geowebcache/core/src/main/java/org/geowebcache/grid/ResolutionMismatchException.java index ae7e1278a9..798e97657a 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/ResolutionMismatchException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/ResolutionMismatchException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, Copyright 2010 */ @@ -17,13 +16,12 @@ public class ResolutionMismatchException extends GridMismatchException { public ResolutionMismatchException(double wRes, double bestResolution) { - super( - "Requested horizontal resolution: " - + wRes - + " , best match: " - + bestResolution - + " exceeds 10% threshold. Perhaps the client is configured " - + " with an incorrect set of scales (resolutions), " - + " or the DPI setting is off compared to the one in GWC ?"); + super("Requested horizontal resolution: " + + wRes + + " , best match: " + + bestResolution + + " exceeds 10% threshold. Perhaps the client is configured " + + " with an incorrect set of scales (resolutions), " + + " or the DPI setting is off compared to the one in GWC ?"); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/SRS.java b/geowebcache/core/src/main/java/org/geowebcache/grid/SRS.java index a46258e90e..472cecfa68 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/SRS.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/SRS.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -30,20 +29,16 @@ public class SRS implements Comparable, Serializable { private static final SRS EPSG4326 = new SRS(4326); /** - * The EPSG says EPSG:3857 is the identifier for web mercator. ArcGIS 10 says either of - * EPSG:102113 or EPSG:102100 identifies web mercator. The "community" first defined it as - * EPSG:900913. + * The EPSG says EPSG:3857 is the identifier for web mercator. ArcGIS 10 says either of EPSG:102113 or EPSG:102100 + * identifies web mercator. The "community" first defined it as EPSG:900913. */ - private static final SRS EPSG3857 = - new SRS(3857, new ArrayList<>(asList(900913, 102113, 102100))); + private static final SRS EPSG3857 = new SRS(3857, new ArrayList<>(asList(900913, 102113, 102100))); /** - * The EPSG says EPSG:3857 is the identifier for web mercator. ArcGIS 10 says either of - * EPSG:102113 or EPSG:102100 identifies web mercator. The "community" first defined it as - * EPSG:900913. + * The EPSG says EPSG:3857 is the identifier for web mercator. ArcGIS 10 says either of EPSG:102113 or EPSG:102100 + * identifies web mercator. The "community" first defined it as EPSG:900913. */ - private static final SRS EPSG900913 = - new SRS(900913, new ArrayList<>(asList(3857, 102113, 102100))); + private static final SRS EPSG900913 = new SRS(900913, new ArrayList<>(asList(3857, 102113, 102100))); private int number; @@ -74,10 +69,9 @@ private Object readResolve() { /** * Returns an SRS object for the given epsg code. * - *

If an SRS for this code already exists, it's returned. Otherwise a registered SRS is - * looked up that has an alias defined for the given code, and if found the alias is returned. - * If no SRS is registered nor an alias is found, a new SRS for this code is registered and - * returned. + *

If an SRS for this code already exists, it's returned. Otherwise a registered SRS is looked up that has an + * alias defined for the given code, and if found the alias is returned. If no SRS is registered nor an alias is + * found, a new SRS for this code is registered and returned. */ public static SRS getSRS(final int epsgCode) { final Integer code = Integer.valueOf(epsgCode); diff --git a/geowebcache/core/src/main/java/org/geowebcache/grid/TileDimensionsMismatchException.java b/geowebcache/core/src/main/java/org/geowebcache/grid/TileDimensionsMismatchException.java index 294c113a91..c0ef36f48b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/grid/TileDimensionsMismatchException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/grid/TileDimensionsMismatchException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, Copyright 2010 */ @@ -17,15 +16,14 @@ public class TileDimensionsMismatchException extends GridMismatchException { public TileDimensionsMismatchException(int height, int width, int gsHeight, int gsWidth) { - super( - "The requested tile dimensions " - + width - + "x" - + height - + " do not match those of the grid set (" - + gsWidth - + "x" - + gsHeight - + ")"); + super("The requested tile dimensions " + + width + + "x" + + height + + " do not match those of the grid set (" + + gsWidth + + "x" + + gsHeight + + ")"); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/ByteArrayResource.java b/geowebcache/core/src/main/java/org/geowebcache/io/ByteArrayResource.java index fd54ede86a..f746932c7b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/ByteArrayResource.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/ByteArrayResource.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -66,8 +65,7 @@ public ByteArrayResource(byte[] data, int offset, int length) { } else { this.data = data; Assert.isTrue(offset < data.length, "Offset should be less than data length"); - Assert.isTrue( - offset + length <= data.length, "Offset + length should be less than length"); + Assert.isTrue(offset + length <= data.length, "Offset + length should be less than length"); this.offset = offset; this.length = length; } @@ -97,7 +95,8 @@ public long transferTo(WritableByteChannel channel) throws IOException { if (length > 0) { ByteBuffer buffer = ByteBuffer.wrap(data, offset, length); long written = 0; - while ((written += channel.write(buffer)) < length) ; + while ((written += channel.write(buffer)) < length) + ; } return length; } @@ -115,7 +114,8 @@ public long transferFrom(ReadableByteChannel channel) throws IOException { } ByteBuffer buffer = ByteBuffer.wrap(data); int read = 0; - while ((read += channel.read(buffer)) < length) ; + while ((read += channel.read(buffer)) < length) + ; } else { offset = 0; length = 0; @@ -198,8 +198,7 @@ public SeekableInputStream(ByteArrayResource res) { public void seek(long pos) throws IOException { if (pos < 0 || pos > super.count) { - throw new IOException( - "Can't seek to pos " + pos + ". buffer is 0.." + (super.count - 1)); + throw new IOException("Can't seek to pos " + pos + ". buffer is 0.." + (super.count - 1)); } super.pos = (int) (lower + pos); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/CollectionConverter.java b/geowebcache/core/src/main/java/org/geowebcache/io/CollectionConverter.java index cea32d6334..f7766531fb 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/CollectionConverter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/CollectionConverter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -24,8 +23,7 @@ import java.util.List; import java.util.Set; -public class CollectionConverter - extends com.thoughtworks.xstream.converters.collections.CollectionConverter { +public class CollectionConverter extends com.thoughtworks.xstream.converters.collections.CollectionConverter { public static final String UNMODIFIABLE_LIST = "java.util.Collections$UnmodifiableList"; public static final String UNMODIFIABLE_SET = "java.util.Collections$UnmodifiableSet"; diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/FileResource.java b/geowebcache/core/src/main/java/org/geowebcache/io/FileResource.java index a5ff477019..53a3f6a7f8 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/FileResource.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/FileResource.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -57,7 +56,8 @@ public long transferTo(WritableByteChannel target) throws IOException { FileChannel in = fis.getChannel()) { final long size = in.size(); long written = 0; - while ((written += in.transferTo(written, size, target)) < size) ; + while ((written += in.transferTo(written, size, target)) < size) + ; return size; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/GeoWebCacheXStream.java b/geowebcache/core/src/main/java/org/geowebcache/io/GeoWebCacheXStream.java index 1d786893f2..8a8bd7e43a 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/GeoWebCacheXStream.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/GeoWebCacheXStream.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, Copyright 2015 */ @@ -89,13 +88,7 @@ public GeoWebCacheXStream( Mapper mapper, ConverterLookup converterLookup, ConverterRegistry converterRegistry) { - super( - reflectionProvider, - driver, - classLoaderReference, - mapper, - converterLookup, - converterRegistry); + super(reflectionProvider, driver, classLoaderReference, mapper, converterLookup, converterRegistry); init(); } @@ -117,8 +110,7 @@ public GeoWebCacheXStream( } public GeoWebCacheXStream( - ReflectionProvider reflectionProvider, - HierarchicalStreamDriver hierarchicalStreamDriver) { + ReflectionProvider reflectionProvider, HierarchicalStreamDriver hierarchicalStreamDriver) { super(reflectionProvider, hierarchicalStreamDriver); init(); } @@ -152,16 +144,13 @@ public GeoWebCacheXStream( @Deprecated public GeoWebCacheXStream( - ReflectionProvider reflectionProvider, - HierarchicalStreamDriver driver, - ClassLoader classLoader) { + ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoader classLoader) { super(reflectionProvider, driver, classLoader); init(); } @Deprecated - public GeoWebCacheXStream( - ReflectionProvider reflectionProvider, Mapper mapper, HierarchicalStreamDriver driver) { + public GeoWebCacheXStream(ReflectionProvider reflectionProvider, Mapper mapper, HierarchicalStreamDriver driver) { super(reflectionProvider, mapper, driver); init(); } @@ -190,29 +179,27 @@ private void init() { addPermission(new PrimitiveTypePermission()); // Common non-primitives - allowTypes( - new Class[] { - java.lang.String.class, - java.util.Date.class, - java.sql.Date.class, - java.sql.Timestamp.class, - java.sql.Time.class, - }); + allowTypes(new Class[] { + java.lang.String.class, + java.util.Date.class, + java.sql.Date.class, + java.sql.Timestamp.class, + java.sql.Time.class, + }); // Common collections - allowTypes( - new Class[] { - java.util.TreeSet.class, - java.util.SortedSet.class, - java.util.Set.class, - java.util.HashSet.class, - java.util.List.class, - java.util.ArrayList.class, - java.util.Map.class, - java.util.HashMap.class, - java.util.concurrent.CopyOnWriteArrayList.class, - java.util.concurrent.ConcurrentHashMap.class, - }); + allowTypes(new Class[] { + java.util.TreeSet.class, + java.util.SortedSet.class, + java.util.Set.class, + java.util.HashSet.class, + java.util.List.class, + java.util.ArrayList.class, + java.util.Map.class, + java.util.HashMap.class, + java.util.concurrent.CopyOnWriteArrayList.class, + java.util.concurrent.ConcurrentHashMap.class, + }); String whitelistProp = GeoWebCacheExtensions.getProperty("GEOWEBCACHE_XSTREAM_WHITELIST"); if (whitelistProp != null) { @@ -222,10 +209,9 @@ private void init() { } /** - * This method is a clone of the base class one, leaving the converters in the same order where - * possible, but altering a few ones performing illegal reflective accesses against Java core - * classes, replacing them with alternatives that do not, or simply removing them, if we are not - * using them + * This method is a clone of the base class one, leaving the converters in the same order where possible, but + * altering a few ones performing illegal reflective accesses against Java core classes, replacing them with + * alternatives that do not, or simply removing them, if we are not using them */ @Override protected void setupConverters() { @@ -279,8 +265,7 @@ protected void setupConverters() { registerConverter(new ColorConverter(), PRIORITY_NORMAL); } if (JVM.isSwingAvailable()) { - registerConverter( - new LookAndFeelConverter(mapper, reflectionProvider), PRIORITY_NORMAL); + registerConverter(new LookAndFeelConverter(mapper, reflectionProvider), PRIORITY_NORMAL); } registerConverter(new LocaleConverter(), PRIORITY_NORMAL); registerConverter(new GregorianCalendarConverter(), PRIORITY_NORMAL); @@ -297,49 +282,25 @@ protected void setupConverters() { new Class[] {ConverterLookup.class}, new Object[] {converterLookup}); registerConverterDynamically( - "com.thoughtworks.xstream.converters.extended.StackTraceElementConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.extended.StackTraceElementConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.extended.CurrencyConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.extended.CurrencyConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.extended.RegexPatternConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.extended.RegexPatternConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.extended.CharsetConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.extended.CharsetConverter", PRIORITY_NORMAL, null, null); // late bound converters - allows XStream to be compiled on earlier JDKs if (JVM.loadClassForName("javax.xml.datatype.Duration") != null) { registerConverterDynamically( - "com.thoughtworks.xstream.converters.extended.DurationConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.extended.DurationConverter", PRIORITY_NORMAL, null, null); } registerConverterDynamically( - "com.thoughtworks.xstream.converters.enums.EnumConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.enums.EnumConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.basic.StringBuilderConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.basic.StringBuilderConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.basic.UUIDConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.basic.UUIDConverter", PRIORITY_NORMAL, null, null); if (JVM.loadClassForName("javax.activation.ActivationDataFlavor") != null) { registerConverterDynamically( "com.thoughtworks.xstream.converters.extended.ActivationDataFlavorConverter", @@ -348,91 +309,43 @@ protected void setupConverters() { null); } registerConverterDynamically( - "com.thoughtworks.xstream.converters.extended.PathConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.extended.PathConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.ChronologyConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.ChronologyConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.DurationConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.DurationConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.HijrahDateConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.HijrahDateConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.JapaneseDateConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.JapaneseDateConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.JapaneseEraConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.JapaneseEraConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.InstantConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.InstantConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.LocalDateConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.LocalDateConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.LocalDateTimeConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.LocalDateTimeConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.LocalTimeConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.LocalTimeConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.MinguoDateConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.MinguoDateConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.MonthDayConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.MonthDayConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.OffsetDateTimeConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.OffsetDateTimeConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.OffsetTimeConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.OffsetTimeConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.PeriodConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.PeriodConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( "com.thoughtworks.xstream.converters.time.SystemClockConverter", PRIORITY_NORMAL, new Class[] {Mapper.class}, new Object[] {mapper}); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.ThaiBuddhistDateConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.ThaiBuddhistDateConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( "com.thoughtworks.xstream.converters.time.ValueRangeConverter", PRIORITY_NORMAL, @@ -444,25 +357,13 @@ protected void setupConverters() { new Class[] {Mapper.class}, new Object[] {mapper}); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.YearConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.YearConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.YearMonthConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.YearMonthConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.ZonedDateTimeConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.ZonedDateTimeConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( - "com.thoughtworks.xstream.converters.time.ZoneIdConverter", - PRIORITY_NORMAL, - null, - null); + "com.thoughtworks.xstream.converters.time.ZoneIdConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically( "com.thoughtworks.xstream.converters.reflection.LambdaConverter", PRIORITY_NORMAL, @@ -473,14 +374,11 @@ protected void setupConverters() { } /** - * Straight copy of the registerConverterDynamically private method of XStream, hopefully it - * will be removed if XStream relaxes access control + * Straight copy of the registerConverterDynamically private method of XStream, hopefully it will be removed if + * XStream relaxes access control */ private void registerConverterDynamically( - String className, - int priority, - Class[] constructorParamTypes, - Object[] constructorParamValues) { + String className, int priority, Class[] constructorParamTypes, Object[] constructorParamValues) { try { Class type = Class.forName(className, false, getClassLoaderReference().getReference()); diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/Resource.java b/geowebcache/core/src/main/java/org/geowebcache/io/Resource.java index 48a9f75862..33a6dd9769 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/Resource.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/Resource.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/TreeMapConverter.java b/geowebcache/core/src/main/java/org/geowebcache/io/TreeMapConverter.java index ffc83d21f1..b8b87e6615 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/TreeMapConverter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/TreeMapConverter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -39,13 +38,12 @@ import java.util.TreeMap; /** - * Converts a java.util.TreeMap to XML, and serializes the associated java.util.Comparator. The - * converter assumes that the entries in the XML are already sorted according the comparator. + * Converts a java.util.TreeMap to XML, and serializes the associated java.util.Comparator. The converter assumes that + * the entries in the XML are already sorted according the comparator. * - *

Cloned from XStream in order to avoid illegal reflective lookup warnings, might introduce - * loading issues if there are circular references stored in the TreeSet. We don't have those right - * now, the alternative would be open the java.util package for deep reflection from the command - * line + *

Cloned from XStream in order to avoid illegal reflective lookup warnings, might introduce loading issues if there + * are circular references stored in the TreeSet. We don't have those right now, the alternative would be open the + * java.util package for deep reflection from the command line * * @author Joe Walnes * @author Jörg Schaible @@ -68,23 +66,17 @@ public TreeMapConverter(Mapper mapper) { } @Override - public void marshal( - Object source, HierarchicalStreamWriter writer, MarshallingContext context) { + public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { SortedMap sortedMap = (SortedMap) source; marshalComparator(mapper(), sortedMap.comparator(), writer, context); super.marshal(source, writer, context); } protected static void marshalComparator( - Mapper mapper, - Comparator comparator, - HierarchicalStreamWriter writer, - MarshallingContext context) { + Mapper mapper, Comparator comparator, HierarchicalStreamWriter writer, MarshallingContext context) { if (comparator != null) { writer.startNode("comparator"); - writer.addAttribute( - mapper.aliasForSystemAttribute("class"), - mapper.serializedClass(comparator.getClass())); + writer.addAttribute(mapper.aliasForSystemAttribute("class"), mapper.serializedClass(comparator.getClass())); context.convertAnother(comparator); writer.endNode(); } @@ -94,8 +86,7 @@ protected static void marshalComparator( public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { TreeMap result = null; @SuppressWarnings("unchecked") - final Comparator comparator = - unmarshalComparator(mapper(), reader, context, result); + final Comparator comparator = unmarshalComparator(mapper(), reader, context, result); if (result == null) { result = comparator == null ? new TreeMap<>() : new TreeMap<>(comparator); } @@ -104,10 +95,7 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co } protected static Comparator unmarshalComparator( - Mapper mapper, - HierarchicalStreamReader reader, - UnmarshallingContext context, - TreeMap result) { + Mapper mapper, HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result) { final Comparator comparator; if (reader.hasMoreChildren()) { reader.moveDown(); @@ -128,17 +116,13 @@ protected static Comparator unmarshalComparator( } protected void populateTreeMap( - HierarchicalStreamReader reader, - UnmarshallingContext context, - TreeMap result, - Comparator comparator) { + HierarchicalStreamReader reader, UnmarshallingContext context, TreeMap result, Comparator comparator) { boolean inFirstElement = comparator == NULL_MARKER; if (inFirstElement) { comparator = null; } SortedMap sortedMap = - new PresortedMap( - comparator != null && JVM.hasOptimizedTreeMapPutAll() ? comparator : null); + new PresortedMap(comparator != null && JVM.hasOptimizedTreeMapPutAll() ? comparator : null); if (inFirstElement) { // we are already within the first entry putCurrentEntryIntoMap(reader, context, result, sortedMap); diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/TreeSetConverter.java b/geowebcache/core/src/main/java/org/geowebcache/io/TreeSetConverter.java index 2cdc4a5913..e931da0f2b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/TreeSetConverter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/TreeSetConverter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -37,13 +36,12 @@ import java.util.TreeSet; /** - * Converts a java.util.TreeSet to XML, and serializes the associated java.util.Comparator. The - * converter assumes that the elements in the XML are already sorted according the comparator. + * Converts a java.util.TreeSet to XML, and serializes the associated java.util.Comparator. The converter assumes that + * the elements in the XML are already sorted according the comparator. * - *

Cloned from XStream in order to avoid illegal reflective lookup warnings, might introduce - * loading issues if there are circular references stored in the TreeSet. We don't have those right - * now, the alternative would be open the java.util package for deep reflection from the command - * line + *

Cloned from XStream in order to avoid illegal reflective lookup warnings, might introduce loading issues if there + * are circular references stored in the TreeSet. We don't have those right now, the alternative would be open the + * java.util package for deep reflection from the command line * * @author Joe Walnes * @author Jörg Schaible @@ -54,8 +52,7 @@ public TreeSetConverter(Mapper mapper) { } @Override - public void marshal( - Object source, HierarchicalStreamWriter writer, MarshallingContext context) { + public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { SortedSet sortedSet = (SortedSet) source; TreeMapConverter.marshalComparator(mapper(), sortedSet.comparator(), writer, context); super.marshal(source, writer, context); diff --git a/geowebcache/core/src/main/java/org/geowebcache/io/XMLBuilder.java b/geowebcache/core/src/main/java/org/geowebcache/io/XMLBuilder.java index d44714909e..93a1c93442 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/io/XMLBuilder.java +++ b/geowebcache/core/src/main/java/org/geowebcache/io/XMLBuilder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, Copyright 2014 */ @@ -123,8 +122,7 @@ public XMLBuilder endElement() throws IOException { /** * End an XML element * - * @param name if not null and assertions are enabled, will check that the element being closed - * has this name. + * @param name if not null and assertions are enabled, will check that the element being closed has this name. * @throws IOException thrown if the underlying Appendable throws IOException */ public XMLBuilder endElement(@Nullable String name) throws IOException { @@ -152,8 +150,7 @@ public XMLBuilder endElement(@Nullable String name) throws IOException { * * @throws IOException thrown if the underlying Appendable throws IOException */ - public XMLBuilder simpleElement(String name, @Nullable String text, boolean indent) - throws IOException { + public XMLBuilder simpleElement(String name, @Nullable String text, boolean indent) throws IOException { return startElement(name, indent).text(text).endElement(); } @@ -232,8 +229,7 @@ public XMLBuilder bboxAttributes(T minx, T miny, T maxx, T maxy) throws IOEx } /** Add a BoundingBox element */ - public XMLBuilder boundingBox(@Nullable String srs, T minx, T miny, T maxx, T maxy) - throws IOException { + public XMLBuilder boundingBox(@Nullable String srs, T minx, T miny, T maxx, T maxy) throws IOException { indentElement("BoundingBox"); if (srs != null) attribute("SRS", srs); bboxAttributes(minx, miny, maxx, maxy); diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/AbstractTileLayer.java b/geowebcache/core/src/main/java/org/geowebcache/layer/AbstractTileLayer.java index edc5a026df..6cdaf7ffdf 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/AbstractTileLayer.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/AbstractTileLayer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -49,7 +48,8 @@ public abstract class AbstractTileLayer extends TileLayer { private static final int[] DEFAULT_METATILING_FACTORS = {1, 1}; - @Nullable protected String blobStoreId; + @Nullable + protected String blobStoreId; protected Boolean enabled; @@ -213,8 +213,7 @@ public Set getGridSubsets() { } /** - * Initializes the layer, creating internal structures for calculating grid location and so - * forth. + * Initializes the layer, creating internal structures for calculating grid location and so forth. * *

Subclasses shall implement {@link #initializeInternal(GridSetBroker)} for anything else */ @@ -390,8 +389,8 @@ public boolean isQueryable() { } /** - * The timeout used when querying the backend server. The same value is used for both the - * connection and the data timeout, so in theory the timeout could be twice this value. + * The timeout used when querying the backend server. The same value is used for both the connection and the data + * timeout, so in theory the timeout could be twice this value. */ @Override public Integer getBackendTimeout() { diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/BadTileException.java b/geowebcache/core/src/main/java/org/geowebcache/layer/BadTileException.java index eb30a7271d..57131b8175 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/BadTileException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/BadTileException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/EmptyTileException.java b/geowebcache/core/src/main/java/org/geowebcache/layer/EmptyTileException.java index 8eec5b2bbc..8ed24ae956 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/EmptyTileException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/EmptyTileException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2022 */ @@ -19,9 +18,9 @@ import org.geowebcache.mime.MimeType; /** - * Exception used to indicate no contents was found, but the tile was inside the bounds of the - * layer. The tile is considered empty, depending on the format that might need a 204, no content, - * or a 200 with a valid empty tile for the chosen mime type. + * Exception used to indicate no contents was found, but the tile was inside the bounds of the layer. The tile is + * considered empty, depending on the format that might need a 204, no content, or a 200 with a valid empty tile for the + * chosen mime type. */ public class EmptyTileException extends GeoWebCacheException { @@ -29,18 +28,15 @@ public class EmptyTileException extends GeoWebCacheException { private ByteArrayResource contents; /** - * An empty tile was found, the result contents are provided (e..g., a valid empty tile in the - * specified format). Should return a 200. + * An empty tile was found, the result contents are provided (e..g., a valid empty tile in the specified format). + * Should return a 200. */ public EmptyTileException(MimeType mime, ByteArrayResource contents) { this(mime); this.contents = contents; } - /** - * An empty tile was found, but no contents are provided. The caller should return a 204, no - * content. - */ + /** An empty tile was found, but no contents are provided. The caller should return a 204, no content. */ public EmptyTileException(MimeType mime) { super("No tile data available for this location"); this.mime = mime; diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/ExpirationRule.java b/geowebcache/core/src/main/java/org/geowebcache/layer/ExpirationRule.java index 4feb0127f6..9ce6447f83 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/ExpirationRule.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/ExpirationRule.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/LayerListenerList.java b/geowebcache/core/src/main/java/org/geowebcache/layer/LayerListenerList.java index 25cafa1fdd..d908839661 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/LayerListenerList.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/LayerListenerList.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/MetaTile.java b/geowebcache/core/src/main/java/org/geowebcache/layer/MetaTile.java index 3ea06a896b..72cbb98213 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/MetaTile.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/MetaTile.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -121,9 +120,8 @@ public class MetaTile implements TileResponseReceiver { /** * The the request format is the format used for the request to the backend. * - *

The response format is what the tiles are actually saved as. The primary example is to use - * image/png or image/tiff for backend requests, and then save the resulting tiles to JPEG to - * avoid loss of quality. + *

The response format is what the tiles are actually saved as. The primary example is to use image/png or + * image/tiff for backend requests, and then save the resulting tiles to JPEG to avoid loss of quality. */ public MetaTile( GridSubset gridSubset, @@ -140,9 +138,7 @@ public MetaTile( this.metaY = metaY; this.gutterConfig = responseFormat.isVector() || gutter == null ? 0 : gutter.intValue(); - metaGridCov = - calculateMetaTileGridBounds( - gridSubset.getCoverage((int) tileGridPosition[2]), tileGridPosition); + metaGridCov = calculateMetaTileGridBounds(gridSubset.getCoverage((int) tileGridPosition[2]), tileGridPosition); tilesGridPositions = calculateTilesGridPositions(); calculateEdgeGutter(); int tileHeight = gridSubset.getTileHeight(); @@ -155,8 +151,8 @@ public MetaTile( * *

Adding a gutter should be really easy, just add to all sides, right ? * - *

But GeoServer / GeoTools, and possibly other WMS servers, can get mad if we exceed 180,90 - * (or the equivalent for other projections), so we'lll treat those with special care. + *

But GeoServer / GeoTools, and possibly other WMS servers, can get mad if we exceed 180,90 (or the equivalent + * for other projections), so we'lll treat those with special care. */ protected void calculateEdgeGutter() { @@ -259,21 +255,15 @@ public void setImageBytes(Resource buffer) throws GeoWebCacheException { try { // ImageIO.read closes the stream, and the stream throws exception on second close call @SuppressWarnings("PMD.CloseResource") - ImageInputStream imgStream = - new ResourceImageInputStream(((ByteArrayResource) buffer).getInputStream()); + ImageInputStream imgStream = new ResourceImageInputStream(((ByteArrayResource) buffer).getInputStream()); RenderedImage metaTiledImage = ImageIO.read(imgStream); // read closes the stream for us setImage(metaTiledImage); } catch (IOException ioe) { throw new GeoWebCacheException( - "WMSMetaTile.setImageBytes() " - + "failed on ImageIO.read(byte[" - + buffer.getSize() - + "])", - ioe); + "WMSMetaTile.setImageBytes() " + "failed on ImageIO.read(byte[" + buffer.getSize() + "])", ioe); } if (metaTileImage == null) { - throw new GeoWebCacheException( - "ImageIO.read(InputStream) returned null. Unable to read image."); + throw new GeoWebCacheException("ImageIO.read(InputStream) returned null. Unable to read image."); } } @@ -282,8 +272,8 @@ public void setImage(RenderedImage metaTiledImage) { } /** - * Cuts the metaTile into the specified number of tiles, the actual number of tiles is - * determined by metaX and metaY, not the width and height provided here. + * Cuts the metaTile into the specified number of tiles, the actual number of tiles is determined by metaX and + * metaY, not the width and height provided here. * * @param tileWidth width of each tile * @param tileHeight height of each tile @@ -313,26 +303,23 @@ private Rectangle[] createTiles(int tileHeight, int tileWidth) { * @param tileHeight height of the tile * @return a rendered image of the specified meta tile region */ - public RenderedImage createTile( - final int minX, final int minY, final int tileWidth, final int tileHeight) { + public RenderedImage createTile(final int minX, final int minY, final int tileWidth, final int tileHeight) { // optimize if we get a bufferedimage if (metaTileImage instanceof BufferedImage) { - BufferedImage subimage = - ((BufferedImage) metaTileImage).getSubimage(minX, minY, tileWidth, tileHeight); + BufferedImage subimage = ((BufferedImage) metaTileImage).getSubimage(minX, minY, tileWidth, tileHeight); return new BufferedImageAdapter(subimage); } // do a crop, and then turn it into a buffered image so that we can release // the image chain - PlanarImage cropped = - CropDescriptor.create( - metaTileImage, - Float.valueOf(minX), - Float.valueOf(minY), - Float.valueOf(tileWidth), - Float.valueOf(tileHeight), - NO_CACHE); + PlanarImage cropped = CropDescriptor.create( + metaTileImage, + Float.valueOf(minX), + Float.valueOf(minY), + Float.valueOf(tileWidth), + Float.valueOf(tileHeight), + NO_CACHE); if (nativeAccelAvailable()) { log.finer("created cropped tile"); return cropped; @@ -364,8 +351,7 @@ public boolean writeTileToStream(final int tileIdx, Resource target) throws IOEx } Rectangle tileRegion = tiles[tileIdx]; - RenderedImage tile = - createTile(tileRegion.x, tileRegion.y, tileRegion.width, tileRegion.height); + RenderedImage tile = createTile(tileRegion.x, tileRegion.y, tileRegion.width, tileRegion.height); disposeLater(tile); // TODO should we recycle the writers ? @@ -398,17 +384,12 @@ protected void disposeLater(RenderedImage tile) { } public String debugString() { - return " metaX: " - + metaX - + " metaY: " - + metaY - + " metaGridCov: " - + Arrays.toString(metaGridCov); + return " metaX: " + metaX + " metaY: " + metaY + " metaGridCov: " + Arrays.toString(metaGridCov); } /** - * Figures out the bounds of the metatile, in terms of the gridposition of all contained tiles. - * To get the BBOX you need to add one tilewidth to the top and right. + * Figures out the bounds of the metatile, in terms of the gridposition of all contained tiles. To get the BBOX you + * need to add one tilewidth to the top and right. * *

It also updates metaX and metaY to the actual metatiling factors */ @@ -478,10 +459,7 @@ public MimeType getRequestFormat() { } } - /** - * Should be called as soon as the meta tile is no longer needed in order to dispose any held - * resource - */ + /** Should be called as soon as the meta tile is no longer needed in order to dispose any held resource */ public void dispose() { if (metaTileImage == null) { return; diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/ProxyLayer.java b/geowebcache/core/src/main/java/org/geowebcache/layer/ProxyLayer.java index cdfa30e178..c2e963d2fe 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/ProxyLayer.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/ProxyLayer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Andrea Aime, GeoSolutions, Copyright 2014 */ @@ -18,8 +17,7 @@ import org.geowebcache.conveyor.ConveyorTile; /** - * Implemented by layers that are able to cascade requests (such as the WMS ones) to the underlying - * back-end + * Implemented by layers that are able to cascade requests (such as the WMS ones) to the underlying back-end * * @author Andrea Aime - GeoSolutions */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/ResourceImageInputStream.java b/geowebcache/core/src/main/java/org/geowebcache/layer/ResourceImageInputStream.java index 816f12883b..7b81a5d1e3 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/ResourceImageInputStream.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/ResourceImageInputStream.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/SecurityDispatcherTileLayerDispatcherFilter.java b/geowebcache/core/src/main/java/org/geowebcache/layer/SecurityDispatcherTileLayerDispatcherFilter.java index 99f66785d8..0426cab0d6 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/SecurityDispatcherTileLayerDispatcherFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/SecurityDispatcherTileLayerDispatcherFilter.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author David Blasby, GeoCat, Copyright 2022 */ @@ -25,8 +24,7 @@ public SecurityDispatcherTileLayerDispatcherFilter(SecurityDispatcher securityDi } /** - * This uses the GWC SecurityDispatcher#checkSecurity to determine if the user has access to the - * layer. + * This uses the GWC SecurityDispatcher#checkSecurity to determine if the user has access to the layer. * * @param tileLayer * @return true if the user doesn't have access to layer diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/TileJSONProvider.java b/geowebcache/core/src/main/java/org/geowebcache/layer/TileJSONProvider.java index c9205ebdc7..d51b693031 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/TileJSONProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/TileJSONProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2021 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayer.java b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayer.java index dc069bff5e..9f70d1924c 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayer.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -57,8 +56,7 @@ /** * "Pure virtual" base class for Layers. * - *

Represents at the same time the configuration of a tiled layer and a way to access each stored - * tile + *

Represents at the same time the configuration of a tiled layer and a way to access each stored tile */ public abstract class TileLayer implements Info { @@ -86,8 +84,8 @@ public abstract class TileLayer implements Info { public abstract String getId(); /** - * @return the identifier for the blob store that manages this layer tiles, or {@code null} if - * the default blob store shall be used + * @return the identifier for the blob store that manages this layer tiles, or {@code null} if the default blob + * store shall be used */ @Nullable public abstract String getBlobStoreId(); @@ -120,8 +118,8 @@ public abstract class TileLayer implements Info { public abstract LayerMetaInformation getMetaInformation(); /** - * List of Metadata URLs for the layer, subclasses should override this method if they support - * declaring metaddata URLs + * List of Metadata URLs for the layer, subclasses should override this method if they support declaring metaddata + * URLs */ public List getMetadataURLs() { return null; @@ -143,8 +141,8 @@ public List getMetadataURLs() { public abstract boolean useETags(); /** - * The normal way of getting a single tile from the layer. Under the hood, this may result in - * several tiles being requested and stored before returning. + * The normal way of getting a single tile from the layer. Under the hood, this may result in several tiles being + * requested and stored before returning. */ public abstract ConveyorTile getTile(ConveyorTile tile) throws GeoWebCacheException, IOException, OutsideCoverageException; @@ -153,16 +151,14 @@ public abstract ConveyorTile getTile(ConveyorTile tile) public abstract ConveyorTile getNoncachedTile(ConveyorTile tile) throws GeoWebCacheException; /** */ - public abstract void seedTile(ConveyorTile tile, boolean tryCache) - throws GeoWebCacheException, IOException; + public abstract void seedTile(ConveyorTile tile, boolean tryCache) throws GeoWebCacheException, IOException; /** - * This is a more direct way of requesting a tile without invoking metatiling, and should not be - * used in general. The method was exposed to let the KML service traverse the tree ahead of the - * client, to avoid linking to empty tiles. + * This is a more direct way of requesting a tile without invoking metatiling, and should not be used in general. + * The method was exposed to let the KML service traverse the tree ahead of the client, to avoid linking to empty + * tiles. */ - public abstract ConveyorTile doNonMetatilingRequest(ConveyorTile tile) - throws GeoWebCacheException; + public abstract ConveyorTile doNonMetatilingRequest(ConveyorTile tile) throws GeoWebCacheException; public abstract List getFormatModifiers(); @@ -191,8 +187,8 @@ public Map getLayerLegendsInf public abstract boolean isQueryable(); /** - * The timeout used when querying the backend server. The same value is used for both the - * connection and the data timeout, so in theory the timeout could be twice this value. + * The timeout used when querying the backend server. The same value is used for both the connection and the data + * timeout, so in theory the timeout could be twice this value. */ public abstract Integer getBackendTimeout(); @@ -224,16 +220,13 @@ public Map getLayerLegendsInf public abstract List getRequestFilters(); - /** - * Initializes the layer, creating internal structures for calculating grid location and so - * forth. - */ + /** Initializes the layer, creating internal structures for calculating grid location and so forth. */ public abstract boolean initialize(GridSetBroker gridSetBroker); /** - * Returns the first grid subset matching the specified SRS. A layer can have more than one - * gridset for a given SRS, if all the informations are available, it's better to use use {@link - * #getGridSubsetsForSRS(SRS)} in combination with {@link GridUtil#findBestMatchingGrid} instead + * Returns the first grid subset matching the specified SRS. A layer can have more than one gridset for a given SRS, + * if all the informations are available, it's better to use use {@link #getGridSubsetsForSRS(SRS)} in combination + * with {@link GridUtil#findBestMatchingGrid} instead */ public GridSubset getGridSubsetForSRS(SRS srs) { for (String gridSet : getGridSubsets()) { @@ -247,8 +240,8 @@ public GridSubset getGridSubsetForSRS(SRS srs) { } /** - * Returns an immutable list of all the layer's {@link GridSubset} whose {@link GridSet} has a - * SRS equal to {@code srs} (may be an alias), or the empty list of none matches. + * Returns an immutable list of all the layer's {@link GridSubset} whose {@link GridSet} has a SRS equal to + * {@code srs} (may be an alias), or the empty list of none matches. */ public List getGridSubsetsForSRS(SRS srs) { List matches = Collections.emptyList(); @@ -279,16 +272,13 @@ public boolean supportsFormat(String strFormat) throws GeoWebCacheException { } // REVISIT: why not simply return false if this is a query method?! - throw new GeoWebCacheException( - "Format " + strFormat + " is not supported by " + this.getName()); + throw new GeoWebCacheException("Format " + strFormat + " is not supported by " + this.getName()); } /** GetFeatureInfo template, throws exception, subclasses must override if supported. */ - public Resource getFeatureInfo( - ConveyorTile convTile, BoundingBox bbox, int height, int width, int x, int y) + public Resource getFeatureInfo(ConveyorTile convTile, BoundingBox bbox, int height, int width, int x, int y) throws GeoWebCacheException { - throw new GeoWebCacheException( - "GetFeatureInfo is not supported by this layer (" + getName() + ")"); + throw new GeoWebCacheException("GetFeatureInfo is not supported by this layer (" + getName() + ")"); } /** @return the resolutions (units/pixel) for the layer */ @@ -324,12 +314,8 @@ public MimeType getDefaultMimeType() { return getMimeTypes().get(0); } - /** - * Converts the given bounding box into the closest location on the grid supported by the - * reference system. - */ - public long[] indexFromBounds(String gridSetId, BoundingBox tileBounds) - throws GridMismatchException { + /** Converts the given bounding box into the closest location on the grid supported by the reference system. */ + public long[] indexFromBounds(String gridSetId, BoundingBox tileBounds) throws GridMismatchException { return getGridSubset(gridSetId).closestIndex(tileBounds); } @@ -378,8 +364,8 @@ public void applyRequestFilters(ConveyorTile convTile) throws RequestFilterExcep } /** - * @return default parameter filters, with keys normalized to upper case, or an empty map if no - * parameter filters are defined + * @return default parameter filters, with keys normalized to upper case, or an empty map if no parameter filters + * are defined */ public Map getDefaultParameterFilters() { if (defaultParameterFilterValues == null) { @@ -400,10 +386,10 @@ public Map getDefaultParameterFilters() { } /** - * @param map keys are parameter names, values are either a single string or an array of strings - * as they come form httpservletrequest - * @return Set of parameter filter keys and values, with keys normalized to upper case, or empty - * map if they match the layer's parameter filters default values + * @param map keys are parameter names, values are either a single string or an array of strings as they come form + * httpservletrequest + * @return Set of parameter filter keys and values, with keys normalized to upper case, or empty map if they match + * the layer's parameter filters default values * @throws GeoWebCacheException if {@link ParameterFilter#apply(String)} does */ public Map getModifiableParameters(Map map, String encoding) @@ -418,8 +404,7 @@ public Map getModifiableParameters(Map map, String en final String[] keys = parameterFilters.stream().map(ParameterFilter::getKey).toArray(i -> new String[i]); - final Map requestValues = - ServletUtils.selectedStringsFromMap(map, encoding, keys); + final Map requestValues = ServletUtils.selectedStringsFromMap(map, encoding, keys); final Map defaultValues = getDefaultParameterFilters(); @@ -429,9 +414,7 @@ public Map getModifiableParameters(Map map, String en value = decodeDimensionValue(value); String defaultValue = defaultValues.get(key); - if (value == null - || value.length() == 0 - || (defaultValue != null && defaultValue.equals(value))) { + if (value == null || value.length() == 0 || (defaultValue != null && defaultValue.equals(value))) { fullParameters.put(key, defaultValue); } else { String appliedValue = parameterFilter.apply(value); @@ -489,8 +472,7 @@ protected ByteArrayResource getImageBuffer(ThreadLocal tl) { } /** Loops over the gridPositions, generates cache keys and saves to cache */ - protected void saveTiles(MetaTile metaTile, ConveyorTile tileProto, long requestTime) - throws GeoWebCacheException { + protected void saveTiles(MetaTile metaTile, ConveyorTile tileProto, long requestTime) throws GeoWebCacheException { final long[][] gridPositions = metaTile.getTilesGridPositions(); final long[] gridLoc = tileProto.getTileIndex(); @@ -523,21 +505,18 @@ protected void saveTiles(MetaTile metaTile, ConveyorTile tileProto, long request try { boolean completed = metaTile.writeTileToStream(i, resource); if (!completed) { - log.log( - Level.SEVERE, - "metaTile.writeTileToStream returned false, no tiles saved"); + log.log(Level.SEVERE, "metaTile.writeTileToStream returned false, no tiles saved"); } if (store) { long[] idx = {gridPos[0], gridPos[1], gridPos[2]}; - TileObject tile = - TileObject.createCompleteTileObject( - this.getName(), - idx, - tileProto.getGridSetId(), - tileProto.getMimeType().getFormat(), - tileProto.getParameters(), - resource); + TileObject tile = TileObject.createCompleteTileObject( + this.getName(), + idx, + tileProto.getGridSetId(), + tileProto.getMimeType().getFormat(), + tileProto.getParameters(), + resource); tile.setCreated(requestTime); try { @@ -552,10 +531,7 @@ protected void saveTiles(MetaTile metaTile, ConveyorTile tileProto, long request } } } catch (IOException ioe) { - log.log( - Level.SEVERE, - "Unable to write image tile to " + "ByteArrayOutputStream", - ioe); + log.log(Level.SEVERE, "Unable to write image tile to " + "ByteArrayOutputStream", ioe); } } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcher.java b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcher.java index df82f2e3f6..7926e3cb19 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcher.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcher.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -48,9 +47,7 @@ import org.springframework.context.ApplicationContextAware; import org.springframework.util.Assert; -/** - * Serves tile layers from the {@link TileLayerConfiguration}s available in the application context. - */ +/** Serves tile layers from the {@link TileLayerConfiguration}s available in the application context. */ public class TileLayerDispatcher implements DisposableBean, InitializingBean, @@ -68,9 +65,8 @@ public class TileLayerDispatcher private ApplicationContext applicationContext; /** - * Used for testing only, in production use {@link #TileLayerDispatcher(GridSetBroker)} instead, - * configurations are loaded from the application context, the {@code config} parameter will be - * overwritten + * Used for testing only, in production use {@link #TileLayerDispatcher(GridSetBroker)} instead, configurations are + * loaded from the application context, the {@code config} parameter will be overwritten */ public TileLayerDispatcher( GridSetBroker gridSetBroker, @@ -81,8 +77,7 @@ public TileLayerDispatcher( this.tileLayerDispatcherFilter = tileLayerDispatcherFilter; } - public TileLayerDispatcher( - GridSetBroker gridSetBroker, TileLayerDispatcherFilter tileLayerDispatcherFilter) { + public TileLayerDispatcher(GridSetBroker gridSetBroker, TileLayerDispatcherFilter tileLayerDispatcherFilter) { this.gridSetBroker = gridSetBroker; this.tileLayerDispatcherFilter = tileLayerDispatcherFilter; } @@ -111,13 +106,12 @@ public TileLayer getTileLayer(final String layerName) throws GeoWebCacheExceptio return layer.get(); } } - throw new GeoWebCacheException( - "Thread " - + Thread.currentThread().getName() - + " Unknown layer " - + layerName - + ". Check the logfiles," - + " it may not have loaded properly."); + throw new GeoWebCacheException("Thread " + + Thread.currentThread().getName() + + " Unknown layer " + + layerName + + ". Check the logfiles," + + " it may not have loaded properly."); } public int getLayerCount() { @@ -139,8 +133,7 @@ public Set getLayerNames() { /** * Returns a list of all the layers. The consumer may still have to initialize each layer! * - *

Modifications to the returned layer do not change the internal list of layers, but layers - * ARE mutable. + *

Modifications to the returned layer do not change the internal list of layers, but layers ARE mutable. * * @return a list view of this tile layer dispatcher's internal layers */ @@ -165,9 +158,8 @@ public Iterable getLayerList() { public Iterable getLayerListFiltered() { Iterable result = getLayerList(); if (tileLayerDispatcherFilter != null) { - Stream s = - StreamSupport.stream(result.spliterator(), false) - .filter(x -> !tileLayerDispatcherFilter.exclude(x)); + Stream s = StreamSupport.stream(result.spliterator(), false) + .filter(x -> !tileLayerDispatcherFilter.exclude(x)); result = s::iterator; } return result; @@ -189,8 +181,7 @@ public void destroy() throws Exception { } /** - * Finds out which {@link TileLayerConfiguration} contains the given layer, removes it, and - * saves the configuration. + * Finds out which {@link TileLayerConfiguration} contains the given layer, removes it, and saves the configuration. * * @param layerName the name of the layer to remove */ @@ -208,8 +199,8 @@ public synchronized void removeLayer(final String layerName) throws IllegalArgum * Adds a layer and returns the {@link TileLayerConfiguration} to which the layer was added. * * @param tl the layer to add - * @throws IllegalArgumentException if the given tile layer can't be added to any configuration - * managed by this tile layer dispatcher. + * @throws IllegalArgumentException if the given tile layer can't be added to any configuration managed by this tile + * layer dispatcher. */ public synchronized void addLayer(final TileLayer tl) throws IllegalArgumentException { for (TileLayerConfiguration c : configs) { @@ -249,20 +240,17 @@ public TileLayerConfiguration getConfiguration(TileLayer tl) throws IllegalArgum return getConfiguration(tl.getName()); } - public TileLayerConfiguration getConfiguration(final String tileLayerName) - throws IllegalArgumentException { + public TileLayerConfiguration getConfiguration(final String tileLayerName) throws IllegalArgumentException { Assert.notNull(tileLayerName, "tileLayerName is null"); for (TileLayerConfiguration c : configs) { if (c.containsLayer(tileLayerName)) { return c; } } - throw new IllegalArgumentException( - "No configuration found containing layer " + tileLayerName); + throw new IllegalArgumentException("No configuration found containing layer " + tileLayerName); } - public synchronized void addGridSet(final GridSet gridSet) - throws IllegalArgumentException, IOException { + public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker.get(gridSet.getName())) { throw new IllegalArgumentException("GridSet " + gridSet.getName() + " already exists"); } @@ -276,8 +264,7 @@ private void saveGridSet(final GridSet gridSet) throws IOException { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMatch(g -> Objects.nonNull(g.getGridSubset(gridsetToRemove)))) { - throw new IllegalStateException( - "Can not remove gridset " + gridsetToRemove + " as it is used by layers"); + throw new IllegalStateException("Can not remove gridset " + gridsetToRemove + " as it is used by layers"); } gridSetBroker.removeGridSet(gridsetToRemove); } @@ -292,10 +279,8 @@ public synchronized void removeGridSetRecursive(String gridsetToRemove) { } } } catch (NoSuchElementException e) { - IllegalStateException wrappedException = - new IllegalStateException( - "Layer was found referencing gridset but was missing during recursive delete", - e); + IllegalStateException wrappedException = new IllegalStateException( + "Layer was found referencing gridset but was missing during recursive delete", e); try { deletedLayers.forEach(this::addLayer); } catch (RuntimeException exceptionOnRestore) { @@ -322,26 +307,19 @@ public List getConfigurations(Cl if (clazz == TileLayerConfiguration.class) { return (List) Collections.unmodifiableList(configs); } else { - return configs.stream() - .filter(clazz::isInstance) - .map(clazz::cast) - .collect(Collectors.toList()); + return configs.stream().filter(clazz::isInstance).map(clazz::cast).collect(Collectors.toList()); } } @Override public void afterPropertiesSet() throws Exception { - this.configs = - GeoWebCacheExtensions.configurations( - TileLayerConfiguration.class, applicationContext); + this.configs = GeoWebCacheExtensions.configurations(TileLayerConfiguration.class, applicationContext); - Map config = - applicationContext.getBeansOfType(BaseConfiguration.class); + Map config = applicationContext.getBeansOfType(BaseConfiguration.class); if (config != null && !config.isEmpty()) { for (Entry e : config.entrySet()) { if (ServerConfiguration.class.isAssignableFrom(e.getValue().getClass())) { - setServiceInformation( - ((ServerConfiguration) e.getValue()).getServiceInformation()); + setServiceInformation(((ServerConfiguration) e.getValue()).getServiceInformation()); } } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcherFilter.java b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcherFilter.java index 5d739f7acb..7ddfafe195 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcherFilter.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerDispatcherFilter.java @@ -1,22 +1,20 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author David Blasby, GeoCat, Copyright 2022 */ package org.geowebcache.layer; /** - * Filter interface for the TileLayerDispatcher. This allows layers to be excluded from the list of - * available layers. + * Filter interface for the TileLayerDispatcher. This allows layers to be excluded from the list of available layers. */ public interface TileLayerDispatcherFilter { diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerListener.java b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerListener.java index 997c8e45b3..0930c9959d 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerListener.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/TileLayerListener.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/TileResponseReceiver.java b/geowebcache/core/src/main/java/org/geowebcache/layer/TileResponseReceiver.java index 50d15a1a30..f9f23179b5 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/TileResponseReceiver.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/TileResponseReceiver.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/ContactInformation.java b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/ContactInformation.java index 1f56b1a010..615298cd46 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/ContactInformation.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/ContactInformation.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2010 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/LayerMetaInformation.java b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/LayerMetaInformation.java index 454e12fec6..85dc495b61 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/LayerMetaInformation.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/LayerMetaInformation.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -31,10 +30,7 @@ public class LayerMetaInformation { } public LayerMetaInformation( - String title, - String description, - List keywords, - List contacts) { + String title, String description, List keywords, List contacts) { this.title = title; this.description = description; this.keywords = keywords; diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/MetadataURL.java b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/MetadataURL.java index a31302f016..6e8004d782 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/MetadataURL.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/MetadataURL.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/TileJSON.java b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/TileJSON.java index 4c2a308fb4..14cf14ed44 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/TileJSON.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/TileJSON.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2021 */ @@ -20,9 +19,8 @@ import java.util.List; /** - * Represents a TileJSON v 3.0 object, see also - * https://github.com/mapbox/tilejson-spec/tree/3.0/3.0.0 (it's a draft of a spec that has explicit - * support for layers and attributes) + * Represents a TileJSON v 3.0 object, see also https://github.com/mapbox/tilejson-spec/tree/3.0/3.0.0 (it's a draft of + * a spec that has explicit support for layers and attributes) */ @JsonInclude(JsonInclude.Include.NON_EMPTY) public class TileJSON { diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/VectorLayerMetadata.java b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/VectorLayerMetadata.java index a6420e4cc5..da7f86ca69 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/meta/VectorLayerMetadata.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/meta/VectorLayerMetadata.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2021 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/GeoRSSFeedDefinition.java b/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/GeoRSSFeedDefinition.java index a2cb1af706..35f06d11d7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/GeoRSSFeedDefinition.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/GeoRSSFeedDefinition.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2010 */ @@ -37,8 +36,8 @@ public class GeoRSSFeedDefinition extends UpdateSourceDefinition { private Integer maxMaskLevel; /** - * The maximum zoom level which to create a backing tile mask for to track the tiles affected by - * the feed geometries; defaults to {@code 10} + * The maximum zoom level which to create a backing tile mask for to track the tiles affected by the feed + * geometries; defaults to {@code 10} */ public int getMaxMaskLevel() { return maxMaskLevel == null ? 10 : maxMaskLevel.intValue(); @@ -60,26 +59,22 @@ public GWCTask.TYPE getOperation() { return GWCTask.TYPE.TRUNCATE; } - /** - * Number of threads to spawn to seed based on the results of the GeoRSS feed; default to {@code - * 1} if not set - */ + /** Number of threads to spawn to seed based on the results of the GeoRSS feed; default to {@code 1} if not set */ public int getSeedingThreads() { return seedingThreads == null ? 1 : seedingThreads.intValue(); } /** - * The URL to the feed. I think we should use templating for parameters, so in the initial - * implementation we search the string for {lastEntryId} and replace any occurrences with the - * actual last entry id. + * The URL to the feed. I think we should use templating for parameters, so in the initial implementation we search + * the string for {lastEntryId} and replace any occurrences with the actual last entry id. */ public String getFeedUrl() { return feedUrl; } /** - * The format for which to truncate / reseed. If you omit this parameter all supported formats - * will be truncated / reseeded. + * The format for which to truncate / reseed. If you omit this parameter all supported formats will be truncated / + * reseeded. */ public String getFormat() { return format; diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/UpdateSourceDefinition.java b/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/UpdateSourceDefinition.java index 441cf51508..fc582970a0 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/UpdateSourceDefinition.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/updatesource/UpdateSourceDefinition.java @@ -1,21 +1,19 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2010 */ package org.geowebcache.layer.updatesource; /** - * This class is not really used, but with XStream it's better to think too far ahead than to update - * the schemas later + * This class is not really used, but with XStream it's better to think too far ahead than to update the schemas later */ public abstract class UpdateSourceDefinition {} diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSHttpHelper.java b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSHttpHelper.java index 782c9bad21..cdc4faae65 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSHttpHelper.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSHttpHelper.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -79,14 +78,8 @@ HttpClient getHttpClient() { return client; } - HttpClientBuilder builder = - new HttpClientBuilder( - null, - getBackendTimeout(), - httpUsername, - httpPassword, - proxyUrl, - getConcurrency()); + HttpClientBuilder builder = new HttpClientBuilder( + null, getBackendTimeout(), httpUsername, httpPassword, proxyUrl, getConcurrency()); client = builder.buildClient(); } @@ -118,8 +111,7 @@ protected void makeRequest( try { wmsBackendUrl = URLs.of(requestUrl); } catch (MalformedURLException maue) { - throw new GeoWebCacheException( - "Malformed URL: " + requestUrl + " " + maue.getMessage()); + throw new GeoWebCacheException("Malformed URL: " + requestUrl + " " + maue.getMessage()); } try { connectAndCheckHeaders( @@ -142,13 +134,10 @@ protected void makeRequest( if (fetchException != null) { msg += " Reason: " + fetchException.getMessage() + ". "; } - msg += - " Last request: '" - + wmsBackendUrl.toString() - + "'. " - + (tileRespRecv.getErrorMessage() == null - ? "" - : tileRespRecv.getErrorMessage()); + msg += " Last request: '" + + wmsBackendUrl.toString() + + "'. " + + (tileRespRecv.getErrorMessage() == null ? "" : tileRespRecv.getErrorMessage()); tileRespRecv.setError(); tileRespRecv.setErrorMessage(msg); @@ -176,16 +165,15 @@ private void connectAndCheckHeaders( responseCode = method.getStatusLine().getStatusCode(); if (responseCode == 200) { if (method.getFirstHeader("length") != null) { - responseLength = Integer.parseInt(method.getFirstHeader("length").getValue()); - } else if (method.getFirstHeader("Content-Length") != null) { responseLength = - Integer.parseInt(method.getFirstHeader("Content-Length").getValue()); + Integer.parseInt(method.getFirstHeader("length").getValue()); + } else if (method.getFirstHeader("Content-Length") != null) { + responseLength = Integer.parseInt( + method.getFirstHeader("Content-Length").getValue()); } else if (method.getEntity() != null) { responseLength = Math.toIntExact(method.getEntity().getContentLength()); } else { - throw new ServiceException( - "Unable to determine response length from: " - + wmsBackendUrl.toString()); + throw new ServiceException("Unable to determine response length from: " + wmsBackendUrl.toString()); } } // Do not set error at this stage @@ -201,17 +189,12 @@ private void connectAndCheckHeaders( if (responseCode != 200 && responseCode != 204) { tileRespRecv.setError(); throw new ServiceException( - "Unexpected response code from backend: " - + responseCode - + " for " - + wmsBackendUrl.toString()); + "Unexpected response code from backend: " + responseCode + " for " + wmsBackendUrl.toString()); } // Check that we're not getting an error MIME back. String responseMime = method.getFirstHeader("Content-Type").getValue(); - if (responseCode != 204 - && responseMime != null - && !requestMimeType.isCompatible(responseMime)) { + if (responseCode != 204 && responseMime != null && !requestMimeType.isCompatible(responseMime)) { String message = null; if (responseMime.equalsIgnoreCase(ErrorMime.vnd_ogc_se_inimage.getFormat())) { // TODO: revisit: I don't understand why it's trying to create a String message @@ -223,22 +206,20 @@ private void connectAndCheckHeaders( } catch (IOException ioe) { // Do nothing } - } else if (responseMime != null - && responseMime.toLowerCase().startsWith("application/vnd.ogc.se_xml")) { + } else if (responseMime != null && responseMime.toLowerCase().startsWith("application/vnd.ogc.se_xml")) { try (InputStream stream = method.getEntity().getContent()) { message = IOUtils.toString(stream, StandardCharsets.UTF_8); } catch (IOException e) { // } } - String msg = - "MimeType mismatch, expected " - + requestMimeType - + " but got " - + responseMime - + " from " - + wmsBackendUrl.toString() - + (message == null ? "" : (":\n" + message)); + String msg = "MimeType mismatch, expected " + + requestMimeType + + " but got " + + responseMime + + " from " + + wmsBackendUrl.toString() + + (message == null ? "" : (":\n" + message)); tileRespRecv.setError(); tileRespRecv.setErrorMessage(msg); log.warning(msg); @@ -267,22 +248,17 @@ private void connectAndCheckHeaders( int readAccu = (int) target.getSize(); if (readAccu != responseLength) { tileRespRecv.setError(); - throw new GeoWebCacheException( - "Responseheader advertised " - + responseLength - + " bytes, but only received " - + readAccu - + " from " - + wmsBackendUrl.toString()); + throw new GeoWebCacheException("Responseheader advertised " + + responseLength + + " bytes, but only received " + + readAccu + + " from " + + wmsBackendUrl.toString()); } } } catch (IOException ioe) { tileRespRecv.setError(); - log.severe( - "Caught IO exception, " - + wmsBackendUrl.toString() - + " " - + ioe.getMessage()); + log.severe("Caught IO exception, " + wmsBackendUrl.toString() + " " + ioe.getMessage()); } } } @@ -293,8 +269,8 @@ private void connectAndCheckHeaders( * @param url endpoint to talk to * @param queryParams parameters for the query string * @param backendTimeout timeout to use in seconds - * @param httpRequestMode the method used to perform requests (can be null, in such case {@link - * org.geowebcache.layer.wms.WMSLayer.HttpRequestMode#Get} will be used + * @param httpRequestMode the method used to perform requests (can be null, in such case + * {@link org.geowebcache.layer.wms.WMSLayer.HttpRequestMode#Get} will be used * @return executed method (that has to be closed after reading the response!) */ public HttpResponse executeRequest( @@ -346,16 +322,12 @@ public HttpResponse executeRequest( return getHttpClient().execute(method); } - private String processRequestParameters(Map parameters) - throws UnsupportedEncodingException { + private String processRequestParameters(Map parameters) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); for (String parameterName : parameters.keySet()) { sb.append(parameterName) .append('=') - .append( - URLEncoder.encode( - parameters.get(parameterName), - StandardCharsets.UTF_8.toString())) + .append(URLEncoder.encode(parameters.get(parameterName), StandardCharsets.UTF_8.toString())) .append('&'); } return sb.substring(0, sb.length() - 1); diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSLayer.java b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSLayer.java index cae8e4ebb2..fe9ec6dbe8 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSLayer.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSLayer.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -129,9 +128,7 @@ public enum HttpRequestMode { // default constructor for XStream } - /** - * Note XStream uses reflection, this is only used for testing and loading from getCapabilities - */ + /** Note XStream uses reflection, this is only used for testing and loading from getCapabilities */ public WMSLayer( String layerName, String[] wmsURL, @@ -173,10 +170,7 @@ protected Object readResolve() { return this; } - /** - * @see - * org.geowebcache.layer.AbstractTileLayer#initializeInternal(org.geowebcache.grid.GridSetBroker) - */ + /** @see org.geowebcache.layer.AbstractTileLayer#initializeInternal(org.geowebcache.grid.GridSetBroker) */ @Override protected boolean initializeInternal(GridSetBroker gridSetBroker) { if (null == this.enabled) { @@ -184,9 +178,8 @@ protected boolean initializeInternal(GridSetBroker gridSetBroker) { } if (null == this.sourceHelper) { - log.config( - this.name - + " is configured without a source, which is a bug unless you're running tests that don't care."); + log.config(this.name + + " is configured without a source, which is a bug unless you're running tests that don't care."); } curWmsURL = 0; @@ -234,8 +227,7 @@ protected boolean initializeInternal(GridSetBroker gridSetBroker) { } @Override - public Resource getFeatureInfo( - ConveyorTile convTile, BoundingBox bbox, int height, int width, int x, int y) + public Resource getFeatureInfo(ConveyorTile convTile, BoundingBox bbox, int height, int width, int x, int y) throws GeoWebCacheException { return sourceHelper.makeFeatureInfoRequest(convTile, bbox, height, width, x, y); } @@ -243,17 +235,15 @@ public Resource getFeatureInfo( /** * The main function * - *

1) Create cache key, test whether we can retrieve without locking 2) Get lock for - * metatile, monitor condition variable if not (Recheck cache after signal) 3) Create metatile - * request, execute 4) Get tiles and save them to cache 5) Unlock metatile, signal other threads - * 6) Set Cache-Control, return tile + *

1) Create cache key, test whether we can retrieve without locking 2) Get lock for metatile, monitor condition + * variable if not (Recheck cache after signal) 3) Create metatile request, execute 4) Get tiles and save them to + * cache 5) Unlock metatile, signal other threads 6) Set Cache-Control, return tile * * @param tile The tile request * @return The resulting tile request */ @Override - public ConveyorTile getTile(ConveyorTile tile) - throws GeoWebCacheException, IOException, OutsideCoverageException { + public ConveyorTile getTile(ConveyorTile tile) throws GeoWebCacheException, IOException, OutsideCoverageException { MimeType mime = tile.getMimeType(); if (mime == null) { @@ -261,8 +251,7 @@ public ConveyorTile getTile(ConveyorTile tile) } if (!formats.contains(mime)) { - throw new GeoWebCacheException( - mime.getFormat() + " is not a supported format for " + name); + throw new GeoWebCacheException(mime.getFormat() + " is not a supported format for " + name); } String tileGridSetId = tile.getGridSetId(); @@ -295,12 +284,10 @@ public ConveyorTile getTile(ConveyorTile tile) /** Used for seeding */ @Override - public void seedTile(ConveyorTile tile, boolean tryCache) - throws GeoWebCacheException, IOException { + public void seedTile(ConveyorTile tile, boolean tryCache) throws GeoWebCacheException, IOException { GridSubset gridSubset = getGridSubset(tile.getGridSetId()); if (gridSubset.shouldCacheAtZoom(tile.getTileIndex()[2])) { - if (tile.getMimeType().supportsTiling() - && (metaWidthHeight[0] > 1 || metaWidthHeight[1] > 1)) { + if (tile.getMimeType().supportsTiling() && (metaWidthHeight[0] > 1 || metaWidthHeight[1] > 1)) { getMetatilingReponse(tile, tryCache); } else { getNonMetatilingReponse(tile, tryCache); @@ -314,8 +301,7 @@ public void seedTile(ConveyorTile tile, boolean tryCache) * @param tile the Tile with all the information * @param tryCache whether to try the cache, or seed */ - private ConveyorTile getMetatilingReponse(ConveyorTile tile, boolean tryCache) - throws GeoWebCacheException { + private ConveyorTile getMetatilingReponse(ConveyorTile tile, boolean tryCache) throws GeoWebCacheException { // int idx = this.getSRSIndex(tile.getSRS()); long[] gridLoc = tile.getTileIndex(); @@ -329,16 +315,15 @@ private ConveyorTile getMetatilingReponse(ConveyorTile tile, boolean tryCache) if (filteringParameters.isEmpty()) { filteringParameters = getDefaultParameterFilters(); } - WMSMetaTile metaTile = - new WMSMetaTile( - this, - gridSubset, - mimeType, - this.getFormatModifier(tile.getMimeType()), - gridLoc, - metaWidthHeight[0], - metaWidthHeight[1], - filteringParameters); + WMSMetaTile metaTile = new WMSMetaTile( + this, + gridSubset, + mimeType, + this.getFormatModifier(tile.getMimeType()), + gridLoc, + metaWidthHeight[0], + metaWidthHeight[1], + filteringParameters); // Leave a hint to save expiration, if necessary if (saveExpirationHeaders) { @@ -372,8 +357,7 @@ private ConveyorTile getMetatilingReponse(ConveyorTile tile, boolean tryCache) sourceHelper.makeRequest(metaTile, buffer); if (metaTile.getError()) { - throw new GeoWebCacheException( - "Empty metatile, error message: " + metaTile.getErrorMessage()); + throw new GeoWebCacheException("Empty metatile, error message: " + metaTile.getErrorMessage()); } if (saveExpirationHeaders) { @@ -427,8 +411,7 @@ private String buildLockKey(ConveyorTile tile, WMSMetaTile metaTile) { * @param tile the Tile with all the information * @param tryCache whether to try the cache, or seed */ - private ConveyorTile getNonMetatilingReponse(ConveyorTile tile, boolean tryCache) - throws GeoWebCacheException { + private ConveyorTile getNonMetatilingReponse(ConveyorTile tile, boolean tryCache) throws GeoWebCacheException { // String debugHeadersStr = null; long[] gridLoc = tile.getTileIndex(); @@ -453,8 +436,7 @@ private ConveyorTile getNonMetatilingReponse(ConveyorTile tile, boolean tryCache tile = doNonMetatilingRequest(tile); - if (tile.getStatus() > 299 - || this.getExpireCache((int) gridLoc[2]) != GWCVars.CACHE_DISABLE_CACHE) { + if (tile.getStatus() > 299 || this.getExpireCache((int) gridLoc[2]) != GWCVars.CACHE_DISABLE_CACHE) { tile.persist(); } @@ -653,8 +635,7 @@ protected String nextWmsURL() { return wmsUrl[curWmsURL]; } - public long[][] getZoomedInGridLoc(String gridSetId, long[] gridLoc) - throws GeoWebCacheException { + public long[][] getZoomedInGridLoc(String gridSetId, long[] gridLoc) throws GeoWebCacheException { return null; } @@ -811,13 +792,11 @@ public void proxyRequest(ConveyorTile tile) throws GeoWebCacheException { WMSSourceHelper helper = getSourceHelper(); if (!(helper instanceof WMSHttpHelper)) { - throw new GeoWebCacheException( - "Can only proxy if WMS Layer is backed by an HTTP backend"); + throw new GeoWebCacheException("Can only proxy if WMS Layer is backed by an HTTP backend"); } httpResponse = - ((WMSHttpHelper) helper) - .executeRequest(url, null, getBackendTimeout(), getHttpRequestMode()); + ((WMSHttpHelper) helper).executeRequest(url, null, getBackendTimeout(), getHttpRequestMode()); HttpEntity entity = httpResponse.getEntity(); try (InputStream is = entity.getContent()) { HttpServletResponse response = tile.servletResp; @@ -859,14 +838,10 @@ public Map getLayerLegendsInf String layerName = wmsLayers == null ? getName() : wmsLayers; return legends == null ? super.getLayerLegendsInfo() - : legends.getLegendsInfo( - layerName, wmsUrl != null && wmsUrl.length > 0 ? wmsUrl[0] : null); + : legends.getLegendsInfo(layerName, wmsUrl != null && wmsUrl.length > 0 ? wmsUrl[0] : null); } - /** - * The request mode used for this layer, defaults to {@link HttpRequestMode#Get} if not set in - * the configuration - */ + /** The request mode used for this layer, defaults to {@link HttpRequestMode#Get} if not set in the configuration */ public HttpRequestMode getHttpRequestMode() { return httpRequestMode == null ? HttpRequestMode.Get : httpRequestMode; } diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSMetaTile.java b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSMetaTile.java index 7a19e1970c..3652f6dbd0 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSMetaTile.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSMetaTile.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -51,8 +50,7 @@ protected WMSMetaTile( } protected Map getWMSParams() throws GeoWebCacheException { - Map params = - wmsLayer.getWMSRequestTemplate(this.getResponseFormat(), WMSLayer.RequestType.MAP); + Map params = wmsLayer.getWMSRequestTemplate(this.getResponseFormat(), WMSLayer.RequestType.MAP); // Fill in the blanks String format; diff --git a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSSourceHelper.java b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSSourceHelper.java index 922f17c255..dd3ea96fcc 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSSourceHelper.java +++ b/geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSSourceHelper.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -27,9 +26,8 @@ import org.geowebcache.util.ServletUtils; /** - * Builds WMS requests to gather a certain tile or meta tile. The actual communication with the - * server is delegated to subclasses (might be a real HTTP request, but also an in process one in - * the case of GeoServer) + * Builds WMS requests to gather a certain tile or meta tile. The actual communication with the server is delegated to + * subclasses (might be a real HTTP request, but also an in process one in the case of GeoServer) */ public abstract class WMSSourceHelper { @@ -58,8 +56,7 @@ public void makeRequest(ConveyorTile tile, Resource target) throws GeoWebCacheEx GridSubset gridSubset = layer.getGridSubset(tile.getGridSetId()); - Map wmsParams = - layer.getWMSRequestTemplate(tile.getMimeType(), WMSLayer.RequestType.MAP); + Map wmsParams = layer.getWMSRequestTemplate(tile.getMimeType(), WMSLayer.RequestType.MAP); wmsParams.put("FORMAT", tile.getMimeType().getFormat()); wmsParams.put("SRS", layer.backendSRSOverride(gridSubset.getSRS())); @@ -88,8 +85,7 @@ public void makeRequest(ConveyorTile tile, Resource target) throws GeoWebCacheEx makeRequest(tile, layer, wmsParams, mimeType, target); } - public Resource makeFeatureInfoRequest( - ConveyorTile tile, BoundingBox bbox, int height, int width, int x, int y) + public Resource makeFeatureInfoRequest(ConveyorTile tile, BoundingBox bbox, int height, int width, int x, int y) throws GeoWebCacheException { WMSLayer layer = (WMSLayer) tile.getLayer(); @@ -117,11 +113,8 @@ public Resource makeFeatureInfoRequest( String featureCount; { - Map values = - ServletUtils.selectedStringsFromMap( - tile.servletReq.getParameterMap(), - tile.servletReq.getCharacterEncoding(), - "feature_count"); + Map values = ServletUtils.selectedStringsFromMap( + tile.servletReq.getParameterMap(), tile.servletReq.getCharacterEncoding(), "feature_count"); featureCount = values.get("feature_count"); } if (featureCount != null) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/locks/LockProvider.java b/geowebcache/core/src/main/java/org/geowebcache/locks/LockProvider.java index ea3ce89c9f..deb701fdba 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/locks/LockProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/locks/LockProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/locks/MemoryLockProvider.java b/geowebcache/core/src/main/java/org/geowebcache/locks/MemoryLockProvider.java index d3d15e248d..fa52695012 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/locks/MemoryLockProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/locks/MemoryLockProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -24,15 +23,14 @@ /** * An in memory lock provider. * - *

This provider does not constrain the number of locks that can be held at any given time. - * Because any one thread can hold multiple locks at a time, a more appropriate approach to - * constraining resource usage would be to limit the number of concurrent threads instead. + *

This provider does not constrain the number of locks that can be held at any given time. Because any one thread + * can hold multiple locks at a time, a more appropriate approach to constraining resource usage would be to limit the + * number of concurrent threads instead. * - *

One objective of this class is to support nested locking - * scenarios. This class used to use a striped lock algorithm which would cause deadlocks for - * nested locking because of the non-predictable manner in which any lock can be arbitrarily locked - * by another unrelated lock. An example use case of nested locks, in pseudocode, would be: + *

One objective of this class is to support nested + * locking scenarios. This class used to use a striped lock algorithm which would cause deadlocks for nested locking + * because of the non-predictable manner in which any lock can be arbitrarily locked by another unrelated lock. An + * example use case of nested locks, in pseudocode, would be: * *

  *  lock(metatile);
@@ -63,16 +61,13 @@ public Lock getLock(String lockKey) {
         if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Acquiring lock key " + lockKey);
 
         // Atomically create a new LockAndCounter, or increment the existing one
-        LockAndCounter lockAndCounter =
-                lockAndCounters.compute(
-                        lockKey,
-                        (key, internalLockAndCounter) -> {
-                            if (internalLockAndCounter == null) {
-                                internalLockAndCounter = new LockAndCounter();
-                            }
-                            internalLockAndCounter.counter.incrementAndGet();
-                            return internalLockAndCounter;
-                        });
+        LockAndCounter lockAndCounter = lockAndCounters.compute(lockKey, (key, internalLockAndCounter) -> {
+            if (internalLockAndCounter == null) {
+                internalLockAndCounter = new LockAndCounter();
+            }
+            internalLockAndCounter.counter.incrementAndGet();
+            return internalLockAndCounter;
+        });
 
         lockAndCounter.lock.lock();
 
@@ -97,15 +92,12 @@ public void release() {
                         // "compute"
                         // so that we know it hasn't been incremented since the if-statement above
                         // was evaluated
-                        lockAndCounters.compute(
-                                lockKey,
-                                (key, existingLockAndCounter) -> {
-                                    if (existingLockAndCounter == null
-                                            || existingLockAndCounter.counter.get() == 0) {
-                                        return null;
-                                    }
-                                    return existingLockAndCounter;
-                                });
+                        lockAndCounters.compute(lockKey, (key, existingLockAndCounter) -> {
+                            if (existingLockAndCounter == null || existingLockAndCounter.counter.get() == 0) {
+                                return null;
+                            }
+                            return existingLockAndCounter;
+                        });
                     }
 
                     if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Released lock key " + lockKey);
@@ -115,8 +107,8 @@ public void release() {
     }
 
     /**
-     * A ReentrantLock with a counter to track how many threads are waiting on this lock so we know
-     * if it's safe to remove it during a release.
+     * A ReentrantLock with a counter to track how many threads are waiting on this lock so we know if it's safe to
+     * remove it during a release.
      */
     private static class LockAndCounter {
         private final java.util.concurrent.locks.Lock lock = new ReentrantLock();
diff --git a/geowebcache/core/src/main/java/org/geowebcache/locks/NIOLockProvider.java b/geowebcache/core/src/main/java/org/geowebcache/locks/NIOLockProvider.java
index cdedf4aa7f..12b1db3911 100644
--- a/geowebcache/core/src/main/java/org/geowebcache/locks/NIOLockProvider.java
+++ b/geowebcache/core/src/main/java/org/geowebcache/locks/NIOLockProvider.java
@@ -1,14 +1,13 @@
 /**
- * This program is free software: you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
  *
- * 

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -51,8 +50,7 @@ public NIOLockProvider(DefaultStorageFinder storageFinder) throws ConfigurationE this(storageFinder.getDefaultPath()); } - public NIOLockProvider( - DefaultStorageFinder storageFinder, int waitBeforeRetry, int maxLockAttempts) + public NIOLockProvider(DefaultStorageFinder storageFinder, int waitBeforeRetry, int maxLockAttempts) throws ConfigurationException { this.root = storageFinder.getDefaultPath(); this.waitBeforeRetry = waitBeforeRetry; @@ -103,21 +101,16 @@ public LockProvider.Lock getLock(final String lockKey) throws GeoWebCacheExcepti // verify we managed to get the FS lock if (count >= maxLockAttempts) { throw new GeoWebCacheException( - "Failed to get a lock on key " - + lockKey - + " after " - + count - + " attempts"); + "Failed to get a lock on key " + lockKey + " after " + count + " attempts"); } if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.fine( - "Lock " - + lockKey - + " acquired by thread " - + Thread.currentThread().getName() - + " on file " - + file); + LOGGER.fine("Lock " + + lockKey + + " acquired by thread " + + Thread.currentThread().getName() + + " on file " + + file); } // store the results in a final variable for the inner class to use @@ -164,18 +157,16 @@ public void release() throws GeoWebCacheException { lockFile.delete(); if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.fine( - "Lock " - + lockKey - + " on file " - + lockFile - + " released by thread " - + Thread.currentThread().getName()); + LOGGER.fine("Lock " + + lockKey + + " on file " + + lockFile + + " released by thread " + + Thread.currentThread().getName()); } } catch (IOException e) { throw new GeoWebCacheException( - "Failure while trying to release lock for key " + lockKey, - e); + "Failure while trying to release lock for key " + lockKey, e); } } finally { memoryLock.release(); @@ -194,8 +185,7 @@ public void release() throws GeoWebCacheException { } } } catch (IOException e) { - throw new GeoWebCacheException( - "Failure while trying to get lock for key " + lockKey, e); + throw new GeoWebCacheException("Failure while trying to get lock for key " + lockKey, e); } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/locks/NoOpLockProvider.java b/geowebcache/core/src/main/java/org/geowebcache/locks/NoOpLockProvider.java index 6e47201846..7c2e01abf7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/locks/NoOpLockProvider.java +++ b/geowebcache/core/src/main/java/org/geowebcache/locks/NoOpLockProvider.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -17,8 +16,8 @@ import org.geowebcache.GeoWebCacheException; /** - * A no-op implementation of LockProvider. It does not actually lock anything, can be used to test - * if the other subsystems continue to work properly in face of absence of locks + * A no-op implementation of LockProvider. It does not actually lock anything, can be used to test if the other + * subsystems continue to work properly in face of absence of locks * * @author Andrea Aime - GeoSolutions */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/ApplicationMime.java b/geowebcache/core/src/main/java/org/geowebcache/mime/ApplicationMime.java index b282c1abef..e3f7f8e0e1 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/ApplicationMime.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/ApplicationMime.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -23,8 +22,7 @@ public class ApplicationMime extends MimeType { - public static final String MAPBOX_TILES_LEGACY_MIME = - "application/x-protobuf;type=mapbox-vector"; + public static final String MAPBOX_TILES_LEGACY_MIME = "application/x-protobuf;type=mapbox-vector"; protected boolean vector; @@ -38,61 +36,37 @@ public class ApplicationMime extends MimeType { new ApplicationMime("application/json", "json", "json", "application/json", false); public static final ApplicationMime topojson = - new ApplicationMime( - "application/json", - "topojson", - "topojson", - "application/json;type=topojson", - true); + new ApplicationMime("application/json", "topojson", "topojson", "application/json;type=topojson", true); public static final ApplicationMime geojson = - new ApplicationMime( - "application/json", - "geojson", - "geojson", - "application/json;type=geojson", - true); + new ApplicationMime("application/json", "geojson", "geojson", "application/json;type=geojson", true); public static final ApplicationMime utfgrid = - new ApplicationMime( - "application/json", - "utfgrid", - "utfgrid", - "application/json;type=utfgrid", - true); - - public static final ApplicationMime mapboxVector = - new ApplicationMime( - "application/vnd.mapbox-vector-tile", - "pbf", - "mapbox-vectortile", - "application/vnd.mapbox-vector-tile", - true); - - static Set ALL = - ImmutableSet.of(bil16, bil32, json, topojson, geojson, utfgrid, mapboxVector); + new ApplicationMime("application/json", "utfgrid", "utfgrid", "application/json;type=utfgrid", true); + + public static final ApplicationMime mapboxVector = new ApplicationMime( + "application/vnd.mapbox-vector-tile", + "pbf", + "mapbox-vectortile", + "application/vnd.mapbox-vector-tile", + true); + + static Set ALL = ImmutableSet.of(bil16, bil32, json, topojson, geojson, utfgrid, mapboxVector); private static final List BINARY_FORMATS = Arrays.asList(bil16.mimeType, bil32.mimeType, mapboxVector.mimeType, utfgrid.mimeType); - private static Map BY_FORMAT = - Maps.uniqueIndex(ALL, mimeType -> mimeType.getFormat()); + private static Map BY_FORMAT = Maps.uniqueIndex(ALL, mimeType -> mimeType.getFormat()); private static Map BY_EXTENSION = Maps.uniqueIndex(ALL, mimeType -> mimeType.getFileExtension()); - private ApplicationMime( - String mimeType, - String fileExtension, - String internalName, - String format, - boolean vector) { + private ApplicationMime(String mimeType, String fileExtension, String internalName, String format, boolean vector) { super(mimeType, fileExtension, internalName, format, false); this.vector = vector; } - public ApplicationMime( - String mimeType, String fileExtension, String internalName, String format) + public ApplicationMime(String mimeType, String fileExtension, String internalName, String format) throws MimeException { super(mimeType, fileExtension, internalName, format, false); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/ErrorMime.java b/geowebcache/core/src/main/java/org/geowebcache/mime/ErrorMime.java index d7a43937f5..2f0f5ba510 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/ErrorMime.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/ErrorMime.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -21,15 +20,13 @@ public class ErrorMime extends MimeType { private static Logger log = Logging.getLogger(ErrorMime.class.getName()); - public static final ErrorMime vnd_ogc_se_inimage = - new ErrorMime("application/vnd.ogc.se_inimage"); + public static final ErrorMime vnd_ogc_se_inimage = new ErrorMime("application/vnd.ogc.se_inimage"); private ErrorMime(String mimeType) { super(mimeType, null, null, mimeType, false); } - public ErrorMime(String mimeType, String fileExtension, String internalName, String format) - throws MimeException { + public ErrorMime(String mimeType, String fileExtension, String internalName, String format) throws MimeException { super(mimeType, fileExtension, internalName, format, false); // Check for trouble @@ -44,9 +41,7 @@ public static ErrorMime createFromMimeType(String mimeType) throws MimeException } else { log.log( Level.SEVERE, - "Unsupported MIME type: " - + mimeType - + ", falling back to application/vnd.ogc.se_inimage."); + "Unsupported MIME type: " + mimeType + ", falling back to application/vnd.ogc.se_inimage."); return vnd_ogc_se_inimage; } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/FormatModifier.java b/geowebcache/core/src/main/java/org/geowebcache/mime/FormatModifier.java index 58b22df8c3..45109cdf83 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/FormatModifier.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/FormatModifier.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo (The Open Planning Project), Copyright 2009 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/ImageMime.java b/geowebcache/core/src/main/java/org/geowebcache/mime/ImageMime.java index 790b23af8f..b499d23c0d 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/ImageMime.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/ImageMime.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -51,103 +50,76 @@ public class ImageMime extends MimeType { JAIExt.initJAIEXT(false, false); } - public static final ImageMime png = - new ImageMime("image/png", "png", "png", "image/png", true, true, true) { + public static final ImageMime png = new ImageMime("image/png", "png", "png", "image/png", true, true, true) { - /** Any response mime starting with image/png will do */ - @Override - public boolean isCompatible(String otherMimeType) { - return super.isCompatible(otherMimeType) - || otherMimeType.startsWith("image/png"); + /** Any response mime starting with image/png will do */ + @Override + public boolean isCompatible(String otherMimeType) { + return super.isCompatible(otherMimeType) || otherMimeType.startsWith("image/png"); + } + }; + + public static final ImageMime jpeg = new ImageMime("image/jpeg", "jpeg", "jpeg", "image/jpeg", true, false, false) { + + /** Shave off the alpha band, JPEG cannot write it out */ + @Override + public RenderedImage preprocess(RenderedImage ri) { + if (ri.getColorModel().hasAlpha()) { + final int numBands = ri.getSampleModel().getNumBands(); + // handle both gray-alpha and RGBA (same code as in GeoTools ImageWorker) + final int[] bands = new int[numBands - 1]; + for (int i = 0; i < bands.length; i++) { + bands[i] = i; } - }; - - public static final ImageMime jpeg = - new ImageMime("image/jpeg", "jpeg", "jpeg", "image/jpeg", true, false, false) { - - /** Shave off the alpha band, JPEG cannot write it out */ - @Override - public RenderedImage preprocess(RenderedImage ri) { - if (ri.getColorModel().hasAlpha()) { - final int numBands = ri.getSampleModel().getNumBands(); - // handle both gray-alpha and RGBA (same code as in GeoTools ImageWorker) - final int[] bands = new int[numBands - 1]; - for (int i = 0; i < bands.length; i++) { - bands[i] = i; - } - // ParameterBlock creation + // ParameterBlock creation + ParameterBlock pb = new ParameterBlock(); + pb.setSource(ri, 0); + pb.set(bands, 0); + final RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, new ImageLayout(ri)); + ri = JAI.create("BandSelect", pb, hints); + } + return ri; + } + }; + + public static final ImageMime gif = new ImageMime("image/gif", "gif", "gif", "image/gif", true, false, true); + + public static final ImageMime tiff = new ImageMime("image/tiff", "tiff", "tiff", "image/tiff", true, true, true); + + public static final ImageMime png8 = new ImageMime("image/png", "png8", "png", "image/png8", true, false, true) { + + /** Quantize if the source did not do so already */ + @Override + public RenderedImage preprocess(RenderedImage canvas) { + if (!(canvas.getColorModel() instanceof IndexColorModel)) { + if (canvas.getColorModel() instanceof ComponentColorModel + && canvas.getSampleModel().getDataType() == DataBuffer.TYPE_BYTE) { + ColorIndexer indexer = new Quantizer(256).subsample().buildColorIndexer(canvas); + if (indexer != null) { ParameterBlock pb = new ParameterBlock(); - pb.setSource(ri, 0); - pb.set(bands, 0); - final RenderingHints hints = - new RenderingHints(JAI.KEY_IMAGE_LAYOUT, new ImageLayout(ri)); - ri = JAI.create("BandSelect", pb, hints); + pb.setSource(canvas, 0); // The source image. + pb.set(indexer, 0); + canvas = JAI.create( + "ColorIndexer", pb, JAI.getDefaultInstance().getRenderingHints()); } - return ri; } - }; - - public static final ImageMime gif = - new ImageMime("image/gif", "gif", "gif", "image/gif", true, false, true); - - public static final ImageMime tiff = - new ImageMime("image/tiff", "tiff", "tiff", "image/tiff", true, true, true); - - public static final ImageMime png8 = - new ImageMime("image/png", "png8", "png", "image/png8", true, false, true) { - - /** Quantize if the source did not do so already */ - @Override - public RenderedImage preprocess(RenderedImage canvas) { - if (!(canvas.getColorModel() instanceof IndexColorModel)) { - if (canvas.getColorModel() instanceof ComponentColorModel - && canvas.getSampleModel().getDataType() == DataBuffer.TYPE_BYTE) { - ColorIndexer indexer = - new Quantizer(256).subsample().buildColorIndexer(canvas); - if (indexer != null) { - ParameterBlock pb = new ParameterBlock(); - pb.setSource(canvas, 0); // The source image. - pb.set(indexer, 0); - canvas = - JAI.create( - "ColorIndexer", - pb, - JAI.getDefaultInstance().getRenderingHints()); - } - } - } - return canvas; - } - }; + } + return canvas; + } + }; - public static final ImageMime png24 = - new ImageMime("image/png", "png24", "png", "image/png24", true, true, true); + public static final ImageMime png24 = new ImageMime("image/png", "png24", "png", "image/png24", true, true, true); public static final ImageMime png_24 = - new ImageMime( - "image/png; mode=24bit", - "png_24", - "png", - "image/png;%20mode=24bit", - true, - true, - true); - - public static final ImageMime dds = - new ImageMime("image/dds", "dds", "dds", "image/dds", false, false, false); + new ImageMime("image/png; mode=24bit", "png_24", "png", "image/png;%20mode=24bit", true, true, true); + + public static final ImageMime dds = new ImageMime("image/dds", "dds", "dds", "image/dds", false, false, false); public static final ImageMime jpegPng = - new JpegPngMime( - "image/vnd.jpeg-png", "jpeg-png", "jpeg-png", "image/vnd.jpeg-png", jpeg, png); + new JpegPngMime("image/vnd.jpeg-png", "jpeg-png", "jpeg-png", "image/vnd.jpeg-png", jpeg, png); public static final ImageMime jpegPng8 = - new JpegPngMime( - "image/vnd.jpeg-png8", - "jpeg-png8", - "jpeg-png8", - "image/vnd.jpeg-png8", - jpeg, - png8); + new JpegPngMime("image/vnd.jpeg-png8", "jpeg-png8", "jpeg-png8", "image/vnd.jpeg-png8", jpeg, png8); private ImageMime( String mimeType, @@ -204,8 +176,7 @@ protected static ImageMime checkForFormat(String formatStr) throws MimeException protected static ImageMime checkForExtension(String fileExtension) throws MimeException { if (fileExtension.equalsIgnoreCase("png")) { return png; - } else if (fileExtension.equalsIgnoreCase("jpeg") - || fileExtension.equalsIgnoreCase("jpg")) { + } else if (fileExtension.equalsIgnoreCase("jpeg") || fileExtension.equalsIgnoreCase("jpg")) { return jpeg; } else if (fileExtension.equalsIgnoreCase("gif")) { return gif; @@ -250,9 +221,7 @@ public ImageWriter getImageWriter(RenderedImage image) { || this.internalName.equals(ImageMime.png8.internalName)) { int bitDepth = image.getSampleModel().getSampleSize(0); - if (bitDepth > 1 - && bitDepth < 8 - && writer.getClass().getName().equals(NATIVE_PNG_WRITER_CLASS_NAME)) { + if (bitDepth > 1 && bitDepth < 8 && writer.getClass().getName().equals(NATIVE_PNG_WRITER_CLASS_NAME)) { writer = it.next(); } @@ -284,23 +253,22 @@ public JpegPngMime( } /** - * Returns true if the best format to encode the image is jpeg (the image is rgb, or rgba - * without any actual transparency use). This code is duplicated in GeoServer - * JpegPngRenderedImageMapOutputFormat. Unfortunately gwc-core does not depend on GeoTools, - * so we don't have an easy place to share it. On the bright side, it's small. + * Returns true if the best format to encode the image is jpeg (the image is rgb, or rgba without any actual + * transparency use). This code is duplicated in GeoServer JpegPngRenderedImageMapOutputFormat. Unfortunately + * gwc-core does not depend on GeoTools, so we don't have an easy place to share it. On the bright side, it's + * small. */ boolean isBestFormatJpeg(RenderedImage renderedImage) { int numBands = renderedImage.getSampleModel().getNumBands(); if (numBands == 4 || numBands == 2) { - RenderedOp extremaOp = - ExtremaDescriptor.create( - renderedImage, - null, - 1, - 1, - false, - 1, - JAI.getDefaultInstance().getRenderingHints()); + RenderedOp extremaOp = ExtremaDescriptor.create( + renderedImage, + null, + 1, + 1, + false, + 1, + JAI.getDefaultInstance().getRenderingHints()); double[][] extrema = (double[][]) extremaOp.getProperty("Extrema"); double[] mins = extrema[0]; @@ -340,8 +308,7 @@ public String getMimeType(org.geowebcache.io.Resource resource) throws IOExcepti @Override public boolean isCompatible(String otherMimeType) { - return jpegDelegate.isCompatible(otherMimeType) - || pngDelegate.isCompatible(otherMimeType); + return jpegDelegate.isCompatible(otherMimeType) || pngDelegate.isCompatible(otherMimeType); } @Override diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/MimeException.java b/geowebcache/core/src/main/java/org/geowebcache/mime/MimeException.java index c6dc8e4e56..713e3ca775 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/MimeException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/MimeException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/MimeType.java b/geowebcache/core/src/main/java/org/geowebcache/mime/MimeType.java index c3a30a81f5..fb9704c9db 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/MimeType.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/MimeType.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -33,11 +32,7 @@ public class MimeType { private static Logger log = Logging.getLogger(MimeType.class.getName()); protected MimeType( - String mimeType, - String fileExtension, - String internalName, - String format, - boolean supportsTiling) { + String mimeType, String fileExtension, String internalName, String format, boolean supportsTiling) { this.mimeType = mimeType; this.fileExtension = fileExtension; this.internalName = internalName; @@ -105,11 +100,11 @@ public boolean supportsTiling() { } /** - * Indicates whether this is a vector format rather than a raster format. Output in vector - * formats should have no guttering. + * Indicates whether this is a vector format rather than a raster format. Output in vector formats should have no + * guttering. * - * @return {@code true} if represents a vector or other kind of non raster format where applying - * a gutter to the request originating the tile would lead to an incorrect result. + * @return {@code true} if represents a vector or other kind of non raster format where applying a gutter to the + * request originating the tile would lead to an incorrect result. */ public boolean isVector() { return false; @@ -186,16 +181,15 @@ public int hashCode() { } /** - * Determine whether otherMimeType is compatible with this MimeType. They're compatible if - * they're identical, or presumably if otherMimeType has this mime type as a prefix. + * Determine whether otherMimeType is compatible with this MimeType. They're compatible if they're identical, or + * presumably if otherMimeType has this mime type as a prefix. * * @param otherMimeType the mime type to check for compatibility * @return whether otherMimeType is "compatible" with this mime type */ public boolean isCompatible(String otherMimeType) { return mimeType.equalsIgnoreCase(otherMimeType) - || (otherMimeType != null - && otherMimeType.toLowerCase().startsWith(mimeType.toLowerCase())); + || (otherMimeType != null && otherMimeType.toLowerCase().startsWith(mimeType.toLowerCase())); } @Override diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/TextMime.java b/geowebcache/core/src/main/java/org/geowebcache/mime/TextMime.java index 579fa13c1c..c07e23169b 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/TextMime.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/TextMime.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2009 */ @@ -18,25 +17,17 @@ public class TextMime extends MimeType { public static final TextMime txt = new TextMime("text/plain", "txt", "txt", "text/plain", true); - public static final TextMime txtHtml = - new TextMime("text/html", "txt.html", "html", "text/html", true); + public static final TextMime txtHtml = new TextMime("text/html", "txt.html", "html", "text/html", true); - public static final TextMime txtMapml = - new TextMime("text/mapml", "mapml", "mapml", "text/mapml", true); + public static final TextMime txtMapml = new TextMime("text/mapml", "mapml", "mapml", "text/mapml", true); public static final TextMime txtXml = new TextMime("text/xml", "xml", "xml", "text/xml", true); public static final TextMime txtCss = new TextMime("text/css", "css", "css", "text/css", true); - public static final TextMime txtJs = - new TextMime("text/javascript", "js", "javascript", "text/javascript", true); + public static final TextMime txtJs = new TextMime("text/javascript", "js", "javascript", "text/javascript", true); - private TextMime( - String mimeType, - String fileExtension, - String internalName, - String format, - boolean noop) { + private TextMime(String mimeType, String fileExtension, String internalName, String format, boolean noop) { super(mimeType, fileExtension, internalName, format, false); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/mime/XMLMime.java b/geowebcache/core/src/main/java/org/geowebcache/mime/XMLMime.java index b208a39f69..f5b4c87baf 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/mime/XMLMime.java +++ b/geowebcache/core/src/main/java/org/geowebcache/mime/XMLMime.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -17,46 +16,21 @@ public class XMLMime extends MimeType { public static final XMLMime ogcxml = - new XMLMime( - "application/vnd.ogc.se_xml", - "ogc-xml", - "ogc-xml", - "application/vnd.ogc.se_xml", - false); + new XMLMime("application/vnd.ogc.se_xml", "ogc-xml", "ogc-xml", "application/vnd.ogc.se_xml", false); - public static final XMLMime kml = - new XMLMime( - "application/vnd.google-earth.kml+xml", - "kml", - "kml", - "application/vnd.google-earth.kml+xml", - false); + public static final XMLMime kml = new XMLMime( + "application/vnd.google-earth.kml+xml", "kml", "kml", "application/vnd.google-earth.kml+xml", false); public static final XMLMime kmz = - new XMLMime( - "application/vnd.google-earth.kmz", - "kmz", - "kmz", - "application/vnd.google-earth.kmz", - false); + new XMLMime("application/vnd.google-earth.kmz", "kmz", "kmz", "application/vnd.google-earth.kmz", false); public static final XMLMime gml = new XMLMime("application/vnd.ogc.gml", "gml", "gml", "application/vnd.ogc.gml", false); public static final XMLMime gml3 = - new XMLMime( - "application/vnd.ogc.gml/3.1.1", - "gml3", - "gml3", - "application/vnd.ogc.gml/3.1.1", - false); + new XMLMime("application/vnd.ogc.gml/3.1.1", "gml3", "gml3", "application/vnd.ogc.gml/3.1.1", false); - private XMLMime( - String mimeType, - String fileExtension, - String internalName, - String format, - boolean noop) { + private XMLMime(String mimeType, String fileExtension, String internalName, String format, boolean noop) { super(mimeType, fileExtension, internalName, format, false); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/proxy/ProxyDispatcher.java b/geowebcache/core/src/main/java/org/geowebcache/proxy/ProxyDispatcher.java index 000d385e1a..ea442850d7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/proxy/ProxyDispatcher.java +++ b/geowebcache/core/src/main/java/org/geowebcache/proxy/ProxyDispatcher.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -32,8 +31,8 @@ public class ProxyDispatcher extends AbstractController { private static long lastRequest = System.currentTimeMillis(); @Override - protected ModelAndView handleRequestInternal( - HttpServletRequest request, HttpServletResponse response) throws Exception { + protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) + throws Exception { String methStr = request.getMethod(); if (!methStr.equalsIgnoreCase("POST")) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/GWCTask.java b/geowebcache/core/src/main/java/org/geowebcache/seed/GWCTask.java index e8a29535b2..529b7838fc 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/GWCTask.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/GWCTask.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2008 */ @@ -40,8 +39,8 @@ public static enum STATE { } /** - * Value shared between all the threads in the group, is incremented each time a task starts - * working and decremented each time one task finishes (either normally or abnormally) + * Value shared between all the threads in the group, is incremented each time a task starts working and decremented + * each time one task finishes (either normally or abnormally) */ protected AtomicInteger sharedThreadCount = new AtomicInteger(); @@ -80,14 +79,8 @@ public final void doAction() throws GeoWebCacheException, InterruptedException { dispose(); int membersRemaining = this.sharedThreadCount.decrementAndGet(); if (0 == membersRemaining) { - double groupTotalTimeSecs = - (System.currentTimeMillis() - (double) groupStartTime) / 1000; - log.info( - "Thread group finished " - + parsedType - + " task after " - + groupTotalTimeSecs - + " seconds"); + double groupTotalTimeSecs = (System.currentTimeMillis() - (double) groupStartTime) / 1000; + log.info("Thread group finished " + parsedType + " task after " + groupTotalTimeSecs + " seconds"); } } } @@ -98,8 +91,8 @@ public final void doAction() throws GeoWebCacheException, InterruptedException { protected abstract void doActionInternal() throws GeoWebCacheException, InterruptedException; /** - * @param sharedThreadCount a counter of number of active tasks in the task group, incremented - * when this task starts working and decremented when it stops + * @param sharedThreadCount a counter of number of active tasks in the task group, incremented when this task starts + * working and decremented when it stops * @param threadOffset REVISIT: may not be needed anymore. Just check if sharedThreadCount == 1? */ public void setThreadInfo(AtomicInteger sharedThreadCount, int threadOffset) { diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/MTSeeder.java b/geowebcache/core/src/main/java/org/geowebcache/seed/MTSeeder.java index 324ad31377..8395c04894 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/MTSeeder.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/MTSeeder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Marius Suta / The Open Planning Project 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/MassTruncateRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/MassTruncateRequest.java index 4f69c8b099..71cc5c3296 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/MassTruncateRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/MassTruncateRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

Copyright 2019 */ @@ -34,8 +33,7 @@ public interface MassTruncateRequest { * @param breeder The tile breeder storing information about the affected layers * @return {@literal true} if successful, {@literal false} otherwise */ - public boolean doTruncate(StorageBroker sb, TileBreeder breeder) - throws StorageException, GeoWebCacheException; + public boolean doTruncate(StorageBroker sb, TileBreeder breeder) throws StorageException, GeoWebCacheException; public default ResponseEntity getResponse(String contentType) { return new ResponseEntity<>(HttpStatus.OK); diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/SeedRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/SeedRequest.java index eb223ad436..b794b60d0c 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/SeedRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/SeedRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Marius Suta / The Open Planning Project 2008 * @author Arne Kepp / The Open Planning Project 2009 @@ -42,8 +41,7 @@ public class SeedRequest { private String format = null; - private String type = - null; // TODO: This appears to do nothing as it is never changed from being null + private String type = null; // TODO: This appears to do nothing as it is never changed from being null private TYPE enumType = null; @@ -210,8 +208,7 @@ public Map getParameters() { } /** - * Number of retries to build a tile before giving up on it. -1 disables also the wait and total - * failures counters. + * Number of retries to build a tile before giving up on it. -1 disables also the wait and total failures counters. */ public int getTileFailureRetryCount() { return tileFailureRetryCount; @@ -231,8 +228,7 @@ public void setTileFailureRetryWaitTime(long tileFailureRetryWaitTime) { } /** - * Total amount of failures before stopping the seeding process, computed across all threads in - * the seed request. + * Total amount of failures before stopping the seeding process, computed across all threads in the seed request. */ public long getTotalFailuresBeforeAborting() { return totalFailuresBeforeAborting; diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/SeedTask.java b/geowebcache/core/src/main/java/org/geowebcache/seed/SeedTask.java index 9a52a447a6..d319fdb574 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/SeedTask.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/SeedTask.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Marius Suta / The Open Planning Project 2008 * @author Arne Kepp / The Open Planning Project 2009 @@ -56,15 +55,11 @@ class SeedTask extends GWCTask { private AtomicLong sharedFailureCounter; - @VisibleForTesting Sleeper sleeper = Thread::sleep; + @VisibleForTesting + Sleeper sleeper = Thread::sleep; /** Constructs a SeedTask */ - public SeedTask( - StorageBroker sb, - TileRangeIterator trIter, - TileLayer tl, - boolean reseed, - boolean doFilterUpdate) { + public SeedTask(StorageBroker sb, TileRangeIterator trIter, TileLayer tl, boolean reseed, boolean doFilterUpdate) { this.storageBroker = sb; this.trIter = trIter; this.tl = tl; @@ -122,16 +117,8 @@ protected void doActionInternal() throws GeoWebCacheException, InterruptedExcept checkInterrupted(); Map fullParameters = tr.getParameters(); - ConveyorTile tile = - new ConveyorTile( - storageBroker, - layerName, - tr.getGridSetId(), - gridLoc, - tr.getMimeType(), - fullParameters, - null, - null); + ConveyorTile tile = new ConveyorTile( + storageBroker, layerName, tr.getGridSetId(), gridLoc, tr.getMimeType(), fullParameters, null, null); for (int fetchAttempt = 0; fetchAttempt <= tileFailureRetryCount || tileFailureRetryCount < 0; @@ -152,27 +139,24 @@ protected void doActionInternal() throws GeoWebCacheException, InterruptedExcept long sharedFailureCount = sharedFailureCounter.incrementAndGet(); if (sharedFailureCount >= totalFailuresBeforeAborting) { - log.info( - "Aborting seed thread " - + getThreadName() - + ". Error count reached configured maximum of " - + totalFailuresBeforeAborting); + log.info("Aborting seed thread " + + getThreadName() + + ". Error count reached configured maximum of " + + totalFailuresBeforeAborting); super.state = GWCTask.STATE.DEAD; return; } - String logMsg = - "Seed failed at " - + tile.toString() - + " after " - + (fetchAttempt + 1) - + " of " - + (tileFailureRetryCount + 1) - + " attempts."; + String logMsg = "Seed failed at " + + tile.toString() + + " after " + + (fetchAttempt + 1) + + " of " + + (tileFailureRetryCount + 1) + + " attempts."; if (fetchAttempt < tileFailureRetryCount) { log.fine(logMsg); if (tileFailureRetryWaitTime > 0) { - log.finer( - "Waiting " + tileFailureRetryWaitTime + " before trying again"); + log.finer("Waiting " + tileFailureRetryWaitTime + " before trying again"); waitToRetry(); } } else { @@ -194,8 +178,7 @@ protected void doActionInternal() throws GeoWebCacheException, InterruptedExcept // note: computing the # of tiles processed by this thread instead of by the whole group // also reduces thread contention as the trIter methods are synchronized and profiler // shows 16 threads block on synchronization about 40% the time - final long tilesCompletedByThisThread = - seedCalls * metaTilingFactorX * metaTilingFactorY; + final long tilesCompletedByThisThread = seedCalls * metaTilingFactorX * metaTilingFactorY; updateStatusInfo(tl, tilesCompletedByThisThread, START_TIME); @@ -205,22 +188,16 @@ protected void doActionInternal() throws GeoWebCacheException, InterruptedExcept } if (this.terminate) { - log.info( - "Job on " - + getThreadName() - + " was terminated after " - + this.tilesDone - + " tiles"); + log.info("Job on " + getThreadName() + " was terminated after " + this.tilesDone + " tiles"); } else { - log.info( - getThreadName() - + " completed (re)seeding layer " - + layerName - + " after " - + this.tilesDone - + " tiles and " - + this.timeSpent - + " seconds."); + log.info(getThreadName() + + " completed (re)seeding layer " + + layerName + + " after " + + this.tilesDone + + " tiles and " + + this.timeSpent + + " seconds."); } checkInterrupted(); @@ -232,8 +209,7 @@ protected void doActionInternal() throws GeoWebCacheException, InterruptedExcept } private void reprioritize() { - Thread.currentThread() - .setPriority((java.lang.Thread.NORM_PRIORITY + java.lang.Thread.MIN_PRIORITY) / 2); + Thread.currentThread().setPriority((java.lang.Thread.NORM_PRIORITY + java.lang.Thread.MIN_PRIORITY) / 2); } private void waitToRetry() throws InterruptedException { @@ -303,8 +279,7 @@ private void runFilterUpdates(String gridSetId) { if (reqFilter.update(tl, gridSetId)) { log.info("Updated request filter " + reqFilter.getName()); } else { - log.fine( - "Request filter " + reqFilter.getName() + " returned false on update."); + log.fine("Request filter " + reqFilter.getName() + " returned false on update."); } } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/SeederException.java b/geowebcache/core/src/main/java/org/geowebcache/seed/SeederException.java index 86d5844fa5..234fc5f11f 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/SeederException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/SeederException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2008 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/SeederThreadPoolExecutor.java b/geowebcache/core/src/main/java/org/geowebcache/seed/SeederThreadPoolExecutor.java index 1e2f48d609..508d974897 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/SeederThreadPoolExecutor.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/SeederThreadPoolExecutor.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2008 */ @@ -34,8 +33,8 @@ public SeederThreadPoolExecutor(int corePoolSize, int maxPoolSize) { } /** - * Destroy method called by the application context at shutdown, needed to gracefully shutdown - * this thread pool executor and any running thread + * Destroy method called by the application context at shutdown, needed to gracefully shutdown this thread pool + * executor and any running thread * * @see org.springframework.beans.factory.DisposableBean#destroy() */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TileBreeder.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TileBreeder.java index 3ddbaef203..9573c04c4a 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TileBreeder.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TileBreeder.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Marius Suta / The Open Planning Project 2008 (original code from SeedRestlet) * @author Arne Kepp / The Open Planning Project 2009 (original code from SeedRestlet) @@ -57,26 +56,24 @@ /** * Class in charge of dispatching seed/truncate tasks. * - *

As of version 1.2.4a+, it is possible to control how GWC behaves in the event that a backend - * (WMS for example) request fails during seeding, using the following environment variables: + *

As of version 1.2.4a+, it is possible to control how GWC behaves in the event that a backend (WMS for example) + * request fails during seeding, using the following environment variables: * *

    - *
  • {@code GWC_SEED_RETRY_COUNT}: specifies how many times to retry a failed request for each - * tile being seeded. Use {@code 0} for no retries, or any higher number. Defaults to {@code - * 0} retry meaning no retries are performed. It also means that the defaults to the other two - * variables do not apply at least you specify a higher value for GWC_SEED_RETRY_COUNT; - *
  • {@code GWC_SEED_RETRY_WAIT}: specifies how much to wait before each retry upon a failure to - * seed a tile, in milliseconds. Defaults to {@code 100ms}; - *
  • {@code GWC_SEED_ABORT_LIMIT}: specifies the aggregated number of failures that a group of - * seeding threads should reach before aborting the seeding operation as a whole. This value - * is shared by all the threads launched as a single thread group; so if the value is {@code - * 10} and you launch a seed task with four threads, when {@code 10} failures are reached by - * all or any of those four threads the four threads will abort the seeding task. The default - * is {@code 1000}. + *
  • {@code GWC_SEED_RETRY_COUNT}: specifies how many times to retry a failed request for each tile being seeded. + * Use {@code 0} for no retries, or any higher number. Defaults to {@code 0} retry meaning no retries are + * performed. It also means that the defaults to the other two variables do not apply at least you specify a + * higher value for GWC_SEED_RETRY_COUNT; + *
  • {@code GWC_SEED_RETRY_WAIT}: specifies how much to wait before each retry upon a failure to seed a tile, in + * milliseconds. Defaults to {@code 100ms}; + *
  • {@code GWC_SEED_ABORT_LIMIT}: specifies the aggregated number of failures that a group of seeding threads + * should reach before aborting the seeding operation as a whole. This value is shared by all the threads launched + * as a single thread group; so if the value is {@code 10} and you launch a seed task with four threads, when + * {@code 10} failures are reached by all or any of those four threads the four threads will abort the seeding + * task. The default is {@code 1000}. *
* - * These environment variables can be established by any of the following ways, in order of - * precedence: + * These environment variables can be established by any of the following ways, in order of precedence: * *
    *
  1. As a Java environment variable: for example {@code java -DGWC_SEED_RETRY_COUNT=5 ...}; @@ -91,8 +88,8 @@ * *
* In the web application's {@code WEB-INF/web.xml} configuration file; - *
  • As a System environment variable: {@code export GWC_SEED_ABORT_LIMIT=2000; } + *
  • As a System environment variable: {@code export GWC_SEED_ABORT_LIMIT=2000; } * * * @author Gabriel Roldan, based on Marius Suta's and Arne Kepp's SeedRestlet @@ -112,18 +109,15 @@ public class TileBreeder implements ApplicationContextAware { private StorageBroker storageBroker; - /** - * How many retries per failed tile. -1: disable checks, 0 = don't retry, 1 = retry once if - * failed, etc - */ + /** How many retries per failed tile. -1: disable checks, 0 = don't retry, 1 = retry once if failed, etc */ public static int TILE_FAILURE_RETRY_COUNT_DEFAULT = 0; /** How much (in milliseconds) to wait before trying again a failed tile */ public static long TILE_FAILURE_RETRY_WAIT_TIME_DEFAULT = 100; /** - * How many failures to tolerate before aborting the seed task. Value is shared between all the - * threads of the same run. + * How many failures to tolerate before aborting the seed task. Value is shared between all the threads of the same + * run. */ public static long TOTAL_FAILURES_BEFORE_ABORTING_DEFAULT = 1000; @@ -149,8 +143,8 @@ public SubmittedTask(final GWCTask task, final Future future) { } /** - * Initializes the seed task failure control variables either with the provided environment - * variable values or their defaults. + * Initializes the seed task failure control variables either with the provided environment variable values or their + * defaults. * * @see {@link TileBreeder class' javadocs} for more information * @see @@ -173,10 +167,9 @@ public void setApplicationContext(ApplicationContext applicationContext) throws @SuppressWarnings("serial") private void checkPositive(long value, String variable) { if (value < 0) { - throw new BeanInitializationException( - "Invalid configuration value for environment variable " - + variable - + ". It should be a positive integer.") {}; + throw new BeanInitializationException("Invalid configuration value for environment variable " + + variable + + ". It should be a positive integer.") {}; } } @@ -187,13 +180,12 @@ private long toLong(String varName, String paramVal, long defaultVal) { try { return Long.valueOf(paramVal); } catch (NumberFormatException e) { - log.warning( - "Invalid environment parameter for " - + varName - + ": '" - + paramVal - + "'. Using default value: " - + defaultVal); + log.warning("Invalid environment parameter for " + + varName + + ": '" + + paramVal + + "'. Using default value: " + + defaultVal); } return defaultVal; } @@ -207,15 +199,13 @@ public void seed(final String layerName, final SeedRequest sr) throws GeoWebCach TileRange tr = createTileRange(sr, tl); - GWCTask[] tasks = - createTasks(tr, tl, sr.getType(), sr.getThreadCount(), sr.getFilterUpdate()); + GWCTask[] tasks = createTasks(tr, tl, sr.getType(), sr.getThreadCount(), sr.getFilterUpdate()); dispatchTasks(tasks); } /** - * Create tasks to manipulate the cache (Seed, truncate, etc) They will still need to be - * dispatched. + * Create tasks to manipulate the cache (Seed, truncate, etc) They will still need to be dispatched. * * @param tr The range of tiles to work on. * @param type The type of task(s) to create @@ -223,8 +213,7 @@ public void seed(final String layerName, final SeedRequest sr) throws GeoWebCach * @param filterUpdate // TODO: What does this do? * @return Array of tasks. Will have length threadCount or 1. */ - public GWCTask[] createTasks( - TileRange tr, GWCTask.TYPE type, int threadCount, boolean filterUpdate) + public GWCTask[] createTasks(TileRange tr, GWCTask.TYPE type, int threadCount, boolean filterUpdate) throws GeoWebCacheException { String layerName = tr.getLayerName(); @@ -232,8 +221,7 @@ public GWCTask[] createTasks( return createTasks(tr, tileLayer, type, threadCount, filterUpdate); } - public GWCTask[] createTasks( - TileRange tr, TileLayer tl, GWCTask.TYPE type, int threadCount, boolean filterUpdate) + public GWCTask[] createTasks(TileRange tr, TileLayer tl, GWCTask.TYPE type, int threadCount, boolean filterUpdate) throws GeoWebCacheException { return createTasks( tr, @@ -247,8 +235,7 @@ public GWCTask[] createTasks( } /** - * Create tasks to manipulate the cache (Seed, truncate, etc). They will still need to be - * dispatched. + * Create tasks to manipulate the cache (Seed, truncate, etc). They will still need to be dispatched. * * @param tr The range of tiles to work on. * @param tl The layer to work on. Overrides any layer specified on tr. @@ -257,8 +244,7 @@ public GWCTask[] createTasks( * @param filterUpdate // TODO: What does this do? * @param tileFailureRetryCount Number of retries for a single tile * @param tileFailureRetryWaitTime Time to wait between retries - * @param totalFailuresBeforeAborting Total number of failures, across all threads, before - * aborting seeding + * @param totalFailuresBeforeAborting Total number of failures, across all threads, before aborting seeding * @return Array of tasks. Will have length threadCount or 1. */ public GWCTask[] createTasks( @@ -289,10 +275,7 @@ public GWCTask[] createTasks( } else { SeedTask task = (SeedTask) createSeedTask(type, trIter, tl, filterUpdate); task.setFailurePolicy( - tileFailureRetryCount, - tileFailureRetryWaitTime, - totalFailuresBeforeAborting, - failureCounter); + tileFailureRetryCount, tileFailureRetryWaitTime, totalFailuresBeforeAborting, failureCounter); tasks[i] = task; } tasks[i].setThreadInfo(sharedThreadCount, i); @@ -323,8 +306,7 @@ public void dispatchTasks(GWCTask[] tasks) { } /** Find the tile range for a Seed Request. */ - public static TileRange createTileRange(SeedRequest req, TileLayer tl) - throws GeoWebCacheException { + public static TileRange createTileRange(SeedRequest req, TileLayer tl) throws GeoWebCacheException { int zoomStart = req.getZoomStart().intValue(); int zoomStop = req.getZoomStop().intValue(); @@ -349,10 +331,9 @@ public static TileRange createTileRange(SeedRequest req, TileLayer tl) if (crsMatches.size() == 1) { gridSetId = crsMatches.get(0).getName(); } else { - throw new IllegalArgumentException( - "More than one GridSubet matches the requested SRS " - + srs - + ". gridSetId must be specified"); + throw new IllegalArgumentException("More than one GridSubet matches the requested SRS " + + srs + + ". gridSetId must be specified"); } } } @@ -381,8 +362,7 @@ public static TileRange createTileRange(SeedRequest req, TileLayer tl) String layerName = tl.getName(); Map parameters = req.getParameters(); - return new TileRange( - layerName, gridSetId, zoomStart, zoomStop, coveredGridLevels, mimeType, parameters); + return new TileRange(layerName, gridSetId, zoomStart, zoomStop, coveredGridLevels, mimeType, parameters); } /** @@ -392,8 +372,7 @@ public static TileRange createTileRange(SeedRequest req, TileLayer tl) * @param trIter a collection of tile ranges * @param tl the layer */ - private GWCTask createSeedTask( - TYPE type, TileRangeIterator trIter, TileLayer tl, boolean doFilterUpdate) + private GWCTask createSeedTask(TYPE type, TileRangeIterator trIter, TileLayer tl, boolean doFilterUpdate) throws IllegalArgumentException { switch (type) { @@ -406,31 +385,27 @@ private GWCTask createSeedTask( } } - private GWCTask createTruncateTask( - TileRangeIterator trIter, TileLayer tl, boolean doFilterUpdate) { + private GWCTask createTruncateTask(TileRangeIterator trIter, TileLayer tl, boolean doFilterUpdate) { return new TruncateTask(storageBroker, trIter.getTileRange(), tl, doFilterUpdate); } /** - * Method returns List of Strings representing the status of the currently running and scheduled - * threads + * Method returns List of Strings representing the status of the currently running and scheduled threads * - * @return array of {@code [[tilesDone, tilesTotal, timeRemaining, taskID, taskStatus],...]} - * where {@code taskStatus} is one of: {@code 0 = PENDING, 1 = RUNNING, 2 = DONE, -1 = - * ABORTED} + * @return array of {@code [[tilesDone, tilesTotal, timeRemaining, taskID, taskStatus],...]} where + * {@code taskStatus} is one of: {@code 0 = PENDING, 1 = RUNNING, 2 = DONE, -1 = ABORTED} */ public long[][] getStatusList() { return getStatusList(null); } /** - * Method returns List of Strings representing the status of the currently running and scheduled - * threads for a specific layer. + * Method returns List of Strings representing the status of the currently running and scheduled threads for a + * specific layer. * - * @return array of {@code [[tilesDone, tilesTotal, timeRemaining, taskID, taskStatus],...]} - * where {@code taskStatus} is one of: {@code 0 = PENDING, 1 = RUNNING, 2 = DONE, -1 = - * ABORTED} + * @return array of {@code [[tilesDone, tilesTotal, timeRemaining, taskID, taskStatus],...]} where + * {@code taskStatus} is one of: {@code 0 = PENDING, 1 = RUNNING, 2 = DONE, -1 = ABORTED} * @param layerName the name of the layer. null for all layers. */ public long[][] getStatusList(final String layerName) { @@ -484,7 +459,8 @@ private void drain() { try { dispatchesWithoutDrain = 0; threadPool.purge(); - for (Iterator> it = this.currentPool.entrySet().iterator(); + for (Iterator> it = + this.currentPool.entrySet().iterator(); it.hasNext(); ) { if (it.next().getValue().future.isDone()) { it.remove(); diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateAllRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateAllRequest.java index b11c579f78..b8c2dace7c 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateAllRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateAllRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Imran Rajjad / Geosolutions 2019 */ @@ -37,11 +36,11 @@ public class TruncateAllRequest implements MassTruncateRequest, Serializable { private static final Logger log = Logging.getLogger(TruncateAllRequest.class.getName()); - @XStreamOmitField private StringBuilder trucatedLayers = new StringBuilder(); + @XStreamOmitField + private StringBuilder trucatedLayers = new StringBuilder(); @Override - public boolean doTruncate(StorageBroker sb, TileBreeder breeder) - throws StorageException, GeoWebCacheException { + public boolean doTruncate(StorageBroker sb, TileBreeder breeder) throws StorageException, GeoWebCacheException { Iterator iterator = breeder.getLayers().iterator(); TileLayer toTruncate; Iterator gridSetIterator; @@ -87,17 +86,15 @@ public String getTrucatedLayersList() { private StringBuilder getResponsePage() { StringBuilder doc = new StringBuilder(); - String content = - "

    Truncated All Layers

    \n" - + "

    Truncated Layers:" - + getTrucatedLayersList().toString() - + "

    "; + String content = "

    Truncated All Layers

    \n" + + "

    Truncated Layers:" + + getTrucatedLayersList().toString() + + "

    "; - doc.append( - "\n" - + ServletUtils.gwcHtmlHeader("../", "GWC Seed Form") - + "\n" - + ServletUtils.gwcHtmlLogoLink("../")); + doc.append("\n" + + ServletUtils.gwcHtmlHeader("../", "GWC Seed Form") + + "\n" + + ServletUtils.gwcHtmlLogoLink("../")); doc.append("

    " + content + "

    "); doc.append("

    Go back

    "); return doc; diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateBboxRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateBboxRequest.java index 2504c47c2d..2025369972 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateBboxRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateBboxRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -51,8 +50,7 @@ public TruncateBboxRequest(String layerName, BoundingBox bounds, String gridSetI } @Override - public boolean doTruncate(StorageBroker sb, TileBreeder breeder) - throws StorageException, GeoWebCacheException { + public boolean doTruncate(StorageBroker sb, TileBreeder breeder) throws StorageException, GeoWebCacheException { final Set> allParams = sb.getCachedParameters(layerName); final TileLayer tileLayer = breeder.findTileLayer(layerName); final Collection allFormats = tileLayer.getMimeTypes(); @@ -60,40 +58,32 @@ public boolean doTruncate(StorageBroker sb, TileBreeder breeder) final int minZ = Optional.fromNullable(subSet.getMinCachedZoom()).or(subSet.getZoomStart()); final int maxZ = Optional.fromNullable(subSet.getMaxCachedZoom()).or(subSet.getZoomStop()); // Create seed request for each combination of params and format - Function, Stream> seedRequestMapper = - params -> - allFormats.stream() - .map( - format -> - new SeedRequest( - layerName, - bounds, - gridSetId, - 1, - minZ, - maxZ, - format.getMimeType(), - GWCTask.TYPE.TRUNCATE, - params)); + Function, Stream> seedRequestMapper = params -> allFormats.stream() + .map(format -> new SeedRequest( + layerName, + bounds, + gridSetId, + 1, + minZ, + maxZ, + format.getMimeType(), + GWCTask.TYPE.TRUNCATE, + params)); try { - int taskCount = - Stream.concat( - allParams.stream(), - Stream.of( - (Map) - null)) // Add null for the default parameters - .flatMap(seedRequestMapper) - .map( - request -> { - try { - breeder.seed(layerName, request); - return 1; - } catch (GeoWebCacheException e) { - throw new UncheckedGeoWebCacheException(e); - } - }) - .reduce((x, y) -> x + y) - .orElse(0); + int taskCount = Stream.concat( + allParams.stream(), + Stream.of((Map) null)) // Add null for the default parameters + .flatMap(seedRequestMapper) + .map(request -> { + try { + breeder.seed(layerName, request); + return 1; + } catch (GeoWebCacheException e) { + throw new UncheckedGeoWebCacheException(e); + } + }) + .reduce((x, y) -> x + y) + .orElse(0); return taskCount > 0; } catch (UncheckedGeoWebCacheException e) { throw e.getCause(); diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateLayerRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateLayerRequest.java index 95c13e97e6..38f1e6ee5c 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateLayerRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateLayerRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateOrphansRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateOrphansRequest.java index fc96faba06..237a4c231f 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateOrphansRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateOrphansRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ @@ -21,8 +20,8 @@ import org.geowebcache.storage.StorageException; /** - * Truncate atiles from a cache where we know they are no longer reachable, or we can't know that - * due to missing metadata. + * Truncate atiles from a cache where we know they are no longer reachable, or we can't know that due to missing + * metadata. * * @author smithkm */ @@ -31,8 +30,7 @@ public class TruncateOrphansRequest implements MassTruncateRequest { String layerName; @Override - public boolean doTruncate(StorageBroker sb, TileBreeder breeder) - throws GeoWebCacheException, StorageException { + public boolean doTruncate(StorageBroker sb, TileBreeder breeder) throws GeoWebCacheException, StorageException { final TileLayer layer = breeder.findTileLayer(layerName); return sb.purgeOrphans(layer); } diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateParametersRequest.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateParametersRequest.java index b0792964e4..4592b1b3a7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateParametersRequest.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateParametersRequest.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Kevin Smith, Boundless, 2017 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateTask.java b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateTask.java index 0e76d2acdc..e708e7ebef 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateTask.java +++ b/geowebcache/core/src/main/java/org/geowebcache/seed/TruncateTask.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp / The Open Planning Project 2008 */ @@ -79,9 +78,7 @@ private void runFilterUpdates() { if (reqFilter.update(tl, tr.getGridSetId())) { log.log(Level.FINE, "Updated request filter " + reqFilter.getName()); } else { - log.log( - Level.FINE, - "Request filter " + reqFilter.getName() + " returned false on update."); + log.log(Level.FINE, "Request filter " + reqFilter.getName() + " returned false on update."); } } } diff --git a/geowebcache/core/src/main/java/org/geowebcache/service/HttpErrorCodeException.java b/geowebcache/core/src/main/java/org/geowebcache/service/HttpErrorCodeException.java index 7fdf359bcc..3ea12a5a1e 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/service/HttpErrorCodeException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/service/HttpErrorCodeException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ @@ -17,8 +16,7 @@ /** * An exception thrown by a service to report back an http error code. * - *

    Instances of this exception are recognized by the dispatcher. The {@link #getErrorCode()} is - * used to set + *

    Instances of this exception are recognized by the dispatcher. The {@link #getErrorCode()} is used to set * * @author Justin Deoliveira, The Open Planning Project */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/service/OWSException.java b/geowebcache/core/src/main/java/org/geowebcache/service/OWSException.java index 948b3b2943..6cc912a96e 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/service/OWSException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/service/OWSException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, OpenGeo, Copyright 2009 */ @@ -56,12 +55,7 @@ public String toString() { str.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"); str.append( " xsi:schemaLocation=\"http://www.opengis.net/ows/1.1 http://geowebcache.org/schema/ows/1.1.0/owsExceptionReport.xsd\">\n"); - str.append( - " \n"); + str.append(" \n"); str.append(" " + exceptionText + "\n"); str.append(" \n"); str.append("\n"); diff --git a/geowebcache/core/src/main/java/org/geowebcache/service/Service.java b/geowebcache/core/src/main/java/org/geowebcache/service/Service.java index 8413b0329d..b32ca45439 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/service/Service.java +++ b/geowebcache/core/src/main/java/org/geowebcache/service/Service.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The Open Planning Project, Copyright 2008 */ @@ -49,25 +48,19 @@ public String getPathName() { // TODO these should be renamed / removed public Conveyor getConveyor(HttpServletRequest request, HttpServletResponse response) throws GeoWebCacheException, OWSException { - throw new ServiceException( - "Service for " - + pathName - + " needs to override " - + "getConveyor(HttpSerlvetRequest,HttpServletResponse)"); + throw new ServiceException("Service for " + + pathName + + " needs to override " + + "getConveyor(HttpSerlvetRequest,HttpServletResponse)"); } public void handleRequest(Conveyor conv) throws GeoWebCacheException, OWSException { throw new RuntimeException( - "Service for " - + pathName - + " needs to override " - + "handleRequest(TileLayerDispatcher, Tile)"); + "Service for " + pathName + " needs to override " + "handleRequest(TileLayerDispatcher, Tile)"); } protected String getLayersParameter(HttpServletRequest request) throws ServiceException { - String layers = - ServletUtils.stringFromMap( - request.getParameterMap(), request.getCharacterEncoding(), "layers"); + String layers = ServletUtils.stringFromMap(request.getParameterMap(), request.getCharacterEncoding(), "layers"); if (layers == null) { throw new ServiceException("Unable to parse layers parameter from request."); } @@ -96,10 +89,7 @@ protected static void writeTileResponse(ConveyorTile conv, boolean writeExpirati } protected static void writeTileResponse( - ConveyorTile conv, - boolean writeExpiration, - RuntimeStats stats, - String mimeTypeOverride) { + ConveyorTile conv, boolean writeExpiration, RuntimeStats stats, String mimeTypeOverride) { HttpServletResponse response = conv.servletResp; Resource data = conv.getBlob(); diff --git a/geowebcache/core/src/main/java/org/geowebcache/service/ServiceException.java b/geowebcache/core/src/main/java/org/geowebcache/service/ServiceException.java index dbeb5e0ac8..4aa59b7ced 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/service/ServiceException.java +++ b/geowebcache/core/src/main/java/org/geowebcache/service/ServiceException.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * *

    Copyright 2019 */ diff --git a/geowebcache/core/src/main/java/org/geowebcache/stats/RuntimeStats.java b/geowebcache/core/src/main/java/org/geowebcache/stats/RuntimeStats.java index 00f460865b..8f70174b34 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/stats/RuntimeStats.java +++ b/geowebcache/core/src/main/java/org/geowebcache/stats/RuntimeStats.java @@ -1,14 +1,13 @@ /** - * This program is free software: you can redistribute it and/or modify it under the terms of the - * GNU Lesser General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + *

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - *

    You should have received a copy of the GNU Lesser General Public License along with this - * program. If not, see . + *

    You should have received a copy of the GNU Lesser General Public License along with this program. If not, see + * . * * @author Arne Kepp, The OpenGeo, Copyright 2009 */ @@ -68,8 +67,8 @@ public class RuntimeStats { /** * @param pollInterval seconds between recording aggregate values - * @param intervals the intervals for which to report, in seconds, ascending. Each interval must - * be a multiple of the pollInterval + * @param intervals the intervals for which to report, in seconds, ascending. Each interval must be a multiple of + * the pollInterval * @param intervalDescs the description for each of the previously defined intervals */ public RuntimeStats(int pollInterval, List intervals, List intervalDescs) { @@ -77,13 +76,12 @@ public RuntimeStats(int pollInterval, List intervals, List inte } /** * @param pollInterval seconds between recording aggregate values - * @param intervals the intervals for which to report, in seconds, ascending. Each interval must - * be a multiple of the pollInterval + * @param intervals the intervals for which to report, in seconds, ascending. Each interval must be a multiple of + * the pollInterval * @param intervalDescs the description for each of the previously defined intervals * @param clock the clock to use to keep track of the time */ - public RuntimeStats( - int pollInterval, List intervals, List intervalDescs, Clock clock) { + public RuntimeStats(int pollInterval, List intervals, List intervalDescs, Clock clock) { this.clock = clock; this.startTime = this.clock.millis(); @@ -103,10 +101,7 @@ public RuntimeStats( if (curVal % pollInterval != 0) { log.log( Level.SEVERE, - "The interval (" - + curVal - + ") must be a multiple of the poll interval " - + pollInterval); + "The interval (" + curVal + ") must be a multiple of the poll interval " + pollInterval); curVal = curVal - (curVal % pollInterval); } this.intervals[i] = curVal; @@ -177,16 +172,11 @@ public String getHTMLStats() { if (runningTime > 0) { str.append("

  • Started:"); - str.append( - ServletUtils.formatTimestamp(this.startTime) - + " (" - + formatTimeDiff(runningTime) - + ") "); + str.append(ServletUtils.formatTimestamp(this.startTime) + " (" + formatTimeDiff(runningTime) + ") "); str.append("
    Total number of requests:" - + totalRequests); + str.append("
    Total number of requests:" + + totalRequests); str.append(" (" + totalRequests / (runningTime) + "/s ) "); str.append("
    Total number of bytes:" - + totalBytes); + str.append("
    Total number of bytes:" + + totalBytes); str.append(" (" + formatBits((totalBytes * 8.0) / (runningTime)) + ") "); str.append("
    Cache hit ratio:"); + str.append("
    Cache hit ratio:"); if (totalHits + totalMisses > 0) { double hitPercentage = (totalHits * 100.0) / (totalHits + totalMisses); int rounded = (int) Math.round(hitPercentage * 100.0); @@ -225,18 +213,13 @@ public String getHTMLStats() { str.append("
    Blank/KML/HTML:"); + str.append("
    Blank/KML/HTML:"); if (totalRequests > 0) { if (totalHits + totalMisses == 0) { str.append("100.0% of requests"); } else { - int rounded = - (int) - Math.round( - ((totalRequests - totalHits - totalMisses - totalWMS) - * 100.0) - / totalRequests); + int rounded = (int) + Math.round(((totalRequests - totalHits - totalMisses - totalWMS) * 100.0) / totalRequests); int percents = rounded / 100; int decimals = rounded - percents * 100; str.append(percents + "." + decimals + "% of requests"); @@ -249,8 +232,7 @@ public String getHTMLStats() { str.append("
    Peak request rate:"); + str.append("
    Peak request rate:"); if (totalRequests > 0) { str.append(formatRequests((peakRequests * 1.0) / pollInterval)); str.append(" (" + ServletUtils.formatTimestamp(peakRequestsTime) + ") "); @@ -259,8 +241,7 @@ public String getHTMLStats() { } str.append("
    Peak bandwidth:"); + str.append("
    Peak bandwidth:"); if (totalRequests > 0) { str.append(formatBits((peakBytes * 8.0) / pollInterval)); str.append(" (" + ServletUtils.formatTimestamp(peakRequestsTime) + ") "); @@ -284,31 +265,28 @@ public String getHTMLStats() { String[] bits = calculateBits(intervals[i]); - str.append( - "
    " - + intervalDescs[i] - + "" - + requests[0] - + "" - + requests[1] - + "" - + bits[0] - + "" - + bits[1] - + "" - + "
    " + + intervalDescs[i] + + "" + + requests[0] + + "" + + requests[1] + + "" + + bits[0] + + "" + + bits[1] + + "" + + "
    All figures are " - + pollInterval - + " second(s) delayed and do not include HTTP overhead
    All figures are " + + pollInterval + + " second(s) delayed and do not include HTTP overhead
    The cache hit ratio does not account for metatiling
    The cache hit ratio does not account for metatiling