diff --git a/build.gradle b/build.gradle index 51add21..e2ed85f 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,8 @@ dependencies { compile group: 'log4j', name: 'log4j', version: '1.2.9' compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1' - compile group: 'commons-lang', name: 'commons-lang', version: '2.4' + compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' + compile group: 'commons-codec', name: 'commons-codec', version: '1.3' compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.1.1' diff --git a/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClient.java b/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClient.java index 9c8f05d..1d7d976 100644 --- a/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClient.java +++ b/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClient.java @@ -6,7 +6,7 @@ import java.util.concurrent.ConcurrentHashMap; import com.ossez.reoc.rets.common.util.CaseInsensitiveTreeMap; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; diff --git a/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClientResponse.java b/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClientResponse.java index 5fe9340..b5612fb 100644 --- a/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClientResponse.java +++ b/src/main/java/com/ossez/reoc/rets/client/CommonsHttpClientResponse.java @@ -6,8 +6,8 @@ import java.util.Map; import java.util.zip.GZIPInputStream; import com.ossez.reoc.rets.common.util.CaseInsensitiveTreeMap; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.Header; import org.apache.http.HttpResponse; diff --git a/src/main/java/com/ossez/reoc/rets/client/GetMetadataRequest.java b/src/main/java/com/ossez/reoc/rets/client/GetMetadataRequest.java index fd7ff18..12d7334 100644 --- a/src/main/java/com/ossez/reoc/rets/client/GetMetadataRequest.java +++ b/src/main/java/com/ossez/reoc/rets/client/GetMetadataRequest.java @@ -1,6 +1,6 @@ package com.ossez.reoc.rets.client; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class GetMetadataRequest extends VersionInsensitiveRequest { private static final int COMPACT_FORMAT = 0; diff --git a/src/main/java/com/ossez/reoc/rets/client/GetMetadataResponse.java b/src/main/java/com/ossez/reoc/rets/client/GetMetadataResponse.java index aa5fe08..67de0ec 100644 --- a/src/main/java/com/ossez/reoc/rets/client/GetMetadataResponse.java +++ b/src/main/java/com/ossez/reoc/rets/client/GetMetadataResponse.java @@ -8,7 +8,7 @@ import com.ossez.reoc.rets.common.metadata.JDomCompactBuilder; import com.ossez.reoc.rets.common.metadata.JDomStandardBuilder; import com.ossez.reoc.rets.common.metadata.MetaObject; import com.ossez.reoc.rets.common.metadata.MetadataException; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.jdom.Element; import org.jdom.JDOMException; diff --git a/src/main/java/com/ossez/reoc/rets/client/GetObjectRequest.java b/src/main/java/com/ossez/reoc/rets/client/GetObjectRequest.java index 0c65087..dc53e43 100644 --- a/src/main/java/com/ossez/reoc/rets/client/GetObjectRequest.java +++ b/src/main/java/com/ossez/reoc/rets/client/GetObjectRequest.java @@ -6,8 +6,8 @@ import java.util.Iterator; import java.util.Set; import java.util.Map; -import org.apache.commons.lang.ObjectUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; public class GetObjectRequest extends VersionInsensitiveRequest { public static final String KEY_RESOURCE = "Resource"; diff --git a/src/main/java/com/ossez/reoc/rets/client/GetObjectResponse.java b/src/main/java/com/ossez/reoc/rets/client/GetObjectResponse.java index d675558..c534ec2 100644 --- a/src/main/java/com/ossez/reoc/rets/client/GetObjectResponse.java +++ b/src/main/java/com/ossez/reoc/rets/client/GetObjectResponse.java @@ -6,7 +6,7 @@ import java.util.Map; import java.util.NoSuchElementException; import com.ossez.reoc.rets.common.util.CaseInsensitiveTreeMap; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.http.HeaderElement; import org.apache.http.NameValuePair; import org.apache.http.message.BasicHeaderValueParser; diff --git a/src/main/java/com/ossez/reoc/rets/client/GetObjectResponseIterator.java b/src/main/java/com/ossez/reoc/rets/client/GetObjectResponseIterator.java index 000183a..7904302 100644 --- a/src/main/java/com/ossez/reoc/rets/client/GetObjectResponseIterator.java +++ b/src/main/java/com/ossez/reoc/rets/client/GetObjectResponseIterator.java @@ -7,7 +7,7 @@ import java.util.HashMap; import java.util.Map; import java.util.NoSuchElementException; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; public class GetObjectResponseIterator implements GetObjectIterator { public static final char CR = '\r'; diff --git a/src/main/java/com/ossez/reoc/rets/client/InvalidReplyCodeException.java b/src/main/java/com/ossez/reoc/rets/client/InvalidReplyCodeException.java index a125dda..94dbc93 100644 --- a/src/main/java/com/ossez/reoc/rets/client/InvalidReplyCodeException.java +++ b/src/main/java/com/ossez/reoc/rets/client/InvalidReplyCodeException.java @@ -1,6 +1,6 @@ package com.ossez.reoc.rets.client; -import org.apache.commons.lang.SystemUtils; +import org.apache.commons.lang3.SystemUtils; /** * Exception class for invalid reply codes from a Rets server */ diff --git a/src/main/java/com/ossez/reoc/rets/client/KeyValueResponse.java b/src/main/java/com/ossez/reoc/rets/client/KeyValueResponse.java index d19b17c..8020c8c 100644 --- a/src/main/java/com/ossez/reoc/rets/client/KeyValueResponse.java +++ b/src/main/java/com/ossez/reoc/rets/client/KeyValueResponse.java @@ -10,8 +10,8 @@ import org.jdom.JDOMException; import org.jdom.Document; import org.jdom.input.SAXBuilder; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/ossez/reoc/rets/client/LoginResponse.java b/src/main/java/com/ossez/reoc/rets/client/LoginResponse.java index d75ecfe..dcb131d 100644 --- a/src/main/java/com/ossez/reoc/rets/client/LoginResponse.java +++ b/src/main/java/com/ossez/reoc/rets/client/LoginResponse.java @@ -6,8 +6,8 @@ import java.net.URL; import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/ossez/reoc/rets/client/MetaCollectorAdapter.java b/src/main/java/com/ossez/reoc/rets/client/MetaCollectorAdapter.java index 164c1d7..ebb3f49 100644 --- a/src/main/java/com/ossez/reoc/rets/client/MetaCollectorAdapter.java +++ b/src/main/java/com/ossez/reoc/rets/client/MetaCollectorAdapter.java @@ -3,7 +3,7 @@ package com.ossez.reoc.rets.client; import com.ossez.reoc.rets.common.metadata.MetaCollector; import com.ossez.reoc.rets.common.metadata.MetaObject; import com.ossez.reoc.rets.common.metadata.MetadataType; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/src/main/java/com/ossez/reoc/rets/client/RetsException.java b/src/main/java/com/ossez/reoc/rets/client/RetsException.java index 70f6be4..4ec8274 100644 --- a/src/main/java/com/ossez/reoc/rets/client/RetsException.java +++ b/src/main/java/com/ossez/reoc/rets/client/RetsException.java @@ -1,8 +1,9 @@ package com.ossez.reoc.rets.client; -import org.apache.commons.lang.exception.NestableException; - -public class RetsException extends NestableException { +/** + * @author YuCheng Hu + */ +public class RetsException extends Exception { public RetsException() { super(); } diff --git a/src/main/java/com/ossez/reoc/rets/client/RetsHttpRequest.java b/src/main/java/com/ossez/reoc/rets/client/RetsHttpRequest.java index ad64f8b..9c0f759 100644 --- a/src/main/java/com/ossez/reoc/rets/client/RetsHttpRequest.java +++ b/src/main/java/com/ossez/reoc/rets/client/RetsHttpRequest.java @@ -9,8 +9,8 @@ import java.util.SortedMap; import java.util.TreeMap; import com.ossez.reoc.rets.common.util.CaseInsensitiveTreeMap; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; /** Base Http Request object */ public abstract class RetsHttpRequest implements Serializable { diff --git a/src/main/java/com/ossez/reoc/rets/client/RetsUtil.java b/src/main/java/com/ossez/reoc/rets/client/RetsUtil.java index 048e5d0..f3b625e 100644 --- a/src/main/java/com/ossez/reoc/rets/client/RetsUtil.java +++ b/src/main/java/com/ossez/reoc/rets/client/RetsUtil.java @@ -1,45 +1,48 @@ package com.ossez.reoc.rets.client; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.net.URLCodec; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.EncoderException; -import org.apache.commons.codec.net.URLCodec; -import org.apache.commons.lang.exception.NestableRuntimeException; - -/** Random utility functions. */ +/** + * Random utility functions + * + * @author YuCheng Hu + */ public class RetsUtil { - public static void copyStream(InputStream in, OutputStream out) throws IOException { - byte[] buf = new byte[512]; - int count; - while (true) { - count = in.read(buf); - if (count < 1) { - in.close(); - out.close(); - return; - } - while (count > 0) { - out.write(buf); - } - } - } + public static void copyStream(InputStream in, OutputStream out) throws IOException { + byte[] buf = new byte[512]; + int count; + while (true) { + count = in.read(buf); + if (count < 1) { + in.close(); + out.close(); + return; + } + while (count > 0) { + out.write(buf); + } + } + } - public static String urlEncode(String string) { - try { - return new URLCodec().encode(string); - } catch (EncoderException e) { - throw new NestableRuntimeException(e); - } - } + public static String urlEncode(String string) { + try { + return new URLCodec().encode(string); + } catch (EncoderException e) { + throw new RuntimeException(e); + } + } - public static String urlDecode(String string) { - try { - return new URLCodec().decode(string); - } catch (DecoderException e) { - throw new NestableRuntimeException(e); - } - } + public static String urlDecode(String string) { + try { + return new URLCodec().decode(string); + } catch (DecoderException e) { + throw new RuntimeException(e); + } + } } diff --git a/src/main/java/com/ossez/reoc/rets/client/RetsVersion.java b/src/main/java/com/ossez/reoc/rets/client/RetsVersion.java index 646710a..243e69f 100644 --- a/src/main/java/com/ossez/reoc/rets/client/RetsVersion.java +++ b/src/main/java/com/ossez/reoc/rets/client/RetsVersion.java @@ -2,8 +2,8 @@ package com.ossez.reoc.rets.client; import java.io.Serializable; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; public class RetsVersion implements Serializable { public static final String RETS_VERSION_HEADER = "RETS-Version"; diff --git a/src/main/java/com/ossez/reoc/rets/client/StreamingSearchResultProcessor.java b/src/main/java/com/ossez/reoc/rets/client/StreamingSearchResultProcessor.java index 2475bf6..f6ee4d5 100644 --- a/src/main/java/com/ossez/reoc/rets/client/StreamingSearchResultProcessor.java +++ b/src/main/java/com/ossez/reoc/rets/client/StreamingSearchResultProcessor.java @@ -4,7 +4,6 @@ import java.io.InputStream; import java.io.Reader; import java.util.LinkedList; -import org.apache.commons.lang.exception.NestableRuntimeException; import org.apache.commons.logging.LogFactory; import org.xml.sax.InputSource; @@ -163,7 +162,7 @@ class StreamingSearchResult implements SearchResultSet, SearchResultCollector { if (state() > BUFFER_FULL) { if (this.exception == null) setException(new RetsException("Attempting to add rows to buffer when in complete state")); - throw new NestableRuntimeException(this.exception); + throw new RuntimeException(this.exception); } // check complete. @@ -174,7 +173,7 @@ class StreamingSearchResult implements SearchResultSet, SearchResultCollector { if (this.exception == null) setException(new RetsException("Timeout writing to streaming result set buffer, timeout length = " + this.timeout)); - throw new NestableRuntimeException(this.exception); + throw new RuntimeException(this.exception); } } @@ -283,7 +282,7 @@ class StreamingSearchResult implements SearchResultSet, SearchResultCollector { try { return checkException(); } catch (RetsException e) { - throw new NestableRuntimeException(e); + throw new RuntimeException(e); } } @@ -301,7 +300,7 @@ class StreamingSearchResult implements SearchResultSet, SearchResultCollector { wait(this.timeout); } catch (InterruptedException e) { pushState(COMPLETE); - throw new NestableRuntimeException(e); + throw new RuntimeException(e); } } diff --git a/src/main/java/com/ossez/reoc/rets/common/metadata/MetaObject.java b/src/main/java/com/ossez/reoc/rets/common/metadata/MetaObject.java index 05b1870..c04216f 100644 --- a/src/main/java/com/ossez/reoc/rets/common/metadata/MetaObject.java +++ b/src/main/java/com/ossez/reoc/rets/common/metadata/MetaObject.java @@ -10,9 +10,9 @@ import java.util.Map; import java.util.Set; import com.ossez.reoc.rets.common.util.CaseInsensitiveTreeMap; -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.ossez.reoc.rets.common.metadata.attrib.AttrAlphanum; diff --git a/src/main/java/com/ossez/reoc/rets/common/metadata/MetadataException.java b/src/main/java/com/ossez/reoc/rets/common/metadata/MetadataException.java index a3da28c..9171b00 100644 --- a/src/main/java/com/ossez/reoc/rets/common/metadata/MetadataException.java +++ b/src/main/java/com/ossez/reoc/rets/common/metadata/MetadataException.java @@ -7,9 +7,8 @@ */ package com.ossez.reoc.rets.common.metadata; -import org.apache.commons.lang.exception.NestableException; -public class MetadataException extends NestableException { +public class MetadataException extends Exception { public MetadataException() { super(); } diff --git a/src/main/java/com/ossez/reoc/rets/common/metadata/attrib/AttrVersion.java b/src/main/java/com/ossez/reoc/rets/common/metadata/attrib/AttrVersion.java index df4529c..d3c49dc 100644 --- a/src/main/java/com/ossez/reoc/rets/common/metadata/attrib/AttrVersion.java +++ b/src/main/java/com/ossez/reoc/rets/common/metadata/attrib/AttrVersion.java @@ -7,7 +7,7 @@ */ package com.ossez.reoc.rets.common.metadata.attrib; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import com.ossez.reoc.rets.common.metadata.AttrType; import com.ossez.reoc.rets.common.metadata.MetaParseException; diff --git a/src/test/java/com/ossez/reoc/rets/examples/RetsGetMetadataExample.java b/src/test/java/com/ossez/reoc/rets/examples/RetsGetMetadataExample.java index ea14bd8..20b32f9 100644 --- a/src/test/java/com/ossez/reoc/rets/examples/RetsGetMetadataExample.java +++ b/src/test/java/com/ossez/reoc/rets/examples/RetsGetMetadataExample.java @@ -2,11 +2,7 @@ package com.ossez.reoc.rets.examples; import java.net.MalformedURLException; -import com.ossez.reoc.rets.client.CommonsHttpClient; -import com.ossez.reoc.rets.client.RetsException; -import com.ossez.reoc.rets.client.RetsHttpClient; -import com.ossez.reoc.rets.client.RetsSession; -import com.ossez.reoc.rets.client.RetsVersion; +import com.ossez.reoc.rets.client.*; import com.ossez.reoc.rets.common.metadata.types.MClass; import com.ossez.reoc.rets.common.metadata.types.MResource; import com.ossez.reoc.rets.common.metadata.types.MSystem; @@ -34,7 +30,9 @@ public class RetsGetMetadataExample { session.setMethod("POST"); try { //Login - session.login(username, password); + LoginResponse loginResponse = session.login(username, password); + + System.out.println(">>>" + loginResponse.getSessionId()); } catch (RetsException e) { e.printStackTrace(); } diff --git a/src/test/java/com/ossez/reoc/rets/examples/RetsSearchExample.java b/src/test/java/com/ossez/reoc/rets/examples/RetsSearchExample.java index 7e7824c..5366984 100644 --- a/src/test/java/com/ossez/reoc/rets/examples/RetsSearchExample.java +++ b/src/test/java/com/ossez/reoc/rets/examples/RetsSearchExample.java @@ -2,7 +2,7 @@ package com.ossez.reoc.rets.examples; import java.net.MalformedURLException; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import com.ossez.reoc.rets.client.CommonsHttpClient; import com.ossez.reoc.rets.client.RetsException; import com.ossez.reoc.rets.client.RetsHttpClient; diff --git a/target/classes/build.xml b/target/classes/build.xml index 485ce42..6acd5e5 100644 --- a/target/classes/build.xml +++ b/target/classes/build.xml @@ -17,7 +17,7 @@ - + diff --git a/target/classes/org/realtors/rets/client/BrokerCodeRequredException.class b/target/classes/org/realtors/rets/client/BrokerCodeRequredException.class deleted file mode 100644 index 8a09b86..0000000 Binary files a/target/classes/org/realtors/rets/client/BrokerCodeRequredException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CapabilityUrls.class b/target/classes/org/realtors/rets/client/CapabilityUrls.class deleted file mode 100644 index 4d63eb9..0000000 Binary files a/target/classes/org/realtors/rets/client/CapabilityUrls.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/ChangePasswordRequest.class b/target/classes/org/realtors/rets/client/ChangePasswordRequest.class deleted file mode 100644 index ea24c24..0000000 Binary files a/target/classes/org/realtors/rets/client/ChangePasswordRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/ChangePasswordResponse.class b/target/classes/org/realtors/rets/client/ChangePasswordResponse.class deleted file mode 100644 index 0caf088..0000000 Binary files a/target/classes/org/realtors/rets/client/ChangePasswordResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CollectionOfCollectionsIterator.class b/target/classes/org/realtors/rets/client/CollectionOfCollectionsIterator.class deleted file mode 100644 index 694332a..0000000 Binary files a/target/classes/org/realtors/rets/client/CollectionOfCollectionsIterator.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CommonsHttpClient.class b/target/classes/org/realtors/rets/client/CommonsHttpClient.class deleted file mode 100644 index 684bf4e..0000000 Binary files a/target/classes/org/realtors/rets/client/CommonsHttpClient.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CommonsHttpClientResponse$1.class b/target/classes/org/realtors/rets/client/CommonsHttpClientResponse$1.class deleted file mode 100644 index 44c3665..0000000 Binary files a/target/classes/org/realtors/rets/client/CommonsHttpClientResponse$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CommonsHttpClientResponse.class b/target/classes/org/realtors/rets/client/CommonsHttpClientResponse.class deleted file mode 100644 index 17874d4..0000000 Binary files a/target/classes/org/realtors/rets/client/CommonsHttpClientResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CompactRowPolicy$1.class b/target/classes/org/realtors/rets/client/CompactRowPolicy$1.class deleted file mode 100644 index 18b83ab..0000000 Binary files a/target/classes/org/realtors/rets/client/CompactRowPolicy$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CompactRowPolicy$2.class b/target/classes/org/realtors/rets/client/CompactRowPolicy$2.class deleted file mode 100644 index 21b0cbc..0000000 Binary files a/target/classes/org/realtors/rets/client/CompactRowPolicy$2.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CompactRowPolicy$3.class b/target/classes/org/realtors/rets/client/CompactRowPolicy$3.class deleted file mode 100644 index 15704ba..0000000 Binary files a/target/classes/org/realtors/rets/client/CompactRowPolicy$3.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CompactRowPolicy$4.class b/target/classes/org/realtors/rets/client/CompactRowPolicy$4.class deleted file mode 100644 index c9dc7e9..0000000 Binary files a/target/classes/org/realtors/rets/client/CompactRowPolicy$4.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/CompactRowPolicy.class b/target/classes/org/realtors/rets/client/CompactRowPolicy.class deleted file mode 100644 index 14a0835..0000000 Binary files a/target/classes/org/realtors/rets/client/CompactRowPolicy.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GenericHttpRequest.class b/target/classes/org/realtors/rets/client/GenericHttpRequest.class deleted file mode 100644 index b2e211f..0000000 Binary files a/target/classes/org/realtors/rets/client/GenericHttpRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetMetadataRequest.class b/target/classes/org/realtors/rets/client/GetMetadataRequest.class deleted file mode 100644 index f27e900..0000000 Binary files a/target/classes/org/realtors/rets/client/GetMetadataRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetMetadataResponse.class b/target/classes/org/realtors/rets/client/GetMetadataResponse.class deleted file mode 100644 index 506e9e4..0000000 Binary files a/target/classes/org/realtors/rets/client/GetMetadataResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetObjectIterator.class b/target/classes/org/realtors/rets/client/GetObjectIterator.class deleted file mode 100644 index 1eae161..0000000 Binary files a/target/classes/org/realtors/rets/client/GetObjectIterator.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetObjectRequest.class b/target/classes/org/realtors/rets/client/GetObjectRequest.class deleted file mode 100644 index c015e80..0000000 Binary files a/target/classes/org/realtors/rets/client/GetObjectRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetObjectResponse$1.class b/target/classes/org/realtors/rets/client/GetObjectResponse$1.class deleted file mode 100644 index 62428f4..0000000 Binary files a/target/classes/org/realtors/rets/client/GetObjectResponse$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetObjectResponse.class b/target/classes/org/realtors/rets/client/GetObjectResponse.class deleted file mode 100644 index 60d5438..0000000 Binary files a/target/classes/org/realtors/rets/client/GetObjectResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetObjectResponseIterator$1.class b/target/classes/org/realtors/rets/client/GetObjectResponseIterator$1.class deleted file mode 100644 index b602f91..0000000 Binary files a/target/classes/org/realtors/rets/client/GetObjectResponseIterator$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/GetObjectResponseIterator.class b/target/classes/org/realtors/rets/client/GetObjectResponseIterator.class deleted file mode 100644 index 5465900..0000000 Binary files a/target/classes/org/realtors/rets/client/GetObjectResponseIterator.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/InvalidArgumentException.class b/target/classes/org/realtors/rets/client/InvalidArgumentException.class deleted file mode 100644 index 72218a0..0000000 Binary files a/target/classes/org/realtors/rets/client/InvalidArgumentException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/InvalidHttpStatusException.class b/target/classes/org/realtors/rets/client/InvalidHttpStatusException.class deleted file mode 100644 index c027201..0000000 Binary files a/target/classes/org/realtors/rets/client/InvalidHttpStatusException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/InvalidReplyCodeException.class b/target/classes/org/realtors/rets/client/InvalidReplyCodeException.class deleted file mode 100644 index 5c47d22..0000000 Binary files a/target/classes/org/realtors/rets/client/InvalidReplyCodeException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/InvalidReplyCodeHandler$1.class b/target/classes/org/realtors/rets/client/InvalidReplyCodeHandler$1.class deleted file mode 100644 index 9047562..0000000 Binary files a/target/classes/org/realtors/rets/client/InvalidReplyCodeHandler$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/InvalidReplyCodeHandler.class b/target/classes/org/realtors/rets/client/InvalidReplyCodeHandler.class deleted file mode 100644 index d54054d..0000000 Binary files a/target/classes/org/realtors/rets/client/InvalidReplyCodeHandler.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/KeyValueResponse.class b/target/classes/org/realtors/rets/client/KeyValueResponse.class deleted file mode 100644 index 7614fe7..0000000 Binary files a/target/classes/org/realtors/rets/client/KeyValueResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/LoginRequest.class b/target/classes/org/realtors/rets/client/LoginRequest.class deleted file mode 100644 index 198e803..0000000 Binary files a/target/classes/org/realtors/rets/client/LoginRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/LoginResponse.class b/target/classes/org/realtors/rets/client/LoginResponse.class deleted file mode 100644 index 6487a4e..0000000 Binary files a/target/classes/org/realtors/rets/client/LoginResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/LogoutRequest.class b/target/classes/org/realtors/rets/client/LogoutRequest.class deleted file mode 100644 index d15eec5..0000000 Binary files a/target/classes/org/realtors/rets/client/LogoutRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/LogoutResponse.class b/target/classes/org/realtors/rets/client/LogoutResponse.class deleted file mode 100644 index 5dc25ab..0000000 Binary files a/target/classes/org/realtors/rets/client/LogoutResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/MetaCollectorAdapter.class b/target/classes/org/realtors/rets/client/MetaCollectorAdapter.class deleted file mode 100644 index d8fc890..0000000 Binary files a/target/classes/org/realtors/rets/client/MetaCollectorAdapter.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/MetaCollectorImpl.class b/target/classes/org/realtors/rets/client/MetaCollectorImpl.class deleted file mode 100644 index 1d36cf6..0000000 Binary files a/target/classes/org/realtors/rets/client/MetaCollectorImpl.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/NetworkEventMonitor.class b/target/classes/org/realtors/rets/client/NetworkEventMonitor.class deleted file mode 100644 index e7943ec..0000000 Binary files a/target/classes/org/realtors/rets/client/NetworkEventMonitor.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/NonMultipartGetObjectResponseIterator.class b/target/classes/org/realtors/rets/client/NonMultipartGetObjectResponseIterator.class deleted file mode 100644 index 69ed825..0000000 Binary files a/target/classes/org/realtors/rets/client/NonMultipartGetObjectResponseIterator.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/NullNetworkEventMonitor.class b/target/classes/org/realtors/rets/client/NullNetworkEventMonitor.class deleted file mode 100644 index d79086e..0000000 Binary files a/target/classes/org/realtors/rets/client/NullNetworkEventMonitor.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/ReplyCode.class b/target/classes/org/realtors/rets/client/ReplyCode.class deleted file mode 100644 index f71f658..0000000 Binary files a/target/classes/org/realtors/rets/client/ReplyCode.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/ReplyCodeHandler.class b/target/classes/org/realtors/rets/client/ReplyCodeHandler.class deleted file mode 100644 index f6c2878..0000000 Binary files a/target/classes/org/realtors/rets/client/ReplyCodeHandler.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsException.class b/target/classes/org/realtors/rets/client/RetsException.class deleted file mode 100644 index 4aaedca..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsHttpClient.class b/target/classes/org/realtors/rets/client/RetsHttpClient.class deleted file mode 100644 index 36c8e9f..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsHttpClient.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsHttpRequest.class b/target/classes/org/realtors/rets/client/RetsHttpRequest.class deleted file mode 100644 index cb62c11..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsHttpRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsHttpResponse.class b/target/classes/org/realtors/rets/client/RetsHttpResponse.class deleted file mode 100644 index 61377b7..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsHttpResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsSession$1.class b/target/classes/org/realtors/rets/client/RetsSession$1.class deleted file mode 100644 index a492539..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsSession$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsSession.class b/target/classes/org/realtors/rets/client/RetsSession.class deleted file mode 100644 index 22ac246..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsSession.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsTransport$1.class b/target/classes/org/realtors/rets/client/RetsTransport$1.class deleted file mode 100644 index 55a3e0b..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsTransport$1.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsTransport.class b/target/classes/org/realtors/rets/client/RetsTransport.class deleted file mode 100644 index 178884f..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsTransport.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsUtil.class b/target/classes/org/realtors/rets/client/RetsUtil.class deleted file mode 100644 index 79fc203..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsUtil.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/RetsVersion.class b/target/classes/org/realtors/rets/client/RetsVersion.class deleted file mode 100644 index 7682ffb..0000000 Binary files a/target/classes/org/realtors/rets/client/RetsVersion.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchRequest.class b/target/classes/org/realtors/rets/client/SearchRequest.class deleted file mode 100644 index f93e92d..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResult.class b/target/classes/org/realtors/rets/client/SearchResult.class deleted file mode 100644 index 858df5d..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResult.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResultCollector.class b/target/classes/org/realtors/rets/client/SearchResultCollector.class deleted file mode 100644 index 383678f..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResultCollector.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResultHandler.class b/target/classes/org/realtors/rets/client/SearchResultHandler.class deleted file mode 100644 index ef8971d..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResultHandler.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResultImpl.class b/target/classes/org/realtors/rets/client/SearchResultImpl.class deleted file mode 100644 index cc86548..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResultImpl.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResultInfo.class b/target/classes/org/realtors/rets/client/SearchResultInfo.class deleted file mode 100644 index d50f0c6..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResultInfo.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResultProcessor.class b/target/classes/org/realtors/rets/client/SearchResultProcessor.class deleted file mode 100644 index 6c61771..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResultProcessor.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SearchResultSet.class b/target/classes/org/realtors/rets/client/SearchResultSet.class deleted file mode 100644 index efaedaa..0000000 Binary files a/target/classes/org/realtors/rets/client/SearchResultSet.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SingleObjectResponse.class b/target/classes/org/realtors/rets/client/SingleObjectResponse.class deleted file mode 100644 index a5c331f..0000000 Binary files a/target/classes/org/realtors/rets/client/SingleObjectResponse.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/SinglePartInputStream.class b/target/classes/org/realtors/rets/client/SinglePartInputStream.class deleted file mode 100644 index 8b658bc..0000000 Binary files a/target/classes/org/realtors/rets/client/SinglePartInputStream.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/StreamingSearchResult.class b/target/classes/org/realtors/rets/client/StreamingSearchResult.class deleted file mode 100644 index ebc9d19..0000000 Binary files a/target/classes/org/realtors/rets/client/StreamingSearchResult.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/StreamingSearchResultProcessor.class b/target/classes/org/realtors/rets/client/StreamingSearchResultProcessor.class deleted file mode 100644 index 336fdbe..0000000 Binary files a/target/classes/org/realtors/rets/client/StreamingSearchResultProcessor.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/StreamingThread.class b/target/classes/org/realtors/rets/client/StreamingThread.class deleted file mode 100644 index 43aacc1..0000000 Binary files a/target/classes/org/realtors/rets/client/StreamingThread.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/client/VersionInsensitiveRequest.class b/target/classes/org/realtors/rets/client/VersionInsensitiveRequest.class deleted file mode 100644 index 20584cb..0000000 Binary files a/target/classes/org/realtors/rets/client/VersionInsensitiveRequest.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/AttrType.class b/target/classes/org/realtors/rets/common/metadata/AttrType.class deleted file mode 100644 index 5ac0011..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/AttrType.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/CacheKey.class b/target/classes/org/realtors/rets/common/metadata/CacheKey.class deleted file mode 100644 index 4ffbc60..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/CacheKey.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/JDomCompactBuilder.class b/target/classes/org/realtors/rets/common/metadata/JDomCompactBuilder.class deleted file mode 100644 index efa4400..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/JDomCompactBuilder.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/JDomStandardBuilder.class b/target/classes/org/realtors/rets/common/metadata/JDomStandardBuilder.class deleted file mode 100644 index b3099a6..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/JDomStandardBuilder.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetaCollector.class b/target/classes/org/realtors/rets/common/metadata/MetaCollector.class deleted file mode 100644 index b305cf4..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetaCollector.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetaObject.class b/target/classes/org/realtors/rets/common/metadata/MetaObject.class deleted file mode 100644 index ec53c44..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetaObject.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetaParseException.class b/target/classes/org/realtors/rets/common/metadata/MetaParseException.class deleted file mode 100644 index 718b475..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetaParseException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/Metadata.class b/target/classes/org/realtors/rets/common/metadata/Metadata.class deleted file mode 100644 index 8f0d14c..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/Metadata.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetadataBuilder.class b/target/classes/org/realtors/rets/common/metadata/MetadataBuilder.class deleted file mode 100644 index 3ac4894..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetadataBuilder.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetadataElement.class b/target/classes/org/realtors/rets/common/metadata/MetadataElement.class deleted file mode 100644 index 58e290b..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetadataElement.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetadataException.class b/target/classes/org/realtors/rets/common/metadata/MetadataException.class deleted file mode 100644 index c8cd817..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetadataException.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/MetadataType.class b/target/classes/org/realtors/rets/common/metadata/MetadataType.class deleted file mode 100644 index e9dea1e..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/MetadataType.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrAbstractText.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrAbstractText.class deleted file mode 100644 index e6f466e..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrAbstractText.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrAlphanum.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrAlphanum.class deleted file mode 100644 index febf508..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrAlphanum.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrBoolean.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrBoolean.class deleted file mode 100644 index fbf601b..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrBoolean.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrDate.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrDate.class deleted file mode 100644 index a89c678..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrDate.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrEnum.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrEnum.class deleted file mode 100644 index 88e5cbe..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrEnum.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrGenericText.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrGenericText.class deleted file mode 100644 index e5f371a..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrGenericText.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrNumeric.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrNumeric.class deleted file mode 100644 index e2f8304..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrNumeric.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrNumericPositive.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrNumericPositive.class deleted file mode 100644 index 5e2a256..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrNumericPositive.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrPlaintext.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrPlaintext.class deleted file mode 100644 index 532c93d..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrPlaintext.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrText.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrText.class deleted file mode 100644 index 8dc4efe..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrText.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/attrib/AttrVersion.class b/target/classes/org/realtors/rets/common/metadata/attrib/AttrVersion.class deleted file mode 100644 index cbdd4a5..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/attrib/AttrVersion.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MClass.class b/target/classes/org/realtors/rets/common/metadata/types/MClass.class deleted file mode 100644 index 0911641..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MClass.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MEditMask.class b/target/classes/org/realtors/rets/common/metadata/types/MEditMask.class deleted file mode 100644 index dfe60ad..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MEditMask.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MForeignKey.class b/target/classes/org/realtors/rets/common/metadata/types/MForeignKey.class deleted file mode 100644 index b1f5be4..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MForeignKey.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MLookup.class b/target/classes/org/realtors/rets/common/metadata/types/MLookup.class deleted file mode 100644 index 2a69f38..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MLookup.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MLookupType.class b/target/classes/org/realtors/rets/common/metadata/types/MLookupType.class deleted file mode 100644 index 809ce1a..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MLookupType.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MObject.class b/target/classes/org/realtors/rets/common/metadata/types/MObject.class deleted file mode 100644 index ca8f059..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MObject.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MResource.class b/target/classes/org/realtors/rets/common/metadata/types/MResource.class deleted file mode 100644 index 29f766d..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MResource.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MSearchHelp.class b/target/classes/org/realtors/rets/common/metadata/types/MSearchHelp.class deleted file mode 100644 index 02005fc..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MSearchHelp.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MSystem.class b/target/classes/org/realtors/rets/common/metadata/types/MSystem.class deleted file mode 100644 index 9fc2485..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MSystem.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MTable.class b/target/classes/org/realtors/rets/common/metadata/types/MTable.class deleted file mode 100644 index fa029c2..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MTable.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MUpdate.class b/target/classes/org/realtors/rets/common/metadata/types/MUpdate.class deleted file mode 100644 index 5224317..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MUpdate.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MUpdateHelp.class b/target/classes/org/realtors/rets/common/metadata/types/MUpdateHelp.class deleted file mode 100644 index b37c25c..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MUpdateHelp.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MUpdateType.class b/target/classes/org/realtors/rets/common/metadata/types/MUpdateType.class deleted file mode 100644 index 69148a8..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MUpdateType.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MValidationExpression.class b/target/classes/org/realtors/rets/common/metadata/types/MValidationExpression.class deleted file mode 100644 index 3e8145b..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MValidationExpression.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MValidationExternal.class b/target/classes/org/realtors/rets/common/metadata/types/MValidationExternal.class deleted file mode 100644 index 73e214c..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MValidationExternal.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MValidationExternalType.class b/target/classes/org/realtors/rets/common/metadata/types/MValidationExternalType.class deleted file mode 100644 index d45c4dd..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MValidationExternalType.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MValidationLookup.class b/target/classes/org/realtors/rets/common/metadata/types/MValidationLookup.class deleted file mode 100644 index 9662bd0..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MValidationLookup.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/metadata/types/MValidationLookupType.class b/target/classes/org/realtors/rets/common/metadata/types/MValidationLookupType.class deleted file mode 100644 index 8327983..0000000 Binary files a/target/classes/org/realtors/rets/common/metadata/types/MValidationLookupType.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/util/CaseInsensitiveComparator.class b/target/classes/org/realtors/rets/common/util/CaseInsensitiveComparator.class deleted file mode 100644 index cc0050b..0000000 Binary files a/target/classes/org/realtors/rets/common/util/CaseInsensitiveComparator.class and /dev/null differ diff --git a/target/classes/org/realtors/rets/common/util/CaseInsensitiveTreeMap.class b/target/classes/org/realtors/rets/common/util/CaseInsensitiveTreeMap.class deleted file mode 100644 index 20e1dfd..0000000 Binary files a/target/classes/org/realtors/rets/common/util/CaseInsensitiveTreeMap.class and /dev/null differ diff --git a/target/filtered-sources/java/org/realtors/rets/client/BrokerCodeRequredException.java b/target/filtered-sources/java/org/realtors/rets/client/BrokerCodeRequredException.java deleted file mode 100644 index 448b26c..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/BrokerCodeRequredException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.client; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * dbt is lame and hasn't overridden the default - * javadoc string. - */ -public class BrokerCodeRequredException extends RetsException { - private final List mCodeList; - - public BrokerCodeRequredException(Collection codes) { - this.mCodeList = Collections.unmodifiableList(new ArrayList(codes)); - } - - public List getCodeList(){ - return this.mCodeList; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/CapabilityUrls.java b/target/filtered-sources/java/org/realtors/rets/client/CapabilityUrls.java deleted file mode 100644 index 083821c..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/CapabilityUrls.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.realtors.rets.client; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class CapabilityUrls { - public static final String ACTION_URL = "Action"; - public static final String CHANGE_PASSWORD_URL = "ChangePassword"; - public static final String GET_OBJECT_URL = "GetObject"; - public static final String LOGIN_URL = "Login"; - public static final String LOGIN_COMPLETE_URL = "LoginComplete"; - public static final String LOGOUT_URL = "Logout"; - public static final String SEARCH_URL = "Search"; - public static final String GET_METADATA_URL = "GetMetadata"; - public static final String UPDATE_URL = "Update"; - 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 URL mUrl; - - public CapabilityUrls() { - this(null); - } - - public CapabilityUrls(URL baseurl) { - this.mUrl = baseurl; - this.mCapabilityUrls = new HashMap(); - } - - public void setCapabilityUrl(String capability, String url) { - if (this.mUrl != null) { - try { - String newurl = new URL(this.mUrl, url).toString(); - if (!newurl.equals(url)) { - LOG.info("qualified " + capability + " URL different: " - + url + " -> " + newurl); - url = newurl; - } - - } catch (MalformedURLException e) { - LOG.warn("Couldn't normalize URL", e); - } - } - this.mCapabilityUrls.put(capability, url); - - } - - public String getCapabilityUrl(String capability) { - return (String) this.mCapabilityUrls.get(capability); - } - - public void setActionUrl(String url) { - setCapabilityUrl(ACTION_URL, url); - } - - public String getActionUrl() { - return getCapabilityUrl(ACTION_URL); - } - - public void setChangePasswordUrl(String url) { - setCapabilityUrl(CHANGE_PASSWORD_URL, url); - } - - public String getChangePasswordUrl() { - return getCapabilityUrl(CHANGE_PASSWORD_URL); - } - - public void setGetObjectUrl(String url) { - setCapabilityUrl(GET_OBJECT_URL, url); - } - - public String getGetObjectUrl() { - return getCapabilityUrl(GET_OBJECT_URL); - } - - public void setLoginUrl(String url) { - if (this.mUrl == null) { - try { - this.mUrl = new URL(url); - } catch (MalformedURLException e) { - LOG.debug("java.net.URL can't parse login url: " + url); - this.mUrl = null; - } - } - setCapabilityUrl(LOGIN_URL, url); - } - - public String getLoginUrl() { - return getCapabilityUrl(LOGIN_URL); - } - - public void setLoginCompleteUrl(String url) { - setCapabilityUrl(LOGIN_COMPLETE_URL, url); - } - - public String getLoginCompleteUrl() { - return getCapabilityUrl(LOGIN_COMPLETE_URL); - } - - public void setLogoutUrl(String url) { - setCapabilityUrl(LOGOUT_URL, url); - } - - public String getLogoutUrl() { - return getCapabilityUrl(LOGOUT_URL); - } - - public void setSearchUrl(String url) { - setCapabilityUrl(SEARCH_URL, url); - } - - public String getSearchUrl() { - return getCapabilityUrl(SEARCH_URL); - } - - public void setGetMetadataUrl(String url) { - setCapabilityUrl(GET_METADATA_URL, url); - } - - public String getGetMetadataUrl() { - return getCapabilityUrl(GET_METADATA_URL); - } - - public void setUpdateUrl(String url) { - setCapabilityUrl(UPDATE_URL, url); - } - - public String getUpdateUrl() { - return getCapabilityUrl(UPDATE_URL); - } - /** - * This is for RETS 1.7 and later and will return an empty string if it is not implemented. - * @param url - */ - public void setServerInfo(String url) { - setCapabilityUrl(SERVER_INFO_URL, url); - } - /** - * This is for RETS 1.7 and later and will return an empty string if it is not implemented. - * @return - */ - public String getServerInfo() { - return getCapabilityUrl(SERVER_INFO_URL); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/ChangePasswordRequest.java b/target/filtered-sources/java/org/realtors/rets/client/ChangePasswordRequest.java deleted file mode 100644 index 331192a..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/ChangePasswordRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.realtors.rets.client; - -import java.security.GeneralSecurityException; -import java.security.MessageDigest; -import javax.crypto.Cipher; -import javax.crypto.SecretKey; -import javax.crypto.SecretKeyFactory; -import javax.crypto.spec.DESKeySpec; - -import org.apache.commons.codec.binary.Base64; - -public class ChangePasswordRequest extends VersionInsensitiveRequest { - public ChangePasswordRequest(String username, String oldPassword, String newPassword) throws RetsException { - try { - MessageDigest md5 = MessageDigest.getInstance("MD5"); - md5.update(username.toUpperCase().getBytes()); - md5.update(oldPassword.toUpperCase().getBytes()); - byte[] digest = md5.digest(); - DESKeySpec keyspec = new DESKeySpec(digest); - SecretKey key = SecretKeyFactory.getInstance("DES").generateSecret(keyspec); - Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, key); - cipher.update(newPassword.getBytes()); - cipher.update(":".getBytes()); - cipher.update(username.getBytes()); - md5.reset(); - md5.update(cipher.doFinal()); - byte[] output = md5.digest(); - byte[] param = Base64.encodeBase64(output); - setQueryParameter("PWD", new String(param)); - } catch (GeneralSecurityException e) { - throw new RetsException(e); - } - } - - @Override - public void setUrl(CapabilityUrls urls) { - this.setUrl(urls.getChangePasswordUrl()); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/ChangePasswordResponse.java b/target/filtered-sources/java/org/realtors/rets/client/ChangePasswordResponse.java deleted file mode 100644 index 9981ba5..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/ChangePasswordResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.realtors.rets.client; - -import java.io.InputStream; - -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.input.SAXBuilder; - -/** - * dbt is lame and hasn't overridden the default - * javadoc string. - */ -public class ChangePasswordResponse { - public ChangePasswordResponse(InputStream stream) throws RetsException { - SAXBuilder builder = new SAXBuilder(); - Document document = null; - try { - document = builder.build(stream); - } catch (Exception e) { - throw new RetsException(e); - } - Element rets = document.getRootElement(); - if (!rets.getName().equals("RETS")) { - throw new RetsException("Invalid Change Password Response"); - } - - int replyCode = Integer.parseInt(rets.getAttributeValue("ReplyCode")); - if (replyCode != 0) { - InvalidReplyCodeException exception; - exception = new InvalidReplyCodeException(replyCode); - exception.setRemoteMessage(rets.getAttributeValue("ReplyText")); - throw exception; - } - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/CollectionOfCollectionsIterator.java b/target/filtered-sources/java/org/realtors/rets/client/CollectionOfCollectionsIterator.java deleted file mode 100644 index cb7240b..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/CollectionOfCollectionsIterator.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.realtors.rets.client; - -import java.util.Collection; -import java.util.Iterator; -import java.util.NoSuchElementException; - -public class CollectionOfCollectionsIterator implements Iterator { - private Iterator mOuter; - private Iterator mInner; - - public CollectionOfCollectionsIterator(Collection c) { - this.mOuter = c.iterator(); - hasNext(); - } - - public boolean hasNext() { - if( this.mInner != null && this.mInner.hasNext() ) { - return true; - } - while( this.mOuter.hasNext() ){ - this.mInner = ((Collection) this.mOuter.next()).iterator(); - if( this.mInner.hasNext() ){ - return true; - } - } - return false; - } - - public Object next() { - if ( this.hasNext() ) - return this.mInner.next(); - - throw new NoSuchElementException(); - } - - public void remove() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/CommonsHttpClient.java b/target/filtered-sources/java/org/realtors/rets/client/CommonsHttpClient.java deleted file mode 100644 index 097efb0..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/CommonsHttpClient.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.realtors.rets.client; - -import java.io.UnsupportedEncodingException; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.StatusLine; -import org.apache.http.auth.AuthScope; -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.client.params.CookiePolicy; -import org.apache.http.cookie.Cookie; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.realtors.rets.common.util.CaseInsensitiveTreeMap; - -public class CommonsHttpClient extends RetsHttpClient { - private static final int DEFAULT_TIMEOUT = 300000; - private static final String RETS_VERSION = "RETS-Version"; - private static final String RETS_SESSION_ID = "RETS-Session-ID"; - private static final String RETS_REQUEST_ID = "RETS-Request-ID"; - private static final String USER_AGENT = "User-Agent"; - private static final String RETS_UA_AUTH_HEADER = "RETS-UA-Authorization"; - private static final String ACCEPT_ENCODING = "Accept-Encoding"; - public static final String CONTENT_ENCODING = "Content-Encoding"; - public static final String DEFLATE_ENCODINGS = "gzip,deflate"; - public static final String CONTENT_TYPE = "Content-Type"; - - public static BasicHttpParams defaultParams(int timeout) { - BasicHttpParams httpClientParams = new BasicHttpParams(); - // connection to server timeouts - HttpConnectionParams.setConnectionTimeout(httpClientParams, timeout); - HttpConnectionParams.setSoTimeout(httpClientParams, timeout); - // set to rfc 2109 as it puts the ASP (IIS) cookie _FIRST_, this is critical for interealty - httpClientParams.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); - return httpClientParams; - } - public static ThreadSafeClientConnManager defaultConnectionManager(int maxConnectionsPerRoute, int maxConnectionsTotal) { - // allows for multi threaded requests from a single client - ThreadSafeClientConnManager connectionManager = new ThreadSafeClientConnManager(); - connectionManager.setDefaultMaxPerRoute(maxConnectionsPerRoute); - connectionManager.setMaxTotal(maxConnectionsTotal); - return connectionManager; - } - - private final ConcurrentHashMap defaultHeaders; - private final DefaultHttpClient httpClient; - - // method choice improvement - private final String userAgentPassword; - - public CommonsHttpClient() { - this(new DefaultHttpClient(defaultConnectionManager(Integer.MAX_VALUE, Integer.MAX_VALUE), defaultParams(DEFAULT_TIMEOUT)), null, true); - } - - public CommonsHttpClient(int timeout, String userAgentPassword, boolean gzip) { - this(new DefaultHttpClient(defaultConnectionManager(Integer.MAX_VALUE, Integer.MAX_VALUE), defaultParams(timeout)), userAgentPassword, gzip); - } - - public CommonsHttpClient(DefaultHttpClient client, String userAgentPassword, boolean gzip) { - this.defaultHeaders = new ConcurrentHashMap(); - this.userAgentPassword = userAgentPassword; - - this.httpClient = client; - // ask the server if we can use gzip - if( gzip ) this.addDefaultHeader(ACCEPT_ENCODING, DEFLATE_ENCODINGS); - } - - public DefaultHttpClient getHttpClient(){ - return this.httpClient; - } - - //----------------------method implementations - @Override - public void setUserCredentials(String userName, String password) { - UsernamePasswordCredentials creds = new UsernamePasswordCredentials(userName, password); - this.httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds); - } - @Override - public RetsHttpResponse doRequest(String httpMethod, RetsHttpRequest request) throws RetsException { - return "GET".equals(StringUtils.upperCase(httpMethod)) ? this.doGet(request) : this.doPost(request); - } - - //----------------------method implementations - public RetsHttpResponse doGet(RetsHttpRequest request) throws RetsException { - String url = request.getUrl(); - String args = request.getHttpParameters(); - if (args != null) { - url = url + "?" + args; - } - HttpGet method = new HttpGet(url); - return execute(method, request.getHeaders()); - } - - public RetsHttpResponse doPost(RetsHttpRequest request) throws RetsException { - String url = request.getUrl(); - String body = request.getHttpParameters(); - if (body == null) body = ""; // commons-httpclient 3.0 refuses to accept null entity (body) - HttpPost method = new HttpPost(url); - try { - method.setEntity(new StringEntity(body, null, null)); - } catch (UnsupportedEncodingException e) { - throw new RetsException(e); - } - //updated Content-Type, application/x-www-url-encoded no longer supported - method.setHeader("Content-Type", "application/x-www-form-urlencoded"); - return execute(method, request.getHeaders()); - } - - protected RetsHttpResponse execute(final HttpRequestBase method, Map headers) throws RetsException { - try { - // add the default headers - if (this.defaultHeaders != null) { - for (Map.Entry entry : this.defaultHeaders.entrySet()) { - method.setHeader(entry.getKey(), entry.getValue()); - } - } - // add our request headers from rets - if (headers != null) { - for (Map.Entry entry : headers.entrySet()) { - method.setHeader(entry.getKey(), entry.getValue()); - } - } - // optional ua-auth stuff here - if( this.userAgentPassword != null ){ - method.setHeader(RETS_UA_AUTH_HEADER, calculateUaAuthHeader(method,getCookies())); - } - // try to execute the request - HttpResponse response = this.httpClient.execute(method); - StatusLine status = response.getStatusLine(); - if (status.getStatusCode() != HttpStatus.SC_OK) { - throw new InvalidHttpStatusException(status); - } - return new CommonsHttpClientResponse(response, getCookies()); - } catch (Exception e) { - throw new RetsException(e); - } - } - - @Override - public synchronized void addDefaultHeader(String key, String value) { - this.defaultHeaders.put(key, value); - if( value == null ) this.defaultHeaders.remove(key); - } - - protected Map getCookies() { - Map cookieMap = new CaseInsensitiveTreeMap(); - for (Cookie cookie : this.httpClient.getCookieStore().getCookies()) { - cookieMap.put(cookie.getName(), cookie.getValue()); - } - return cookieMap; - } - - protected String calculateUaAuthHeader(HttpRequestBase method, Map cookies ) { - final String userAgent = this.getHeaderValue(method, USER_AGENT); - final String requestId = this.getHeaderValue(method, RETS_REQUEST_ID); - final String sessionId = cookies.get(RETS_SESSION_ID); - final String retsVersion = this.getHeaderValue(method, RETS_VERSION); - String secretHash = DigestUtils.md5Hex(String.format("%s:%s",userAgent,this.userAgentPassword)); - String pieces = String.format("%s:%s:%s:%s",secretHash,StringUtils.trimToEmpty(requestId),StringUtils.trimToEmpty(sessionId),retsVersion); - return String.format("Digest %s", DigestUtils.md5Hex(pieces)); - } - - protected String getHeaderValue(HttpRequestBase method, String key){ - Header requestHeader = method.getFirstHeader(key); - if( requestHeader == null ) return null; - return requestHeader.getValue(); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/CommonsHttpClientResponse.java b/target/filtered-sources/java/org/realtors/rets/client/CommonsHttpClientResponse.java deleted file mode 100644 index 6c78149..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/CommonsHttpClientResponse.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.realtors.rets.client; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.zip.GZIPInputStream; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.realtors.rets.common.util.CaseInsensitiveTreeMap; - -import com.google.common.io.Closeables; - -public class CommonsHttpClientResponse implements RetsHttpResponse { - private HttpResponse response; - private Map headers; - private Map cookies; - - public CommonsHttpClientResponse(HttpResponse response, Map cookies) { - this.response = response; - this.cookies = new CaseInsensitiveTreeMap(cookies); - - this.headers = new CaseInsensitiveTreeMap(); - for (Header header : this.response.getAllHeaders()) { - this.headers.put(header.getName(), header.getValue()); - } - } - - public int getResponseCode() { - return this.response.getStatusLine().getStatusCode(); - } - - public Map getHeaders() { - return this.headers; - } - - public String getHeader(String header) { - return this.headers.get(header); - } - - - public Map getCookies() throws RetsException { - return this.cookies; - } - - - public String getCookie(String cookie) throws RetsException { - return this.cookies.get(cookie); - } - - - public String getCharset() { - String contentType = StringUtils.trimToEmpty(this.getHeader(CommonsHttpClient.CONTENT_TYPE)).toLowerCase(); - String[] split = StringUtils.split(contentType, ";"); - if (split == null) return null; - - for (String s : split) { - String sLower = s.toLowerCase().trim(); - boolean b = sLower.startsWith("charset="); - if (b){ - return StringUtils.substringAfter(s, "charset="); - } - } - return null; - } - - /** using this mess to provide logging, gzipping and httpmethod closing */ - - public InputStream getInputStream() throws RetsException { - try { - // get our underlying stream - InputStream inputStream = this.response.getEntity().getContent(); - // gzipped aware checks - String contentEncoding = StringUtils.trimToEmpty(this.getHeader(CommonsHttpClient.CONTENT_ENCODING)).toLowerCase(); - boolean gzipped = ArrayUtils.contains(CommonsHttpClient.DEFLATE_ENCODINGS.split(","),contentEncoding); - if( gzipped ) inputStream = new GZIPInputStream(inputStream); - - final InputStream in = inputStream; - // the http method close wrapper (necessary) - return new InputStream(){ - - public int read() throws IOException { - return in.read(); - } - - public int read(byte[] b) throws IOException { - return in.read(b); - } - - public int read(byte[] b, int off, int len) throws IOException { - return in.read(b, off, len); - } - - public void close() throws IOException { - // connection release _AFTER_ the input stream has been read - try { - Closeables.close(in, true); - } catch (IOException e) { - // ignore - } - } - }; - } catch (IOException e) { - throw new RetsException(e); - } - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/CompactRowPolicy.java b/target/filtered-sources/java/org/realtors/rets/client/CompactRowPolicy.java deleted file mode 100644 index 2877fb1..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/CompactRowPolicy.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.commons.logging.LogFactory; - - -public interface CompactRowPolicy { - - /** fail fast and furiously */ - public static final CompactRowPolicy STRICT = new CompactRowPolicy(){ - - public boolean apply(int row, String[] columns, String[] values) { - if( values.length != columns.length ) - throw new IllegalArgumentException(String.format("Invalid number of result columns: got %s, expected %s",values.length, columns.length)); - return true; - }}; - - /** drop everything thats suspect */ - public static final CompactRowPolicy DROP = new CompactRowPolicy(){ - - public boolean apply(int row, String[] columns, String[] values) { - if (values.length != columns.length) { - LogFactory.getLog(CompactRowPolicy.class).warn(String.format("Row %s: Invalid number of result columns: got %s, expected ",row, values.length, columns.length)); - return false; - } - return true; - }}; - - /** fail fast on long rows */ - public static final CompactRowPolicy DEFAULT = new CompactRowPolicy(){ - - public boolean apply(int row, String[] columns, String[] values) { - if (values.length > columns.length) { - throw new IllegalArgumentException(String.format("Invalid number of result columns: got %s, expected %s",values.length, columns.length)); - } - if (values.length < columns.length) { - LogFactory.getLog(CompactRowPolicy.class).warn(String.format("Row %s: Invalid number of result columns: got %s, expected ",row, values.length, columns.length)); - } - return true; - }}; - - /** drop and log long rows, try to keep short rows */ - public static final CompactRowPolicy DROP_LONG = new CompactRowPolicy(){ - - public boolean apply(int row, String[] columns, String[] values) { - if (values.length > columns.length) { - LogFactory.getLog(CompactRowPolicy.class).warn(String.format("Row %s: Invalid number of result columns: got %s, expected ",row, values.length, columns.length)); - return false; - } - if (values.length < columns.length) { - LogFactory.getLog(CompactRowPolicy.class).warn(String.format("Row %s: Invalid number of result columns: got %s, expected ",row, values.length, columns.length)); - } - return true; - }}; - - public boolean apply(int row, String[] columns, String[] values); -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/GenericHttpRequest.java b/target/filtered-sources/java/org/realtors/rets/client/GenericHttpRequest.java deleted file mode 100644 index 9f3ec4f..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GenericHttpRequest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.realtors.rets.client; - -/** - * on the off chance you need an ad hoc request object... - */ -public class GenericHttpRequest extends VersionInsensitiveRequest { - - public GenericHttpRequest(){ - // noop - } - - public GenericHttpRequest(String url){ - this.mUrl = url; - } - - /** - * throws an exception. GenericHttpRequest can't have a - * CapabilityUrl - * @param urls the CapabilityUrls object that has nothing we can use - */ - @Override - public void setUrl(CapabilityUrls urls) { - // do nothing - return; - } - - /** - * expose the queryParameter interface to build query arguments. - * @param name the parameter name - * @param value the parameter value - */ - @Override - public void setQueryParameter(String name, String value) { - super.setQueryParameter(name, value); - } -} \ No newline at end of file diff --git a/target/filtered-sources/java/org/realtors/rets/client/GetMetadataRequest.java b/target/filtered-sources/java/org/realtors/rets/client/GetMetadataRequest.java deleted file mode 100644 index 92261dd..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GetMetadataRequest.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.commons.lang.StringUtils; - -public class GetMetadataRequest extends VersionInsensitiveRequest { - private static final int COMPACT_FORMAT = 0; - private static final int STANDARD_XML_FORMAT = 1; - public static final String KEY_TYPE = "Type"; - public static final String KEY_ID = "ID"; - public static final String KEY_FORMAT = "Format"; - public static final String FORMAT_STANDARD = "STANDARD-XML"; - public static final String FORMAT_STANDARD_PREFIX = "STANDARD-XML:"; - public static final String FORMAT_COMPACT = "COMPACT"; - - private int format; - private String standardXmlVersion; - - public GetMetadataRequest(String type, String id) throws RetsException { - this(type, new String[] { id }); - } - - public GetMetadataRequest(String type, String[] ids) throws RetsException { - assertValidIds(ids); - type = "METADATA-" + type; - if (type.equals("METADATA-SYSTEM") || type.equals("METADATA-RESOURCE")) { - assertIdZeroOrStar(ids); - } - - setQueryParameter(KEY_TYPE, type); - setQueryParameter(KEY_ID, StringUtils.join(ids, ":")); - setQueryParameter(KEY_FORMAT, FORMAT_STANDARD); - this.format = STANDARD_XML_FORMAT; - } - - @Override - public void setUrl(CapabilityUrls urls) { - setUrl(urls.getGetMetadataUrl()); - } - - private void assertValidIds(String[] ids) throws InvalidArgumentException { - if (ids.length == 0) { - throw new InvalidArgumentException("Expecting at least one ID"); - } - } - - private void assertIdZeroOrStar(String[] ids) throws InvalidArgumentException { - if (ids.length != 1) { - throw new InvalidArgumentException("Expecting 1 ID, but found, " + ids.length); - } - if (!ids[0].equals("0") && !ids[0].equals("*")) { - throw new InvalidArgumentException("Expecting ID of 0 or *, but was " + ids[0]); - } - } - - public void setCompactFormat() { - setQueryParameter(KEY_FORMAT, FORMAT_COMPACT); - this.format = COMPACT_FORMAT; - this.standardXmlVersion = null; - } - - public boolean isCompactFormat() { - return (this.format == COMPACT_FORMAT); - } - - public boolean isStandardXmlFormat() { - return (this.format == STANDARD_XML_FORMAT); - } - - public String getStandardXmlVersion() { - return this.standardXmlVersion; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/GetMetadataResponse.java b/target/filtered-sources/java/org/realtors/rets/client/GetMetadataResponse.java deleted file mode 100644 index 8876b6d..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GetMetadataResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.realtors.rets.client; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import org.apache.commons.lang.math.NumberUtils; - -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.Document; -import org.jdom.input.SAXBuilder; -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.JDomCompactBuilder; -import org.realtors.rets.common.metadata.MetadataException; -import org.realtors.rets.common.metadata.JDomStandardBuilder; - -public class GetMetadataResponse { - private MetaObject[] mMetadataObjs; - - public GetMetadataResponse(InputStream stream, boolean compact, boolean isStrict) throws RetsException { - try { - SAXBuilder builder = new SAXBuilder(); - Document document = builder.build(stream); - Element retsElement = document.getRootElement(); - if (!retsElement.getName().equals("RETS")) { - throw new RetsException("Expecting RETS"); - } - int replyCode = NumberUtils.toInt(retsElement.getAttributeValue("ReplyCode")); - if (ReplyCode.SUCCESS.equals(replyCode)) { - if (compact) { - handleCompactMetadata(document, isStrict); - } else { - handleStandardMetadata(document, isStrict); - } - } else if (ReplyCode.NO_METADATA_FOUND.equals(replyCode)) { - // No metadata is not an exceptional case - handleNoMetadataFound(retsElement); - } else { - InvalidReplyCodeException e = new InvalidReplyCodeException(replyCode); - e.setRemoteMessage(retsElement.getAttributeValue(retsElement.getAttributeValue("ReplyText"))); - throw e; - } - } catch (JDOMException e) { - throw new RetsException(e); - } catch (IOException e) { - throw new RetsException(e); - } - } - - private void handleNoMetadataFound(Element retsElement) throws RetsException { - List children = retsElement.getChildren(); - if (children.size() != 0) { - throw new RetsException("Expecting 0 children when results"); - } - this.mMetadataObjs = new MetaObject[0]; - } - - private void handleCompactMetadata(Document document, boolean isStrict) throws RetsException { - try { - JDomCompactBuilder builder = new JDomCompactBuilder(); - builder.setStrict(isStrict); - this.mMetadataObjs = builder.parse(document); - } catch (MetadataException e) { - throw new RetsException(e); - } - } - - private void handleStandardMetadata(Document document, boolean isStrict) throws RetsException { - try { - JDomStandardBuilder builder = new JDomStandardBuilder(); - builder.setStrict(isStrict); - this.mMetadataObjs = builder.parse(document); - } catch (MetadataException e) { - throw new RetsException(e); - } - } - - public MetaObject[] getMetadata() { - return this.mMetadataObjs; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/GetObjectIterator.java b/target/filtered-sources/java/org/realtors/rets/client/GetObjectIterator.java deleted file mode 100644 index 6ba02c1..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GetObjectIterator.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.realtors.rets.client; - -import java.io.Closeable; -import java.util.Iterator; -/** - * Iterator for SingleResoponseObjects - * - * @param - */ -public interface GetObjectIterator extends Closeable, Iterator{ - // noop -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/GetObjectRequest.java b/target/filtered-sources/java/org/realtors/rets/client/GetObjectRequest.java deleted file mode 100644 index dbed37b..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GetObjectRequest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.realtors.rets.client; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.Map; - -import org.apache.commons.lang.ObjectUtils; -import org.apache.commons.lang.StringUtils; - -public class GetObjectRequest extends VersionInsensitiveRequest { - public static final String KEY_RESOURCE = "Resource"; - public static final String KEY_TYPE = "Type"; - public static final String KEY_LOCATION = "Location"; - public static final String KEY_ID = "ID"; - - private final Map mMap; - - public GetObjectRequest(String resource, String type) { - this(resource, type, new String[] { "*/*" }); - } - - public GetObjectRequest(String resource, String type, String[] acceptMimeTypes) { - setQueryParameter(KEY_RESOURCE, resource); - setQueryParameter(KEY_TYPE, type); - this.mMap = new HashMap(); - setHeader("Accept", StringUtils.join(acceptMimeTypes, ", ")); - } - - @Override - public void setUrl(CapabilityUrls urls) { - setUrl(urls.getGetObjectUrl()); - } - - public void setLocationOnly(boolean flag) { - if (flag) { - setQueryParameter(KEY_LOCATION, "1"); - } else { - setQueryParameter(KEY_LOCATION, null); - } - } - - public void addObject(String resourceEntity, String id) { - if (id == null) - throw new NullPointerException("Object id should not be null. " - + "Cannot remove object already added to request."); - - Object cur = this.mMap.get(resourceEntity); - if (id.equals("*")) { - this.mMap.put(resourceEntity, id); - } else if (cur == null) { - this.mMap.put(resourceEntity, id); - } else if (cur instanceof String) { - if (ObjectUtils.equals(cur, "*")) { - return; - } - if (ObjectUtils.equals(cur, id)) { - return; - } - Set s = new HashSet(); - s.add(cur); - s.add(id); - this.mMap.put(resourceEntity, s); - } else if (cur instanceof Set) { - ((Set) cur).add(id); - } else { - /* NOTREACHED */ - throw new RuntimeException(resourceEntity + " has invalid value " + "of type " + cur.getClass().getName()); - } - setQueryParameter(KEY_ID, makeIdStr()); - } - - private String makeIdStr() { - StringBuffer id = new StringBuffer(); - Iterator iter = this.mMap.keySet().iterator(); - while (iter.hasNext()) { - String key = (String) iter.next(); - id.append(key); - Object cur = this.mMap.get(key); - if (cur instanceof String) { - id.append(":"); - id.append(cur); - } else if (cur instanceof Set) { - Iterator iter2 = ((Set) cur).iterator(); - while (iter2.hasNext()) { - String val = (String) iter2.next(); - id.append(":"); - id.append(val); - } - } else { - throw new RuntimeException(key + " has invalid value of " + "type " + cur.getClass().getName()); - } - if (iter.hasNext()) { - id.append(","); - } - } - return id.toString(); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/GetObjectResponse.java b/target/filtered-sources/java/org/realtors/rets/client/GetObjectResponse.java deleted file mode 100644 index 287fc56..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GetObjectResponse.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.realtors.rets.client; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.NoSuchElementException; - -import org.apache.commons.lang.math.NumberUtils; -import org.apache.http.HeaderElement; -import org.apache.http.NameValuePair; -import org.apache.http.message.BasicHeaderValueParser; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.realtors.rets.common.util.CaseInsensitiveTreeMap; - -public class GetObjectResponse{ - private static final int DEFAULT_BUFFER_SIZE = 8192; - - private final static GetObjectIterator EMPTY_OBJECT_RESPONSE_ITERATOR = new GetObjectIterator() { - public boolean hasNext() { - return false; - } - public SingleObjectResponse next() { - throw new NoSuchElementException(); - } - public void close() { - /* no op */ - } - public void remove() { - /* no op */ - } - }; - private final Map headers; - private final InputStream inputStream; - private final boolean isMultipart; - /** Indicate whether the response was empty */ - private boolean emptyResponse; - /** Indicate whether this GetObjectResponse is exhausted, i.e. has no objects */ - private boolean exhausted; - - public GetObjectResponse(Map headers, InputStream in) throws RetsException { - this.emptyResponse = false; - this.exhausted = false; - this.headers = new CaseInsensitiveTreeMap(headers); - this.isMultipart = getType().contains("multipart"); - this.inputStream = in; - - boolean isXml = getType().equals("text/xml"); - boolean containsContentId = headers.containsKey(SingleObjectResponse.CONTENT_ID); - // non multipart request that returns text/xml and does NOT have a Context-ID header, must only be a non-zero response code - boolean nonMultiPart_xml_withoutContentId = !this.isMultipart && isXml && !containsContentId; - // multipart request that returns text/xml can only be a non-zero response code - boolean multiPart_xml = this.isMultipart && isXml; - - if ( multiPart_xml || nonMultiPart_xml_withoutContentId ) { - int replyCode = 0; - try { - // GetObjectResponse is empty, because we have a Rets ReplyCode - this.emptyResponse = true; - SAXBuilder builder = new SAXBuilder(); - Document mDocument = builder.build(in); - Element root = mDocument.getRootElement(); - if (root.getName().equals("RETS")) { - replyCode = NumberUtils.toInt(root.getAttributeValue("ReplyCode")); - - // success - if (ReplyCode.SUCCESS.equals(replyCode)) return; - - // no object found - that's fine - if (ReplyCode.NO_OBJECT_FOUND.equals(replyCode)) return; - - throw new InvalidReplyCodeException(replyCode); - } - // no other possibilities - throw new RetsException("Malformed response [multipart="+this.isMultipart+", content-type=text/xml]. " + - "Content id did not exist in response and response was not valid rets response."); - } catch (JDOMException e) { - throw new RetsException(e); - } catch (IOException e) { - throw new RetsException(e); - } - } - } - - public String getType() { - return (String) this.headers.get("Content-Type"); - } - - public String getBoundary() { - String contentTypeValue = getType(); - HeaderElement[] contentType = BasicHeaderValueParser.parseElements(contentTypeValue, new BasicHeaderValueParser()); - if (contentType.length != 1) - throw new IllegalArgumentException("Multipart response appears to have a bad Content-Type: header value: " - + contentTypeValue); - - NameValuePair boundaryNV = contentType[0].getParameterByName("boundary"); - if (boundaryNV == null) - return null; - return unescapeBoundary(boundaryNV.getValue()); - } - - private static String unescapeBoundary(String boundaryValue) { - if (boundaryValue.startsWith("\"")) - boundaryValue = boundaryValue.substring(1); - if (boundaryValue.endsWith("\"")) - boundaryValue = boundaryValue.substring(0, boundaryValue.length() - 1); - return boundaryValue; - } - - - /** - * @return GetObjectIterator, which iterates over SingleObjectResponse - * objects. - * - * @throws RetsException - */ - public GetObjectIterator iterator() throws RetsException { - return iterator(DEFAULT_BUFFER_SIZE); - } - - /** - * @return GetObjectIterator, which iterates over SingleObjectResponse - * objects. - * - * @param bufferSize How large a buffer should be used for underlying - * streams. - * - * @throws RetsException - */ - public GetObjectIterator iterator(int bufferSize) throws RetsException { - if(this.exhausted ) - throw new RetsException("response was exhausted - cannot request iterator a second time"); - - if( this.emptyResponse ) - return (GetObjectIterator) EMPTY_OBJECT_RESPONSE_ITERATOR; - - - if( this.isMultipart ){ - try { - return GetObjectResponseIterator.createIterator(this, bufferSize); - } catch (Exception e) { - throw new RetsException("Error creating multipart GetObjectIterator", e); - } - } - // no other possibilities - return new NonMultipartGetObjectResponseIterator(this.headers, this.inputStream); - } - - public InputStream getInputStream() { - return this.inputStream; - } - -} - - -/** Used to implement GetObjectIterator for a non multipart response. */ -final class NonMultipartGetObjectResponseIterator implements GetObjectIterator { - private boolean exhausted; - private final Map headers; - private final InputStream inputStream; - - public NonMultipartGetObjectResponseIterator(Map headers, InputStream in){ - this.exhausted = false; - this.headers = headers; - this.inputStream = in; - } - - - public void close() throws IOException { - this.inputStream.close(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() { - return !this.exhausted; - } - - public SingleObjectResponse next() { - if( this.exhausted ) - throw new NoSuchElementException("stream exhausted"); - - this.exhausted = true; - return new SingleObjectResponse(this.headers, this.inputStream); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/GetObjectResponseIterator.java b/target/filtered-sources/java/org/realtors/rets/client/GetObjectResponseIterator.java deleted file mode 100644 index 7ff246f..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/GetObjectResponseIterator.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.realtors.rets.client; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.PushbackInputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.NoSuchElementException; - -import org.apache.commons.lang.StringUtils; - -public class GetObjectResponseIterator implements GetObjectIterator { - public static final char CR = '\r'; - public static final char LF = '\n'; - public static final String EOL = CR+""+LF; - public static final String BS = "--"; - - private final PushbackInputStream multipartStream; - private final String boundary; - private Boolean hasNext; - - public static GetObjectIterator createIterator(final GetObjectResponse response, int streamBufferSize) throws Exception { - String boundary = response.getBoundary(); - if (boundary != null) - return new GetObjectResponseIterator(response, boundary, streamBufferSize); - - return new GetObjectIterator() { - - public void close() throws IOException{ - response.getInputStream().close(); - } - - public boolean hasNext() { - return false; - } - - public T next() { - throw new NoSuchElementException(); - } - - public void remove() { - throw new UnsupportedOperationException(""); - } - }; - } - - private GetObjectResponseIterator(GetObjectResponse response, String boundary, int streamBufferSize) throws Exception { - this.boundary = boundary; - - BufferedInputStream input = new BufferedInputStream(response.getInputStream(), streamBufferSize); - this.multipartStream = new PushbackInputStream(input, BS.length() + this.boundary.length() + EOL.length()); - } - - - public boolean hasNext() { - if (this.hasNext != null) - return this.hasNext.booleanValue(); - - try { - this.hasNext = new Boolean(this.getHaveNext()); - return this.hasNext.booleanValue(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - - public T next() { - if (!this.hasNext()) - throw new NoSuchElementException(); - - this.hasNext = null; - try { - return getNext(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - - public void remove() { - throw new UnsupportedOperationException(); - } - - - public void close() throws IOException { - this.multipartStream.close(); - } - - private boolean getHaveNext() throws IOException { - String line = null; - while ((line = this.readLine()) != null) { - if (line.equals(BS+this.boundary)) - return true; - if (line.equals(BS+this.boundary+BS)) - return false; - } - return false; - } - - private T getNext() throws Exception { - Map headers = new HashMap(); - String header = null; - while (StringUtils.isNotEmpty(header = this.readLine())) { - int nvSeperatorIndex = header.indexOf(':'); - if (nvSeperatorIndex == -1){ - headers.put(header, ""); - } else { - String name = header.substring(0, nvSeperatorIndex); - String value = header.substring(nvSeperatorIndex + 1).trim(); - headers.put(name, value); - } - } - return (T)new SingleObjectResponse(headers, new SinglePartInputStream(this.multipartStream, BS+this.boundary)); - } - - // TODO find existing library to do this - private String readLine() throws IOException { - boolean eolReached = false; - StringBuffer line = new StringBuffer(); - int currentChar = -1; - while (!eolReached && (currentChar = this.multipartStream.read()) != -1) { - eolReached = (currentChar == CR || currentChar == LF); - if (!eolReached) - line.append((char) currentChar); - } - - if (currentChar == -1 && line.length() == 0) - return null; - - if (currentChar == CR) { - int nextChar = this.multipartStream.read(); - if (nextChar != LF) - this.multipartStream.unread(new byte[] { (byte) nextChar }); - } - - return line.toString(); - } - -} \ No newline at end of file diff --git a/target/filtered-sources/java/org/realtors/rets/client/InvalidArgumentException.java b/target/filtered-sources/java/org/realtors/rets/client/InvalidArgumentException.java deleted file mode 100644 index bf7a241..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/InvalidArgumentException.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.realtors.rets.client; - -public class InvalidArgumentException extends RetsException { - public InvalidArgumentException(String message) { - super(message); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/InvalidHttpStatusException.java b/target/filtered-sources/java/org/realtors/rets/client/InvalidHttpStatusException.java deleted file mode 100644 index aa084a7..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/InvalidHttpStatusException.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.http.StatusLine; - -public class InvalidHttpStatusException extends RetsException { - public InvalidHttpStatusException(StatusLine status) { - super("Status code (" + status.getStatusCode() + ") " + status.getReasonPhrase()); - } - public InvalidHttpStatusException(StatusLine status, String message) { - super("Status code (" + status.getStatusCode() + ") " + status.getReasonPhrase() +" '"+message+"'"); - } -} \ No newline at end of file diff --git a/target/filtered-sources/java/org/realtors/rets/client/InvalidReplyCodeException.java b/target/filtered-sources/java/org/realtors/rets/client/InvalidReplyCodeException.java deleted file mode 100644 index 8011571..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/InvalidReplyCodeException.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.commons.lang.SystemUtils; -/** - * Exception class for invalid reply codes from a Rets server - */ -public class InvalidReplyCodeException extends RetsException { - private final ReplyCode mReplyCode; - private String mMsg; - private String mReqinfo; - - public InvalidReplyCodeException(int replyCodeValue) { - this.mReplyCode = ReplyCode.fromValue(replyCodeValue); - } - - public InvalidReplyCodeException(ReplyCode replyCode) { - this.mReplyCode = replyCode; - } - - @Override - public String getMessage() { - StringBuffer sb = new StringBuffer(this.mReplyCode.toString()); - if (this.mMsg != null) { - sb.append(SystemUtils.LINE_SEPARATOR + this.mMsg); - } - if (this.mReqinfo != null) { - sb.append(SystemUtils.LINE_SEPARATOR + this.mReqinfo); - } - return sb.toString(); - } - - public int getReplyCodeValue() { - return this.mReplyCode.getValue(); - } - - public void setRemoteMessage(String msg) { - this.mMsg = msg; - } - - public void setRequestInfo(String reqinfo) { - this.mReqinfo = reqinfo; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/InvalidReplyCodeHandler.java b/target/filtered-sources/java/org/realtors/rets/client/InvalidReplyCodeHandler.java deleted file mode 100644 index 165eec5..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/InvalidReplyCodeHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.realtors.rets.client; - -public interface InvalidReplyCodeHandler { - InvalidReplyCodeHandler FAIL = new InvalidReplyCodeHandler() { - public void invalidRetsReplyCode(int replyCode) throws InvalidReplyCodeException { - throw new InvalidReplyCodeException(replyCode); - } - - public void invalidRetsStatusReplyCode(int replyCode) throws InvalidReplyCodeException { - throw new InvalidReplyCodeException(replyCode); - } - }; - - public void invalidRetsReplyCode(int replyCode) throws InvalidReplyCodeException; - - public void invalidRetsStatusReplyCode(int replyCode) throws InvalidReplyCodeException; -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/KeyValueResponse.java b/target/filtered-sources/java/org/realtors/rets/client/KeyValueResponse.java deleted file mode 100644 index 2c539b5..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/KeyValueResponse.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.realtors.rets.client; - -import java.util.List; -import java.util.StringTokenizer; -import java.io.InputStream; -import java.io.IOException; - -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.Document; -import org.jdom.input.SAXBuilder; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -abstract public class KeyValueResponse { - protected static final String CRLF = "\r\n"; - private static final Log LOG = LogFactory.getLog(KeyValueResponse.class); - - protected Document mDoc; - protected int mReplyCode; - protected boolean mStrict; - - public KeyValueResponse() { - this.mStrict = false; - } - - public void parse(InputStream stream, RetsVersion mVersion) throws RetsException { - try { - SAXBuilder builder = new SAXBuilder(); - this.mDoc = builder.build(stream); - Element retsElement = this.mDoc.getRootElement(); - if (!retsElement.getName().equals("RETS")) { - throw new RetsException("Expecting RETS"); - } - - int replyCode = NumberUtils.toInt(retsElement.getAttributeValue("ReplyCode")); - this.mReplyCode = replyCode; - if (!isValidReplyCode(replyCode)) { - throw new InvalidReplyCodeException(replyCode); - } - Element capabilityContainer; - if (RetsVersion.RETS_10.equals(mVersion)) { - capabilityContainer = retsElement; - } else { - List children = retsElement.getChildren(); - if (children.size() != 1) { - throw new RetsException("Invalid number of children: " + children.size()); - } - - capabilityContainer = (Element) children.get(0); - - if (!capabilityContainer.getName().equals("RETS-RESPONSE")) { - throw new RetsException("Expecting RETS-RESPONSE"); - } - } - this.handleRetsResponse(capabilityContainer); - } catch (JDOMException e) { - throw new RetsException(e); - } catch (IOException e) { - throw new RetsException(e); - } - } - - protected boolean isValidReplyCode(int replyCode) { - return (ReplyCode.SUCCESS.equals(replyCode)); - - } - - private void handleRetsResponse(Element retsResponse) throws RetsException { - StringTokenizer tokenizer = new StringTokenizer(retsResponse.getText(), CRLF); - while (tokenizer.hasMoreTokens()) { - String line = tokenizer.nextToken(); - String splits[] = StringUtils.split(line, "="); - String key = splits[0].trim(); - // guard against a missing value in a KeyValueResponse - String value = splits.length > 1 ? splits[1].trim() : ""; - if (LOG.isDebugEnabled()) { - LOG.debug("<" + key + "> -> <" + value + ">"); - } - this.handleKeyValue(key, value); - } - } - - protected abstract void handleKeyValue(String key, String value) throws RetsException; - - public void setStrict(boolean strict) { - this.mStrict = strict; - } - - public boolean isStrict() { - return this.mStrict; - } - - protected boolean matchKey(String key, String value) { - if (this.mStrict) - return key.equals(value); - - return key.equalsIgnoreCase(value); - } - - protected void assertStrictWarning(Log log, String message) throws RetsException { - if (this.mStrict) - throw new RetsException(message); - - log.warn(message); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/LoginRequest.java b/target/filtered-sources/java/org/realtors/rets/client/LoginRequest.java deleted file mode 100644 index b301393..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/LoginRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.realtors.rets.client; - -public class LoginRequest extends VersionInsensitiveRequest { - - @Override - public void setUrl(CapabilityUrls urls) { - setUrl(urls.getLoginUrl()); - } - - public void setBrokerCode(String code, String branch) { - if (code == null) { - setQueryParameter(KEY_BROKERCODE, null); - } else { - if (branch == null) { - setQueryParameter(KEY_BROKERCODE, code); - } else { - setQueryParameter(KEY_BROKERCODE, code + "," + branch); - } - } - } - - public static final String KEY_BROKERCODE = "BrokerCode"; -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/LoginResponse.java b/target/filtered-sources/java/org/realtors/rets/client/LoginResponse.java deleted file mode 100644 index ae746a7..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/LoginResponse.java +++ /dev/null @@ -1,197 +0,0 @@ -package org.realtors.rets.client; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashSet; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class LoginResponse extends KeyValueResponse { - private static final String BROKER_KEY = "Broker"; - private static final String MEMBER_NAME_KEY = "MemberName"; - private static final String METADATA_VER_KEY = "MetadataVersion"; - private static final String MIN_METADATA_VER_KEY = "MinMetadataVersion"; - private static final String USER_INFO_KEY = "User"; - private static final String OFFICE_LIST_KEY = "OfficeList"; - private static final String BALANCE_KEY = "Balance"; - private static final String TIMEOUT_KEY = "TimeoutSeconds"; - private static final String PWD_EXPIRE_KEY = "Expr"; - private static final String METADATA_TIMESTAMP_KEY = "MetadataTimestamp"; - private static final String MIN_METADATA_TIMESTAMP_KEY = "MinMetadataTimestamp"; - private static final Log LOG = LogFactory.getLog(LoginResponse.class); - - private String sessionId; - private String memberName; - private String userInformation; - private String broker; - private String metadataVersion; - private String minMetadataVersion; - private String metadataTimestamp; - private String minMetadataTimestamp; - private String officeList; - private String balance; - private int sessionTimeout; - private String passwordExpiration; - private CapabilityUrls capabilityUrls; - private Set brokerCodes; - - public LoginResponse(String loginUrl) { - super(); - this.brokerCodes = new HashSet(); - URL url = null; - try { - url = new URL(loginUrl); - } catch (MalformedURLException e) { - LOG.warn("Bad URL: " + loginUrl); - } - this.capabilityUrls = new CapabilityUrls(url); - } - - public LoginResponse() { - super(); - this.capabilityUrls = new CapabilityUrls(); - } - - @Override - public void parse(InputStream stream, RetsVersion version) throws RetsException { - super.parse(stream, version); - if (ReplyCode.BROKER_CODE_REQUIRED.equals(this.mReplyCode)) { - throw new BrokerCodeRequredException(this.brokerCodes); - } - } - - @Override - protected boolean isValidReplyCode(int replyCode) { - return (super.isValidReplyCode(replyCode) || ReplyCode.BROKER_CODE_REQUIRED.equals(replyCode)); - } - - @Override - protected void handleKeyValue(String key, String value) throws RetsException { - if (ReplyCode.BROKER_CODE_REQUIRED.equals(this.mReplyCode)) { - if (matchKey(key, BROKER_KEY)) { - String[] strings = StringUtils.split(value, ","); - if (strings.length > 0 && strings.length < 3) { - this.brokerCodes.add(strings); - } else { - throw new RetsException("Invalid broker/branch code: " + value); - } - } - } - - if (matchKey(key, BROKER_KEY)) { - this.broker = value; - } else if (matchKey(key, MEMBER_NAME_KEY)) { - this.memberName = value; - } else if (matchKey(key, METADATA_VER_KEY)) { - this.metadataVersion = value; - } else if (matchKey(key, MIN_METADATA_VER_KEY)) { - this.minMetadataVersion = value; - } else if (matchKey(key, METADATA_TIMESTAMP_KEY)) { - this.metadataTimestamp = value; - } else if (matchKey(key, MIN_METADATA_TIMESTAMP_KEY)) { - this.minMetadataTimestamp = value; - } else if (matchKey(key, USER_INFO_KEY)) { - this.userInformation = value; - } else if (matchKey(key, OFFICE_LIST_KEY)) { - this.officeList = value; - } else if (matchKey(key, BALANCE_KEY)) { - this.balance = value; - } else if (matchKey(key, TIMEOUT_KEY)) { - this.sessionTimeout = NumberUtils.toInt(value); - } else if (matchKey(key, PWD_EXPIRE_KEY)) { - this.passwordExpiration = value; - } else if (matchKey(key, CapabilityUrls.ACTION_URL)) { - this.capabilityUrls.setActionUrl(value); - } else if (matchKey(key, CapabilityUrls.CHANGE_PASSWORD_URL)) { - this.capabilityUrls.setChangePasswordUrl(value); - } else if (matchKey(key, CapabilityUrls.GET_OBJECT_URL)) { - this.capabilityUrls.setGetObjectUrl(value); - } else if (matchKey(key, CapabilityUrls.LOGIN_URL)) { - this.capabilityUrls.setLoginUrl(value); - } else if (matchKey(key, CapabilityUrls.LOGIN_COMPLETE_URL)) { - this.capabilityUrls.setLoginCompleteUrl(value); - } else if (matchKey(key, CapabilityUrls.LOGOUT_URL)) { - this.capabilityUrls.setLogoutUrl(value); - } else if (matchKey(key, CapabilityUrls.SEARCH_URL)) { - this.capabilityUrls.setSearchUrl(value); - } else if (matchKey(key, CapabilityUrls.GET_METADATA_URL)) { - this.capabilityUrls.setGetMetadataUrl(value); - } else if (matchKey(key, CapabilityUrls.UPDATE_URL)) { - this.capabilityUrls.setUpdateUrl(value); - }else if (matchKey(key, CapabilityUrls.SERVER_INFO_URL)) { - this.capabilityUrls.setServerInfo(value); - LOG.warn("Depreciated: " + key + " -> " + value); - } else if (matchKey(key, "Get")) { - LOG.warn("Found bad key: Get -> " + value); - // FIX ME: Should not get this - } else { - if (key.substring(0, 2).equalsIgnoreCase("X-")) { - LOG.warn("Unknown experimental key: " + key + " -> " + value); - } else { - assertStrictWarning(LOG, "Invalid login response key: " + key + " -> " + value); - } - } - } - - public String getMemberName() { - return this.memberName; - } - - public String getUserInformation() { - return this.userInformation; - } - - public String getBroker() { - return this.broker; - } - - public String getMetadataVersion() { - return this.metadataVersion; - } - - public String getMinMetadataVersion() { - return this.minMetadataVersion; - } - - public String getMetadataTimestamp() { - return this.metadataTimestamp; - } - - public String getMinMetadataTimestamp() { - return this.minMetadataTimestamp; - } - - public String getOfficeList() { - return this.officeList; - } - - public String getBalance() { - return this.balance; - } - - public int getSessionTimeout() { - return this.sessionTimeout; - } - - public String getPasswordExpiration() { - return this.passwordExpiration; - } - - public CapabilityUrls getCapabilityUrls() { - return this.capabilityUrls; - } - - public String getSessionId() { - return this.sessionId; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/LogoutRequest.java b/target/filtered-sources/java/org/realtors/rets/client/LogoutRequest.java deleted file mode 100644 index a27afa3..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/LogoutRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.realtors.rets.client; - -public class LogoutRequest extends VersionInsensitiveRequest { - - @Override - public void setUrl(CapabilityUrls urls) { - setUrl(urls.getLogoutUrl()); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/LogoutResponse.java b/target/filtered-sources/java/org/realtors/rets/client/LogoutResponse.java deleted file mode 100644 index 8f31339..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/LogoutResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class LogoutResponse extends KeyValueResponse { - private static final Log LOG = LogFactory.getLog(LogoutResponse.class); - private static final String CONNECT_TIME_KEY = "ConnectTime"; - private static final String BILLING_KEY = "Billing"; - private static final String SIGNOFF_KEY = "SignOffMessage"; - - private String seconds; - private String billingInfo; - private String logoutMessage; - - @Override - protected void handleKeyValue(String key, String value) throws RetsException { - if (matchKey(key, CONNECT_TIME_KEY)) { - this.seconds = value; - } else if (matchKey(key, BILLING_KEY)) { - this.billingInfo = value; - } else if (matchKey(key, SIGNOFF_KEY)) { - this.logoutMessage = value; - } else { - assertStrictWarning(LOG, "Invalid logout response key: " + key + " -> " + value); - } - } - - public String getSeconds() { - return this.seconds; - } - - public String getBillingInfo() { - return this.billingInfo; - } - - public String getLogoutMessage() { - return this.logoutMessage; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/MetaCollectorAdapter.java b/target/filtered-sources/java/org/realtors/rets/client/MetaCollectorAdapter.java deleted file mode 100644 index d959dca..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/MetaCollectorAdapter.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.realtors.rets.common.metadata.MetaCollector; -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public abstract class MetaCollectorAdapter implements MetaCollector { - - - public MetaObject[] getMetadata(MetadataType type, String path) { - return getSome(type, path, "0"); - } - - - public MetaObject[] getMetadataRecursive(MetadataType type, String path) { - return getSome(type, path, "*"); - } - - private MetaObject[] getSome(MetadataType type, String path, String sfx) { - boolean compact = Boolean.getBoolean("rets-client.metadata.compact"); - try { - GetMetadataRequest req; - if (path == null || path.equals("")) { - req = new GetMetadataRequest(type.name(), sfx); - } else { - String[] ppath = StringUtils.split(path, ":"); - String[] id = new String[ppath.length + 1]; - System.arraycopy(ppath, 0, id, 0, ppath.length); - id[ppath.length] = sfx; - req = new GetMetadataRequest(type.name(), id); - } - if (compact) { - req.setCompactFormat(); - } - GetMetadataResponse response; - - response = doRequest(req); - - return response.getMetadata(); - } catch (RetsException e) { - LOG.error("bad metadata request", e); - return null; - } - } - - /** - * Perform operation of turning a GetMetadataRequest into - * a GetMetadataResponse - * - * @param req Requested metadata - * @return parsed MetaObjects - * - * @throws RetsException if an error occurs - */ - protected abstract GetMetadataResponse doRequest(GetMetadataRequest req) throws RetsException; - - private static final Log LOG = LogFactory.getLog(MetaCollectorAdapter.class); -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/MetaCollectorImpl.java b/target/filtered-sources/java/org/realtors/rets/client/MetaCollectorImpl.java deleted file mode 100644 index d7465bf..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/MetaCollectorImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.client; - -public class MetaCollectorImpl extends MetaCollectorAdapter { - private final RetsTransport mTransport; - - public MetaCollectorImpl(RetsTransport transport) { - this.mTransport = transport; - } - - @Override - protected GetMetadataResponse doRequest(GetMetadataRequest req) throws RetsException { - return this.mTransport.getMetadata(req); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/NetworkEventMonitor.java b/target/filtered-sources/java/org/realtors/rets/client/NetworkEventMonitor.java deleted file mode 100644 index 3936c5c..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/NetworkEventMonitor.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.realtors.rets.client; - -/** - * A client can register a monitor for network events - */ -public interface NetworkEventMonitor -{ - /** - * inform the client app that an event has started. - * the client app can return an object, which will be passed - * to eventFinish(). - * - * @param message a message describing the event - * @return an object to be passed to eventFinish, or null - */ - public Object eventStart(String message); - /** - * Inform the client app that the previous event has completed - * - * @param o the object returned from eventStart - */ - public void eventFinish(Object o); -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/NullNetworkEventMonitor.java b/target/filtered-sources/java/org/realtors/rets/client/NullNetworkEventMonitor.java deleted file mode 100644 index 2e2ac4d..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/NullNetworkEventMonitor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.realtors.rets.client; - -public class NullNetworkEventMonitor implements NetworkEventMonitor { - - public Object eventStart(String message) { - return null; - } - - - public void eventFinish(Object o) { - //noop - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/ReplyCode.java b/target/filtered-sources/java/org/realtors/rets/client/ReplyCode.java deleted file mode 100644 index 650bbec..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/ReplyCode.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.realtors.rets.client; - -import java.util.Map; -import java.util.HashMap; - -public class ReplyCode { - // static initialization loop.... this declaration _MUST_ come before the members - private static final Map CODES = new HashMap(); - - public static final ReplyCode SUCCESS = new ReplyCode(0, "Success"); - public static final ReplyCode ZERO_BALANCE = new ReplyCode(20003, "Zero balance"); - public static final ReplyCode BROKER_CODE_REQUIRED = new ReplyCode(20012, "Broker code required"); - public static final ReplyCode BROKER_CODE_INVALID = new ReplyCode(20013, "Broker Code Invalid"); - public static final ReplyCode ADDTIONAL_LOGIN_NOT_PREMITTED = new ReplyCode(20022, "Additional login not permitted"); - public static final ReplyCode MISCELLANEOUS_LOGIN_ERROR = new ReplyCode(20036, "Miscellaneous server login error"); - public static final ReplyCode CLIENT_PASSWORD_INVALID = new ReplyCode(20037, "Client passsword invalid"); - public static final ReplyCode SERVER_TEMPORARILY_DISABLED = new ReplyCode(20050, "Server temporarily disabled"); - public static final ReplyCode UNKNOWN_QUERY_FIELD = new ReplyCode(20200, "Unknown Query Field"); - public static final ReplyCode NO_RECORDS_FOUND = new ReplyCode(20201, "No Records Found"); - public static final ReplyCode INVALID_SELECT = new ReplyCode(20202, "Invalid select"); - public static final ReplyCode MISCELLANOUS_SEARCH_ERROR = new ReplyCode(20203, "Miscellaneous search error"); - public static final ReplyCode INVALID_QUERY_SYNTAX = new ReplyCode(20206, "Invalid query syntax"); - public static final ReplyCode UNAUTHORIZED_QUERY = new ReplyCode(20207, "Unauthorized query"); - public static final ReplyCode MAXIMUM_RECORDS_EXCEEDED = new ReplyCode(20208, "Maximum records exceeded"); - public static final ReplyCode SEARCH_TIMED_OUT = new ReplyCode(20209, "Search timed out"); - public static final ReplyCode TOO_MANY_OUTSTANDING_QUERIES = new ReplyCode(20210, "Too many outstanding queries"); - public static final ReplyCode INVALID_RESOURCE_GETOBJECT = new ReplyCode(20400, "Invalid Resource"); - public static final ReplyCode INVALID_TYPE_GETOBJECT = new ReplyCode(20401, "Invalid Type"); - public static final ReplyCode INVALID_IDENTIFIER_GETOBJECT = new ReplyCode(20402, "Invalid Identifier"); - public static final ReplyCode NO_OBJECT_FOUND = new ReplyCode(20403, "No Object Found"); - public static final ReplyCode UNSUPPORTED_MIME_TYPE_GETOBJECT = new ReplyCode(20406, "Unsupported MIME Type"); - public static final ReplyCode UNAUTHORIZED_RETRIEVAL_GETOBJECT = new ReplyCode(20407, "Unauthorized Retrieval"); - public static final ReplyCode RESOURCE_UNAVAILABLE_GETOBJECT = new ReplyCode(20408, "Resource Unavailable"); - public static final ReplyCode OBJECT_UNAVAILABLE = new ReplyCode(20409, "Object Unavailable"); - public static final ReplyCode REQUEST_TOO_LARGE_GETOBJECT = new ReplyCode(20410, "Request Too Large"); - public static final ReplyCode TIMEOUT_GETOBJECT = new ReplyCode(20411, "Timeout"); - public static final ReplyCode TOO_MANY_OUTSTANDING_QUERIES_GETOBJECT = new ReplyCode(20412,"Too Many Outstanding Queries"); - public static final ReplyCode MISCELLANEOUS_ERROR_GETOBJECT = new ReplyCode(20413, "Miscellaneous Error"); - public static final ReplyCode INVALID_RESOURCE = new ReplyCode(20500, "Invalid resource"); - public static final ReplyCode INVALID_TYPE = new ReplyCode(20501, "Invalid type"); - public static final ReplyCode INVALID_IDENTIFIER = new ReplyCode(20502, "Invalid identifier"); - public static final ReplyCode NO_METADATA_FOUND = new ReplyCode(20503, "No metadata found"); - public static final ReplyCode UNSUPPORTED_MIME_TYPE = new ReplyCode(20506, "Unsupported MIME type"); - public static final ReplyCode UNAUTHORIZED_RETRIEVAL = new ReplyCode(20507, "Unauthorized retrieval"); - public static final ReplyCode RESOURCE_UNAVAILABLE = new ReplyCode(20508, "Resource unavailable"); - public static final ReplyCode METADATA_UNAVAILABLE = new ReplyCode(20509, "Metadata unavailable"); - public static final ReplyCode REQUEST_TOO_LARGE = new ReplyCode(20510, "Request too large"); - public static final ReplyCode TIMEOUT = new ReplyCode(20511, "Timeout"); - public static final ReplyCode TOO_MANY_OUSTANDING_REQUESTS = new ReplyCode(20512, "Too many outstanding requests"); - public static final ReplyCode MISCELLANEOUS_ERROR = new ReplyCode(20513, "Miscellanous error"); - public static final ReplyCode REQUESTED_DTD_UNAVAILABLE = new ReplyCode(20514, "Requested DTD unvailable"); - - private final int mValue; - private final String mMessage; - - private ReplyCode(int value, String message) { - this.mValue = value; - this.mMessage = message; - if (CODES.containsValue(new Integer(value))) - throw new IllegalArgumentException(String.format("value already used: %s ( %s ) ",value,message)); - CODES.put(new Integer(value), this); - } - - - @Override - public boolean equals(Object o) { - if (!(o instanceof ReplyCode)) { - return false; - } - - ReplyCode rhs = (ReplyCode) o; - return (this.mValue == rhs.mValue); - } - - public boolean equals(int value) { - return this.mValue == value; - } - - @Override - public String toString() { - return String.format("%s (%s)",this.mValue,this.mMessage); - } - - public int getValue() { - return this.mValue; - } - - public String getMessage() { - return this.mMessage; - } - - public static ReplyCode fromValue(int value) { - ReplyCode replyCode = CODES.get(new Integer(value)); - if (replyCode != null) - return replyCode; - - return new ReplyCode(value, "Unknown"); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/ReplyCodeHandler.java b/target/filtered-sources/java/org/realtors/rets/client/ReplyCodeHandler.java deleted file mode 100644 index 8b2b0b5..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/ReplyCodeHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.realtors.rets.client; - -/** - * @author jrayburn - */ -public interface ReplyCodeHandler { - - /** - * ReplyCodeHandler can choose to handle reply codes - * that are non-zero reply codes in its own fashion. - * - * This is intended to be used to allow the SearchResultCollector - * to choose to throw InvalidReplyCodeException if the response is - * 20201 (Empty) or 20208 (MaxRowsExceeded). - * - * @param replyCode The RETS reply code - * - * @throws InvalidReplyCodeException Thrown if reply code is - * invalid for the SearchResultCollector. - */ - public void handleReplyCode(int replyCode) throws InvalidReplyCodeException; - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsException.java b/target/filtered-sources/java/org/realtors/rets/client/RetsException.java deleted file mode 100644 index e5e2369..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.realtors.rets.client; - -import org.apache.commons.lang.exception.NestableException; - -public class RetsException extends NestableException { - public RetsException() { - super(); - } - - public RetsException(String message) { - super(message); - } - - public RetsException(String message, Throwable cause) { - super(message, cause); - } - - public RetsException(Throwable cause) { - super(cause); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsHttpClient.java b/target/filtered-sources/java/org/realtors/rets/client/RetsHttpClient.java deleted file mode 100644 index 97f7425..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsHttpClient.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.realtors.rets.client; - - -public abstract class RetsHttpClient { - - public static final String SESSION_ID_COOKIE = "RETS-Session-ID"; - public static final String LOGIN_SESSION_ID = "0"; - - public abstract void setUserCredentials(String userName, String password); - - /** - * The protocol specific implementation happens here. - */ - public abstract RetsHttpResponse doRequest(String httpMethod, RetsHttpRequest request) throws RetsException; - - /** - * Add an HTTP header that should be included by default in all requests - * - * @param name - * header name, case should be preserved - * @param value - * static header value, if null then implementation - * should not include the header in requests - */ - public abstract void addDefaultHeader(String name, String value); - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsHttpRequest.java b/target/filtered-sources/java/org/realtors/rets/client/RetsHttpRequest.java deleted file mode 100644 index 04ed651..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsHttpRequest.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.realtors.rets.client; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.realtors.rets.common.util.CaseInsensitiveTreeMap; - -/** Base Http Request object */ -public abstract class RetsHttpRequest implements Serializable { - private final Map mHeaders; - private final SortedMap mQueryParameters; - protected String mUrl; - - public RetsHttpRequest() { - this.mHeaders = new CaseInsensitiveTreeMap(); - this.mQueryParameters = new TreeMap(); - } - - public abstract void setUrl(CapabilityUrls urls); - - public void setUrl(String url) { - this.mUrl = url; - } - - public String getUrl() { - return this.mUrl; - } - - public void setHeader(String key, String value) { - this.mHeaders.put(key, value); - } - - public Map getHeaders() { - return this.mHeaders; - } - - public String getHttpParameters() { - if (this.mQueryParameters.isEmpty()) - return null; - - List params = new LinkedList(); - for(Map.Entry param : this.mQueryParameters.entrySet()){ - params.add(String.format("%s=%s",RetsUtil.urlEncode(param.getKey()),RetsUtil.urlEncode(param.getValue()))); - } - return StringUtils.join(params.iterator(),"&"); - } - - protected void setQueryParameter(String name, String value) { - if (value == null) { - this.mQueryParameters.remove(name); - } else { - this.mQueryParameters.put(name, value); - } - } - - @Override - public String toString() { - ToStringBuilder builder = new ToStringBuilder(this); - Iterator iterator = this.mQueryParameters.keySet().iterator(); - while (iterator.hasNext()) { - String s = (String) iterator.next(); - builder.append(s, this.mQueryParameters.get(s)); - } - return builder.toString(); - } - - /** - * any request with version-specific handling should deal with this. - * - * @param version - */ - public abstract void setVersion(RetsVersion version); - -} \ No newline at end of file diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsHttpResponse.java b/target/filtered-sources/java/org/realtors/rets/client/RetsHttpResponse.java deleted file mode 100644 index bf93cf8..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsHttpResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.realtors.rets.client; - -import java.util.Map; -import java.io.InputStream; - -/** - * Interface for retrieving useful header fields from a RETS HTTP response - * - * - */ - -public interface RetsHttpResponse { - public int getResponseCode() throws RetsException; - - public Map getHeaders() throws RetsException; - - public String getHeader(String hdr) throws RetsException; - - public String getCookie(String cookie) throws RetsException; - - public String getCharset() throws RetsException; - - public InputStream getInputStream() throws RetsException; - - public Map getCookies() throws RetsException; - -} \ No newline at end of file diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsSession.java b/target/filtered-sources/java/org/realtors/rets/client/RetsSession.java deleted file mode 100644 index 202b891..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsSession.java +++ /dev/null @@ -1,403 +0,0 @@ -package org.realtors.rets.client; - -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.realtors.rets.common.metadata.Metadata; -import org.realtors.rets.common.metadata.MetadataException; - -/** - * RetsSession is the core class of the rets.client package. - */ -public class RetsSession { - public static final String METADATA_TABLES = "metadata_tables.xml"; - public static final String RETS_CLIENT_VERSION = "1.5";//change default version - - private static final Log LOG = LogFactory.getLog(RetsSession.class); - private static String sUserAgent = "crt-rets-client/" + RETS_CLIENT_VERSION; - - private CapabilityUrls capabilityUrls; - private RetsHttpClient httpClient; - private RetsTransport transport; - private String sessionId; - - - /** - * Creates a new RetsSession instance. - * You must call login(user, pass) before attempting any other - * transactions. - * - * Uses a default implementation of RetsHttpClient based on - * apache commons http client. - * - * Uses the RetsVersion.RETS_DEFAULT as the RetsVersion for - * this session. - * - * Uses sAgent at the User-Agent setting for this RetsSession. - * - * @param loginUrl URL of the Login transaction. - */ - public RetsSession(String loginUrl) { - this(loginUrl, new CommonsHttpClient()); - } - - /** - * Creates a new RetsSession instance. - * You must call login(user, pass) before attempting any other - * transactions. - * - * Uses the RetsVersion.RETS_DEFAULT as the RetsVersion for - * this session. - * - * Uses sAgent at the User-Agent setting for this RetsSession. - * - * @param loginUrl URL of the Login transaction - * @param httpClient a RetsHttpClient implementation. The default - * is CommonsHttpClient. - */ - public RetsSession(String loginUrl, RetsHttpClient httpClient) { - this(loginUrl, httpClient, RetsVersion.DEFAULT); - } - - /** - * Creates a new RetsSession instance. - * You must call login(user, pass) before attempting any other - * transactions. - * - * Uses sAgent at the User-Agent setting for this RetsSession. - * - * @param loginUrl URL of the Login transaction - * @param httpClient a RetsHttpClient implementation. The default - * is CommonsHttpClient. - * @param retsVersion The RetsVersion used by this RetsSession. - */ - public RetsSession(String loginUrl, RetsHttpClient httpClient, RetsVersion retsVersion) { - this(loginUrl, httpClient, retsVersion, sUserAgent,false); - } - - /** - * Creates a new RetsSession instance. - * You must call login(user, pass) before attempting any other - * transactions. - * - * @param loginUrl URL of the Login transaction - * @param httpClient a RetsHttpClient implementation. The default - * is CommonsHttpClient. - * @param retsVersion The RetsVersion used by this RetsSession. - * @param userAgent specific User-Agent to use for this session. - */ - public RetsSession(String loginUrl, RetsHttpClient httpClient, RetsVersion retsVersion, String userAgent, boolean strict) { - this.capabilityUrls = new CapabilityUrls(); - this.capabilityUrls.setLoginUrl(loginUrl); - - this.httpClient = httpClient; - this.transport = new RetsTransport(httpClient, this.capabilityUrls, retsVersion, strict); - this.httpClient.addDefaultHeader("User-Agent", userAgent); - } - - /** - * Query the current RetsVersion being used in this session. - * - * Initially, this will be the value passed to the RetsTransport. - * However, if during auto-negotiation the RetsTransport changes - * the RetsSession, this value may change throughout the session. - * - * @return the current RetsVersion value being used by the - * RetsTransport. - */ - public RetsVersion getRetsVersion() { - return this.transport.getRetsVersion(); - } - - /** - * Get the current RETS Session ID - * - * @return the current RETS Session ID or null is the server has - * not specified one - */ - public String getSessionId() { - return this.sessionId; - } - - public void setSessionId(String sessionId) { - LOG.debug("setting Session-ID to: " + sessionId); - this.sessionId = sessionId; - } - - public void setMonitor(NetworkEventMonitor monitor) { - this.transport.setMonitor(monitor); - } - - public void setStrict(boolean strict) { - this.transport.setStrict(strict); - } - public boolean isStrict() { - return this.transport.isStrict(); - } - - /** - * Sets the default User-Agent value for RetsSessions created without - * a specified User-Agent value. - * - * @param userAgent Default User-Agent value to use for all RetsSession - * objects created in the future. - */ - public static void setUserAgent(String userAgent) { - sUserAgent = userAgent; - } - - public String getLoginUrl() { - return this.capabilityUrls.getLoginUrl(); - } - - public Metadata getIncrementalMetadata() throws RetsException { - try { - return new Metadata(new MetaCollectorImpl(this.transport)); - } catch (MetadataException e) { - throw new RetsException(e); - } - } - - /** - * Get the complete RETS metadata. - * - * @return The RETS metadata object for these credentials. - * - * @throws RetsException - */ - public Metadata getMetadata() throws RetsException { - return this.transport.getMetadata("null"); - } - /** - * Ability to download the raw metadata to a location - * @param location - * @return - * @throws RetsException - */ - public Metadata getMetadata(String location) throws RetsException { - return this.transport.getMetadata(location); - } - - /** - * Perform a low level GetMetadatRequest. To retrieve - * structured metadata, - * - * @see #getMetadata() - * - * @param req GetMetadataRequest - * @return GetMetadataResponse, containing all MetaObjects - * returned - * - * @throws RetsException if an error occurs - */ - public GetMetadataResponse getMetadata(GetMetadataRequest req) throws RetsException { - return this.transport.getMetadata(req); - } - - /** - * Fetches the action (MOTD) from the server. - * - * @exception RetsException if an error occurs - */ - private void getAction() throws RetsException { - String actionUrl = this.capabilityUrls.getActionUrl(); - if (actionUrl == null) { - LOG.warn("No Action-URL available, skipping"); - return; - } - GenericHttpRequest actionRequest = new GenericHttpRequest(actionUrl){ - @Override - public Map getHeaders() { - return null; - } - }; - RetsHttpResponse httpResponse = this.httpClient.doRequest("GET", actionRequest); - try { - httpResponse.getInputStream().close(); - } catch (Exception e) { - LOG.error("Action URL weirdness", e); - } - } - - /** - * Implementation that allow for single or multi-part - * GetObject requests. - * - * @param req - * @return - * @exception RetsException if an error occurs - */ - public GetObjectResponse getObject(GetObjectRequest req) throws RetsException { - return this.transport.getObject(req); - } - - /** - * - * @param resource - * @param type - * @param entity - * @param id - * @return response - * @exception RetsException if an error occurs - */ - public GetObjectResponse getObject(String resource, String type, String entity, String id) throws RetsException { - GetObjectRequest req = new GetObjectRequest(resource, type); - req.addObject(entity, id); - return getObject(req); - } - - /** - * Log into the RETS server (see RETS 1.5, section 4). No other - * transactions will work until you have logged in. - * - * @param userName Username to authenticate - * @param password Password to authenticate with - * @return LoginResponse if success. - * @exception RetsException if authentication was denied - */ - public LoginResponse login(String userName, String password) throws RetsException { - return login(userName, password, null, null); - } - - /** - * Log into the RETS server (see RETS 1.5, section 4). No other - * transactions will work until you have logged in. - * - * @param userName username to authenticate - * @param password password to authenticate with - * @param brokerCode broker code if the same user belongs to multiple - * brokerages. May be null. - * @param brokerBranch branch code if the same user belongs to multiple - * branches. May be null. brokerCode is required if you want - * brokerBranch to work. - * @return LoginResponse if success. - * @exception RetsException if authentication was denied - */ - - public LoginResponse login(String userName, String password, String brokerCode, String brokerBranch) throws RetsException { - this.httpClient.setUserCredentials(userName, password); - - LoginRequest request = new LoginRequest(); - request.setBrokerCode(brokerCode, brokerBranch); - - LoginResponse response = this.transport.login(request); - this.capabilityUrls = response.getCapabilityUrls(); - this.transport.setCapabilities(this.capabilityUrls); - this.setSessionId(response.getSessionId()); - this.getAction(); - - return response; - } - - /** - * Log out of the current session. Another login _may_ re-establish a new connection - * depending the the behavior of the {#link RetsHttpClient} and its' ability to - * maintain and restablish a connection. - * - * @return a LogoutResponse - * @throws RetsException if the logout transaction failed - */ - public LogoutResponse logout() throws RetsException { - try { - return this.transport.logout(); - } finally { - this.setSessionId(null); - } - } - - /** - * Will perform a search as requested and return a filled - * SearchResult object. This method caches all result information - * in memory in the SearchResult object. - * - * @param req Contains parameters on which to search. - * @return a completed SearchResult - * @exception RetsException if an error occurs - */ - public SearchResult search(SearchRequest req) throws RetsException { - SearchResultImpl res = new SearchResultImpl(); - search(req, res); - return res; - } - - /** - * Execute a RETS Search. The collector object will be filled - * when this method is returned. See RETS 1.52d, Section 5. - * - * @param req Contains parameters on which to search. - * @param collector SearchResult object which will be informed of the results - * as they come in. If you don't need live results, see the other - * search invocation. - * @exception RetsException if an error occurs - */ - public void search(SearchRequest req, SearchResultCollector collector) throws RetsException { - this.transport.search(req, collector); - } - - /** - * Search and process the Search using a given SearchResultProcessor. - * - * @param req the search request - * @param processor the result object that will process the data - */ - public SearchResultSet search(SearchRequest req, SearchResultProcessor processor) throws RetsException { - return this.transport.search(req, processor); - } - - /** - * The lowest level integration. This method is not recommened for general use. - */ - public RetsHttpResponse request(RetsHttpRequest request) throws RetsException{ - return this.transport.doRequest(request); - } - - /** - * switch to a specific HttpMethodName, POST/GET, where the - * method is supported. Where GET is not supported, POST - * will be used. - * @param method the HttpMethodName to use - */ - public void setMethod(String method) { - this.transport.setMethod(method); - } - - /** Make sure GC'd sessions are logged out. */ - @Override - protected void finalize() throws Throwable { - try { - if( this.sessionId != null ) this.logout(); - } finally { - super.finalize(); - } - } - /** - * Performs a search returning only the number of records resulting from a query. - * - * Convenience method to get number records from a query - * - * @param req the search request - * @return the number of records that returned from the search request - * @throws RetsException - */ - public int getQueryCount(SearchRequest req) throws RetsException { - req.setCountOnly(); - SearchResult res = this.search(req); - return res.getCount(); - } - - /** - * Gives the URL's of an Object request instead of object themselves - * - * Convenience method to get the URL's of the requeseted object only - * - * @param req - * @return - * @throws RetsException - */ - public GetObjectResponse getObjectUrl(GetObjectRequest req) throws RetsException { - req.setLocationOnly(true); - GetObjectResponse res = this.getObject(req); - return res; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsTransport.java b/target/filtered-sources/java/org/realtors/rets/client/RetsTransport.java deleted file mode 100644 index aea8bf9..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsTransport.java +++ /dev/null @@ -1,330 +0,0 @@ -package org.realtors.rets.client; - - -import java.io.FileWriter; -import java.util.HashMap; -import java.util.Map; -import org.jdom.Document; -import org.jdom.input.SAXBuilder; -import org.jdom.output.XMLOutputter; -import org.realtors.rets.common.metadata.JDomCompactBuilder; -import org.realtors.rets.common.metadata.JDomStandardBuilder; -import org.realtors.rets.common.metadata.Metadata; -import org.realtors.rets.common.metadata.MetadataBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Implements the basic transport mechanism. This class deals with the - * very basic parts of sending the request, returning a response object, - * and version negotiation. - * - */ -public class RetsTransport { - private static final String RETS_SESSION_ID_HEADER = "RETS-Session-ID"; // TODO spec says hyphen, Marketlinx uses an underscore - - private RetsHttpClient client; - private CapabilityUrls capabilities; - private String method = "GET"; - private RetsVersion version; - private boolean strict; - private NetworkEventMonitor monitor; - - private static final Log LOG = LogFactory.getLog(RetsTransport.class); - - private static Map MONITOR_MSGS = new HashMap(){{ - put(ChangePasswordRequest.class, "Transmitting change password request"); - put(GetObjectRequest.class, "Retrieving media object"); - put(LoginRequest.class, "Logging in"); - put(GetMetadataRequest.class, "Retrieving metadata"); - put(LogoutRequest.class, "Logging out"); - put(SearchRequest.class, "Executing search"); - }}; - - - /** - * Create a new transport instance. - * @param client An http client (make sure you call setUserCredentials - * on it before carrying out any transactions). - * @param capabilities the initial capabilities url list. This can be - * replaced with a more up to date version at any time (for example, - * post-login()) with setCapabilities() - * - * @see RetsHttpClient#setUserCredentials - */ - public RetsTransport(RetsHttpClient client, CapabilityUrls capabilities) { - this(client, capabilities, RetsVersion.DEFAULT, false); - } - - /** - * Create a new transport instance to speak a specific RETS version. - * @param client an http client - * @param capabilities the initial capabilities url list - * @param version the RETS version to use during initial negotiation - * (RetsTransport will automatically switch to whatever version the - * server supports). - */ - public RetsTransport(RetsHttpClient client, CapabilityUrls capabilities, RetsVersion version, boolean strict) { - this.client = client; - this.capabilities = capabilities; - this.doVersionHeader(version); - this.strict = strict; - this.client.addDefaultHeader("Accept", "*/*"); - this.monitor = new NullNetworkEventMonitor(); - } - - /** - * Query the current RetsVersion being used in this RetsTransport. - * - * Initially, this will be the value with which this object was - * constructed. - * - * However, this value may change after login. - * - * @return the current RetsVersion value being used by the - * RetsTransport. - */ - public RetsVersion getRetsVersion() { - return this.version; - } - - public boolean isStrict() { - return this.strict; - } - - public void setStrict(boolean strict) { - this.strict = strict; - } - - public void setMonitor(NetworkEventMonitor monitor) { - if (monitor == null) { - monitor = new NullNetworkEventMonitor(); - } - this.monitor = monitor; - } - - /** - * Set our RetsHttpClient up with the correct default RETS version to use, - * default to RETS 1.5. - * @param retsVersion - */ - private void doVersionHeader(RetsVersion retsVersion) { - if (this.client == null) - return; - if (retsVersion == null) - retsVersion = RetsVersion.DEFAULT; - this.version = retsVersion; - this.client.addDefaultHeader(RetsVersion.RETS_VERSION_HEADER, this.version.toString()); - } - - /** - * replace the capabilities url list with a new one - * @param capabilities the new capabilities url list - */ - public void setCapabilities(CapabilityUrls capabilities) { - this.capabilities = capabilities; - } - - /** - * switch to a specific HttpMethodName, POST/GET, where the - * method is supported. Where GET is not supported, POST - * will be used. - * @param method the HttpMethodName to use - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * Available as an integration last resort - */ - public RetsHttpResponse doRequest(RetsHttpRequest req) throws RetsException { - Object monitorobj = null; - String msg = getMonitorMessage(req); - monitorobj = this.monitor.eventStart(msg); - - req.setVersion(this.version); - req.setUrl(this.capabilities); - - RetsHttpResponse httpResponse; - try { - httpResponse = this.client.doRequest(this.method, req); - } finally { - this.monitor.eventFinish(monitorobj); - } - return httpResponse; - } - - private String getMonitorMessage(RetsHttpRequest req) { - String msg = (String) MONITOR_MSGS.get(req.getClass()); - if (msg == null) { - msg = "communicating with network"; - } - return msg; - } - - /** - * Logs into the server. This transaction gets a list of capability URLs - * encapsulated in the LoginResponse that should typically be given back - * to the transport object with setCapabilities(). RETS Specification, - * section 4. - * - * @param req The login request - * @return the LoginResponse object - * @throws RetsException if the login failed or something went wrong on the - * network - * @see #setCapabilities - */ - public LoginResponse login(LoginRequest req) throws RetsException { - RetsHttpResponse retsHttpResponse = this.doRequest(req); - - String versionHeader = retsHttpResponse.getHeader(RetsVersion.RETS_VERSION_HEADER); - // may be null, which is fine, return null, dont throw - RetsVersion retsVersion = RetsVersion.getVersion(versionHeader); - if( retsVersion == null && this.strict ) - throw new RetsException(String.format("RETS Version is a required response header, version '%s' is unrecognized",versionHeader)); - // skip updating the client version if its not set (correctly) by the server - if( retsVersion != null ) this.doVersionHeader(retsVersion); - - LoginResponse response = new LoginResponse(this.capabilities.getLoginUrl()); - - String sessionId = retsHttpResponse.getCookie(RETS_SESSION_ID_HEADER); - response.setSessionId(sessionId); - response.setStrict(this.strict); - response.parse(retsHttpResponse.getInputStream(), this.version); - return response; - } - - /** - * Logs out of the server. No other transactions should be called until - * another login() succeeds. RETS Specification, Section 6. Logout is - * an optional transaction. This method returns null if the server does - * not support the Logout transaction. - * - * @return LogoutResponse or null if logout is not supported - * @throws RetsException if there is a network or remote server error - */ - public LogoutResponse logout() throws RetsException { - if (this.capabilities.getLogoutUrl() == null) { - return null; - } - RetsHttpRequest req = new LogoutRequest(); - RetsHttpResponse httpResponse = doRequest(req); - LogoutResponse response = new LogoutResponse(); - response.setStrict(this.strict); - try { - response.parse(httpResponse.getInputStream(), this.version); - } catch(RetsException e) { - if (e.getMessage().contains("Invalid number of children")){// most RETS servers have issues logging out for some reason. - LOG.warn("unsual response for logout request, but log out successful."); - } - - } - return response; - } - - /** - * Perform a non-streaming search and pass all results from the - * SearchRequest to the given collector. - * - * 12/06/20 Added charset, needed for sax parser - * @param req the search request - * @param collector the result object that will store the data - */ - public void search(SearchRequest req, SearchResultCollector collector) throws RetsException { - RetsHttpResponse httpResponse = doRequest(req); - new SearchResultHandler(collector).parse(httpResponse.getInputStream(), httpResponse.getCharset()); - } - - /** - * Override processing of the search completely by providing a - * SearchResultProcessor to process the results of the Search. - * - * @param req the search request - * @param processor the result object that will process the data - */ - public SearchResultSet search(SearchRequest req, SearchResultProcessor processor) throws RetsException { - RetsHttpResponse httpResponse = doRequest(req); - return processor.parse(httpResponse.getInputStream()); - } - - /** - * - * @param req GetObject request - * @return a GetObjectResponse - * @throws RetsException if the request is not valid or a network error - * occurs - */ - public GetObjectResponse getObject(GetObjectRequest req) throws RetsException { - if (this.capabilities.getGetObjectUrl() == null) { - throw new RetsException("Server does not support GetObject transaction."); - } - req.setUrl(this.capabilities); - RetsHttpResponse httpResponse = this.client.doRequest(this.method, req); - GetObjectResponse result = new GetObjectResponse(httpResponse.getHeaders(), httpResponse.getInputStream()); - return result; - } - - public Metadata getMetadata(String location) throws RetsException { - boolean compact = Boolean.getBoolean("rets-client.metadata.compact"); - GetMetadataRequest req = new GetMetadataRequest("SYSTEM", "*"); - if (compact) { - req.setCompactFormat(); - } - try { - RetsHttpResponse httpResponse = doRequest(req); - Object monitorobj = null; - monitorobj = this.monitor.eventStart("Parsing metadata"); - try { - SAXBuilder xmlBuilder = new SAXBuilder(); - Document xmlDocument = xmlBuilder.build(httpResponse.getInputStream()); - if (!location.equals("null")){ - XMLOutputter outputter = new XMLOutputter(); - FileWriter writer = new FileWriter(location); - outputter.output(xmlDocument, writer); - outputter.outputString(xmlDocument); - } - MetadataBuilder metadataBuilder; - if (req.isCompactFormat()) { - metadataBuilder = new JDomCompactBuilder(); - } else { - metadataBuilder = new JDomStandardBuilder(); - } - metadataBuilder.setStrict(this.strict); - - - - return metadataBuilder.doBuild(xmlDocument); - } finally { - this.monitor.eventFinish(monitorobj); - } - } catch (Exception e) { - throw new RetsException(e); - } - } - - public GetMetadataResponse getMetadata(GetMetadataRequest req) throws RetsException { - RetsHttpResponse httpResponse = doRequest(req); - Object monitorobj = null; - monitorobj = this.monitor.eventStart("Parsing metadata"); - try { - try { - return new GetMetadataResponse(httpResponse.getInputStream(), req.isCompactFormat(),this.strict); - } catch (InvalidReplyCodeException e) { - e.setRequestInfo(req.toString()); - throw e; - } - } finally { - this.monitor.eventFinish(monitorobj); - } - } - - public boolean changePassword(ChangePasswordRequest req) throws RetsException { - RetsHttpResponse httpResponse = doRequest(req); - ChangePasswordResponse response = new ChangePasswordResponse(httpResponse.getInputStream()); - // response will throw an exception if there is an error code - return (response != null); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsUtil.java b/target/filtered-sources/java/org/realtors/rets/client/RetsUtil.java deleted file mode 100644 index 4e9b530..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.realtors.rets.client; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.EncoderException; -import org.apache.commons.codec.net.URLCodec; -import org.apache.commons.lang.exception.NestableRuntimeException; - -/** Random utility functions. */ -public class RetsUtil { - public static void copyStream(InputStream in, OutputStream out) throws IOException { - byte[] buf = new byte[512]; - int count; - while (true) { - count = in.read(buf); - if (count < 1) { - in.close(); - out.close(); - return; - } - while (count > 0) { - out.write(buf); - } - } - } - - public static String urlEncode(String string) { - try { - return new URLCodec().encode(string); - } catch (EncoderException e) { - throw new NestableRuntimeException(e); - } - } - - public static String urlDecode(String string) { - try { - return new URLCodec().decode(string); - } catch (DecoderException e) { - throw new NestableRuntimeException(e); - } - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/RetsVersion.java b/target/filtered-sources/java/org/realtors/rets/client/RetsVersion.java deleted file mode 100644 index 2ceab0b..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/RetsVersion.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.realtors.rets.client; - -import java.io.Serializable; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; - -public class RetsVersion implements Serializable { - public static final String RETS_VERSION_HEADER = "RETS-Version"; - - public static final RetsVersion RETS_10 = new RetsVersion(1, 0, 0, 0); - public static final RetsVersion RETS_15 = new RetsVersion(1, 5, 0, 0); - public static final RetsVersion RETS_16 = new RetsVersion(1, 6, 0, 0); - public static final RetsVersion RETS_17 = new RetsVersion(1, 7, 0, 0); - public static final RetsVersion RETS_1_7_2 = new RetsVersion(1, 7, 2, 0); - public static final RetsVersion DEFAULT = RETS_1_7_2; - - private int mMajor; - private int mMinor; - private int mRevision; - private int mDraft; - - public RetsVersion(int major, int minor) { - this(major,minor,0,0); - } - - /** @deprecated use new RetsVersion(major, minor, 0, draft) */ - @Deprecated - public RetsVersion(int major, int minor, int draft) { - this(major,minor,0,draft); - } - - public RetsVersion(int major, int minor, int revision, int draft) { - this.mMajor = major; - this.mMinor = minor; - this.mRevision = revision; - this.mDraft = draft; - } - - public int getMajor() { - return this.mMajor; - } - - public int getMinor() { - return this.mMinor; - } - - public int getRevision() { - return this.mRevision; - } - - public int getDraft() { - return this.mDraft; - } - - @Override - public String toString() { - if (this.mRevision == 0) { - if (this.mDraft == 0) { - return "RETS/" + this.mMajor + "." + this.mMinor; - } - return "RETS/" + this.mMajor + "." + this.mMinor + "d" + this.mDraft; - } - if (this.mDraft == 0) { - return "RETS/" + this.mMajor + "." + this.mMinor + "." + this.mRevision; - } - return "RETS/" + this.mMajor + "." + this.mMinor + "." + this.mRevision + "d" + this.mDraft; - } - - @Override - public boolean equals(Object o) { - if (o instanceof RetsVersion) { - RetsVersion v = (RetsVersion) o; - if ((v.getMajor() == this.mMajor) && (v.getMinor() == this.mMinor) && (v.getRevision() == this.mRevision) && (v.getDraft() == this.mDraft)) { - return true; - } - } - return false; - } - - public static RetsVersion getVersion(String ver) { - if( StringUtils.isEmpty(ver) ) return null; - String[] split = StringUtils.trimToEmpty(ver).split("\\."); - int ma = NumberUtils.toInt(split[0],1); - int mn = split.length > 1 ? NumberUtils.toInt(split[1],0) : 0; - int re = 0; - int dr = 0; - if (split.length > 2) { - split = StringUtils.defaultString(split[2]).split("d"); - re = NumberUtils.toInt(split[0],0); - dr = split.length > 1 ? NumberUtils.toInt(split[1],0) : 0; - } - return new RetsVersion(ma,mn,re,dr); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchRequest.java b/target/filtered-sources/java/org/realtors/rets/client/SearchRequest.java deleted file mode 100644 index b5b4c4f..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchRequest.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.realtors.rets.client; - -/** - * - * The search request sent from search() in RetsSession - * - */ - -public class SearchRequest extends RetsHttpRequest { - - public static final int COUNT_NONE = 1; - public static final int COUNT_FIRST = 2; - public static final int COUNT_ONLY = 3; - public static final String FORMAT_STANDARD_XML = "STANDARD-XML"; - public static final String FORMAT_COMPACT = "COMPACT"; - public static final String FORMAT_COMPACT_DECODED = "COMPACT-DECODED"; - public static final String RETS_DMQL1 = "DMQL"; - public static final String RETS_DMQL2 = "DMQL2"; - public static final String KEY_TYPE = "SearchType"; - public static final String KEY_CLASS = "Class"; - public static final String KEY_DMQLVERSION = "QueryType"; - public static final String KEY_QUERY = "Query"; - public static final String KEY_COUNT = "Count"; - public static final String KEY_FORMAT = "Format"; - public static final String KEY_LIMIT = "Limit"; - public static final String KEY_OFFSET = "Offset"; - public static final String KEY_SELECT = "Select"; - public static final String KEY_RESTRICTEDINDICATOR = "RestrictedIndicator"; - public static final String KEY_STANDARDNAMES = "StandardNames"; - - - private String type; - - public SearchRequest(String stype, String sclass, String query) { - setQueryParameter(KEY_TYPE, stype); - this.type = stype; - setQueryParameter(KEY_CLASS, sclass); - setQueryParameter(KEY_QUERY, query); - setQueryParameter(KEY_FORMAT, FORMAT_COMPACT); - setQueryParameter(KEY_DMQLVERSION, RETS_DMQL2); - } - - - @Override - public void setUrl(CapabilityUrls urls) { - setUrl(urls.getSearchUrl()); - } - - public String getType() { - return this.type; - } - - public void setCountNone() { - setQueryParameter(KEY_COUNT, null); - } - - public void setCountFirst() { - setQueryParameter(KEY_COUNT, "1"); - } - - public void setCountOnly() { - setQueryParameter(KEY_COUNT, "2"); - } - - public void setFormatCompact() { - setQueryParameter(KEY_FORMAT, FORMAT_COMPACT); - } - - public void setFormatCompactDecoded() { - setQueryParameter(KEY_FORMAT, FORMAT_COMPACT_DECODED); - } - - public void setFormatStandardXml() { - setQueryParameter(KEY_FORMAT, FORMAT_STANDARD_XML); - } - - public void setFormatStandardXml(String dtdVersion) { - setQueryParameter(KEY_FORMAT, FORMAT_STANDARD_XML + ":" + dtdVersion); - } - - public void setLimit(int count) { - setQueryParameter(KEY_LIMIT, Integer.toString(count)); - } - - public void setLimitNone() { - setQueryParameter(KEY_LIMIT, null); - } - - public void setSelect(String sel) { - setQueryParameter(KEY_SELECT, sel); - } - - public void setRestrictedIndicator(String rest) { - setQueryParameter(KEY_RESTRICTEDINDICATOR, rest); - } - - public void setStandardNames() { - setQueryParameter(KEY_STANDARDNAMES, "1"); - } - - public void setSystemNames() { - setQueryParameter(KEY_STANDARDNAMES, null); - } - - public void setOffset(int offset) { - setQueryParameter(KEY_OFFSET, Integer.toString(offset)); - } - - public void setOffsetNone() { - setQueryParameter(KEY_OFFSET, null); - } - - /** TODO should the search automatically handle this??? shouldn't this be setable by vendor is that predicatable? */ - @Override - public void setVersion(RetsVersion ver) { - if (RetsVersion.RETS_10.equals(ver)) { - setQueryParameter(KEY_DMQLVERSION, RETS_DMQL1); - } else { - setQueryParameter(KEY_DMQLVERSION, RETS_DMQL2); - } - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResult.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResult.java deleted file mode 100644 index e590778..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResult.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.realtors.rets.client; - -import java.util.NoSuchElementException; -import java.util.Iterator; - -/** - * Interface for retrieving additional information from of a result from a RETS query/search - * - */ - -public interface SearchResult extends SearchResultInfo { - public String[] getRow(int idx) throws NoSuchElementException; - - public Iterator iterator(); - - public String[] getColumns(); - - public boolean isMaxrows(); - - public int getCount(); - - public boolean isComplete(); -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResultCollector.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResultCollector.java deleted file mode 100644 index 6d3a8a2..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResultCollector.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.realtors.rets.client; - -/** - * Interface for a setting properties of a result from a query (used by SearchResultHandler) - */ - -public interface SearchResultCollector { - - public void setCount(int count); - - public void setColumns(String[] columns); - - public boolean addRow(String[] row); - - public void setMaxrows(); - - public void setComplete(); -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResultHandler.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResultHandler.java deleted file mode 100644 index cd9a49d..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResultHandler.java +++ /dev/null @@ -1,280 +0,0 @@ -package org.realtors.rets.client; - -import java.io.IOException; -import java.io.InputStream; -import java.util.LinkedList; -import java.util.List; -import java.util.StringTokenizer; - -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -/** - * - * Handles XML parsing from response setting the proper fields using a SearchResultCollector - * - */ -public class SearchResultHandler implements ContentHandler, ErrorHandler{ - private static final Log LOG = LogFactory.getLog(SearchResultHandler.class); - private static SAXParserFactory FACTORY = SAXParserFactory.newInstance(); - - private int dataCount; - private SearchResultCollector collector; - private StringBuffer currentEntry; - private String delimiter; - private Locator locator; - private String[] columns; - private InvalidReplyCodeHandler invalidReplyCodeHandler; - private CompactRowPolicy compactRowPolicy; - - public SearchResultHandler(SearchResultCollector r) { - this(r, InvalidReplyCodeHandler.FAIL, CompactRowPolicy.DEFAULT); - } - - public SearchResultHandler(SearchResultCollector r, InvalidReplyCodeHandler invalidReplyCodeHandler, CompactRowPolicy badRowPolicy) { - this.compactRowPolicy = badRowPolicy; - if (r == null) - throw new NullPointerException("SearchResultCollector must not be null"); - - if (invalidReplyCodeHandler == null) - throw new NullPointerException("InvalidReplyCodeHandler must not be null"); - - if (badRowPolicy == null) - throw new NullPointerException("BadRowPolicy must not be null"); - - this.collector = r; - this.dataCount = 0; - this.invalidReplyCodeHandler = invalidReplyCodeHandler; - } - - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - String name = localName; - if (localName.equals("")) { - name = qName; - } - if (name.equals("RETS") || name.equals("RETS-STATUS")) { - String rawrepcode = atts.getValue("ReplyCode"); - try { - int repcode = Integer.parseInt(rawrepcode); - if (repcode > 0) { - try { - if (ReplyCode.MAXIMUM_RECORDS_EXCEEDED.equals(repcode)) - return; - - if (ReplyCode.NO_RECORDS_FOUND.equals(repcode)) - return; - - if (name.equals("RETS")) - this.invalidReplyCodeHandler.invalidRetsReplyCode(repcode); - else - this.invalidReplyCodeHandler.invalidRetsStatusReplyCode(repcode); - } catch (InvalidReplyCodeException e) { - String text = atts.getValue("", "ReplyText"); - e.setRemoteMessage(text); - throw new SAXException(e); - } - } - } catch (NumberFormatException e) { - throw new SAXParseException("Invalid ReplyCode '" + rawrepcode + "'", this.locator); - } - return; - } - if (name == "COUNT") { - String s = atts.getValue("Records"); - if (s == null) { - s = atts.getValue("", "Records"); - if (s == null) { - throw new SAXParseException("COUNT tag has no Records " + "attribute", this.locator); - } - } - int i = Integer.parseInt(s, 10); - this.collector.setCount(i); - return; - } - if (name == "DELIMITER") { - String s = atts.getValue("value"); - if (s == null) { - s = atts.getValue("", "value"); - if (s == null) { - throw new RuntimeException("Invalid Delimiter"); - } - } - int i = Integer.parseInt(s, 16); - this.delimiter = "" + (char) i; - return; - } - if (name == "COLUMNS" || name == "DATA") { - this.currentEntry = new StringBuffer(); - return; - } - if (name == "MAXROWS") { - this.collector.setMaxrows(); - return; - } - // Unknown tag. danger, will. - LOG.warn("Unknown tag: " + name + ", qName = " + qName); - - } - - public void characters(char[] ch, int start, int length) { - if (this.currentEntry != null) { - this.currentEntry.append(ch, start, length); - } - } - - public void ignorableWhitespace(char[] ch, int start, int length) { - // we ignore NOZINK! - characters(ch, start, length); - } - - /** do NOT use string.split() unless your prepared to deal with loss due to token boundary conditions */ - private String[] split(String input) throws SAXParseException { - if (this.delimiter == null) { - throw new SAXParseException("Invalid compact format - DELIMITER not specified", this.locator); - } - if( !input.startsWith(this.delimiter) ){ - throw new SAXParseException("Invalid compact format", this.locator); - } - StringTokenizer tkn = new StringTokenizer(input, this.delimiter, true); - List list = new LinkedList(); - tkn.nextToken(); // junk the first element - String last = null; - while (tkn.hasMoreTokens()) { - String next = tkn.nextToken(); - if (next.equals(this.delimiter)) { - if (last == null) { - list.add(""); - } else { - last = null; - } - } else { - list.add(next); - last = next; - } - } - return (String[]) list.toArray(new String[0]); - } - - public void endElement(String uri, String localName, String qName) throws SAXParseException { - String name = localName; - if (name.equals("")) { - name = qName; - } - if (name.equals("COLUMNS") || name.equals("DATA")) { - String[] contents = split(this.currentEntry.toString()); - if (name.equals("COLUMNS")) { - this.collector.setColumns(contents); - this.columns = contents; - } else { - if( this.compactRowPolicy.apply(this.dataCount, this.columns, contents) ) { - this.dataCount++; - this.collector.addRow(contents); - } - } - this.currentEntry = null; - } - } - - public void startDocument() { - LOG.info("Start document"); - } - - public void endDocument() { - LOG.info("Document ended"); - this.collector.setComplete(); - } - - public void startPrefixMapping(String prefix, String uri) throws SAXException { - // LOG.debug("prefix mapping: " + prefix); - } - - public void endPrefixMapping(String prefix) throws SAXException { - // LOG.debug("prefix mapping: " + prefix); - } - - public void processingInstruction(String target, String data) throws SAXException { - throw new SAXException("processing instructions not supported: " + "target=" + target + ", data=" + data); - } - - public void skippedEntity(String name) throws SAXException { - throw new SAXException("skipped entities not supported: name=" + name); - } - - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - public void error(SAXParseException e) throws SAXException { - throw e; - } - - public void fatalError(SAXParseException e) throws SAXException { - throw e; - } - - public void warning(SAXParseException e) { - LOG.warn("an error occured while parsing. Attempting to continue", e); - } - - - - public void parse(InputSource src) throws RetsException { - parse(src, null); - } - /** - * - * created in order to pass the charset to the parser for proper encoding - * @param str - * @param charset - * @throws RetsException - */ - - public void parse(InputStream str, String charset) throws RetsException { - parse(new InputSource(str), charset); - try { - str.close(); - } catch (IOException e) { - throw new RetsException(e); - } - } - /** - * Pareses given source with the given charset - * - * @param src - * @throws RetsException - */ - public void parse(InputSource src, String charset) throws RetsException { - String encoding = src.getEncoding(); - if (encoding == null && (charset != null)){ - encoding = charset; - LOG.warn("Charset from headers:" + charset + ". Setting as correct encoding for parsing"); - src.setEncoding(encoding); - } - try { - SAXParser p = FACTORY.newSAXParser(); - XMLReader r = p.getXMLReader(); - r.setContentHandler(this); - r.setErrorHandler(this); - r.parse(src); - } catch (SAXException se) { - if (se.getException() != null && se.getException() instanceof RetsException) { - throw (RetsException) se.getException(); - } - throw new RetsException(se); - } catch (Exception e) { - LOG.error("An exception occured", e); - throw new RetsException(e); - - } - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResultImpl.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResultImpl.java deleted file mode 100644 index 8d15182..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResultImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.realtors.rets.client; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -import org.apache.commons.logging.LogFactory; -/** - * Concrete Implementation of SearchResult interface - * - */ -public class SearchResultImpl implements SearchResult, SearchResultCollector { - - private String[] columnNames; - private int count; - private List rows; - private boolean maxRows; - private boolean complete; - - public SearchResultImpl() { - this.count = 0; - this.rows = new ArrayList(); - this.maxRows = false; - this.complete = false; - } - - public void setCount(int count) { - this.count = count; - } - - public int getCount() { - if (this.count > 0) { - return this.count; - } - return this.rows.size(); - } - - public int getRowCount() { - return this.rows.size(); - } - - public void setColumns(String[] columns) { - this.columnNames = columns; - } - - public String[] getColumns() { - return this.columnNames; - } - - public boolean addRow(String[] row) { - if (row.length > this.columnNames.length) { - throw new IllegalArgumentException(String.format("Invalid number of result columns: got %s, expected %s",row.length, this.columnNames.length)); - } - if (row.length < this.columnNames.length) { - LogFactory.getLog(SearchResultCollector.class).warn(String.format("Row %s: Invalid number of result columns: got %s, expected ",this.rows.size(), row.length, this.columnNames.length)); - } - return this.rows.add(row); - } - - public String[] getRow(int idx) { - if (idx >= this.rows.size()) { - throw new NoSuchElementException(); - } - return this.rows.get(idx); - } - - public Iterator iterator() { - return this.rows.iterator(); - } - - public void setMaxrows() { - this.maxRows = true; - } - - public boolean isMaxrows() { - return this.maxRows; - } - - public void setComplete() { - this.complete = true; - } - - public boolean isComplete() { - return this.complete; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResultInfo.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResultInfo.java deleted file mode 100644 index d663cab..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResultInfo.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.realtors.rets.client; - -/** - * Interface that describes high level information - * about the results of a search. - * @author jrayburn - */ -public interface SearchResultInfo { - public int getCount() throws RetsException; - - public String[] getColumns() throws RetsException; - - /** @throws IllegalStateException */ - public boolean isMaxrows() throws RetsException, IllegalStateException; - - /** - * Indicates that processing of this search - * is complete. - * - * @return true if this SearchResultSet is finished processing. - * @throws RetsException Thrown if there is an error - * processing the SearchResultSet. - */ - public boolean isComplete() throws RetsException; -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResultProcessor.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResultProcessor.java deleted file mode 100644 index 4fbd477..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResultProcessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.realtors.rets.client; - -import java.io.InputStream; -import java.io.Reader; - -/** - * Interface for parsing results from a RETS query/search - */ -public interface SearchResultProcessor { - public SearchResultSet parse(InputStream in) throws RetsException; - - public SearchResultSet parse(Reader in) throws RetsException; -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SearchResultSet.java b/target/filtered-sources/java/org/realtors/rets/client/SearchResultSet.java deleted file mode 100644 index 3d96648..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SearchResultSet.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.realtors.rets.client; - -/** - * Iterator style interface for processing the results - * of a RETS search a single time. Information about the - * search can be retrieved once processing is complete by - * calling the getInfo() method. - * - * @author jrayburn - */ -public interface SearchResultSet extends SearchResultInfo { - public String[] next() throws RetsException; - - public boolean hasNext() throws RetsException; -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SingleObjectResponse.java b/target/filtered-sources/java/org/realtors/rets/client/SingleObjectResponse.java deleted file mode 100644 index 9a77972..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SingleObjectResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.realtors.rets.client; - -import java.io.InputStream; -import java.util.Map; - -import org.realtors.rets.common.util.CaseInsensitiveTreeMap; - -/** - * Representation of a single object returned - * from a RETS server. - * - * @author jrayburn - */ -public class SingleObjectResponse { - - public static final String CONTENT_TYPE = "Content-Type"; - public static final String LOCATION = "Location"; - public static final String CONTENT_DESCRIPTION = "Content-Description"; - public static final String OBJECT_ID = "Object-ID"; - public static final String CONTENT_ID = "Content-ID"; - - private Map headers; - private InputStream inputStream; - - public SingleObjectResponse(Map headers, InputStream in) { - this.headers = new CaseInsensitiveTreeMap(headers); - this.inputStream = in; - } - - public String getType() { - return (String) this.headers.get(CONTENT_TYPE); - } - - public String getContentID() { - return (String) this.headers.get(CONTENT_ID); - } - - public String getObjectID() { - return (String) this.headers.get(OBJECT_ID); - } - - public String getDescription() { - return (String) this.headers.get(CONTENT_DESCRIPTION); - } - - public String getLocation() { - return (String) this.headers.get(LOCATION); - } - - public InputStream getInputStream() { - return this.inputStream; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/SinglePartInputStream.java b/target/filtered-sources/java/org/realtors/rets/client/SinglePartInputStream.java deleted file mode 100644 index 0612b0c..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/SinglePartInputStream.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.realtors.rets.client; - -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.PushbackInputStream; - -class SinglePartInputStream extends FilterInputStream { - private static final int EOS = -1; - - private final String boundary; - private boolean eos; - - - SinglePartInputStream(PushbackInputStream partInput, String boundary) { - super(partInput); - this.boundary = boundary; - } - - @Override - public int read() throws IOException { - int read = this.getPushBackStream().read(); - // was this the start of a boundary? - if( read != '\r' && read != '\n' ) return read; - this.getPushBackStream().unread(read); - byte[] peek = new byte[ "\r\n".length() + this.boundary.length()]; - // if so, check and see if the rest of the boundary is next - int peekRead = this.getPushBackStream().read(peek); - this.getPushBackStream().unread(peek, 0, peekRead); - if( new String(peek).contains(this.boundary) ) return EOS; - // if not, just a coincidence, just return the byte - return this.getPushBackStream().read(); - } - - @Override - public int read(byte[] b, int off, int len) throws IOException { - if(this.eos) return EOS; - - int read = off; - for( ; read < off + len; read++) { - int nextByte = this.read(); - if(nextByte == EOS) { - this.eos = true; - break; - } - - b[read] = (byte) nextByte; - } - return ( read - off ); - } - - @Override - public int read(byte[] b) throws IOException { - return this.read(b, 0, b.length); - } - - @Override - public void close() { - // noop - part of a larger stream - } - - private PushbackInputStream getPushBackStream() { - return (PushbackInputStream) this.in; - } -} \ No newline at end of file diff --git a/target/filtered-sources/java/org/realtors/rets/client/StreamingSearchResultProcessor.java b/target/filtered-sources/java/org/realtors/rets/client/StreamingSearchResultProcessor.java deleted file mode 100644 index cd2c4e7..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/StreamingSearchResultProcessor.java +++ /dev/null @@ -1,325 +0,0 @@ -package org.realtors.rets.client; - -import java.io.InputStream; -import java.io.Reader; -import java.util.LinkedList; - -import org.apache.commons.lang.exception.NestableRuntimeException; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.InputSource; - -/** - * SearchResultProcessor that returns a streaming SearchResult implementation. - * - * @author jrayburn - */ -public class StreamingSearchResultProcessor implements SearchResultProcessor { - private final int mBufferSize; - private final int mTimeout; - private InvalidReplyCodeHandler mInvalidReplyCodeHandler; - private CompactRowPolicy mCompactRowPolicy; - - /** - * Construct a StreamingSearchResultProcessor. - * - * Waits indefinitely for buffer to be read from by - * client. - * - * @param bufferSize - * How many rows to buffer - */ - public StreamingSearchResultProcessor(int bufferSize) { - this(bufferSize, 0); - } - - /** - * Construct a StreamingSearchResultProcessor. - * - * Waits timeout milliseconds for buffer to - * be read from by client. - * - * @param bufferSize - * How many rows to buffer - * - * @param timeout - * How long to wait, in milliseconds, for the buffer - * to be read from when full. 0 indicates an indefinite - * wait. - */ - public StreamingSearchResultProcessor(int bufferSize, int timeout) { - super(); - this.mBufferSize = bufferSize; - this.mTimeout = timeout; - } - - /** how to deal with badly delimited data */ - public void setCompactRowPolicy(CompactRowPolicy badRowPolicy) { - this.mCompactRowPolicy = badRowPolicy; - } - - private CompactRowPolicy getCompactRowPolicy() { - if (this.mCompactRowPolicy == null) - return CompactRowPolicy.DEFAULT; - return this.mCompactRowPolicy; - } - - public void setInvalidRelyCodeHandler(InvalidReplyCodeHandler invalidReplyCodeHandler) { - this.mInvalidReplyCodeHandler = invalidReplyCodeHandler; - } - - private InvalidReplyCodeHandler getInvalidRelyCodeHandler() { - if (this.mInvalidReplyCodeHandler == null) - return InvalidReplyCodeHandler.FAIL; - return this.mInvalidReplyCodeHandler; - } - - public SearchResultSet parse(InputStream reader) { - return parse(new InputSource(reader)); - } - - public SearchResultSet parse(Reader reader) { - return parse(new InputSource(reader)); - } - - public SearchResultSet parse(InputSource source) { - StreamingSearchResult result = new StreamingSearchResult(this.mBufferSize, this.mTimeout); - StreamingThread thread = new StreamingThread(source, result, this.getInvalidRelyCodeHandler(), this.getCompactRowPolicy()); - thread.start(); - return result; - } - -} - -class StreamingThread extends Thread { - private StreamingSearchResult mResult; - private InputSource mSource; - private InvalidReplyCodeHandler mInvalidReplyCodeHandler; - private CompactRowPolicy badRowPolicy; - - public StreamingThread(InputSource source, StreamingSearchResult result,InvalidReplyCodeHandler invalidReplyCodeHandler, CompactRowPolicy badRowPolicy) { - this.mSource = source; - this.mResult = result; - this.mInvalidReplyCodeHandler = invalidReplyCodeHandler; - this.badRowPolicy = badRowPolicy; - } - - @Override - public void run() { - SearchResultHandler handler = new SearchResultHandler(this.mResult, this.mInvalidReplyCodeHandler, this.badRowPolicy); - try { - handler.parse(this.mSource); - } catch (RetsException e) { - this.mResult.setException(e); - } catch (Exception e) { - // socket timeouts, etc while obtaining xml bytes from InputSource ... - this.mResult.setException(new RetsException("Low level exception while attempting to parse input from source.", e)); - } - } - -} - -class StreamingSearchResult implements SearchResultSet, SearchResultCollector { - - private static final int PREPROCESS = 0; - private static final int BUFFER_AVAILABLE = 1; - private static final int BUFFER_FULL = 2; - private static final int COMPLETE = 3; - - private final int timeout; - private final int bufferSize; - private final LinkedList buffer; - - private boolean mMaxrows; - private int state; - private String[] columns; - private int count; - private RetsException exception; - - public StreamingSearchResult(int bufferSize, int timeout) { - if (bufferSize < 1) - throw new IllegalArgumentException("[bufferSize=" + bufferSize + "] must be greater than zero"); - if (timeout < 0) - throw new IllegalArgumentException("[timeout=" + timeout + "] must be greater than or equal to zero"); - - this.bufferSize = bufferSize; - this.timeout = timeout; - this.state = PREPROCESS; - this.buffer = new LinkedList(); - this.count = -1; - this.columns = null; - this.exception = null; - } - - // ------------ Producer Methods - - public synchronized boolean addRow(String[] row) { - if (row.length > this.columns.length) { - throw new IllegalArgumentException(String.format("Invalid number of result columns: got %s, expected %s",row.length, this.columns.length)); - } - if (row.length < this.columns.length) { - LogFactory.getLog(SearchResultCollector.class).warn(String.format("Row %s: Invalid number of result columns: got %s, expected ",this.count, row.length, this.columns.length)); - } - - if (state() > BUFFER_FULL) { - if (this.exception == null) - setException(new RetsException("Attempting to add rows to buffer when in complete state")); - throw new NestableRuntimeException(this.exception); - } - - // check complete. - while (checkRuntime() && state() == BUFFER_FULL) { - _wait(); - - if (state() >= BUFFER_FULL) { - if (this.exception == null) - setException(new RetsException("Timeout writing to streaming result set buffer, timeout length = " - + this.timeout)); - throw new NestableRuntimeException(this.exception); - } - } - - this.buffer.addLast(row); - - if (this.bufferSize == this.buffer.size()) - pushState(BUFFER_FULL); - else - pushState(BUFFER_AVAILABLE); - - this.notifyAll(); - return true; - } - - public synchronized void setComplete() { - pushState(COMPLETE); - notifyAll(); - } - - public synchronized void setCount(int count) { - this.count = count; - pushState(PREPROCESS); - notifyAll(); - } - - public synchronized void setColumns(String[] columns) { - this.columns = columns; - pushState(BUFFER_AVAILABLE); - notifyAll(); - } - - public synchronized void setMaxrows() { - this.mMaxrows = true; - pushState(COMPLETE); - notifyAll(); - } - - synchronized void setException(RetsException e) { - this.exception = e; - pushState(COMPLETE); - notifyAll(); - } - - // ----------- Consumer Methods - - public synchronized boolean hasNext() throws RetsException { - // wait for someone to add data to the queue - // or flag complete - while (checkException() && state() < COMPLETE) { - if (!this.buffer.isEmpty()) - return true; - - _wait(); - } - - return !this.buffer.isEmpty(); - } - - public synchronized String[] next() throws RetsException { - checkException(); - String[] row = this.buffer.removeFirst(); - if (this.state < COMPLETE) - pushState(BUFFER_AVAILABLE); - this.notifyAll(); - return row; - } - - public synchronized int getCount() throws RetsException { - while (checkException() && state() < BUFFER_AVAILABLE) { - _wait(); - } - return this.count; - } - - public synchronized String[] getColumns() throws RetsException { - while (checkException() && state() < BUFFER_AVAILABLE) { - _wait(); - } - return this.columns; - } - - public synchronized boolean isMaxrows() throws RetsException { - checkException(); - - if (!isComplete()) - throw new IllegalStateException("Cannot call isMaxRows until isComplete == true"); - - return this.mMaxrows; - } - - public synchronized SearchResultInfo getInfo() throws RetsException { - checkException(); - - if (!isComplete()) - throw new IllegalStateException("Cannot call isMaxRows until isComplete == true"); - - return this; - } - - public synchronized boolean isComplete() throws RetsException { - checkException(); - return state() >= COMPLETE; - } - - private synchronized boolean checkRuntime() { - try { - return checkException(); - } catch (RetsException e) { - throw new NestableRuntimeException(e); - } - } - - private synchronized boolean checkException() throws RetsException { - // considering doing something here to maintain the original - // stack trace but also provide the stack trace from this - // location... - if (this.exception != null) - throw this.exception; - return true; - } - - private void _wait() { - try { - wait(this.timeout); - } catch (InterruptedException e) { - pushState(COMPLETE); - throw new NestableRuntimeException(e); - } - } - - private void pushState(int newState) { - if (this.state >= COMPLETE && newState < COMPLETE) - throw new IllegalStateException("Cannot revert from complete state"); - - if (this.state > PREPROCESS && newState <= PREPROCESS) - throw new IllegalStateException("Cannot revert to preprocess state"); - - if (newState < this.state && newState != BUFFER_AVAILABLE && this.state != BUFFER_FULL) - throw new IllegalStateException("Cannot go back in state unless reverting to buffer available from full"); - - this.state = newState; - } - - private int state() { - return this.state; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/VersionInsensitiveRequest.java b/target/filtered-sources/java/org/realtors/rets/client/VersionInsensitiveRequest.java deleted file mode 100644 index c508742..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/VersionInsensitiveRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.realtors.rets.client; - -public abstract class VersionInsensitiveRequest extends RetsHttpRequest { - /** - * Abstract class of subclasses where the Version of RETS is not needed (Password Request, Login Request, etc.) - */ - public VersionInsensitiveRequest() { - super(); - } - - @Override - public void setVersion(RetsVersion version) { - //noop - I don't care about version - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/client/metadata_tables.xml b/target/filtered-sources/java/org/realtors/rets/client/metadata_tables.xml deleted file mode 100644 index bc735b3..0000000 --- a/target/filtered-sources/java/org/realtors/rets/client/metadata_tables.xml +++ /dev/null @@ -1,41 +0,0 @@ - -
- -
-
- -
-
-
- - - -
-
-
-
-
-
- - -
-
- - -
-
- -
- -
diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/AttrType.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/AttrType.java deleted file mode 100644 index 67d477d..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/AttrType.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -import java.io.Serializable; - -public interface AttrType extends Serializable { - public T parse(String value, boolean strict) throws MetaParseException; - public Class getType(); - public String render(T value); -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/JDomCompactBuilder.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/JDomCompactBuilder.java deleted file mode 100644 index c027aa5..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/JDomCompactBuilder.java +++ /dev/null @@ -1,706 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.StringTokenizer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.realtors.rets.common.metadata.types.MClass; -import org.realtors.rets.common.metadata.types.MEditMask; -import org.realtors.rets.common.metadata.types.MLookup; -import org.realtors.rets.common.metadata.types.MLookupType; -import org.realtors.rets.common.metadata.types.MObject; -import org.realtors.rets.common.metadata.types.MResource; -import org.realtors.rets.common.metadata.types.MSearchHelp; -import org.realtors.rets.common.metadata.types.MSystem; -import org.realtors.rets.common.metadata.types.MTable; -import org.realtors.rets.common.metadata.types.MUpdate; -import org.realtors.rets.common.metadata.types.MUpdateType; -import org.realtors.rets.common.metadata.types.MValidationExpression; -import org.realtors.rets.common.metadata.types.MValidationExternal; -import org.realtors.rets.common.metadata.types.MValidationExternalType; -import org.realtors.rets.common.metadata.types.MValidationLookup; -import org.realtors.rets.common.metadata.types.MValidationLookupType; -import org.xml.sax.InputSource; - -public class JDomCompactBuilder extends MetadataBuilder { - public static final String CONTAINER_PREFIX = "METADATA-"; - public static final String CONTAINER_ROOT = "RETS"; - public static final String CONTAINER_METADATA = "METADATA"; - public static final String CONTAINER_SYSTEM = "METADATA-SYSTEM"; - public static final String CONTAINER_RESOURCE = "METADATA-RESOURCE"; - public static final String CONTAINER_FOREIGNKEY = "METADATA-FOREIGN_KEY"; - public static final String CONTAINER_CLASS = "METADATA-CLASS"; - public static final String CONTAINER_TABLE = "METADATA-TABLE"; - public static final String CONTAINER_UPDATE = "METADATA-UPDATE"; - public static final String CONTAINER_UPDATETYPE = "METADATA-UPDATE_TYPE"; - public static final String CONTAINER_OBJECT = "METADATA-OBJECT"; - public static final String CONTAINER_SEARCHHELP = "METADATA-SEARCH_HELP"; - public static final String CONTAINER_EDITMASK = "METADATA-EDITMASK"; - public static final String CONTAINER_UPDATEHELP = "METADATA-UPDATE_HELP"; - public static final String CONTAINER_LOOKUP = "METADATA-LOOKUP"; - public static final String CONTAINER_LOOKUPTYPE = "METADATA-LOOKUP_TYPE"; - public static final String CONTAINER_VALIDATIONLOOKUP = "METADATA-VALIDATION_LOOKUP"; - public static final String CONTAINER_VALIDATIONLOOKUPTYPE = "METADATA-VALIDATION_LOOKUP_TYPE"; - public static final String CONTAINER_VALIDATIONEXPRESSION = "METADATA-VALIDATION_EXPRESSION"; - public static final String CONTAINER_VALIDATIONEXTERNAL = "METADATA-VALIDATION_EXTERNAL"; - public static final String CONTAINER_VALIDATIONEXTERNALTYPE = "METADATA-VALIDATION_EXTERNAL_TYPE"; - public static final String ELEMENT_SYSTEM = "SYSTEM"; - public static final String COLUMNS = "COLUMNS"; - public static final String DATA = "DATA"; - public static final String ATTRIBUTE_RESOURCE = "Resource"; - public static final String ATTRIBUTE_CLASS = "Class"; - public static final String ATTRIBUTE_UPDATE = "Update"; - public static final String ATTRIBUTE_LOOKUP = "Lookup"; - public static final String ATTRIBUTE_VALIDATIONEXTERNAL = "ValidationExternal"; - public static final String ATTRIBUTE_VALIDATIONLOOKUP = "ValidationLookup"; - private static final Log LOG = LogFactory.getLog(JDomCompactBuilder.class); - - @Override - public Metadata doBuild(Object src) throws MetadataException { - return build((Document) src); - } - - public Metadata build(InputSource source) throws MetadataException { - SAXBuilder builder = new SAXBuilder(); - Document document; - try { - document = builder.build(source); - } catch (JDOMException e) { - throw new MetadataException("Couldn't build document", e); - } catch (IOException e) { - throw new MetadataException("Couldn't build document", e); - } - return build(document); - } - - @Override - public MetaObject[] parse(Object src) throws MetadataException { - return parse((Document) src); - } - - public MetaObject[] parse(Document src) throws MetadataException { - Element root = src.getRootElement(); - if (!root.getName().equals(CONTAINER_ROOT)) { - throw new MetadataException("Invalid root element"); - } - Element container = root.getChild(CONTAINER_SYSTEM); - if (container != null) { - MSystem sys = processSystem(container); - if (root.getChild(CONTAINER_RESOURCE) != null) { - Metadata m = new Metadata(sys); - recurseAll(m, root); - } - return new MetaObject[] { sys }; - } - container = root.getChild(CONTAINER_RESOURCE); - if (container != null) { - return processResource(container); - } - container = root.getChild(CONTAINER_CLASS); - if (container != null) { - return processClass(container); - } - container = root.getChild(CONTAINER_TABLE); - if (container != null) { - return processTable(container); - } - container = root.getChild(CONTAINER_UPDATE); - if (container != null) { - return processUpdate(container); - } - container = root.getChild(CONTAINER_UPDATETYPE); - if (container != null) { - return processUpdateType(container); - } - container = root.getChild(CONTAINER_OBJECT); - if (container != null) { - return processObject(container); - } - container = root.getChild(CONTAINER_SEARCHHELP); - if (container != null) { - return processSearchHelp(container); - } - container = root.getChild(CONTAINER_EDITMASK); - if (container != null) { - return processEditMask(container); - } - container = root.getChild(CONTAINER_LOOKUP); - if (container != null) { - return processLookup(container); - } - container = root.getChild(CONTAINER_LOOKUPTYPE); - if (container != null) { - return processLookupType(container); - } - container = root.getChild(CONTAINER_VALIDATIONLOOKUP); - if (container != null) { - return processValidationLookup(container); - } - container = root.getChild(CONTAINER_VALIDATIONLOOKUPTYPE); - if (container != null) { - return processValidationLookupType(container); - } - container = root.getChild(CONTAINER_VALIDATIONEXTERNAL); - if (container != null) { - return processValidationExternal(container); - } - container = root.getChild(CONTAINER_VALIDATIONEXTERNALTYPE); - if (container != null) { - return processValidationExternalType(container); - } - container = root.getChild(CONTAINER_VALIDATIONEXPRESSION); - if (container != null) { - return processValidationExpression(container); - } - return null; - } - - public Metadata build(Document src) throws MetadataException { - Element root = src.getRootElement(); - if (!root.getName().equals(CONTAINER_ROOT)) { - throw new MetadataException("Invalid root element"); - } - Element element = root.getChild(CONTAINER_SYSTEM); - if (element == null) { - throw new MetadataException("Missing element " + CONTAINER_SYSTEM); - } - MSystem sys = processSystem(element); - Metadata metadata; - metadata = new Metadata(sys); - recurseAll(metadata, root); - return metadata; - } - - private void recurseAll(Metadata metadata, Element root) throws MetaParseException { - attachResource(metadata, root); - attachClass(metadata, root); - attachTable(metadata, root); - attachUpdate(metadata, root); - attachUpdateType(metadata, root); - attachObject(metadata, root); - attachSearchHelp(metadata, root); - attachEditMask(metadata, root); - attachLookup(metadata, root); - attachLookupType(metadata, root); - attachValidationLookup(metadata, root); - attachValidationLookupType(metadata, root); - attachValidationExternal(metadata, root); - attachValidationExternalType(metadata, root); - attachValidationExpression(metadata, root); - } - - private void setAttributes(MetaObject obj, String[] columns, String[] data) { - int count = columns.length; - if (count > data.length) { - count = data.length; - } - for (int i = 0; i < count; i++) { - String column = columns[i]; - String datum = data[i]; - if (!datum.equals("")) { - setAttribute(obj, column, datum); - } - } - } - - private String[] getColumns(Element el) { - Element cols = el.getChild(COLUMNS); - return split(cols); - } - - /** do NOT use string.split() unless your prepared to deal with loss due to token boundary conditions */ - private String[] split(Element el) { - if( el == null ) return null; - final String delimiter = "\t"; - StringTokenizer tkn = new StringTokenizer(el.getText(), delimiter, true); - List list = new LinkedList(); - tkn.nextToken(); // junk the first element - String last = null; - while (tkn.hasMoreTokens()) { - String next = tkn.nextToken(); - if (next.equals(delimiter)) { - if (last == null) { - list.add(""); - } else { - last = null; - } - } else { - list.add(next); - last = next; - } - } - return (String[]) list.toArray(new String[0]); - } - - /** - * Gets an attribute that is not expected to be null (i.e. an attribute that - * MUST exist). - * - * @param element Element - * @param name Attribute name - * @return value of attribute - * @throws MetaParseException if the value is null. - */ - private String getNonNullAttribute(Element element, String name) throws MetaParseException { - String value = element.getAttributeValue(name); - if (value == null) { - throw new MetaParseException("Attribute '" + name + "' not found on tag " + toString(element)); - } - return value; - } - - private String toString(Element element) { - StringBuffer buffer = new StringBuffer(); - List attributes = element.getAttributes(); - buffer.append("'").append(element.getName()).append("'"); - buffer.append(", attributes: ").append(attributes); - return buffer.toString(); - } - - private MSystem processSystem(Element container) { - Element element = container.getChild(ELEMENT_SYSTEM); - MSystem system = buildSystem(); - // system metadata is such a hack. the first one here is by far my favorite - String comment = container.getChildText(MSystem.COMMENTS); - String systemId = element.getAttributeValue(MSystem.SYSTEMID); - String systemDescription = element.getAttributeValue(MSystem.SYSTEMDESCRIPTION); - String version = container.getAttributeValue(MSystem.VERSION); - String date = container.getAttributeValue(MSystem.DATE); - setAttribute(system, MSystem.COMMENTS, comment); - setAttribute(system, MSystem.SYSTEMID, systemId); - setAttribute(system, MSystem.SYSTEMDESCRIPTION, systemDescription); - setAttribute(system, MSystem.VERSION, version); - setAttribute(system, MSystem.DATE, date); - return system; - } - - private void attachResource(Metadata metadata, Element root) { - MSystem system = metadata.getSystem(); - List containers = root.getChildren(CONTAINER_RESOURCE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource[] resources = this.processResource(container); - for (int j = 0; j < resources.length; j++) { - system.addChild(MetadataType.RESOURCE, resources[j]); - } - } - } - - private MResource[] processResource(Element resourceContainer) { - String[] columns = getColumns(resourceContainer); - List rows = resourceContainer.getChildren(DATA); - MResource[] resources = new MResource[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MResource resource = buildResource(); - setAttributes(resource, columns, data); - resources[i] = resource; - } - return resources; - } - - private void attachClass(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_CLASS); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - String resourceId = getNonNullAttribute(container, ATTRIBUTE_RESOURCE); - MResource resource = metadata.getResource(resourceId); - MClass[] classes = processClass(container); - for (int j = 0; j < classes.length; j++) { - resource.addChild(MetadataType.CLASS, classes[j]); - } - } - } - - private MClass[] processClass(Element classContainer) throws MetaParseException { - String name = classContainer.getName(); - String resourceId = getNonNullAttribute(classContainer, ATTRIBUTE_RESOURCE); - LOG.debug("resource name: " + resourceId + " for container " + name); - String[] columns = getColumns(classContainer); - List rows = classContainer.getChildren(DATA); - MClass[] classes = new MClass[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MClass clazz = buildClass(); - setAttributes(clazz, columns, data); - classes[i] = clazz; - } - return classes; - } - - private void attachTable(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_TABLE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - String resourceId = getNonNullAttribute(container, ATTRIBUTE_RESOURCE); - String className = getNonNullAttribute(container, ATTRIBUTE_CLASS); - MClass clazz = metadata.getMClass(resourceId, className); - - if (clazz == null) { - //MarketLinx Strikes!!! - LOG.warn("Found table metadata for resource class: " + resourceId + ":" + className - + " but there is no class metadata for " + resourceId + ":" + className); - continue; - } - - MTable[] fieldMetadata = processTable(container); - for (int j = 0; j < fieldMetadata.length; j++) { - clazz.addChild(MetadataType.TABLE, fieldMetadata[j]); - } - } - } - - private MTable[] processTable(Element tableContainer) { - String[] columns = getColumns(tableContainer); - List rows = tableContainer.getChildren(DATA); - MTable[] fieldMetadata = new MTable[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MTable mTable = buildTable(); - setAttributes(mTable, columns, data); - fieldMetadata[i] = mTable; - } - return fieldMetadata; - } - - private void attachUpdate(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_UPDATE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MClass parent = metadata.getMClass(getNonNullAttribute(container, ATTRIBUTE_RESOURCE), getNonNullAttribute( - container, ATTRIBUTE_CLASS)); - MUpdate[] updates = processUpdate(container); - for (int j = 0; j < updates.length; j++) { - parent.addChild(MetadataType.UPDATE, updates[j]); - } - } - } - - private MUpdate[] processUpdate(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MUpdate[] updates = new MUpdate[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MUpdate update = buildUpdate(); - setAttributes(update, columns, data); - updates[i] = update; - } - return updates; - } - - private void attachUpdateType(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_UPDATETYPE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MUpdate parent = metadata.getUpdate(getNonNullAttribute(container, ATTRIBUTE_RESOURCE), - getNonNullAttribute(container, ATTRIBUTE_CLASS), getNonNullAttribute(container, ATTRIBUTE_UPDATE)); - MUpdateType[] updateTypes = processUpdateType(container); - for (int j = 0; j < updateTypes.length; j++) { - parent.addChild(MetadataType.UPDATE_TYPE, updateTypes[j]); - } - } - } - - private MUpdateType[] processUpdateType(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MUpdateType[] updateTypes = new MUpdateType[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MUpdateType updateType = buildUpdateType(); - setAttributes(updateType, columns, data); - updateTypes[i] = updateType; - } - return updateTypes; - } - - private void attachObject(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_OBJECT); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE)); - MObject[] objects = processObject(container); - for (int j = 0; j < objects.length; j++) { - parent.addChild(MetadataType.OBJECT, objects[j]); - } - } - } - - private MObject[] processObject(Element objectContainer) { - String[] columns = getColumns(objectContainer); - List rows = objectContainer.getChildren(DATA); - MObject[] objects = new MObject[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MObject object = buildObject(); - setAttributes(object, columns, data); - objects[i] = object; - } - return objects; - } - - private void attachSearchHelp(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_SEARCHHELP); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE)); - MSearchHelp[] searchHelps = processSearchHelp(container); - for (int j = 0; j < searchHelps.length; j++) { - parent.addChild(MetadataType.SEARCH_HELP, searchHelps[j]); - } - } - } - - private MSearchHelp[] processSearchHelp(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MSearchHelp[] searchHelps = new MSearchHelp[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MSearchHelp searchHelp = buildSearchHelp(); - setAttributes(searchHelp, columns, data); - searchHelps[i] = searchHelp; - } - return searchHelps; - } - - private void attachEditMask(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_EDITMASK); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE)); - MEditMask[] editMasks = processEditMask(container); - for (int j = 0; j < editMasks.length; j++) { - parent.addChild(MetadataType.EDITMASK, editMasks[j]); - } - } - } - - private MEditMask[] processEditMask(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MEditMask[] editMasks = new MEditMask[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MEditMask editMask = buildEditMask(); - setAttributes(editMask, columns, data); - editMasks[i] = editMask; - } - return editMasks; - } - - private void attachLookup(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_LOOKUP); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE)); - MLookup[] lookups = processLookup(container); - for (int j = 0; j < lookups.length; j++) { - parent.addChild(MetadataType.LOOKUP, lookups[j]); - } - } - } - - private MLookup[] processLookup(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MLookup[] lookups = new MLookup[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MLookup lookup = buildLookup(); - setAttributes(lookup, columns, data); - lookups[i] = lookup; - } - return lookups; - } - - private void attachLookupType(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_LOOKUPTYPE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MLookup parent = metadata.getLookup(getNonNullAttribute(container, ATTRIBUTE_RESOURCE), - getNonNullAttribute(container, ATTRIBUTE_LOOKUP)); - - if (parent == null) { - LOG.warn("Skipping lookup type: could not find lookup for tag " + toString(container)); - continue; - } - - MLookupType[] lookupTypes = processLookupType(container); - for (int j = 0; j < lookupTypes.length; j++) { - parent.addChild(MetadataType.LOOKUP_TYPE, lookupTypes[j]); - } - } - } - - private MLookupType[] processLookupType(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MLookupType[] lookupTypes = new MLookupType[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MLookupType lookupType = buildLookupType(); - setAttributes(lookupType, columns, data); - lookupTypes[i] = lookupType; - } - return lookupTypes; - } - - private void attachValidationLookup(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_VALIDATIONLOOKUP); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE)); - MValidationLookup[] validationLookups = processValidationLookup(container); - for (int j = 0; j < validationLookups.length; j++) { - parent.addChild(MetadataType.VALIDATION_LOOKUP, validationLookups[j]); - } - } - } - - private MValidationLookup[] processValidationLookup(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MValidationLookup[] validationLookups = new MValidationLookup[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MValidationLookup validationLookup = buildValidationLookup(); - setAttributes(validationLookup, columns, data); - validationLookups[i] = validationLookup; - } - return validationLookups; - } - - private void attachValidationLookupType(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_VALIDATIONLOOKUPTYPE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MValidationLookup parent = metadata.getValidationLookup(getNonNullAttribute(container, ATTRIBUTE_RESOURCE), - getNonNullAttribute(container, ATTRIBUTE_VALIDATIONLOOKUP)); - MValidationLookupType[] validationLookupTypes = processValidationLookupType(container); - for (int j = 0; j < validationLookupTypes.length; j++) { - parent.addChild(MetadataType.VALIDATION_LOOKUP_TYPE, validationLookupTypes[j]); - } - } - } - - private MValidationLookupType[] processValidationLookupType(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MValidationLookupType[] validationLookupTypes = new MValidationLookupType[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MValidationLookupType validationLookupType = buildValidationLookupType(); - setAttributes(validationLookupType, columns, data); - validationLookupTypes[i] = validationLookupType; - } - return validationLookupTypes; - } - - private void attachValidationExternal(Metadata metadata, Element root) { - List containers = root.getChildren(CONTAINER_VALIDATIONEXTERNAL); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(container.getAttributeValue(ATTRIBUTE_RESOURCE)); - MValidationExternal[] validationExternals = processValidationExternal(container); - for (int j = 0; j < validationExternals.length; j++) { - parent.addChild(MetadataType.VALIDATION_EXTERNAL, validationExternals[j]); - } - } - } - - private MValidationExternal[] processValidationExternal(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MValidationExternal[] validationExternals = new MValidationExternal[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MValidationExternal validationExternal = buildValidationExternal(); - setAttributes(validationExternal, columns, data); - validationExternals[i] = validationExternal; - } - return validationExternals; - } - - private void attachValidationExternalType(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_VALIDATIONEXTERNALTYPE); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MValidationExternal parent = metadata.getValidationExternal(getNonNullAttribute(container, - ATTRIBUTE_RESOURCE), getNonNullAttribute(container, ATTRIBUTE_VALIDATIONEXTERNAL)); - MValidationExternalType[] validationExternalTypes = processValidationExternalType(container); - for (int j = 0; j < validationExternalTypes.length; j++) { - parent.addChild(MetadataType.VALIDATION_EXTERNAL_TYPE, validationExternalTypes[j]); - } - } - } - - private MValidationExternalType[] processValidationExternalType(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MValidationExternalType[] validationExternalTypes = new MValidationExternalType[rows.size()]; - for (int i = 0; i < rows.size(); i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MValidationExternalType validationExternalType = buildValidationExternalType(); - setAttributes(validationExternalType, columns, data); - validationExternalTypes[i] = validationExternalType; - } - return validationExternalTypes; - } - - private void attachValidationExpression(Metadata metadata, Element root) throws MetaParseException { - List containers = root.getChildren(CONTAINER_VALIDATIONEXPRESSION); - for (int i = 0; i < containers.size(); i++) { - Element container = (Element) containers.get(i); - MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE)); - MValidationExpression[] expressions = processValidationExpression(container); - for (int j = 0; j < expressions.length; j++) { - parent.addChild(MetadataType.VALIDATION_EXPRESSION, expressions[j]); - } - } - } - - private MValidationExpression[] processValidationExpression(Element container) { - String[] columns = getColumns(container); - List rows = container.getChildren(DATA); - MValidationExpression[] expressions = new MValidationExpression[rows.size()]; - for (int i = 0; i < expressions.length; i++) { - Element element = (Element) rows.get(i); - String[] data = split(element); - MValidationExpression expression = buildValidationExpression(); - setAttributes(expression, columns, data); - expressions[i] = expression; - } - return expressions; - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/JDomStandardBuilder.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/JDomStandardBuilder.java deleted file mode 100644 index ef8cb93..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/JDomStandardBuilder.java +++ /dev/null @@ -1,628 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; - -import org.jdom.Attribute; -import org.jdom.Document; -import org.jdom.Element; -import org.realtors.rets.common.metadata.types.MClass; -import org.realtors.rets.common.metadata.types.MEditMask; -import org.realtors.rets.common.metadata.types.MForeignKey; -import org.realtors.rets.common.metadata.types.MLookup; -import org.realtors.rets.common.metadata.types.MLookupType; -import org.realtors.rets.common.metadata.types.MObject; -import org.realtors.rets.common.metadata.types.MResource; -import org.realtors.rets.common.metadata.types.MSearchHelp; -import org.realtors.rets.common.metadata.types.MSystem; -import org.realtors.rets.common.metadata.types.MTable; -import org.realtors.rets.common.metadata.types.MUpdate; -import org.realtors.rets.common.metadata.types.MUpdateHelp; -import org.realtors.rets.common.metadata.types.MUpdateType; -import org.realtors.rets.common.metadata.types.MValidationExpression; -import org.realtors.rets.common.metadata.types.MValidationExternal; -import org.realtors.rets.common.metadata.types.MValidationExternalType; -import org.realtors.rets.common.metadata.types.MValidationLookup; -import org.realtors.rets.common.metadata.types.MValidationLookupType; - -/** Parses apart a complete Standard-XML response, returns a Metadata object */ -public class JDomStandardBuilder extends MetadataBuilder { - public static final String ELEMENT_SYSTEM = "System"; - public static final String ELEMENT_RESOURCE = "Resource"; - public static final String ELEMENT_FOREIGNKEY = "ForeignKey"; - public static final String ELEMENT_CLASS = "Class"; - public static final String ELEMENT_TABLE = "Field"; - public static final String ELEMENT_UPDATE = "UpdateType"; - public static final String ELEMENT_UPDATETYPE = "UpdateField"; - public static final String ELEMENT_OBJECT = "Object"; - public static final String ELEMENT_SEARCHHELP = "SearchHelp"; - public static final String ELEMENT_EDITMASK = "EditMask"; - public static final String ELEMENT_UPDATEHELP = "UpdateHelp"; - public static final String ELEMENT_LOOKUP = "Lookup"; - public static final String ELEMENT_LOOKUPTYPE = "LookupType"; - public static final String ELEMENT_VALIDATIONLOOKUP = "ValidationLookup"; - public static final String ELEMENT_VALIDATIONLOOKUPTYPE = "ValidationLookupType"; - public static final String ELEMENT_VALIDATIONEXPRESSION = "ValidationExpression"; - public static final String ELEMENT_VALIDATIONEXTERNAL = "ValidationExternalType"; - public static final String ELEMENT_VALIDATIONEXTERNALTYPE = "ValidationExternal"; - public static final String ATTRIBUTE_RESOURCEID = ELEMENT_RESOURCE; - public static final String ATTRIBUTE_CLASSNAME = ELEMENT_CLASS; - public static final String ATTRIBUTE_UPDATE = ELEMENT_UPDATE; - public static final String ATTRIBUTE_LOOKUP = ELEMENT_LOOKUP; - public static final String ATTRIBUTE_VALIDATIONLOOKUP = ELEMENT_VALIDATIONLOOKUP; - public static final String ATTRIBUTE_VALIDATIONEXTERNAL = ELEMENT_VALIDATIONEXTERNAL; - public static final Map sType2Element = new HashMap(); - - static { - sType2Element.put(MetadataType.SYSTEM, ELEMENT_SYSTEM); - sType2Element.put(MetadataType.RESOURCE, ELEMENT_RESOURCE); - sType2Element.put(MetadataType.FOREIGNKEYS, ELEMENT_FOREIGNKEY); - sType2Element.put(MetadataType.CLASS, ELEMENT_CLASS); - sType2Element.put(MetadataType.TABLE, ELEMENT_TABLE); - sType2Element.put(MetadataType.UPDATE, ELEMENT_UPDATE); - sType2Element.put(MetadataType.UPDATE_TYPE, ELEMENT_UPDATETYPE); - sType2Element.put(MetadataType.SEARCH_HELP, ELEMENT_SEARCHHELP); - sType2Element.put(MetadataType.EDITMASK, ELEMENT_EDITMASK); - sType2Element.put(MetadataType.UPDATE_HELP, ELEMENT_UPDATEHELP); - sType2Element.put(MetadataType.LOOKUP, ELEMENT_LOOKUP); - sType2Element.put(MetadataType.LOOKUP_TYPE, ELEMENT_LOOKUPTYPE); - sType2Element.put(MetadataType.VALIDATION_LOOKUP, ELEMENT_VALIDATIONLOOKUP); - sType2Element.put(MetadataType.VALIDATION_LOOKUP_TYPE, ELEMENT_VALIDATIONLOOKUPTYPE); - sType2Element.put(MetadataType.VALIDATION_EXTERNAL, ELEMENT_VALIDATIONEXTERNAL); - sType2Element.put(MetadataType.VALIDATION_EXTERNAL_TYPE, ELEMENT_VALIDATIONEXTERNALTYPE); - sType2Element.put(MetadataType.VALIDATION_EXPRESSION, ELEMENT_VALIDATIONEXPRESSION); - } - - @Override - public Metadata doBuild(Object src) throws MetadataException { - return build((Document) src); - } - - public Metadata build(Document src) throws MetadataException { - Element element = src.getRootElement(); - expectElement(element, CONTAINER_ROOT); - element = getElement(element, CONTAINER_METADATA); - return build(element); - } - - @Override - public MetaObject[] parse(Object src) throws MetadataException { - return parse((Document) src); - } - - public MetaObject[] parse(Document src) throws MetadataException { - Element element = src.getRootElement(); - expectElement(element, CONTAINER_ROOT); - Element container = getElement(element, CONTAINER_METADATA); - boolean recurse = checkForRecursion(container); - List list = container.getChildren(); - if (list.size() == 0) { - return null; - } - return processContainer(null, (Element) list.get(0), recurse); - } - - /** - * Function to determine if a request contains recursive data or not. - * This is done here instead of inside processContainer because, well, - * it's easier and more reliable (processContainer might not figure out - * that a request is recursive until the third or 4th child if there are - * no children for the first couple of elements. - * - * @param top The outside METADATA container. - * @return true if the request is recursive - * - */ - private boolean checkForRecursion(Element top) { - /* - * this seems like a really nasty loop. However, if there are a - * lot of recursive elements, we'll find out pretty quickly, and if - * we fall all the way to the end then there probably wasn't that - * much to look through. - */ - Iterator children = top.getChildren().iterator(); - while (children.hasNext()) { - /* each of these is a container (METADATA-*) type */ - Element element = (Element) children.next(); - Iterator iterator = element.getChildren().iterator(); - while (iterator.hasNext()) { - /* each of these is an item element */ - Element child = (Element) iterator.next(); - Iterator subtypes = child.getChildren().iterator(); - while (subtypes.hasNext()) { - Element subtype = (Element) subtypes.next(); - if (subtype.getName().startsWith(CONTAINER_PREFIX)) { - return true; - } - } - } - } - return false; - } - - private MetaObject[] processContainer(MetaObject parent, Element container, boolean recursion) { - MetadataType type = (MetadataType) sContainer2Type.get(container.getName()); - if (type == null) { - throw new RuntimeException("no matching type for container " + container.getName()); - } - List elements = container.getChildren((String) sType2Element.get(type)); - String path = getPath(container); - List output = null; - if (parent == null) { - output = new LinkedList(); - } - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MetaObject obj = newType(type); - setAttributes(obj, element); - if (output != null) { - output.add(obj); - } - if (parent != null) { - parent.addChild(type, obj); - } else { - /** - * Weirdness abounds. There IS an ID attribute of System, - * and the SystemID is included in the Metadata container - * attributes, but the system id is not part of the metadata - * request path for a getMetadata request, so we ignore it. - */ - if (!type.equals(MetadataType.SYSTEM)) { - obj.setPath(path); - } - } - if (recursion) { - MetadataType[] childTypes = obj.getChildTypes(); - for (int j = 0; j < childTypes.length; j++) { - MetadataType childType = childTypes[j]; - Element childContainer = element.getChild(CONTAINER_PREFIX + childType.name()); - if (childContainer == null) { - obj.addChild(childType, null); - } else { - processContainer(obj, childContainer, true); - } - } - } - } - if (output == null) { - return null; - } - return (MetaObject[]) output.toArray(new MetaObject[0]); - } - - String getPath(Element container) { - String resource = container.getAttributeValue(ATTRIBUTE_RESOURCEID); - if (resource == null) { - return null; - } - String classname = container.getAttributeValue(ATTRIBUTE_CLASSNAME); - if (classname != null) { - String update = container.getAttributeValue(ATTRIBUTE_UPDATE); - if (update != null) { - return resource + ":" + classname + ":" + update; - } - return resource + ":" + classname; - } - String lookup = container.getAttributeValue(ATTRIBUTE_LOOKUP); - if (lookup != null) { - return resource + ":" + lookup; - } - String vallkp = container.getAttributeValue(ATTRIBUTE_VALIDATIONLOOKUP); - if (vallkp != null) { - return resource + ":" + vallkp; - } - String vale = container.getAttributeValue(ATTRIBUTE_VALIDATIONEXTERNAL); - if (vale != null) { - return resource + ":" + vale; - } - return resource; - } - - public Metadata build(Element element) throws MetadataException { - expectElement(element, CONTAINER_METADATA); - element = getElement(element, CONTAINER_SYSTEM); - //maybe i get the attribute here - MSystem sys = processSystem(element); - return new Metadata(sys); - } - - private Element getElement(Element parent, String type) throws MetadataException { - Element element = parent.getChild(type); - if (element == null) { - throw new MetadataException("Missing element " + type); - } - return element; - } - - - private void expectElement(Element element, String type) throws MetadataException { - if (!element.getName().equalsIgnoreCase(type)) {// changed to ignore case - throw new MetadataException("Expecting element " + type + ", got " + element.getName()); - } - } - - private void setAttributes(MetaObject obj, Element el) { - - List children = el.getChildren(); - for (int i = 0; i < children.size(); i++) { - Element child = (Element) children.get(i); - String name = child.getName(); - if (!name.startsWith(CONTAINER_PREFIX)) { - String value = child.getTextTrim(); - setAttribute(obj, name, value); - } else { - // LOG.info("skipping container element " + name); - } - } - } - - //when atrributes from the xml element are needed - public void setAttributesFromXMLAttr(MetaObject obj, Element el) { - - Iterator attrIter = el.getParentElement().getAttributes().iterator(); - - while(attrIter.hasNext()){ - Attribute attr = (Attribute) attrIter.next(); - String name = attr.getName(); - String value= attr.getValue().trim(); - setAttribute(obj, name, value); - } - } - - - /** - * If we're a recursive request, initialize all possible child types so - * we don't have to try to pull them later, dynamically - */ - private void init(MetaObject item) { - MetadataType[] childTypes = item.getChildTypes(); - for (int i = 0; i < childTypes.length; i++) { - MetadataType type = childTypes[i]; - item.addChild(type, null); - } - } - - private MSystem processSystem(Element container) { - Element element = container.getChild(ELEMENT_SYSTEM); - if (element == null){ - element = container.getChild(ELEMENT_SYSTEM.toUpperCase()); - } - MSystem system = buildSystem(); - init(system); - setAttributesFromXMLAttr(system, element); - setAttributes(system, element); - Element child; - child = element.getChild(CONTAINER_RESOURCE); - if (child != null) { - processResource(system, child); - } - child = element.getChild(CONTAINER_FOREIGNKEY); - if (child != null) { - processForeignKey(system, child); - } - return system; - } - - private void processResource(MSystem system, Element container) { - List resources = container.getChildren(ELEMENT_RESOURCE); - for (int i = 0; i < resources.size(); i++) { - Element element = (Element) resources.get(i); - MResource resource = buildResource(); - init(resource); - setAttributes(resource, element); - system.addChild(MetadataType.RESOURCE, resource); - Element child; - child = element.getChild(CONTAINER_CLASS); - if (child != null) { - processClass(resource, child); - } - child = element.getChild(CONTAINER_OBJECT); - if (child != null) { - processObject(resource, child); - } - child = element.getChild(CONTAINER_SEARCH_HELP); - if (child != null) { - processSearchHelp(resource, child); - } - child = element.getChild(CONTAINER_EDITMASK); - if (child != null) { - processEditMask(resource, child); - } - child = element.getChild(CONTAINER_LOOKUP); - if (child != null) { - processLookup(resource, child); - } - child = element.getChild(CONTAINER_UPDATEHELP); - if (child != null) { - processUpdateHelp(resource, child); - } - child = element.getChild(CONTAINER_VALIDATIONLOOKUP); - if (child != null) { - processValidationLookup(resource, child); - } - child = element.getChild(CONTAINER_VALIDATIONEXPRESSION); - if (child != null) { - processValidationExpression(resource, child); - } - child = element.getChild(CONTAINER_VALIDATIONEXTERNAL); - if (child != null) { - processValidationExternal(resource, child); - } - } - } - - private void processEditMask(MResource parent, Element container) { - List elements = container.getChildren(ELEMENT_EDITMASK); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MEditMask mask = buildEditMask(); - setAttributes(mask, element); - parent.addChild(MetadataType.EDITMASK, mask); - } - } - - private void processLookup(MResource parent, Element container) { - List elements15 = container.getChildren(ELEMENT_LOOKUP); - List elements17 = container.getChildren(ELEMENT_LOOKUPTYPE); - List elements; - //some Rets Servers have lookuptype and lookup elements interchanged - if (elements15.isEmpty()){ - elements = elements17; - } else { - elements = elements15; - } - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MLookup lookup = buildLookup(); - init(lookup); - setAttributes(lookup, element); - parent.addChild(MetadataType.LOOKUP, lookup); - Element child = element.getChild(CONTAINER_LOOKUPTYPE); - if (child != null) { - processLookupType(lookup, child); - } - } - } - - private void processLookupType(MLookup parent, Element container) { - - List elements15 = container.getChildren(ELEMENT_LOOKUPTYPE);// check spec - List elements17 = container.getChildren(ELEMENT_LOOKUP); - List elements; - //some Rets Servers have lookuptype and lookup elements interchanged - if (elements15.isEmpty()){ - elements = elements17; - } else { - elements = elements15; - } - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MLookupType type = buildLookupType(); - setAttributes(type, element); - parent.addChild(MetadataType.LOOKUP_TYPE, type); - } - } - - private void processUpdateHelp(MResource parent, Element container) { - List elements = container.getChildren(ELEMENT_UPDATEHELP); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MUpdateHelp help = buildUpdateHelp(); - setAttributes(help, element); - parent.addChild(MetadataType.UPDATE_HELP, help); - } - } - - private void processValidationLookup(MResource parent, Element container) { - List elements = container.getChildren(ELEMENT_VALIDATIONLOOKUP); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MValidationLookup lookup = buildValidationLookup(); - init(lookup); - setAttributes(lookup, element); - parent.addChild(MetadataType.VALIDATION_LOOKUP, lookup); - Element child = element.getChild(CONTAINER_VALIDATIONLOOKUPTYPE); - if (child != null) { - processValidationLookupType(lookup, child); - } - } - } - - private void processValidationLookupType(MValidationLookup parent, Element container) { - List elements = container.getChildren(ELEMENT_VALIDATIONLOOKUPTYPE); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MValidationLookupType lookupType = buildValidationLookupType(); - setAttributes(lookupType, element); - parent.addChild(MetadataType.VALIDATION_LOOKUP_TYPE, lookupType); - } - } - - private void processValidationExpression(MResource parent, Element container) { - List elements = container.getChildren(ELEMENT_VALIDATIONEXPRESSION); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MValidationExpression expression = buildValidationExpression(); - setAttributes(expression, element); - parent.addChild(MetadataType.VALIDATION_EXPRESSION, expression); - } - } - - private void processValidationExternal(MResource parent, Element container) { - List elements = container.getChildren(ELEMENT_VALIDATIONEXTERNAL); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MValidationExternal external = buildValidationExternal(); - init(external); - setAttributes(external, element); - parent.addChild(MetadataType.VALIDATION_EXTERNAL, external); - Element child = element.getChild(CONTAINER_VALIDATIONEXTERNALTYPE); - if (child != null) { - processValidationExternalType(external, child); - } - } - } - - private void processValidationExternalType(MValidationExternal parent, Element container) { - List elements = container.getChildren(ELEMENT_VALIDATIONEXTERNALTYPE); - for (int i = 0; i < elements.size(); i++) { - Element element = (Element) elements.get(i); - MValidationExternalType type = buildValidationExternalType(); - setAttributes(type, element); - parent.addChild(MetadataType.VALIDATION_EXTERNAL_TYPE, type); - } - } - - private void processSearchHelp(MResource parent, Element container) { - List searchhelps = container.getChildren(ELEMENT_SEARCHHELP); - for (int i = 0; i < searchhelps.size(); i++) { - Element element = (Element) searchhelps.get(i); - MSearchHelp searchhelp = buildSearchHelp(); - setAttributes(searchhelp, element); - parent.addChild(MetadataType.SEARCH_HELP, searchhelp); - } - } - - private void processObject(MResource parent, Element container) { - List objects = container.getChildren(ELEMENT_OBJECT); - for (int i = 0; i < objects.size(); i++) { - Element element = (Element) objects.get(i); - MObject obj = buildObject(); - setAttributes(obj, element); - parent.addChild(MetadataType.OBJECT, obj); - } - } - - private void processClass(MResource parent, Element container) { - List classes = container.getChildren(ELEMENT_CLASS); - for (int i = 0; i < classes.size(); i++) { - Element element = (Element) classes.get(i); - MClass clazz = buildClass(); - init(clazz); - setAttributes(clazz, element); - parent.addChild(MetadataType.CLASS, clazz); - Element child; - child = element.getChild(CONTAINER_TABLE); - if (child != null) { - processTable(clazz, child); - } - child = element.getChild(CONTAINER_UPDATE); - if (child != null) { - processUpdate(clazz, child); - } - } - } - - private void processTable(MClass parent, Element container) { - List tables = container.getChildren(ELEMENT_TABLE); - for (int i = 0; i < tables.size(); i++) { - Element element = (Element) tables.get(i); - MTable table = buildTable(); - setAttributes(table, element); - parent.addChild(MetadataType.TABLE, table); - } - } - - private void processUpdate(MClass parent, Element container) { - List updates = container.getChildren(ELEMENT_UPDATE); - for (int i = 0; i < updates.size(); i++) { - Element element = (Element) updates.get(i); - MUpdate update = buildUpdate(); - init(update); - setAttributes(update, element); - parent.addChild(MetadataType.UPDATE, update); - Element child = element.getChild(CONTAINER_UPDATE_TYPE); - if (child != null) { - processUpdateType(update, child); - } - } - } - - private void processUpdateType(MUpdate parent, Element container) { - List updateFields = container.getChildren(ELEMENT_UPDATETYPE); - for (int i = 0; i < updateFields.size(); i++) { - Element element = (Element) updateFields.get(i); - MUpdateType updateType = buildUpdateType(); - parent.addChild(MetadataType.UPDATE_TYPE, updateType); - setAttributes(updateType, element); - } - } - - private void processForeignKey(MSystem system, Element container) { - List fkeys = container.getChildren("ForeignKey"); - for (int i = 0; i < fkeys.size(); i++) { - Element element = (Element) fkeys.get(i); - MForeignKey foreignKey = buildForeignKey(); - setAttributes(foreignKey, element); - system.addChild(MetadataType.FOREIGNKEYS, foreignKey); - } - } - - public static final String CONTAINER_PREFIX = "METADATA-"; - - public static final String CONTAINER_ROOT = "RETS"; - - public static final String CONTAINER_METADATA = "METADATA"; - - public static final String CONTAINER_SYSTEM = "METADATA-SYSTEM"; - - public static final String CONTAINER_RESOURCE = "METADATA-RESOURCE"; - - public static final String CONTAINER_FOREIGNKEY = "METADATA-FOREIGN_KEYS"; - - public static final String CONTAINER_CLASS = "METADATA-CLASS"; - - public static final String CONTAINER_TABLE = "METADATA-TABLE"; - - public static final String CONTAINER_UPDATE = "METADATA-UPDATE"; - - public static final String CONTAINER_UPDATE_TYPE = "METADATA-UPDATE_TYPE"; - - public static final String CONTAINER_OBJECT = "METADATA-OBJECT"; - - public static final String CONTAINER_SEARCH_HELP = "METADATA-SEARCH_HELP"; - - public static final String CONTAINER_EDITMASK = "METADATA-EDITMASK"; - - public static final String CONTAINER_UPDATEHELP = "METADATA-UPDATE_HELP"; - - public static final String CONTAINER_LOOKUP = "METADATA-LOOKUP"; - - public static final String CONTAINER_LOOKUPTYPE = "METADATA-LOOKUP_TYPE"; - - public static final String CONTAINER_VALIDATIONLOOKUP = "METADATA-VALIDATION_LOOKUP"; - - public static final String CONTAINER_VALIDATIONLOOKUPTYPE = "METADATA-VALIDATION_LOOKUP_TYPE"; - - public static final String CONTAINER_VALIDATIONEXPRESSION = "METADATA-VALIDATION_EXPRESSION"; - - public static final String CONTAINER_VALIDATIONEXTERNAL = "METADATA-VALIDATION_EXTERNAL"; - - public static final String CONTAINER_VALIDATIONEXTERNALTYPE = "METADATA-VALIDATION_EXTERNAL_TYPE"; - - public static final Map sContainer2Type = new HashMap(); - static { - for (int i = 0; i < MetadataType.values().length; i++) { - MetadataType type = MetadataType.values()[i]; - sContainer2Type.put(CONTAINER_PREFIX + type.name(), type); - } - /* you have got to be kidding me. The spec (compact) says - METADATA-FOREIGNKEYS and that's the request type but the DTD says - METADATA-FOREIGN_KEY. - I think I'm going to be sick. - */ - sContainer2Type.remove(CONTAINER_PREFIX + MetadataType.FOREIGNKEYS.name()); - sContainer2Type.put(CONTAINER_FOREIGNKEY, MetadataType.FOREIGNKEYS); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaCollector.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaCollector.java deleted file mode 100644 index e824106..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaCollector.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -import java.io.Serializable; - -/** Interface for Metadata objects to collect their children. */ -public interface MetaCollector extends Serializable { - /** - * @param path path to the parent object. - */ - public MetaObject[] getMetadata(MetadataType type, String path) throws MetadataException; - - public MetaObject[] getMetadataRecursive(MetadataType type, String path) throws MetadataException; -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaObject.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaObject.java deleted file mode 100644 index ed00e32..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaObject.java +++ /dev/null @@ -1,366 +0,0 @@ -package org.realtors.rets.common.metadata; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -//import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.realtors.rets.common.metadata.attrib.AttrAlphanum; -import org.realtors.rets.common.metadata.attrib.AttrBoolean; -import org.realtors.rets.common.metadata.attrib.AttrDate; -import org.realtors.rets.common.metadata.attrib.AttrNumeric; -import org.realtors.rets.common.metadata.attrib.AttrNumericPositive; -import org.realtors.rets.common.metadata.attrib.AttrPlaintext; -import org.realtors.rets.common.metadata.attrib.AttrText; -import org.realtors.rets.common.metadata.attrib.AttrVersion; -import org.realtors.rets.common.util.CaseInsensitiveTreeMap; - -public abstract class MetaObject implements Serializable { - private static final Log LOG = LogFactory.getLog(MetaObject.class); - - /** a standard parser used by different child types */ - protected static final AttrType sAlphanum = new AttrAlphanum(0, 0); - protected static final AttrType sAlphanum64 = new AttrAlphanum(1, 64); - protected static final AttrType sAlphanum32 = new AttrAlphanum(1, 32); - protected static final AttrType sAlphanum24 = new AttrAlphanum(1, 24); - protected static final AttrType sAlphanum10 = new AttrAlphanum(1, 10); - protected static final AttrType sPlaintext = new AttrPlaintext(0, 0); - protected static final AttrType sPlaintext1024 = new AttrPlaintext(1, 1024); - protected static final AttrType sPlaintext512 = new AttrPlaintext(1, 512); - protected static final AttrType sPlaintext128 = new AttrPlaintext(1, 128); - protected static final AttrType sPlaintext64 = new AttrPlaintext(1, 64); - protected static final AttrType sPlaintext32 = new AttrPlaintext(1, 32); - protected static final AttrType sText = new AttrText(0, 0); - protected static final AttrType sText1024 = new AttrText(1, 1024); - protected static final AttrType sText512 = new AttrText(1, 512); - protected static final AttrType sText256 = new AttrText(1, 256); - protected static final AttrType sText128 = new AttrText(1, 128); - protected static final AttrType sText64 = new AttrText(1, 64); - protected static final AttrType sText32 = new AttrText(1, 32); - protected static final AttrType sAttrBoolean = new AttrBoolean(); - protected static final AttrType sAttrDate = new AttrDate(); - protected static final AttrType sAttrNumeric = new AttrNumeric(); - protected static final AttrType sAttrNumericPositive = new AttrNumericPositive(); - protected static final AttrType sAttrVersion = new AttrVersion(); - protected static final AttrType sAttrMetadataEntryId = sAlphanum32; - protected static final MetadataType[] sNoChildren = new MetadataType[0]; - - protected static final AttrType retsid = sAlphanum32; - protected static final AttrType retsname = sAlphanum64; - - public static final boolean STRICT_PARSING = true; - public static final boolean LOOSE_PARSING = false; - public static final boolean DEFAULT_PARSING = LOOSE_PARSING; - - /** the metdata path to this object */ - protected String path; - /** map of child type to map of child id to child object */ - protected Map childTypes; - /** map of attribute name to attribute object (as parsed by attrtype) */ - protected Map attributes; - /** map of attribute name to AttrType parser */ - protected Map attrTypes; - - - private static Map sAttributeMapCache = new HashMap(); - private MetaCollector mCollector; - private boolean strict; - - public MetaObject(boolean strictParsing) { - this.strict = strictParsing; - if (strictParsing) { - this.attributes = new HashMap(); - } else { - this.attributes = new CaseInsensitiveTreeMap(); - } - this.attrTypes = this.getAttributeMap(strictParsing); - MetadataType[] types = getChildTypes(); - this.childTypes = new HashMap(); - for (int i = 0; i < types.length; i++) { - this.childTypes.put(types[i], null); - } - } - - private Map getAttributeMap(boolean strictParsing) { - synchronized (sAttributeMapCache) { - Map map = sAttributeMapCache.get(new CacheKey(this, strictParsing)); - if (map == null) { - if (strictParsing) { - map = new HashMap(); - } else { - map = new CaseInsensitiveTreeMap(); - } - addAttributesToMap(map); - // Let's make sure no one mucks with the map later - map = Collections.unmodifiableMap(map); - sAttributeMapCache.put(new CacheKey(this, strictParsing), map); - if (LOG.isDebugEnabled()) { - LOG.debug("Adding to attribute cache: " + this.getClass().getName() + ", " + strictParsing); - } - } - return map; - } - } - - public static void clearAttributeMapCache() { - synchronized (sAttributeMapCache) { - sAttributeMapCache.clear(); - } - } - - public Collection getChildren(MetadataType type) { - if (!this.childTypes.containsKey(type)) { - // throw new IllegalArgumentException? - return null; - } - Object o = this.childTypes.get(type); - if (o == null) { - if (!fetchChildren(type)) { - return Collections.EMPTY_SET; - } - o = this.childTypes.get(type); - } - if (o instanceof Map) { - Map m = (Map) o; - return m.values(); - } - return (Collection) o; - } - - private boolean fetchChildren(MetadataType type) { - this.childTypes.put(type, new HashMap()); - try { - MetaObject[] children = null; - if (this.mCollector != null) { - children = this.mCollector.getMetadata(type, getPath()); - } - if (children == null) { - return false; - } - for (int i = 0; i < children.length; i++) { - MetaObject child = children[i]; - addChild(type, child); - } - } catch (MetadataException e) { - LOG.error(toString() + " unable to fetch " + type.name() + " children"); - return false; - } - return true; - } - - public MetaObject getChild(MetadataType type, String id) { - if (id == null) { - return null; - } - try { - if (this.childTypes.get(type) == null && this.mCollector != null) { - if (!fetchChildren(type)) { - return null; - } - } - Map m = (Map) this.childTypes.get(type); - if (m == null) { - return null; - } - return (MetaObject) m.get(id); - } catch (ClassCastException e) { - return null; - } - } - - public Object getAttribute(String key) { - return this.attributes.get(key); - } - - public Set getKnownAttributes() { - return this.attrTypes.keySet(); - } - - public String getAttributeAsString(String key) { - Object value = this.attributes.get(key); - if (value == null) { - return null; - } - if (this.attrTypes.containsKey(key)) { - AttrType type = (AttrType) this.attrTypes.get(key); - return type.render(value); - } - return value.toString(); - } - - protected Object getTypedAttribute(String key, Class type) { - AttrType atype = (AttrType) this.attrTypes.get(key); - if (atype == null) { - return null; - } - if (atype.getType() == type) { - return this.attributes.get(key); - } - LOG.warn("type mismatch, expected " + type.getName() + " but" + " got " + atype.getType().getName()); - return null; - } - - public String getDateAttribute(String key) { - return (String) getTypedAttribute(key, String.class); - } - - public String getStringAttribute(String key) { - return (String) getTypedAttribute(key, String.class); - } - - public int getIntAttribute(String key) { - Integer i = (Integer) getTypedAttribute(key, Integer.class); - if (i == null) { - return 0; - } - return i.intValue(); - } - - public boolean getBooleanAttribute(String key) { - Boolean b = (Boolean) getTypedAttribute(key, Boolean.class); - if (b == null) { - return false; - } - return b.booleanValue(); - } - - public void setAttribute(String key, String value) { - if (value == null) { - // LOG.warning() - return; - } - if (this.attrTypes.containsKey(key)) { - AttrType type = (AttrType) this.attrTypes.get(key); - try { - this.attributes.put(key, type.parse(value,this.strict)); - } catch (MetaParseException e) { - LOG.warn(toString() + " couldn't parse attribute " + key + ", value " + value + ": " + e.getMessage()); - } - } else { - this.attributes.put(key, value); - LOG.warn("Unknown key (" + toString() + "): " + key); - } - } - - public void addChild(MetadataType type, MetaObject child) { - if (this.childTypes.containsKey(type)) { - Object obj = this.childTypes.get(type); - Map map; - if (obj == null) { - map = new HashMap(); - this.childTypes.put(type, map); - } else { - map = (Map) obj; - } - if (child == null) { - return; - } - String id = child.getId(); - - child.setPath(this.getPath()); - child.setCollector(this.mCollector); - if (id != null) { - map.put(id, child); - } - return; - } - } - - public String getId() { - String idAttr = getIdAttr(); - if (idAttr == null) { - /** cheap hack so everything's a damn map */ - return Integer.toString(hashCode()); - } - return getAttributeAsString(idAttr); - } - - public String getPath() { - return this.path; - } - - protected void setPath(String parent) { - if (parent == null || parent.equals("")) { - this.path = getId(); - } else { - this.path = parent + ":" + getId(); - } - } - - @Override - public String toString() { - ToStringBuilder tsb = new ToStringBuilder(this); - Iterator iter = getKnownAttributes().iterator(); - while (iter.hasNext()) { - String key = (String) iter.next(); - tsb.append(key, getAttributeAsString(key)); - } - return tsb.toString(); - } - - public void setCollector(MetaCollector c) { - this.mCollector = c; - Iterator iterator = this.childTypes.keySet().iterator(); - while (iterator.hasNext()) { - MetadataType type = (MetadataType) iterator.next(); - Map map = (Map) this.childTypes.get(type); - if (map == null) { - continue; - } - Collection children = map.values(); - for (Iterator iter = children.iterator(); iter.hasNext();) { - MetaObject object = (MetaObject) iter.next(); - object.setCollector(c); - } - } - } - - public abstract MetadataType[] getChildTypes(); - - protected abstract String getIdAttr(); - - /** - * Adds attributes to an attribute map. This is called by the MetaObject - * constructor to initialize a map of atributes. This map may be cached, - * so this method may not be called for every object construction. - * - * @param attributeMap Map to add attributes to - */ - protected abstract void addAttributesToMap(Map attributeMap); - -} - -class CacheKey { - private Class mClass; - private boolean strictParsing; - - public CacheKey(MetaObject metaObject, boolean strictParsing) { - this.mClass = metaObject.getClass(); - this.strictParsing = strictParsing; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof CacheKey)) { - return false; - } - CacheKey rhs = (CacheKey) obj; - return new EqualsBuilder().append(this.mClass, rhs.mClass).append(this.strictParsing, rhs.strictParsing).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(this.mClass).append(this.strictParsing).toHashCode(); - } - -} - diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaParseException.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaParseException.java deleted file mode 100644 index 7b83bc1..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetaParseException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -public class MetaParseException extends MetadataException { - public MetaParseException() { - super(); - } - - public MetaParseException(String msg) { - super(msg); - } - - public MetaParseException(Throwable cause) { - super(cause); - } - - public MetaParseException(String msg, Throwable cause) { - super(msg, cause); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/Metadata.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/Metadata.java deleted file mode 100644 index 5c6fcea..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/Metadata.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.realtors.rets.common.metadata; - -import java.io.Serializable; - -import org.realtors.rets.common.metadata.types.MSystem; -import org.realtors.rets.common.metadata.types.MResource; -import org.realtors.rets.common.metadata.types.MForeignKey; -import org.realtors.rets.common.metadata.types.MClass; -import org.realtors.rets.common.metadata.types.MTable; -import org.realtors.rets.common.metadata.types.MUpdate; -import org.realtors.rets.common.metadata.types.MUpdateType; -import org.realtors.rets.common.metadata.types.MObject; -import org.realtors.rets.common.metadata.types.MValidationExternal; -import org.realtors.rets.common.metadata.types.MValidationLookup; -import org.realtors.rets.common.metadata.types.MLookup; -import org.realtors.rets.common.metadata.types.MSearchHelp; - -public class Metadata implements Serializable { - - protected MSystem system; - - public Metadata(MetaCollector collector) throws MetadataException { - MetaObject[] sys = collector.getMetadata(MetadataType.SYSTEM, null); - if (sys != null && sys.length == 1) { - try { - this.system = (MSystem) sys[0]; - } catch (ClassCastException e) { - throw new MetadataException(e); - } - this.system.setCollector(collector); - } - } - - public Metadata(MSystem system) { - this.system = system; - } - - public MSystem getSystem() { - return this.system; - } - - public MResource getResource(String resourceId) { - return this.system.getMResource(resourceId); - } - - public MForeignKey getForeignKey(String foreignKeyId) { - return this.system.getMForeignKey(foreignKeyId); - } - - public MClass getMClass(String resourceId, String className) { - MResource resource = getResource(resourceId); - if (resource == null) { - return null; - } - return resource.getMClass(className); - } - - public MTable getTable(String resourceId, String className, String systemName) { - MClass clazz = getMClass(resourceId, className); - if (clazz == null) { - return null; - } - return clazz.getMTable(systemName); - } - - public MUpdate getUpdate(String resourceId, String className, String updateName) { - MClass clazz = getMClass(resourceId, className); - if (clazz == null) { - return null; - } - return clazz.getMUpdate(updateName); - } - - public MUpdateType getUpdateType(String resourceId, String className, String updateName, String systemName) { - MUpdate update = getUpdate(resourceId, className, updateName); - if (update == null) { - return null; - } - return update.getMUpdateType(systemName); - } - - public MObject getObject(String resourceId, String objectType) { - MResource resource = getResource(resourceId); - if (resource == null) { - return null; - } - return resource.getMObject(objectType); - } - - public MLookup getLookup(String resourceId, String lookupName) { - MResource resource = getResource(resourceId); - if (resource == null) { - return null; - } - return resource.getMLookup(lookupName); - } - - public MSearchHelp getSearchHelp(String resourceId, String searchHelpId) { - MResource resource = getResource(resourceId); - if (resource == null) { - return null; - } - return resource.getMSearchHelp(searchHelpId); - } - - public MValidationExternal getValidationExternal(String resourceId, String validationExternalName) { - MResource resource = getResource(resourceId); - if (resource == null) { - return null; - } - return resource.getMValidationExternal(validationExternalName); - } - - public MValidationLookup getValidationLookup(String resourceId, String validationLookupName) { - MResource resource = getResource(resourceId); - if (resource == null) { - return null; - } - return resource.getMValidationLookup(validationLookupName); - } - - private String getResourceId(MetaObject obj) { - String path = obj.getPath(); - int index = path.indexOf(':'); - if (index == -1) { - return null; - } - String resource = path.substring(0, index); - return resource; - } - - public MResource getResource(MTable field) { - String resource = getResourceId(field); - return getResource(resource); - } - - public MLookup getLookup(MTable field) { - String resource = getResourceId(field); - return getLookup(resource, field.getLookupName()); - } - - public MSearchHelp getSearchHelp(MTable field) { - String searchHelpID = field.getSearchHelpID(); - if (searchHelpID == null) { - return null; - } - String resource = getResourceId(field); - return getSearchHelp(resource, searchHelpID); - } - - public MResource getResource(MClass clazz) { - return getResource(getResourceId(clazz)); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataBuilder.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataBuilder.java deleted file mode 100644 index e8085b8..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataBuilder.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -import org.realtors.rets.common.metadata.types.MClass; -import org.realtors.rets.common.metadata.types.MEditMask; -import org.realtors.rets.common.metadata.types.MForeignKey; -import org.realtors.rets.common.metadata.types.MLookup; -import org.realtors.rets.common.metadata.types.MLookupType; -import org.realtors.rets.common.metadata.types.MObject; -import org.realtors.rets.common.metadata.types.MResource; -import org.realtors.rets.common.metadata.types.MSearchHelp; -import org.realtors.rets.common.metadata.types.MSystem; -import org.realtors.rets.common.metadata.types.MTable; -import org.realtors.rets.common.metadata.types.MUpdate; -import org.realtors.rets.common.metadata.types.MUpdateHelp; -import org.realtors.rets.common.metadata.types.MUpdateType; -import org.realtors.rets.common.metadata.types.MValidationExpression; -import org.realtors.rets.common.metadata.types.MValidationExternal; -import org.realtors.rets.common.metadata.types.MValidationExternalType; -import org.realtors.rets.common.metadata.types.MValidationLookup; -import org.realtors.rets.common.metadata.types.MValidationLookupType; - -public abstract class MetadataBuilder { - protected MetadataBuilder() { - this.mStrict = false; - } - - public boolean isStrict() { - return this.mStrict; - } - - public void setStrict(boolean strict) { - this.mStrict = strict; - } - - protected Metadata finish(MSystem system) { - return new Metadata(system); - } - - protected static void setAttribute(MetaObject obj, String key, String value) { - obj.setAttribute(key, value); - } - - protected MSystem buildSystem() { - MSystem system = new MSystem(this.mStrict); - return system; - } - - protected MResource buildResource() { - MResource resource = new MResource(this.mStrict); - return resource; - } - - protected MForeignKey buildForeignKey() { - MForeignKey key = new MForeignKey(this.mStrict); - return key; - } - - protected MClass buildClass() { - MClass clazz = new MClass(this.mStrict); - return clazz; - } - - protected MTable buildTable() { - MTable table = new MTable(this.mStrict); - return table; - } - - protected MUpdate buildUpdate() { - MUpdate update = new MUpdate(this.mStrict); - return update; - } - - protected MUpdateType buildUpdateType() { - MUpdateType updatetype = new MUpdateType(this.mStrict); - return updatetype; - } - - protected MObject buildObject() { - MObject obj = new MObject(this.mStrict); - return obj; - } - - protected MSearchHelp buildSearchHelp() { - MSearchHelp help = new MSearchHelp(this.mStrict); - return help; - } - - protected MEditMask buildEditMask() { - MEditMask mask = new MEditMask(this.mStrict); - return mask; - } - - protected MLookup buildLookup() { - MLookup lookup = new MLookup(this.mStrict); - return lookup; - } - - protected MLookupType buildLookupType() { - MLookupType type = new MLookupType(this.mStrict); - return type; - } - - protected MUpdateHelp buildUpdateHelp() { - MUpdateHelp help = new MUpdateHelp(this.mStrict); - return help; - } - - protected MValidationLookup buildValidationLookup() { - MValidationLookup lookup = new MValidationLookup(this.mStrict); - return lookup; - } - - protected MValidationExternalType buildValidationExternalType() { - MValidationExternalType type = new MValidationExternalType(this.mStrict); - return type; - } - - protected MValidationExpression buildValidationExpression() { - MValidationExpression expression = new MValidationExpression(this.mStrict); - return expression; - } - - protected MValidationExternal buildValidationExternal() { - MValidationExternal external = new MValidationExternal(this.mStrict); - return external; - } - - protected MValidationLookupType buildValidationLookupType() { - MValidationLookupType lookupType = new MValidationLookupType(this.mStrict); - return lookupType; - } - - public abstract Metadata doBuild(Object src) throws MetadataException; - - public abstract MetaObject[] parse(Object src) throws MetadataException; - - protected MetaObject newType(MetadataType type) { - if (type == MetadataType.SYSTEM) { - return buildSystem(); - } - if (type == MetadataType.RESOURCE) { - return buildResource(); - } - if (type == MetadataType.FOREIGNKEYS) { - return buildForeignKey(); - } - if (type == MetadataType.CLASS) { - return buildClass(); - } - if (type == MetadataType.TABLE) { - return buildTable(); - } - if (type == MetadataType.UPDATE) { - return buildUpdate(); - } - if (type == MetadataType.UPDATE_TYPE) { - return buildUpdateType(); - } - if (type == MetadataType.OBJECT) { - return buildObject(); - } - if (type == MetadataType.SEARCH_HELP) { - return buildSearchHelp(); - } - if (type == MetadataType.EDITMASK) { - return buildEditMask(); - } - if (type == MetadataType.UPDATE_HELP) { - return buildUpdateHelp(); - } - if (type == MetadataType.LOOKUP) { - return buildLookup(); - } - if (type == MetadataType.LOOKUP_TYPE) { - return buildLookupType(); - } - if (type == MetadataType.VALIDATION_LOOKUP) { - return buildValidationLookup(); - } - if (type == MetadataType.VALIDATION_LOOKUP_TYPE) { - return buildValidationLookupType(); - } - if (type == MetadataType.VALIDATION_EXTERNAL) { - return buildValidationExternal(); - } - if (type == MetadataType.VALIDATION_EXTERNAL_TYPE) { - return buildValidationExternalType(); - } - if (type == MetadataType.VALIDATION_EXPRESSION) { - return buildValidationExpression(); - } - throw new RuntimeException("No metadata type class found for " + type.name()); - } - - private boolean mStrict; -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataElement.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataElement.java deleted file mode 100644 index b517251..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataElement.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.realtors.rets.common.metadata; - -public enum MetadataElement { - SYSTEM("System"),// might need to provide enumeration for different versions 1.5 vs 1.7 - RESOURCE("Resource"), - FOREIGNKEY("ForeignKey"), - CLASS("Class"), - TABLE("Field"), - UPDATE("UpdateType"), - UPDATETYPE("UpdateField"), - OBJECT("Object"), - SEARCHHELP("SearchHelp"), - EDITMASK("EditMask"), - UPDATEHELP("UpdateHelp"), - LOOKUP("Lookup"), - LOOKUPTYPE("LookupType"), - VALIDATIONLOOKUP("ValidationLookup"), - VALIDATIONLOOKUPTYPE("ValidationLookupType"), - VALIDATIONEXPRESSION("ValidationExpression"), - VALIDATIONEXTERNAL("ValidationExternalType"), - VALIDATIONEXTERNALTYPE("ValidationExternal"); - - private final String elementName; - - MetadataElement(String elementName){ - this.elementName = elementName; - } - - public String elementName(){ return this.elementName;} - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataException.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataException.java deleted file mode 100644 index 3d8d3ee..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataException.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -import org.apache.commons.lang.exception.NestableException; - -public class MetadataException extends NestableException { - public MetadataException() { - super(); - } - - public MetadataException(String msg) { - super(msg); - } - - public MetadataException(Throwable cause) { - super(cause); - } - - public MetadataException(String msg, Throwable cause) { - super(msg, cause); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataType.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataType.java deleted file mode 100644 index f37d7a5..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/MetadataType.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata; - -public enum MetadataType { - EDITMASK, - FOREIGNKEYS, - RESOURCE, - LOOKUP, - LOOKUP_TYPE, - OBJECT, - SEARCH_HELP, - SYSTEM, - TABLE, - UPDATE, - UPDATE_HELP, - UPDATE_TYPE, - VALIDATION_EXPRESSION, - VALIDATION_EXTERNAL, - VALIDATION_EXTERNAL_TYPE, - VALIDATION_LOOKUP, - VALIDATION_LOOKUP_TYPE, - CLASS; - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrAbstractText.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrAbstractText.java deleted file mode 100644 index eb32065..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrAbstractText.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaParseException; - -public abstract class AttrAbstractText implements AttrType { - protected int min; - protected int max; - - public AttrAbstractText(int min, int max) { - this.min = min; - this.max = max; - } - - - public String parse(String value, boolean strict) throws MetaParseException { - if( !strict ) - return value; - int l = value.length(); - if (this.min != 0 && l < this.min) { - throw new MetaParseException("Value too short (min " + this.min + "): " + l); - } - if (this.max != 0 && l > this.max) { - throw new MetaParseException("Value too long (max " + this.max + "): " + l); - } - checkContent(value); - return value; - } - - - public Class getType() { - return String.class; - } - - - public String render(String value) { - return value; - } - - protected abstract void checkContent(String value) throws MetaParseException; - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrAlphanum.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrAlphanum.java deleted file mode 100644 index 3a2e721..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrAlphanum.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrAlphanum extends AttrAbstractText { - - public AttrAlphanum(int min, int max) { - super(min, max); - } - - @Override - protected void checkContent(String value) throws MetaParseException { - char[] chars = value.toCharArray(); - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - if (!Character.isLetterOrDigit(c)) { - // illegal but exist in CRT metadata - if ("_- ".indexOf(c) == -1) { - throw new MetaParseException("Invalid Alphanum character at position " + i + ": " + c); - } - } - } - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrBoolean.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrBoolean.java deleted file mode 100644 index cba0304..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrBoolean.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrBoolean implements AttrType { - public Boolean parse(String value, boolean strict) throws MetaParseException { - if (value.equals("1")) { - return Boolean.TRUE; - } - if (value.equals("0")) { - return Boolean.FALSE; - } - - if (value.equalsIgnoreCase("true")) { - return Boolean.TRUE; - } - if (value.equalsIgnoreCase("false")) { - return Boolean.FALSE; - } - - if (value.equalsIgnoreCase("Y")) { - return Boolean.TRUE; - } - if (value.equalsIgnoreCase("N")) { - return Boolean.FALSE; - } - - if (value.equals("")) { - return Boolean.FALSE; - } - - if( strict ) - throw new MetaParseException("Invalid boolean value: " + value); - return false; - } - - public String render(Boolean value) { - if( value.booleanValue() ) return "1"; - - return "0"; - } - - public Class getType() { - return Boolean.class; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrDate.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrDate.java deleted file mode 100644 index 62e947f..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrDate.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - * - * - * Vangulo Changed: - * gives ability to handle dates in this format - * 2011-06-01T18:06:58 - * should find a more elegant way - */ -package org.realtors.rets.common.metadata.attrib; - -//import java.text.DateFormat; -//import java.text.ParseException; -//import java.text.SimpleDateFormat; -//import java.util.Date; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaParseException; - -/** - * Converted this class to return a String instead of a - * Date object which allows for more flexiblity since - * Many Rets Servers format their dates differently - * - * @author vangulo - * - */ -public class AttrDate implements AttrType { - - // need date attribute to be flexible since different MLS's have - // different formats for dates - public String parse(String value, boolean strict) throws MetaParseException { - return value; -// Date d; -// try { -// d = this.df.parse(value); -// } catch (ParseException e) { -// if( strict ) -// throw new MetaParseException(e); -// try { -// value = value.replaceAll("[A-Za-z]", " "); -// d = this.df1.parse(value); -// } catch (ParseException e1) { -// //e1.printStackTrace(); -// return value; -// } -// return d; -// } -// return d; - } - - public String render(String value) { - return value; - //Date date = value; - //return this.df.format(date); - } - - public Class getType() { - return String.class; - } - - //private DateFormat df = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss z"); - //2011-06-01T18:06:58 - //private DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - //Tuesday, 22-Dec-2009 21:03:18 GMT - //private DateFormat df2 = new SimpleDateFormat("E, dd-MMM-yyyy HH:mm:ss z"); -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrEnum.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrEnum.java deleted file mode 100644 index 3aa12f3..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrEnum.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import java.util.HashMap; -import java.util.Map; -import java.util.Collections; - -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrEnum extends AttrAbstractText { - public AttrEnum(String[] values) { - super(0, 0); - this.map = new HashMap(); - for (String value : values) this.map.put(value, value); - this.map = Collections.unmodifiableMap(this.map); - } - - @Override - protected void checkContent(String value) throws MetaParseException { - if( !this.map.containsKey(value) ) - throw new MetaParseException("Invalid key: " + value); - } - - private Map map; -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrGenericText.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrGenericText.java deleted file mode 100644 index 48247dd..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrGenericText.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.attrib.AttrAbstractText; -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrGenericText extends AttrAbstractText { - private String mChars; - - public AttrGenericText(int min, int max, String chars) { - super(min, max); - this.mChars = chars; - } - - @Override - protected void checkContent(String value) throws MetaParseException { - char[] chars = value.toCharArray(); - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - if (this.mChars.indexOf(c) == -1) { - throw new MetaParseException("Invalid char (" + c + ") at position " + i); - } - } - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrNumeric.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrNumeric.java deleted file mode 100644 index 55806aa..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrNumeric.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrNumeric implements AttrType { - public Integer parse(String value, boolean strict) throws MetaParseException { - try { - return new Integer(value); - } catch (NumberFormatException e) { - if( strict ) - throw new MetaParseException(e); - return 0; - } - } - - public String render(Integer value) { - return value.toString(); - } - - public Class getType() { - return Integer.class; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrNumericPositive.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrNumericPositive.java deleted file mode 100644 index 2359476..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrNumericPositive.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrNumericPositive implements AttrType { - - public Integer parse(String value, boolean strict) throws MetaParseException { - try { - Integer integer = new Integer(value); - if (strict && integer < 1) throw new IllegalArgumentException(String.format("%s is not positive", value)); - return integer; - } catch (Exception e) { - if( strict ) - throw new MetaParseException(e); - return 1; - } - } - - - public String render(Integer value) { - return value.toString(); - } - - - public Class getType() { - return Integer.class; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrPlaintext.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrPlaintext.java deleted file mode 100644 index b73d7fd..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrPlaintext.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrPlaintext extends AttrAbstractText { - public AttrPlaintext(int min, int max) { - super(min, max); - } - - @Override - protected void checkContent(String value) throws MetaParseException { - char[] chars = value.toCharArray(); - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - if (c < 31 || c > 126) { - throw new MetaParseException("Invalid character (ordinal " + (int) c + ") at position " + i); - } - } - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrText.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrText.java deleted file mode 100644 index d0b7ba3..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrText.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.realtors.rets.common.metadata.MetaParseException; - -public class AttrText extends AttrAbstractText { - public AttrText(int min, int max) { - super(min, max); - } - - @Override - protected void checkContent(String value) throws MetaParseException { - char[] chars = value.toCharArray(); - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - if (!(c == '\n' || c == '\r' || c == ' ' || c == '\t' || (c > 31 && c < 127))) { - throw new MetaParseException("Invalid character (ordinal " + (int) c + ") at position " + i); - } - } - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrVersion.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrVersion.java deleted file mode 100644 index 66b997b..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/attrib/AttrVersion.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * cart: CRT's Awesome RETS Tool - * - * Author: David Terrell - * Copyright (c) 2003, The National Association of REALTORS - * Distributed under a BSD-style license. See LICENSE.TXT for details. - */ -package org.realtors.rets.common.metadata.attrib; - -import org.apache.commons.lang.StringUtils; -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaParseException; - -/** - * A version is a string formatted "major.minor.release". This gets converted - * to an integer such as major * 10,000,000 + minor * 100,000 + release. - */ -public class AttrVersion implements AttrType { - - public Integer parse(String value, boolean strict) throws MetaParseException { - String[] parts = StringUtils.split(value, "."); - int major, minor, release; - if (strict && parts != null && parts.length != 3) { - throw new MetaParseException("Invalid version: " + value + ", " + parts.length + " parts"); - } - try { - major = Integer.parseInt(this.getPart(parts,0)); - minor = Integer.parseInt(this.getPart(parts,1)); - release = Integer.parseInt(this.getPart(parts,2)); - } catch (NumberFormatException e) { - throw new MetaParseException("Invalid version: " + value, e); - } - if ((major < 100) && (major >= 0) && (minor < 100) && (minor >= 0) && (release < 100000) && (release >= 0)) { - return new Integer(major * 10000000 + minor * 100000 + release); - } - if( strict ) - throw new MetaParseException("Invalid version: " + value); - return 0; - } - private String getPart(String[] parts, int part){ - if( parts != null && parts.length > part ) return parts[part]; - return "0"; - } - - - public String render(Integer value) { - int ver = value.intValue(); - int release = ver % 100000; - int minor = (ver / 100000) % 100; - int major = (ver / 10000000); - String minstr = Integer.toString(minor); - String relstr = Integer.toString(release); - while (minstr.length() < 2) { - minstr = "0" + minstr; - } - while (relstr.length() < 5) { - relstr = "0" + relstr; - } - return major + "." + minstr + "." + relstr; - } - - - public Class getType() { - return Integer.class; - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MClass.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MClass.java deleted file mode 100644 index 408aea8..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MClass.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Collection; -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MClass extends MetaObject { - public static final String CLASSNAME = "ClassName"; - public static final String VISIBLENAME = "VisibleName"; - public static final String STANDARDNAME = "StandardName"; - public static final String DESCRIPTION = "Description"; - public static final String TABLEVERSION = "TableVersion"; - public static final String TABLEDATE = "TableDate"; - public static final String UPDATEVERSION = "UpdateVersion"; - public static final String UPDATEDATE = "UpdateDate"; - public static final String DELETEDFLAGFIELD = "DeletedFlagField"; - public static final String DELETEDFLAGVALUE = "DeletedFlagValue"; - public static final String CLASSTIMESTAMP = "ClassTimeStamp"; - public static final String HASHKEYINDEX = "HasKeyIndex"; - private static MetadataType[] sTypes = { MetadataType.UPDATE, MetadataType.TABLE }; - - public MClass() { - this(DEFAULT_PARSING); - } - - public MClass(boolean strictParsing) { - super(strictParsing); - } - - @Override - public MetadataType[] getChildTypes() { - return sTypes; - } - - public String getClassName() { - return getStringAttribute(CLASSNAME); - } - - public String getVisibleName() { - return getStringAttribute(VISIBLENAME); - } - - public String getStandardName() { - return getStringAttribute(STANDARDNAME); - } - - public String getDescription() { - return getStringAttribute(DESCRIPTION); - } - - public int getTableVersion() { - return getIntAttribute(TABLEVERSION); - } - - public String getTableDate() { - return getDateAttribute(TABLEDATE); - } - - public int getUpdateVersion() { - return getIntAttribute(UPDATEVERSION); - } - - public String getUpdateDate() { - return getDateAttribute(UPDATEDATE); - } - - public MUpdate getMUpdate(String updateName) { - return (MUpdate) getChild(MetadataType.UPDATE, updateName); - } - - public MUpdate[] getMUpdates() { - MUpdate[] tmpl = new MUpdate[0]; - return (MUpdate[]) getChildren(MetadataType.UPDATE).toArray(tmpl); - } - - public MTable getMTable(String systemName) { - return (MTable) getChild(MetadataType.TABLE, systemName); - } - - public MTable[] getMTables() { - Collection children = getChildren(MetadataType.TABLE); - return (MTable[]) children.toArray(new MTable[0]); - } - - @Override - protected String getIdAttr() { - return CLASSNAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(CLASSNAME, sAlphanum32); - attributeMap.put(VISIBLENAME, sPlaintext32); - attributeMap.put(STANDARDNAME, sAlphanum32); - attributeMap.put(DESCRIPTION, sPlaintext128); - attributeMap.put(TABLEVERSION, sAttrVersion); - attributeMap.put(TABLEDATE, sAttrDate); - attributeMap.put(UPDATEVERSION, sAttrVersion); - attributeMap.put(UPDATEDATE, sAttrDate); - attributeMap.put(DELETEDFLAGFIELD, retsname); - attributeMap.put(DELETEDFLAGVALUE, sAlphanum32); - attributeMap.put(CLASSTIMESTAMP, retsname); - attributeMap.put(HASHKEYINDEX, sAttrBoolean); - } - - - public String getDeletedFlagField() { - return getStringAttribute(DELETEDFLAGFIELD); - } - - public String getDeletedFlagValue() { - return getStringAttribute(DELETEDFLAGVALUE); - } - - public String getClassTimeStamp() { - return getStringAttribute(CLASSTIMESTAMP); - } - - public String getHashKeyIndex() { - return getStringAttribute(HASHKEYINDEX); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MEditMask.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MEditMask.java deleted file mode 100644 index 2efca83..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MEditMask.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MEditMask extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String EDITMASKID = "EditMaskID"; - public static final String VALUE = "Value"; - - public MEditMask() { - this(DEFAULT_PARSING); - } - - public MEditMask(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getEditMaskID() { - return getStringAttribute(EDITMASKID); - } - - public String getValue() { - return getStringAttribute(VALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return EDITMASKID; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(EDITMASKID, sAlphanum32); - attributeMap.put(VALUE, sText256); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MForeignKey.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MForeignKey.java deleted file mode 100644 index a6e3b8e..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MForeignKey.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MForeignKey extends MetaObject { - public static final String FOREIGNKEYID = "ForeignKeyID"; - public static final String PARENTRESOURCEID = "ParentResourceID"; - public static final String PARENTCLASSID = "ParentClassID"; - public static final String PARENTSYSTEMNAME = "ParentSystemName"; - public static final String CHILDRESOURCEID = "ChildResourceID"; - public static final String CHILDCLASSID = "ChildClassID"; - public static final String CHILDSYSTEMNAME = "ChildSystemName"; - public static final String CONDITIONALPARENTFIELD = "ConditionalParentField"; - public static final String CONDITIONALPARENTVALUE = "ConditionalParentValue"; - - - public MForeignKey() { - this(DEFAULT_PARSING); - } - - public MForeignKey(boolean strictParsing) { - super(strictParsing); - } - - public String getForeignKeyID() { - return getStringAttribute(FOREIGNKEYID); - } - - public String getParentResourceID() { - return getStringAttribute(PARENTRESOURCEID); - } - - public String getParentClassID() { - return getStringAttribute(PARENTCLASSID); - } - - public String getParentSystemName() { - return getStringAttribute(PARENTSYSTEMNAME); - } - - public String getChildResourceID() { - return getStringAttribute(CHILDRESOURCEID); - } - - public String getChildClassID() { - return getStringAttribute(CHILDCLASSID); - } - - public String getChildSystemName() { - return getStringAttribute(CHILDSYSTEMNAME); - } - - public String getConditionalParentField() { - return getStringAttribute(CONDITIONALPARENTFIELD); - } - - public String getConditionalParentValue() { - return getStringAttribute(CONDITIONALPARENTVALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return FOREIGNKEYID; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(FOREIGNKEYID, sAlphanum32); - attributeMap.put(PARENTRESOURCEID, sAlphanum32); - attributeMap.put(PARENTCLASSID, sAlphanum32); - attributeMap.put(PARENTSYSTEMNAME, sAlphanum32); - attributeMap.put(CHILDRESOURCEID, sAlphanum32); - attributeMap.put(CHILDCLASSID, sAlphanum32); - attributeMap.put(CHILDSYSTEMNAME, sAlphanum32); - attributeMap.put(CONDITIONALPARENTFIELD, retsname); - attributeMap.put(CONDITIONALPARENTVALUE, retsname); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MLookup.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MLookup.java deleted file mode 100644 index 3204b54..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MLookup.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MLookup extends MetaObject { - private static final MetadataType[] CHILDREN = { MetadataType.LOOKUP_TYPE }; - private static final MLookupType[] EMPTYLOOKUPTYPES = {}; - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String LOOKUPNAME = "LookupName"; - public static final String VISIBLENAME = "VisibleName"; - public static final String VERSION = "Version"; - public static final String DATE = "Date"; - public static final String LOOKUPTYPEVERSION = "LookupTypeVersion"; - public static final String LOOKUPTYPEDATE = "LookupTypeDate"; - - public MLookup() { - this(DEFAULT_PARSING); - } - - public MLookup(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getLookupName() { - return getStringAttribute(LOOKUPNAME); - } - - public String getVisibleName() { - return getStringAttribute(VISIBLENAME); - } - - public int getVersion() { - - int ver = getIntAttribute(VERSION); - if (ver == 0){ - ver = getIntAttribute(LOOKUPTYPEVERSION); - } - return ver; - } - - public String getDate() { - String date = getDateAttribute(DATE); - if (date == null) { - date = getDateAttribute(LOOKUPTYPEDATE); - } - return date; - } - - public MLookupType getMLookupType(String value) { - return (MLookupType) getChild(MetadataType.LOOKUP_TYPE, value); - } - - public MLookupType[] getMLookupTypes() { - return (MLookupType[]) getChildren(MetadataType.LOOKUP_TYPE).toArray(EMPTYLOOKUPTYPES); - } - - @Override - public MetadataType[] getChildTypes() { - return CHILDREN; - } - - @Override - protected String getIdAttr() { - return LOOKUPNAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(LOOKUPNAME, sAlphanum32); - attributeMap.put(VISIBLENAME, sPlaintext32); - attributeMap.put(VERSION, sAttrVersion); - attributeMap.put(DATE, sAttrDate); - attributeMap.put(LOOKUPTYPEVERSION, sAttrVersion); - attributeMap.put(LOOKUPTYPEDATE, sAttrDate); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MLookupType.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MLookupType.java deleted file mode 100644 index c4af351..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MLookupType.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MLookupType extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String LONGVALUE = "LongValue"; - public static final String SHORTVALUE = "ShortValue"; - public static final String VALUE = "Value"; - - public MLookupType() { - this(DEFAULT_PARSING); - } - - public MLookupType(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getLongValue() { - return getStringAttribute(LONGVALUE); - } - - public String getShortValue() { - return getStringAttribute(SHORTVALUE); - } - - public String getValue() { - return getStringAttribute(VALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return VALUE; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(LONGVALUE, sText128); - attributeMap.put(SHORTVALUE, sText32); - attributeMap.put(VALUE, sAlphanum32); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MObject.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MObject.java deleted file mode 100644 index c8d027c..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MObject.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MObject extends MetaObject { - - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String OBJECTTYPE = "ObjectType"; - public static final String MIMETYPE = "MimeType"; - public static final String VISIBLENAME = "VisibleName"; - public static final String DESCRIPTION = "Description"; - public static final String OBJECTTIMESTAMPNAME = "ObjectTimeStamp"; - public static final String OBJECTCOUNT = "ObjectCount"; - public static final String STANDARDNAME = "StandardName"; - public MObject() { - this(DEFAULT_PARSING); - } - - public MObject(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getObjectType() { - return getStringAttribute(OBJECTTYPE); - } - - public String getMIMEType() { - return getStringAttribute(MIMETYPE); - } - - public String getVisibleName() { - return getStringAttribute(VISIBLENAME); - } - - public String getDescription() { - return getStringAttribute(DESCRIPTION); - } - public String getStandardName() { - return getStringAttribute(STANDARDNAME); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return OBJECTTYPE; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAlphanum24); - attributeMap.put(OBJECTTYPE, sAlphanum24); - attributeMap.put(MIMETYPE, sText64); - attributeMap.put(VISIBLENAME, sPlaintext64); - attributeMap.put(DESCRIPTION, sPlaintext128); - attributeMap.put(OBJECTTIMESTAMPNAME, retsname); - attributeMap.put(OBJECTCOUNT, retsname); - attributeMap.put(STANDARDNAME, retsname); - } - - public String getObjectTimeStampName() { - return getStringAttribute(OBJECTTIMESTAMPNAME); - } - - public String getObjectCount() { - return getStringAttribute(OBJECTCOUNT); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MResource.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MResource.java deleted file mode 100644 index 8cd1ed3..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MResource.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MResource extends MetaObject { - private static final MetadataType[] CHILDREN = { - MetadataType.VALIDATION_EXPRESSION, - MetadataType.LOOKUP, - MetadataType.CLASS, - MetadataType.OBJECT, - MetadataType.VALIDATION_EXTERNAL, - MetadataType.VALIDATION_LOOKUP, - MetadataType.EDITMASK, - MetadataType.UPDATE_HELP, - MetadataType.SEARCH_HELP - }; - - public static final String RESOURCEID = "ResourceID"; - public static final String STANDARDNAME = "StandardName"; - public static final String VISIBLENAME = "VisibleName"; - public static final String DESCRIPTION = "Description"; - public static final String KEYFIELD = "KeyField"; - public static final String CLASSCOUNT = "ClassCount"; - public static final String CLASSVERSION = "ClassVersion"; - public static final String CLASSDATE = "ClassDate"; - public static final String OBJECTVERSION = "ObjectVersion"; - public static final String OBJECTDATE = "ObjectDate"; - public static final String SEARCHHELPVERSION = "SearchHelpVersion"; - public static final String SEARCHHELPDATE = "SearchHelpDate"; - public static final String EDITMASKVERSION = "EditMaskVersion"; - public static final String EDITMASKDATE = "EditMaskDate"; - public static final String LOOKUPVERSION = "LookupVersion"; - public static final String LOOKUPDATE = "LookupDate"; - public static final String UPDATEHELPVERSION = "UpdateHelpVersion"; - public static final String UPDATEHELPDATE = "UpdateHelpDate"; - public static final String VALIDATIONEXPRESSIONVERSION = "ValidationExpressionVersion"; - public static final String VALIDATIONEXPRESSIONDATE = "ValidationExpressionDate"; - public static final String VALIDATIONLOOKUPVERSION = "ValidationLookupVersion"; - public static final String VALIDATIONLOOKUPDATE = "ValidationLookupDate"; - public static final String VALIDATIONEXTERNALVERSION = "ValidationExternalVersion"; - public static final String VALIDATIONEXTERNALDATE = "ValidationExternalDate"; - - public MResource() { - this(DEFAULT_PARSING); - } - - public MResource(boolean strictParsing) { - super(strictParsing); - } - - public String getResourceID() { - return getStringAttribute(RESOURCEID); - } - - public String getStandardName() { - return getStringAttribute(STANDARDNAME); - } - - public String getVisibleName() { - return getStringAttribute(VISIBLENAME); - } - - public String getDescription() { - return getStringAttribute(DESCRIPTION); - } - - public String getKeyField() { - return getStringAttribute(KEYFIELD); - } - - public int getClassCount() { - return getIntAttribute(CLASSCOUNT); - } - - public int getClassVersion() { - return getIntAttribute(CLASSVERSION); - } - - public String getClassDate() { - return getDateAttribute(CLASSDATE); - } - - public int getObjectVersion() { - return getIntAttribute(OBJECTVERSION); - } - - public String getObjectDate() { - return getDateAttribute(OBJECTDATE); - } - - public int getSearchHelpVersion() { - return getIntAttribute(SEARCHHELPVERSION); - } - - public String getSearchHelpDate() { - return getDateAttribute(SEARCHHELPDATE); - } - - public int getEditMaskVersion() { - return getIntAttribute(EDITMASKVERSION); - } - - public String getEditMaskDate() { - return getDateAttribute(EDITMASKDATE); - } - - public int getLookupVersion() { - return getIntAttribute(LOOKUPVERSION); - } - - public String getLookupDate() { - return getDateAttribute(LOOKUPDATE); - } - - public int getUpdateHelpVersion() { - return getIntAttribute(UPDATEHELPVERSION); - } - - public String getUpdateHelpDate() { - return getDateAttribute(UPDATEHELPDATE); - } - - public int getValidationExpressionVersion() { - return getIntAttribute(VALIDATIONEXPRESSIONVERSION); - } - - public String getValidationExpressionDate() { - return getDateAttribute(VALIDATIONEXPRESSIONDATE); - } - - public int getValidationLookupVersion() { - return getIntAttribute(VALIDATIONLOOKUPVERSION); - } - - public String getValidationLookupDate() { - return getDateAttribute(VALIDATIONLOOKUPDATE); - } - - public int getValidationExternalVersion() { - return getIntAttribute(VALIDATIONEXTERNALVERSION); - } - - public String getValidationExternalDate() { - return getDateAttribute(VALIDATIONEXTERNALDATE); - } - - public MValidationExpression getMValidationExpression(String validationExpressionID) { - return (MValidationExpression) getChild(MetadataType.VALIDATION_EXPRESSION, validationExpressionID); - } - - public MValidationExpression[] getMValidationExpressions() { - MValidationExpression[] tmpl = new MValidationExpression[0]; - return (MValidationExpression[]) getChildren(MetadataType.VALIDATION_EXPRESSION).toArray(tmpl); - } - - public MLookup getMLookup(String lookupName) { - return (MLookup) getChild(MetadataType.LOOKUP, lookupName); - } - - public MLookup[] getMLookups() { - MLookup[] tmpl = new MLookup[0]; - return (MLookup[]) getChildren(MetadataType.LOOKUP).toArray(tmpl); - } - - public MClass getMClass(String className) { - return (MClass) getChild(MetadataType.CLASS, className); - } - - public MClass[] getMClasses() { - MClass[] tmpl = new MClass[0]; - return (MClass[]) getChildren(MetadataType.CLASS).toArray(tmpl); - } - - public MObject getMObject(String objectType) { - return (MObject) getChild(MetadataType.OBJECT, objectType); - } - - public MObject[] getMObjects() { - MObject[] tmpl = new MObject[0]; - return (MObject[]) getChildren(MetadataType.OBJECT).toArray(tmpl); - } - - public MValidationExternal getMValidationExternal(String validationExternalName) { - return (MValidationExternal) getChild(MetadataType.VALIDATION_EXTERNAL, validationExternalName); - } - - public MValidationExternal[] getMValidationExternal() { - MValidationExternal[] tmpl = new MValidationExternal[0]; - return (MValidationExternal[]) getChildren(MetadataType.VALIDATION_EXTERNAL).toArray(tmpl); - } - - public MValidationLookup getMValidationLookup(String validationLookupName) { - return (MValidationLookup) getChild(MetadataType.VALIDATION_LOOKUP, validationLookupName); - } - - public MValidationLookup[] getMValidationLookups() { - MValidationLookup[] tmpl = new MValidationLookup[0]; - return (MValidationLookup[]) getChildren(MetadataType.VALIDATION_LOOKUP).toArray(tmpl); - } - - public MEditMask getMEditMask(String editMaskID) { - return (MEditMask) getChild(MetadataType.EDITMASK, editMaskID); - } - - public MEditMask[] getMEditMasks() { - MEditMask[] tmpl = new MEditMask[0]; - return (MEditMask[]) getChildren(MetadataType.EDITMASK).toArray(tmpl); - } - - public MUpdateHelp getMUpdateHelp(String updateHelpID) { - return (MUpdateHelp) getChild(MetadataType.UPDATE_HELP, updateHelpID); - } - - public MUpdateHelp[] getMUpdateHelps() { - MUpdateHelp[] tmpl = new MUpdateHelp[0]; - return (MUpdateHelp[]) getChildren(MetadataType.UPDATE_HELP).toArray(tmpl); - } - - public MSearchHelp getMSearchHelp(String searchHelpID) { - return (MSearchHelp) getChild(MetadataType.SEARCH_HELP, searchHelpID); - } - - public MSearchHelp[] getMSearchHelps() { - MSearchHelp[] tmpl = new MSearchHelp[0]; - return (MSearchHelp[]) getChildren(MetadataType.SEARCH_HELP).toArray(tmpl); - } - - @Override - public MetadataType[] getChildTypes() { - return CHILDREN; - } - - @Override - protected String getIdAttr() { - return RESOURCEID; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(RESOURCEID, sAlphanum32); - attributeMap.put(STANDARDNAME, sAlphanum32); - attributeMap.put(VISIBLENAME, sPlaintext32); - attributeMap.put(DESCRIPTION, sPlaintext64); - attributeMap.put(KEYFIELD, sAlphanum32); - attributeMap.put(CLASSCOUNT, sAttrNumeric); - attributeMap.put(CLASSVERSION, sAttrVersion); - attributeMap.put(CLASSDATE, sAttrDate); - attributeMap.put(OBJECTVERSION, sAttrVersion); - attributeMap.put(OBJECTDATE, sAttrDate); - attributeMap.put(SEARCHHELPVERSION, sAttrVersion); - attributeMap.put(SEARCHHELPDATE, sAttrDate); - attributeMap.put(EDITMASKVERSION, sAttrVersion); - attributeMap.put(EDITMASKDATE, sAttrDate); - attributeMap.put(LOOKUPVERSION, sAttrVersion); - attributeMap.put(LOOKUPDATE, sAttrDate); - attributeMap.put(UPDATEHELPVERSION, sAttrVersion); - attributeMap.put(UPDATEHELPDATE, sAttrDate); - attributeMap.put(VALIDATIONEXPRESSIONVERSION, sAttrVersion); - attributeMap.put(VALIDATIONEXPRESSIONDATE, sAttrDate); - attributeMap.put(VALIDATIONLOOKUPVERSION, sAttrVersion); - attributeMap.put(VALIDATIONLOOKUPDATE, sAttrDate); - attributeMap.put(VALIDATIONEXTERNALVERSION, sAttrVersion); - attributeMap.put(VALIDATIONEXTERNALDATE, sAttrDate); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MSearchHelp.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MSearchHelp.java deleted file mode 100644 index 0082f5e..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MSearchHelp.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MSearchHelp extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String SEARCHHELPID = "SearchHelpID"; - public static final String VALUE = "Value"; - - public MSearchHelp() { - this(DEFAULT_PARSING); - } - - public MSearchHelp(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getSearchHelpID() { - return getStringAttribute(SEARCHHELPID); - } - - public String getValue() { - return getStringAttribute(VALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return SEARCHHELPID; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(SEARCHHELPID, sAlphanum32); - attributeMap.put(VALUE, sText1024); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MSystem.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MSystem.java deleted file mode 100644 index 6db0573..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MSystem.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MSystem extends MetaObject { - public static final String SYSTEMID = "SystemID"; - public static final String SYSTEMDESCRIPTION = "SystemDescription"; - public static final String COMMENTS = "Comments"; - public static final String DATE = "Date"; - public static final String VERSION = "Version"; - public static final String TIMEZONEOFFSET = "TimeZoneOffset"; - - public MSystem() { - this(DEFAULT_PARSING); - } - - public MSystem(boolean strictParsing) { - super(strictParsing); - } - - public String getSystemID() { - return getStringAttribute(SYSTEMID); - } - - public String getComment() { - return getStringAttribute(COMMENTS); - } - - public String getSystemDescription() { - return getStringAttribute(SYSTEMDESCRIPTION); - } - - public String getDate() { - return getDateAttribute(DATE); - } - - public String getTimeZoneOffset() { - return getDateAttribute(TIMEZONEOFFSET); - } - - public int getVersion() { - return getIntAttribute(VERSION); - } - - public MResource getMResource(String resourceID) { - return (MResource) getChild(MetadataType.RESOURCE, resourceID); - } - - public MResource[] getMResources() { - MResource[] tmpl = new MResource[0]; - return (MResource[]) getChildren(MetadataType.RESOURCE).toArray(tmpl); - } - - public MForeignKey getMForeignKey(String foreignKeyID) { - return (MForeignKey) getChild(MetadataType.FOREIGNKEYS, foreignKeyID); - } - - public MForeignKey[] getMForeignKeys() { - MForeignKey[] tmpl = new MForeignKey[0]; - return (MForeignKey[]) getChildren(MetadataType.FOREIGNKEYS).toArray(tmpl); - } - - @Override - public MetadataType[] getChildTypes() { - return CHILDREN; - } - - @Override - protected String getIdAttr() { - return null; - } - - public static final MetadataType[] CHILDREN = { MetadataType.RESOURCE, MetadataType.FOREIGNKEYS }; - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(SYSTEMID, sAlphanum10); - attributeMap.put(SYSTEMDESCRIPTION, sPlaintext64); - attributeMap.put(DATE, sAttrDate); - attributeMap.put(VERSION, sAttrVersion); - attributeMap.put(COMMENTS, sText); - attributeMap.put(TIMEZONEOFFSET, sAttrDate); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MTable.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MTable.java deleted file mode 100644 index 38aba26..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MTable.java +++ /dev/null @@ -1,242 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; -import org.realtors.rets.common.metadata.attrib.AttrEnum; - -public class MTable extends MetaObject { - - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String SYSTEMNAME = "SystemName"; - public static final String STANDARDNAME = "StandardName"; - public static final String LONGNAME = "LongName"; - public static final String DBNAME = "DBName"; - public static final String SHORTNAME = "ShortName"; - public static final String MAXIMUMLENGTH = "MaximumLength"; - public static final String DATATYPE = "DataType"; - public static final String PRECISION = "Precision"; - public static final String SEARCHABLE = "Searchable"; - public static final String INTERPRETATION = "Interpretation"; - public static final String ALIGNMENT = "Alignment"; - public static final String USESEPARATOR = "UseSeparator"; - public static final String EDITMASKID = "EditMaskID"; - public static final String LOOKUPNAME = "LookupName"; - public static final String MAXSELECT = "MaxSelect"; - public static final String UNITS = "Units"; - public static final String INDEX = "Index"; - public static final String MINIMUM = "Minimum"; - public static final String MAXIMUM = "Maximum"; - public static final String DEFAULT = "Default"; - public static final String REQUIRED = "Required"; - public static final String SEARCHHELPID = "SearchHelpID"; - public static final String UNIQUE = "Unique"; - public static final String MODTIMESTAMP = "ModTimeStamp"; - public static final String MODTIMESTAMPNAME = "ModTimeStampName"; - public static final String FOREIGNKEYNAME = "ForeignKeyName"; - public static final String FOREIGNFIELD = "ForeignField"; - public static final String INKEYINDEX = "InKeyIndex"; - public static final String KEYQUERY = "KeyQuery"; - public static final String KEYSELECT = "KeySelect"; - - private static final String[] DATATYPES = "Boolean,Character,Date,DateTime,Time,Tiny,Small,Int,Long,Decimal".split(","); - private static final AttrType sDataTypes = new AttrEnum(DATATYPES); - private static final String[] INTERPRETATIONS = "Number,Currency,Lookup,LookupMulti,LookupBitstring,LookupBitmask".split(","); - private static final AttrType sInterpretations = new AttrEnum(INTERPRETATIONS); - private static final String[] ALIGNMENTS = "Left,Right,Center,Justify".split(","); - private static final AttrType sAlignments = new AttrEnum(ALIGNMENTS); - private static final String[] UNITSS = "Feet,Meters,SqFt,SqMeters,Acres,Hectares".split(","); - private static final AttrType sUnits = new AttrEnum(UNITSS); - - public MTable() { - this(DEFAULT_PARSING); - } - - public MTable(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - - String metadataEntryID = getStringAttribute(METADATAENTRYID); - if (metadataEntryID == null){ - metadataEntryID = this.getSystemName(); - } - return metadataEntryID; - } - - public String getSystemName() { - return getStringAttribute(SYSTEMNAME); - } - - public String getStandardName() { - return getStringAttribute(STANDARDNAME); - } - - public String getLongName() { - return getStringAttribute(LONGNAME); - } - - public String getDBName() { - return getStringAttribute(DBNAME); - } - - public String getShortName() { - return getStringAttribute(SHORTNAME); - } - - public int getMaximumLength() { - return getIntAttribute(MAXIMUMLENGTH); - } - - public String getDataType() { - return getStringAttribute(DATATYPE); - } - - public int getPrecision() { - return getIntAttribute(PRECISION); - } - - public boolean getSearchable() { - return getBooleanAttribute(SEARCHABLE); - } - - public String getInterpretation() { - return getStringAttribute(INTERPRETATION); - } - - public boolean isLookup() { - String interp = getInterpretation(); - if (interp != null && interp.startsWith("Lookup")) { - return true; - } - if (getSystemName().equalsIgnoreCase("status")) { - System.out.println("Field is " + getSystemName() + " and interp " + "is " + interp - + " but isLookup() is false"); - } - return false; - } - - public String getAlignment() { - return getStringAttribute(ALIGNMENT); - } - - public boolean getUseSeparator() { - return getBooleanAttribute(USESEPARATOR); - } - - public String getEditMaskID() { - return getStringAttribute(EDITMASKID); - } - - public String getLookupName() { - return getStringAttribute(LOOKUPNAME); - } - - public int getMaxSelect() { - return getIntAttribute(MAXSELECT); - } - - public String getUnits() { - return getStringAttribute(UNITS); - } - - public int getIndex() { - return getIntAttribute(INDEX); - } - - public int getMinimum() { - return getIntAttribute(MINIMUM); - } - - public int getMaximum() { - return getIntAttribute(MAXIMUM); - } - - public int getDefault() { - return getIntAttribute(DEFAULT); - } - - public int getRequired() { - return getIntAttribute(REQUIRED); - } - - public String getSearchHelpID() { - return getStringAttribute(SEARCHHELPID); - } - - public boolean getUnique() { - return getBooleanAttribute(UNIQUE); - } - - public boolean getModTimestamp() { - return getBooleanAttribute(MODTIMESTAMP); - } - - public boolean getModTimestampName() { - return getBooleanAttribute(MODTIMESTAMPNAME); - } - - public boolean getInKeyIndex() { - return getBooleanAttribute(INKEYINDEX); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return SYSTEMNAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, retsid); - attributeMap.put(SYSTEMNAME, retsname); - attributeMap.put(STANDARDNAME, retsname); - attributeMap.put(LONGNAME, sText256); - attributeMap.put(DBNAME, sAlphanum10); - attributeMap.put(SHORTNAME, sText64); - attributeMap.put(MAXIMUMLENGTH, sAttrNumericPositive); - attributeMap.put(DATATYPE, sDataTypes); - attributeMap.put(PRECISION, sAttrNumeric); - attributeMap.put(SEARCHABLE, sAttrBoolean); - attributeMap.put(INTERPRETATION, sInterpretations); - attributeMap.put(ALIGNMENT, sAlignments); - attributeMap.put(USESEPARATOR, sAttrBoolean); - // XXX: but multiples are separated by commas - attributeMap.put(EDITMASKID, retsname); - attributeMap.put(LOOKUPNAME, retsname); - attributeMap.put(MAXSELECT, sAttrNumeric); - attributeMap.put(UNITS, sUnits); - attributeMap.put(INDEX, sAttrNumeric); - attributeMap.put(MINIMUM, sAttrNumeric); - attributeMap.put(MAXIMUM, sAttrNumeric); - // XXX: serial - attributeMap.put(DEFAULT, sAttrNumeric); - attributeMap.put(REQUIRED, sAttrNumeric); - attributeMap.put(SEARCHHELPID, retsname); - attributeMap.put(UNIQUE, sAttrBoolean); - attributeMap.put(MODTIMESTAMP, sAttrBoolean); - attributeMap.put(MODTIMESTAMPNAME, retsname); - attributeMap.put(FOREIGNKEYNAME,retsid); - attributeMap.put(FOREIGNFIELD,retsname); - attributeMap.put(INKEYINDEX, sAttrBoolean); - - attributeMap.put(KEYQUERY, sAttrBoolean); - attributeMap.put(KEYSELECT, sAttrBoolean); - } - - public String getForeignKeyName() { - return getStringAttribute(FOREIGNKEYNAME); - } - - public String getForeignField() { - return getStringAttribute(FOREIGNFIELD); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdate.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdate.java deleted file mode 100644 index 5c1f160..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdate.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MUpdate extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String UPDATENAME = "UpdateName"; - public static final String DESCRIPTION = "Description"; - public static final String KEYFIELD = "KeyField"; - public static final String VERSION = "Version"; - public static final String DATE = "Date"; - public static final String UPDATETYPEVERSION = "UpdateTypeVersion"; - public static final String UPDATETYPEDATE = "UpdateTypeDate"; - - public MUpdate() { - this(DEFAULT_PARSING); - } - - public MUpdate(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getUpdateName() { - return getStringAttribute(UPDATENAME); - } - - public String getDescription() { - return getStringAttribute(DESCRIPTION); - } - - public String getKeyField() { - return getStringAttribute(KEYFIELD); - } - - public int getVersion() { - int v = getIntAttribute(VERSION); - if (v == 0){ - v = getIntAttribute(UPDATETYPEVERSION); - } - return v; - } - - public String getDate() { - String d = getDateAttribute(DATE); - if (d == null ){ - d = getDateAttribute(UPDATETYPEDATE); - } - return d; - } - - public MUpdateType getMUpdateType(String systemName) { - return (MUpdateType) getChild(MetadataType.UPDATE_TYPE, systemName); - } - - public MUpdateType[] getMUpdateTypes() { - MUpdateType[] tmpl = new MUpdateType[0]; - return (MUpdateType[]) getChildren(MetadataType.UPDATE_TYPE).toArray(tmpl); - } - - @Override - public MetadataType[] getChildTypes() { - return sTypes; - } - - @Override - protected String getIdAttr() { - return UPDATENAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(UPDATENAME, sAlphanum24); - attributeMap.put(DESCRIPTION, sPlaintext64); - attributeMap.put(KEYFIELD, sAlphanum32); - attributeMap.put(VERSION, sAttrVersion); - attributeMap.put(DATE, sAttrDate); - attributeMap.put(UPDATETYPEVERSION, sAttrVersion); - attributeMap.put(UPDATETYPEDATE, sAttrDate); - } - - private static final MetadataType[] sTypes = { MetadataType.UPDATE_TYPE }; -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdateHelp.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdateHelp.java deleted file mode 100644 index 278b69f..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdateHelp.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MUpdateHelp extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String UPDATEHELPID = "UpdateHelpID"; - public static final String VALUE = "Value"; - - public MUpdateHelp() { - this(DEFAULT_PARSING); - } - - public MUpdateHelp(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getUpdateHelpID() { - return getStringAttribute(UPDATEHELPID); - } - - public String getValue() { - return getStringAttribute(VALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return UPDATEHELPID; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(UPDATEHELPID, sAlphanum32); - attributeMap.put(VALUE, sText1024); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdateType.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdateType.java deleted file mode 100644 index 2124f51..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MUpdateType.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; -import org.realtors.rets.common.metadata.attrib.AttrGenericText; - -public class MUpdateType extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String SYSTEMNAME = "SystemName"; - public static final String SEQUENCE = "Sequence"; - public static final String ATTRIBUTES = "Attributes"; - public static final String DEFAULT = "Default"; - public static final String VALIDATIONEXPRESSIONID = "ValidationExpressionID"; - public static final String UPDATEHELPID = "UpdateHelpID"; - public static final String VALIDATIONLOOKUPNAME = "ValidationLookupName"; - public static final String VALIDATIONEXTERNALNAME = "ValidationExternalName"; - public static final String MAXCHOICE = "MaxChoice"; - public static final String MAXUPDATE = "MaxUpdate"; - - private static final AttrType sAttributes = new AttrGenericText(0, 10, "12345,"); - - public MUpdateType() { - this(DEFAULT_PARSING); - - } - - public MUpdateType(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getSystemName() { - return getStringAttribute(SYSTEMNAME); - } - - public int getSequence() { - return getIntAttribute(SEQUENCE); - } - - public String getAttributes() { - return getStringAttribute(ATTRIBUTES); - } - - public String getDefault() { - return getStringAttribute(DEFAULT); - } - - public String getValidationExpressionID() { - return getStringAttribute(VALIDATIONEXPRESSIONID); - } - - public String getUpdateHelpID() { - return getStringAttribute(UPDATEHELPID); - } - - public String getValidationLookupName() { - return getStringAttribute(VALIDATIONLOOKUPNAME); - } - - public String getValidationExternalName() { - return getStringAttribute(VALIDATIONEXTERNALNAME); - } - - public int getMaxChoice() { - return getIntAttribute(MAXCHOICE); - } - - public int getMaxUpdate() { - return getIntAttribute(MAXUPDATE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return SYSTEMNAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(SYSTEMNAME, sAlphanum32); - attributeMap.put(SEQUENCE, sAttrNumeric); - attributeMap.put(ATTRIBUTES, sAttributes); - attributeMap.put(DEFAULT, sPlaintext); - attributeMap.put(VALIDATIONEXPRESSIONID, sAlphanum32); - attributeMap.put(UPDATEHELPID, sAlphanum32); - attributeMap.put(VALIDATIONLOOKUPNAME, sAlphanum32); - attributeMap.put(VALIDATIONEXTERNALNAME, sAlphanum32); - attributeMap.put(MAXCHOICE, sAttrNumeric); - attributeMap.put(MAXUPDATE, sAttrNumeric); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExpression.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExpression.java deleted file mode 100644 index 57221ee..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExpression.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.AttrType; -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; -import org.realtors.rets.common.metadata.attrib.AttrEnum; - -public class MValidationExpression extends MetaObject { - - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String VALIDATIONEXPRESSIONID = "ValidationExpressionID"; - public static final String VALIDATIONEXPRESSIONTYPE = "ValidationExpressionType"; - public static final String VALUE = "Value"; - private static final String[] VALIDATIONEXPRESSIONTYPES = "ACCEPT,REJECT,SET".split(","); - private static final AttrType sExpressionType = new AttrEnum(VALIDATIONEXPRESSIONTYPES); - - public MValidationExpression() { - this(DEFAULT_PARSING); - } - - public MValidationExpression(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getValidationExpressionID() { - return getStringAttribute(VALIDATIONEXPRESSIONID); - } - - public String getValidationExpressionType() { - return getStringAttribute(VALIDATIONEXPRESSIONTYPE); - } - - public String getValue() { - return getStringAttribute(VALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return VALIDATIONEXPRESSIONID; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(VALIDATIONEXPRESSIONID, sAlphanum32); - attributeMap.put(VALIDATIONEXPRESSIONTYPE, sExpressionType); - attributeMap.put(VALUE, sText512); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExternal.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExternal.java deleted file mode 100644 index 0d891e3..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExternal.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MValidationExternal extends MetaObject { - - private static final MetadataType[] CHILDREN = { MetadataType.VALIDATION_EXTERNAL_TYPE }; - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String VALIDATIONEXTERNALNAME = "ValidationExternalName"; - public static final String SEARCHRESOURCE = "SearchResource"; - public static final String SEARCHCLASS = "SearchClass"; - public static final String VERSION = "Version"; - public static final String DATE = "Date"; - - public MValidationExternal() { - this(DEFAULT_PARSING); - } - - public MValidationExternal(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getValidationExternalName() { - return getStringAttribute(VALIDATIONEXTERNALNAME); - } - - public String getSearchResource() { - return getStringAttribute(SEARCHRESOURCE); - } - - public String getSearchClass() { - return getStringAttribute(SEARCHCLASS); - } - - public int getVersion() { - return getIntAttribute(VERSION); - } - - public String getDate() { - return getDateAttribute(DATE); - } - - public MValidationExternalType[] getMValidationExternalTypes() { - MValidationExternalType[] tmpl = new MValidationExternalType[0]; - return (MValidationExternalType[]) getChildren(MetadataType.VALIDATION_EXTERNAL_TYPE).toArray(tmpl); - } - - @Override - public MetadataType[] getChildTypes() { - return CHILDREN; - } - - @Override - protected String getIdAttr() { - return VALIDATIONEXTERNALNAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(VALIDATIONEXTERNALNAME, sAlphanum32); - attributeMap.put(SEARCHRESOURCE, sAlphanum32); - attributeMap.put(SEARCHCLASS, sAlphanum32); - attributeMap.put(VERSION, sAttrVersion); - attributeMap.put(DATE, sAttrDate); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExternalType.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExternalType.java deleted file mode 100644 index e052c1e..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationExternalType.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MValidationExternalType extends MetaObject { - - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String SEARCHFIELD = "SearchField"; - public static final String DISPLAYFIELD = "DisplayField"; - public static final String RESULTFIELDS = "ResultFields"; - - public MValidationExternalType() { - this(DEFAULT_PARSING); - } - - public MValidationExternalType(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getSearchField() { - return getStringAttribute(SEARCHFIELD); - } - - public String getDisplayField() { - return getStringAttribute(DISPLAYFIELD); - } - - public String getResultFields() { - return getStringAttribute(RESULTFIELDS); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return null; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(SEARCHFIELD, sPlaintext512); - attributeMap.put(DISPLAYFIELD, sPlaintext512); - attributeMap.put(RESULTFIELDS, sPlaintext1024); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationLookup.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationLookup.java deleted file mode 100644 index 3a893b2..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationLookup.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -//import java.util.Date; -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MValidationLookup extends MetaObject { - - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String VALIDATIONLOOKUPNAME = "ValidationLookupName"; - public static final String PARENT1FIELD = "Parent1Field"; - public static final String PARENT2FIELD = "Parent2Field"; - public static final String VERSION = "Version"; - public static final String DATE = "Date"; - private static final MetadataType[] sChildren = { MetadataType.VALIDATION_LOOKUP_TYPE }; - - public MValidationLookup() { - this(DEFAULT_PARSING); - } - - public MValidationLookup(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getValidationLookupName() { - return getStringAttribute(VALIDATIONLOOKUPNAME); - } - - public String getParent1Field() { - return getStringAttribute(PARENT1FIELD); - } - - public String getParent2Field() { - return getStringAttribute(PARENT2FIELD); - } - - public int getVersion() { - return getIntAttribute(VERSION); - } - - public String getDate() { - return getDateAttribute(DATE); - } - - @Override - public MetadataType[] getChildTypes() { - return sChildren; - } - - @Override - protected String getIdAttr() { - return VALIDATIONLOOKUPNAME; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(VALIDATIONLOOKUPNAME, sAlphanum32); - attributeMap.put(PARENT1FIELD, sAlphanum32); - attributeMap.put(PARENT2FIELD, sAlphanum32); - attributeMap.put(VERSION, sAttrVersion); - attributeMap.put(DATE, sAttrDate); - } - - public MValidationLookupType[] getMValidationLookupTypes() { - MValidationLookupType[] tmpl = new MValidationLookupType[0]; - return (MValidationLookupType[]) getChildren(MetadataType.VALIDATION_LOOKUP_TYPE).toArray(tmpl); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationLookupType.java b/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationLookupType.java deleted file mode 100644 index 295108a..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/metadata/types/MValidationLookupType.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.realtors.rets.common.metadata.types; - -import java.util.Map; - -import org.realtors.rets.common.metadata.MetaObject; -import org.realtors.rets.common.metadata.MetadataType; - -public class MValidationLookupType extends MetaObject { - public static final String METADATAENTRYID = "MetadataEntryID"; - public static final String VALIDTEXT = "ValidText"; - public static final String PARENT1VALUE = "Parent1Value"; - public static final String PARENT2VALUE = "Parent2Value"; - - public MValidationLookupType() { - this(DEFAULT_PARSING); - } - - public MValidationLookupType(boolean strictParsing) { - super(strictParsing); - } - - public String getMetadataEntryID() { - return getStringAttribute(METADATAENTRYID); - } - - public String getValidText() { - return getStringAttribute(VALIDTEXT); - } - - public String getParent1Value() { - return getStringAttribute(PARENT1VALUE); - } - - public String getParent2Value() { - return getStringAttribute(PARENT2VALUE); - } - - @Override - public MetadataType[] getChildTypes() { - return sNoChildren; - } - - @Override - protected String getIdAttr() { - return null; - } - - @Override - protected void addAttributesToMap(Map attributeMap) { - attributeMap.put(METADATAENTRYID, sAttrMetadataEntryId); - attributeMap.put(VALIDTEXT, sAlphanum32); - attributeMap.put(PARENT1VALUE, sAlphanum32); - attributeMap.put(PARENT2VALUE, sAlphanum32); - } - -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/util/CaseInsensitiveComparator.java b/target/filtered-sources/java/org/realtors/rets/common/util/CaseInsensitiveComparator.java deleted file mode 100644 index 248cf2c..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/util/CaseInsensitiveComparator.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.realtors.rets.common.util; - -import java.io.Serializable; -import java.util.Comparator; - -public class CaseInsensitiveComparator implements Comparator, Serializable { - public int compare(Object o1, Object o2) { - String s1 = (String) o1; - String s2 = (String) o2; - return s1.compareToIgnoreCase(s2); - } -} diff --git a/target/filtered-sources/java/org/realtors/rets/common/util/CaseInsensitiveTreeMap.java b/target/filtered-sources/java/org/realtors/rets/common/util/CaseInsensitiveTreeMap.java deleted file mode 100644 index 87aa3a8..0000000 --- a/target/filtered-sources/java/org/realtors/rets/common/util/CaseInsensitiveTreeMap.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.realtors.rets.common.util; - -import java.util.Map; -import java.util.TreeMap; - -public class CaseInsensitiveTreeMap extends TreeMap { - public CaseInsensitiveTreeMap(Map map) { - this(); - this.putAll(map); - } - - public CaseInsensitiveTreeMap() { - super(new CaseInsensitiveComparator()); - } - -} diff --git a/target/test-classes/org/realtors/rets/client/AllTests.class b/target/test-classes/org/realtors/rets/client/AllTests.class deleted file mode 100644 index b3d6255..0000000 Binary files a/target/test-classes/org/realtors/rets/client/AllTests.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/GetMetadataRequestTest.class b/target/test-classes/org/realtors/rets/client/GetMetadataRequestTest.class deleted file mode 100644 index c3ea782..0000000 Binary files a/target/test-classes/org/realtors/rets/client/GetMetadataRequestTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/GetMetadataResponseTest.class b/target/test-classes/org/realtors/rets/client/GetMetadataResponseTest.class deleted file mode 100644 index 4679654..0000000 Binary files a/target/test-classes/org/realtors/rets/client/GetMetadataResponseTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/GetObjectResponseIteratorTest.class b/target/test-classes/org/realtors/rets/client/GetObjectResponseIteratorTest.class deleted file mode 100644 index 180adb0..0000000 Binary files a/target/test-classes/org/realtors/rets/client/GetObjectResponseIteratorTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/IOFailReader.class b/target/test-classes/org/realtors/rets/client/IOFailReader.class deleted file mode 100644 index 058e442..0000000 Binary files a/target/test-classes/org/realtors/rets/client/IOFailReader.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/LoginRequestTest.class b/target/test-classes/org/realtors/rets/client/LoginRequestTest.class deleted file mode 100644 index 072a43d..0000000 Binary files a/target/test-classes/org/realtors/rets/client/LoginRequestTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/LoginResponseTest.class b/target/test-classes/org/realtors/rets/client/LoginResponseTest.class deleted file mode 100644 index f8895f4..0000000 Binary files a/target/test-classes/org/realtors/rets/client/LoginResponseTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/LogoutResponseTest.class b/target/test-classes/org/realtors/rets/client/LogoutResponseTest.class deleted file mode 100644 index 8471874..0000000 Binary files a/target/test-classes/org/realtors/rets/client/LogoutResponseTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/RetsTestCase.class b/target/test-classes/org/realtors/rets/client/RetsTestCase.class deleted file mode 100644 index 5fe9d94..0000000 Binary files a/target/test-classes/org/realtors/rets/client/RetsTestCase.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/RetsVersionTest.class b/target/test-classes/org/realtors/rets/client/RetsVersionTest.class deleted file mode 100644 index 67e040a..0000000 Binary files a/target/test-classes/org/realtors/rets/client/RetsVersionTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/SearchResultHandlerTest.class b/target/test-classes/org/realtors/rets/client/SearchResultHandlerTest.class deleted file mode 100644 index 1df33f2..0000000 Binary files a/target/test-classes/org/realtors/rets/client/SearchResultHandlerTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/SearchResultImplTest.class b/target/test-classes/org/realtors/rets/client/SearchResultImplTest.class deleted file mode 100644 index bd71dcc..0000000 Binary files a/target/test-classes/org/realtors/rets/client/SearchResultImplTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/SingleObjectResponseTest.class b/target/test-classes/org/realtors/rets/client/SingleObjectResponseTest.class deleted file mode 100644 index 1636df0..0000000 Binary files a/target/test-classes/org/realtors/rets/client/SingleObjectResponseTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/StreamingSearchResultProcessorTest.class b/target/test-classes/org/realtors/rets/client/StreamingSearchResultProcessorTest.class deleted file mode 100644 index 5c36b39..0000000 Binary files a/target/test-classes/org/realtors/rets/client/StreamingSearchResultProcessorTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/client/TestInvalidReplyCodeHandler.class b/target/test-classes/org/realtors/rets/client/TestInvalidReplyCodeHandler.class deleted file mode 100644 index 36fd21b..0000000 Binary files a/target/test-classes/org/realtors/rets/client/TestInvalidReplyCodeHandler.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/MetaObjectTest.class b/target/test-classes/org/realtors/rets/common/metadata/MetaObjectTest.class deleted file mode 100644 index ea995ec..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/MetaObjectTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/MetadataTestCase.class b/target/test-classes/org/realtors/rets/common/metadata/MetadataTestCase.class deleted file mode 100644 index 6959841..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/MetadataTestCase.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/TestMetaObject.class b/target/test-classes/org/realtors/rets/common/metadata/TestMetaObject.class deleted file mode 100644 index 1f90904..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/TestMetaObject.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest$1.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest$1.class deleted file mode 100644 index 85b5be4..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest$1.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest$2.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest$2.class deleted file mode 100644 index b0b3eb3..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest$2.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest.class deleted file mode 100644 index f3a7228..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAbstractTextTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAlphanumTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAlphanumTest.class deleted file mode 100644 index 49d752f..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrAlphanumTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrBooleanTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrBooleanTest.class deleted file mode 100644 index 14554a9..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrBooleanTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrDateTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrDateTest.class deleted file mode 100644 index cf1d6c9..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrDateTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrEnumTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrEnumTest.class deleted file mode 100644 index 2b87707..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrEnumTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrGenericTextTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrGenericTextTest.class deleted file mode 100644 index eb6ef67..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrGenericTextTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrNumericTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrNumericTest.class deleted file mode 100644 index 4813203..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrNumericTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrPlaintextTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrPlaintextTest.class deleted file mode 100644 index 0a61d52..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrPlaintextTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrTextTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrTextTest.class deleted file mode 100644 index 887aa62..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrTextTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrTypeTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrTypeTest.class deleted file mode 100644 index 983a885..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrTypeTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrVersionTest.class b/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrVersionTest.class deleted file mode 100644 index f8198e9..0000000 Binary files a/target/test-classes/org/realtors/rets/common/metadata/attrib/AttrVersionTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/common/util/CaseInsensitiveTreeMapTest.class b/target/test-classes/org/realtors/rets/common/util/CaseInsensitiveTreeMapTest.class deleted file mode 100644 index 52029db..0000000 Binary files a/target/test-classes/org/realtors/rets/common/util/CaseInsensitiveTreeMapTest.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/examples/RetsGetMetadataExample.class b/target/test-classes/org/realtors/rets/examples/RetsGetMetadataExample.class deleted file mode 100644 index 9596d42..0000000 Binary files a/target/test-classes/org/realtors/rets/examples/RetsGetMetadataExample.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/examples/RetsGetObjectExample.class b/target/test-classes/org/realtors/rets/examples/RetsGetObjectExample.class deleted file mode 100644 index c3b6baf..0000000 Binary files a/target/test-classes/org/realtors/rets/examples/RetsGetObjectExample.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/examples/RetsGetObjectURLExample.class b/target/test-classes/org/realtors/rets/examples/RetsGetObjectURLExample.class deleted file mode 100644 index 3ab08b1..0000000 Binary files a/target/test-classes/org/realtors/rets/examples/RetsGetObjectURLExample.class and /dev/null differ diff --git a/target/test-classes/org/realtors/rets/examples/RetsSearchExample.class b/target/test-classes/org/realtors/rets/examples/RetsSearchExample.class deleted file mode 100644 index b72f879..0000000 Binary files a/target/test-classes/org/realtors/rets/examples/RetsSearchExample.class and /dev/null differ