123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using System;
- using Nini.Config;
- using OpenSim.Server.Base;
- using OpenSim.Services.Interfaces;
- using OpenSim.Framework.Servers.HttpServer;
- namespace OpenSim.Server.Handlers.Base
- {
- public interface IServiceConnector
- {
- }
- public class ServiceConnector : IServiceConnector
- {
- public virtual string ConfigURL
- {
- get { return String.Empty; }
- }
- public virtual string ConfigName
- {
- get;
- protected set;
- }
- public virtual string ConfigFile
- {
- get;
- protected set;
- }
- public virtual IConfigSource Config
- {
- get;
- protected set;
- }
- public ServiceConnector()
- {
- }
- public ServiceConnector(IConfigSource config, IHttpServer server, string configName)
- {
- }
-
- public IConfig GetConfig()
- {
- IConfig config = null;
- config = ServerUtils.GetConfig(ConfigFile, ConfigName);
-
- if ( config == null )
- {
- IConfigSource remotesource = GetConfigSource();
- if (remotesource != null)
- {
- IniConfigSource initialconfig = new IniConfigSource();
- initialconfig.Merge (remotesource);
- initialconfig.Save(ConfigFile);
- }
- config = remotesource.Configs[ConfigName];
- }
- return config;
- }
-
-
-
-
- private IConfigSource GetConfigSource()
- {
- IConfigSource source = null;
-
- source = ServerUtils.LoadInitialConfig(ConfigURL);
- if (source == null)
- System.Console.WriteLine(String.Format ("Config Url: {0} Not found!", ConfigURL));
- return source;
- }
- }
- }
|