port to 1.3.x branch: switch to slf4j to close #12

This commit is contained in:
ccancellieri 2012-04-19 13:21:11 +02:00
parent 270f3450fb
commit da77d4ede0
21 changed files with 372 additions and 343 deletions

486
pom.xml
View File

@ -1,265 +1,279 @@
<!--
* GeoServer-Manager - Simple Manager Library for GeoServer
*
* Copyright (C) 2007,2011 GeoSolutions S.A.S.
* http://www.geo-solutions.it
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
-->
<!-- * GeoServer-Manager - Simple Manager Library for GeoServer * * Copyright
(C) 2007,2011 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission
is hereby granted, free of charge, to any person obtaining a copy * of this
software and associated documentation files (the "Software"), to deal * in
the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is *
furnished to do so, subject to the following conditions: * * The above copyright
notice and this permission notice shall be included in * all copies or substantial
portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN * THE SOFTWARE. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.geosolutions</groupId>
<artifactId>geoserver-manager</artifactId>
<version>1.3.3-SNAPSHOT</version>
<groupId>it.geosolutions</groupId>
<artifactId>geoserver-manager</artifactId>
<version>1.4.1-SNAPSHOT</version>
<packaging>jar</packaging>
<packaging>jar</packaging>
<name>GeoServer 2 Manager - REST based</name>
<description>
<name>GeoServer 2 Manager - REST based</name>
<description>
GeoServer Manager is a library to interact with GeoServer 2.x.
The scope of this library is to have a simple API, and use as few external
libs as possible.
</description>
<inceptionYear>2007</inceptionYear>
<inceptionYear>2007</inceptionYear>
<organization>
<name>GeoSolutions</name>
<url>http://www.geo-solutions.it</url>
</organization>
<organization>
<name>GeoSolutions</name>
<url>http://www.geo-solutions.it</url>
</organization>
<developers>
<developer>
<id>etj</id>
<name>Emanuele Tajariol</name>
<email>etj AT geosolutions.it</email>
<organization>GeoSolutions</organization>
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+1</timezone>
</developer>
<developer>
<id>ccancellieri</id>
<name>Carlo Cancellieri</name>
<email>carlo.cancellieri AT geosolutions.it</email>
<organization>GeoSolutions</organization>
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+1</timezone>
</developer>
</developers>
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<url>http://code.google.com/p/geoserver-manager/</url>
<issueManagement>
<system>googlecode</system>
<url>http://code.google.com/p/geoserver-manager/issues/list</url>
</issueManagement>
<mailingLists>
<mailingList>
<name>GeoServer Manager User List</name>
<post>geoserver-manager-users@googlegroups.com </post>
<archive>http://groups.google.com/group/geoserver-manager-users/topics</archive>
</mailingList>
</mailingLists>
<developers>
<developer>
<id>etj</id>
<name>Emanuele Tajariol</name>
<email>etj AT geosolutions.it</email>
<organization>GeoSolutions</organization>
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+1</timezone>
</developer>
<developer>
<id>ccancellieri</id>
<name>Carlo Cancellieri</name>
<email>carlo.cancellieri AT geosolutions.it</email>
<organization>GeoSolutions</organization>
<organizationUrl>http://www.geo-solutions.it</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+1</timezone>
</developer>
</developers>
<scm>
<connection>scm:git:[fetch=]https://github.com/geosolutions-it/geoserver-manager.git[push=]git@github.com:geosolutions-it/geoserver-manager.git</connection>
<!--developerConnection>scm:git</developerConnection-->
<!--tag>master</tag-->
<url>https://github.com/geosolutions-it/geoserver-manager</url>
</scm>
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<ciManagement>
<system>jenkins</system>
<url>http://ci.geo-solutions.it/</url>
</ciManagement>
<distributionManagement>
<downloadUrl>http://maven.geo-solutions.it</downloadUrl>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>geosolutions</id>
<url>ftp://maven.geo-solutions.it/</url>
</repository>
<site>
<id>demo.geosolutions</id>
<url>scp://demo.geo-solutions.it/var/www/share/javadoc/gsman</url>
</site>
</distributionManagement>
<url>http://code.google.com/p/geoserver-manager/</url>
<issueManagement>
<system>googlecode</system>
<url>http://code.google.com/p/geoserver-manager/issues/list</url>
</issueManagement>
<mailingLists>
<mailingList>
<name>GeoServer Manager User List</name>
<post>geoserver-manager-users@googlegroups.com </post>
<archive>http://groups.google.com/group/geoserver-manager-users/topics</archive>
</mailingList>
</mailingLists>
<scm>
<connection>scm:git:[fetch=]https://github.com/geosolutions-it/geoserver-manager.git[push=]git@github.com:geosolutions-it/geoserver-manager.git</connection>
<!--developerConnection>scm:git</developerConnection -->
<!--tag>master</tag -->
<url>https://github.com/geosolutions-it/geoserver-manager</url>
</scm>
<ciManagement>
<system>jenkins</system>
<url>http://ci.geo-solutions.it/</url>
</ciManagement>
<distributionManagement>
<downloadUrl>http://maven.geo-solutions.it</downloadUrl>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>geosolutions</id>
<url>ftp://maven.geo-solutions.it/</url>
</repository>
<site>
<id>demo.geosolutions</id>
<url>scp://demo.geo-solutions.it/var/www/share/javadoc/gsman</url>
</site>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<detectLinks />
<!-- <links>
<link>http://commons.apache.org/dbcp/apidocs/</link>
<link>http://commons.apache.org/fileupload/apidocs/</link>
<link>http://download.oracle.com/javase/6/docs/api</link>
</links>-->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<detectLinks />
<!-- <links> <link>http://commons.apache.org/dbcp/apidocs/</link> <link>http://commons.apache.org/fileupload/apidocs/</link>
<link>http://download.oracle.com/javase/6/docs/api</link> </links> -->
</configuration>
</plugin>
<!-- ======================================================= -->
<!-- Source packaging. -->
<!-- ======================================================= -->
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- versioning -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
<!-- ======================================================= -->
<!-- Source packaging. -->
<!-- ======================================================= -->
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- versioning -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
<!-- ======================================================== -->
<!-- Extensions settings for Deployment -->
<!-- ======================================================== -->
<extensions>
<!--.............................................-->
<!-- geo-solutions (using wagon ftp) -->
<!--.............................................-->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>
<!-- ======================================================== -->
<!-- Extensions settings for Deployment -->
<!-- ======================================================== -->
<extensions>
<!--............................................. -->
<!-- geo-solutions (using wagon ftp) -->
<!--............................................. -->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://commons.apache.org/lang/api</link>
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
<link>http://www.jdom.org/docs/apidocs</link>
</links>
</configuration>
</plugin>
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
</plugin>-->
</plugins>
</reporting>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<links>
<link>http://commons.apache.org/lang/api</link>
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
<link>http://www.jdom.org/docs/apidocs</link>
</links>
</configuration>
</plugin>
<dependencies>
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version> </plugin> -->
</plugins>
</reporting>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
</dependency>
<properties>
<slf4j.version>1.5.11</slf4j.version>
</properties>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
</dependency>
<!--=================================================================-->
<!-- TEST -->
<!--=================================================================-->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5.6.SEC02</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- commons-logging can be rather simply and conveniently excluded as
a dependency by declaring it in the provided scope within the pom.xml file
of your project. The actual commons-logging classes would be provided by
jcl-over-slf4j. This translates into the following pom file snippet: -->
<!-- <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId>
<version>1.1.1</version> <scope>provided</scope> </dependency> <dependency>
<groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>-->
<!--================================================================= -->
<!-- TEST -->
<!--================================================================= -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5.6.SEC02</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -44,8 +44,8 @@ import java.util.Iterator;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.io.FilenameUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Connect to a GeoServer instance to publish or modify data.
@ -56,8 +56,7 @@ import org.apache.log4j.Logger;
*/
public class GeoServerRESTPublisher {
private static final Logger LOGGER = Logger
.getLogger(GeoServerRESTPublisher.class);
private static final Logger LOGGER = LoggerFactory.getLogger(GeoServerRESTPublisher.class);
private final String restURL;
private final String gsuser;
private final String gspass;
@ -135,7 +134,7 @@ public class GeoServerRESTPublisher {
try {
return publishStyle(sldBody, null);
} catch (IllegalArgumentException e) {
if (LOGGER.isEnabledFor(Level.ERROR)) {
if (LOGGER.isErrorEnabled()) {
LOGGER.error(e.getLocalizedMessage(), e);
}
}
@ -338,7 +337,7 @@ public class GeoServerRESTPublisher {
try {
return removeStyle(styleName, true);
} catch (IllegalArgumentException e) {
if (LOGGER.isEnabledFor(Level.ERROR)) {
if (LOGGER.isErrorEnabled()) {
LOGGER.error(e.getLocalizedMessage(), e);
}
}
@ -416,7 +415,7 @@ public class GeoServerRESTPublisher {
LOGGER.info("Store successfully created using ( " + uri + " )");
return true;
} else {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Error in creating store using: " + uri);
return false;
}
@ -712,7 +711,7 @@ public class GeoServerRESTPublisher {
final String layername = fte.getName();
if (layername == null || layername.isEmpty()) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("GSFeatureTypeEncoder has no valid name associated, try using GSFeatureTypeEncoder.setName(String)");
return false;
}
@ -729,7 +728,7 @@ public class GeoServerRESTPublisher {
LOGGER.info("DB layer successfully added (layer:" + layername + ")");
if (layerEncoder == null) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("GSLayerEncoder is null: Unable to find the defauldStyle for this layer");
return false;
}
@ -1110,7 +1109,7 @@ public class GeoServerRESTPublisher {
// create Coverage Store
if (!createCoverage(workspace, storeName, coverageEncoder)) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Unable to create a coverage for the store:"+ coverageName);
return null;
}
@ -1122,7 +1121,7 @@ public class GeoServerRESTPublisher {
reader = new GeoServerRESTReader(this.restURL, this.gsuser, this.gspass);
return reader.getCoverageStore(workspace, storeName);
} catch (MalformedURLException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
LOGGER.error(e.getMessage(), e);
}
}
return null;
@ -1240,7 +1239,7 @@ public class GeoServerRESTPublisher {
* readable by target GeoServer not the calling client!
*/
if (!mosaicDir.isDirectory()) {
if (LOGGER.isEnabledFor(Level.WARN))
if (LOGGER.isWarnEnabled())
LOGGER.warn("Directory '"
+ mosaicDir
+ "' not exists locally. Continue: please check existance on the remote server.");
@ -1372,12 +1371,12 @@ public class GeoServerRESTPublisher {
return false;
}
if (!createCoverage(workspace, storeName, coverageEncoder)) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Unable to create a coverage for the store:" + coverageName);
return false;
}
if (!configureLayer(workspace, coverageName, layerEncoder)) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Unable to configure the Layer for the coverage:" + coverageName);
return false;
}
@ -1413,7 +1412,7 @@ public class GeoServerRESTPublisher {
fqLayerName = layerName;
if (LOGGER.isEnabledFor(Level.WARN)) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Null workspace while configuring layer : "
+ layerName + " -- This behavior is deprecated.");
}
@ -1456,8 +1455,8 @@ public class GeoServerRESTPublisher {
// the covstore is still there: should we delete it?
} catch (MalformedURLException ex) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(ex);
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(),ex);
return false;
}
}
@ -1485,7 +1484,7 @@ public class GeoServerRESTPublisher {
fqLayerName = layerName;
if (LOGGER.isEnabledFor(Level.WARN)) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Null workspace while configuring layer : "
+ layerName + " -- This behavior is deprecated.");
}
@ -1520,8 +1519,8 @@ public class GeoServerRESTPublisher {
// the store is still there: should we delete it?
} catch (MalformedURLException ex) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(ex);
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(),ex);
return false;
}
}
@ -1542,7 +1541,7 @@ public class GeoServerRESTPublisher {
try {
return removeDatastore(workspace, storename, true);
} catch (IllegalArgumentException e) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Arguments may not be null or empty!", e);
}
return false;
@ -1589,8 +1588,8 @@ public class GeoServerRESTPublisher {
return deleted;
} catch (MalformedURLException ex) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(ex);
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(),ex);
return false;
}
}
@ -1609,7 +1608,7 @@ public class GeoServerRESTPublisher {
try {
return removeCoverageStore(workspace, storename, true);
} catch (IllegalArgumentException e) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Arguments may not be null or empty!", e);
}
return false;
@ -1655,8 +1654,8 @@ public class GeoServerRESTPublisher {
return deleted;
} catch (MalformedURLException ex) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(ex);
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(),ex);
return false;
}
}
@ -1674,7 +1673,7 @@ public class GeoServerRESTPublisher {
try {
return removeWorkspace(workspace, false);
} catch (IllegalArgumentException e) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Arguments may not be null or empty!", e);
}
return false;
@ -1718,8 +1717,8 @@ public class GeoServerRESTPublisher {
return deleted;
} catch (MalformedURLException ex) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(ex);
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(),ex);
return false;
}
}
@ -1758,7 +1757,7 @@ public class GeoServerRESTPublisher {
boolean deleted = HTTPUtils.delete(deleteUrl.toExternalForm(),
gsuser, gspass);
if (!deleted) {
if (LOGGER.isEnabledFor(Level.WARN))
if (LOGGER.isWarnEnabled())
LOGGER.warn("Could not delete layergroup " + name);
} else {
if (LOGGER.isInfoEnabled())
@ -1767,8 +1766,8 @@ public class GeoServerRESTPublisher {
return deleted;
} catch (MalformedURLException ex) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(ex);
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(),ex);
return false;
}
}
@ -1794,7 +1793,7 @@ public class GeoServerRESTPublisher {
fqLayerName = layerName;
if (LOGGER.isEnabledFor(Level.WARN)) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Null workspace while removing layer : "
+ layerName + " -- This behavior is deprecated.");
}
@ -1802,7 +1801,7 @@ public class GeoServerRESTPublisher {
fqLayerName = workspace + ":" + layerName;
}
if (layerName == null) {
if (LOGGER.isEnabledFor(Level.ERROR)) {
if (LOGGER.isErrorEnabled()) {
LOGGER.error("Null layerName : " + layerName);
}
return false;
@ -1816,7 +1815,7 @@ public class GeoServerRESTPublisher {
LOGGER.info("Layer successfully removed: " + fqLayerName);
}
} else {
if (LOGGER.isEnabledFor(Level.WARN))
if (LOGGER.isWarnEnabled())
LOGGER.warn("Error removing layer " + fqLayerName);
}
@ -1856,7 +1855,7 @@ public class GeoServerRESTPublisher {
LOGGER.info("Layer successfully configured: " + fqLayerName);
}
} else {
if (LOGGER.isEnabledFor(Level.WARN))
if (LOGGER.isWarnEnabled())
LOGGER.warn("Error configuring layer " + fqLayerName + " (" + sendResult + ")");
}
@ -1879,7 +1878,7 @@ public class GeoServerRESTPublisher {
final String wsname, final String csname) {
final String cname = ce.getName();
if (cname == null) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("Unable to configure a coverage with no name try using GSCoverageEncoder.setName(String)");
return false;
}
@ -1888,13 +1887,13 @@ public class GeoServerRESTPublisher {
try {
reader = new GeoServerRESTReader(restURL, gsuser, gspass);
} catch (MalformedURLException e) {
if (LOGGER.isEnabledFor(Level.ERROR))
LOGGER.error(e);
if (LOGGER.isErrorEnabled())
LOGGER.error(e.getLocalizedMessage(),e);
return false;
}
final RESTCoverageList covList = reader.getCoverages(wsname, csname);
if (covList.isEmpty()) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("No coverages found in new coveragestore "
+ csname);
return false;
@ -1910,7 +1909,7 @@ public class GeoServerRESTPublisher {
}
// if no coverage to configure is found return false
if (!found) {
if (LOGGER.isEnabledFor(Level.ERROR))
if (LOGGER.isErrorEnabled())
LOGGER.error("No coverages found in new coveragestore "
+ csname + " called " + cname);
return false;
@ -1929,7 +1928,7 @@ public class GeoServerRESTPublisher {
+ csname + ":" + cname);
}
} else {
if (LOGGER.isEnabledFor(Level.WARN))
if (LOGGER.isWarnEnabled())
LOGGER.warn("Error configuring coverage " + wsname + ":"
+ csname + ":" + cname + " (" + sendResult + ")");
}
@ -1983,7 +1982,7 @@ public class GeoServerRESTPublisher {
LOGGER.debug("Coverage successfully created " + wsname + ":" + storeName + ":" + coverageName);
}
} else {
if (LOGGER.isEnabledFor(Level.WARN))
if (LOGGER.isErrorEnabled())
LOGGER.warn("Error creating coverage " + wsname + ":" + storeName + ":" + coverageName + " ("
+ sendResult + ")");
}

