|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.s60tools.creator.components.connectionmethod; |
|
19 |
|
20 import java.util.LinkedHashMap; |
|
21 |
|
22 import com.nokia.s60tools.creator.components.AbstractVariables; |
|
23 |
|
24 /** |
|
25 * Variables for connection method |
|
26 */ |
|
27 public class ConnectionMethodVariables extends AbstractVariables { |
|
28 |
|
29 // |
|
30 // Variables for XML element names |
|
31 // |
|
32 public static final String USEPROXY_XML_ELEMENT = "useproxy"; |
|
33 public static final String PROMPTPASSWORD_XML_ELEMENT = "promptpassword"; |
|
34 public static final String SECUREAUTHENTICATION_XML_ELEMENT = "secureauthentication"; |
|
35 public static final String DISABLE_TEXT_AUTH_XML_ELEMENT = "disabletextauth"; |
|
36 public static final String WAPWSOPTION_XML_ELEMENT = "wapwspoption"; |
|
37 public static final String DATACALLLINESPEED_XML_ELEMENT = "datacalllinespeed"; |
|
38 public static final String DATACALLTYPEISDN_XML_ELEMENT = "datacalltypeisdn"; |
|
39 public static final String PROTOCOLLTYPE_XML_ELEMENT = "protocoltype"; |
|
40 public static final String BEARERTYPE_XML_ELEMENT = "bearertype"; |
|
41 |
|
42 /** |
|
43 * Only instance of this class |
|
44 */ |
|
45 private static ConnectionMethodVariables instance; |
|
46 |
|
47 /** |
|
48 * Get Singleton instance of variables |
|
49 * @return |
|
50 */ |
|
51 public static ConnectionMethodVariables getInstance() { |
|
52 |
|
53 if(instance == null){ |
|
54 instance = new ConnectionMethodVariables(); |
|
55 } |
|
56 |
|
57 return instance; |
|
58 } |
|
59 |
|
60 private ConnectionMethodVariables(){ |
|
61 init(); |
|
62 initFixedValues(); |
|
63 initMaxOccurValues(); |
|
64 } |
|
65 |
|
66 // |
|
67 // Variables to show in UI |
|
68 // |
|
69 public static final String CONNECTIONNAME = "Connection name"; |
|
70 public static final String BEARERTYPE = "Bearer type"; |
|
71 public static final String STARTPAGE = "Start page"; |
|
72 public static final String WAPWSPOPTION = "WAP WSP option"; |
|
73 public static final String PROTOCOLTYPE = "Protocol type"; |
|
74 public static final String SECUREAUTHENTICATION = "Secure authentication"; |
|
75 public static final String LOGINNAME = "Login name"; |
|
76 public static final String LOGINPASS = "Login password"; |
|
77 public static final String PROMPTPASSWORD = "Prompt password"; |
|
78 public static final String GATEWAYADDRESS = "Gateway address"; |
|
79 public static final String SUBNETMASK = "Subnetmask"; |
|
80 public static final String DEVICEIPADDR = "Device IP address"; |
|
81 public static final String IP4NAMESERVER1 = "IP v4 primary nameserver"; |
|
82 public static final String IP4NAMESERVER2 = "IP v4 secondary nameserver"; |
|
83 public static final String DATACALLTELNUMBER = "Datacall phone number"; |
|
84 public static final String DATACALLTYPEISDN = "Datacall ISDN type"; |
|
85 public static final String DATACALLLINESPEED = "Datacall line speed"; |
|
86 public static final String USEPROXY = "Use proxy"; |
|
87 public static final String PROXYSERVERADDRESS = "Proxy server address"; |
|
88 public static final String PROXYPORTNUMBER = "Proxy port number"; |
|
89 public static final String IP6NAMESERVER1 = "IP v6 primary nameserver"; |
|
90 public static final String IP6NAMESERVER2 = "IP v6 secondary nameserver"; |
|
91 public static final String DISABLETEXTAUTH = "Disable plaintext authentication"; |
|
92 public static final String WLANNAME = "SSID of WLAN connection"; |
|
93 public static final String WLANIPADDR = "IP address of Device"; |
|
94 public static final String WLANSECMODE = "WLAN Security mode"; |
|
95 public static final String WLANNETMODE = "WLAN Network mode"; |
|
96 |
|
97 // |
|
98 // Fixed variables for certain item in UI |
|
99 // |
|
100 public static final String ALL_BEARERTYPE_TYPES_AS_COMMA_SEPARATED_STRING [] = {"WLAN", "GPRS", "Datacall", "HSGSM", "Embedded", "VPN", "LAN"}; |
|
101 public static final String ALL_PROTOCOLTYPE_TYPES_AS_COMMA_SEPARATED_STRING [] = {"IPV4", "IPV6"}; |
|
102 public static final String ALL_DATACALLTYPEISDN_TYPES_AS_COMMA_SEPARATED_STRING [] = {"Analogue", "ISDNv110", "ISDNv120"}; |
|
103 public static final String ALL_DATACALLLINESPEED_TYPES_AS_COMMA_SEPARATED_STRING [] = {"AUTOMATIC", "9600", "14400", "19200", "28800", "38400", "43200", "56000"}; |
|
104 public static final String ALL_WAPWSPOPTION_TYPES_AS_COMMA_SEPARATED_STRING [] = {"Connectionless", "Connectionoriented"}; |
|
105 |
|
106 |
|
107 |
|
108 private void init() { |
|
109 |
|
110 items = new LinkedHashMap<String, String>(27); |
|
111 items.put("connectionname", CONNECTIONNAME ); |
|
112 items.put(BEARERTYPE_XML_ELEMENT, BEARERTYPE ); |
|
113 items.put("startpage", STARTPAGE ); |
|
114 items.put(WAPWSOPTION_XML_ELEMENT, WAPWSPOPTION ); |
|
115 items.put(PROTOCOLLTYPE_XML_ELEMENT, PROTOCOLTYPE ); |
|
116 items.put("loginname", LOGINNAME ); |
|
117 items.put(SECUREAUTHENTICATION_XML_ELEMENT, SECUREAUTHENTICATION ); |
|
118 items.put("loginpass", LOGINPASS ); |
|
119 items.put(PROMPTPASSWORD_XML_ELEMENT, PROMPTPASSWORD ); |
|
120 items.put("gatewayaddress", GATEWAYADDRESS ); |
|
121 items.put("subnetmask", SUBNETMASK ); |
|
122 items.put("deviceipaddr", DEVICEIPADDR ); |
|
123 items.put("ip4nameserver1", IP4NAMESERVER1 ); |
|
124 items.put("ip4nameserver2", IP4NAMESERVER2 ); |
|
125 items.put("datacalltelnumber", DATACALLTELNUMBER ); |
|
126 items.put(DATACALLTYPEISDN_XML_ELEMENT, DATACALLTYPEISDN ); |
|
127 items.put(DATACALLLINESPEED_XML_ELEMENT, DATACALLLINESPEED ); |
|
128 items.put(USEPROXY_XML_ELEMENT, USEPROXY ); |
|
129 items.put("proxyserveraddress", PROXYSERVERADDRESS ); |
|
130 items.put("proxyportnumber", PROXYPORTNUMBER ); |
|
131 items.put("ip6nameserver1", IP6NAMESERVER1 ); |
|
132 items.put("ip6nameserver2", IP6NAMESERVER2 ); |
|
133 items.put(DISABLE_TEXT_AUTH_XML_ELEMENT, DISABLETEXTAUTH ); |
|
134 items.put("wlanname", WLANNAME ); |
|
135 items.put("wlanipaddr", WLANIPADDR ); |
|
136 items.put("wlansecmode", WLANSECMODE ); |
|
137 items.put("wlannetmode", WLANNETMODE ); |
|
138 } |
|
139 |
|
140 private void initFixedValues(){ |
|
141 itemsValues = new LinkedHashMap<String, String[]>(4); |
|
142 itemsValues.put(BEARERTYPE_XML_ELEMENT, ALL_BEARERTYPE_TYPES_AS_COMMA_SEPARATED_STRING); |
|
143 itemsValues.put(PROTOCOLLTYPE_XML_ELEMENT, ALL_PROTOCOLTYPE_TYPES_AS_COMMA_SEPARATED_STRING); |
|
144 itemsValues.put(DATACALLTYPEISDN_XML_ELEMENT, ALL_DATACALLTYPEISDN_TYPES_AS_COMMA_SEPARATED_STRING); |
|
145 itemsValues.put(DATACALLLINESPEED_XML_ELEMENT, ALL_DATACALLLINESPEED_TYPES_AS_COMMA_SEPARATED_STRING); |
|
146 itemsValues.put(WAPWSOPTION_XML_ELEMENT, ALL_WAPWSPOPTION_TYPES_AS_COMMA_SEPARATED_STRING); |
|
147 itemsValues.put(DISABLE_TEXT_AUTH_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); |
|
148 itemsValues.put(SECUREAUTHENTICATION_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); |
|
149 itemsValues.put(PROMPTPASSWORD_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); |
|
150 itemsValues.put(USEPROXY_XML_ELEMENT, YES_NO_TYPES_AS_COMMA_SEPARATED_STRING); |
|
151 |
|
152 } |
|
153 |
|
154 /** |
|
155 * Inits Max Occur values for items, all items can occur only once. |
|
156 */ |
|
157 private void initMaxOccurValues(){ |
|
158 maxOccur = new LinkedHashMap<String, Integer>(4); |
|
159 |
|
160 Integer integerOne = new Integer (1); |
|
161 |
|
162 maxOccur.put( CONNECTIONNAME , integerOne ); |
|
163 maxOccur.put( BEARERTYPE , integerOne ); |
|
164 maxOccur.put( STARTPAGE , integerOne ); |
|
165 maxOccur.put( WAPWSPOPTION , integerOne ); |
|
166 maxOccur.put( PROTOCOLTYPE , integerOne ); |
|
167 maxOccur.put( LOGINNAME , integerOne ); |
|
168 maxOccur.put( SECUREAUTHENTICATION , integerOne ); |
|
169 maxOccur.put( LOGINPASS , integerOne ); |
|
170 maxOccur.put( PROMPTPASSWORD , integerOne ); |
|
171 maxOccur.put( GATEWAYADDRESS , integerOne ); |
|
172 maxOccur.put( SUBNETMASK , integerOne ); |
|
173 maxOccur.put( DEVICEIPADDR , integerOne ); |
|
174 maxOccur.put( IP4NAMESERVER1 , integerOne ); |
|
175 maxOccur.put( IP4NAMESERVER2 , integerOne ); |
|
176 maxOccur.put( DATACALLTELNUMBER , integerOne ); |
|
177 maxOccur.put( DATACALLTYPEISDN , integerOne ); |
|
178 maxOccur.put( DATACALLLINESPEED , integerOne ); |
|
179 maxOccur.put( USEPROXY , integerOne ); |
|
180 maxOccur.put( PROXYSERVERADDRESS , integerOne ); |
|
181 maxOccur.put( PROXYPORTNUMBER , integerOne ); |
|
182 maxOccur.put( IP6NAMESERVER1 , integerOne ); |
|
183 maxOccur.put( IP6NAMESERVER2 , integerOne ); |
|
184 maxOccur.put( DISABLETEXTAUTH , integerOne ); |
|
185 maxOccur.put( WLANNAME , integerOne ); |
|
186 maxOccur.put( WLANIPADDR , integerOne ); |
|
187 maxOccur.put( WLANSECMODE , integerOne ); |
|
188 maxOccur.put( WLANNETMODE , integerOne ); |
|
189 |
|
190 } |
|
191 |
|
192 protected AbstractVariables getInstanceImpl() { |
|
193 return instance; |
|
194 } |
|
195 |
|
196 } |