aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-04-23 20:48:23 +0000
committerSean Dague2008-04-23 20:48:23 +0000
commit3dd98a112f4308532d768943690b13c403dff68b (patch)
tree6c33ceb05d8c431720ffca11be2d025a1782fc78 /OpenSim
parentchanges to allow asset_source to be specified in the opensim.ini (diff)
downloadopensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.zip
opensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.tar.gz
opensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.tar.bz2
opensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.tar.xz
allow for Inventory database source to be specified in main
configs. This works with sqlite and nhibernate backends, and stays with default seperate ini files for mysql and mssql until someone writes those.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs6
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs10
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs26
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs16
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs4
-rw-r--r--OpenSim/Framework/IInventoryData.cs2
-rw-r--r--OpenSim/Framework/InventoryConfig.cs42
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs4
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs2
11 files changed, 69 insertions, 51 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 27f8b60..c524fc0 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -51,6 +51,12 @@ namespace OpenSim.Data.MSSQL
51 /// <summary> 51 /// <summary>
52 /// Loads and initialises this database plugin 52 /// Loads and initialises this database plugin
53 /// </summary> 53 /// </summary>
54 public void Initialise(string connect)
55 {
56 // TODO: actually use the provided connect string
57 Initialise();
58 }
59
54 public void Initialise() 60 public void Initialise()
55 { 61 {
56 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); 62 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index dbcb9bd..6261d37 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -51,6 +51,12 @@ namespace OpenSim.Data.MySQL
51 /// <summary> 51 /// <summary>
52 /// Loads and initialises this database plugin 52 /// Loads and initialises this database plugin
53 /// </summary> 53 /// </summary>
54 public void Initialise(string connect)
55 {
56 // TODO: actually use the provided connect string
57 Initialise();
58 }
59
54 public void Initialise() 60 public void Initialise()
55 { 61 {
56 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 62 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index 7bd4a0b..beac693 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -55,11 +55,11 @@ namespace OpenSim.Data.NHibernate
55 55
56 public override void Initialise(string connect) 56 public override void Initialise(string connect)
57 { 57 {
58 // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test 58 // Split out the dialect, driver, and connect string
59 char[] split = {';'}; 59 char[] split = {';'};
60 string[] parts = connect.Split(split); 60 string[] parts = connect.Split(split);
61 61
62 // This is stubbing for now, it will become dynamic later and support different db backends 62 // NHibernate setup
63 cfg = new Configuration(); 63 cfg = new Configuration();
64 cfg.SetProperty(Environment.ConnectionProvider, 64 cfg.SetProperty(Environment.ConnectionProvider,
65 "NHibernate.Connection.DriverConnectionProvider"); 65 "NHibernate.Connection.DriverConnectionProvider");
@@ -74,7 +74,11 @@ namespace OpenSim.Data.NHibernate
74 using ( MemoryStream stream = 74 using ( MemoryStream stream =
75 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) 75 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
76 cfg.AddInputStream(stream); 76 cfg.AddInputStream(stream);
77 77
78 // If uncommented this will auto create tables, but it
79 // does drops of the old tables, so we need a smarter way
80 // to acturally manage this.
81
78 // new SchemaExport(cfg).Create(true, true); 82 // new SchemaExport(cfg).Create(true, true);
79 83
80 factory = cfg.BuildSessionFactory(); 84 factory = cfg.BuildSessionFactory();
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 1ac0f0c..938f47c 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -50,25 +50,21 @@ namespace OpenSim.Data.NHibernate
50 /// <summary> 50 /// <summary>
51 /// Initialises the interface 51 /// Initialises the interface
52 /// </summary> 52 /// </summary>
53 public void Initialise() 53 public void Initialise(string connect)
54 { 54 {
55 Initialise("Inventory.db", "Inventory"); 55 // Split out the dialect, driver, and connect string
56 } 56 char[] split = {';'};
57 57 string[] parts = connect.Split(split);
58 public void Initialise(string dbfile, string dbname) 58
59 { 59 // Establish NHibernate Connection
60 // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test
61
62 // This is stubbing for now, it will become dynamic later and support different db backends
63 cfg = new Configuration(); 60 cfg = new Configuration();
64 cfg.SetProperty(Environment.ConnectionProvider, 61 cfg.SetProperty(Environment.ConnectionProvider,
65 "NHibernate.Connection.DriverConnectionProvider"); 62 "NHibernate.Connection.DriverConnectionProvider");
66 cfg.SetProperty(Environment.Dialect, 63 cfg.SetProperty(Environment.Dialect,
67 "NHibernate.Dialect.SQLiteDialect"); 64 "NHibernate.Dialect." + parts[0]);
68 cfg.SetProperty(Environment.ConnectionDriver, 65 cfg.SetProperty(Environment.ConnectionDriver,
69 "NHibernate.Driver.SqliteClientDriver"); 66 "NHibernate.Driver." + parts[1]);
70 cfg.SetProperty(Environment.ConnectionString, 67 cfg.SetProperty(Environment.ConnectionString, parts[2]);
71 "URI=file:" + dbfile + ",version=3");
72 cfg.AddAssembly("OpenSim.Data.NHibernate"); 68 cfg.AddAssembly("OpenSim.Data.NHibernate");
73 69
74 HbmSerializer.Default.Validate = true; 70 HbmSerializer.Default.Validate = true;
@@ -76,6 +72,10 @@ namespace OpenSim.Data.NHibernate
76 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) 72 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
77 cfg.AddInputStream(stream); 73 cfg.AddInputStream(stream);
78 74
75 // If uncommented this will auto create tables, but it
76 // does drops of the old tables, so we need a smarter way
77 // to acturally manage this.
78
79 // new SchemaExport(cfg).Create(true, true); 79 // new SchemaExport(cfg).Create(true, true);
80 80
81 factory = cfg.BuildSessionFactory(); 81 factory = cfg.BuildSessionFactory();
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 442ba39..2eb0ad5 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -50,17 +50,13 @@ namespace OpenSim.Data.SQLite
50 /// <summary> 50 /// <summary>
51 /// Initialises the interface 51 /// Initialises the interface
52 /// </summary> 52 /// </summary>
53 public void Initialise() 53 public void Initialise(string dbconnect)
54 { 54 {
55 Initialise("inventoryStore.db", "inventoryDatabase"); 55 if (dbconnect == string.Empty) {
56 } 56 dbconnect = "URI=file:inventoryStore.db,version=3";
57 57 }
58 public void Initialise(string dbfile, string dbname) 58 m_log.Info("[Inventory]: Sqlite - connecting: " + dbconnect);
59 { 59 SqliteConnection conn = new SqliteConnection(dbconnect);
60 string connectionString = "URI=file:" + dbfile + ",version=3";
61
62 m_log.Info("[Inventory]: Sqlite - connecting: " + dbfile);
63 SqliteConnection conn = new SqliteConnection(connectionString);
64 60
65 conn.Open(); 61 conn.Open();
66 62
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 769c530..5cbfcf9 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Framework.Communications
46 /// Adds a new user server plugin - plugins will be requested in the order they were loaded. 46 /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
47 /// </summary> 47 /// </summary>
48 /// <param name="FileName">The filename to the user server plugin DLL</param> 48 /// <param name="FileName">The filename to the user server plugin DLL</param>
49 public void AddPlugin(string FileName) 49 public void AddPlugin(string FileName, string connect)
50 { 50 {
51 if (!String.IsNullOrEmpty(FileName)) 51 if (!String.IsNullOrEmpty(FileName))
52 { 52 {
@@ -63,7 +63,7 @@ namespace OpenSim.Framework.Communications
63 { 63 {
64 IInventoryData plug = 64 IInventoryData plug =
65 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 65 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
66 plug.Initialise(); 66 plug.Initialise(connect);
67 m_plugins.Add(plug.getName(), plug); 67 m_plugins.Add(plug.getName(), plug);
68 m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface"); 68 m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface");
69 } 69 }
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Framework/IInventoryData.cs
index d72231d..508099e 100644
--- a/OpenSim/Framework/IInventoryData.cs
+++ b/OpenSim/Framework/IInventoryData.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework
38 /// <summary> 38 /// <summary>
39 /// Initialises the interface 39 /// Initialises the interface
40 /// </summary> 40 /// </summary>
41 void Initialise(); 41 void Initialise(string connect);
42 42
43 /// <summary> 43 /// <summary>
44 /// Closes the interface 44 /// Closes the interface
diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs
index 39a6930..1e22fe8 100644
--- a/OpenSim/Framework/InventoryConfig.cs
+++ b/OpenSim/Framework/InventoryConfig.cs
@@ -40,6 +40,7 @@ namespace OpenSim.Framework
40 public string UserRecvKey = String.Empty; 40 public string UserRecvKey = String.Empty;
41 41
42 public string DatabaseProvider = String.Empty; 42 public string DatabaseProvider = String.Empty;
43 public string DatabaseConnect = String.Empty;
43 public static uint DefaultHttpPort = 8004; 44 public static uint DefaultHttpPort = 8004;
44 45
45 public uint HttpPort = DefaultHttpPort; 46 public uint HttpPort = DefaultHttpPort;
@@ -68,6 +69,8 @@ namespace OpenSim.Framework
68 "Key to expect from user server", "null", false); 69 "Key to expect from user server", "null", false);
69 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 70 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
70 "DLL for database provider", "OpenSim.Data.SQLite.dll", false); 71 "DLL for database provider", "OpenSim.Data.SQLite.dll", false);
72 configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
73 "Database Connect String", "", false);
71 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 74 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
72 "Http Listener port", DefaultHttpPort.ToString(), false); 75 "Http Listener port", DefaultHttpPort.ToString(), false);
73 } 76 }
@@ -76,24 +79,27 @@ namespace OpenSim.Framework
76 { 79 {
77 switch (configuration_key) 80 switch (configuration_key)
78 { 81 {
79 case "default_startup_message": 82 case "default_startup_message":
80 DefaultStartupMsg = (string) configuration_result; 83 DefaultStartupMsg = (string) configuration_result;
81 break; 84 break;
82 case "default_user_server": 85 case "default_user_server":
83 UserServerURL = (string) configuration_result; 86 UserServerURL = (string) configuration_result;
84 break; 87 break;
85 case "user_send_key": 88 case "user_send_key":
86 UserSendKey = (string) configuration_result; 89 UserSendKey = (string) configuration_result;
87 break; 90 break;
88 case "user_recv_key": 91 case "user_recv_key":
89 UserRecvKey = (string) configuration_result; 92 UserRecvKey = (string) configuration_result;
90 break; 93 break;
91 case "database_provider": 94 case "database_provider":
92 DatabaseProvider = (string) configuration_result; 95 DatabaseProvider = (string) configuration_result;
93 break; 96 break;
94 case "http_port": 97 case "database_connect":
95 HttpPort = (uint) configuration_result; 98 DatabaseConnect = (string) configuration_result;
96 break; 99 break;
100 case "http_port":
101 HttpPort = (uint) configuration_result;
102 break;
97 } 103 }
98 104
99 return true; 105 return true;
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index b3c6891..1d4a4e3 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Grid.InventoryServer
48 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. 48 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
49 /// </summary> 49 /// </summary>
50 /// <param name="FileName">The filename to the inventory server plugin DLL</param> 50 /// <param name="FileName">The filename to the inventory server plugin DLL</param>
51 public void AddDatabasePlugin(string FileName) 51 public void AddDatabasePlugin(string FileName, string dbconnect)
52 { 52 {
53 m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName); 53 m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName);
54 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 54 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
@@ -65,7 +65,7 @@ namespace OpenSim.Grid.InventoryServer
65 { 65 {
66 IInventoryData plug = 66 IInventoryData plug =
67 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 67 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
68 plug.Initialise(); 68 plug.Initialise(dbconnect);
69 _databasePlugin = plug; 69 _databasePlugin = plug;
70 m_log.Info("[" + OpenInventory_Main.LogName + "]: " + 70 m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
71 "Invenstorage: Added IInventoryData Interface"); 71 "Invenstorage: Added IInventoryData Interface");
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 2454650..85d9ba5 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Grid.InventoryServer
72 72
73 m_inventoryService = new GridInventoryService(); 73 m_inventoryService = new GridInventoryService();
74 // m_inventoryManager = new InventoryManager(); 74 // m_inventoryManager = new InventoryManager();
75 m_inventoryService.AddPlugin(m_config.DatabaseProvider); 75 m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
76 76
77 m_log.Info("[" + LogName + "]: Starting HTTP server ..."); 77 m_log.Info("[" + LogName + "]: Starting HTTP server ...");
78 78
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index c01fc5a..aaf2d7e 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -353,7 +353,7 @@ namespace OpenSim
353 if (m_sandbox) 353 if (m_sandbox)
354 { 354 {
355 LocalInventoryService inventoryService = new LocalInventoryService(); 355 LocalInventoryService inventoryService = new LocalInventoryService();
356 inventoryService.AddPlugin(m_standaloneInventoryPlugin); 356 inventoryService.AddPlugin(m_standaloneInventoryPlugin, m_standaloneInventorySource);
357 357
358 LocalUserServices userService = 358 LocalUserServices userService =
359 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, 359 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,