Revision 23de68fc
Added by Andreas Müller almost 2 years ago
cdmlib-api/src/main/java/eu/etaxonomy/cdm/persistence/dto/UuidAndTitleCache.java | ||
---|---|---|
12 | 12 |
import java.io.Serializable; |
13 | 13 |
import java.util.UUID; |
14 | 14 |
|
15 |
import org.apache.log4j.Logger; |
|
16 |
|
|
17 | 15 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
18 | 16 |
|
19 | 17 |
/** |
... | ... | |
24 | 22 |
|
25 | 23 |
private static final long serialVersionUID = 3446993458279371682L; |
26 | 24 |
|
27 |
@SuppressWarnings("unused") |
|
28 |
private static final Logger logger = Logger .getLogger(UuidAndTitleCache.class); |
|
29 |
|
|
30 | 25 |
private Class<? extends T> type; |
31 | 26 |
final private UUID uuid; |
32 | 27 |
private Integer id; |
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CacheLoader.java | ||
---|---|---|
15 | 15 |
import java.util.List; |
16 | 16 |
import java.util.Map; |
17 | 17 |
|
18 |
import org.apache.log4j.Logger; |
|
18 |
import org.apache.logging.log4j.LogManager; |
|
19 |
import org.apache.logging.log4j.Logger; |
|
19 | 20 |
import org.springframework.util.ReflectionUtils; |
20 | 21 |
|
21 | 22 |
import eu.etaxonomy.cdm.api.service.pager.Pager; |
... | ... | |
31 | 32 |
*/ |
32 | 33 |
public class CacheLoader { |
33 | 34 |
|
34 |
private static final Logger logger = Logger.getLogger(CacheLoader.class); |
|
35 |
private static final Logger logger = LogManager.getLogger(CacheLoader.class);
|
|
35 | 36 |
|
36 | 37 |
private static boolean isRecursiveEnabled = true; |
37 | 38 |
|
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmModelCacher.java | ||
---|---|---|
21 | 21 |
import java.util.Iterator; |
22 | 22 |
import java.util.Map; |
23 | 23 |
|
24 |
import org.apache.log4j.Logger; |
|
24 |
import org.apache.logging.log4j.LogManager; |
|
25 |
import org.apache.logging.log4j.Logger; |
|
25 | 26 |
import org.hibernate.SessionFactory; |
26 | 27 |
import org.hibernate.boot.Metadata; |
27 | 28 |
import org.hibernate.boot.MetadataSources; |
... | ... | |
46 | 47 |
*/ |
47 | 48 |
public class CdmModelCacher { |
48 | 49 |
|
49 |
private static final Logger logger = Logger.getLogger(CdmModelCacher.class); |
|
50 |
private static final Logger logger = LogManager.getLogger(CdmModelCacher.class);
|
|
50 | 51 |
|
51 | 52 |
public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml"; |
52 | 53 |
|
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmRemoteCacheManager.java | ||
---|---|---|
11 | 11 |
import java.io.IOException; |
12 | 12 |
import java.net.URISyntaxException; |
13 | 13 |
|
14 |
import org.apache.log4j.Logger; |
|
14 |
import org.apache.logging.log4j.LogManager; |
|
15 |
import org.apache.logging.log4j.Logger; |
|
15 | 16 |
|
16 | 17 |
import net.sf.ehcache.Cache; |
17 | 18 |
import net.sf.ehcache.CacheException; |
... | ... | |
23 | 24 |
public class CdmRemoteCacheManager { |
24 | 25 |
|
25 | 26 |
@SuppressWarnings("unused") |
26 |
private static final Logger logger = Logger.getLogger(CdmRemoteCacheManager.class); |
|
27 |
private static final Logger logger = LogManager.getLogger(CdmRemoteCacheManager.class);
|
|
27 | 28 |
|
28 | 29 |
private Cache cdmlibModelCache; |
29 | 30 |
|
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmTransientEntityCacher.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import javax.management.MBeanServer; |
20 | 20 |
|
21 |
import org.apache.log4j.Logger; |
|
21 |
import org.apache.logging.log4j.LogManager; |
|
22 |
import org.apache.logging.log4j.Logger; |
|
22 | 23 |
|
23 | 24 |
import eu.etaxonomy.cdm.api.cache.CdmCacherBase; |
24 | 25 |
import eu.etaxonomy.cdm.model.ICdmCacher; |
... | ... | |
51 | 52 |
*/ |
52 | 53 |
public class CdmTransientEntityCacher implements ICdmCacher { |
53 | 54 |
|
54 |
private static final Logger logger = Logger.getLogger(CdmTransientEntityCacher.class); |
|
55 |
private static final Logger logger = LogManager.getLogger(CdmTransientEntityCacher.class);
|
|
55 | 56 |
|
56 | 57 |
//the key for this cacher within the CacheManager |
57 | 58 |
private final String cacheId; |
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/EntityCacherDebugResult.java | ||
---|---|---|
16 | 16 |
import java.util.List; |
17 | 17 |
import java.util.Map; |
18 | 18 |
|
19 |
import org.apache.log4j.Logger; |
|
19 |
import org.apache.logging.log4j.LogManager; |
|
20 |
import org.apache.logging.log4j.Logger; |
|
20 | 21 |
import org.hibernate.LazyInitializationException; |
21 | 22 |
import org.hibernate.collection.spi.PersistentCollection; |
22 | 23 |
import org.hibernate.proxy.HibernateProxy; |
... | ... | |
35 | 36 |
*/ |
36 | 37 |
public class EntityCacherDebugResult { |
37 | 38 |
|
38 |
private static final Logger logger = Logger.getLogger(EntityCacherDebugResult.class); |
|
39 |
private static final Logger logger = LogManager.getLogger(EntityCacherDebugResult.class);
|
|
39 | 40 |
|
40 | 41 |
private Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap; |
41 | 42 |
|
cdmlib-commons/pom.xml | ||
---|---|---|
17 | 17 |
|
18 | 18 |
<dependencies> |
19 | 19 |
<dependency> |
20 |
<groupId>log4j</groupId> |
|
21 |
<artifactId>log4j</artifactId> |
|
20 |
<groupId>org.apache.logging.log4j</groupId>
|
|
21 |
<artifactId>log4j-core</artifactId>
|
|
22 | 22 |
</dependency> |
23 | 23 |
<dependency> |
24 | 24 |
<groupId>org.springframework</groupId> |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/CdmUtils.java | ||
---|---|---|
26 | 26 |
import java.util.regex.Pattern; |
27 | 27 |
|
28 | 28 |
import org.apache.commons.lang3.StringUtils; |
29 |
import org.apache.log4j.Logger; |
|
29 |
import org.apache.logging.log4j.LogManager; |
|
30 |
import org.apache.logging.log4j.Logger; |
|
30 | 31 |
|
31 | 32 |
/** |
32 | 33 |
* @author a.mueller |
... | ... | |
34 | 35 |
*/ |
35 | 36 |
public class CdmUtils { |
36 | 37 |
|
37 |
private static final Logger logger = Logger.getLogger(CdmUtils.class); |
|
38 |
private static final Logger logger = LogManager.getLogger(CdmUtils.class);
|
|
38 | 39 |
|
39 | 40 |
static private boolean urlIsJarOrBundle(URL url){ |
40 | 41 |
return url.getProtocol().startsWith("jar") || url.getProtocol().startsWith("bundleresource"); |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/DoubleResult.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.common; |
10 | 10 |
|
11 |
import org.apache.log4j.Logger; |
|
11 |
import org.apache.logging.log4j.LogManager; |
|
12 |
import org.apache.logging.log4j.Logger; |
|
12 | 13 |
|
13 | 14 |
/** |
14 | 15 |
* An instance of this class represents an method result that contains 2 variables. The variables may be typified. |
... | ... | |
17 | 18 |
* @since 30.10.2008 |
18 | 19 |
*/ |
19 | 20 |
public class DoubleResult<S extends Object, T extends Object> { |
20 |
private static final Logger logger = Logger.getLogger(DoubleResult.class); |
|
21 |
|
|
22 |
private static final Logger logger = LogManager.getLogger(DoubleResult.class); |
|
21 | 23 |
|
22 | 24 |
private S firstResult = null; |
23 | 25 |
private T secondResult = null; |
... | ... | |
26 | 28 |
if (logger.isDebugEnabled()){logger.debug("Constructor");} |
27 | 29 |
} |
28 | 30 |
|
29 |
|
|
30 | 31 |
public DoubleResult(S firstResult, T secondResult) { |
31 | 32 |
this.firstResult = firstResult; |
32 | 33 |
this.secondResult = secondResult; |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/DynamicBatch.java | ||
---|---|---|
12 | 12 |
import java.util.Iterator; |
13 | 13 |
import java.util.List; |
14 | 14 |
|
15 |
import org.apache.log4j.Logger; |
|
15 |
import org.apache.logging.log4j.LogManager; |
|
16 |
import org.apache.logging.log4j.Logger; |
|
16 | 17 |
|
17 | 18 |
/** |
18 | 19 |
* DynamicBatch: a JVM resources aware batch manager. |
... | ... | |
22 | 23 |
*/ |
23 | 24 |
public class DynamicBatch { |
24 | 25 |
|
25 |
public static final Logger logger = Logger.getLogger(DynamicBatch.class); |
|
26 |
public static final Logger logger = LogManager.getLogger(DynamicBatch.class);
|
|
26 | 27 |
|
27 | 28 |
int batchSize; |
28 | 29 |
int batchItemCount = -1; |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/ExcelUtils.java | ||
---|---|---|
19 | 19 |
import java.util.Locale; |
20 | 20 |
import java.util.Map; |
21 | 21 |
|
22 |
import org.apache.log4j.Logger; |
|
22 |
import org.apache.logging.log4j.LogManager; |
|
23 |
import org.apache.logging.log4j.Logger; |
|
23 | 24 |
import org.apache.poi.hssf.usermodel.HSSFDataFormatter; |
24 | 25 |
import org.apache.poi.ss.usermodel.Cell; |
25 | 26 |
import org.apache.poi.ss.usermodel.CellType; |
... | ... | |
33 | 34 |
* @since 18.11.2008 |
34 | 35 |
*/ |
35 | 36 |
public class ExcelUtils { |
36 |
private static final Logger logger = Logger.getLogger(ExcelUtils.class); |
|
37 |
|
|
38 |
private static final Logger logger = LogManager.getLogger(ExcelUtils.class); |
|
37 | 39 |
|
38 | 40 |
/** Reads all rows of an Excel worksheet */ |
39 | 41 |
public static List<Map<String, String>> parseXLS(URI uri) throws FileNotFoundException { |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/FileCopy.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.common; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
16 | 15 |
import java.io.InputStream; |
17 | 16 |
import java.io.OutputStream; |
18 | 17 |
|
19 |
import org.apache.log4j.Logger; |
|
18 |
import org.apache.logging.log4j.LogManager; |
|
19 |
import org.apache.logging.log4j.Logger; |
|
20 | 20 |
|
21 | 21 |
/** |
22 | 22 |
* @author a.mueller |
23 | 23 |
* @since 20.11.2008 |
24 |
* @version 1.0 |
|
25 | 24 |
*/ |
26 | 25 |
public class FileCopy { |
27 |
private static final Logger logger = Logger.getLogger(FileCopy.class); |
|
26 |
|
|
27 |
private static final Logger logger = LogManager.getLogger(FileCopy.class); |
|
28 | 28 |
|
29 | 29 |
// overwrite constants |
30 | 30 |
public static final int DO_OVERWRITE = 1; |
... | ... | |
33 | 33 |
// default values |
34 | 34 |
private static int bufferSize = 4 * 1024; |
35 | 35 |
private static int overwrite = DO_OVERWRITE; |
36 |
|
|
36 |
|
|
37 | 37 |
/** |
38 |
* Copies a File to another directory
|
|
38 |
* Copies a File to another directory |
|
39 | 39 |
* @param sourceFile |
40 | 40 |
* @param destinationDirectory |
41 | 41 |
* @param destFileName |
... | ... | |
57 | 57 |
} |
58 | 58 |
InputStream in = new FileInputStream(sourceFile); |
59 | 59 |
copy(in, destinationDirectory, destFileName); |
60 |
|
|
60 |
|
|
61 | 61 |
if (!destinationDirectory.isDirectory()) { |
62 | 62 |
logger.warn("Not a directory: " + destinationDirectory.getName()); |
63 | 63 |
return false; |
... | ... | |
65 | 65 |
File destinationFile = new File(destinationDirectory, destFileName); |
66 | 66 |
|
67 | 67 |
OutputStream out = new FileOutputStream(destinationFile); |
68 |
|
|
68 |
|
|
69 | 69 |
return copy(in, out); |
70 | 70 |
} |
71 |
|
|
71 |
|
|
72 | 72 |
public static boolean copy(InputStream in, File destinationDirectory, String destFileName) |
73 | 73 |
throws IOException { |
74 |
|
|
74 |
|
|
75 | 75 |
if (!destinationDirectory.isDirectory()) { |
76 | 76 |
throw new IOException("Destination is not a directory"); |
77 | 77 |
} |
... | ... | |
80 | 80 |
} |
81 | 81 |
File destinationFile = new File(destinationDirectory, destFileName); |
82 | 82 |
OutputStream out = new FileOutputStream(destinationFile); |
83 |
|
|
83 |
|
|
84 | 84 |
return copy(in, out); |
85 |
} |
|
86 |
|
|
85 |
}
|
|
86 |
|
|
87 | 87 |
public static boolean copy(InputStream in, OutputStream out) |
88 | 88 |
throws IOException { |
89 | 89 |
byte[] buffer = new byte[bufferSize]; |
... | ... | |
97 | 97 |
return true; |
98 | 98 |
} |
99 | 99 |
|
100 |
|
|
101 | 100 |
public static boolean copy(String source, String destDirectory, String destFileName) |
102 | 101 |
throws IOException { |
103 | 102 |
File sourceFile = new File(source); |
104 | 103 |
File destinationDir = new File(destDirectory); |
105 | 104 |
return copy(sourceFile, destinationDir, destFileName); |
106 | 105 |
} |
107 |
|
|
106 |
|
|
108 | 107 |
public static boolean copy(String source, String destDirectory) |
109 | 108 |
throws IOException { |
110 | 109 |
return copy(source, destDirectory, null); |
111 | 110 |
} |
112 | 111 |
|
113 |
|
|
114 | 112 |
/** |
115 |
* True if file
|
|
113 |
* True if file |
|
116 | 114 |
* @param file File destination |
117 | 115 |
* @return true if data can be copied, false otherwise |
118 | 116 |
*/ |
... | ... | |
126 | 124 |
return false; |
127 | 125 |
} |
128 | 126 |
} |
129 |
|
|
130 |
|
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
127 |
} |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/GeneralParser.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* |
|
3 |
*/ |
|
2 |
* Copyright (C) 2016 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
4 | 9 |
package eu.etaxonomy.cdm.common; |
5 | 10 |
|
6 | 11 |
import java.util.regex.Pattern; |
7 | 12 |
|
8 |
import org.apache.log4j.Logger; |
|
9 |
|
|
10 | 13 |
/** |
11 | 14 |
* @author a.mueller |
12 | 15 |
* @since 2013-Aug-02 |
13 | 16 |
*/ |
14 | 17 |
public class GeneralParser { |
15 | 18 |
|
16 |
@SuppressWarnings("unused") |
|
17 |
private static final Logger logger = Logger.getLogger(GeneralParser.class); |
|
18 |
|
|
19 | 19 |
static String isbnPatternStr = "^(ISBN\\s*)?(\\d-?){9}((\\d-?){3})?(\\d|X)$"; |
20 | 20 |
static Pattern isbnPattern; |
21 | 21 |
|
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/JvmMonitor.java | ||
---|---|---|
14 | 14 |
import java.lang.management.MemoryUsage; |
15 | 15 |
import java.util.List; |
16 | 16 |
|
17 |
import org.apache.log4j.Logger; |
|
17 |
import org.apache.logging.log4j.LogManager; |
|
18 |
import org.apache.logging.log4j.Logger; |
|
18 | 19 |
|
19 | 20 |
/** |
20 | 21 |
* @author a.kohlbecker |
... | ... | |
22 | 23 |
*/ |
23 | 24 |
public class JvmMonitor { |
24 | 25 |
|
25 |
public static final Logger logger = Logger.getLogger(JvmMonitor.class); |
|
26 |
public static final Logger logger = LogManager.getLogger(JvmMonitor.class);
|
|
26 | 27 |
|
27 | 28 |
private long gcTimeLast = 0; |
28 | 29 |
|
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/ResultWrapper.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.common; |
11 | 11 |
|
12 |
import org.apache.log4j.Logger; |
|
13 |
|
|
14 |
//import org.apache.log4j.Logger; |
|
12 |
import org.apache.logging.log4j.LogManager; |
|
13 |
import org.apache.logging.log4j.Logger; |
|
15 | 14 |
|
16 | 15 |
/** |
17 | 16 |
* Wrapps a result object so it can be used as method parameter and changed within the method. |
... | ... | |
27 | 26 |
* __}<br> |
28 | 27 |
* } |
29 | 28 |
* </code> |
30 |
* Here a String is returned but the boolean value may also be changed and it's value is useable
|
|
29 |
* Here a String is returned but the boolean value may also be changed and it's value is useable |
|
31 | 30 |
* by the calling method |
32 |
*
|
|
31 |
* |
|
33 | 32 |
* @author a.mueller |
34 | 33 |
* @since 01.11.2008 |
35 |
* @version 1.0 |
|
36 | 34 |
*/ |
37 | 35 |
public class ResultWrapper<T> { |
38 |
private static final Logger logger = Logger.getLogger(ResultWrapper.class); |
|
36 |
|
|
37 |
private static final Logger logger = LogManager.getLogger(ResultWrapper.class); |
|
39 | 38 |
|
40 | 39 |
public static final ResultWrapper<Boolean> NewInstance(Boolean value){ |
41 | 40 |
ResultWrapper<Boolean> result = new ResultWrapper<Boolean>(); |
... | ... | |
43 | 42 |
if (logger.isDebugEnabled()){logger.debug("New Instance");} |
44 | 43 |
return result; |
45 | 44 |
} |
46 |
|
|
47 |
T object; |
|
48 | 45 |
|
49 |
/** |
|
50 |
* @return the object |
|
51 |
*/ |
|
46 |
private T object; |
|
47 |
|
|
52 | 48 |
public T getValue() { |
53 | 49 |
return object; |
54 | 50 |
} |
55 | 51 |
|
56 |
/** |
|
57 |
* @param object the object to set |
|
58 |
*/ |
|
59 | 52 |
public void setValue(T value) { |
60 | 53 |
this.object = value; |
61 | 54 |
} |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/StreamUtils.java | ||
---|---|---|
17 | 17 |
import java.net.HttpURLConnection; |
18 | 18 |
import java.net.URL; |
19 | 19 |
|
20 |
import org.apache.log4j.Logger; |
|
20 |
import org.apache.logging.log4j.LogManager; |
|
21 |
import org.apache.logging.log4j.Logger; |
|
21 | 22 |
|
22 | 23 |
/** |
23 | 24 |
* @author a.kohlbecker |
... | ... | |
26 | 27 |
*/ |
27 | 28 |
public class StreamUtils { |
28 | 29 |
|
29 |
public static final Logger logger = Logger.getLogger(StreamUtils.class); |
|
30 |
public static final Logger logger = LogManager.getLogger(StreamUtils.class);
|
|
30 | 31 |
private static final int BUFFER_SIZE = 4096; |
31 | 32 |
|
32 | 33 |
/** |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/UriUtils.java | ||
---|---|---|
52 | 52 |
import org.apache.http.impl.client.CloseableHttpClient; |
53 | 53 |
import org.apache.http.impl.client.DefaultHttpClient; |
54 | 54 |
import org.apache.http.impl.client.HttpClients; |
55 |
import org.apache.log4j.Logger; |
|
55 |
import org.apache.logging.log4j.LogManager; |
|
56 |
import org.apache.logging.log4j.Logger; |
|
56 | 57 |
|
57 | 58 |
/** |
58 | 59 |
* @author n.hoffmann |
59 | 60 |
* @since Sep 23, 2010 |
60 | 61 |
*/ |
61 | 62 |
public class UriUtils { |
62 |
private static final Logger logger = Logger.getLogger(UriUtils.class); |
|
63 |
private static final Logger logger = LogManager.getLogger(UriUtils.class);
|
|
63 | 64 |
|
64 | 65 |
protected static final String URI_IS_NOT_ABSOLUTE = "URI is not absolute (protocol is missing)"; |
65 | 66 |
|
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/XmlHelp.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
18 | 18 |
import java.util.ArrayList; |
19 | 19 |
import java.util.List; |
20 | 20 |
|
21 |
import org.apache.log4j.Logger; |
|
21 |
import org.apache.logging.log4j.LogManager; |
|
22 |
import org.apache.logging.log4j.Logger; |
|
22 | 23 |
import org.jdom.Attribute; |
23 | 24 |
import org.jdom.Document; |
24 | 25 |
import org.jdom.Element; |
... | ... | |
29 | 30 |
import org.jdom.output.XMLOutputter; |
30 | 31 |
|
31 | 32 |
public class XmlHelp { |
32 |
private static final Logger logger = Logger.getLogger(XmlHelp.class); |
|
33 |
private static final Logger logger = LogManager.getLogger(XmlHelp.class);
|
|
33 | 34 |
|
34 |
public final static Format prettyFormat = Format.getPrettyFormat();
|
|
35 |
public final static Format prettyFormat = Format.getPrettyFormat(); |
|
35 | 36 |
/** |
36 | 37 |
* Writes the Document doc to the specified file |
37 | 38 |
* @param doc |
38 | 39 |
* @param path |
39 | 40 |
* @param fileName |
40 | 41 |
* @return true, if no error |
41 |
*
|
|
42 |
* TODO throw the FileNotFoundException and handle in the calling method. That is more likely the place where you can do
|
|
42 |
* |
|
43 |
* TODO throw the FileNotFoundException and handle in the calling method. That is more likely the place where you can do |
|
43 | 44 |
* something about the problem |
44 | 45 |
*/ |
45 | 46 |
static public boolean saveToXml(Document doc, String path, String fileName, Format format ){ |
... | ... | |
47 | 48 |
if (! fileName.endsWith(".xml")){ |
48 | 49 |
fileName += ".xml"; |
49 | 50 |
} |
50 |
FileOutputStream outFile = new FileOutputStream(path + File.separator + fileName);
|
|
51 |
FileOutputStream outFile = new FileOutputStream(path + File.separator + fileName); |
|
51 | 52 |
return saveToXml(doc, outFile, format); |
52 | 53 |
} catch (FileNotFoundException e) { |
53 | 54 |
logger.error("FileNotFoundException in saveToXml()"); |
54 | 55 |
return false; |
55 | 56 |
} |
56 |
|
|
57 |
|
|
57 | 58 |
} |
58 |
|
|
59 |
|
|
59 | 60 |
/** |
60 | 61 |
* Writes the Document doc to the specified file |
61 | 62 |
* @param doc |
62 | 63 |
* @param path |
63 | 64 |
* @param fileName |
64 | 65 |
* @return true, if no error |
65 |
*
|
|
66 |
* TODO throw the IOException and handle in the calling method. That is more likely the place where you can do
|
|
66 |
* |
|
67 |
* TODO throw the IOException and handle in the calling method. That is more likely the place where you can do |
|
67 | 68 |
* something about the problem |
68 | 69 |
*/ |
69 | 70 |
static public boolean saveToXml(Document doc, OutputStream outStream, Format format ){ |
... | ... | |
74 | 75 |
} catch (IOException e) { |
75 | 76 |
logger.error("IOException in saveToXml()"); |
76 | 77 |
return false; |
77 |
}
|
|
78 |
} |
|
78 | 79 |
} |
79 |
|
|
80 |
|
|
80 | 81 |
static public Element getFirstAttributedChild(Element parent, String elementName, String attributeName, String attributeValue){ |
81 | 82 |
Namespace ns = parent.getNamespace(); |
82 |
|
|
83 |
|
|
83 | 84 |
List<Element> elList = getChildren(parent, elementName, ns); |
84 | 85 |
for (Element el : elList){ |
85 | 86 |
Attribute attr = el.getAttribute(attributeName); |
... | ... | |
89 | 90 |
} |
90 | 91 |
return null; |
91 | 92 |
} |
92 |
|
|
93 |
|
|
93 | 94 |
static public List<Element> getAttributedChildList(Element parent, String elementName, String attributeName){ |
94 | 95 |
List<Element> resultList = new ArrayList<Element>(); |
95 | 96 |
Namespace ns = parent.getNamespace(); |
... | ... | |
102 | 103 |
} |
103 | 104 |
return resultList; |
104 | 105 |
} |
105 |
|
|
106 |
|
|
106 | 107 |
/** |
107 |
* Returns a list of children with the given element name and with a given attribute name and
|
|
108 |
* Returns a list of children with the given element name and with a given attribute name and |
|
108 | 109 |
* a given value for this attribute.<BR> |
109 | 110 |
* The value comparison is case insensitive. |
110 | 111 |
* @param parent |
... | ... | |
132 | 133 |
private static List<Element> getChildren(Element parent, String elementName,Namespace ns) { |
133 | 134 |
return parent.getChildren(elementName, ns); |
134 | 135 |
} |
135 |
|
|
136 |
|
|
136 | 137 |
public static String getChildAttributeValue(Element element, String childElementName, Namespace childElementNamespace, String childAttributeName, Namespace childAttributeNamespace){ |
137 | 138 |
Element child = element.getChild(childElementName, childElementNamespace); |
138 | 139 |
if (child == null){ |
... | ... | |
144 | 145 |
} |
145 | 146 |
return childAttribute.getValue(); |
146 | 147 |
} |
147 |
|
|
148 |
|
|
148 | 149 |
public static String getChildContent(Element element, String childElementName, Namespace childElementNamespace, String childAttributeName, Namespace childAttributeNamespace){ |
149 | 150 |
Element child = element.getChild(childElementName, childElementNamespace); |
150 | 151 |
if (child == null){ |
... | ... | |
174 | 175 |
*/ |
175 | 176 |
static public Element getOrAddChild(Element parent, String elementName, String attributeName, String attributeValue){ |
176 | 177 |
Element result = null; |
177 |
if (parent != null){
|
|
178 |
if (parent != null){ |
|
178 | 179 |
if (attributeName != null){ |
179 | 180 |
result = getFirstAttributedChild(parent, elementName, attributeName, attributeValue); |
180 | 181 |
}else{ |
... | ... | |
193 | 194 |
} |
194 | 195 |
return result; |
195 | 196 |
} |
196 |
|
|
197 |
|
|
197 | 198 |
static public Element insertXmlRefProperty(Element parent, String strName, String strValue){ |
198 | 199 |
Namespace ns = parent.getNamespace(); |
199 | 200 |
Element property = new Element("property", ns); |
... | ... | |
204 | 205 |
parent.addContent(property); |
205 | 206 |
return property; |
206 | 207 |
} |
207 |
|
|
208 |
|
|
208 | 209 |
static public Element insertXmlValueProperty(Element parent, String strName, String strValue){ |
209 | 210 |
Namespace ns = parent.getNamespace(); |
210 | 211 |
Element property = new Element("property", ns); |
... | ... | |
215 | 216 |
parent.addContent(property); |
216 | 217 |
return property; |
217 | 218 |
} |
218 |
|
|
219 |
|
|
219 |
|
|
220 |
|
|
220 | 221 |
static public Element insertXmlBean(Element parent, String strId, String strClass){ |
221 | 222 |
Namespace ns = parent.getNamespace(); |
222 | 223 |
Element bean = new Element("bean", ns); |
... | ... | |
227 | 228 |
parent.addContent(bean); |
228 | 229 |
return bean; |
229 | 230 |
} |
230 |
|
|
231 |
|
|
231 | 232 |
|
232 | 233 |
/** |
233 | 234 |
* returns the root Element in the File xmlFile |
... | ... | |
242 | 243 |
Element root = doc.getRootElement(); |
243 | 244 |
return root; |
244 | 245 |
} |
245 |
|
|
246 |
|
|
246 | 247 |
/** |
247 | 248 |
* returns the root Element in the File xmlFile |
248 |
*
|
|
249 |
* |
|
249 | 250 |
* @param xmlInput |
250 | 251 |
* @param elementName |
251 | 252 |
* @return |
252 |
* TODO throw the JDOMException and the IOException and handle in the calling method. That is more likely the place where you can do
|
|
253 |
* TODO throw the JDOMException and the IOException and handle in the calling method. That is more likely the place where you can do |
|
253 | 254 |
* something about the problem |
254 | 255 |
*/ |
255 | 256 |
static public Element getRoot(InputStream xmlInput, String elementName){ |
... | ... | |
268 | 269 |
} catch (IOException e) { |
269 | 270 |
e.printStackTrace(); |
270 | 271 |
return null; |
271 |
}
|
|
272 |
} |
|
272 | 273 |
} |
273 |
|
|
274 |
|
|
274 | 275 |
/** |
275 | 276 |
* returns the root Element in the File xmlFile |
276 | 277 |
* @param xmlInput |
277 | 278 |
* @return |
278 |
*
|
|
279 |
* TODO throw the IOException and handle in the calling method. That is more likely the place where you can do
|
|
279 |
* |
|
280 |
* TODO throw the IOException and handle in the calling method. That is more likely the place where you can do |
|
280 | 281 |
* something about the problem |
281 | 282 |
*/ |
282 | 283 |
static public Element getBeansRoot(InputStream xmlInput){ |
... | ... | |
295 | 296 |
} catch (IOException e) { |
296 | 297 |
e.printStackTrace(); |
297 | 298 |
return null; |
298 |
}
|
|
299 |
} |
|
299 | 300 |
} |
300 |
|
|
301 |
|
|
301 | 302 |
/** |
302 | 303 |
* Gets the child element and tests if there is no other child element exists having the same name. |
303 |
* The result is returned as a pair of thd child element and a boolean value that indicates if the
|
|
304 |
* The result is returned as a pair of thd child element and a boolean value that indicates if the |
|
304 | 305 |
* elements cardinality was correct. <BR> |
305 |
* If there is more then one child element with the child element name
|
|
306 |
* If there is more then one child element with the child element name |
|
306 | 307 |
* or if there is no such element and obligatory is <code>true</code> the second part of the result is <code>false</code> |
307 | 308 |
* Otherwise it is <code>true</code>. |
308 | 309 |
* @param parentElement the parent element |
... | ... | |
315 | 316 |
static public DoubleResult<Element, Boolean> getSingleChildElement(Element parentElement, String childName, Namespace nsChild, boolean obligatory){ |
316 | 317 |
DoubleResult<Element, Boolean> result = new DoubleResult<Element, Boolean>(); |
317 | 318 |
result.setSecondResult(false); |
318 |
|
|
319 |
|
|
319 | 320 |
if (parentElement == null){ |
320 | 321 |
logger.warn("Parent element is null"); |
321 | 322 |
return result; |
... | ... | |
323 | 324 |
List<Element> elList = getChildren(parentElement, childName, nsChild); |
324 | 325 |
if (elList.size() > 1){ |
325 | 326 |
logger.error("Multiple '" + childName + "' elements."); |
326 |
return result;
|
|
327 |
return result; |
|
327 | 328 |
}else if (elList.size() == 0){ |
328 | 329 |
logger.info("There is no '" + childName + "' element"); |
329 | 330 |
if (! obligatory){ |
... | ... | |
331 | 332 |
} |
332 | 333 |
return result; |
333 | 334 |
} |
334 |
Element childElement = elList.get(0);
|
|
335 |
Element childElement = elList.get(0); |
|
335 | 336 |
result.setFirstResult(childElement); |
336 | 337 |
result.setSecondResult(true); |
337 | 338 |
return result; |
338 | 339 |
} |
339 |
|
|
340 |
|
|
340 | 341 |
static public Element getSingleChildElement(ResultWrapper<Boolean> success, Element parentElement, String childName, Namespace nsChild, boolean obligatory){ |
341 |
|
|
342 |
|
|
342 | 343 |
if (parentElement == null){ |
343 | 344 |
logger.warn("Parent element is null"); |
344 | 345 |
success.setValue(false); |
... | ... | |
348 | 349 |
if (elList.size() > 1){ |
349 | 350 |
logger.error("Multiple '" + childName + "' elements."); |
350 | 351 |
success.setValue(false); |
351 |
return null;
|
|
352 |
return null; |
|
352 | 353 |
}else if (elList.size() == 0){ |
353 | 354 |
elList = getChildren(parentElement, childName, null); |
354 | 355 |
logger.info("There is no '" + childName + "' element"); |
... | ... | |
357 | 358 |
} |
358 | 359 |
return null; |
359 | 360 |
} |
360 |
|
|
361 |
Element childElement = elList.get(0);
|
|
361 |
|
|
362 |
Element childElement = elList.get(0); |
|
362 | 363 |
return childElement; |
363 |
}
|
|
364 |
} |
|
364 | 365 |
|
365 | 366 |
static public List<Element> getMultipleChildElement(Element parentElement, String childName, Namespace nsChild, boolean obligatory){ |
366 |
|
|
367 |
|
|
367 | 368 |
if (parentElement == null){ |
368 | 369 |
logger.warn("Parent element is null"); |
369 | 370 |
return null; |
370 | 371 |
} |
371 |
|
|
372 |
|
|
372 | 373 |
List<Element> elList = getChildren(parentElement, childName.trim(), nsChild); |
373 |
|
|
374 |
|
|
374 | 375 |
if (elList.size() == 0){ |
375 | 376 |
logger.info("There is no '" + childName + "' element"); |
376 | 377 |
return null; |
... | ... | |
397 | 398 |
} |
398 | 399 |
if (!(contentEl.getAttributeValue(childElementName) == null)){ |
399 | 400 |
Attribute at = contentEl.getAttribute("ressource"); |
400 |
if (at != null)return at.getValue(); |
|
401 |
if (at != null) { |
|
402 |
return at.getValue(); |
|
403 |
} |
|
401 | 404 |
} |
402 | 405 |
} |
403 | 406 |
} |
404 | 407 |
return null; |
405 |
}
|
|
406 |
|
|
408 |
} |
|
409 |
|
|
407 | 410 |
} |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/concurrent/ConcurrentQueue.java | ||
---|---|---|
11 | 11 |
import java.util.LinkedList; |
12 | 12 |
import java.util.List; |
13 | 13 |
|
14 |
import org.apache.log4j.Logger; |
|
14 |
import org.apache.logging.log4j.LogManager; |
|
15 |
import org.apache.logging.log4j.Logger; |
|
15 | 16 |
|
16 | 17 |
/** |
17 | 18 |
* Concurrent queue. Example taken from |
... | ... | |
24 | 25 |
*/ |
25 | 26 |
public class ConcurrentQueue<T> { |
26 | 27 |
|
27 |
private static final Logger logger = Logger.getLogger(ConcurrentQueue.class); |
|
28 |
private static final Logger logger = LogManager.getLogger(ConcurrentQueue.class);
|
|
28 | 29 |
|
29 | 30 |
private int capacity; |
30 | 31 |
private List<T> queue = new LinkedList<>(); |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/media/MediaInfo.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.common.media; |
10 | 10 |
|
11 |
import org.apache.log4j.Logger; |
|
11 |
import org.apache.logging.log4j.LogManager; |
|
12 |
import org.apache.logging.log4j.Logger; |
|
12 | 13 |
|
13 | 14 |
/** |
14 | 15 |
* @author n.hoffmann |
... | ... | |
16 | 17 |
*/ |
17 | 18 |
public abstract class MediaInfo { |
18 | 19 |
@SuppressWarnings("unused") |
19 |
private static Logger logger = Logger.getLogger(MediaInfo.class); |
|
20 |
private static Logger logger = LogManager.getLogger(MediaInfo.class);
|
|
20 | 21 |
|
21 | 22 |
private String formatName; |
22 | 23 |
private String mimeType; |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/monitor/DefaultProgressMonitor.java | ||
---|---|---|
11 | 11 |
import java.io.Serializable; |
12 | 12 |
import java.math.BigDecimal; |
13 | 13 |
|
14 |
import org.apache.log4j.Level; |
|
15 |
import org.apache.log4j.Logger; |
|
14 |
import org.apache.logging.log4j.Level; |
|
15 |
import org.apache.logging.log4j.LogManager; |
|
16 |
import org.apache.logging.log4j.Logger; |
|
16 | 17 |
|
17 | 18 |
/** |
18 | 19 |
* This is a console style progress monitor with prints the progress information to configured {@link Logger} with level {@link Level#INFO} |
... | ... | |
23 | 24 |
public class DefaultProgressMonitor implements IProgressMonitor { |
24 | 25 |
|
25 | 26 |
private static final long serialVersionUID = 8782649283568146667L; |
26 |
private static final Logger logger = Logger.getLogger(DefaultProgressMonitor.class); |
|
27 |
private static final Logger logger = LogManager.getLogger(DefaultProgressMonitor.class);
|
|
27 | 28 |
|
28 | 29 |
public static final DefaultProgressMonitor NewInstance(){ |
29 | 30 |
return new DefaultProgressMonitor(); |
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/monitor/RemotingProgressMonitorThread.java | ||
---|---|---|
11 | 11 |
import java.io.Serializable; |
12 | 12 |
import java.util.concurrent.ConcurrentHashMap; |
13 | 13 |
|
14 |
import org.apache.log4j.Logger; |
|
14 |
import org.apache.logging.log4j.LogManager; |
|
15 |
import org.apache.logging.log4j.Logger; |
|
15 | 16 |
|
16 | 17 |
/** |
17 | 18 |
* Thread class to be used to run monitored jobs |
... | ... | |
21 | 22 |
*/ |
22 | 23 |
public abstract class RemotingProgressMonitorThread extends Thread { |
23 | 24 |
|
24 |
private static final Logger logger = Logger.getLogger(RemotingProgressMonitorThread.class); |
|
25 |
private static final Logger logger = LogManager.getLogger(RemotingProgressMonitorThread.class);
|
|
25 | 26 |
|
26 | 27 |
private static ConcurrentHashMap<IRemotingProgressMonitor, RemotingProgressMonitorThread> |
27 | 28 |
monitorsInProgress = new ConcurrentHashMap<>(); |
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/CdmUtilsTest.java | ||
---|---|---|
14 | 14 |
import java.io.InputStream; |
15 | 15 |
import java.util.regex.Pattern; |
16 | 16 |
|
17 |
import org.apache.log4j.Level;
|
|
18 |
import org.apache.log4j.Logger; |
|
17 |
import org.apache.logging.log4j.LogManager;
|
|
18 |
import org.apache.logging.log4j.Logger;
|
|
19 | 19 |
import org.junit.Assert; |
20 | 20 |
import org.junit.Test; |
21 | 21 |
|
... | ... | |
25 | 25 |
*/ |
26 | 26 |
public class CdmUtilsTest { |
27 | 27 |
|
28 |
private static final Logger logger = Logger.getLogger(CdmUtilsTest.class); |
|
28 |
private static final Logger logger = LogManager.getLogger(CdmUtilsTest.class);
|
|
29 | 29 |
|
30 | 30 |
/************************** TESTS ****************************************/ |
31 | 31 |
|
32 | 32 |
@Test |
33 | 33 |
public void testFindLibrary() { |
34 |
if (logger.isEnabledFor(Level.DEBUG)) {logger.debug(CdmUtils.findLibrary(CdmUtils.class));}
|
|
34 |
logger.debug("{}", CdmUtils.findLibrary(CdmUtils.class));
|
|
35 | 35 |
|
36 | 36 |
String library = CdmUtils.findLibrary(CdmUtils.class); |
37 | 37 |
String endOfLibrary = "target/classes/eu/etaxonomy/cdm/common/CdmUtils.class"; |
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/JvmMonitorTest.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.common; |
10 | 10 |
|
11 |
import org.apache.log4j.Logger; |
|
11 |
import org.apache.logging.log4j.LogManager; |
|
12 |
import org.apache.logging.log4j.Logger; |
|
12 | 13 |
import org.junit.Assert; |
13 | 14 |
import org.junit.Test; |
14 | 15 |
|
... | ... | |
20 | 21 |
public class JvmMonitorTest extends Assert{ |
21 | 22 |
|
22 | 23 |
|
23 |
public static final Logger logger = Logger.getLogger(JvmMonitorTest.class); |
|
24 |
public static final Logger logger = LogManager.getLogger(JvmMonitorTest.class);
|
|
24 | 25 |
|
25 | 26 |
@Test |
26 | 27 |
public void testGcTime() { |
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/UriUtilsTest.java | ||
---|---|---|
11 | 11 |
import org.apache.http.NameValuePair; |
12 | 12 |
import org.apache.http.client.ClientProtocolException; |
13 | 13 |
import org.apache.http.message.BasicNameValuePair; |
14 |
import org.apache.log4j.Logger; |
|
14 |
import org.apache.logging.log4j.LogManager; |
|
15 |
import org.apache.logging.log4j.Logger; |
|
15 | 16 |
import org.junit.Assert; |
16 | 17 |
import org.junit.Test; |
17 | 18 |
|
18 | 19 |
public class UriUtilsTest { |
19 | 20 |
|
20 |
private static final Logger logger = Logger.getLogger(UriUtilsTest.class); |
|
21 |
private static final Logger logger = LogManager.getLogger(UriUtilsTest.class);
|
|
21 | 22 |
|
22 | 23 |
//********************* TESTS **********************************************/ |
23 | 24 |
|
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/UuidGenerator.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.UUID; |
12 | 12 |
|
13 |
import org.apache.log4j.Logger; |
|
13 |
import org.apache.logging.log4j.LogManager; |
|
14 |
import org.apache.logging.log4j.Logger; |
|
14 | 15 |
|
15 | 16 |
/** |
16 | 17 |
* @author a.mueller |
17 | 18 |
*/ |
18 | 19 |
public class UuidGenerator { |
19 |
private static final Logger logger = Logger.getLogger(UuidGenerator.class); |
|
20 |
private static final Logger logger = LogManager.getLogger(UuidGenerator.class);
|
|
20 | 21 |
|
21 | 22 |
private static int n = 100; |
22 | 23 |
|
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/XmlHelpTest.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.common; |
11 | 11 |
|
12 |
import static org.junit.Assert.*;
|
|
12 |
import static org.junit.Assert.assertTrue;
|
|
13 | 13 |
|
14 |
import org.apache.log4j.Logger; |
|
14 |
import org.apache.logging.log4j.LogManager; |
|
15 |
import org.apache.logging.log4j.Logger; |
|
15 | 16 |
import org.junit.After; |
16 | 17 |
import org.junit.AfterClass; |
17 | 18 |
import org.junit.Before; |
... | ... | |
19 | 20 |
import org.junit.Test; |
20 | 21 |
|
21 | 22 |
public class XmlHelpTest { |
22 |
private static final Logger logger = Logger.getLogger(XmlHelpTest.class); |
|
23 |
private static final Logger logger = LogManager.getLogger(XmlHelpTest.class);
|
|
23 | 24 |
|
24 | 25 |
@BeforeClass |
25 | 26 |
public static void setUpBeforeClass() throws Exception { |
... | ... | |
37 | 38 |
@After |
38 | 39 |
public void tearDown() throws Exception { |
39 | 40 |
} |
40 |
|
|
41 |
|
|
41 | 42 |
/******* TESTS *************************************/ |
42 | 43 |
|
43 | 44 |
@Test |
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/test/suite/CdmTestSuite.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.test.suite; |
11 | 10 |
|
12 |
import org.apache.log4j.Logger; |
|
13 | 11 |
import org.junit.runner.RunWith; |
14 | 12 |
import org.junit.runners.Suite; |
15 | 13 |
|
... | ... | |
24 | 22 |
} |
25 | 23 |
) |
26 | 24 |
public class CdmTestSuite { |
27 |
@SuppressWarnings("unused") |
|
28 |
private static final Logger logger = Logger.getLogger(CdmTestSuite.class); |
|
29 | 25 |
|
30 | 26 |
// the class remains completely empty, |
31 | 27 |
// being used only as a holder for the above annotations |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/bci/BciServiceWrapper.java | ||
---|---|---|
24 | 24 |
import org.apache.commons.lang.StringUtils; |
25 | 25 |
import org.apache.http.NameValuePair; |
26 | 26 |
import org.apache.http.message.BasicNameValuePair; |
27 |
import org.apache.log4j.Logger; |
|
27 |
import org.apache.logging.log4j.LogManager; |
|
28 |
import org.apache.logging.log4j.Logger; |
|
28 | 29 |
import org.springframework.stereotype.Component; |
29 | 30 |
|
30 | 31 |
import com.ibm.lsid.MalformedLSIDException; |
... | ... | |
51 | 52 |
extends ServiceWrapperBase<Collection> |
52 | 53 |
implements IBciServiceWrapper{ |
53 | 54 |
|
54 |
private static final Logger logger = Logger.getLogger(BciServiceWrapper.class); |
|
55 |
private static final Logger logger = LogManager.getLogger(BciServiceWrapper.class);
|
|
55 | 56 |
|
56 | 57 |
private enum ServiceType{ |
57 | 58 |
AUTHOR, |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/common/SchemaAdapterBase.java | ||
---|---|---|
12 | 12 |
import java.io.InputStream; |
13 | 13 |
import java.util.List; |
14 | 14 |
|
15 |
import org.apache.log4j.Logger; |
|
15 |
import org.apache.logging.log4j.LogManager; |
|
16 |
import org.apache.logging.log4j.Logger; |
|
16 | 17 |
|
17 | 18 |
import eu.etaxonomy.cdm.common.URI; |
18 | 19 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
... | ... | |
23 | 24 |
*/ |
24 | 25 |
public abstract class SchemaAdapterBase<T extends CdmBase> { |
25 | 26 |
|
26 |
public static final Logger logger = Logger.getLogger(SchemaAdapterBase.class); |
|
27 |
public static final Logger logger = LogManager.getLogger(SchemaAdapterBase.class);
|
|
27 | 28 |
|
28 | 29 |
/** |
29 | 30 |
* @return the identifier e.g. "info:srw/schema/1/dc-v1.1" for DublinCore |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/common/ServiceWrapperBase.java | ||
---|---|---|
22 | 22 |
import org.apache.http.NameValuePair; |
23 | 23 |
import org.apache.http.client.ClientProtocolException; |
24 | 24 |
import org.apache.http.message.BasicNameValuePair; |
25 |
import org.apache.log4j.Logger; |
|
25 |
import org.apache.logging.log4j.LogManager; |
|
26 |
import org.apache.logging.log4j.Logger; |
|
26 | 27 |
|
27 | 28 |
import eu.etaxonomy.cdm.common.URI; |
28 | 29 |
import eu.etaxonomy.cdm.common.UriUtils; |
... | ... | |
35 | 36 |
*/ |
36 | 37 |
public class ServiceWrapperBase<T extends CdmBase> { |
37 | 38 |
|
38 |
public static final Logger logger = Logger.getLogger(ServiceWrapperBase.class); |
|
39 |
public static final Logger logger = LogManager.getLogger(ServiceWrapperBase.class);
|
|
39 | 40 |
|
40 | 41 |
private URL baseUrl; |
41 | 42 |
|
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoService.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import javax.persistence.EntityNotFoundException; |
26 | 26 |
|
27 |
import org.apache.log4j.Logger; |
|
27 |
import org.apache.logging.log4j.LogManager; |
|
28 |
import org.apache.logging.log4j.Logger; |
|
28 | 29 |
import org.springframework.beans.factory.annotation.Autowired; |
29 | 30 |
import org.springframework.stereotype.Service; |
30 | 31 |
import org.springframework.transaction.annotation.Transactional; |
... | ... | |
69 | 70 |
public class EditGeoService implements IEditGeoService { |
70 | 71 |
|
71 | 72 |
@SuppressWarnings("unused") |
72 |
private static final Logger logger = Logger.getLogger(EditGeoService.class); |
|
73 |
private static final Logger logger = LogManager.getLogger(EditGeoService.class);
|
|
73 | 74 |
|
74 | 75 |
@Autowired |
75 | 76 |
private IDescriptionDao dao; |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceUtilities.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import org.apache.commons.collections.CollectionUtils; |
29 | 29 |
import org.apache.commons.lang.StringUtils; |
30 |
import org.apache.log4j.Logger; |
|
30 |
import org.apache.logging.log4j.LogManager; |
|
31 |
import org.apache.logging.log4j.Logger; |
|
31 | 32 |
|
32 | 33 |
import com.fasterxml.jackson.core.JsonParseException; |
33 | 34 |
import com.fasterxml.jackson.databind.JsonMappingException; |
... | ... | |
64 | 65 |
* @since 17.11.2008 |
65 | 66 |
*/ |
66 | 67 |
public class EditGeoServiceUtilities { |
67 |
private static final Logger logger = Logger.getLogger(EditGeoServiceUtilities.class); |
|
68 |
private static final Logger logger = LogManager.getLogger(EditGeoServiceUtilities.class);
|
|
68 | 69 |
|
69 | 70 |
private static final int INT_MAX_LENGTH = String.valueOf(Integer.MAX_VALUE).length(); |
70 | 71 |
|
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/GeoServiceArea.java | ||
---|---|---|
23 | 23 |
import javax.xml.stream.XMLStreamException; |
24 | 24 |
import javax.xml.stream.XMLStreamWriter; |
25 | 25 |
|
26 |
import org.apache.log4j.Logger; |
|
26 |
import org.apache.logging.log4j.LogManager; |
|
27 |
import org.apache.logging.log4j.Logger; |
|
27 | 28 |
import org.jdom.Element; |
28 | 29 |
import org.jdom.JDOMException; |
29 | 30 |
import org.jdom.Namespace; |
... | ... | |
46 | 47 |
*/ |
47 | 48 |
public class GeoServiceArea { |
48 | 49 |
@SuppressWarnings("unused") |
49 |
private static final Logger logger = Logger.getLogger(GeoServiceArea.class); |
|
50 |
private static final Logger logger = LogManager.getLogger(GeoServiceArea.class);
|
|
50 | 51 |
|
51 | 52 |
private static final String VALUE = "value"; |
52 | 53 |
private static final String FIELD = "field"; |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/GeoServiceAreaAnnotatedMapping.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import javax.xml.stream.XMLStreamException; |
15 | 15 |
|
16 |
import org.apache.log4j.Logger; |
|
16 |
import org.apache.logging.log4j.LogManager; |
|
17 |
import org.apache.logging.log4j.Logger; |
|
17 | 18 |
import org.springframework.beans.factory.annotation.Autowired; |
18 | 19 |
import org.springframework.stereotype.Component; |
19 | 20 |
|
... | ... | |
34 | 35 |
@Component |
35 | 36 |
public class GeoServiceAreaAnnotatedMapping implements IGeoServiceAreaMapping { |
36 | 37 |
@SuppressWarnings("unused") |
37 |
private static final Logger logger = Logger.getLogger(GeoServiceAreaAnnotatedMapping.class); |
|
38 |
private static final Logger logger = LogManager.getLogger(GeoServiceAreaAnnotatedMapping.class);
|
|
38 | 39 |
|
39 | 40 |
@Autowired |
40 | 41 |
private ITermService termService; |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/ShpAttributesToNamedAreaMapper.java | ||
---|---|---|
16 | 16 |
import java.util.Set; |
17 | 17 |
|
18 | 18 |
import org.apache.commons.lang.ArrayUtils; |
19 |
import org.apache.log4j.Logger; |
|
19 |
import org.apache.logging.log4j.LogManager; |
|
20 |
import org.apache.logging.log4j.Logger; |
|
20 | 21 |
|
21 | 22 |
import au.com.bytecode.opencsv.CSVReader; |
22 | 23 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
... | ... | |
42 | 43 |
*/ |
43 | 44 |
public class ShpAttributesToNamedAreaMapper { |
44 | 45 |
|
45 |
public static final Logger logger = Logger.getLogger(ShpAttributesToNamedAreaMapper.class); |
|
46 |
public static final Logger logger = LogManager.getLogger(ShpAttributesToNamedAreaMapper.class);
|
|
46 | 47 |
|
47 | 48 |
private static final char COMMA = ','; |
48 | 49 |
|
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/kml/GeometryBuilder.java | ||
---|---|---|
16 | 16 |
import javax.measure.UnitConverter; |
17 | 17 |
import javax.measure.quantity.Length; |
18 | 18 |
|
19 |
import org.apache.log4j.Logger; |
|
19 |
import org.apache.logging.log4j.LogManager; |
|
20 |
import org.apache.logging.log4j.Logger; |
|
20 | 21 |
import org.geotools.data.DataUtilities; |
21 | 22 |
import org.geotools.feature.SchemaException; |
22 | 23 |
import org.geotools.feature.simple.SimpleFeatureBuilder; |
... | ... | |
48 | 49 |
|
49 | 50 |
/** |
50 | 51 |
* See : |
51 |
*
|
|
52 |
* |
|
52 | 53 |
* https://gis.stackexchange.com/questions/311272/create-dynamic-circle-polygon-from-specific-lat-long-using-geotools |
53 | 54 |
* https://gis.stackexchange.com/questions/283183/using-geometricshapefactory-to-create-circle-with-radius-in-miles |
54 |
*
|
|
55 |
* |
|
55 | 56 |
* https://stackoverflow.com/questions/36481651/how-do-i-create-a-circle-with-latitude-longitude-and-radius-with-geotools#36528805 |
56 |
*
|
|
57 |
*
|
|
57 |
* |
|
58 |
* |
|
58 | 59 |
* Another great library for creating shapes is https://github.com/locationtech/spatial4j |
59 |
*
|
|
60 |
* |
|
60 | 61 |
* @author Andreas Kohlbecker |
61 | 62 |
* @since Apr 21, 2020 |
62 | 63 |
*/ |
63 | 64 |
public class GeometryBuilder { |
64 | 65 |
|
65 |
private final static Logger logger = Logger.getLogger(GeometryBuilder.class); |
|
66 |
private final static Logger logger = LogManager.getLogger(GeometryBuilder.class);
|
|
66 | 67 |
|
67 | 68 |
public enum CircleMethod { |
68 | 69 |
circle, simpleCircleSmall, simpleCircle, reprojectedCircle; |
... | ... | |
71 | 72 |
/** |
72 | 73 |
* Fails with javax.measure.IncommensurableException: m is not compatible with |
73 | 74 |
* deg |
74 |
*
|
|
75 |
* |
|
75 | 76 |
* see |
76 | 77 |
* https://gis.stackexchange.com/questions/283183/using-geometricshapefactory-to-create-circle-with-radius-in-miles |
77 |
*
|
|
78 |
* |
|
78 | 79 |
* @param radius |
79 | 80 |
* @param latitude |
80 | 81 |
* @param longitude |
... | ... | |
104 | 105 |
/** |
105 | 106 |
* Only suitable for small radius (> 1000 m) as the circles are heavily |
106 | 107 |
* distorted otherwise. |
107 |
*
|
|
108 |
* |
|
108 | 109 |
* @param radius |
109 | 110 |
* @param latitude |
110 | 111 |
* @param longitude |
... | ... | |
128 | 129 |
/** |
129 | 130 |
* Creates perfect circles which are looking good but might be projected |
130 | 131 |
* incorrectly for the resulting map |
131 |
*
|
|
132 |
* |
|
132 | 133 |
* @param distance |
133 | 134 |
* @param latitude |
134 | 135 |
* @param longitude |
... | ... | |
159 | 160 |
|
160 | 161 |
/** |
161 | 162 |
* This Method should produces the best circles. |
162 |
*
|
|
163 |
* |
|
163 | 164 |
* The code is based on an example published by Ian Turton on stackoverflow: |
164 |
*
|
|
165 |
* |
|
165 | 166 |
* https://stackoverflow.com/questions/36481651/how-do-i-create-a-circle-with-latitude-longitude-and-radius-with-geotools#36528805 |
166 |
*
|
|
167 |
* |
|
167 | 168 |
* see https://gist.github.com/ianturton/973563fe5004985ba35a6e2247f7d823 and |
168 | 169 |
* https://gitlab.com/snippets/17558 |
169 |
*
|
|
170 |
* |
|
170 | 171 |
* @param feature |
171 | 172 |
* @param distance |
172 | 173 |
* @return |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/kml/KMLDocumentBuilder.java | ||
---|---|---|
19 | 19 |
import java.util.Set; |
20 | 20 |
|
21 | 21 |
import org.apache.commons.lang3.StringUtils; |
22 |
import org.apache.log4j.Logger; |
|
22 |
import org.apache.logging.log4j.LogManager; |
|
23 |
import org.apache.logging.log4j.Logger; |
|
23 | 24 |
import org.geotools.feature.SchemaException; |
24 | 25 |
import org.locationtech.jts.geom.Coordinate; |
25 | 26 |
import org.opengis.feature.simple.SimpleFeature; |
... | ... | |
55 | 56 |
*/ |
56 | 57 |
public class KMLDocumentBuilder { |
57 | 58 |
|
58 |
private final static Logger logger = Logger.getLogger(KMLDocumentBuilder.class); |
|
59 |
private final static Logger logger = LogManager.getLogger(KMLDocumentBuilder.class);
|
|
59 | 60 |
|
60 | 61 |
private Set<SpecimenOrObservationBase> occSet = new HashSet<>(); |
61 | 62 |
|
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
import org.apache.commons.lang.StringUtils; |
30 | 30 |
import org.apache.http.HttpResponse; |
31 |
import org.apache.log4j.Logger; |
|
31 |
import org.apache.logging.log4j.LogManager; |
|
32 |
import org.apache.logging.log4j.Logger; |
|
32 | 33 |
import org.springframework.stereotype.Component; |
33 | 34 |
|
34 | 35 |
import eu.etaxonomy.cdm.api.application.ICdmRepository; |
... | ... | |
71 | 72 |
*/ |
72 | 73 |
@Component |
73 | 74 |
public class IpniService implements IIpniService{ |
74 |
private static final Logger logger = Logger.getLogger(IpniService.class); |
|
75 |
private static final Logger logger = LogManager.getLogger(IpniService.class);
|
|
75 | 76 |
|
76 | 77 |
|
77 | 78 |
//TYPE |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceAuthorConfigurator.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.cdm.ext.ipni; |
2 | 2 |
|
3 |
import org.apache.log4j.Logger; |
|
3 |
import org.apache.logging.log4j.LogManager; |
|
4 |
import org.apache.logging.log4j.Logger; |
|
4 | 5 |
|
5 | 6 |
public class IpniServiceAuthorConfigurator extends IpniServiceConfiguratorBase implements IIpniServiceConfigurator { |
6 |
public static final Logger logger = Logger.getLogger(IpniServiceAuthorConfigurator.class); |
|
7 |
|
|
7 |
public static final Logger logger = LogManager.getLogger(IpniServiceAuthorConfigurator.class);
|
|
8 |
|
|
8 | 9 |
} |
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniServiceNamesConfigurator.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.cdm.ext.ipni; |
5 | 5 |
|
6 |
import org.apache.log4j.Logger; |
|
6 |
import org.apache.logging.log4j.LogManager; |
|
7 |
import org.apache.logging.log4j.Logger; |
|
7 | 8 |
|
8 | 9 |
/** |
9 | 10 |
* Configurator for IPNI name service import / mapping. |
10 | 11 |
* @author a.mueller |
11 | 12 |
*/ |
12 | 13 |
public class IpniServiceNamesConfigurator extends IpniServiceConfiguratorBase implements IIpniServiceConfigurator { |
13 |
public static final Logger logger = Logger.getLogger(IpniServiceNamesConfigurator.class); |
|
14 |
public static final Logger logger = LogManager.getLogger(IpniServiceNamesConfigurator.class);
|
|
14 | 15 |
|
Also available in: Unified diff
ref #9359 upgrade cdmlib to log4j 2