aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-08-04 18:15:48 +0000
committerMW2007-08-04 18:15:48 +0000
commitf1e10e555d1cc7bee40b4fd05caf2507c5808816 (patch)
tree26b17b33db5726efb0f5a4983a607401fa58d04a /OpenSim
parentOpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs (diff)
downloadopensim-SC_OLD-f1e10e555d1cc7bee40b4fd05caf2507c5808816.zip
opensim-SC_OLD-f1e10e555d1cc7bee40b4fd05caf2507c5808816.tar.gz
opensim-SC_OLD-f1e10e555d1cc7bee40b4fd05caf2507c5808816.tar.bz2
opensim-SC_OLD-f1e10e555d1cc7bee40b4fd05caf2507c5808816.tar.xz
clean up of startup config settings (command line args etc),
Now using the Nini configuration library (suggest we look into using this for the rest of our config handling, as it provides a standard interface for command line args, INI files, Xml files, .NET config files, and windows registry). One IMPORTANT change is that to TO START GRIDMODE , you need to now use -gridmode=true . Also need someone to test it under mono. (there is a dll that has been compiled under mono available, just hoping that we don't have to deal with separate dlls for windows and linux.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/Application.cs71
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs73
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs14
5 files changed, 71 insertions, 101 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index a8c40ec..b07a4d6 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
31 32
32namespace OpenSim 33namespace OpenSim
33{ 34{
@@ -52,70 +53,16 @@ namespace OpenSim
52 53
53 Console.WriteLine("Starting...\n"); 54 Console.WriteLine("Starting...\n");
54 55
55 bool sandBoxMode = true; 56 ArgvConfigSource source = new ArgvConfigSource(args);
56 bool startLoginServer = true;
57 string physicsEngine = "basicphysics";
58 57
59 bool userAccounts = false; 58 source.AddSwitch("Startup", "inifile");
60 bool gridLocalAsset = false; 59 source.AddSwitch("Startup", "configfile");
61 bool useConfigFile = false; 60 source.AddSwitch("Startup", "gridmode");
62 bool silent = false; 61 source.AddSwitch("Startup", "physics");
63 string configFile = "simconfig.xml"; 62 source.AddSwitch("Startup", "config");
64 63 source.AddSwitch("Startup", "noverbose");
65 for (int i = 0; i < args.Length; i++)
66 {
67 if (args[i] == "-gridmode")
68 {
69 sandBoxMode = false;
70 startLoginServer = false;
71 }
72
73 if (args[i] == "-accounts")
74 {
75 userAccounts = true;
76 }
77 if (args[i] == "-realphysx")
78 {
79 physicsEngine = "RealPhysX";
80 }
81 if (args[i] == "-bulletX")
82 {
83 physicsEngine = "BulletXEngine";
84 }
85 if (args[i] == "-ode")
86 {
87 physicsEngine = "OpenDynamicsEngine";
88 }
89 if (args[i] == "-localasset")
90 {
91 gridLocalAsset = true;
92 }
93 if (args[i] == "-configfile")
94 {
95 useConfigFile = true;
96 }
97 if (args[i] == "-noverbose")
98 {
99 silent = true;
100 }
101 if (args[i] == "-config")
102 {
103 try
104 {
105 i++;
106 configFile = args[i];
107 }
108 catch (Exception e)
109 {
110 Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")");
111 }
112 }
113 }
114
115 OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile);
116 64
117 sim.user_accounts = userAccounts; 65 OpenSimMain sim = new OpenSimMain(source);
118 sim.m_gridLocalAsset = gridLocalAsset;
119 66
120 sim.StartUp(); 67 sim.StartUp();
121 68
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index fbd6790..c68f75e 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -29,6 +29,7 @@
29using System; 29using System;
30using System.IO; 30using System.IO;
31using libsecondlife; 31using libsecondlife;
32using Nini.Config;
32using OpenSim.Assets; 33using OpenSim.Assets;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
@@ -39,7 +40,7 @@ using OpenSim.Framework.Servers;
39using OpenSim.Framework.Types; 40using OpenSim.Framework.Types;
40using OpenSim.Framework.Configuration; 41using OpenSim.Framework.Configuration;
41using OpenSim.Physics.Manager; 42using OpenSim.Physics.Manager;
42 43
43using OpenSim.Region.ClientStack; 44using OpenSim.Region.ClientStack;
44using OpenSim.Region.Communications.Local; 45using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1; 46using OpenSim.Region.Communications.OGS1;
@@ -57,7 +58,6 @@ namespace OpenSim
57 { 58 {
58 public string m_physicsEngine; 59 public string m_physicsEngine;
59 public bool m_sandbox; 60 public bool m_sandbox;
60 public bool m_loginserver;
61 public bool user_accounts; 61 public bool user_accounts;
62 public bool m_gridLocalAsset; 62 public bool m_gridLocalAsset;
63 protected bool m_useConfigFile; 63 protected bool m_useConfigFile;
@@ -70,18 +70,37 @@ namespace OpenSim
70 private bool m_silent; 70 private bool m_silent;
71 private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log"); 71 private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log");
72 72
73 public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngineName, bool useConfigFile, bool silent, string configFileName) 73 public OpenSimMain(IConfigSource configSource)
74 :base( ) 74 : base()
75 {
76 IConfigSource startupSource = configSource;
77 string iniFile = startupSource.Configs["Startup"].GetString("inifile", "NA");
78 if (iniFile != "NA")
79 {
80 //a ini is set to be used for startup settings
81 string iniFilePath = Path.Combine(Util.configDir(), iniFile);
82 if (File.Exists(iniFilePath))
83 {
84 startupSource = new IniConfigSource(iniFilePath);
85
86 //enable follow line, if we want the original config source(normally commandline args) merged with ini file settings.
87 //in this case we have it so if both sources have the same named setting, command line value will overwrite the ini file value.
88 //(as if someone has bothered to enter a command line arg, we should take notice of it)
89 //startupSource.Merge(configSource);
90 }
91 }
92 ReadConfigSettings(startupSource);
93 }
94
95 protected void ReadConfigSettings(IConfigSource configSource)
75 { 96 {
76 m_useConfigFile = useConfigFile; 97 m_useConfigFile = configSource.Configs["Startup"].GetBoolean("configfile", false);
77 m_sandbox = sandBoxMode; 98 m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false);
78 m_loginserver = startLoginServer; 99 m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics");
79 m_physicsEngine = physicsEngineName; 100 m_configFileName = configSource.Configs["Startup"].GetString("config", "simconfig.xml");
80 m_configFileName = configFileName; 101 m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false);
81 m_silent = silent;
82 } 102 }
83 103
84
85 /// <summary> 104 /// <summary>
86 /// Performs initialisation of the scene, such as loading configuration from disk. 105 /// Performs initialisation of the scene, such as loading configuration from disk.
87 /// </summary> 106 /// </summary>
@@ -91,7 +110,7 @@ namespace OpenSim
91 { 110 {
92 Directory.CreateDirectory(Util.logDir()); 111 Directory.CreateDirectory(Util.logDir());
93 } 112 }
94 m_log = new LogBase(Path.Combine(Util.logDir(),m_logFilename), "Region", this, m_silent); 113 m_log = new LogBase(Path.Combine(Util.logDir(), m_logFilename), "Region", this, m_silent);
95 MainLog.Instance = m_log; 114 MainLog.Instance = m_log;
96 115
97 base.StartUp(); 116 base.StartUp();
@@ -103,11 +122,11 @@ namespace OpenSim
103 122
104 if (m_sandbox) 123 if (m_sandbox)
105 { 124 {
106 m_commsManager = new CommunicationsLocal( m_networkServersInfo, m_httpServer, m_assetCache); 125 m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache);
107 } 126 }
108 else 127 else
109 { 128 {
110 m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer , m_assetCache); 129 m_commsManager = new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache);
111 } 130 }
112 131
113 132
@@ -129,15 +148,15 @@ namespace OpenSim
129 148
130 for (int i = 0; i < configFiles.Length; i++) 149 for (int i = 0; i < configFiles.Length; i++)
131 { 150 {
132 Console.WriteLine("Loading region config file"); 151 //Console.WriteLine("Loading region config file");
133 RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); 152 RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]);
134 153
135 UDPServer udpServer; 154 UDPServer udpServer;
136 Scene scene = SetupScene(regionInfo, out udpServer); 155 Scene scene = SetupScene(regionInfo, out udpServer);
137 156
138 m_localScenes.Add(scene); 157 m_localScenes.Add(scene);
139 158
140 159
141 m_udpServers.Add(udpServer); 160 m_udpServers.Add(udpServer);
142 m_regionData.Add(regionInfo); 161 m_regionData.Add(regionInfo);
143 } 162 }
@@ -148,7 +167,7 @@ namespace OpenSim
148 this.m_udpServers[i].ServerListener(); 167 this.m_udpServers[i].ServerListener();
149 } 168 }
150 169
151 170
152 } 171 }
153 172
154 protected override StorageManager CreateStorageManager(RegionInfo regionInfo) 173 protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
@@ -160,10 +179,10 @@ namespace OpenSim
160 { 179 {
161 return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer); 180 return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer);
162 } 181 }
163 182
164 protected override void Initialize() 183 protected override void Initialize()
165 { 184 {
166 m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(),"network_servers_information.xml")); 185 m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(), "network_servers_information.xml"));
167 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 186 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
168 m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 187 m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
169 } 188 }
@@ -174,15 +193,15 @@ namespace OpenSim
174 { 193 {
175 Directory.CreateDirectory(Util.logDir()); 194 Directory.CreateDirectory(Util.logDir());
176 } 195 }
177 196
178 return new LogBase((Path.Combine(Util.logDir(),m_logFilename)), "Region", this, m_silent); 197 return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, m_silent);
179 } 198 }
180 199
181 # region Setup methods 200 # region Setup methods
182 201
183 protected override PhysicsScene GetPhysicsScene( ) 202 protected override PhysicsScene GetPhysicsScene()
184 { 203 {
185 return GetPhysicsScene( m_physicsEngine ); 204 return GetPhysicsScene(m_physicsEngine);
186 } 205 }
187 206
188 private class SimStatusHandler : IStreamHandler 207 private class SimStatusHandler : IStreamHandler
@@ -201,7 +220,7 @@ namespace OpenSim
201 { 220 {
202 get { return "GET"; } 221 get { return "GET"; }
203 } 222 }
204 223
205 public string Path 224 public string Path
206 { 225 {
207 get { return "/simstatus/"; } 226 get { return "/simstatus/"; }
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 3f1ba18..ea93050 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment
57 return false; 57 return false;
58 58
59 SceneObject task = (SceneObject)m_scene.Entities[obj]; 59 SceneObject task = (SceneObject)m_scene.Entities[obj];
60 LLUUID taskOwner = null; // Since we dont have a 'owner' property on task yet 60 LLUUID taskOwner = task.rootPrimitive.OwnerID;
61 61
62 // Object owners should be able to edit their own content 62 // Object owners should be able to edit their own content
63 if (user == taskOwner) 63 if (user == taskOwner)
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
index 8ed04d9..3eb34b4 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
@@ -94,16 +94,24 @@ namespace OpenSim.Region.Environment.Scenes
94 return dupe; 94 return dupe;
95 } 95 }
96 96
97 /// <summary>
98 ///
99 /// </summary>
100 /// <param name="part"></param>
97 public void CopyRootPart(AllNewSceneObjectPart2 part) 101 public void CopyRootPart(AllNewSceneObjectPart2 part)
98 { 102 {
99 AllNewSceneObjectPart2 newPart = part.Copy(m_scene); 103 AllNewSceneObjectPart2 newPart = part.Copy(m_scene.PrimIDAllocate());
100 this.m_parts.Add(newPart.UUID, newPart); 104 this.m_parts.Add(newPart.UUID, newPart);
101 this.SetPartAsRoot(newPart); 105 this.SetPartAsRoot(newPart);
102 } 106 }
103 107
108 /// <summary>
109 ///
110 /// </summary>
111 /// <param name="part"></param>
104 public void CopyPart(AllNewSceneObjectPart2 part) 112 public void CopyPart(AllNewSceneObjectPart2 part)
105 { 113 {
106 AllNewSceneObjectPart2 newPart = part.Copy(m_scene); 114 AllNewSceneObjectPart2 newPart = part.Copy(m_scene.PrimIDAllocate());
107 this.m_parts.Add(newPart.UUID, newPart); 115 this.m_parts.Add(newPart.UUID, newPart);
108 this.SetPartAsNonRoot(newPart); 116 this.SetPartAsNonRoot(newPart);
109 } 117 }
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
index 65b4287..42acab9 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
@@ -27,7 +27,7 @@ namespace OpenSim.Region.Environment.Scenes
27 public uint EveryoneMask = FULL_MASK_PERMISSIONS; 27 public uint EveryoneMask = FULL_MASK_PERMISSIONS;
28 public uint BaseMask = FULL_MASK_PERMISSIONS; 28 public uint BaseMask = FULL_MASK_PERMISSIONS;
29 29
30 protected PrimitiveBaseShape m_shape; 30
31 protected byte[] m_particleSystem = new byte[0]; 31 protected byte[] m_particleSystem = new byte[0];
32 32
33 protected AllNewSceneObjectGroup2 m_parentGroup; 33 protected AllNewSceneObjectGroup2 m_parentGroup;
@@ -54,9 +54,6 @@ namespace OpenSim.Region.Environment.Scenes
54 } 54 }
55 55
56 protected string m_name; 56 protected string m_name;
57 /// <summary>
58 ///
59 /// </summary>
60 public virtual string Name 57 public virtual string Name
61 { 58 {
62 get { return m_name; } 59 get { return m_name; }
@@ -154,9 +151,9 @@ namespace OpenSim.Region.Environment.Scenes
154 set { m_touchName = value; } 151 set { m_touchName = value; }
155 } 152 }
156 153
154 protected PrimitiveBaseShape m_shape;
157 public PrimitiveBaseShape Shape 155 public PrimitiveBaseShape Shape
158 { 156 {
159
160 get { return this.m_shape; } 157 get { return this.m_shape; }
161 set { m_shape = value; } 158 set { m_shape = value; }
162 } 159 }
@@ -245,14 +242,13 @@ namespace OpenSim.Region.Environment.Scenes
245 /// 242 ///
246 /// </summary> 243 /// </summary>
247 /// <returns></returns> 244 /// <returns></returns>
248 public AllNewSceneObjectPart2 Copy(Scene scene) 245 public AllNewSceneObjectPart2 Copy(uint localID)
249 { 246 {
250 AllNewSceneObjectPart2 dupe = (AllNewSceneObjectPart2)this.MemberwiseClone(); 247 AllNewSceneObjectPart2 dupe = (AllNewSceneObjectPart2)this.MemberwiseClone();
251 dupe.m_shape = m_shape.Copy(); 248 dupe.m_shape = m_shape.Copy();
252 dupe.m_regionHandle = m_regionHandle; 249 dupe.m_regionHandle = m_regionHandle;
253 uint newLocalID = scene.PrimIDAllocate();
254 dupe.UUID = LLUUID.Random(); 250 dupe.UUID = LLUUID.Random();
255 dupe.LocalID = newLocalID; 251 dupe.LocalID = localID;
256 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z); 252 dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
257 dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W); 253 dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W);
258 dupe.Velocity = new LLVector3(0, 0, 0); 254 dupe.Velocity = new LLVector3(0, 0, 0);
@@ -303,7 +299,7 @@ namespace OpenSim.Region.Environment.Scenes
303 } 299 }
304 else 300 else
305 { 301 {
306 if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes 302 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
307 { 303 {
308 SendFullUpdateToAllClients(); 304 SendFullUpdateToAllClients();
309 ClearUpdateSchedule(); 305 ClearUpdateSchedule();