diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/ServerMain.cs (renamed from OpenSim/Server/AssetServer/AssetServerMain.cs) | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/OpenSim/Server/AssetServer/AssetServerMain.cs b/OpenSim/Server/ServerMain.cs index b08c8cf..352ae98 100644 --- a/OpenSim/Server/AssetServer/AssetServerMain.cs +++ b/OpenSim/Server/ServerMain.cs | |||
@@ -25,25 +25,69 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using Nini.Config; | ||
29 | using log4net; | ||
30 | using System.Reflection; | ||
28 | using System; | 31 | using System; |
32 | using System.Collections.Generic; | ||
29 | using OpenSim.Server.Base; | 33 | using OpenSim.Server.Base; |
34 | using OpenSim.Server.Handlers.Base; | ||
30 | using OpenSim.Server.Handlers.Asset; | 35 | using OpenSim.Server.Handlers.Asset; |
31 | 36 | ||
32 | namespace OpenSim.Server.AssetServer | 37 | namespace OpenSim.Server |
33 | { | 38 | { |
34 | public class AssetServer | 39 | public class OpenSimServer |
35 | { | 40 | { |
41 | private static readonly ILog m_log = | ||
42 | LogManager.GetLogger( | ||
43 | MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
36 | protected static HttpServerBase m_Server = null; | 45 | protected static HttpServerBase m_Server = null; |
37 | 46 | ||
38 | protected static AssetServiceConnector m_AssetServiceConnector; | 47 | protected static List<IServiceConnector> m_ServiceConnectors = |
48 | new List<IServiceConnector>(); | ||
39 | 49 | ||
40 | static int Main(string[] args) | 50 | static int Main(string[] args) |
41 | { | 51 | { |
42 | m_Server = new HttpServerBase("Asset", args); | 52 | m_Server = new HttpServerBase("Asset", args); |
43 | 53 | ||
44 | m_AssetServiceConnector = new AssetServiceConnector(m_Server.Config, | 54 | IConfig serverConfig = m_Server.Config.Configs["Startup"]; |
45 | m_Server.HttpServer); | 55 | if (serverConfig == null) |
56 | { | ||
57 | System.Console.WriteLine("Startup config section missing in .ini file"); | ||
58 | throw new Exception("Configuration error"); | ||
59 | } | ||
60 | |||
61 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); | ||
62 | string[] conns = connList.Split(new char[] {',', ' '}); | ||
63 | |||
64 | foreach (string conn in conns) | ||
65 | { | ||
66 | if (conn == String.Empty) | ||
67 | continue; | ||
68 | |||
69 | string[] parts = conn.Split(new char[] {':'}); | ||
70 | string friendlyName = parts[0]; | ||
71 | if (parts.Length > 1) | ||
72 | friendlyName = parts[1]; | ||
73 | |||
74 | m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); | ||
75 | |||
76 | Object[] modargs = new Object[] { m_Server.Config, m_Server.HttpServer }; | ||
77 | IServiceConnector connector = | ||
78 | ServerUtils.LoadPlugin<IServiceConnector>(conn, | ||
79 | modargs); | ||
46 | 80 | ||
81 | if (connector != null) | ||
82 | { | ||
83 | m_ServiceConnectors.Add(connector); | ||
84 | m_log.InfoFormat("[SERVER]: {0} loaded successfully", friendlyName); | ||
85 | } | ||
86 | else | ||
87 | { | ||
88 | m_log.InfoFormat("[SERVER]: Failed to load {0}", conn); | ||
89 | } | ||
90 | } | ||
47 | return m_Server.Run(); | 91 | return m_Server.Run(); |
48 | } | 92 | } |
49 | } | 93 | } |