diff options
Diffstat (limited to 'OpenSim/Grid/AssetServer/Main.cs')
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index c26c506..26f4bc8 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -46,48 +46,14 @@ namespace OpenSim.Grid.AssetServer | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | public static OpenAsset_Main assetserver; | 49 | public AssetConfig m_config; |
50 | 50 | ||
51 | public static OpenAsset_Main assetserver; | ||
52 | |||
51 | // Temporarily hardcoded - should be a plugin | 53 | // Temporarily hardcoded - should be a plugin |
52 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); | 54 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); |
53 | 55 | ||
54 | private IAssetProvider m_assetProvider; | 56 | private IAssetProvider m_assetProvider; |
55 | public AssetConfig m_config; | ||
56 | |||
57 | public OpenAsset_Main() | ||
58 | { | ||
59 | m_console = new ConsoleBase("OpenAsset", this); | ||
60 | |||
61 | MainConsole.Instance = m_console; | ||
62 | } | ||
63 | |||
64 | #region conscmd_callback Members | ||
65 | |||
66 | public override void RunCmd(string cmd, string[] cmdparams) | ||
67 | { | ||
68 | base.RunCmd(cmd, cmdparams); | ||
69 | |||
70 | switch (cmd) | ||
71 | { | ||
72 | case "help": | ||
73 | m_console.Notice( | ||
74 | @"shutdown - shutdown this asset server (USE CAUTION!) | ||
75 | stats - statistical information for this server"); | ||
76 | |||
77 | break; | ||
78 | |||
79 | case "stats": | ||
80 | m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); | ||
81 | break; | ||
82 | |||
83 | case "shutdown": | ||
84 | m_console.Close(); | ||
85 | Environment.Exit(0); | ||
86 | break; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | #endregion | ||
91 | 57 | ||
92 | [STAThread] | 58 | [STAThread] |
93 | public static void Main(string[] args) | 59 | public static void Main(string[] args) |
@@ -112,6 +78,13 @@ namespace OpenSim.Grid.AssetServer | |||
112 | } | 78 | } |
113 | } | 79 | } |
114 | 80 | ||
81 | public OpenAsset_Main() | ||
82 | { | ||
83 | m_console = new ConsoleBase("OpenAsset", this); | ||
84 | |||
85 | MainConsole.Instance = m_console; | ||
86 | } | ||
87 | |||
115 | public void Startup() | 88 | public void Startup() |
116 | { | 89 | { |
117 | m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); | 90 | m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); |
@@ -187,18 +160,42 @@ namespace OpenSim.Grid.AssetServer | |||
187 | catch (Exception e) | 160 | catch (Exception e) |
188 | { | 161 | { |
189 | m_log.Warn("[ASSET]: setupDB() - Exception occured"); | 162 | m_log.Warn("[ASSET]: setupDB() - Exception occured"); |
190 | m_log.Warn("[ASSET]: " + e); | 163 | m_log.Warn("[ASSET]: " + e.ToString()); |
191 | } | 164 | } |
192 | } | 165 | } |
193 | 166 | ||
194 | public void LoadDefaultAssets() | 167 | public void LoadDefaultAssets() |
195 | { | 168 | { |
196 | assetLoader.ForEachDefaultXmlAsset(StoreAsset); | 169 | assetLoader.ForEachDefaultXmlAsset(StoreAsset); |
197 | } | 170 | } |
198 | 171 | ||
199 | protected void StoreAsset(AssetBase asset) | 172 | protected void StoreAsset(AssetBase asset) |
200 | { | 173 | { |
201 | m_assetProvider.CreateAsset(asset); | 174 | m_assetProvider.CreateAsset(asset); |
202 | } | 175 | } |
176 | |||
177 | public override void RunCmd(string cmd, string[] cmdparams) | ||
178 | { | ||
179 | base.RunCmd(cmd, cmdparams); | ||
180 | |||
181 | switch (cmd) | ||
182 | { | ||
183 | case "help": | ||
184 | m_console.Notice( | ||
185 | @"shutdown - shutdown this asset server (USE CAUTION!) | ||
186 | stats - statistical information for this server"); | ||
187 | |||
188 | break; | ||
189 | |||
190 | case "stats": | ||
191 | m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); | ||
192 | break; | ||
193 | |||
194 | case "shutdown": | ||
195 | m_console.Close(); | ||
196 | Environment.Exit(0); | ||
197 | break; | ||
198 | } | ||
199 | } | ||
203 | } | 200 | } |
204 | } \ No newline at end of file | 201 | } |