diff options
Diffstat (limited to 'OpenSim/Framework/General/Types/NetworkServersInfo.cs')
-rw-r--r-- | OpenSim/Framework/General/Types/NetworkServersInfo.cs | 216 |
1 files changed, 59 insertions, 157 deletions
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs index 6259d7b..40557be 100644 --- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Framework.Interfaces; | 30 | using OpenSim.Framework.Interfaces; |
31 | using OpenSim.Framework.Configuration; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework.Types | 33 | namespace OpenSim.Framework.Types |
33 | { | 34 | { |
@@ -44,175 +45,76 @@ namespace OpenSim.Framework.Types | |||
44 | public string UserRecvKey = ""; | 45 | public string UserRecvKey = ""; |
45 | public bool isSandbox; | 46 | public bool isSandbox; |
46 | 47 | ||
47 | public uint DefaultHomeLocX = 1000; | 48 | public uint DefaultHomeLocX = 0; |
48 | public uint DefaultHomeLocY = 1000; | 49 | public uint DefaultHomeLocY = 0; |
49 | 50 | ||
50 | public int HttpListenerPort = 9000; | 51 | public int HttpListenerPort = 9000; |
51 | public int RemotingListenerPort = 8895; | 52 | public int RemotingListenerPort = 8895; |
52 | 53 | ||
53 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | 54 | private ConfigurationMember configMember; |
54 | { | ||
55 | this.isSandbox = sandboxMode; | ||
56 | |||
57 | try | ||
58 | { | ||
59 | string attri = ""; | ||
60 | |||
61 | attri = ""; | ||
62 | attri = configData.GetAttribute("HttpListenerPort"); | ||
63 | if (attri == "") | ||
64 | { | ||
65 | string location = MainLog.Instance.CmdPrompt("Http Listener Port", "9000"); | ||
66 | configData.SetAttribute("HttpListenerPort", location); | ||
67 | this.HttpListenerPort = Convert.ToInt32(location); | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | this.HttpListenerPort = Convert.ToInt32(attri); | ||
72 | } | ||
73 | |||
74 | attri = ""; | ||
75 | attri = configData.GetAttribute("RemotingListenerPort"); | ||
76 | if (attri == "") | ||
77 | { | ||
78 | string location = MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895"); | ||
79 | configData.SetAttribute("RemotingListenerPort", location); | ||
80 | this.RemotingListenerPort = Convert.ToInt32(location); | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | this.RemotingListenerPort = Convert.ToInt32(attri); | ||
85 | } | ||
86 | |||
87 | if (sandboxMode) | ||
88 | { | ||
89 | // default home location X | ||
90 | attri = ""; | ||
91 | attri = configData.GetAttribute("DefaultLocationX"); | ||
92 | if (attri == "") | ||
93 | { | ||
94 | string location = MainLog.Instance.CmdPrompt("Default Home Location X", "1000"); | ||
95 | configData.SetAttribute("DefaultLocationX", location); | ||
96 | this.DefaultHomeLocX = (uint)Convert.ToUInt32(location); | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri); | ||
101 | } | ||
102 | |||
103 | // default home location Y | ||
104 | attri = ""; | ||
105 | attri = configData.GetAttribute("DefaultLocationY"); | ||
106 | if (attri == "") | ||
107 | { | ||
108 | string location = MainLog.Instance.CmdPrompt("Default Home Location Y", "1000"); | ||
109 | configData.SetAttribute("DefaultLocationY", location); | ||
110 | this.DefaultHomeLocY = (uint)Convert.ToUInt32(location); | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri); | ||
115 | } | ||
116 | } | ||
117 | if (!isSandbox) | ||
118 | { | ||
119 | //Grid Server | ||
120 | attri = ""; | ||
121 | attri = configData.GetAttribute("GridServerURL"); | ||
122 | if (attri == "") | ||
123 | { | ||
124 | this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); | ||
125 | configData.SetAttribute("GridServerURL", this.GridURL); | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | this.GridURL = attri; | ||
130 | } | ||
131 | 55 | ||
132 | //Grid Send Key | 56 | public NetworkServersInfo(string description, string filename) |
133 | attri = ""; | 57 | { |
134 | attri = configData.GetAttribute("GridSendKey"); | 58 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleConfigurationItem); |
135 | if (attri == "") | 59 | configMember.performConfigurationRetrieve(); |
136 | { | 60 | } |
137 | this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server", "null"); | ||
138 | configData.SetAttribute("GridSendKey", this.GridSendKey); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | this.GridSendKey = attri; | ||
143 | } | ||
144 | 61 | ||
145 | //Grid Receive Key | 62 | public void loadConfigurationOptions() |
146 | attri = ""; | 63 | { |
147 | attri = configData.GetAttribute("GridRecvKey"); | ||
148 | if (attri == "") | ||
149 | { | ||
150 | this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server", "null"); | ||
151 | configData.SetAttribute("GridRecvKey", this.GridRecvKey); | ||
152 | } | ||
153 | else | ||
154 | { | ||
155 | this.GridRecvKey = attri; | ||
156 | } | ||
157 | 64 | ||
158 | //Grid Server | 65 | configMember.addConfigurationOption("HttpListenerPort", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "HTTP Listener Port", "9000"); |
159 | attri = ""; | 66 | configMember.addConfigurationOption("RemotingListenerPort", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Remoting Listener Port", "8895"); |
160 | attri = configData.GetAttribute("UserServerURL"); | 67 | configMember.addConfigurationOption("DefaultLocationX", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Default Home Location (X Axis)", "1000"); |
161 | if (attri == "") | 68 | configMember.addConfigurationOption("DefaultLocationY", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Default Home Location (Y Axis)", "1000"); |
162 | { | ||
163 | this.UserURL= MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/"); | ||
164 | configData.SetAttribute("UserServerURL", this.UserURL); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | this.UserURL = attri; | ||
169 | } | ||
170 | 69 | ||
171 | //Grid Send Key | 70 | configMember.addConfigurationOption("GridServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Grid Server URL", "http://127.0.0.1:8001"); |
172 | attri = ""; | 71 | configMember.addConfigurationOption("GridSendKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null"); |
173 | attri = configData.GetAttribute("UserSendKey"); | 72 | configMember.addConfigurationOption("GridRecvKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null"); |
174 | if (attri == "") | ||
175 | { | ||
176 | this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server", "null"); | ||
177 | configData.SetAttribute("UserSendKey", this.UserSendKey); | ||
178 | } | ||
179 | else | ||
180 | { | ||
181 | this.UserSendKey = attri; | ||
182 | } | ||
183 | 73 | ||
184 | //Grid Receive Key | 74 | configMember.addConfigurationOption("UserServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "User Server URL", "http://127.0.0.1:8002"); |
185 | attri = ""; | 75 | configMember.addConfigurationOption("UserSendKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null"); |
186 | attri = configData.GetAttribute("UserRecvKey"); | 76 | configMember.addConfigurationOption("UserRecvKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null"); |
187 | if (attri == "") | ||
188 | { | ||
189 | this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server", "null"); | ||
190 | configData.SetAttribute("UserRecvKey", this.UserRecvKey); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | this.UserRecvKey = attri; | ||
195 | } | ||
196 | 77 | ||
197 | attri = ""; | 78 | configMember.addConfigurationOption("AssetServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Asset Server URL", "http://127.0.0.1:8003"); |
198 | attri = configData.GetAttribute("AssetServerURL"); | 79 | } |
199 | if (attri == "") | ||
200 | { | ||
201 | this.AssetURL = MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); | ||
202 | configData.SetAttribute("AssetServerURL", this.GridURL); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | this.AssetURL = attri; | ||
207 | } | ||
208 | 80 | ||
209 | } | 81 | public void handleConfigurationItem(string configuration_key, object configuration_object) |
210 | configData.Commit(); | 82 | { |
211 | } | 83 | switch (configuration_key) |
212 | catch (Exception e) | ||
213 | { | 84 | { |
214 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | 85 | case "HttpListenerPort": |
215 | MainLog.Instance.Warn(e.ToString()); | 86 | this.HttpListenerPort = (int)configuration_object; |
87 | break; | ||
88 | case "RemotingListenerPort": | ||
89 | this.RemotingListenerPort = (int)configuration_object; | ||
90 | break; | ||
91 | case "DefaultLocationX": | ||
92 | this.DefaultHomeLocX = (uint)configuration_object; | ||
93 | break; | ||
94 | case "DefaultLocationY": | ||
95 | this.DefaultHomeLocY = (uint)configuration_object; | ||
96 | break; | ||
97 | case "GridServerURL": | ||
98 | this.GridURL = (string)configuration_object; | ||
99 | break; | ||
100 | case "GridSendKey": | ||
101 | this.GridSendKey = (string)configuration_object; | ||
102 | break; | ||
103 | case "GridRecvKey": | ||
104 | this.GridRecvKey = (string)configuration_object; | ||
105 | break; | ||
106 | case "UserServerURL": | ||
107 | this.UserURL = (string)configuration_object; | ||
108 | break; | ||
109 | case "UserSendKey": | ||
110 | this.UserSendKey = (string)configuration_object; | ||
111 | break; | ||
112 | case "UserRecvKey": | ||
113 | this.UserRecvKey = (string)configuration_object; | ||
114 | break; | ||
115 | case "AssetServerURL": | ||
116 | this.AssetURL = (string)configuration_object; | ||
117 | break; | ||
216 | } | 118 | } |
217 | } | 119 | } |
218 | } | 120 | } |