aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities
diff options
context:
space:
mode:
authorJeff Ames2008-04-03 18:25:01 +0000
committerJeff Ames2008-04-03 18:25:01 +0000
commit4f174fbf57160acc05911e9e3b342e8da9eb3644 (patch)
treecfbc8ecf3470dc729aec6cfe2ba2db3d7b63774e /OpenSim/Framework/Communications/Capabilities
parent* Attempted resolution for mantis 854 (diff)
downloadopensim-SC-4f174fbf57160acc05911e9e3b342e8da9eb3644.zip
opensim-SC-4f174fbf57160acc05911e9e3b342e8da9eb3644.tar.gz
opensim-SC-4f174fbf57160acc05911e9e3b342e8da9eb3644.tar.bz2
opensim-SC-4f174fbf57160acc05911e9e3b342e8da9eb3644.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r--[-rwxr-xr-x]OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs288
1 files changed, 144 insertions, 144 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs
index a3d6b71..3518e20 100755..100644
--- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs
@@ -1,144 +1,144 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
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
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37 37
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// CapsHandlers is a cap handler container but also takes 41 /// CapsHandlers is a cap handler container but also takes
42 /// care of adding and removing cap handlers to and from the 42 /// care of adding and removing cap handlers to and from the
43 /// supplied BaseHttpServer. 43 /// supplied BaseHttpServer.
44 /// </summary> 44 /// </summary>
45 public class CapsHandlers 45 public class CapsHandlers
46 { 46 {
47 private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>(); 47 private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
48 private BaseHttpServer m_httpListener; 48 private BaseHttpServer m_httpListener;
49 private string m_httpListenerHostName; 49 private string m_httpListenerHostName;
50 private uint m_httpListenerPort; 50 private uint m_httpListenerPort;
51 51
52 /// <summary></summary> 52 /// <summary></summary>
53 /// <param name="httpListener">base HTTP server</param> 53 /// <param name="httpListener">base HTTP server</param>
54 /// <param name="httpListenerHostname">host name of the HTTP 54 /// <param name="httpListenerHostname">host name of the HTTP
55 /// server</param> 55 /// server</param>
56 /// <param name="httpListenerPort">HTTP port</param> 56 /// <param name="httpListenerPort">HTTP port</param>
57 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort) 57 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
58 { 58 {
59 m_httpListener = httpListener; 59 m_httpListener = httpListener;
60 m_httpListenerHostName = httpListenerHostname; 60 m_httpListenerHostName = httpListenerHostname;
61 m_httpListenerPort = httpListenerPort; 61 m_httpListenerPort = httpListenerPort;
62 } 62 }
63 63
64 /// <summary> 64 /// <summary>
65 /// Remove the cap handler for a capability. 65 /// Remove the cap handler for a capability.
66 /// </summary> 66 /// </summary>
67 /// <param name="capsName">name of the capability of the cap 67 /// <param name="capsName">name of the capability of the cap
68 /// handler to be removed</param> 68 /// handler to be removed</param>
69 public void Remove(string capsName) 69 public void Remove(string capsName)
70 { 70 {
71 m_capsHandlers.Remove(capsName); 71 m_capsHandlers.Remove(capsName);
72 } 72 }
73 73
74 public bool ContainsCap(string cap) 74 public bool ContainsCap(string cap)
75 { 75 {
76 return m_capsHandlers.ContainsKey(cap); 76 return m_capsHandlers.ContainsKey(cap);
77 } 77 }
78 78
79 /// <summary> 79 /// <summary>
80 /// The indexer allows us to treat the CapsHandlers object 80 /// The indexer allows us to treat the CapsHandlers object
81 /// in an intuitive dictionary like way. 81 /// in an intuitive dictionary like way.
82 /// </summary> 82 /// </summary>
83 /// <Remarks> 83 /// <Remarks>
84 /// The indexer will throw an exception when you try to 84 /// The indexer will throw an exception when you try to
85 /// retrieve a cap handler for a cap that is not contained in 85 /// retrieve a cap handler for a cap that is not contained in
86 /// CapsHandlers. 86 /// CapsHandlers.
87 /// </Remarks> 87 /// </Remarks>
88 public IRequestHandler this[string idx] 88 public IRequestHandler this[string idx]
89 { 89 {
90 get 90 get
91 { 91 {
92 return m_capsHandlers[idx]; 92 return m_capsHandlers[idx];
93 } 93 }
94 94
95 set 95 set
96 { 96 {
97 if (m_capsHandlers.ContainsKey(idx)) 97 if (m_capsHandlers.ContainsKey(idx))
98 { 98 {
99 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path); 99 m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
100 m_capsHandlers.Remove(idx); 100 m_capsHandlers.Remove(idx);
101 } 101 }
102 102
103 if (null == value) return; 103 if (null == value) return;
104 104
105 m_capsHandlers[idx] = value; 105 m_capsHandlers[idx] = value;
106 m_httpListener.AddStreamHandler(value); 106 m_httpListener.AddStreamHandler(value);
107 } 107 }
108 } 108 }
109 109
110 /// <summary> 110 /// <summary>
111 /// Return the list of cap names for which this CapsHandlers 111 /// Return the list of cap names for which this CapsHandlers
112 /// object contains cap handlers. 112 /// object contains cap handlers.
113 /// </summary> 113 /// </summary>
114 public string[] Caps 114 public string[] Caps
115 { 115 {
116 get 116 get
117 { 117 {
118 string[] __keys = new string[m_capsHandlers.Keys.Count]; 118 string[] __keys = new string[m_capsHandlers.Keys.Count];
119 m_capsHandlers.Keys.CopyTo(__keys, 0); 119 m_capsHandlers.Keys.CopyTo(__keys, 0);
120 return __keys; 120 return __keys;
121 } 121 }
122 } 122 }
123 123
124 /// <summary> 124 /// <summary>
125 /// Return an LLSD-serializable Hashtable describing the 125 /// Return an LLSD-serializable Hashtable describing the
126 /// capabilities and their handler details. 126 /// capabilities and their handler details.
127 /// </summary> 127 /// </summary>
128 public Hashtable CapsDetails 128 public Hashtable CapsDetails
129 { 129 {
130 get 130 get
131 { 131 {
132 Hashtable caps = new Hashtable(); 132 Hashtable caps = new Hashtable();
133 string baseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenerPort.ToString(); 133 string baseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
134 foreach (string capsName in m_capsHandlers.Keys) 134 foreach (string capsName in m_capsHandlers.Keys)
135 { 135 {
136 // skip SEED cap 136 // skip SEED cap
137 if ("SEED" == capsName) continue; 137 if ("SEED" == capsName) continue;
138 caps[capsName] = baseUrl + m_capsHandlers[capsName].Path; 138 caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
139 } 139 }
140 return caps; 140 return caps;
141 } 141 }
142 } 142 }
143 } 143 }
144} 144}