[IOT-1089] Change Android build system to accomodate both Android and Generic Java...
[contrib/iotivity.git] / java / iotivity-linux / src / main / java / org / iotivity / base / PlatformConfig.java
1 /*
2  *******************************************************************
3  *
4  * Copyright 2015 Intel Corporation.
5  *
6  *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21  */
22
23 package org.iotivity.base;
24
25 /**
26  * Data structure to provide the configuration.
27  */
28 public class PlatformConfig {
29     private ServiceType mServiceType;
30     private ModeType mModeType;
31     private String mIpAddress;
32     private int mPort;
33     private QualityOfService mQualityOfService;
34     private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
35                               //this is only for 0.9.2
36     /**
37      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
38      * @param modeType         indicate whether we want to do server, client or both
39      * @param ipAddress        ip address of server
40      *                         if you specify 0.0.0.0 : it listens on any interface
41      * @param port             port of server
42      *                         if you specifiy 0 : next available random port is used
43      *                         if you specify 5683 : client discovery can work even if they don't
44      *                         specify port
45      * @param qualityOfService quality of service
46      * @param dbPath           Persistant storage file for SVR Database.
47      */
48     public PlatformConfig(
49                           ServiceType serviceType,
50                           ModeType modeType,
51                           String ipAddress,
52                           int port,
53                           QualityOfService qualityOfService,
54                           String dbPath) {
55         this.mServiceType = serviceType;
56         this.mModeType = modeType;
57         this.mIpAddress = ipAddress;
58         this.mPort = port;
59         this.mQualityOfService = qualityOfService;
60         this.mSvrDbPath = dbPath;
61     }
62
63     /**
64      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
65      * @param modeType         indicate whether we want to do server, client or both
66      * @param ipAddress        ip address of server
67      *                         if you specify 0.0.0.0 : it listens on any interface
68      * @param port             port of server
69      *                         if you specifiy 0 : next available random port is used
70      *                         if you specify 5683 : client discovery can work even if they don't
71      *                         specify port
72      * @param qualityOfService quality of service
73      */
74     // Avoid breaking building java samples due to persistent storage SVR DB changes.
75     public PlatformConfig(
76                           ServiceType serviceType,
77                           ModeType modeType,
78                           String ipAddress,
79                           int port,
80                           QualityOfService qualityOfService) {
81         this(serviceType,modeType,ipAddress,port,qualityOfService, "");
82     }
83
84     public ServiceType getServiceType() {
85         return mServiceType;
86     }
87
88     public ModeType getModeType() {
89         return mModeType;
90     }
91
92     public String getIpAddress() {
93         return mIpAddress;
94     }
95
96     public int getPort() {
97         return mPort;
98     }
99
100     public QualityOfService getQualityOfService() {
101         return mQualityOfService;
102     }
103
104     public String getSvrDbPath() {
105         return mSvrDbPath;
106     }
107
108 }