Compare commits
271 Commits
master
...
integratio
Author | SHA1 | Date |
---|---|---|
BlueWall | 8a3a7fbf83 | |
BlueWall | 09dc8d6f96 | |
BlueWall | 466a88f676 | |
BlueWall | c3fda850fe | |
BlueWall | 862db03c74 | |
BlueWall | 1140cb613b | |
BlueWall | a611979870 | |
BlueWall | 24754b4155 | |
BlueWall | 2a762ec0e8 | |
BlueWall | 0765801448 | |
BlueWall | 4e8e3874ae | |
BlueWall | c24fe86f0e | |
BlueWall | 6a37f5f852 | |
BlueWall | 13b7c46d50 | |
BlueWall | fc507ff59b | |
BlueWall | d4226e7406 | |
PixelTomsen | 028a74e4d3 | |
PixelTomsen | 5cbe2da3ba | |
BlueWall | 48bc76ae8d | |
BlueWall | ffc6d0744c | |
BlueWall | 9f6e26d31d | |
BlueWall | 0938ea2e1e | |
BlueWall | 0bbc57a1cb | |
BlueWall | 368b103578 | |
BlueWall | 509bf3fa53 | |
BlueWall | b1a42f4257 | |
BlueWall | 286a9adcb2 | |
BlueWall | dad2e2060c | |
BlueWall | be6e1bae33 | |
BlueWall | 141abf9f42 | |
BlueWall | 3257634024 | |
BlueWall | 93662eecb3 | |
BlueWall | c356c97b3d | |
BlueWall | 83f6565049 | |
BlueWall | 9d36f57c34 | |
BlueWall | 23196b127a | |
BlueWall | cdac29549e | |
BlueWall | c713c8585d | |
BlueWall | ab446bc692 | |
BlueWall | c46ddba231 | |
BlueWall | 28b4beead7 | |
SignpostMarv | 14163f43c0 | |
SignpostMarv | ba21b096e4 | |
SignpostMarv | ef574d3a29 | |
BlueWall | 7b52bbd9cb | |
BlueWall | 8cac6c8412 | |
BlueWall | 02794e152e | |
BlueWall | c56340952b | |
BlueWall | f61447cd8d | |
BlueWall | d51628b0a5 | |
BlueWall | dbd42daed6 | |
BlueWall | 25672829c5 | |
BlueWall | c0b6bd1d24 | |
BlueWall | d343ecfa82 | |
BlueWall | 48ebea163b | |
BlueWall | 1e7c523670 | |
BlueWall | d2a6d255e4 | |
BlueWall | 7daca3299a | |
BlueWall | 0b2e8421ce | |
BlueWall | c29d1612ee | |
BlueWall | 909439b407 | |
BlueWall | c3535596ea | |
BlueWall | 5b14941d0f | |
SignpostMarv | b951124d02 | |
BlueWall | d5e2d2949f | |
BlueWall | 26c17f7fad | |
BlueWall | cbbe5125cd | |
BlueWall | b97cae415b | |
BlueWall | d3f1599f27 | |
BlueWall | 20d7229358 | |
BlueWall | cf6bbe9d0f | |
BlueWall | 070d77d2f4 | |
BlueWall | 1bbd9852bb | |
BlueWall | 2d5cb2eba0 | |
BlueWall | 276d882ad3 | |
BlueWall | 552ea11383 | |
BlueWall | aae6ace2ce | |
BlueWall | 8d815872b9 | |
BlueWall | 4ba8a0feb3 | |
BlueWall | 0b96019c5e | |
BlueWall | 0fedc13fe6 | |
BlueWall | 2b9b94a135 | |
BlueWall | 0b185aaf18 | |
BlueWall | cbcd7ed6d2 | |
BlueWall | 9177d28b5c | |
BlueWall | 39e5546bbb | |
BlueWall | afa2d7eea3 | |
BlueWall | 1352a38680 | |
BlueWall | ea7d56b232 | |
BlueWall | 6e4e26d213 | |
BlueWall | e28e2ef3ac | |
BlueWall | 77f08ae632 | |
BlueWall | 466d3793b1 | |
BlueWall | 8a1b4d225b | |
BlueWall | bffe1ecaed | |
BlueWall | 1b34287866 | |
BlueWall | 6842bb785f | |
BlueWall | b2604869ca | |
BlueWall | d3d9e3923c | |
BlueWall | 234e55077a | |
BlueWall | 91b4f45d47 | |
BlueWall | 5632e4e002 | |
BlueWall | 2fc935891c | |
BlueWall | 3857295b13 | |
BlueWall | 3926c196df | |
BlueWall | 0d598450ad | |
BlueWall | 4c28972294 | |
BlueWall | 514a2107cc | |
BlueWall | a8ce8709f2 | |
BlueWall | 4290ae59f4 | |
BlueWall | db71f1fd33 | |
BlueWall | 2ae3e8cf39 | |
BlueWall | cc962a2275 | |
BlueWall | f870c6b490 | |
BlueWall | fbcbac8aef | |
BlueWall | 6ded541b55 | |
BlueWall | ec05e93f85 | |
BlueWall | d7c5e240a5 | |
BlueWall | 491eccf882 | |
BlueWall | 9e0377cd3d | |
BlueWall | 8e2752a0f6 | |
BlueWall | 04d132e78b | |
BlueWall | bc0cfa4468 | |
BlueWall | 466f0b096f | |
BlueWall | e460663fec | |
BlueWall | f79168ae1a | |
BlueWall | 95dc97c0c4 | |
Talun | 94118f1180 | |
BlueWall | 21f6572bf3 | |
BlueWall | 860cf767a1 | |
BlueWall | b699752fa9 | |
BlueWall | 2176bd18e3 | |
BlueWall | 78a98b8a28 | |
BlueWall | 28e03792ae | |
BlueWall | f88a26b861 | |
BlueWall | ab3fb19870 | |
BlueWall | 6605d6cb44 | |
BlueWall | 8ee746d404 | |
BlueWall | 3b772e7a45 | |
BlueWall | d9b358886a | |
BlueWall | 2602a48738 | |
BlueWall | 904f60709f | |
BlueWall | 192db34c41 | |
BlueWall | 36d8e6208a | |
BlueWall | c1467e7fe1 | |
BlueWall | d637b163d9 | |
BlueWall | 26c332f5f2 | |
BlueWall | bd5a298a2d | |
BlueWall | 5b3da481de | |
BlueWall | 14eef0a32b | |
BlueWall | 367e6901a9 | |
BlueWall | 8c841dc38b | |
BlueWall | b8a0a65435 | |
BlueWall | e289006611 | |
BlueWall | a73a5be0c5 | |
BlueWall | a150d3d1e5 | |
BlueWall | 0464508a5b | |
BlueWall | 13187aca91 | |
BlueWall | 477b67e1e6 | |
BlueWall | c990cfe481 | |
BlueWall | cf93f39b9f | |
BlueWall | 9cb242e24d | |
BlueWall | 5d860d09a3 | |
BlueWall | 8f0405bacc | |
BlueWall | 3e00395b37 | |
BlueWall | e9d1af46fa | |
BlueWall | baff20f7c5 | |
BlueWall | 8e6276865b | |
BlueWall | 6f54714eb0 | |
BlueWall | 8ff97699e2 | |
BlueWall | a4d75e37cf | |
BlueWall | d3a88263cb | |
BlueWall | 2b5e05fad8 | |
BlueWall | 668912be6f | |
BlueWall | 293a2873b4 | |
BlueWall | ed2afb8454 | |
BlueWall | 800fae41c7 | |
BlueWall | c36714a9bd | |
BlueWall | 90a4d965d9 | |
BlueWall | 08cf05a586 | |
BlueWall | 6f4afd8601 | |
BlueWall | 8dda6e9ea1 | |
BlueWall | 8ef85f2a38 | |
BlueWall | 9784b6fa75 | |
BlueWall | 515b7eabbd | |
BlueWall | d00df295d6 | |
BlueWall | 1c60ecf3ed | |
BlueWall | 0bf3f597fe | |
BlueWall | 02cc1ed91a | |
BlueWall | def8012ec1 | |
BlueWall | b5db5d7a57 | |
BlueWall | d76df3df79 | |
BlueWall | a153a3cf3b | |
BlueWall | cca3c5f66e | |
BlueWall | 6fd803f24f | |
BlueWall | 32a70fb7e9 | |
BlueWall | 38c0927707 | |
BlueWall | de4327bfd5 | |
BlueWall | bf0b0c9ad5 | |
BlueWall | 578ec6cc26 | |
BlueWall | c0b2e64a90 | |
BlueWall | 3dc88c55a9 | |
BlueWall | 4d78837a3a | |
BlueWall | 3750f329d1 | |
BlueWall | 40828910e7 | |
Talun | 3c03418e06 | |
BlueWall | 6a69c3ac04 | |
BlueWall | e8909703ae | |
BlueWall | 3e546ebbc5 | |
BlueWall | bd0dfc1d6d | |
BlueWall | 05b369965e | |
BlueWall | e76fa4c5aa | |
BlueWall | 027d313703 | |
BlueWall | 9b1741da0d | |
BlueWall | 2122748af1 | |
BlueWall | 040412857c | |
BlueWall | 70808d6d54 | |
BlueWall | 083dd0c17c | |
BlueWall | b6f6f05e1a | |
BlueWall | 3d6f9f9cec | |
BlueWall | 28f0bf7f08 | |
BlueWall | 0f96b9f41b | |
BlueWall | f3f85c3106 | |
BlueWall | 7bcd6a6842 | |
BlueWall | 30fff0e78e | |
BlueWall | 9babd79a66 | |
BlueWall | ffc1f6a656 | |
BlueWall | e0c4f8ed76 | |
BlueWall | a57ec18fb5 | |
BlueWall | 0a949a20ca | |
BlueWall | bb3aa1440d | |
BlueWall | 1d4bee454e | |
BlueWall | d95e6ca0c6 | |
BlueWall | 3e6043bb47 | |
BlueWall | 679533f632 | |
BlueWall | a798b98f85 | |
BlueWall | 0838c5288f | |
BlueWall | 35fa8b454d | |
BlueWall | 4b278c64d6 | |
BlueWall | 27845de7ea | |
BlueWall | fb18476032 | |
BlueWall | 74776c4ee0 | |
BlueWall | 952ad59c1f | |
BlueWall | c066f528ef | |
BlueWall | 0591a85787 | |
BlueWall | 7a686ef124 | |
BlueWall | 931c28888b | |
BlueWall | d4a6ed3d98 | |
BlueWall | b8eafc6280 | |
BlueWall | 5509d981d4 | |
BlueWall | 4f4ca1625f | |
BlueWall | 90a2296983 | |
BlueWall | 1aab096a83 | |
BlueWall | de1d213117 | |
BlueWall | f494e6b086 | |
BlueWall | 2d9971ea93 | |
BlueWall | f266e19243 | |
BlueWall | e4a69297f6 | |
BlueWall | 4fa5fa5e08 | |
BlueWall | d2cd39d0d8 | |
BlueWall | a4cb9639cc | |
BlueWall | 639c6bdd62 | |
BlueWall | b3ecf935cd | |
BlueWall | 4c5b3adb96 | |
BlueWall | 335d167ead | |
BlueWall | 36daea4480 | |
BlueWall | 5c92aa262a | |
BlueWall | 445caca18b | |
BlueWall | 4b90dcfb73 | |
BlueWall | ade1acc9d4 | |
BlueWall | e8eb9b7e84 |
|
@ -125,7 +125,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
if (changed)
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
|
||||
if (scene != null)
|
||||
{
|
||||
|
@ -136,6 +136,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//[TODO]: Temporary fix for an issue after the mono-addis upgrade
|
||||
// PostInilise can fire before the region is loaded, so need to
|
||||
// track down the cause of that
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace OpenSim.Data
|
|||
bool Store(PresenceData data);
|
||||
|
||||
PresenceData Get(UUID sessionID);
|
||||
PresenceData Verify(UUID s_sessionID);
|
||||
void LogoutRegionAgents(UUID regionID);
|
||||
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||
PresenceData[] Get(string field, string data);
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace OpenSim.Data.MSSQL
|
|||
return ret[0];
|
||||
}
|
||||
|
||||
public PresenceData Verify(UUID s_sessionID)
|
||||
{
|
||||
PresenceData[] ret = Get("SecureSessionID",
|
||||
s_sessionID.ToString());
|
||||
|
||||
if (ret.Length == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace OpenSim.Data.MySQL
|
|||
return ret[0];
|
||||
}
|
||||
|
||||
public PresenceData Verify(UUID s_sessionID)
|
||||
{
|
||||
PresenceData[] ret = Get("SecureSessionID",
|
||||
s_sessionID.ToString());
|
||||
|
||||
if (ret.Length == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
|
@ -96,4 +107,4 @@ namespace OpenSim.Data.MySQL
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,19 @@ namespace OpenSim.Data.Null
|
|||
return null;
|
||||
}
|
||||
|
||||
public PresenceData Verify(UUID s_sessionID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.Verify(s_sessionID);
|
||||
|
||||
if (m_presenceData.ContainsKey(s_sessionID))
|
||||
{
|
||||
return m_presenceData[s_sessionID];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
if (Instance != this)
|
||||
|
|
|
@ -123,4 +123,4 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
|
|||
Assert.That(retrievedAsset, Is.Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -675,14 +675,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
}
|
||||
break;
|
||||
case "R":
|
||||
// We need to place this newFont inside its own context so that the .NET compiler
|
||||
// doesn't complain about a redefinition of an existing newFont, even though there is none
|
||||
// The mono compiler doesn't produce this error.
|
||||
{
|
||||
Font newFont = new Font(myFont, FontStyle.Regular);
|
||||
myFont.Dispose();
|
||||
myFont = newFont;
|
||||
}
|
||||
// Font newFont = new Font(myFont, FontStyle.Regular);
|
||||
myFont.Dispose();
|
||||
myFont = new Font(myFont, FontStyle.Regular);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -852,4 +847,4 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,5 +98,42 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPresenceService
|
||||
|
||||
public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
|
||||
{
|
||||
m_log.Warn("[LOCAL PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators");
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool LogoutAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
|
||||
public bool LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
return m_PresenceService.LogoutRegionAgents(regionID);
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
{
|
||||
return m_PresenceService.ReportAgent(sessionID, regionID);
|
||||
}
|
||||
|
||||
public PresenceInfo GetAgent(UUID sessionID)
|
||||
{
|
||||
return m_PresenceService.GetAgent(sessionID);
|
||||
}
|
||||
|
||||
public PresenceInfo[] GetAgents(string[] userIDs)
|
||||
{
|
||||
return m_PresenceService.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,4 +75,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,6 +209,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
|
||||
client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
|
||||
client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
|
||||
client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
|
||||
|
||||
EntityBase presenceEntity;
|
||||
if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
|
||||
|
@ -800,6 +801,17 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
}
|
||||
}
|
||||
|
||||
private void ClientOnParcelDwellRequest(int localID, IClientAPI client)
|
||||
{
|
||||
ILandObject parcel = null;
|
||||
lock (m_landList)
|
||||
{
|
||||
if (!m_landList.TryGetValue(localID, out parcel))
|
||||
return;
|
||||
}
|
||||
client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parcel Modification
|
||||
|
|
|
@ -34,5 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
void RegisterNewReceiver(IScriptModule scriptEngine, UUID channelID, UUID objectID, UUID itemID, string url);
|
||||
void ScriptRemoved(UUID itemID);
|
||||
void ObjectRemoved(UUID objectID);
|
||||
void UnRegisterReceiver(string channelID, UUID itemID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
|||
{
|
||||
public class XmlRpcInfo
|
||||
{
|
||||
public UUID item;
|
||||
public UUID channel;
|
||||
public string uri;
|
||||
}
|
||||
|
@ -88,6 +89,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
|||
return;
|
||||
|
||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||
|
||||
IScriptModule scriptEngine = scene.RequestModuleInterface<IScriptModule>();
|
||||
if ( scriptEngine != null )
|
||||
{
|
||||
scriptEngine.OnScriptRemoved += this.ScriptRemoved;
|
||||
scriptEngine.OnObjectRemoved += this.ObjectRemoved;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -120,22 +129,36 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
|||
|
||||
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
||||
{
|
||||
if (!m_Channels.ContainsKey(itemID))
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_log.InfoFormat("[XMLRPC GRID ROUTER]: New receiver Obj: {0} Ch: {1} ID: {2} URI: {3}",
|
||||
objectID.ToString(), channel.ToString(), itemID.ToString(), uri);
|
||||
|
||||
XmlRpcInfo info = new XmlRpcInfo();
|
||||
info.channel = channel;
|
||||
info.uri = uri;
|
||||
info.item = itemID;
|
||||
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
|
||||
"POST", m_ServerURI+"/RegisterChannel/", info);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
XmlRpcInfo info = new XmlRpcInfo();
|
||||
info.channel = channel;
|
||||
info.uri = uri;
|
||||
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
|
||||
"POST", m_ServerURI+"/RegisterChannel/", info);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
m_log.Error("[XMLRPC GRID ROUTER] Error contacting server");
|
||||
}
|
||||
|
||||
m_Channels[itemID] = channel;
|
||||
m_log.Error("[XMLRPC GRID ROUTER] Error contacting server");
|
||||
}
|
||||
|
||||
m_Channels[itemID] = channel;
|
||||
|
||||
}
|
||||
|
||||
public void UnRegisterReceiver(string channelID, UUID itemID)
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
RemoveChannel(itemID);
|
||||
|
||||
}
|
||||
|
||||
public void ScriptRemoved(UUID itemID)
|
||||
|
@ -143,10 +166,33 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (m_Channels.ContainsKey(itemID))
|
||||
RemoveChannel(itemID);
|
||||
|
||||
}
|
||||
|
||||
public void ObjectRemoved(UUID objectID)
|
||||
{
|
||||
// m_log.InfoFormat("[XMLRPC GRID ROUTER]: Object Removed {0}",objectID.ToString());
|
||||
}
|
||||
|
||||
private bool RemoveChannel(UUID itemID)
|
||||
{
|
||||
if(!m_Channels.ContainsKey(itemID))
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<UUID, bool>(
|
||||
"POST", m_ServerURI+"/RemoveChannel/", m_Channels[itemID]);
|
||||
m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
XmlRpcInfo info = new XmlRpcInfo();
|
||||
|
||||
info.channel = m_Channels[itemID];
|
||||
info.item = itemID;
|
||||
info.uri = "http://0.0.0.0:00";
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>(
|
||||
"POST", m_ServerURI+"/RemoveChannel/", info);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
|
@ -154,11 +200,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
|||
}
|
||||
|
||||
m_Channels.Remove(itemID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ObjectRemoved(UUID objectID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,12 +101,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
|||
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});
|
||||
}
|
||||
|
||||
public void UnRegisterReceiver(string channelID, UUID itemID)
|
||||
{
|
||||
}
|
||||
|
||||
public void ScriptRemoved(UUID itemID)
|
||||
{
|
||||
System.Console.WriteLine("TEST Script Removed!");
|
||||
}
|
||||
|
||||
public void ObjectRemoved(UUID objectID)
|
||||
{
|
||||
System.Console.WriteLine("TEST Obj Removed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6856,6 +6856,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public void llCloseRemoteDataChannel(string channel)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
|
||||
if (xmlRpcRouter != null)
|
||||
{
|
||||
xmlRpcRouter.UnRegisterReceiver(channel, m_item.ItemID);
|
||||
}
|
||||
|
||||
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
|
||||
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
|
||||
ScriptSleep(1000);
|
||||
|
|
|
@ -35,6 +35,7 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Server.Base
|
||||
{
|
||||
|
@ -333,5 +334,36 @@ namespace OpenSim.Server.Base
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool ParseStringToOSDMap(string input, out OSDMap map)
|
||||
{
|
||||
try
|
||||
{
|
||||
map = null;
|
||||
OSD tmpbuff = null;
|
||||
try
|
||||
{
|
||||
tmpbuff = OSDParser.DeserializeJson(input);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.DebugFormat("[ServerUtils]: Parse Caught Error Deserializei {0} ", input);
|
||||
return false;
|
||||
}
|
||||
if (tmpbuff.Type == OSDType.Map)
|
||||
{
|
||||
map = (OSDMap)tmpbuff;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.ErrorFormat("[ServerUtils]: exception on ParseStringToJson {0}", e.Message);
|
||||
map = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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 Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
||||
namespace OpenSim.Server.Handlers.Integration
|
||||
{
|
||||
public class IntegrationServiceConnector : ServiceConnector
|
||||
{
|
||||
|
||||
private IIntegrationService m_IntegrationService;
|
||||
private string m_ConfigName = "IntegrationService";
|
||||
|
||||
public IntegrationServiceConnector(IConfigSource config, IHttpServer server, string configName) :
|
||||
base(config, server, configName)
|
||||
{
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
|
||||
|
||||
string service = serverConfig.GetString("LocalServiceModule",
|
||||
String.Empty);
|
||||
|
||||
if (service == String.Empty)
|
||||
throw new Exception("No LocalServiceModule in config file");
|
||||
|
||||
Object[] args = new Object[] { config, server };
|
||||
m_IntegrationService = ServerUtils.LoadPlugin<IIntegrationService>(service, args);
|
||||
|
||||
server.AddStreamHandler(new IntegrationServerHandler(m_IntegrationService));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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 OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Integration
|
||||
{
|
||||
public class IntegrationServerHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IIntegrationService m_IntegrationService;
|
||||
|
||||
public IntegrationServerHandler(IIntegrationService service) :
|
||||
base("POST", "/integration")
|
||||
{
|
||||
m_IntegrationService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
body = body.Trim();
|
||||
|
||||
try
|
||||
{
|
||||
OSDMap request = null;
|
||||
if (ServerUtils.ParseStringToOSDMap(body, out request) == false)
|
||||
{
|
||||
return FailureResult();
|
||||
}
|
||||
|
||||
if (!request.ContainsKey("command"))
|
||||
{
|
||||
return FailureResult("Error, no command defined!");
|
||||
}
|
||||
|
||||
string command = request["command"].AsString();
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case "list_plugins":
|
||||
return HandleListPlugins(request);
|
||||
|
||||
case "list_available":
|
||||
return HandleListAvailablePlugins(request);
|
||||
|
||||
case "show_info":
|
||||
return HandlePluginInfo(request);
|
||||
|
||||
case "install_plugin":
|
||||
return HandleInstallPlugin(request);
|
||||
|
||||
case "uninstall_plugin":
|
||||
return HandleUnInstallPlugin(request);
|
||||
|
||||
case "enable_plugin":
|
||||
return HandleEnablePlugin(request);
|
||||
|
||||
case "disable_plugin":
|
||||
return HandleDisblePlugin(request);
|
||||
|
||||
case "plugin_info":
|
||||
return HandlePluginInfo(request);
|
||||
|
||||
case "list_repos":
|
||||
return HandleListRepositories(request);
|
||||
|
||||
case "add_repo":
|
||||
return HandleAddRepository(request);
|
||||
|
||||
case "remove_repo":
|
||||
return HandleRemoveRepository(request);
|
||||
|
||||
case "enable_repo":
|
||||
return HandleEnablePlugin(request);
|
||||
|
||||
case "disable_repo":
|
||||
return HandleDisableRepository(request);
|
||||
|
||||
default:
|
||||
m_log.DebugFormat(
|
||||
"[INTEGRATION HANDLER]: unknown method {0} request {1}",
|
||||
command.Length,
|
||||
command
|
||||
);
|
||||
return FailureResult("IntegrationHandler: Unrecognized method requested!");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[INTEGRATION HANDLER]: Exception {0}", e);
|
||||
}
|
||||
|
||||
return FailureResult();
|
||||
}
|
||||
|
||||
#region web handlers
|
||||
// List installed plugins
|
||||
private byte[] HandleListPlugins(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebListPlugins(request);
|
||||
}
|
||||
|
||||
// Show plugin info
|
||||
private byte[] HandlePluginInfo(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebPluginInfo(request);
|
||||
}
|
||||
|
||||
// Enable plugin
|
||||
private byte[] HandleEnablePlugin(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebEnablePlugin(request);
|
||||
}
|
||||
|
||||
// Disable plugin
|
||||
private byte[] HandleDisblePlugin(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebDisablePlugin(request);
|
||||
}
|
||||
|
||||
// Install plugin
|
||||
public byte[] HandleInstallPlugin(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebInstallPlugin(request);
|
||||
}
|
||||
|
||||
// Uninstall plugin
|
||||
public byte[] HandleUnInstallPlugin(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebUnInstallPlugin(request);
|
||||
}
|
||||
|
||||
// List available plugins
|
||||
public byte[] HandleListAvailablePlugins(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebListAvailablePlugins(request);
|
||||
}
|
||||
|
||||
// List repositories
|
||||
public byte[] HandleListRepositories(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebListRepositories(request);
|
||||
}
|
||||
|
||||
// Add repository
|
||||
public byte[] HandleAddRepository(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebAddRepository(request);
|
||||
}
|
||||
|
||||
// Remove repository
|
||||
public byte[] HandleRemoveRepository(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebRemoveRepositroy(request);
|
||||
}
|
||||
|
||||
// Enable repository
|
||||
public byte[] HandleEnableRepository(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleEnableRepository(request);
|
||||
}
|
||||
|
||||
// Disable repository
|
||||
public byte[] HandleDisableRepository(OSDMap request)
|
||||
{
|
||||
return m_IntegrationService.HandleWebDisableRepository(request);
|
||||
}
|
||||
#endregion web handlers
|
||||
|
||||
#region utility
|
||||
// These are in IntegrationUtils.cs for plugins
|
||||
private byte[] FailureResult()
|
||||
{
|
||||
return FailureResult(String.Empty);
|
||||
}
|
||||
|
||||
private byte[] FailureResult(string msg)
|
||||
{
|
||||
OSDMap doc = new OSDMap(2);
|
||||
doc["Result"] = OSD.FromString("Failure");
|
||||
doc["Message"] = OSD.FromString(msg);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] DocToBytes(OSDMap doc)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(doc));
|
||||
}
|
||||
#endregion utility
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Presence
|
||||
{
|
||||
|
@ -244,7 +245,7 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
|
||||
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
|
||||
}
|
||||
|
||||
|
||||
private byte[] SuccessResult()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
|
|
@ -371,6 +371,49 @@ namespace OpenSim.Services.Connectors
|
|||
return rinfos.ToArray();
|
||||
}
|
||||
|
||||
public PresenceInfo VerifyAgent(UUID s_sessionID)
|
||||
{
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
//sendData["SCOPEID"] = scopeID.ToString();
|
||||
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||
sendData["METHOD"] = "verifyagent";
|
||||
|
||||
sendData["SecureSessionID"] = s_sessionID.ToString();
|
||||
|
||||
string reply = string.Empty;
|
||||
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||
string uri = m_ServerURI + "/presence";
|
||||
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: VerifyAgent received null or empty reply");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message);
|
||||
}
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
PresenceInfo pinfo = null;
|
||||
|
||||
if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
|
||||
{
|
||||
if (replyData["result"] is Dictionary<string, object>)
|
||||
{
|
||||
pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]);
|
||||
}
|
||||
}
|
||||
|
||||
return pinfo;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -260,6 +260,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
return null;
|
||||
}
|
||||
|
||||
public PresenceInfo VerifyAgent(UUID s_sessionID)
|
||||
{
|
||||
// Not implemented
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
|
||||
{
|
||||
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);
|
||||
|
|
|
@ -0,0 +1,458 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Ux = OpenSim.Services.IntegrationService.IntegrationUtils;
|
||||
|
||||
// ****[ Robust ] Keep the core services here and rebrand it as a more generic
|
||||
// ****[ Robust ] service for use in buthe OpenSim.exe and Robust.exe
|
||||
//
|
||||
namespace OpenSim.Services.IntegrationService
|
||||
{
|
||||
public class IntegrationService : IntegrationServiceBase, IIntegrationService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public IntegrationService(IConfigSource config, IHttpServer server)
|
||||
: base(config, server)
|
||||
{
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Loaded");
|
||||
|
||||
// Add commands to the console
|
||||
if (MainConsole.Instance != null)
|
||||
{
|
||||
AddConsoleCommands();
|
||||
}
|
||||
}
|
||||
|
||||
// ****[ Robust ] We have console commands to manage the repositories and modules.
|
||||
// ****[ Robust ] We can add/remove/enable/disable repositories and modules
|
||||
// ****[ Robust ] We can query repositories for available modules and updates
|
||||
// ****[ Robust ] The manager needs to be moved to OpenSim.Framework so we can
|
||||
// ****[ Robust ] use it to complete the region module loader
|
||||
//
|
||||
// Our console commands
|
||||
private void AddConsoleCommands()
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"install", "install \"plugin name\"", "Install plugin from repository",
|
||||
HandleConsoleInstallPlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"uninstall", "uninstall \"plugin name\"", "Remove plugin from repository",
|
||||
HandleConsoleUnInstallPlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"check installed", "check installed \"plugin name=\"","Check installed plugin",
|
||||
HandleConsoleCheckInstalledPlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"list installed", "list installed \"plugin name=\"","List install plugins",
|
||||
HandleConsoleListInstalledPlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"list available", "list available \"plugin name=\"","List available plugins",
|
||||
HandleConsoleListAvailablePlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"list updates", "list updates","List availble updates",
|
||||
HandleConsoleListUpdates);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"update", "update \"plugin name=\"","Update the plugin",
|
||||
HandleConsoleUpdatePlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"add repo", "add repo \"url\"","Add repository",
|
||||
HandleConsoleAddRepo);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"get repo", "get repo \"url\"", "Sync with a registered repository",
|
||||
HandleConsoleGetRepo);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"remove repo", "remove repo \"[url | index]\"","Remove registered repository",
|
||||
HandleConsoleRemoveRepo);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"enable repo", "enable repo \"[url | index]\"","Enable registered repository",
|
||||
HandleConsoleEnableRepo);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"disable repo", "disable repo \"[url | index]\"","Disable registered repository",
|
||||
HandleConsoleDisableRepo);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"list repos", "list repos","List registered repositories",
|
||||
HandleConsoleListRepos);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"show info", "show info \"plugin name\"","Show detailed information for plugin",
|
||||
HandleConsoleShowAddinInfo);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"disable plugin", "disable plugin \"plugin name\"","disable the plugin",
|
||||
HandleConsoleDisablePlugin);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||
"enable plugin", "enable plugin \"plugin name\"","enable the plugin",
|
||||
HandleConsoleEnablePlugin);
|
||||
}
|
||||
|
||||
#region console handlers
|
||||
// Handle our console commands
|
||||
//
|
||||
// Install plugin from registered repository
|
||||
/// <summary>
|
||||
/// Handles the console install plugin command. Attempts to install the selected plugin
|
||||
/// and
|
||||
/// </summary>
|
||||
/// <param name='module'>
|
||||
/// Module.
|
||||
/// </param>
|
||||
/// <param name='cmd'>
|
||||
/// Cmd.
|
||||
/// </param>
|
||||
private void HandleConsoleInstallPlugin(string module, string[] cmd)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (cmd.Length == 2)
|
||||
{
|
||||
int ndx = Convert.ToInt16(cmd[1]);
|
||||
if (m_PluginManager.InstallPlugin(ndx, out result) == true)
|
||||
{
|
||||
ArrayList s = new ArrayList();
|
||||
s.AddRange(result.Keys);
|
||||
s.Sort();
|
||||
|
||||
var list = result.Keys.ToList();
|
||||
list.Sort();
|
||||
foreach (var k in list)
|
||||
{
|
||||
Dictionary<string, object> plugin = (Dictionary<string, object>)result[k];
|
||||
bool enabled = (bool)plugin["enabled"];
|
||||
MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}",
|
||||
k,
|
||||
enabled == true ? "[ ]" : "[X]",
|
||||
plugin["name"], plugin["version"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove installed plugin
|
||||
private void HandleConsoleUnInstallPlugin(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length == 2)
|
||||
{
|
||||
int ndx = Convert.ToInt16(cmd[1]);
|
||||
m_PluginManager.UnInstall(ndx);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check installed plugins **not working
|
||||
private void HandleConsoleCheckInstalledPlugin(string module, string[] cmd)
|
||||
{
|
||||
MainConsole.Instance.Output(m_PluginManager.CheckInstalled());
|
||||
return;
|
||||
}
|
||||
|
||||
// List installed plugins
|
||||
private void HandleConsoleListInstalledPlugin(string module, string[] cmd)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
m_PluginManager.ListInstalledAddins(out result);
|
||||
|
||||
ArrayList s = new ArrayList();
|
||||
s.AddRange(result.Keys);
|
||||
s.Sort();
|
||||
|
||||
var list = result.Keys.ToList();
|
||||
list.Sort();
|
||||
foreach (var k in list)
|
||||
{
|
||||
Dictionary<string, object> plugin = (Dictionary<string, object>)result[k];
|
||||
bool enabled = (bool)plugin["enabled"];
|
||||
MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}",
|
||||
k,
|
||||
enabled == true ? "[ ]" : "[X]",
|
||||
plugin["name"], plugin["version"]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// List available plugins on registered repositories
|
||||
private void HandleConsoleListAvailablePlugin(string module, string[] cmd)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
m_PluginManager.ListAvailable(out result);
|
||||
|
||||
var list = result.Keys.ToList();
|
||||
list.Sort();
|
||||
foreach (var k in list)
|
||||
{
|
||||
// name, version, repository
|
||||
Dictionary<string, object> plugin = (Dictionary<string, object>)result[k];
|
||||
MainConsole.Instance.OutputFormat("{0}) {1} rev. {2} {3}",
|
||||
k,
|
||||
plugin["name"],
|
||||
plugin["version"],
|
||||
plugin["repository"]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// List available updates **not ready
|
||||
private void HandleConsoleListUpdates(string module, string[] cmd)
|
||||
{
|
||||
m_PluginManager.ListUpdates();
|
||||
return;
|
||||
}
|
||||
|
||||
// Update plugin **not ready
|
||||
private void HandleConsoleUpdatePlugin(string module, string[] cmd)
|
||||
{
|
||||
MainConsole.Instance.Output(m_PluginManager.Update());
|
||||
return;
|
||||
}
|
||||
|
||||
// Register repository
|
||||
private void HandleConsoleAddRepo(string module, string[] cmd)
|
||||
{
|
||||
if ( cmd.Length == 3)
|
||||
{
|
||||
m_PluginManager.AddRepository(cmd[2]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Get repository status **not working
|
||||
private void HandleConsoleGetRepo(string module, string[] cmd)
|
||||
{
|
||||
m_PluginManager.GetRepository();
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove registered repository
|
||||
private void HandleConsoleRemoveRepo(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length == 3)
|
||||
m_PluginManager.RemoveRepository(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable repository
|
||||
private void HandleConsoleEnableRepo(string module, string[] cmd)
|
||||
{
|
||||
m_PluginManager.EnableRepository(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable repository
|
||||
private void HandleConsoleDisableRepo(string module, string[] cmd)
|
||||
{
|
||||
m_PluginManager.DisableRepository(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
// List repositories
|
||||
private void HandleConsoleListRepos(string module, string[] cmd)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
m_PluginManager.ListRepositories(out result);
|
||||
|
||||
var list = result.Keys.ToList();
|
||||
list.Sort();
|
||||
foreach (var k in list)
|
||||
{
|
||||
Dictionary<string, object> repo = (Dictionary<string, object>)result[k];
|
||||
bool enabled = (bool)repo["enabled"];
|
||||
MainConsole.Instance.OutputFormat("{0}) {1} {2}",
|
||||
k,
|
||||
enabled == true ? "[ ]" : "[X]",
|
||||
repo["name"], repo["url"]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Show description information
|
||||
private void HandleConsoleShowAddinInfo(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length >= 3)
|
||||
{
|
||||
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
int ndx = Convert.ToInt16(cmd[2]);
|
||||
m_PluginManager.AddinInfo(ndx, out result);
|
||||
|
||||
MainConsole.Instance.OutputFormat("Name: {0}\nURL: {1}\nFile: {2}\nAuthor: {3}\nCategory: {4}\nDesc: {5}",
|
||||
result["name"],
|
||||
result["url"],
|
||||
result["file_name"],
|
||||
result["author"],
|
||||
result["category"],
|
||||
result["description"]);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable plugin
|
||||
private void HandleConsoleDisablePlugin(string module, string[] cmd)
|
||||
{
|
||||
m_PluginManager.DisablePlugin(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable plugin
|
||||
private void HandleConsoleEnablePlugin(string module, string[] cmd)
|
||||
{
|
||||
m_PluginManager.EnablePlugin(cmd);
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// ****[ Robust ] These are handlers that relate to the console commands, but
|
||||
// ****[ Robust ] are connecting to remote applications. It would be ok to do
|
||||
// ****[ Robust ] this later in a separate module
|
||||
//
|
||||
#region IIntegrationService implementation
|
||||
// Will hold back on implementing things here that can actually make changes
|
||||
// Need to secure it first
|
||||
public byte[] HandleWebListRepositories(OSDMap request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
m_PluginManager.ListRepositories(out result);
|
||||
string json = LitJson.JsonMapper.ToJson(result);
|
||||
return Ux.DocToBytes(json);
|
||||
}
|
||||
|
||||
public byte[] HandleWebAddRepository(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
|
||||
public byte[] HandleWebRemoveRepositroy(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
|
||||
public byte[] HandleEnableRepository(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
|
||||
public byte[] HandleWebDisableRepository(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
|
||||
public byte[] HandleWebListPlugins(OSDMap request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
m_PluginManager.ListInstalledAddins(out result);
|
||||
string json = LitJson.JsonMapper.ToJson(result);
|
||||
return Ux.DocToBytes(json);
|
||||
}
|
||||
|
||||
public byte[] HandleWebPluginInfo(OSDMap request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if(!String.IsNullOrEmpty(request["index"].ToString()))
|
||||
{
|
||||
int ndx = Convert.ToInt16(request["index"].ToString());
|
||||
m_PluginManager.AddinInfo(ndx, out result);
|
||||
string json = LitJson.JsonMapper.ToJson(result);
|
||||
return Ux.DocToBytes(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ux.FailureResult("No index supplied");
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] HandleWebListAvailablePlugins(OSDMap request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
m_PluginManager.ListAvailable(out result);
|
||||
string json = LitJson.JsonMapper.ToJson(result);
|
||||
return Ux.DocToBytes(json);
|
||||
}
|
||||
|
||||
public byte[] HandleWebInstallPlugin(OSDMap request)
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
int ndx = Convert.ToInt16(request["index"].ToString());
|
||||
if (m_PluginManager.InstallPlugin(ndx, out result) == true)
|
||||
{
|
||||
string json = LitJson.JsonMapper.ToJson(result);
|
||||
return Ux.DocToBytes(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ux.FailureResult("No index supplied");
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] HandleWebUnInstallPlugin(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
|
||||
public byte[] HandleWebEnablePlugin(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
|
||||
public byte[] HandleWebDisablePlugin(OSDMap request)
|
||||
{
|
||||
return Ux.FailureResult("Not Implemented");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,301 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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.IO;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Base;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Ux = OpenSim.Services.IntegrationService.IntegrationUtils;
|
||||
|
||||
|
||||
// ****[ Robust ] Re-factor to use in both OpenSim.exe and Robust.exe
|
||||
// ****[ Robust ] ** Loading can be done in modules that overide a base
|
||||
// ****[ Robust ] ** class that provides the base services for the
|
||||
// ****[ Robust ] ** discovery, loading and event queing of the modules
|
||||
|
||||
|
||||
// ****[ Robust ] We need to define our root to graft our modules into
|
||||
[assembly:AddinRoot("IntegrationService", "2.1")]
|
||||
namespace OpenSim.Services.IntegrationService
|
||||
{
|
||||
// ****[ Robust ] The name our modules look for as a dependency
|
||||
[TypeExtensionPoint(Path="/OpenSim/IntegrationService", Name="IntegrationService")]
|
||||
public interface IntegrationPlugin
|
||||
{
|
||||
void Init(IConfigSource MainConfig, IConfigSource PluginConfig, IHttpServer server, ServiceBase service);
|
||||
void Unload();
|
||||
string PluginName { get; }
|
||||
string ConfigName { get; }
|
||||
string DefaultConfig { get; }
|
||||
}
|
||||
|
||||
// Hide the nasty stuff in here, let the IntegrationService be clean for
|
||||
// our command and request handlers
|
||||
public class IntegrationServiceBase : ServiceBase
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ConfigName = "IntegrationService";
|
||||
|
||||
protected IHttpServer m_Server;
|
||||
|
||||
protected string m_IntegrationConfig;
|
||||
protected PluginManager m_PluginManager;
|
||||
AddinManager am;
|
||||
|
||||
protected IConfig m_IntegrationServerConfig;
|
||||
protected string m_IntegrationConfigLoc;
|
||||
IConfigSource m_ConfigSource;
|
||||
|
||||
public IntegrationServiceBase(IConfigSource config, IHttpServer server)
|
||||
: base(config)
|
||||
{
|
||||
m_ConfigSource = config;
|
||||
m_Server = server;
|
||||
|
||||
IConfig serverConfig = m_ConfigSource.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
|
||||
|
||||
m_IntegrationConfigLoc = serverConfig.GetString("IntegrationConfig", String.Empty);
|
||||
AddinRegistry registry ;
|
||||
bool DEVELOPMENT = serverConfig.GetBoolean("DevelopmentMode", false);
|
||||
|
||||
// ****[ Robust ] Would be able to load as a local Robust module,
|
||||
// ****[ Robust ] during development, by adding the info to the
|
||||
// ****[ Robust ] ServiceConnectors. Also allows modules to be
|
||||
// ****[ Robust ] loaded locally under normal operations
|
||||
//
|
||||
// Are we developing plugins? We will load them now.
|
||||
// This will allow debugging of the modules and will
|
||||
// use the runtime directory for the registry. Will not
|
||||
// be able to use the repo/registry commands ...
|
||||
if (DEVELOPMENT == true)
|
||||
{
|
||||
AddinManager.Initialize(".");
|
||||
registry = new AddinRegistry(".", ".");
|
||||
registry.Update();
|
||||
|
||||
AddinManager.AddinLoaded += on_addinloaded_;
|
||||
AddinManager.AddinLoadError += on_addinloaderror_;
|
||||
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
|
||||
AddinManager.AddinEngine.ExtensionChanged += HandleAddinManagerAddinEngineExtensionChanged;
|
||||
|
||||
registry.Update();
|
||||
foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService"))
|
||||
{
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Processing Addin {0}", cmd.PluginName);
|
||||
LoadingPlugin(cmd);
|
||||
}
|
||||
|
||||
Addin[] addins = registry.GetAddins();
|
||||
foreach (Addin addin in addins)
|
||||
{
|
||||
if (addin.Description.Category == "IntegrationPlugin")
|
||||
{
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Processing O Addin {0}", addin.Name);
|
||||
addin.Enabled = true;
|
||||
registry.EnableAddin(addin.Id);
|
||||
registry.Update();
|
||||
AddinManager.AddinEngine.LoadAddin(null, addin.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ****[ Robust ] Place this in a loader that getsd called from
|
||||
// Robust after the main server is running
|
||||
//
|
||||
// ****[ Robust ] Make generic version of this to be overridden
|
||||
// ****[ Robust ] by OpenSim.exe and Robust.exe
|
||||
//
|
||||
else
|
||||
{
|
||||
// defaults to the ./bin directory
|
||||
string RegistryLocation = serverConfig.GetString("PluginRegistryLocation", ".");
|
||||
|
||||
registry = new AddinRegistry(RegistryLocation, ".");
|
||||
m_PluginManager = new PluginManager(registry);
|
||||
|
||||
// Deal with files only for now - will add url/environment later
|
||||
m_IntegrationConfigLoc = serverConfig.GetString("IntegrationConfig", String.Empty);
|
||||
if(String.IsNullOrEmpty(m_IntegrationConfigLoc))
|
||||
m_log.Error("[INTEGRATION SERVICE]: No IntegrationConfig defined in the Robust.ini");
|
||||
|
||||
|
||||
m_IntegrationServerConfig = m_ConfigSource.Configs["IntegrationService"];
|
||||
if (m_IntegrationServerConfig == null)
|
||||
{
|
||||
throw new Exception("[INTEGRATION SERVICE]: Missing configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
AddinManager.Initialize(RegistryLocation);
|
||||
AddinManager.Registry.Update();
|
||||
|
||||
AddinManager.AddinLoaded += on_addinloaded_;
|
||||
AddinManager.AddinLoadError += on_addinloaderror_;
|
||||
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
|
||||
|
||||
// Installed extensions are queried here and cause the registered events to fire
|
||||
AddinManager.AddExtensionNodeHandler("/OpenSim/IntegrationService", OnExtensionChanged);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region addin event handlers
|
||||
void HandleAddinManagerAddinEngineExtensionChanged(object sender, ExtensionEventArgs args)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("Plugin Extension Change Path:{0}", args.Path));
|
||||
}
|
||||
|
||||
private IConfigSource GetConfig(string configName)
|
||||
{
|
||||
return new IniConfigSource();
|
||||
}
|
||||
|
||||
void HandleAddinManagerAddinUnloaded(object sender, AddinEventArgs args)
|
||||
{
|
||||
MainConsole.Instance.Output("Plugin Unloaded");
|
||||
}
|
||||
|
||||
private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
|
||||
{
|
||||
if (args.Exception == null)
|
||||
m_log.Error("[INTEGRATION SERVICE]: Plugin Error: "
|
||||
+ args.Message);
|
||||
else
|
||||
m_log.Error("[INTEGRATION SERVICE]: Plugin Error: "
|
||||
+ args.Exception.Message + "\n"
|
||||
+ args.Exception.StackTrace);
|
||||
}
|
||||
|
||||
// ****[ Robust ] This is where we get control of the plugin during
|
||||
// ****[ Robust ] the loading and unloading
|
||||
//
|
||||
// This is our init
|
||||
// We can do build-up and tear-down of our plugin
|
||||
void OnExtensionChanged(object s, ExtensionNodeEventArgs args)
|
||||
{
|
||||
// This is our plugin
|
||||
IntegrationPlugin ip = (IntegrationPlugin) args.ExtensionObject;
|
||||
// We will need to get the name and path of the dll for the connector to
|
||||
// be able to load the service in the refactored version...
|
||||
// Might also use this to check for updates to alert the user
|
||||
Addin a = m_PluginManager.Registry.GetAddin(args.ExtensionNode.Addin.Id);
|
||||
m_log.InfoFormat("[INTEGRATION SERVICE]: Plugin Change {0}",a.AddinFile);
|
||||
|
||||
switch (args.Change)
|
||||
{
|
||||
// Build up
|
||||
case ExtensionChange.Add:
|
||||
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Plugin Added {0}", ip.PluginName);
|
||||
LoadingPlugin(ip);
|
||||
return;
|
||||
|
||||
// Tear down
|
||||
case ExtensionChange.Remove:
|
||||
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Plugin Remove {0}", ip.PluginName);
|
||||
UnLoadingPlugin(ip);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void on_addinloaded_(object sender, AddinEventArgs args)
|
||||
{
|
||||
m_log.Info("[INTEGRATION SERVICE]: Plugin Loaded: " + args.AddinId);
|
||||
}
|
||||
#endregion addin-event handlers
|
||||
|
||||
// ****[ Robust ] We are taking the module from the event handler and
|
||||
// ****[ Robust ] taking it through the initialization process
|
||||
// ****[ Robust ] This is using a mixture of the user's existing ini
|
||||
// ****[ Robust ] and the developer supplied initial configuration
|
||||
// ****[ Robust ]
|
||||
// ****[ Robust ] We should first check the user's ini for existing entries
|
||||
// ****[ Robust ] in case they have configured the module ahead of time.
|
||||
//
|
||||
private void LoadingPlugin(IntegrationPlugin plugin)
|
||||
{
|
||||
string ConfigPath = String.Format("{0}/(1)", m_IntegrationConfigLoc,plugin.ConfigName);
|
||||
IConfigSource PlugConfig = Ux.GetConfigSource(m_IntegrationConfigLoc, plugin.ConfigName);
|
||||
|
||||
// We maintain a configuration per-plugin to enhance modularity
|
||||
// If ConfigSource is null, we will get the default from the repo
|
||||
// and write it to our directory
|
||||
// Fetch the starter ini
|
||||
if (PlugConfig == null)
|
||||
{
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Fetching starter config for {0} from {1}", plugin.PluginName, plugin.DefaultConfig);
|
||||
|
||||
// Send the default data service
|
||||
IConfig DataService = m_ConfigSource.Configs["DatabaseService"];
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: Writing initial config to {0}", plugin.ConfigName);
|
||||
|
||||
IniConfigSource source = new IniConfigSource();
|
||||
IConfig Init = source.AddConfig("DatabaseService");
|
||||
Init.Set("StorageProvider",(string)DataService.GetString("StorageProvider"));
|
||||
Init.Set("ConnectionString", String.Format("\"{0}\"",DataService.GetString("ConnectionString")));
|
||||
|
||||
PlugConfig = Ux.LoadInitialConfig(plugin.DefaultConfig);
|
||||
source.Merge(PlugConfig);
|
||||
source.Save(Path.Combine(m_IntegrationConfigLoc, plugin.ConfigName));
|
||||
PlugConfig = Ux.GetConfigSource(m_IntegrationConfigLoc, plugin.ConfigName);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[INTEGRATION SERVICE]: ****** In Loading Plugin {0}", plugin.PluginName);
|
||||
plugin.Init(m_ConfigSource, PlugConfig, m_Server, this);
|
||||
}
|
||||
|
||||
// ****[ Robust ] We are taking the plugin from the event handler to unload it
|
||||
// ****[ Robust ] and we need to tear down to release all objects.
|
||||
//
|
||||
private void UnLoadingPlugin(IntegrationPlugin plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.Unload();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// Getting some "Error Object reference not set to an instance of an object"
|
||||
// when the plugins are unloaded. This keeps things quiet for now
|
||||
// m_log.DebugFormat("[INTEGRATION SERVICE]: Error {0}", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
|
||||
namespace OpenSim.Services.IntegrationService
|
||||
{
|
||||
public static class IntegrationUtils
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// ****[ Robust ] Only a couple of these are needed in the core management system
|
||||
// ****[ Robust ] These could be moved to the implementation instead of being in
|
||||
// ****[ Robust ] a separate file
|
||||
//
|
||||
#region web utils
|
||||
public static bool ParseStringToOSDMap(string input, out OSDMap json)
|
||||
{
|
||||
try
|
||||
{
|
||||
json = null;
|
||||
OSD tmpbuff = null;
|
||||
|
||||
try
|
||||
{
|
||||
tmpbuff = OSDParser.DeserializeJson(input.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tmpbuff.Type == OSDType.Map)
|
||||
{
|
||||
json = (OSDMap)tmpbuff;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.ErrorFormat("[IUtil]: exception on ParseStringToJson {0}", e.Message);
|
||||
json = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] FailureResult()
|
||||
{
|
||||
return FailureResult(String.Empty);
|
||||
}
|
||||
|
||||
public static byte[] FailureResult(string msg)
|
||||
{
|
||||
OSDMap doc = new OSDMap(2);
|
||||
doc["result"] = OSD.FromString("failure");
|
||||
doc["message"] = OSD.FromString(msg);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
public static byte[] ResponseMessage(string message)
|
||||
{
|
||||
OSDMap doc = new OSDMap(2);
|
||||
doc["result"] = OSD.FromString("success");
|
||||
doc["message"] = OSD.FromString(message);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
public static byte[] DocToBytes(OSDMap doc)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(doc));
|
||||
}
|
||||
|
||||
public static byte[] DocToBytes(string json)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(json);
|
||||
}
|
||||
#endregion web utils
|
||||
|
||||
#region config utils
|
||||
public static IConfigSource GetConfigSource(string IniPath, string IniName)
|
||||
{
|
||||
string configFilePath = Path.GetFullPath(
|
||||
Path.Combine(IniPath, IniName));
|
||||
|
||||
if (File.Exists(configFilePath))
|
||||
{
|
||||
IConfigSource config = new IniConfigSource(configFilePath);
|
||||
return config;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static IConfigSource LoadInitialConfig(string url)
|
||||
{
|
||||
IConfigSource source = new XmlConfigSource();
|
||||
m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url);
|
||||
|
||||
// The ini file path is a http URI
|
||||
// Try to read it
|
||||
try
|
||||
{
|
||||
XmlReader r = XmlReader.Create(url);
|
||||
IConfigSource cs = new XmlConfigSource(r);
|
||||
source.Merge(cs);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
#endregion config utils
|
||||
|
||||
public static T LoadPlugin<T>(string dllName, Object[] args) where T:class
|
||||
{
|
||||
return OpenSim.Server.Base.ServerUtils.LoadPlugin<T>(dllName, args);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,561 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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.Text;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Mono.Addins;
|
||||
using Mono.Addins.Setup;
|
||||
using Mono.Addins.Description;
|
||||
using OpenSim.Framework;
|
||||
using Ux = OpenSim.Services.IntegrationService.IntegrationUtils;
|
||||
|
||||
namespace OpenSim.Services.IntegrationService
|
||||
{
|
||||
// ****[ Robust ] These are the functions that connect our console
|
||||
// ****[ Robust ] commands to the addin management. This needs to
|
||||
// ****[ Robust ] be maintained in a file separately from the main
|
||||
// ****[ Robust ] implementation in the same namespace. Any generaly
|
||||
// ****[ Robust ] usefull methods can be located in one of the existing
|
||||
// ****[ Robust ] places
|
||||
// ****[ Robust ]
|
||||
// ****[ Robust ] This needs to be in OpenSim.Framework so it can be
|
||||
// ****[ Robust ] used to complete the region module management
|
||||
//
|
||||
// This will maintain the plugin repositories and plugins
|
||||
public class PluginManager : SetupService
|
||||
{
|
||||
protected AddinRegistry m_Registry;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OpenSim.Services.IntegrationService.PluginManager"/> class.
|
||||
/// </summary>
|
||||
/// <param name='r'>
|
||||
/// R.
|
||||
/// </param>
|
||||
internal PluginManager(AddinRegistry r): base (r)
|
||||
{
|
||||
m_Registry = r;
|
||||
m_Registry.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Installs the plugin.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The plugin.
|
||||
/// </returns>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public bool InstallPlugin(int ndx, out Dictionary<string, object> result)
|
||||
{
|
||||
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||
|
||||
PackageCollection pack = new PackageCollection();
|
||||
PackageCollection toUninstall;
|
||||
DependencyCollection unresolved;
|
||||
|
||||
IProgressStatus ps = new ConsoleProgressStatus(false);
|
||||
|
||||
AddinRepositoryEntry[] available = GetSortedAvailbleAddins();
|
||||
|
||||
if (ndx > (available.Length - 1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
result = res;
|
||||
return false;
|
||||
}
|
||||
|
||||
AddinRepositoryEntry aentry = available[ndx];
|
||||
|
||||
Package p = Package.FromRepository(aentry);
|
||||
pack.Add(p);
|
||||
|
||||
ResolveDependencies(ps, pack, out toUninstall, out unresolved);
|
||||
|
||||
// Attempt to install the plugin disabled
|
||||
if (Install(ps, pack) == true)
|
||||
{
|
||||
m_Registry.Update(ps);
|
||||
Addin addin = m_Registry.GetAddin(aentry.Addin.Id);
|
||||
m_Registry.DisableAddin(addin.Id);
|
||||
addin.Enabled = false;
|
||||
|
||||
MainConsole.Instance.Output("Installation Success");
|
||||
ListInstalledAddins(out res);
|
||||
result = res;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output("Installation Failed");
|
||||
result = res;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove plugin
|
||||
/// <summary>
|
||||
/// Uns the install.
|
||||
/// </summary>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public void UnInstall(int ndx)
|
||||
{
|
||||
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
||||
|
||||
if (ndx > (addins.Length -1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
Addin addin = addins[ndx];
|
||||
MainConsole.Instance.OutputFormat("Uninstalling plugin {0}", addin.Id);
|
||||
AddinManager.Registry.DisableAddin(addin.Id);
|
||||
addin.Enabled = false;
|
||||
IProgressStatus ps = new ConsoleProgressStatus(false);
|
||||
Uninstall(ps, addin.Id);
|
||||
MainConsole.Instance.Output("Uninstall Success - restart to complete operation");
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks the installed.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The installed.
|
||||
/// </returns>
|
||||
public string CheckInstalled()
|
||||
{
|
||||
return "CheckInstall";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists the installed addins.
|
||||
/// </summary>
|
||||
/// <param name='result'>
|
||||
/// Result.
|
||||
/// </param>
|
||||
public void ListInstalledAddins(out Dictionary<string, object> result)
|
||||
{
|
||||
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||
|
||||
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
||||
|
||||
int count = 0;
|
||||
foreach (Addin addin in addins)
|
||||
{
|
||||
Dictionary<string, object> r = new Dictionary<string, object>();
|
||||
r["enabled"] = addin.Enabled == true ? true : false;
|
||||
r["name"] = addin.LocalId;
|
||||
r["version"] = addin.Version;
|
||||
|
||||
res.Add(count.ToString(), r);
|
||||
|
||||
count++;
|
||||
}
|
||||
result = res;
|
||||
return;
|
||||
}
|
||||
|
||||
// List compatible plugins in registered repositories
|
||||
/// <summary>
|
||||
/// Lists the available.
|
||||
/// </summary>
|
||||
/// <param name='result'>
|
||||
/// Result.
|
||||
/// </param>
|
||||
public void ListAvailable(out Dictionary<string, object> result)
|
||||
{
|
||||
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||
|
||||
AddinRepositoryEntry[] addins = GetSortedAvailbleAddins();
|
||||
|
||||
int count = 0;
|
||||
foreach (AddinRepositoryEntry addin in addins)
|
||||
{
|
||||
Dictionary<string, object> r = new Dictionary<string, object>();
|
||||
r["name"] = addin.Addin.Name;
|
||||
r["version"] = addin.Addin.Version;
|
||||
r["repository"] = addin.RepositoryName;
|
||||
|
||||
res.Add(count.ToString(), r);
|
||||
count++;
|
||||
}
|
||||
result = res;
|
||||
return;
|
||||
}
|
||||
|
||||
// List available updates ** 1
|
||||
/// <summary>
|
||||
/// Lists the updates.
|
||||
/// </summary>
|
||||
public void ListUpdates()
|
||||
{
|
||||
IProgressStatus ps = new ConsoleProgressStatus(true);
|
||||
Console.WriteLine ("Looking for updates...");
|
||||
Repositories.UpdateAllRepositories (ps);
|
||||
Console.WriteLine ("Available add-in updates:");
|
||||
bool found = false;
|
||||
AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates();
|
||||
|
||||
foreach (AddinRepositoryEntry entry in entries)
|
||||
{
|
||||
Console.WriteLine(String.Format("{0}",entry.Addin.Id));
|
||||
}
|
||||
}
|
||||
|
||||
// Sync to repositories
|
||||
/// <summary>
|
||||
/// Update this instance.
|
||||
/// </summary>
|
||||
public string Update()
|
||||
{
|
||||
IProgressStatus ps = new ConsoleProgressStatus(true);
|
||||
Repositories.UpdateAllRepositories(ps);
|
||||
return "Update";
|
||||
}
|
||||
|
||||
// Register a repository
|
||||
/// <summary>
|
||||
/// Register a repository with our server.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// result of the action
|
||||
/// </returns>
|
||||
/// <param name='repo'>
|
||||
/// The URL of the repository we want to add
|
||||
/// </param>
|
||||
public bool AddRepository(string repo)
|
||||
{
|
||||
Repositories.RegisterRepository(null, repo, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the repository.
|
||||
/// </summary>
|
||||
public void GetRepository()
|
||||
{
|
||||
Repositories.UpdateAllRepositories(new ConsoleProgressStatus(false));
|
||||
}
|
||||
|
||||
// Remove a repository from the list
|
||||
/// <summary>
|
||||
/// Removes the repository.
|
||||
/// </summary>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public void RemoveRepository(string[] args)
|
||||
{
|
||||
AddinRepository[] reps = Repositories.GetRepositories();
|
||||
Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
|
||||
if (reps.Length == 0)
|
||||
{
|
||||
MainConsole.Instance.Output("No repositories have been registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
int n = Convert.ToInt16(args[2]);
|
||||
if (n > (reps.Length -1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
AddinRepository rep = reps[n];
|
||||
Repositories.RemoveRepository(rep.Url);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable repository
|
||||
/// <summary>
|
||||
/// Enables the repository.
|
||||
/// </summary>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public void EnableRepository(string[] args)
|
||||
{
|
||||
AddinRepository[] reps = Repositories.GetRepositories();
|
||||
Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
|
||||
if (reps.Length == 0)
|
||||
{
|
||||
MainConsole.Instance.Output("No repositories have been registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
int n = Convert.ToInt16(args[2]);
|
||||
if (n > (reps.Length -1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
AddinRepository rep = reps[n];
|
||||
Repositories.SetRepositoryEnabled(rep.Url, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable a repository
|
||||
/// <summary>
|
||||
/// Disables the repository.
|
||||
/// </summary>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public void DisableRepository(string[] args)
|
||||
{
|
||||
AddinRepository[] reps = Repositories.GetRepositories();
|
||||
Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
|
||||
if (reps.Length == 0)
|
||||
{
|
||||
MainConsole.Instance.Output("No repositories have been registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
int n = Convert.ToInt16(args[2]);
|
||||
if (n > (reps.Length -1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
AddinRepository rep = reps[n];
|
||||
Repositories.SetRepositoryEnabled(rep.Url, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// List registered repositories
|
||||
/// <summary>
|
||||
/// Lists the repositories.
|
||||
/// </summary>
|
||||
/// <param name='result'>
|
||||
/// Result.
|
||||
/// </param>
|
||||
public void ListRepositories(out Dictionary<string, object> result)
|
||||
{
|
||||
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||
result = res;
|
||||
|
||||
AddinRepository[] reps = GetSortedAddinRepo();
|
||||
if (reps.Length == 0)
|
||||
{
|
||||
MainConsole.Instance.Output("No repositories have been registered.");
|
||||
return;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
foreach (AddinRepository rep in reps)
|
||||
{
|
||||
Dictionary<string, object> r = new Dictionary<string, object>();
|
||||
r["enabled"] = rep.Enabled == true ? true : false;
|
||||
r["name"] = rep.Name;
|
||||
r["url"] = rep.Url;
|
||||
|
||||
res.Add(count.ToString(), r);
|
||||
count++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the registry.
|
||||
/// </summary>
|
||||
public void UpdateRegistry()
|
||||
{
|
||||
m_Registry.Update();
|
||||
}
|
||||
|
||||
// Show plugin info
|
||||
/// <summary>
|
||||
/// Addins the info.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The info.
|
||||
/// </returns>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public bool AddinInfo(int ndx, out Dictionary<string, object> result)
|
||||
{
|
||||
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||
result = res;
|
||||
|
||||
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
||||
|
||||
if (ndx > (addins.Length - 1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return false;
|
||||
}
|
||||
// author category description
|
||||
Addin addin = addins[ndx];
|
||||
|
||||
res["author"] = addin.Description.Author;
|
||||
res["category"] = addin.Description.Category;
|
||||
res["description"] = addin.Description.Description;
|
||||
res["name"] = addin.Name;
|
||||
res["url"] = addin.Description.Url;
|
||||
res["file_name"] = addin.Description.FileName;
|
||||
|
||||
result = res;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Disable a plugin
|
||||
/// <summary>
|
||||
/// Disables the plugin.
|
||||
/// </summary>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public void DisablePlugin(string[] args)
|
||||
{
|
||||
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
||||
|
||||
int n = Convert.ToInt16(args[2]);
|
||||
if (n > (addins.Length -1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
Addin addin = addins[n];
|
||||
AddinManager.Registry.DisableAddin(addin.Id);
|
||||
addin.Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable plugin
|
||||
/// <summary>
|
||||
/// Enables the plugin.
|
||||
/// </summary>
|
||||
/// <param name='args'>
|
||||
/// Arguments.
|
||||
/// </param>
|
||||
public void EnablePlugin(string[] args)
|
||||
{
|
||||
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
||||
|
||||
int n = Convert.ToInt16(args[2]);
|
||||
if (n > (addins.Length -1))
|
||||
{
|
||||
MainConsole.Instance.Output("Selection out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
Addin addin = addins[n];
|
||||
|
||||
addin.Enabled = true;
|
||||
AddinManager.Registry.EnableAddin(addin.Id);
|
||||
// AddinManager.Registry.Update();
|
||||
if(m_Registry.IsAddinEnabled(addin.Id))
|
||||
{
|
||||
ConsoleProgressStatus ps = new ConsoleProgressStatus(false);
|
||||
if (!AddinManager.AddinEngine.IsAddinLoaded(addin.Id))
|
||||
{
|
||||
AddinManager.Registry.Rebuild(ps);
|
||||
AddinManager.AddinEngine.LoadAddin(ps, addin.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Not Enabled in this domain {0}", addin.Name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#region Util
|
||||
private void Testing()
|
||||
{
|
||||
Addin[] list = Registry.GetAddins();
|
||||
|
||||
var addins = list.Where( a => a.Description.Category == "IntegrationPlugin");
|
||||
|
||||
foreach (Addin addin in addins)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Addin {0}", addin.Name);
|
||||
}
|
||||
}
|
||||
|
||||
// These will let us deal with numbered lists instead
|
||||
// of needing to type in the full ids
|
||||
private AddinRepositoryEntry[] GetSortedAvailbleAddins()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
list.AddRange(Repositories.GetAvailableAddins());
|
||||
|
||||
AddinRepositoryEntry[] addins = list.ToArray(typeof(AddinRepositoryEntry)) as AddinRepositoryEntry[];
|
||||
|
||||
Array.Sort(addins,(r1,r2) => r1.Addin.Id.CompareTo(r2.Addin.Id));
|
||||
|
||||
return addins;
|
||||
}
|
||||
|
||||
private AddinRepository[] GetSortedAddinRepo()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
list.AddRange(Repositories.GetRepositories());
|
||||
|
||||
AddinRepository[] repos = list.ToArray(typeof(AddinRepository)) as AddinRepository[];
|
||||
Array.Sort (repos,(r1,r2) => r1.Name.CompareTo(r2.Name));
|
||||
|
||||
return repos;
|
||||
}
|
||||
|
||||
private Addin[] GetSortedAddinList(string category)
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
list.AddRange(m_Registry.GetAddins());
|
||||
ArrayList xlist = new ArrayList();
|
||||
|
||||
foreach (Addin addin in list)
|
||||
{
|
||||
if (addin.Description.Category == category)
|
||||
xlist.Add(addin);
|
||||
}
|
||||
|
||||
Addin[] addins = xlist.ToArray(typeof(Addin)) as Addin[];
|
||||
Array.Sort(addins,(r1,r2) => r1.Id.CompareTo(r2.Id));
|
||||
|
||||
return addins;
|
||||
}
|
||||
#endregion Util
|
||||
|
||||
#region Notes
|
||||
// ** 1 Not working
|
||||
#endregion Notes
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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 OpenSimulator 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.Collections;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Services.Interfaces
|
||||
{
|
||||
public interface IIntegrationService
|
||||
{
|
||||
#region Web handlers
|
||||
byte[] HandleWebListRepositories(OSDMap request);
|
||||
byte[] HandleWebAddRepository(OSDMap request);
|
||||
byte[] HandleWebRemoveRepositroy(OSDMap request);
|
||||
byte[] HandleEnableRepository(OSDMap request);
|
||||
byte[] HandleWebDisableRepository(OSDMap request);
|
||||
byte[] HandleWebListPlugins(OSDMap request);
|
||||
byte[] HandleWebPluginInfo(OSDMap request);
|
||||
byte[] HandleWebListAvailablePlugins(OSDMap request);
|
||||
byte[] HandleWebInstallPlugin(OSDMap request);
|
||||
byte[] HandleWebUnInstallPlugin(OSDMap request);
|
||||
byte[] HandleWebEnablePlugin(OSDMap request);
|
||||
byte[] HandleWebDisablePlugin(OSDMap request);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -106,4 +106,4 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <param name='userIDs'></param>
|
||||
PresenceInfo[] GetAgents(string[] userIDs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,5 +158,19 @@ namespace OpenSim.Services.PresenceService
|
|||
|
||||
return info.ToArray();
|
||||
}
|
||||
|
||||
public PresenceInfo VerifyAgent(UUID s_sessionID)
|
||||
{
|
||||
PresenceInfo ret = new PresenceInfo();
|
||||
|
||||
PresenceData data = m_Database.Verify(s_sessionID);
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
ret.UserID = data.UserID;
|
||||
ret.RegionID = data.RegionID;
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -20,7 +20,6 @@
|
|||
; * The full syntax of a connector string is:
|
||||
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
|
||||
; *
|
||||
[Startup]
|
||||
|
||||
[ServiceList]
|
||||
|
||||
|
@ -52,7 +51,7 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
|
|||
|
||||
;; Additions for other add-on modules. For example:
|
||||
;; WifiServerConnector = "8002/Diva.Wifi.dll:WifiServerConnector"
|
||||
|
||||
IntegrationService = "8002/OpenSim.Server.Handlers.dll:IntegrationServiceConnector"
|
||||
|
||||
; * This is common for all services, it's the network setup for the entire
|
||||
; * server instance, if none is specified above
|
||||
|
@ -546,3 +545,18 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
|
|||
;; This applies to the core groups module (Flotsam) only.
|
||||
; ForwardOfflineGroupMessages = true
|
||||
|
||||
[IntegrationService]
|
||||
|
||||
LocalServiceModule = "OpenSim.Services.IntegrationService.dll:IntegrationService"
|
||||
|
||||
;; Location for plugin management data, default is "."
|
||||
PluginRegistryLocation="/home/opensim/var/run/addin/Integration"
|
||||
;;
|
||||
;; Each plugin uses it's own ini (for now these are files only)
|
||||
;; The initial files are supplied by the plugin when it is installed
|
||||
;; and this is the location for the directory for these.
|
||||
IntegrationConfig = "/home/opensim/etc/Integration"
|
||||
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ GridUserServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridUserServiceConn
|
|||
FriendsServiceConnector = "8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector"
|
||||
MapAddServiceConnector = "8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector"
|
||||
MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector"
|
||||
|
||||
IntegrationService = "8002/OpenSim.Server.Handlers.dll:IntegrationServiceConnector"
|
||||
; * This is common for all services, it's the network setup for the entire
|
||||
; * server instance, if none is specified above
|
||||
; *
|
||||
|
@ -355,3 +355,19 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
|
|||
|
||||
; password help: optional: page providing password assistance for users of your grid
|
||||
;password = http://127.0.0.1/password
|
||||
|
||||
[IntegrationService]
|
||||
|
||||
LocalServiceModule = "OpenSim.Services.IntegrationService.dll:IntegrationService"
|
||||
|
||||
;; Location for plugin management data, default is "."
|
||||
PluginRegistryLocation="/home/opensim/var/run/addin/Integration"
|
||||
;;
|
||||
;; Each plugin uses it's own ini (for now these are files only)
|
||||
;; The initial files are supplied by the plugin when it is installed
|
||||
;; and this is the location for the directory for these.
|
||||
IntegrationConfig = "/home/opensim/etc/Integration"
|
||||
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
41
prebuild.xml
41
prebuild.xml
|
@ -734,6 +734,7 @@
|
|||
<Reference name="System.Xml"/>
|
||||
<Reference name="System.Web"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
|
@ -1097,6 +1098,44 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Services.IntegrationService" path="OpenSim/Services/IntegrationService" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="OpenSim.Services.Interfaces"/>
|
||||
<Reference name="OpenSim.Services.Base"/>
|
||||
<Reference name="OpenSim.Services.Connectors"/>
|
||||
<Reference name="OpenSim.Data"/>
|
||||
<Reference name="OpenSim.Server.Base"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||
<Reference name="Mono.Addins.Setup" path="../../../bin/"/>
|
||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Services.InventoryService" path="OpenSim/Services/InventoryService" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -2152,7 +2191,7 @@
|
|||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||
<Reference name="Community.CsharpSqlite" path="../../../bin/"/>
|
||||
<Reference name="Community.CsharpSqlite.Sqlite" path="../../../bin"/>
|
||||
<Reference name="Mono.Data.Sqlite"/>
|
||||
<Reference name="Mono.Data.Sqlite" path="../../../bin" />
|
||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||
<Reference name="log4net" path="../../../bin/"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue