diff options
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r-- | OpenSim/Server/Handlers/Base/ServerConnector.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 71876da..067fd2a 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs | |||
@@ -39,8 +39,73 @@ 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 | |||
66 | public ServiceConnector() | ||
67 | { | ||
68 | } | ||
69 | |||
42 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) | 70 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) |
43 | { | 71 | { |
44 | } | 72 | } |
73 | |||
74 | // We call this from our plugin module to get our configuration | ||
75 | public IConfig GetConfig() | ||
76 | { | ||
77 | IConfig config = null; | ||
78 | config = ServerUtils.GetConfig(ConfigFile, ConfigName); | ||
79 | |||
80 | // Our file is not here? We can get one to bootstrap our plugin module | ||
81 | if ( config == null ) | ||
82 | { | ||
83 | IConfigSource remotesource = GetConfigSource(); | ||
84 | |||
85 | if (remotesource != null) | ||
86 | { | ||
87 | IniConfigSource initialconfig = new IniConfigSource(); | ||
88 | initialconfig.Merge (remotesource); | ||
89 | initialconfig.Save(ConfigFile); | ||
90 | } | ||
91 | |||
92 | config = remotesource.Configs[ConfigName]; | ||
93 | } | ||
94 | |||
95 | return config; | ||
96 | } | ||
97 | |||
98 | // We get our remote initial configuration for bootstrapping | ||
99 | private IConfigSource GetConfigSource() | ||
100 | { | ||
101 | IConfigSource source = null; | ||
102 | |||
103 | source = ServerUtils.LoadInitialConfig(ConfigURL); | ||
104 | |||
105 | if (source == null) | ||
106 | System.Console.WriteLine(String.Format ("Config Url: {0} Not found!", ConfigURL)); | ||
107 | |||
108 | return source; | ||
109 | } | ||
45 | } | 110 | } |
46 | } | 111 | } |