diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Base/ServerConnector.cs')
-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 | } |