+public class DAS_Feature_Handler extends DefaultHandler
+{
+
+ /**
+ *
+ */
+ List features;
+
+ boolean first_flag;
+
+ HashMap feature;
+
+ String featurefield;
+
+ StringBuffer characterdata;
+
+ String dasCommand;
+
+ int comeBackLater;
+
+ int maxFeatures;
+
+ String segmentId;
+
+ String version;
+
+ String type_id;
+
+ String type_category;
+
+ public DAS_Feature_Handler()
+ {
+ super();
+
+ features = new ArrayList();
+ first_flag = true;
+ featurefield = "";
+ characterdata = new StringBuffer();
+ dasCommand = "";
+ comeBackLater = -1;
+ maxFeatures = -1;
+ segmentId = "";
+ version = "";
+ type_id = "";
+ type_category = "";
+ }
+
+ /**
+ * get the id information specified int the SEGMENT field of the DAS response
+ *
+ * @return the segmentId or an emtpy string if not available
+ */
+ public String getSegmentId()
+ {
+ return segmentId;
+ }
+
+ /**
+ * get the version informationspecified in the SEGMENT field of the DAS
+ * response
+ *
+ * @return the version information of an empty string if not available
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public boolean isMD5Checksum()
+ {
+
+ if ((version != null) && (version.length() == 32))
+ return true;
+ return false;
+ }
+
+ /**
+ * specifies a maximum number of features to be downloaded. if a server
+ * returns more, they will be ignored. default is to load all features
+ *
+ * @param max
+ * the maximium number of features to be downloaded
+ */
+
+ public void setMaxFeatures(int max)
+ {
+ maxFeatures = max;
+ }
+
+ public int getMaxFeatures()
+ {
+ return maxFeatures;
+ }
+
+ public void setDASCommand(String cmd)
+ {
+ dasCommand = cmd;
+ }
+
+ public String getDASCommand()
+ {
+ return dasCommand;
+ }
+
+ public List get_features()
+ {
+ return features;
+ }
+
+ public int getComBackLater()
+ {
+ return comeBackLater;
+ }
+
+ void start_feature(String uri, String name, String qName, Attributes atts)
+ {
+
+ if ((maxFeatures > 0) && (features.size() > maxFeatures))
+ {
+ characterdata = new StringBuffer();
+ return;