Displaying differences for changeset
 
display as  

nbproject/ant-deploy.xml

@@ -1,42 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
-Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved.
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
 
-Oracle and Java are registered trademarks of Oracle and/or its affiliates.
-Other names may be trademarks of their respective owners.
+      http://www.apache.org/licenses/LICENSE-2.0
 
-The contents of this file are subject to the terms of either the GNU
-General Public License Version 2 only ("GPL") or the Common
-Development and Distribution License("CDDL") (collectively, the
-"License"). You may not use this file except in compliance with the
-License. You can obtain a copy of the License at
-http://www.netbeans.org/cddl-gplv2.html
-or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
-specific language governing permissions and limitations under the
-License.  When distributing the software, include this License Header
-Notice in each file and include the License file at
-nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the GPL Version 2 section of the License file that
-accompanied this code. If applicable, add the following below the
-License Header, with the fields enclosed by brackets [] replaced by
-your own identifying information:
-"Portions Copyrighted [year] [name of copyright owner]"
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
 
-If you wish your version of this file to be governed by only the CDDL
-or only the GPL Version 2, indicate your decision by adding
-"[Contributor] elects to include this software in this distribution
-under the [CDDL or GPL Version 2] license." If you do not indicate a
-single choice of license, a recipient has the option to distribute
-your version of this file under either the CDDL, the GPL Version 2 or
-to extend the choice of license to its licensees as provided above.
-However, if you add GPL Version 2 code and therefore, elected the GPL
-Version 2 license, then the option applies only if the new code is
-made subject to such option by the copyright holder.
-
-Contributor(s):
 -->
 <project default="-deploy-ant" basedir=".">
     <target name="-init" if="deploy.ant.enabled">

nbproject/project.properties

@@ -1,5 +1,5 @@
 file.reference.velocity-engine-core-2.0.jar=lib/velocity-engine-core-2.0.jar
-j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.6.3.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-de.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-ko.jar:${j2ee.server.home}/lib/tomcat-i18n-ru.jar:${j2ee.server.home}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
+j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.4.1.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-spdy.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
 #Mon Nov 09 10:36:44 MST 2015
 javadoc.splitindex=true
 lib.dir=${web.docbase.dir}/WEB-INF/lib
@@ -10,7 +10,7 @@
 dist.war=${dist.dir}/${war.name}
 javac.target=1.8
 build.generated.dir=${build.dir}/generated
-project.csip-core=../../csip-core
+project.csip-core=../csip-core
 reference.csip-core.jar=${project.csip-core}/dist/csip-core.jar
 resource.dir=setup
 build.web.excludes=${build.classes.excludes}

src/java/org/rti/rivertrak/ApplicationConfig.java

