add comments on Database part
This commit is contained in:
		| @@ -6,7 +6,6 @@ import ch.hevs.isi.core.DataPoint; | ||||
| import ch.hevs.isi.core.DataPointListener; | ||||
| import ch.hevs.isi.core.FloatDataPoint; | ||||
| import ch.hevs.isi.utils.Utility; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.io.OutputStreamWriter; | ||||
| @@ -19,7 +18,7 @@ import java.util.Properties; | ||||
|  | ||||
|  | ||||
| public class DatabaseConnector implements DataPointListener { | ||||
|     private final Properties properties = new Properties();           // Properties of the config.properties file | ||||
|     private final Properties properties = new Properties();     // Properties of the config.properties file | ||||
|     private URL urlForWrite = null;                             // URL of the InfluxDB server | ||||
|     private HttpURLConnection con = null;                       // Connection to the InfluxDB server | ||||
|     private boolean initialized = false;                        // Boolean to know if the database connector is initialized | ||||
| @@ -124,8 +123,8 @@ public class DatabaseConnector implements DataPointListener { | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Push the data point to the database | ||||
|      * @param dp Data point to push | ||||
|      * Add the timestamp to the data point | ||||
|      * @param dp Data point to add the timestamp | ||||
|      */ | ||||
|     private void pushToDatabase(DataPoint dp) { | ||||
|         // Initialize the database connector if not already done | ||||
| @@ -142,6 +141,12 @@ public class DatabaseConnector implements DataPointListener { | ||||
|         sendDataToDatabase(data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Create and formate the request to send to the database | ||||
|      * Send the request to the database | ||||
|      * Check if the data is correctly send to the database with the response code | ||||
|      * @param data Data to send to the database | ||||
|      */ | ||||
|     private void sendDataToDatabase(String data){ | ||||
|         try { | ||||
|             // Create connection and set headers | ||||
|   | ||||
		Reference in New Issue
	
	Block a user