aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2012-10-10 09:35:08 -0400
committerBlueWall2012-10-10 09:35:08 -0400
commit83073ebd03e46789b3509af2c4e37ef3b3428174 (patch)
tree0b40e5e76e89887f23014e3149fba9eb13feef87
parentAdd System.Core to references (diff)
downloadopensim-SC_OLD-83073ebd03e46789b3509af2c4e37ef3b3428174.zip
opensim-SC_OLD-83073ebd03e46789b3509af2c4e37ef3b3428174.tar.gz
opensim-SC_OLD-83073ebd03e46789b3509af2c4e37ef3b3428174.tar.bz2
opensim-SC_OLD-83073ebd03e46789b3509af2c4e37ef3b3428174.tar.xz
Implement plugin unloading
Plugin may be enabled and disabled on the fly.
-rw-r--r--OpenSim/Server/Base/PluginManager.cs2
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs18
2 files changed, 16 insertions, 4 deletions
diff --git a/OpenSim/Server/Base/PluginManager.cs b/OpenSim/Server/Base/PluginManager.cs
index 6248e74..d2cf668 100644
--- a/OpenSim/Server/Base/PluginManager.cs
+++ b/OpenSim/Server/Base/PluginManager.cs
@@ -246,6 +246,8 @@ namespace OpenSim.Server.Base
246 public bool AddRepository(string repo) 246 public bool AddRepository(string repo)
247 { 247 {
248 Repositories.RegisterRepository(null, repo, true); 248 Repositories.RegisterRepository(null, repo, true);
249 PluginRegistry.Rebuild(null);
250
249 return true; 251 return true;
250 } 252 }
251 253
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)