public EndpointI read(Ice.InputStream s) { lock (this) { short type = s.readShort(); EndpointFactory factory = get(type); EndpointI e = null; s.startEncapsulation(); if (factory != null) { e = factory.read(s); } else { e = new OpaqueEndpointI(type, s); } s.endEncapsulation(); return(e); } }
public EndpointI read(Ice.InputStream s) { lock (this) { short type = s.ReadShort(); EndpointFactory factory = get(type); EndpointI e = null; s.StartEncapsulation(); if (factory != null) { e = factory.read(s); } // // If the factory failed to read the endpoint, return an opaque endpoint. This can // occur if for example the factory delegates to another factory and this factory // isn't available. In this case, the factory needs to make sure the stream position // is preserved for reading the opaque endpoint. // if (e == null) { e = new OpaqueEndpointI(type, s); } s.EndEncapsulation(); return(e); } }
public EndpointI read(BasicStream s) { lock (this) { short type = s.readShort(); EndpointFactory factory = get(type); EndpointI e = null; s.startReadEncaps(); if (factory != null) { e = factory.read(s); } else { e = new OpaqueEndpointI(type, s); } s.endReadEncaps(); return(e); } }
// // Compare endpoints for sorting purposes // public override int CompareTo(EndpointI obj) { if (!(obj is OpaqueEndpointI)) { return(type() < obj.type() ? -1 : 1); } OpaqueEndpointI p = (OpaqueEndpointI)obj; if (this == p) { return(0); } if (_type < p._type) { return(-1); } else if (p._type < _type) { return(1); } if (_rawEncoding.major < p._rawEncoding.major) { return(-1); } else if (p._rawEncoding.major < _rawEncoding.major) { return(1); } if (_rawEncoding.minor < p._rawEncoding.minor) { return(-1); } else if (p._rawEncoding.minor < _rawEncoding.minor) { return(1); } if (_rawBytes.Length < p._rawBytes.Length) { return(-1); } else if (p._rawBytes.Length < _rawBytes.Length) { return(1); } for (int i = 0; i < _rawBytes.Length; i++) { if (_rawBytes[i] < p._rawBytes[i]) { return(-1); } else if (p._rawBytes[i] < _rawBytes[i]) { return(1); } } return(0); }
public EndpointI create(string str, bool oaEndpoint) { string[] arr = IceUtilInternal.StringUtil.splitString(str, " \t\r\n"); if (arr == null) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "mismatched quote"; throw e; } if (arr.Length == 0) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "value has no non-whitespace characters"; throw e; } List <string> v = new List <string>(arr); string protocol = v[0]; v.RemoveAt(0); if (protocol.Equals("default")) { protocol = _instance.defaultsAndOverrides().defaultProtocol; } EndpointFactory factory = null; lock (this) { for (int i = 0; i < _factories.Count; i++) { EndpointFactory f = _factories[i]; if (f.protocol().Equals(protocol)) { factory = f; } } } if (factory != null) { EndpointI e = factory.create(v, oaEndpoint); if (v.Count > 0) { Ice.EndpointParseException ex = new Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v[0] + "' in endpoint `" + str + "'"; throw ex; } return(e); // Code below left in place for debugging. /* * EndpointI e = f.create(s.Substring(m.Index + m.Length), oaEndpoint); * BasicStream bs = new BasicStream(_instance, true); * e.streamWrite(bs); * Buffer buf = bs.getBuffer(); * buf.b.position(0); * short type = bs.readShort(); * EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); * System.Console.Error.WriteLine("Normal: " + e); * System.Console.Error.WriteLine("Opaque: " + ue); * return e; */ } // // If the stringified endpoint is opaque, create an unknown endpoint, // then see whether the type matches one of the known endpoints. // if (protocol.Equals("opaque")) { EndpointI ue = new OpaqueEndpointI(v); if (v.Count > 0) { Ice.EndpointParseException ex = new Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v[0] + "' in endpoint `" + str + "'"; throw ex; } factory = get(ue.type()); if (factory != null) { // // Make a temporary stream, write the opaque endpoint data into the stream, // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // Ice.OutputStream os = new Ice.OutputStream(_instance, Ice.Util.currentProtocolEncoding); os.writeShort(ue.type()); ue.streamWrite(os); Ice.InputStream iss = new Ice.InputStream(_instance, Ice.Util.currentProtocolEncoding, os.getBuffer(), true); iss.pos(0); iss.readShort(); // type iss.startEncapsulation(); EndpointI e = factory.read(iss); iss.endEncapsulation(); return(e); } return(ue); // Endpoint is opaque, but we don't have a factory for its type. } return(null); }
public EndpointI create(string str, bool oaEndpoint) { string[] arr = IceUtilInternal.StringUtil.splitString(str, " \t\r\n"); if(arr == null) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "mismatched quote"; throw e; } if(arr.Length == 0) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "value has no non-whitespace characters"; throw e; } List<string> v = new List<string>(arr); string protocol = v[0]; v.RemoveAt(0); if(protocol.Equals("default")) { protocol = instance_.defaultsAndOverrides().defaultProtocol; } EndpointFactory factory = null; lock(this) { for(int i = 0; i < _factories.Count; i++) { EndpointFactory f = _factories[i]; if(f.protocol().Equals(protocol)) { factory = f; } } } if(factory != null) { EndpointI e = factory.create(v, oaEndpoint); if(v.Count > 0) { Ice.EndpointParseException ex = new Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v[0] + "' in endpoint `" + str + "'"; throw ex; } return e; // Code below left in place for debugging. /* EndpointI e = f.create(s.Substring(m.Index + m.Length), oaEndpoint); BasicStream bs = new BasicStream(instance_, true); e.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); short type = bs.readShort(); EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); System.Console.Error.WriteLine("Normal: " + e); System.Console.Error.WriteLine("Opaque: " + ue); return e; */ } // // If the stringified endpoint is opaque, create an unknown endpoint, // then see whether the type matches one of the known endpoints. // if(protocol.Equals("opaque")) { EndpointI ue = new OpaqueEndpointI(v); if(v.Count > 0) { Ice.EndpointParseException ex = new Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v[0] + "' in endpoint `" + str + "'"; throw ex; } factory = get(ue.type()); if(factory != null) { // // Make a temporary stream, write the opaque endpoint data into the stream, // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // BasicStream bs = new BasicStream(instance_, Ice.Util.currentProtocolEncoding); bs.writeShort(ue.type()); ue.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); buf.b.limit(buf.size()); bs.readShort(); // type bs.startReadEncaps(); EndpointI e = factory.read(bs); bs.endReadEncaps(); return e; } return ue; // Endpoint is opaque, but we don't have a factory for its type. } return null; }
public EndpointI read(BasicStream s) { lock(this) { short type = s.readShort(); EndpointFactory factory = get(type); EndpointI e = null; s.startReadEncaps(); if(factory != null) { e = factory.read(s); } else { e = new OpaqueEndpointI(type, s); } s.endReadEncaps(); return e; } }
public EndpointI create(string str, bool oaEndpoint) { lock(this) { string s = str.Trim(); if(s.Length == 0) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "value has no non-whitespace characters"; throw e; } Regex p = new Regex("([ \t\n\r]+)|$"); Match m = p.Match(s); Debug.Assert(m.Success); string protocol = s.Substring(0, m.Index); if(protocol.Equals("default")) { protocol = instance_.defaultsAndOverrides().defaultProtocol; } for(int i = 0; i < _factories.Count; i++) { EndpointFactory f = (EndpointFactory)_factories[i]; if(f.protocol().Equals(protocol)) { return f.create(s.Substring(m.Index + m.Length), oaEndpoint); // Code below left in place for debugging. /* EndpointI e = f.create(s.Substring(m.Index + m.Length), oaEndpoint); BasicStream bs = new BasicStream(instance_, true); e.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); short type = bs.readShort(); EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); System.Console.Error.WriteLine("Normal: " + e); System.Console.Error.WriteLine("Opaque: " + ue); return e; */ } } // // If the stringified endpoint is opaque, create an unknown endpoint, // then see whether the type matches one of the known endpoints. // if(protocol.Equals("opaque")) { EndpointI ue = new OpaqueEndpointI(s.Substring(m.Index + m.Length)); for(int i = 0; i < _factories.Count; i++) { EndpointFactory f = (EndpointFactory)_factories[i]; if(f.type() == ue.type()) { // // Make a temporary stream, write the opaque endpoint data into the stream, // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // BasicStream bs = new BasicStream(instance_, Ice.Util.currentProtocolEncoding, true); ue.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); bs.readShort(); // type return f.read(bs); } } return ue; // Endpoint is opaque, but we don't have a factory for its type. } return null; } }
public EndpointI create(string str, bool oaEndpoint) { lock (this) { string s = str.Trim(); if (s.Length == 0) { Ice.EndpointParseException e = new Ice.EndpointParseException(); e.str = "value has no non-whitespace characters"; throw e; } Regex p = new Regex("([ \t\n\r]+)|$"); Match m = p.Match(s); Debug.Assert(m.Success); string protocol = s.Substring(0, m.Index); if (protocol.Equals("default")) { protocol = instance_.defaultsAndOverrides().defaultProtocol; } for (int i = 0; i < _factories.Count; i++) { EndpointFactory f = (EndpointFactory)_factories[i]; if (f.protocol().Equals(protocol)) { return(f.create(s.Substring(m.Index + m.Length), oaEndpoint)); // Code below left in place for debugging. /* * EndpointI e = f.create(s.Substring(m.Index + m.Length), oaEndpoint); * BasicStream bs = new BasicStream(instance_, true); * e.streamWrite(bs); * Buffer buf = bs.getBuffer(); * buf.b.position(0); * short type = bs.readShort(); * EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); * System.Console.Error.WriteLine("Normal: " + e); * System.Console.Error.WriteLine("Opaque: " + ue); * return e; */ } } // // If the stringified endpoint is opaque, create an unknown endpoint, // then see whether the type matches one of the known endpoints. // if (protocol.Equals("opaque")) { EndpointI ue = new OpaqueEndpointI(s.Substring(m.Index + m.Length)); for (int i = 0; i < _factories.Count; i++) { EndpointFactory f = (EndpointFactory)_factories[i]; if (f.type() == ue.type()) { // // Make a temporary stream, write the opaque endpoint data into the stream, // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // BasicStream bs = new BasicStream(instance_, Ice.Util.currentProtocolEncoding, true); ue.streamWrite(bs); Buffer buf = bs.getBuffer(); buf.b.position(0); bs.readShort(); // type return(f.read(bs)); } } return(ue); // Endpoint is opaque, but we don't have a factory for its type. } return(null); } }
public EndpointI read(Ice.InputStream s) { lock(this) { short type = s.readShort(); EndpointFactory factory = get(type); EndpointI e = null; s.startEncapsulation(); if(factory != null) { e = factory.read(s); } else { e = new OpaqueEndpointI(type, s); } s.endEncapsulation(); return e; } }