Cleaning up code for runtime, installer, RMI, compiler for the Java side
[iot2.git] / iotjava / iotruntime / slave / IoTDeviceAddress.java
index 2917e98dfaed1d33a6d467c7196a60daa76788d6..b4224adf2ebf5722766f0aae849ae2e90a981b2f 100644 (file)
@@ -13,7 +13,7 @@ import java.net.UnknownHostException;
  * @version     1.0\r
  * @since       2016-02-18\r
  */\r
-public class IoTDeviceAddress extends IoTAddress {\r
+public final class IoTDeviceAddress extends IoTAddress {\r
 \r
        /**\r
         * IoTDeviceAddress class properties\r
@@ -36,7 +36,7 @@ public class IoTDeviceAddress extends IoTAddress {
         * @param   _isSrcPortWildCard  Is this source port a wild card (=can change port number)?\r
         * @param   _isDstPortWildCard  Is this destination port a wild card (=can change port number)?\r
         */\r
-       protected IoTDeviceAddress(String _sAddress, int _iSrcPort, int _iDstPort, boolean _isSrcPortWildCard, \r
+       protected IoTDeviceAddress(String _sAddress, int _iSrcPort, int _iDstPort, boolean _isSrcPortWildCard,\r
                boolean _isDstPortWildCard) throws UnknownHostException {\r
 \r
                super(_sAddress);\r
@@ -136,4 +136,30 @@ public class IoTDeviceAddress extends IoTAddress {
        public boolean getIsDstPortWildcard() {\r
                return isDstPortWildCard;\r
        }\r
+\r
+       /**\r
+        * getURL() method\r
+        *\r
+        * @return  String\r
+        */\r
+       public String getURL(String strURLComplete) {\r
+\r
+               //e.g. http:// + inetAddress.getHostAddress() + strURLComplete\r
+               //     http://192.168.2.254/cgi-bin/mjpg/video.cgi?\r
+               return "http://" + inetAddress.getHostAddress() + ":" + iDstPort + strURLComplete;\r
+\r
+       }\r
+       \r
+       /**\r
+        * getURL() method\r
+        *\r
+        * @return  String\r
+        */\r
+       public String getURL(String strURLComplete, String strUser, String strPassword) {\r
+\r
+               //e.g. http:// + inetAddress.getHostAddress() + strURLComplete\r
+               //     http://192.168.2.254/cgi-bin/mjpg/video.cgi?\r
+               return "http://" + strUser + ":" + strPassword + "@" + inetAddress.getHostAddress() + ":" + iDstPort + strURLComplete;\r
+\r
+       }\r
 }\r