diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/AssetDataBase.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateAssetData.cs | 16 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/IAssetProvider.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 2 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 2 |
9 files changed, 40 insertions, 13 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index b30ae73..e3b5c25 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs | |||
@@ -40,6 +40,7 @@ namespace OpenSim.Data | |||
40 | 40 | ||
41 | public abstract string Version { get; } | 41 | public abstract string Version { get; } |
42 | public abstract string Name { get; } | 42 | public abstract string Name { get; } |
43 | public abstract void Initialise(string connect); | ||
43 | public abstract void Initialise(); | 44 | public abstract void Initialise(); |
44 | } | 45 | } |
45 | } | 46 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 2029b80..d837e4e 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -191,6 +191,13 @@ namespace OpenSim.Data.MSSQL | |||
191 | 191 | ||
192 | #region IPlugin Members | 192 | #region IPlugin Members |
193 | 193 | ||
194 | override public void Initialise(string connect) | ||
195 | { | ||
196 | // TODO: this would allow you to pass in connnect info as | ||
197 | // a string instead of file, if someone writes the support | ||
198 | Initialise(); | ||
199 | } | ||
200 | |||
194 | override public void Initialise() | 201 | override public void Initialise() |
195 | { | 202 | { |
196 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 203 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 111f7d1..b6545d7 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -170,6 +170,13 @@ namespace OpenSim.Data.MySQL | |||
170 | 170 | ||
171 | #region IPlugin Members | 171 | #region IPlugin Members |
172 | 172 | ||
173 | override public void Initialise(string connect) | ||
174 | { | ||
175 | // TODO: This will let you pass in the connect string in | ||
176 | // the config, though someone will need to write that. | ||
177 | Initialise(); | ||
178 | } | ||
179 | |||
173 | override public void Initialise() | 180 | override public void Initialise() |
174 | { | 181 | { |
175 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | 182 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); |
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index db90d09..7bd4a0b 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs | |||
@@ -50,18 +50,24 @@ namespace OpenSim.Data.NHibernate | |||
50 | 50 | ||
51 | public override void Initialise() | 51 | public override void Initialise() |
52 | { | 52 | { |
53 | // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test | 53 | Initialise("SQLiteDialect;SqliteClientDriver;URI=file:Asset.db,version=3"); |
54 | } | ||
54 | 55 | ||
56 | public override void Initialise(string connect) | ||
57 | { | ||
58 | // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test | ||
59 | char[] split = {';'}; | ||
60 | string[] parts = connect.Split(split); | ||
61 | |||
55 | // This is stubbing for now, it will become dynamic later and support different db backends | 62 | // This is stubbing for now, it will become dynamic later and support different db backends |
56 | cfg = new Configuration(); | 63 | cfg = new Configuration(); |
57 | cfg.SetProperty(Environment.ConnectionProvider, | 64 | cfg.SetProperty(Environment.ConnectionProvider, |
58 | "NHibernate.Connection.DriverConnectionProvider"); | 65 | "NHibernate.Connection.DriverConnectionProvider"); |
59 | cfg.SetProperty(Environment.Dialect, | 66 | cfg.SetProperty(Environment.Dialect, |
60 | "NHibernate.Dialect.SQLiteDialect"); | 67 | "NHibernate.Dialect." + parts[0]); |
61 | cfg.SetProperty(Environment.ConnectionDriver, | 68 | cfg.SetProperty(Environment.ConnectionDriver, |
62 | "NHibernate.Driver.SqliteClientDriver"); | 69 | "NHibernate.Driver." + parts[1]); |
63 | cfg.SetProperty(Environment.ConnectionString, | 70 | cfg.SetProperty(Environment.ConnectionString, parts[2]); |
64 | "URI=file:Asset.db,version=3"); | ||
65 | cfg.AddAssembly("OpenSim.Data.NHibernate"); | 71 | cfg.AddAssembly("OpenSim.Data.NHibernate"); |
66 | 72 | ||
67 | HbmSerializer.Default.Validate = true; | 73 | HbmSerializer.Default.Validate = true; |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 2b63d2b..0d8b468 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -56,9 +56,12 @@ namespace OpenSim.Data.SQLite | |||
56 | 56 | ||
57 | private SqliteConnection m_conn; | 57 | private SqliteConnection m_conn; |
58 | 58 | ||
59 | public void Initialise(string dbfile, string dbname) | 59 | override public void Initialise(string dbconnect) |
60 | { | 60 | { |
61 | m_conn = new SqliteConnection("URI=file:" + dbfile + ",version=3"); | 61 | if (dbconnect == string.Empty) { |
62 | dbconnect = "URI=file:AssetStorage.db,version=3"; | ||
63 | } | ||
64 | m_conn = new SqliteConnection(dbconnect); | ||
62 | m_conn.Open(); | 65 | m_conn.Open(); |
63 | TestTables(m_conn); | 66 | TestTables(m_conn); |
64 | return; | 67 | return; |
@@ -289,7 +292,7 @@ namespace OpenSim.Data.SQLite | |||
289 | 292 | ||
290 | override public void Initialise() | 293 | override public void Initialise() |
291 | { | 294 | { |
292 | Initialise("AssetStorage.db", ""); | 295 | Initialise("URI=file:AssetStorage.db,version=3"); |
293 | } | 296 | } |
294 | 297 | ||
295 | override public string Name | 298 | override public string Name |
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 1afec70..334c5bd 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | |||
@@ -35,9 +35,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
35 | { | 35 | { |
36 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 36 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
37 | 37 | ||
38 | public SQLAssetServer(string pluginName) | 38 | public SQLAssetServer(string pluginName, string connect) |
39 | { | 39 | { |
40 | AddPlugin(pluginName); | 40 | AddPlugin(pluginName, connect); |
41 | } | 41 | } |
42 | 42 | ||
43 | public SQLAssetServer(IAssetProvider assetProvider) | 43 | public SQLAssetServer(IAssetProvider assetProvider) |
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
45 | m_assetProvider = assetProvider; | 45 | m_assetProvider = assetProvider; |
46 | } | 46 | } |
47 | 47 | ||
48 | public void AddPlugin(string FileName) | 48 | public void AddPlugin(string FileName, string connect) |
49 | { | 49 | { |
50 | m_log.Info("[SQLAssetServer]: AssetStorage: Attempting to load " + FileName); | 50 | m_log.Info("[SQLAssetServer]: AssetStorage: Attempting to load " + FileName); |
51 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 51 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
@@ -61,7 +61,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
61 | IAssetProvider plug = | 61 | IAssetProvider plug = |
62 | (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 62 | (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
63 | m_assetProvider = plug; | 63 | m_assetProvider = plug; |
64 | m_assetProvider.Initialise(); | 64 | m_assetProvider.Initialise(connect); |
65 | 65 | ||
66 | m_log.Info("[AssetStorage]: " + | 66 | m_log.Info("[AssetStorage]: " + |
67 | "Added " + m_assetProvider.Name + " " + | 67 | "Added " + m_assetProvider.Name + " " + |
diff --git a/OpenSim/Framework/IAssetProvider.cs b/OpenSim/Framework/IAssetProvider.cs index c9e4c8a..dcb79ea 100644 --- a/OpenSim/Framework/IAssetProvider.cs +++ b/OpenSim/Framework/IAssetProvider.cs | |||
@@ -36,5 +36,6 @@ namespace OpenSim.Framework | |||
36 | void UpdateAsset(AssetBase asset); | 36 | void UpdateAsset(AssetBase asset); |
37 | bool ExistsAsset(LLUUID uuid); | 37 | bool ExistsAsset(LLUUID uuid); |
38 | void CommitAssets(); // force a sync to the database | 38 | void CommitAssets(); // force a sync to the database |
39 | void Initialise(string connect); | ||
39 | } | 40 | } |
40 | } | 41 | } |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index ad0ee45..c01fc5a 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -454,7 +454,7 @@ namespace OpenSim | |||
454 | } | 454 | } |
455 | else | 455 | else |
456 | { | 456 | { |
457 | SQLAssetServer sqlAssetServer = new SQLAssetServer(m_standaloneAssetPlugin); | 457 | SQLAssetServer sqlAssetServer = new SQLAssetServer(m_standaloneAssetPlugin, m_standaloneAssetSource); |
458 | sqlAssetServer.LoadDefaultAssets(); | 458 | sqlAssetServer.LoadDefaultAssets(); |
459 | assetServer = sqlAssetServer; | 459 | assetServer = sqlAssetServer; |
460 | } | 460 | } |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index ab7dfe4..bced391 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -104,6 +104,8 @@ welcome_message = "Welcome to OpenSim" | |||
104 | ; Asset database provider | 104 | ; Asset database provider |
105 | asset_plugin = "OpenSim.Data.SQLite.dll" | 105 | asset_plugin = "OpenSim.Data.SQLite.dll" |
106 | ; asset_plugin = "OpenSim.Data.MySQL.dll" | 106 | ; asset_plugin = "OpenSim.Data.MySQL.dll" |
107 | ; the Asset DB source. This only works for sqlite and nhibernate for now | ||
108 | asset_source = "URI=file:Asset.db,version=3" | ||
107 | 109 | ||
108 | ; Inventory database provider | 110 | ; Inventory database provider |
109 | inventory_plugin = "OpenSim.Data.SQLite.dll" | 111 | inventory_plugin = "OpenSim.Data.SQLite.dll" |