REOC-70 Change build version to 1.8 and rebuild it
This commit is contained in:
parent
95d6455071
commit
d15ef22e34
|
@ -1,17 +1,20 @@
|
||||||
package com.ossez.reoc.rets.client;
|
package com.ossez.reoc.rets.client;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CapabilityUrls {
|
public class CapabilityUrls {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(CapabilityUrls.class);
|
||||||
|
|
||||||
public static final String ACTION_URL = "Action";
|
public static final String ACTION_URL = "Action";
|
||||||
public static final String CHANGE_PASSWORD_URL = "ChangePassword";
|
public static final String CHANGE_PASSWORD_URL = "ChangePassword";
|
||||||
public static final String GET_OBJECT_URL = "GetObject";
|
public static final String GET_OBJECT_URL = "GetObject";
|
||||||
|
@ -22,7 +25,6 @@ public class CapabilityUrls {
|
||||||
public static final String GET_METADATA_URL = "GetMetadata";
|
public static final String GET_METADATA_URL = "GetMetadata";
|
||||||
public static final String UPDATE_URL = "Update";
|
public static final String UPDATE_URL = "Update";
|
||||||
public static final String SERVER_INFO_URL = "ServerInformation";// for rets 1.7
|
public static final String SERVER_INFO_URL = "ServerInformation";// for rets 1.7
|
||||||
private static final Log LOG = LogFactory.getLog(CapabilityUrls.class);
|
|
||||||
|
|
||||||
private final Map mCapabilityUrls;
|
private final Map mCapabilityUrls;
|
||||||
private URL mUrl;
|
private URL mUrl;
|
||||||
|
@ -41,13 +43,13 @@ public class CapabilityUrls {
|
||||||
try {
|
try {
|
||||||
String newurl = new URL(this.mUrl, url).toString();
|
String newurl = new URL(this.mUrl, url).toString();
|
||||||
if (!newurl.equals(url)) {
|
if (!newurl.equals(url)) {
|
||||||
LOG.info("qualified " + capability + " URL different: "
|
logger.info("qualified " + capability + " URL different: "
|
||||||
+ url + " -> " + newurl);
|
+ url + " -> " + newurl);
|
||||||
url = newurl;
|
url = newurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
LOG.warn("Couldn't normalize URL", e);
|
logger.warn("Couldn't normalize URL", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mCapabilityUrls.put(capability, url);
|
this.mCapabilityUrls.put(capability, url);
|
||||||
|
@ -91,7 +93,7 @@ public class CapabilityUrls {
|
||||||
try {
|
try {
|
||||||
this.mUrl = new URL(url);
|
this.mUrl = new URL(url);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
LOG.debug("java.net.URL can't parse login url: " + url);
|
logger.debug("java.net.URL can't parse login url: " + url);
|
||||||
this.mUrl = null;
|
this.mUrl = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,17 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.DocumentException;
|
import org.dom4j.DocumentException;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
import org.dom4j.io.SAXReader;
|
import org.dom4j.io.SAXReader;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.ossez.reoc.rets.client.CapabilityUrls.LOGIN_URL;
|
import static com.ossez.reoc.rets.client.CapabilityUrls.LOGIN_URL;
|
||||||
|
|
||||||
|
@ -20,7 +23,7 @@ import static com.ossez.reoc.rets.client.CapabilityUrls.LOGIN_URL;
|
||||||
*/
|
*/
|
||||||
abstract public class KeyValueResponse {
|
abstract public class KeyValueResponse {
|
||||||
protected static final String CRLF = "\r\n";
|
protected static final String CRLF = "\r\n";
|
||||||
private static final Log LOG = LogFactory.getLog(KeyValueResponse.class);
|
private static final Logger logger = LoggerFactory.getLogger(KeyValueResponse.class);
|
||||||
|
|
||||||
protected Document mDoc;
|
protected Document mDoc;
|
||||||
protected int mReplyCode;
|
protected int mReplyCode;
|
||||||
|
@ -85,43 +88,26 @@ abstract public class KeyValueResponse {
|
||||||
String[] splits = StringUtils.split(keyValueStr, "=");
|
String[] splits = StringUtils.split(keyValueStr, "=");
|
||||||
if (!ArrayUtils.isEmpty(splits) && splits.length > 1) {
|
if (!ArrayUtils.isEmpty(splits) && splits.length > 1) {
|
||||||
String key = StringUtils.trimToNull(splits[0]);
|
String key = StringUtils.trimToNull(splits[0]);
|
||||||
// guard against a missing value in a KeyValueResponse
|
|
||||||
String value = StringUtils.trimToEmpty(splits[1]);
|
String value = StringUtils.trimToEmpty(splits[1]);
|
||||||
|
|
||||||
|
// PROCESS LOGIN_URL
|
||||||
if (StringUtils.equalsIgnoreCase(LOGIN_URL, key))
|
if (StringUtils.equalsIgnoreCase(LOGIN_URL, key))
|
||||||
retsResponseMap.put(LOGIN_URL, value);
|
retsResponseMap.put(LOGIN_URL, value);
|
||||||
else
|
else
|
||||||
retsResponseMap.put(key, value);
|
retsResponseMap.put(key, value);
|
||||||
}
|
}
|
||||||
// // LOOP TO LOAD LOGIN URL
|
|
||||||
// tokenizeList.parallelStream().forEach(keyValueString -> {
|
|
||||||
//
|
|
||||||
// //parallelStream
|
|
||||||
// try {
|
|
||||||
// String line = StringUtils.trimToEmpty(keyValueString);
|
|
||||||
// String splits[] = StringUtils.split(line, "=");
|
|
||||||
// if (!ArrayUtils.isEmpty(splits) && splits.length > 1) {
|
|
||||||
// String key = StringUtils.trimToNull(splits[0]);
|
|
||||||
// // guard against a missing value in a KeyValueResponse
|
|
||||||
// String value = StringUtils.trimToEmpty(splits[1]);
|
|
||||||
//
|
|
||||||
// if (StringUtils.equalsIgnoreCase(LOGIN_URL, key))
|
|
||||||
// retsResponseMap.put(LOGIN_URL, value);
|
|
||||||
// else
|
|
||||||
// retsResponseMap.put(key, value);
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// LOOP TO LOAD OTHERS
|
|
||||||
this.handleKeyValue(LOGIN_URL, retsResponseMap.get(LOGIN_URL));
|
|
||||||
|
|
||||||
for (String k : retsResponseMap.keySet()) {
|
|
||||||
this.handleKeyValue(k, retsResponseMap.get(k));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retsResponseMap.entrySet().parallelStream().forEach(entry -> {
|
||||||
|
try {
|
||||||
|
this.handleKeyValue(entry.getKey(), entry.getValue());
|
||||||
|
} catch (RetsException ex) {
|
||||||
|
logger.warn("Unable process rests login response value", ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void handleKeyValue(String key, String value) throws RetsException;
|
protected abstract void handleKeyValue(String key, String value) throws RetsException;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<configuration>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<configuration debug="true">
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT"
|
||||||
<!-- encoders are assigned the type
|
class="ch.qos.logback.core.ConsoleAppender">
|
||||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
<!-- encoders are assigned by default the type
|
||||||
|
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
|
|
Loading…
Reference in New Issue