diff options
author | BlueWall | 2012-10-03 16:07:11 -0400 |
---|---|---|
committer | BlueWall | 2012-10-03 16:07:11 -0400 |
commit | 3e71c71cbffb0de454759e2bbd0ff840dfa480bc (patch) | |
tree | d6cbdc998bd4d7f9309bb73866e1ebaf72cb1b1b /OpenSim/Server/Handlers | |
parent | Allow setting connection limits, part 2 (diff) | |
download | opensim-SC-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.zip opensim-SC-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.gz opensim-SC-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.bz2 opensim-SC-3e71c71cbffb0de454759e2bbd0ff840dfa480bc.tar.xz |
Add modular configuration for Robust connectors
We can provide modular ini for connectors...
look for our configuration in the following places...
1) in the default ini/-inifile
2) in the named file (ConfigName) located in the configured directory
(see Robust[.HG].ini [Start] section for ConfigDirectory)
3) in the repository named in the connector (ConfigURL)
In this case, the file will be written into the configured
directory with the specified
See example connector/service @ https://github.com/BlueWall/SlipStream
for testing.
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r-- | OpenSim/Server/Handlers/Base/ServerConnector.cs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 71876da..951cd89 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs | |||
@@ -39,8 +39,69 @@ namespace OpenSim.Server.Handlers.Base | |||
39 | 39 | ||
40 | public class ServiceConnector : IServiceConnector | 40 | public class ServiceConnector : IServiceConnector |
41 | { | 41 | { |
42 | public virtual string ConfigURL | ||
43 | { | ||
44 | get; | ||
45 | protected set; | ||
46 | } | ||
47 | |||
48 | public virtual string ConfigName | ||
49 | { | ||
50 | get; | ||
51 | protected set; | ||
52 | } | ||
53 | |||
54 | public virtual string ConfigFile | ||
55 | { | ||
56 | get; | ||
57 | protected set; | ||
58 | } | ||
59 | |||
60 | public virtual IConfigSource Config | ||
61 | { | ||
62 | get; | ||
63 | protected set; | ||
64 | } | ||
65 | |||
42 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) | 66 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) |
43 | { | 67 | { |
44 | } | 68 | } |
69 | |||
70 | // We call this from our plugin module to get our configuration | ||
71 | public IConfig GetConfig() | ||
72 | { | ||
73 | IConfig config = null; | ||
74 | config = ServerUtils.GetConfig(ConfigFile, ConfigName); | ||
75 | |||
76 | // Our file is not here? We can get one to bootstrap our plugin module | ||
77 | if ( config == null ) | ||
78 | { | ||
79 | IConfigSource remotesource = GetConfigSource(); | ||
80 | |||
81 | if (remotesource != null) | ||
82 | { | ||
83 | IniConfigSource initialconfig = new IniConfigSource(); | ||
84 | initialconfig.Merge (remotesource); | ||
85 | initialconfig.Save(ConfigFile); | ||
86 | } | ||
87 | |||
88 | config = remotesource.Configs[ConfigName]; | ||
89 | } | ||
90 | |||
91 | return config; | ||
92 | } | ||
93 | |||
94 | // We get our remote initial configuration for bootstrapping | ||
95 | private IConfigSource GetConfigSource() | ||
96 | { | ||
97 | IConfigSource source = null; | ||
98 | |||
99 | source = ServerUtils.LoadInitialConfig(ConfigURL); | ||
100 | |||
101 | if (source == null) | ||
102 | System.Console.WriteLine(String.Format ("Config Url: {0} Not found!", ConfigURL)); | ||
103 | |||
104 | return source; | ||
105 | } | ||
45 | } | 106 | } |
46 | } | 107 | } |