diff options
author | BlueWall | 2012-10-10 09:35:08 -0400 |
---|---|---|
committer | BlueWall | 2012-10-10 09:35:08 -0400 |
commit | 83073ebd03e46789b3509af2c4e37ef3b3428174 (patch) | |
tree | 0b40e5e76e89887f23014e3149fba9eb13feef87 /OpenSim/Server/Base/ServerUtils.cs | |
parent | Add System.Core to references (diff) | |
download | opensim-SC-83073ebd03e46789b3509af2c4e37ef3b3428174.zip opensim-SC-83073ebd03e46789b3509af2c4e37ef3b3428174.tar.gz opensim-SC-83073ebd03e46789b3509af2c4e37ef3b3428174.tar.bz2 opensim-SC-83073ebd03e46789b3509af2c4e37ef3b3428174.tar.xz |
Implement plugin unloading
Plugin may be enabled and disabled on the fly.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index d0b6c81..6cbf332 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -65,6 +65,7 @@ namespace OpenSim.Server.Base | |||
65 | 65 | ||
66 | uint Configure(IConfigSource config); | 66 | uint Configure(IConfigSource config); |
67 | void Initialize(IHttpServer server); | 67 | void Initialize(IHttpServer server); |
68 | void Unload(); | ||
68 | } | 69 | } |
69 | 70 | ||
70 | public class PluginLoader | 71 | public class PluginLoader |
@@ -105,12 +106,17 @@ namespace OpenSim.Server.Base | |||
105 | a = Registry.GetAddin(args.ExtensionNode.Addin.Id); | 106 | a = Registry.GetAddin(args.ExtensionNode.Addin.Id); |
106 | } | 107 | } |
107 | 108 | ||
108 | m_log.InfoFormat("[SERVER]: Extension Change: {0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); | ||
109 | |||
110 | switch(args.Change) | 109 | switch(args.Change) |
111 | { | 110 | { |
112 | case ExtensionChange.Add: | 111 | case ExtensionChange.Add: |
113 | connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); | 112 | if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) |
113 | { | ||
114 | connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); | ||
115 | } | ||
116 | else | ||
117 | { | ||
118 | connector.PluginPath = a.AddinFile; | ||
119 | } | ||
114 | LoadPlugin(connector); | 120 | LoadPlugin(connector); |
115 | break; | 121 | break; |
116 | case ExtensionChange.Remove: | 122 | case ExtensionChange.Remove: |
@@ -127,15 +133,19 @@ namespace OpenSim.Server.Base | |||
127 | if(connector.Enabled) | 133 | if(connector.Enabled) |
128 | { | 134 | { |
129 | server = GetServer(connector, port); | 135 | server = GetServer(connector, port); |
130 | m_log.InfoFormat("[SERVER]: Path is {0}", connector.PluginPath); | ||
131 | connector.Initialize(server); | 136 | connector.Initialize(server); |
132 | } | 137 | } |
133 | else | 138 | else |
139 | { | ||
134 | m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); | 140 | m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); |
141 | } | ||
135 | } | 142 | } |
136 | 143 | ||
137 | private void UnloadPlugin(IRobustConnector connector) | 144 | private void UnloadPlugin(IRobustConnector connector) |
138 | { | 145 | { |
146 | m_log.InfoFormat("[Server]: Unloading {0}", connector.ConfigName); | ||
147 | |||
148 | connector.Unload(); | ||
139 | } | 149 | } |
140 | 150 | ||
141 | private IHttpServer GetServer(IRobustConnector connector, uint port) | 151 | private IHttpServer GetServer(IRobustConnector connector, uint port) |