diff --git a/pom.xml b/pom.xml index a4f5cf2..089ef55 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,15 @@ logback-classic 1.2.5 + + + + org.apache.httpcomponents + httpclient + ${commons-httpclient.version} + + + xalan xalan @@ -111,7 +120,9 @@ 2.6 3.11 1.4 - 3.0.0 + 4.5.13 + + 30.1.1-jre @@ -143,6 +154,8 @@ 3.0.0 2.21.0 3.8.1 + 3.0.0 + \ No newline at end of file diff --git a/src/main/java/org/realtor/rets/retsapi/RETSConnection.java b/src/main/java/org/realtor/rets/retsapi/RETSConnection.java index b2ff47c..b932bc7 100644 --- a/src/main/java/org/realtor/rets/retsapi/RETSConnection.java +++ b/src/main/java/org/realtor/rets/retsapi/RETSConnection.java @@ -11,8 +11,9 @@ import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Category; import org.realtor.rets.util.RETSConfigurator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.*; import java.net.URLEncoder; @@ -27,8 +28,7 @@ import java.util.zip.GZIPInputStream; * @version 1.0 */ public class RETSConnection extends java.lang.Object { - // log4j category - static Category cat = Category.getInstance(RETSConnection.class); + private final static Logger logger = LoggerFactory.getLogger(RETSConnection.class); static { RETSConfigurator.configure(); diff --git a/src/main/java/org/realtor/rets/retsapi/RETSGetMetadataTransaction.java b/src/main/java/org/realtor/rets/retsapi/RETSGetMetadataTransaction.java index ae03c9a..71d08bc 100644 --- a/src/main/java/org/realtor/rets/retsapi/RETSGetMetadataTransaction.java +++ b/src/main/java/org/realtor/rets/retsapi/RETSGetMetadataTransaction.java @@ -6,14 +6,13 @@ */ package org.realtor.rets.retsapi; - -//import java.util.*; -import org.apache.log4j.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /////////////////////////////////////////////////////////////////////// public class RETSGetMetadataTransaction extends RETSTransaction { - static Category cat = Category.getInstance(RETSGetMetadataTransaction.class); + private final static Logger logger = LoggerFactory.getLogger(RETSConnection.class); String version = null; /** diff --git a/src/main/java/org/realtor/rets/retsapi/RETSTransaction.java b/src/main/java/org/realtor/rets/retsapi/RETSTransaction.java index a2876d4..b58de16 100644 --- a/src/main/java/org/realtor/rets/retsapi/RETSTransaction.java +++ b/src/main/java/org/realtor/rets/retsapi/RETSTransaction.java @@ -1,26 +1,28 @@ /** - * RETSTransaction.java + * RETSTransaction.java * - * @author jbrush - * @version + * @author jbrush + * @version */ package org.realtor.rets.retsapi; -import org.apache.log4j.*; +import org.apache.regexp.RE; +import org.apache.regexp.RESyntaxException; +import org.realtor.rets.util.RETSRequestResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import org.apache.regexp.*; - -import org.realtor.rets.util.*; - -import java.io.*; - -import java.util.*; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.StringTokenizer; /////////////////////////////////////////////////////////////////////// public class RETSTransaction extends RETSRequestResponse { - static Category cat = Category.getInstance(RETSTransaction.class); + private final static Logger logger = LoggerFactory.getLogger(RETSConnection.class); + private static final String STATUS = "status"; private static final String STATUSTEXT = "statusText"; private static final String BODY = "body"; @@ -47,7 +49,7 @@ public class RETSTransaction extends RETSRequestResponse { firstStatusRE = new RE(" " + responseHeaderMap.toString()); + logger.debug("RESPONSEHEADERMAP ==> " + responseHeaderMap.toString()); // responseString = (String) responseHeaderMap.get(headerName.toLowerCase()); - cat.debug("ContentType Class is ... " + responseHeaderMap.get(headerName).getClass().getName()); + logger.debug("ContentType Class is ... " + responseHeaderMap.get(headerName).getClass().getName()); Object object = responseHeaderMap.get(headerName); - if ( object == null ) + if (object == null) return null; - if ( object instanceof ArrayList ) { - responseString = (String) ((ArrayList)object).get(0); + if (object instanceof ArrayList) { + responseString = (String) ((ArrayList) object).get(0); } else responseString = object.toString(); } else { - cat.debug("RESPONSEHEADERMAP ==> " + responseHeaderMap); + logger.debug("RESPONSEHEADERMAP ==> " + responseHeaderMap); } return responseString; } @@ -267,7 +269,7 @@ public class RETSTransaction extends RETSRequestResponse { } static public void log(String logMessage) { - cat.debug(logMessage); + logger.debug(logMessage); } } diff --git a/src/main/java/org/realtor/rets/retsapi/RETSUpdateTransaction.java b/src/main/java/org/realtor/rets/retsapi/RETSUpdateTransaction.java index 7a50290..44e6593 100644 --- a/src/main/java/org/realtor/rets/retsapi/RETSUpdateTransaction.java +++ b/src/main/java/org/realtor/rets/retsapi/RETSUpdateTransaction.java @@ -1,28 +1,20 @@ package org.realtor.rets.retsapi; -import org.apache.log4j.Category; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Iterator; import java.util.Map; -import org.apache.xpath.XPathAPI; -import org.realtor.rets.util.XMLUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; -import java.util.Collections; -import java.util.Vector; -import javax.xml.transform.TransformerException; /** - * RETSUpdateTransaction.java + * RETSUpdateTransaction.java * - * @author pobrien - * @version 1.0 + * @author pobrien + * @version 1.0 */ public class RETSUpdateTransaction extends RETSTransaction { - static Category cat = Category.getInstance(RETSUpdateTransaction.class); + private final static Logger logger = LoggerFactory.getLogger(RETSConnection.class); /** * @@ -34,9 +26,9 @@ public class RETSUpdateTransaction extends RETSTransaction { } /** - * Sets the response body for the transaction. + * Sets the response body for the transaction. * - * @param body body of the transaction + * @param body body of the transaction */ public void setResponse(String body) { super.setResponse(body); @@ -44,55 +36,56 @@ public class RETSUpdateTransaction extends RETSTransaction { setKeyValuePairs(body); } + /** - * Sets the type attribute to the string passed in. + * Sets the type attribute to the string passed in. * - * @param type type attribute value + * @param str type attribute value */ public void setType(String str) { - cat.debug("set Type=" + str); + logger.debug("set Type=" + str); setRequestVariable("Type", str); } /** - * Sets the ID attribute to the string passed in. + * Sets the ID attribute to the string passed in. * - * @param str ID of the object + * @param str ID of the object */ public void setValidate(String str) { - cat.debug("set Validate=" + str); + logger.debug("set Validate=" + str); setRequestVariable("Validate", str); } /** - * Sets the location attribute to the string passed in. + * Sets the location attribute to the string passed in. * - * @param str location attribute value + * @param str location attribute value */ public void setDelimiter(String str) { - cat.debug("set Delimiter=" + str); + logger.debug("set Delimiter=" + str); setRequestVariable("Delimiter", str); } public String getDelimiter() { - return getRequestVariable("Delimiter"); + return getRequestVariable("Delimiter"); } public void setRecord(String str) { - cat.debug("set Record=" + str); + logger.debug("set Record=" + str); setRequestVariable("Record", str); } public void setWarningResponse(String str) { - cat.debug("set WarningResponse=" + str); - setRequestVariable("WarningResponse", str); + logger.debug("set WarningResponse=" + str); + setRequestVariable("WarningResponse", str); } public void setNewValues(Map m) { // convert to a string and feed to setRecord().... StringBuffer record = new StringBuffer(); Iterator iter = m.keySet().iterator(); - // delimiter is a 2 digit HEX value + // delimiter is a 2 digit HEX value char delim = (char) Integer.parseInt(getDelimiter().trim(), 16); while (iter.hasNext()) { @@ -122,36 +115,36 @@ public class RETSUpdateTransaction extends RETSTransaction { public void setWarningResponseValues(Map m) { - // convert to a string and feed to setWarningResponse().... - StringBuffer warning = new StringBuffer("("); - Iterator iter = m.keySet().iterator(); - // delimiter is a 2 digit HEX value - char delim = (char) Integer.parseInt(getDelimiter().trim(), 16); + // convert to a string and feed to setWarningResponse().... + StringBuffer warning = new StringBuffer("("); + Iterator iter = m.keySet().iterator(); + // delimiter is a 2 digit HEX value + char delim = (char) Integer.parseInt(getDelimiter().trim(), 16); - while (iter.hasNext()) { - String name = (String) iter.next(); - Object val = m.get(name); - String value = ""; + while (iter.hasNext()) { + String name = (String) iter.next(); + Object val = m.get(name); + String value = ""; - if (val instanceof String) { - value = (String) val; - } else { - String[] arr = (String[]) val; - value = arr[0]; - } + if (val instanceof String) { + value = (String) val; + } else { + String[] arr = (String[]) val; + value = arr[0]; + } - warning.append(name); - warning.append("="); - warning.append(value); + warning.append(name); + warning.append("="); + warning.append(value); - if (iter.hasNext()) { + if (iter.hasNext()) { - warning.append(delim); - } - } + warning.append(delim); + } + } - warning.append(")"); - setWarningResponse(warning.toString()); + warning.append(")"); + setWarningResponse(warning.toString()); } public void setUID(String id) { @@ -160,7 +153,4 @@ public class RETSUpdateTransaction extends RETSTransaction { } - - - }