View File

@ -29,8 +29,8 @@ import it.geosolutions.geoserver.rest.decoder.RESTCoverage;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageList;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStoreList;
import it.geosolutions.geoserver.rest.decoder.RESTDataStoreList;
import it.geosolutions.geoserver.rest.decoder.RESTDataStore;
import it.geosolutions.geoserver.rest.decoder.RESTDataStoreList;
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
import it.geosolutions.geoserver.rest.decoder.RESTLayerGroup;
@ -46,7 +46,10 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@ -58,7 +61,7 @@ import org.apache.log4j.Logger;
*/
public class GeoServerRESTReader {
private final static Logger LOGGER = Logger.getLogger(GeoServerRESTReader.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoServerRESTReader.class);
private final String baseurl;
private String username;
private String password;

View File

@ -33,6 +33,7 @@ import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
@ -47,13 +48,14 @@ import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Low level HTTP utilities.
*/
class HTTPUtils {
private static final Logger LOGGER = Logger.getLogger(HTTPUtils.class);
private static final Logger LOGGER = LoggerFactory.getLogger(HTTPUtils.class);
/**
* Performs an HTTP GET on the given URL.

View File

@ -27,11 +27,13 @@ package it.geosolutions.geoserver.rest.decoder.utils;
import java.io.IOException;
import java.io.StringReader;
import org.apache.log4j.Logger;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -39,7 +41,7 @@ import org.jdom.input.SAXBuilder;
*/
public class JDOMBuilder {
private final static Logger LOGGER = Logger.getLogger(JDOMBuilder.class);
private final static Logger LOGGER = LoggerFactory.getLogger(JDOMBuilder.class);
public static Element buildElement(String response) {
if(response == null)

View File

@ -29,9 +29,10 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import org.jdom.Element;
import org.jdom.filter.Filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -42,7 +43,7 @@ public abstract class ElementUtils {
/**
* Default logger
*/
private final static Logger LOGGER = Logger.getLogger(ElementUtils.class);
private final static Logger LOGGER = LoggerFactory.getLogger(ElementUtils.class);
/**
*

View File

@ -38,7 +38,8 @@ import java.io.IOException;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -51,7 +52,7 @@ import org.springframework.core.io.ClassPathResource;
* @author etj
*/
public class ConfigTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(ConfigTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(ConfigTest.class);
private static final String DEFAULT_WS = "geosolutions";

View File

@ -25,19 +25,22 @@
package it.geosolutions.geoserver.rest;
import it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem;
import it.geosolutions.geoserver.rest.decoder.RESTCoverage;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.decoder.RESTDataStore;
import it.geosolutions.geoserver.rest.decoder.RESTFeatureType;
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
import it.geosolutions.geoserver.rest.decoder.RESTLayerGroup;
import it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Initializes REST params.
@ -54,7 +57,7 @@ import org.apache.log4j.Logger;
* @author etj
*/
public abstract class GeoserverRESTTest extends TestCase {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTTest.class);
protected static final String DEFAULT_WS = "geosolutions";

View File

@ -21,11 +21,12 @@ package it.geosolutions.geoserver.rest.encoder;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
*/
public class GSWorkspaceEncoderTest extends TestCase {
@ -36,18 +37,17 @@ public class GSWorkspaceEncoderTest extends TestCase {
/**
* Default logger
*/
protected final static Logger LOGGER = Logger.getLogger(GSWorkspaceEncoderTest.class);
protected final static Logger LOGGER = LoggerFactory.getLogger(GSWorkspaceEncoderTest.class);
@Test
public void testAll() {
final GSWorkspaceEncoder wsenc = new GSWorkspaceEncoder("WS1");
LOGGER.info(wsenc.toString());
wsenc.setName("test_name");
LOGGER.info(wsenc.toString());
wsenc.setName("new_name");
LOGGER.info(wsenc.toString());
final GSWorkspaceEncoder wsenc = new GSWorkspaceEncoder("WS1");
LOGGER.info(wsenc.toString());
wsenc.setName("test_name");
LOGGER.info(wsenc.toString());
wsenc.setName("new_name");
LOGGER.info(wsenc.toString());
}
}

View File

@ -26,10 +26,11 @@ import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Pr
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.jdom.Element;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -43,7 +44,7 @@ public class GSCoverageEncoderTest extends TestCase {
/**
* Default logger
*/
protected final static Logger LOGGER = Logger.getLogger(GSCoverageEncoderTest.class);
protected final static Logger LOGGER = LoggerFactory.getLogger(GSCoverageEncoderTest.class);
/**
* test set or reset of reprojection

View File

@ -21,8 +21,9 @@ package it.geosolutions.geoserver.rest.encoder.coverage;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -36,7 +37,7 @@ public class GSImageMosaicEncoderTest extends TestCase {
/**
* Default logger
*/
protected final static Logger LOGGER = Logger.getLogger(GSImageMosaicEncoderTest.class);
protected final static Logger LOGGER = LoggerFactory.getLogger(GSImageMosaicEncoderTest.class);
/**
* TODO implement this test

View File

@ -30,10 +30,11 @@ import java.math.BigDecimal;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.jdom.Element;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -41,7 +42,7 @@ import org.junit.Test;
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
*/
public class GSFeatureEncoderTest extends TestCase {
protected final static Logger LOGGER = Logger.getLogger(GSFeatureEncoderTest.class);
protected final static Logger LOGGER = LoggerFactory.getLogger(GSFeatureEncoderTest.class);
public GSFeatureEncoderTest() {
}

View File

@ -1,21 +1,17 @@
package it.geosolutions.geoserver.rest.encoder.utils;
import it.geosolutions.geoserver.rest.encoder.GSWorkspaceEncoderTest;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import org.jdom.Content;
import org.jdom.Element;
import org.jdom.filter.Filter;
import org.jdom.output.XMLOutputter;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ElementUtilsTest {
@ -23,7 +19,7 @@ public class ElementUtilsTest {
/**
* Default logger
*/
protected final static Logger LOGGER = Logger.getLogger(ElementUtilsTest.class);
protected final static Logger LOGGER = LoggerFactory.getLogger(ElementUtilsTest.class);
final static String NAME="TEST";

View File

@ -27,15 +27,14 @@ package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -47,7 +46,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTGeoTiffTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTGeoTiffTest.class);
public GeoserverRESTGeoTiffTest(String testName) {
super(testName);
@ -72,7 +71,7 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
boolean pc = publisher.publishExternalGeoTIFF(DEFAULT_WS, storeName, geotiff, layerName,"EPSG:4326",ProjectionPolicy.FORCE_DECLARED,"raster");
assertTrue("publish() failed", pc);
assertTrue(existsLayer(layerName));
LOGGER.info(pc);
LOGGER.info("Published "+pc);
RESTCoverageStore reloadedCS = reader.getCoverageStore(DEFAULT_WS, storeName);
assertEquals(storeName, reloadedCS.getName());

View File

@ -26,8 +26,8 @@
package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.ParameterConfigure;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
@ -40,7 +40,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -68,7 +69,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class GeoserverRESTImageMosaicTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTImageMosaicTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTImageMosaicTest.class);
public GeoserverRESTImageMosaicTest(String testName) {

View File

@ -29,7 +29,9 @@ package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.decoder.RESTDataStore;
import it.geosolutions.geoserver.rest.encoder.GSPostGISDatastoreEncoder;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Testcase for creating postgis-based resources on geoserver.
@ -57,7 +59,7 @@ import org.apache.log4j.Logger;
*/
public class GeoserverRESTPostgisDatastoreTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTPostgisDatastoreTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTPostgisDatastoreTest.class);
private static final String DEFAULT_WS = "it.geosolutions";
private final boolean pgIgnore;

View File

@ -31,7 +31,9 @@ import it.geosolutions.geoserver.rest.decoder.RESTLayer;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Testcase for publishing layers on geoserver.
@ -43,7 +45,7 @@ import org.apache.log4j.Logger;
*/
public class GeoserverRESTPublisherTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTPublisherTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTPublisherTest.class);
public GeoserverRESTPublisherTest(String testName) {
super(testName);

View File

@ -33,7 +33,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -46,7 +47,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class GeoserverRESTShapeTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTShapeTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTShapeTest.class);
public GeoserverRESTShapeTest(String testName) {
super(testName);

View File

@ -36,9 +36,10 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.jdom.Element;
import org.jdom.Namespace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -51,7 +52,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class GeoserverRESTStyleTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger
private final static Logger LOGGER = LoggerFactory
.getLogger(GeoserverRESTStyleTest.class);
public GeoserverRESTStyleTest(String testName) {

View File

@ -26,15 +26,13 @@
package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -47,7 +45,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class GeoserverRESTWorkspaceTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTWorkspaceTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTWorkspaceTest.class);
public GeoserverRESTWorkspaceTest(String testName) {
super(testName);

View File

@ -25,14 +25,15 @@
package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.ParameterConfigure;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import java.io.File;
import java.io.IOException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
@ -44,7 +45,7 @@ import org.springframework.core.io.ClassPathResource;
*/
public class GeoserverRESTWorldImageTest extends GeoserverRESTTest {
private final static Logger LOGGER = Logger.getLogger(GeoserverRESTWorldImageTest.class);
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTWorldImageTest.class);
public GeoserverRESTWorldImageTest(String testName) {
super(testName);