@@ -10,7 +10,7 @@
 
 /**
  *
- * @author User
+ * @author Olaf David
  */
 @javax.ws.rs.ApplicationPath("")
 public class ApplicationConfig extends Application {
@@ -39,6 +39,7 @@
     resources.add(csip.CatalogService.class);
     resources.add(csip.ControlService.class);
     resources.add(csip.DynamicPyModelDataService.class);
+    resources.add(csip.GzipWriterInterceptor.class);
     resources.add(csip.QueryService.class);
     resources.add(csip.QueueingModelDataService.class);
     resources.add(csip.ReportService.class);

src/java/org/rti/rivertrak/V1_0.java

@@ -1,4 +1,4 @@
-/*
+  /*
  * To change this license header, choose License Headers in Project Properties.
  * To change this template file, choose Tools | Templates
  * and open the template in the editor.
@@ -119,13 +119,13 @@
     warningLevel = parameter().getInt("WarningLevel", 1);
     refreshCount = parameter().getInt("RefreshCount", 10);
 
-    getWorkspaceFile("States").mkdirs();
+    workspace().getFile("States").mkdirs();
 
-    if (!getWorkspaceFile("TimeSeries").exists()) {
+    if (!workspace().getFile("TimeSeries").exists()) {
       throw new ServiceException("No Time series data.");
     }
 
-    File modelFolder = getWorkspaceFile("Models");
+    File modelFolder = workspace().getFile("Models");
     if (!modelFolder.exists()) {
       modelFolder.mkdirs();
     }
@@ -178,7 +178,7 @@
 
   /// public properties for Velocity access
   public String getWorkspace() {
-    return toWin(getWorkspaceDir());
+    return toWin(workspace().getDir());
   }
 
 
@@ -246,13 +246,13 @@
     VelocityContext context = new VelocityContext();
     context.put("service", this);
 
-    FileWriter w = new FileWriter(getWorkspaceFile(RIVERTRAK_CFG));
+    FileWriter w = new FileWriter(workspace().getFile(RIVERTRAK_CFG));
     velocity.getTemplate(RIVERTRAK_CONF_VM, "utf-8").merge(context, w);
     w.close();
 
     if (LOG.isLoggable(Level.INFO)) {
       LOG.info("Created: " + RIVERTRAK_CFG);
-      LOG.info(FileUtils.readFileToString(getWorkspaceFile(RIVERTRAK_CFG)));
+      LOG.info("\n" + FileUtils.readFileToString(workspace().getFile(RIVERTRAK_CFG)));
     }
     return RIVERTRAK_CFG;
   }

src/java/org/rti/timeseries/ParseTimeSeries.java

@@ -1,3 +1,4 @@
+
 package org.rti.timeseries;
 
 import java.io.IOException;
@@ -16,327 +17,369 @@
 import java.util.stream.Stream;
 
 class ParseData {
-    
-    String TSID, dataType, desc, units, missing, comment;
-    int numTS;
-    boolean flagNumTs, flagTSID, flagDataType, flagDesc, flagUnits, flagMissing, flagStart, flagEnd, verifyFirstDate, flagComment;
-    Date start, end;
-    List<Date> dateObjects;
-    List<Float> values;
-    AtomicInteger count;
-    public ParseData() {
-        numTS = -1;
-        TSID = "";
-        dataType = "default";
-        desc = "default";
-        units = "default";
-        missing = "default";
-        comment = "#";
-        start = null;
-        end = null;
-        dateObjects = new ArrayList<Date>();
-        values = new ArrayList<Float>();
-        count = new AtomicInteger(0);
-        
-        flagNumTs = false;
-        flagTSID = false;
-        flagDataType = false;
-        flagDesc = false;
-        flagUnits = false;
-        flagMissing = false;
-        flagStart = false;
-        flagEnd = false;
-        flagComment = false;
-        verifyFirstDate = false;
-        
-    }
-    
-    public void parseFile(String fileName, String targetFile) throws Exception {
-        try {
-            Stream<String> stream = Files.lines(Paths.get(fileName));
-            Iterator iterator = stream.iterator();
-            FileChannel rwChannel = new RandomAccessFile(targetFile, "rw").getChannel();
-            String sample_line = "2015-10-30 10:00:00:00 0.3\n";
-            Stream<String> temp = Files.lines(Paths.get(fileName));
-            ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, sample_line.getBytes().length*temp.count());
-            String line;
-            while (iterator.hasNext()) {
-                line = (String) iterator.next();
-                
-                //check for Comment
-                if (!flagComment)
-                if(line.indexOf("#") != -1) {
-                        this.comment = line;
-                        flagComment = true;
-                        continue;
-                }    
-                
-                //check for numTS
-                if (!flagNumTs)
-                if(line.indexOf("NumTS") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("NumTS=") == 0) {
-                        setNumTS( Integer.parseInt(line.substring("NumTS=".length(),line.length())) );
-                        flagNumTs = true;
-                        continue;
-                    }
-                }
-                
-                //check for TSID
-                if (!flagTSID)
-                if(line.indexOf("TSID") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("TSID=") == 0) {
-                        setTSID( (line.substring("TSID=".length(),line.length())) );
-                        flagTSID =true;
-                        continue;
-                    }
-                }
-                
-                //check for dataType
-                if (!flagDataType)
-                if(line.indexOf("DataType") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("DataType=") == 0) {
-                        setDataType( (line.substring("DataType=".length(),line.length())) );
-                        flagDataType =true;
-                        continue;
-                    }
-                }
-                
-                //check for Description
-                if (!flagDesc)
-                if(line.indexOf("Description") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("Description=") == 0) {
-                        setDesc( (line.substring("Description=".length(),line.length())) );
-                        flagDesc =true;
-                        continue;
-                    }
-                }
-                
-                //check for units
-                if (!flagUnits)
-                if(line.indexOf("Units") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("Units=") == 0) {
-                        setUnits( (line.substring("Units=".length(),line.length())) );
-                        flagUnits =true;
-                        continue;
-                    }
-                }
-                
-                //check for Missing
-                if (!flagMissing)
-                if(line.indexOf("Missing") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("Missing=") == 0) {
-                        setMissing( (line.substring("Missing=".length(),line.length())) );
-                        flagMissing =true;
-                        continue;
-                    }
-                }
-                
-                //check for Start
-                if (!flagStart)
-                if(line.indexOf("Start") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("Start=") == 0) {
-                        String _start = (line.substring("Start=".length(),line.length()));
-                        try {
-                            start = new SimpleDateFormat("yyyy-mm-ddhh:mm:ss:SS").parse(_start);
-                            flagStart =true;
-                            continue;
-                        } catch (ParseException ex) {
-                            rwChannel.close();
-                            stream.close();
-                            temp.close();
-                            wrBuf.clear();
-                            throw new Exception("The Start Date format is not specified correctly");
-                        }
-                    }
-                }
-                
-                //check for End
-                if (!flagEnd)
-                if(line.indexOf("End") != -1) {
-                    line = line.replace(" ", "");
-                    line = line.replace("\t", "");
-                    if(line.indexOf("End=") == 0) {
-                        String _end = (line.substring("End=".length(),line.length()));
-                        try {
-                            end = new SimpleDateFormat("yyyy-mm-ddhh:mm:ss:SS").parse(_end);
-                            flagEnd =true;
-                            continue;
-                        } catch (ParseException ex) {
-                            rwChannel.close();
-                            stream.close();
-                            temp.close();
-                            wrBuf.clear();
-                            throw new Exception("The End Date format is not specified correctly");
-                        }
-                    }
-                }
-                
-                if (!verifyFirstDate) {
-                    int len = "Description".length();
-                    if (flagComment)
-                    wrBuf.put( (getComment() + "\n").getBytes());
-                    if (flagNumTs)
-                    wrBuf.put( (padString("Num TS", len) + " = "+ getNumTS() + "\n").getBytes() );
-                    if (flagTSID)
-                    wrBuf.put( (padString("TSID", len) + " = "+ getTSID() + "\n").getBytes() );
-                    if (flagDataType)
-                    wrBuf.put( (padString("Data Type", len) + " = "+ getDataType() + "\n").getBytes() );
-                    if (flagDesc)
-                    wrBuf.put( (padString("Description", len) + " = "+ getDesc() + "\n").getBytes() );
-                    if (flagUnits)
-                    wrBuf.put( (padString("Units", len) + " = "+ getUnits() + "\n").getBytes() );
-                    if (flagMissing)
-                    wrBuf.put( (padString("Missing", len) + " = "+ getMissing() + "\n").getBytes() );
-                    if (flagStart)
-                    wrBuf.put( (padString("Start", len) + " = "+ getStartDate() + "\n").getBytes() );
-                    if (flagEnd)
-                    wrBuf.put( (padString("End", len) + " = "+ getEndDate() + "\n").getBytes() );
-                    verifyFirstDate = true;
-                    Date verify = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss:SS").parse(line.substring(0,"yyyy-mm-dd hh:mm:ss:SS".length()));
-                    if (!verify.equals(start)) {
-                        rwChannel.close();
-                        stream.close();
-                        temp.close();
-                        wrBuf.clear();
-                        throw new Exception("Start Date not equal to the first entry in the data");
-                    }
-                }
-                
-                if (flagStart && flagEnd && flagTSID) {
-                    line+="\n";
-                    wrBuf.put(line.getBytes());
-                } else {
-                    rwChannel.close();
-                    stream.close();
-                    temp.close();
-                    wrBuf.clear();
-                    throw new Exception("The headers are not defined correctly. Make sure the headers are defined correctly");
-                }
-            }
-            
-            rwChannel.close();
-            stream.close();
-            temp.close();
-            wrBuf.clear();
-            
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        
-    }
-    
-    protected List<Float> getValues() {
-        return this.values;
-    }
-    
-    protected List<Date> getDateObjects() {
-        return this.dateObjects;
-    }
-    
-    private void setNumTS(int numTS) {
-        this.numTS = numTS;
-    }
-    
-    public int getNumTS() {
-        return numTS;
-    }
-    
-    private void setTSID(String TSID) {
-        this.TSID = TSID;
-    }
-    
-    public String getTSID() {
-        return this.TSID;
-    }
-    
-    private void setDataType(String dataType) {
-        this.dataType = dataType;
-    }
-    
-    public String getDataType() {
-        return this.dataType;
-    }
-    
-    private void setDesc(String desc) {
-        this.desc = desc;
-    }
-    
-    public String getDesc() {
-        return this.desc;
-    }
-    
-    private void setUnits(String units) {
-        this.units = units;
-    }
-    
-    public String getUnits() {
-        return this.units;
-    }
-    
-    private void setMissing(String missing) {
-        this.missing = missing;
-    }
-    
-    public String getMissing() {
-        return this.missing;
-    }
-    
-    private String getStartDate() {
-        return new SimpleDateFormat("yyyy-mm-dd hh:mm:ss:SS").format(this.start);
-    }
-    
-    private String getEndDate() {
-        return new SimpleDateFormat("yyyy-mm-dd hh:mm:ss:SS").format(this.end);
-    }
-    
-    public Date getStart() {
-        return this.start;
-    }
-    
-    public Date getEnd() {
-        return this.end;
-    }
-    
-    public String getComment() {
-        return this.comment;
-    }
-    
-    public String padString(String str, int len) {
-        for( int i = str.length() ; i <= len; i++) {
-            str+=" ";
-        }
-        return str;
-    }
-    
+
+  String TSID, dataType, desc, units, missing, comment;
+  int numTS;
+  boolean flagNumTs, flagTSID, flagDataType, flagDesc, flagUnits, flagMissing, flagStart, flagEnd, verifyFirstDate, flagComment;
+  Date start, end;
+  List<Date> dateObjects;
+  List<Float> values;
+  AtomicInteger count;
+
+
+  public ParseData() {
+    numTS = -1;
+    TSID = "";
+    dataType = "default";
+    desc = "default";
+    units = "default";
+    missing = "default";
+    comment = "#";
+    start = null;
+    end = null;
+    dateObjects = new ArrayList<Date>();
+    values = new ArrayList<Float>();
+    count = new AtomicInteger(0);
+
+    flagNumTs = false;
+    flagTSID = false;
+    flagDataType = false;
+    flagDesc = false;
+    flagUnits = false;
+    flagMissing = false;
+    flagStart = false;
+    flagEnd = false;
+    flagComment = false;
+    verifyFirstDate = false;
+
+  }
+
+
+  public void parseFile(String fileName, String targetFile) throws Exception {
+    try {
+      Stream<String> stream = Files.lines(Paths.get(fileName));
+      Iterator iterator = stream.iterator();
+
+      FileChannel rwChannel = new RandomAccessFile(targetFile, "rw").getChannel();
+      String sample_line = "2015-10-30 10:00:00:00 0.3\n";
+      Stream<String> temp = Files.lines(Paths.get(fileName));
+      ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, sample_line.getBytes().length * temp.count());
+      
+      String line;
+      while (iterator.hasNext()) {
+        line = (String) iterator.next();
+
+        //check for Comment
+        if (!flagComment) {
+          if (line.indexOf("#") != -1) {
+            this.comment = line;
+            flagComment = true;
+            continue;
+          }
+        }
+
+        //check for numTS
+        if (!flagNumTs) {
+          if (line.indexOf("NumTS") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("NumTS=") == 0) {
+              setNumTS(Integer.parseInt(line.substring("NumTS=".length(), line.length())));
+              flagNumTs = true;
+              continue;
+            }
+          }
+        }
+
+        //check for TSID
+        if (!flagTSID) {
+          if (line.indexOf("TSID") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("TSID=") == 0) {
+              setTSID((line.substring("TSID=".length(), line.length())));
+              flagTSID = true;
+              continue;
+            }
+          }
+        }
+
+        //check for dataType
+        if (!flagDataType) {
+          if (line.indexOf("DataType") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("DataType=") == 0) {
+              setDataType((line.substring("DataType=".length(), line.length())));
+              flagDataType = true;
+              continue;
+            }
+          }
+        }
+
+        //check for Description
+        if (!flagDesc) {
+          if (line.indexOf("Description") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("Description=") == 0) {
+              setDesc((line.substring("Description=".length(), line.length())));
+              flagDesc = true;
+              continue;
+            }
+          }
+        }
+
+        //check for units
+        if (!flagUnits) {
+          if (line.indexOf("Units") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("Units=") == 0) {
+              setUnits((line.substring("Units=".length(), line.length())));
+              flagUnits = true;
+              continue;
+            }
+          }
+        }
+
+        //check for Missing
+        if (!flagMissing) {
+          if (line.indexOf("Missing") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("Missing=") == 0) {
+              setMissing((line.substring("Missing=".length(), line.length())));
+              flagMissing = true;
+              continue;
+            }
+          }
+        }
+
+        //check for Start
+        if (!flagStart) {
+          if (line.indexOf("Start") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("Start=") == 0) {
+              String _start = (line.substring("Start=".length(), line.length()));
+              try {
+                start = new SimpleDateFormat("yyyy-mm-ddhh:mm:ss:SS").parse(_start);
+                flagStart = true;
+                continue;
+              } catch (ParseException ex) {
+                rwChannel.close();
+                stream.close();
+                temp.close();
+                wrBuf.clear();
+                throw new Exception("The Start Date format is not specified correctly");
+              }
+            }
+          }
+        }
+
+        //check for End
+        if (!flagEnd) {
+          if (line.indexOf("End") != -1) {
+            line = line.replace(" ", "");
+            line = line.replace("\t", "");
+            if (line.indexOf("End=") == 0) {
+              String _end = (line.substring("End=".length(), line.length()));
+              try {
+                end = new SimpleDateFormat("yyyy-mm-ddhh:mm:ss:SS").parse(_end);
+                flagEnd = true;
+                continue;
+              } catch (ParseException ex) {
+                rwChannel.close();
+                stream.close();
+                temp.close();
+                wrBuf.clear();
+                throw new Exception("The End Date format is not specified correctly");
+              }
+            }
+          }
+        }
+
+        if (!verifyFirstDate) {
+          int len = "Description".length();
+          if (flagComment) {
+            wrBuf.put((getComment() + "\n").getBytes());
+          }
+          if (flagNumTs) {
+            wrBuf.put((padString("Num TS", len) + " = " + getNumTS() + "\n").getBytes());
+          }
+          if (flagTSID) {
+            wrBuf.put((padString("TSID", len) + " = " + getTSID() + "\n").getBytes());
+          }
+          if (flagDataType) {
+            wrBuf.put((padString("Data Type", len) + " = " + getDataType() + "\n").getBytes());
+          }
+          if (flagDesc) {
+            wrBuf.put((padString("Description", len) + " = " + getDesc() + "\n").getBytes());
+          }
+          if (flagUnits) {
+            wrBuf.put((padString("Units", len) + " = " + getUnits() + "\n").getBytes());
+          }
+          if (flagMissing) {
+            wrBuf.put((padString("Missing", len) + " = " + getMissing() + "\n").getBytes());
+          }
+          if (flagStart) {
+            wrBuf.put((padString("Start", len) + " = " + getStartDate() + "\n").getBytes());
+          }
+          if (flagEnd) {
+            wrBuf.put((padString("End", len) + " = " + getEndDate() + "\n").getBytes());
+          }
+          verifyFirstDate = true;
+          Date verify = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss:SS").parse(line.substring(0, "yyyy-mm-dd hh:mm:ss:SS".length()));
+          if (!verify.equals(start)) {
+            rwChannel.close();
+            stream.close();
+            temp.close();
+            wrBuf.clear();
+            throw new Exception("Start Date not equal to the first entry in the data");
+          }
+        }
+
+        if (flagStart && flagEnd && flagTSID) {
+          line += "\n";
+          wrBuf.put(line.getBytes());
+        } else {
+          rwChannel.close();
+          stream.close();
+          temp.close();
+          wrBuf.clear();
+          throw new Exception("The headers are not defined correctly. Make sure the headers are defined correctly");
+        }
+      }
+
+      rwChannel.close();
+      stream.close();
+      temp.close();
+      wrBuf.clear();
+
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+
+  }
+
+
+  protected List<Float> getValues() {
+    return this.values;
+  }
+
+
+  protected List<Date> getDateObjects() {
+    return this.dateObjects;
+  }
+
+
+  private void setNumTS(int numTS) {
+    this.numTS = numTS;
+  }
+
+
+  public int getNumTS() {
+    return numTS;
+  }
+
+
+  private void setTSID(String TSID) {
+    this.TSID = TSID;
+  }
+
+
+  public String getTSID() {
+    return this.TSID;
+  }
+
+
+  private void setDataType(String dataType) {
+    this.dataType = dataType;
+  }
+
+
+  public String getDataType() {
+    return this.dataType;
+  }
+
+
+  private void setDesc(String desc) {
+    this.desc = desc;
+  }
+
+
+  public String getDesc() {
+    return this.desc;
+  }
+
+
+  private void setUnits(String units) {
+    this.units = units;
+  }
+
+
+  public String getUnits() {
+    return this.units;
+  }
+
+
+  private void setMissing(String missing) {
+    this.missing = missing;
+  }
+
+
+  public String getMissing() {
+    return this.missing;
+  }
+
+
+  private String getStartDate() {
+    return new SimpleDateFormat("yyyy-mm-dd hh:mm:ss:SS").format(this.start);
+  }
+
+
+  private String getEndDate() {
+    return new SimpleDateFormat("yyyy-mm-dd hh:mm:ss:SS").format(this.end);
+  }
+
+
+  public Date getStart() {
+    return this.start;
+  }
+
+
+  public Date getEnd() {
+    return this.end;
+  }
+
+
+  public String getComment() {
+    return this.comment;
+  }
+
+
+  public String padString(String str, int len) {
+    for (int i = str.length(); i <= len; i++) {
+      str += " ";
+    }
+    return str;
+  }
+
 }
 
-public class ParseTimeSeries{
-    
-    public static void main(String args[])throws IOException, Exception, ParseException {
-        Date startTime =  new Date();
-        ParseData parseData = new ParseData();
-        parseData.parseFile("./data/TimeSeries/MCAN3.NHDES.MAP.1HOUR", "textFile.txt");
-        Date endTime = new Date();
-        long timetaken = endTime.getTime() - startTime.getTime();
-        System.out.println("Time taken for reading and writing 1 file is " + timetaken + "ms" );
-        System.out.println("Time taken for reading and writing 800,000 files is " + timetaken*80 + "seconds");
-        System.out.println("Time taken for reading and writing 800,000 files is " + timetaken*80/60 + "minutes");
-        System.out.println("Time taken for reading and writing 800,000 files is " + timetaken*80/3600 + "hours");
-        
-        
-    }
+public class ParseTimeSeries {
+
+  public static void main(String args[]) throws IOException, Exception, ParseException {
+    Date startTime = new Date();
+    ParseData parseData = new ParseData();
+    parseData.parseFile("./data/TimeSeries/MCAN3.NHDES.MAP.1HOUR", "textFile.txt");
+    Date endTime = new Date();
+    long timetaken = endTime.getTime() - startTime.getTime();
+    System.out.println("Time taken for reading and writing 1 file is " + timetaken + "ms");
+    System.out.println("Time taken for reading and writing 800,000 files is " + timetaken * 80 + "seconds");
+    System.out.println("Time taken for reading and writing 800,000 files is " + timetaken * 80 / 60 + "minutes");
+    System.out.println("Time taken for reading and writing 800,000 files is " + timetaken * 80 / 3600 + "hours");
+
+  }
 }