Exemplo n.º 1
0
        public virtual void CacheWearableData(UUID principalID, AvatarWearable cachedWearable)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            //sendData["SCOPEID"] = scopeID.ToString();
            sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"]     = "cachewearabledata";

            sendData["WEARABLES"] = OSDParser.SerializeJsonString(cachedWearable.Pack());

            string reqString = WebUtils.BuildQueryString(sendData);

            // MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
            try
            {
                List <string> serverURIs =
                    m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AvatarServerURI");
                foreach (string m_ServerURI in serverURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                                                                m_ServerURI,
                                                                reqString);
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message);
            }
        }
Exemplo n.º 2
0
        public bool Get(string id, Object sender, AssetRetrieved handler)
        {
            string uri = m_ServerURI + "/assets/" + id;

            AssetBase asset = null;

            if (m_Cache != null)
            {
                asset = m_Cache.Get(id);
            }

            if (asset == null)
            {
                AsynchronousRestObjectRequester.MakeRequest <int, AssetBase>("GET", uri, 0, delegate(AssetBase a)
                {
                    if (m_Cache != null)
                    {
                        m_Cache.Cache(a);
                    }

                    handler(id, sender, a);
                });
            }
            else
            {
                handler(id, sender, asset);
            }

            return(true);
        }
Exemplo n.º 3
0
        public void DeleteMute(UUID muteID, UUID PrincipalID)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["PRINCIPALID"] = PrincipalID.ToString();
            sendData["MUTEID"]      = muteID.ToString();
            sendData["METHOD"]      = "deletemute";

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                                                                m_ServerURI + "/auroradata",
                                                                reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteMuteListConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }
Exemplo n.º 4
0
        public void UpdateLSLData(string token, string key, string value)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["token"]  = token;
            sendData["key"]    = key;
            sendData["value"]  = value;
            sendData["METHOD"] = "updatelsldata";

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                List <string> m_ServerURIs =
                    m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                                                                m_ServerURI,
                                                                reqString);
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteAssetConnector]: Exception when contacting server: {0}", e);
            }
        }
Exemplo n.º 5
0
        public void Post(OSDMap request, ulong RegionHandle)
        {
            OSDMap        message    = CreateWebRequest(request);
            string        postInfo   = OSDParser.SerializeJsonString(message);
            List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(RegionHandle.ToString(), "MessagingServerURI");

            foreach (string host in serverURIs)
            {
                //Send it async
                AsynchronousRestObjectRequester.MakeRequest("POST", host, postInfo);
            }
        }
Exemplo n.º 6
0
        public override bool Get(string id, object sender, AssetRetrieved handler)
        {
            List <string> serverURIs =
                m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AssetServerURI");

            if (m_serverURL != string.Empty)
            {
                serverURIs = new List <string>(new string[1] {
                    m_serverURL
                });
            }
            foreach (string m_ServerURI in serverURIs)
            {
                string uri = m_ServerURI + "/" + id;

                Aurora.Framework.AssetBase asset = null;
                if (m_Cache != null)
                {
                    asset = m_Cache.Get(id);
                }

                if (asset == null)
                {
                    bool result = false;

                    AsynchronousRestObjectRequester.
                    MakeRequest("GET", uri, 0,
                                delegate(AssetBase aa)
                    {
                        Aurora.Framework.AssetBase a = TearDown(aa);
                        if (m_Cache != null)
                        {
                            m_Cache.Cache(a);
                        }
                        handler(id, sender, a);
                        result = true;
                    });

                    if (result)
                    {
                        return(result);
                    }
                }
                else
                {
                    handler(id, sender, asset);
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 7
0
        public virtual bool Get(string id, Object sender, AssetRetrieved handler)
        {
            List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AssetServerURI");

            foreach (string m_ServerURI in serverURIs)
            {
                string uri = m_ServerURI + "/" + id;

                AssetBase asset = null;
                if (m_Cache != null)
                {
                    asset = m_Cache.Get(id);
                }

                if (asset == null)
                {
                    bool result = false;

                    AsynchronousRestObjectRequester.
                    MakeRequest <int, AssetBase>("GET", uri, 0,
                                                 delegate(AssetBase a)
                    {
                        if (m_Cache != null)
                        {
                            m_Cache.Cache(a);
                        }
                        handler(id, sender, a);
                        result = true;
                    });

                    if (result)
                    {
                        return(result);
                    }
                }
                else
                {
                    //Util.FireAndForget(delegate { handler(id, sender, asset); });
                    handler(id, sender, asset);
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 8
0
        /// <summary>
        /// This also updates the parcel, not for just adding a new one
        /// </summary>
        /// <param name="args"></param>
        /// <param name="regionID"></param>
        /// <param name="forSale"></param>
        /// <param name="EstateID"></param>
        /// <param name="showInSearch"></param>
        public void AddLandObject(LandData args)
        {
            Dictionary <string, object> sendData = args.ToKeyValuePairs();

            sendData["METHOD"] = "addlandobject";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                                                                m_ServerURI,
                                                                reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }
        public void AddOfflineMessage(GridInstantMessage message)
        {
            Dictionary <string, object> sendData = message.ToKeyValuePairs();

            sendData["METHOD"] = "addofflinemessage";

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(message.toAgentID.ToString(), "RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                                                                m_ServerURI + "/auroradata",
                                                                reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteOfflineMessagesConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }
        public bool Get(string id, Object sender, AssetRetrieved handler)
        {
            //            m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id);

            string uri = m_ServerURI + "/assets/" + id;

            AssetBase asset = null;

            if (m_Cache != null)
            {
                asset = m_Cache.Get(id);
            }

            if (asset == null)
            {
                lock (m_AssetHandlers)
                {
                    AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); });

                    AssetRetrievedEx handlers;
                    if (m_AssetHandlers.TryGetValue(id, out handlers))
                    {
                        // Someone else is already loading this asset. It will notify our handler when done.
                        handlers += handlerEx;
                        return(true);
                    }

                    // Load the asset ourselves
                    handlers += handlerEx;
                    m_AssetHandlers.Add(id, handlers);
                }

                bool success = false;
                try
                {
                    AsynchronousRestObjectRequester.MakeRequest <int, AssetBase>("GET", uri, 0,
                                                                                 delegate(AssetBase a)
                    {
                        if (a != null && m_Cache != null)
                        {
                            m_Cache.Cache(a);
                        }

                        AssetRetrievedEx handlers;
                        lock (m_AssetHandlers)
                        {
                            handlers = m_AssetHandlers[id];
                            m_AssetHandlers.Remove(id);
                        }
                        handlers.Invoke(a);
                    }, m_maxAssetRequestConcurrency);

                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        lock (m_AssetHandlers)
                        {
                            m_AssetHandlers.Remove(id);
                        }
                    }
                }
            }
            else
            {
                handler(id, sender, asset);
            }

            return(true);
        }