From 5d77625e9ac4ce1fc7b8fd67aabf563678ef0d5d Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 25 May 2008 23:27:38 +0000 Subject: Update svn properties. Formatting cleanup. --- OpenSim/ApplicationPlugins/Rest/RestPlugin.cs | 81 +++++++++++++-------------- 1 file changed, 40 insertions(+), 41 deletions(-) (limited to 'OpenSim/ApplicationPlugins/Rest/RestPlugin.cs') diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs index f1ca83d..c502e28 100644 --- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs +++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs @@ -1,30 +1,29 @@ /* -* Copyright (c) Contributors, http://opensimulator.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ using System; using System.Threading; @@ -56,7 +55,7 @@ namespace OpenSim.ApplicationPlugins.Rest { #region properties - protected static readonly log4net.ILog m_log = + protected static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IConfig _config; // Configuration source: Rest Plugins @@ -106,8 +105,8 @@ namespace OpenSim.ApplicationPlugins.Rest /// public bool IsEnabled { - get - { + get + { return (null != _pluginConfig) && _pluginConfig.GetBoolean("enabled", false); } } @@ -115,7 +114,7 @@ namespace OpenSim.ApplicationPlugins.Rest /// /// OpenSimMain application /// - public OpenSimMain App + public OpenSimMain App { get { return _app; } } @@ -123,7 +122,7 @@ namespace OpenSim.ApplicationPlugins.Rest /// /// RPC server /// - public BaseHttpServer HttpServer + public BaseHttpServer HttpServer { get { return _httpd; } } @@ -156,7 +155,7 @@ namespace OpenSim.ApplicationPlugins.Rest public XmlTextWriter XmlWriter { - get { + get { if (null == _xw) { _sw = new StringWriter(); @@ -200,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.Rest return; } - if (!_config.GetBoolean("enabled", false)) + if (!_config.GetBoolean("enabled", false)) { m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID); return; @@ -211,14 +210,14 @@ namespace OpenSim.ApplicationPlugins.Rest // Retrieve GOD key value, if any. _godkey = _config.GetString("god_key", String.Empty); - + // Retrive prefix if any. _prefix = _config.GetString("prefix", "/admin"); - + // Get plugin specific config _pluginConfig = openSim.ConfigSource.Configs[ConfigName]; - + m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID); } catch (Exception e) @@ -231,7 +230,7 @@ namespace OpenSim.ApplicationPlugins.Rest // not possible for the openSim pointer to be null. However // were the implementation to be changed, this could // result in a silent initialization failure. Harmless - // except for lack of function and lack of any + // except for lack of function and lack of any // diagnostic indication as to why. The same is true if // the HTTP server reference is bad. // We should at least issue a message... @@ -254,7 +253,7 @@ namespace OpenSim.ApplicationPlugins.Rest { if (!IsEnabled) return; - if (!path.StartsWith(_prefix)) + if (!path.StartsWith(_prefix)) { path = String.Format("{0}{1}", _prefix, path); } @@ -354,7 +353,7 @@ namespace OpenSim.ApplicationPlugins.Rest /// origin of the failure message /// failure message /// This should probably set a return code as - /// well. (?) + /// well. (?) protected string Failure(OSHttpResponse response, OSHttpStatusCode status, string method, string format, params string[] msg) { @@ -373,8 +372,8 @@ namespace OpenSim.ApplicationPlugins.Rest /// origin of the failure message /// exception causing the failure message /// This should probably set a return code as - /// well. (?) - public string Failure(OSHttpResponse response, OSHttpStatusCode status, + /// well. (?) + public string Failure(OSHttpResponse response, OSHttpStatusCode status, string method, Exception e) { string m = String.Format("exception occurred: {0}", e.Message); -- cgit v1.1