public Proxy (Type rootType, string url) : base (rootType) { string host; int port; string rest; IceChannelUtils.ParseIceURL (url, out host, out port, out rest); _url = url; _identity = new Ice.Identity (rest); _facetPath = new string[0]; _secure = false; _typeIds = null; _realObject = null; FindChannel(); }
protected abstract void evict(Ice.Object servant, object cookie);
public void addAdminFacet(Ice.Object servant, string facet) { instance_.addAdminFacet(servant, facet); }
public void writeObject(Ice.Object v) { _os.writeObject(v); }
public override void patch(Ice.Object v) { _cb.invoke(v); }
allTests(global::Test.TestHelper helper) { var output = helper.getWriter(); Ice.Communicator communicator = helper.communicator(); Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.activate(); Ice.Object servant = new MyObjectI(); // // Register default servant with category "foo" // oa.addDefaultServant(servant, "foo"); // // Start test // output.Write("testing single category... "); output.Flush(); Ice.Object r = oa.findDefaultServant("foo"); test(r == servant); r = oa.findDefaultServant("bar"); test(r == null); Ice.Identity identity = new Ice.Identity(); identity.category = "foo"; string[] names = new string[] { "foo", "bar", "x", "y", "abcdefg" }; Test.MyObjectPrx prx = null; for (int idx = 0; idx < 5; ++idx) { identity.name = names[idx]; prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity)); prx.ice_ping(); test(prx.getName() == names[idx]); } identity.name = "ObjectNotExist"; prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity)); try { prx.ice_ping(); test(false); } catch (Ice.ObjectNotExistException) { // Expected } try { prx.getName(); test(false); } catch (Ice.ObjectNotExistException) { // Expected } identity.name = "FacetNotExist"; prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity)); try { prx.ice_ping(); test(false); } catch (Ice.FacetNotExistException) { // Expected } try { prx.getName(); test(false); } catch (Ice.FacetNotExistException) { // Expected } identity.category = "bar"; for (int idx = 0; idx < 5; idx++) { identity.name = names[idx]; prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity)); try { prx.ice_ping(); test(false); } catch (Ice.ObjectNotExistException) { // Expected } try { prx.getName(); test(false); } catch (Ice.ObjectNotExistException) { // Expected } } oa.removeDefaultServant("foo"); identity.category = "foo"; prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity)); try { prx.ice_ping(); } catch (Ice.ObjectNotExistException) { // Expected } output.WriteLine("ok"); output.Write("testing default category... "); output.Flush(); oa.addDefaultServant(servant, ""); r = oa.findDefaultServant("bar"); test(r == null); r = oa.findDefaultServant(""); test(r == servant); for (int idx = 0; idx < 5; ++idx) { identity.name = names[idx]; prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity)); prx.ice_ping(); test(prx.getName() == names[idx]); } output.WriteLine("ok"); }
/// <summary> /// 初始化连接 /// </summary> /// <returns></returns> public bool Init() { try { lock (lockData) { Ice.InitializationData intiData = new Ice.InitializationData(); Ice.Properties properties = Ice.Util.createProperties(); properties.setProperty("Ice.MessageSizeMax", "104857600"); intiData.properties = properties; ic = Ice.Util.initialize(intiData); // 连接 Ice.ObjectPrx objectPrx = ic.stringToProxy(string.Format("{0}:tcp -h {1} -p {2} -t 5000", NMCommunicationRPCId.value, EEMSConfigHelper.GetValueByCommomConfig("config/CommonConfig/netagent_ip", "127.0.0.1"), EEMSConfigHelper.GetValueByCommomConfig("config/CommonConfig/netagent_port", "40050"))); client = NMServerPrxHelper.checkedCast(objectPrx); // 代理 Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints(NMCommunicationRPCId.value, string.Format("tcp -h {0} -p {1} -t 5000", EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/WarnInfoLocalIp", "127.0.0.1"), EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/WarnInfoClentPort", "42050"))); NMClientI clientI = new NMClientI(); clientI.ReceiveDataHandler += clientI_ReceiveDataHandler; Ice.Object obj = clientI; adapter.add(obj, ic.stringToIdentity(NMCommunicationRPCId.value)); adapter.activate(); NMClientPrx call = NMClientPrxHelper.uncheckedCast(adapter.createProxy(ic.stringToIdentity(NMCommunicationRPCId.value))); client.NMRegistClient(clientID, call); IsConnect = true; } return(true); } catch (Exception e) { // 初始化失败 client = null; LogHelper.Instance.WirteErrorMsg(e.Message); return(false); } finally { if (!isThreadStart) { isThreadStart = true; CheckConnectThread(); } } }
public virtual void reclaim() { servant_ = null; locator_ = null; cookie_ = null; observer_ = null; if(os_ != null) { os_.reset(); } interceptorAsyncCallbackList_ = null; }
addWithUUID(Ice.Object servant) { return(objectAdapter().add(servant, createCallbackIdentity(Guid.NewGuid().ToString()))); }
public Ice.Object GetProxy(string url, Type t) { Ice.Proxy rprx = new Ice.Proxy(t, url); Ice.Object prx = (Ice.Object)rprx.GetTransparentProxy(); return(prx); }
public string ProxyToString(Ice.Object obj) { throw new NotImplementedException(); }
protected void register(Ice.Object servant, bool icegrid = true) { Servant = servant; //logger.Info("registering: " + Servant.ice_id()); Proxy = IceApp.register(Name, Servant, icegrid); }
public ObjectPrx addWithUUID(Ice.Object obj) { return(addFacetWithUUID(obj, "")); }
public ObjectPrx add(Ice.Object obj, Identity ident) { return(addFacet(obj, ident, "")); }
public abstract void patch(Ice.Object v);
internal InterceptorI(Ice.Object servant) { servant_ = servant; }
public virtual void invoke(Ice.Object v) { patch(v); }
public void finished(Ice.Current curr, Ice.Object servant, System.Object cookie) { }
internal void adopt(IncomingBase inc) { instance_ = inc.instance_; //inc.instance_ = null; // Don't reset instance_. observer_ = inc.observer_; inc.observer_ = null; servant_ = inc.servant_; inc.servant_ = null; locator_ = inc.locator_; inc.locator_ = null; cookie_ = inc.cookie_; inc.cookie_ = null; response_ = inc.response_; inc.response_ = false; compress_ = inc.compress_; inc.compress_ = 0; // // Adopt the stream - it creates less garbage. // os_ = inc.os_; inc.os_ = null; responseHandler_ = inc.responseHandler_; inc.responseHandler_ = null; }
public Direct(Ice.Current current, RunDelegate run) { _current = current; _run = run; Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)_current.adapter; Debug.Assert(adapter != null); // // Must call incDirectCount() first, because it checks for // adapter deactivation, and prevents deactivation completion // until decDirectCount() is called. This is important, // because getServantManager() may not be called afer // deactivation completion. // adapter.incDirectCount(); ServantManager servantManager = adapter.getServantManager(); Debug.Assert(servantManager != null); _servant = servantManager.findServant(_current.id, _current.facet); if(_servant == null) { _locator = servantManager.findServantLocator(_current.id.category); if(_locator == null && _current.id.category.Length > 0) { _locator = servantManager.findServantLocator(""); } if(_locator != null) { try { _servant = _locator.locate(_current, out _cookie); } catch(System.Exception) { adapter.decDirectCount(); throw; } } } if(_servant == null) { adapter.decDirectCount(); if(servantManager != null && servantManager.hasServant(_current.id)) { Ice.FacetNotExistException ex = new Ice.FacetNotExistException(); ex.id = _current.id; ex.facet = _current.facet; ex.operation = _current.operation; throw ex; } else { Ice.ObjectNotExistException ex = new Ice.ObjectNotExistException(); ex.id = _current.id; ex.facet = _current.facet; ex.operation = _current.operation; throw ex; } } }