From 937e8f0a5fb9bf55f27dcde2e0193b8856f6b6c5 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Wed, 24 Nov 2021 07:50:04 -0500 Subject: [PATCH] USRE-76 Add missing file and add rets-io-common package --- .idea/workspace.xml | 106 ++++++++++++++++++ pom.xml | 13 ++- .../realtor/rets/validation/OperatorMap.java | 43 +++---- .../rets/validation/RETSUpdateValidator.java | 10 +- target/test-classes/log4j2.xml | 97 ++++++++++++++++ target/test-classes/logback.xml | 21 ++++ 6 files changed, 265 insertions(+), 25 deletions(-) create mode 100644 .idea/workspace.xml create mode 100644 target/test-classes/log4j2.xml create mode 100644 target/test-classes/logback.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..c77837e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1637724413061 + + + 1637725048156 + + + 1637757513552 + + + 1637757528301 + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index b096c43..2a1f8a5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.ossez.usreio rets-io-validation - 0.0.2-SNAPSHOT + 0.0.1-SNAPSHOT jar Rets-Io-Validation @@ -28,11 +28,22 @@ + + com.ossez.usreio + rets-io-common + 0.0.1-SNAPSHOT + + ch.qos.logback logback-classic 1.2.5 + + xalan + xalan + 2.7.2 + diff --git a/src/main/java/org/realtor/rets/validation/OperatorMap.java b/src/main/java/org/realtor/rets/validation/OperatorMap.java index 30e1a9e..379c302 100644 --- a/src/main/java/org/realtor/rets/validation/OperatorMap.java +++ b/src/main/java/org/realtor/rets/validation/OperatorMap.java @@ -1,9 +1,9 @@ /* $Header: /usr/local/cvsroot/rets/validation/src/org/realtor/rets/validation/OperatorMap.java,v 1.3 2003/12/04 15:28:33 rsegelman Exp $ */ package org.realtor.rets.validation; -import org.apache.log4j.Category; - import org.realtor.rets.validation.operators.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.*; @@ -18,16 +18,19 @@ import java.util.zip.*; /** - * OperatorMap.java Created Aug 25, 2003 + * OperatorMap.java Created Aug 25, 2003 + *

+ *

+ * Copyright 2003, Avantia inc. * - * - * Copyright 2003, Avantia inc. - * @version $Revision: 1.3 $ - * @author scohen + * @author scohen + * @version $Revision: 1.3 $ */ public class OperatorMap { + private final static Logger logger = LoggerFactory.getLogger(OperatorMap.class); + private static Hashtable map; - static Category cat = Category.getInstance(OperatorMap.class); + private static String packageName = "org.realtor.rets.validation.operators"; static { @@ -58,7 +61,7 @@ public class OperatorMap { try { // Try to create an instance of the object - cat.debug("getAllOperators instantiating class= " + classname); + logger.debug("getAllOperators instantiating class= " + classname); Object o = Class.forName(classname).newInstance(); @@ -67,18 +70,18 @@ public class OperatorMap { map.put(oper.getSymbol(), oper); } } catch (ClassNotFoundException cnfex) { - cat.error("error:" + classname, cnfex); + logger.error("error:" + classname, cnfex); } catch (InstantiationException iex) { - cat.error("error: " + classname + - " We try to instantiate an interface or an object that does not have a default constructor ", - iex); + logger.error("error: " + classname + + " We try to instantiate an interface or an object that does not have a default constructor ", + iex); // We try to instantiate an interface // or an object that does not have a // default constructor } catch (IllegalAccessException iaex) { - cat.error("error: " + classname + " The class is not public ", - iaex); + logger.error("error: " + classname + " The class is not public ", + iaex); // The class is not public } @@ -105,19 +108,19 @@ public class OperatorMap { while (entries.hasMoreElements()) { JarEntry entry = (JarEntry) entries.nextElement(); String entryName = entry.getName().replace('/', '.'); - cat.debug("entryName prior to add" + entryName); - cat.debug("packageName" + packageName); + logger.debug("entryName prior to add" + entryName); + logger.debug("packageName" + packageName); if (entryName.startsWith(packageName) && entryName.endsWith("class")) { - cat.debug("adding entryName " + entryName); + logger.debug("adding entryName " + entryName); classList.add(entryName); } } files = (String[]) classList.toArray(new String[classList.size()]); } catch (IOException io) { - cat.error("error creating jarfile ", io); + logger.error("error creating jarfile ", io); } return files; @@ -130,7 +133,7 @@ public class OperatorMap { // we are only interested in .class files if (files[i].endsWith(".class")) { files[i] = packageName + "." + files[i]; - cat.debug("getClassListFromDirectory file is " + files[i]); + logger.debug("getClassListFromDirectory file is " + files[i]); } } diff --git a/src/main/java/org/realtor/rets/validation/RETSUpdateValidator.java b/src/main/java/org/realtor/rets/validation/RETSUpdateValidator.java index dbf2e64..f249983 100644 --- a/src/main/java/org/realtor/rets/validation/RETSUpdateValidator.java +++ b/src/main/java/org/realtor/rets/validation/RETSUpdateValidator.java @@ -13,13 +13,14 @@ import java.util.Map; import javax.xml.transform.TransformerException; -import org.apache.log4j.Category; import org.apache.xpath.XPathAPI; import org.realtor.rets.util.XMLUtils; import org.realtor.rets.validation.terms.AbstractTerm; import org.realtor.rets.validation.terms.DateTerm; import org.realtor.rets.validation.terms.NumericTerm; import org.realtor.rets.validation.terms.StringTerm; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -36,7 +37,8 @@ import org.w3c.dom.NodeList; */ public class RETSUpdateValidator { // log4j category - static Category cat = Category.getInstance(RETSUpdateValidator.class); + private final static Logger logger = LoggerFactory.getLogger(RETSUpdateValidator.class); + protected static final String AGENT_CODE_KEY = "AGENT-CODE"; protected static final String USER_CLASS_KEY = "USER-CLASS"; protected static final String USER_LEVEL_KEY = "USER-LEVEL"; @@ -146,10 +148,10 @@ public class RETSUpdateValidator { Constructor constructor = termTypeClass.getConstructor(new Class [] {String.class}); AbstractTerm term = (AbstractTerm) constructor.newInstance(new Object [] {entry}); rv.put(key, term); - cat.debug("Added value: " + key + " = " + term); + logger.debug("Added value: " + key + " = " + term); } catch (Exception e) { - cat.error(e); + logger.debug(e); } } } diff --git a/target/test-classes/log4j2.xml b/target/test-classes/log4j2.xml new file mode 100644 index 0000000..ff28157 --- /dev/null +++ b/target/test-classes/log4j2.xml @@ -0,0 +1,97 @@ + + + + + + /home/logs/reoc/services/ + + + + + + + + + + + + + + + + + + %-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n + + + + + + + + + + + + + + + %-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n + + + + + + + + + + + + + + + %-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n + + + + + + + + + + + + + + + %-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/test-classes/logback.xml b/target/test-classes/logback.xml new file mode 100644 index 0000000..8599e4f --- /dev/null +++ b/target/test-classes/logback.xml @@ -0,0 +1,21 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n + + + + + + + +