USRE-76 Add missing file and add rets-io-common package

This commit is contained in:
YuCheng Hu 2021-11-24 07:50:04 -05:00
parent 57364df744
commit 937e8f0a5f
6 changed files with 265 additions and 25 deletions

106
.idea/workspace.xml Normal file
View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="7c2295ed-8e00-4073-a402-bff68b86a0c3" name="Changes" comment="USRE-76 Add missing file for IJ">
<change beforePath="$PROJECT_DIR$/src/main/java/org/realtor/rets/validation/OperatorMap.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/realtor/rets/validation/OperatorMap.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/realtor/rets/validation/RETSUpdateValidator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/realtor/rets/validation/RETSUpdateValidator.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="main" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitSEFilterConfiguration">
<file-type-list>
<filtered-out-file-type name="LOCAL_BRANCH" />
<filtered-out-file-type name="REMOTE_BRANCH" />
<filtered-out-file-type name="TAG" />
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
</file-type-list>
</component>
<component name="ProjectId" id="21LdgS70iDzrIoxYFTvmHETvD86" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="TF_FMT" value="false" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
</component>
<component name="RecentsManager">
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
<recent name="org.realtor.rets.validation.tests" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="7c2295ed-8e00-4073-a402-bff68b86a0c3" name="Changes" comment="" />
<created>1637724413061</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1637724413061</updated>
<workItem from="1637724415528" duration="4930000" />
</task>
<task id="LOCAL-00001" summary="USRE-76 init repo and re-create project as maven project">
<created>1637725048156</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1637725048156</updated>
</task>
<task id="LOCAL-00002" summary="USRE-76 init slf4j package instead of log4j">
<created>1637757513552</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1637757513552</updated>
</task>
<task id="LOCAL-00003" summary="USRE-76 Add missing file for IJ">
<created>1637757528301</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1637757528301</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="USRE-76 init repo and re-create project as maven project" />
<MESSAGE value="USRE-76 init slf4j package instead of log4j" />
<MESSAGE value="USRE-76 Add missing file for IJ" />
<option name="LAST_COMMIT_MESSAGE" value="USRE-76 Add missing file for IJ" />
</component>
</project>

13
pom.xml
View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ossez.usreio</groupId>
<artifactId>rets-io-validation</artifactId>
<version>0.0.2-SNAPSHOT</version>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Rets-Io-Validation</name>
@ -28,11 +28,22 @@
<dependencies>
<dependency>
<groupId>com.ossez.usreio</groupId>
<artifactId>rets-io-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.2</version>
</dependency>
</dependencies>
<build>

View File

@ -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
* <p>
* <p>
* 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]);
}
}

View File

@ -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);
}
}
}

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE RelativeLayout>
<Configuration status="WARN">
<Properties>
<Property name="baseDir">/home/logs/reoc/services/</Property>
</Properties>
<Appenders>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- C O N S O L E - A P P E N D E R -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n" />
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY" />
</Console>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- D E B U G _ F I L E - A P P E N D E R -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<RollingFile name="FILE_DEBUG" append="true" fileName="${baseDir}/services_debug.log" filePattern="${baseDir}/$${date:yyyy-MM}/services-debug-%d{yyyy-MM-dd}-%i.log.gz">
<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout>
<pattern>%-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"></SizeBasedTriggeringPolicy>
</Policies>
<DefaultRolloverStrategy max="12" />
</RollingFile>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- I N F O _ F I L E - A P P E N D E R -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<RollingFile name="FILE_INFO" append="true" fileName="${baseDir}/services_info.log" filePattern="${baseDir}/$${date:yyyy-MM}/services-info-%d{yyyy-MM-dd}.log.gz">
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout>
<pattern>%-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"></SizeBasedTriggeringPolicy>
</Policies>
<DefaultRolloverStrategy max="12" />
</RollingFile>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- F I L E _ W A R N - A P P E N D E R -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<RollingFile name="FILE_WARN" append="true" fileName="${baseDir}/services_info.log" filePattern="${baseDir}/$${date:yyyy-MM}/services-warn-%d{yyyy-MM-dd}.log.gz">
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout>
<pattern>%-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"></SizeBasedTriggeringPolicy>
</Policies>
<DefaultRolloverStrategy max="12" />
</RollingFile>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- F I L E _ E R R O R - A P P E N D E R -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<RollingFile name="FILE_ERROR" append="true" fileName="${baseDir}/services_error.log" filePattern="${baseDir}/$${date:yyyy-MM}/services-error-%d{yyyy-MM-dd}.log.gz">
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout>
<pattern>%-d{yyyy/MM/dd HH:mm:ss} %-5p [%c] - %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"></SizeBasedTriggeringPolicy>
</Policies>
<DefaultRolloverStrategy max="12" />
</RollingFile>
</Appenders>
<!-- LOGGERS -->
<Loggers>
<Logger name="com" level="TRACE" additivity="false">
<AppenderRef ref="CONSOLE" level="DEBUG" />
<AppenderRef ref="FILE_DEBUG" level="DEBUG" />
<AppenderRef ref="FILE_INFO" level="INFO" />
<AppenderRef ref="FILE_WARN" level="WARN" />
<AppenderRef ref="FILE_ERROR" level="ERROR" />
</Logger>
<root level="TRACE">
</root>
</Loggers>
</Configuration>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration debug="true">
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned by default the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<root level="debug">
<appender-ref ref="STDOUT"/>
</root>
</configuration>