/// <summary> /// 取门诊单据费用明细(退费前用) /// </summary> /// <param name="mzlsh">门诊流水号</param> /// <param name="djh"></param> /// <param name="theMZFY"></param> /// <param name="errMsg"></param> /// <returns></returns> public bool GetMZFYMX(string mzlsh, string djh, out MZFYDetail[] theMZFY, out string errMsg) { IiopClientChannel channel = new IiopClientChannel(); try { NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), strior); NameComponent[] name = new NameComponent[] { new NameComponent("MZYL", "Service") }; intMZ mz = (intMZ)nameService.resolve(name); short[] res = mz.GetMZFYMX(yljgbm, mzlsh, djh, czybm, czy, out theMZFY); ChannelServices.UnregisterChannel(channel); string resStr = TransSAToString(res); if (resStr.StartsWith(SUCCESS)) { errMsg = string.Empty; return(true); } else { errMsg = resStr.Substring(resStr.IndexOf(")") + 1); return(false); } } catch (Exception ex) { ChannelServices.UnregisterChannel(channel); if (isSaveExceptionLog) { //DataLog.SaveLog(String.Format("GetMZFYMX:{0}\n", ex.Message)); } errMsg = EXCEPTION; theMZFY = null; return(false); } }
public static void Main(string[] args) { try { string nameServiceHost = "localhost"; int nameServicePort = 1050; parseArgs(ref nameServiceHost, ref nameServicePort, args); Console.WriteLine("input the two summands"); Console.WriteLine("sum1:"); double sum1 = Double.Parse(Console.ReadLine()); Console.WriteLine("sum2:"); double sum2 = Double.Parse(Console.ReadLine()); // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); // access COS nameing service CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService(nameServiceHost, nameServicePort); NameComponent[] name = new NameComponent[] { new NameComponent("adder", "") }; // get the reference to the adder Adder adder = (Adder)nameService.resolve(name); // call add double result = adder.add(sum1, sum2); Console.WriteLine("result: " + result); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
public static void Main(string[] args) { try { string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root"; if (args.Length > 0) { nameserviceLoc = args[0]; } IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""), new NameComponent("commandTargetHome", "") }; // get the command target home interface CommandTargetHome home = (CommandTargetHome)nameService.resolve(name); CommandTarget commandTarget = home.create(); Application.Run(new Commandform(commandTarget)); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
/// <summary> /// The argument <paramref name="completeSource" /> determines whether the source code /// is complete PHP script file, which is a case in dynamic includ in Silverlight /// </summary> public TransientCompilationUnit Build(string /*!*/ sourceCode, SourceCodeDescriptor descriptor, EvalKinds kind, CompilationContext /*!*/ context, ScriptContext /*!*/ scriptContext, DTypeDesc referringType, NamingContext namingContext, bool completeSource) { PhpSourceFile source_file = new PhpSourceFile(context.Config.Compiler.SourceRoot, RelativePath.ParseCanonical(descriptor.ContainingSourcePath)); Encoding encoding = context.Config.Globalization.PageEncoding; TransientCompilationUnit result = new TransientCompilationUnit (sourceCode, source_file, encoding, namingContext, descriptor.Line, descriptor.Column, completeSource); if (!result.PreCompile(context, scriptContext, descriptor, kind, referringType)) { return(null); } DefineGlobalType(((TransientModuleBuilder)result.ModuleBuilder).AssemblyBuilder.RealModuleBuilder); if (!result.Compile(context, kind)) { return(null); } BakeGlobals(); result.PostCompile(descriptor); return(result); }
public static bool Register(NamingContext namingContext, DTypeDesc caller, PhpCallback autoloadFunction, bool throwError, bool prepend) { if (autoloadFunction == null) { PhpException.ArgumentNull("autoloadFunction"); return(false); } if (autoloadFunction.Bind(!throwError, caller, namingContext)) { var context = ScriptContext.CurrentContext; if (FindAutoloadFunction(context, autoloadFunction.ToPhpRepresentation()) != null) { return(false); } if (prepend) { context.SplAutoloadFunctions.AddFirst(autoloadFunction); } else { context.SplAutoloadFunctions.AddLast(autoloadFunction); } return(true); } else { return(false); } }
public static void Main(string[] args) { try { string nameServiceHost = "localhost"; int nameServicePort = 1050; parseArgs(ref nameServiceHost, ref nameServicePort, args); // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); // access COS naming service CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService(nameServiceHost, nameServicePort); NameComponent[] name = new NameComponent[] { new NameComponent("service", "") }; // get the reference to the adder Service service = (Service)nameService.resolve(name); // call fail service.fail(); } catch (CustomEx je) { Console.WriteLine("Java-side exception: {0}\nReason: {1}", je.value.message, je.value.reason); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
public static void DefaultAutoload(NamingContext namingContext, DTypeDesc caller, string className) { // TODO: skip in pure mode var context = ScriptContext.CurrentContext; var fileExtensions = context.SplAutoloadExtensions.GetEnumerator(); bool stateChanged = true; while (!stateChanged || ScriptContext.CurrentContext.ResolveType(className, namingContext, caller, null, ResolveTypeFlags.None) == null) { if (!fileExtensions.MoveNext()) { PhpException.Throw(PhpError.Error, string.Format(CoreResources.class_could_not_be_loaded, className)); return; } // try to dynamically include the file specified by the class name, if it exists string FullFileName = className + fileExtensions.Current; if (PhpFile.Exists(FullFileName)) { context.DynamicInclude(FullFileName, context.WorkingDirectory, null, null, null, InclusionTypes.IncludeOnce); stateChanged = true; } else { stateChanged = false; } } }
private BuilderVisitor(IList <Statement> /*!*/ statements, SemanticsBinder /*!*/ binder, NamingContext naming) { Contract.ThrowIfNull(statements); Contract.ThrowIfNull(binder); _binder = binder; _naming = naming; this.Start = WithNewOrdinal(new StartBlock() { Naming = _naming }); this.Exit = new ExitBlock(); _current = WithOpenScope(this.Start); statements.ForEach(this.VisitElement); _current = Connect(_current, this.Exit); // WithNewOrdinal(this.Exit); CloseScope(); // Debug.Assert(_scopes.Count == 0); Debug.Assert(_tryTargets == null || _tryTargets.Count == 0); Debug.Assert(_breakTargets == null || _breakTargets.Count == 0); }
bool IsObjectReplicated(DsServer orig, DsServer dest, NamingContext ncType, string objectDn) { // FIXME: likezh-11-06-2013: // Correct me if this is wrong, but it seems to be working quite well... // // The property is replicated if it meets: // - The originating USN of the property in orig is less or equal to the one in dest // First get the UTD in dest UPTODATE_VECTOR_V1_EXT utdVectorDest = ldapAdapter.GetReplUTD(dest, ncType); // No way to get the object metadata (ENTINF) thru LDAP, so try uSNChanged of the object instead. uint usnChanged = Convert.ToUInt32(ldapAdapter.GetAttributeValueInString(orig, objectDn, "uSNChanged")); for (int i = 0; i < utdVectorDest.cNumCursors; ++i) { UPTODATE_CURSOR_V1 cursor = utdVectorDest.rgCursors[i]; if (cursor.uuidDsa == orig.InvocationId) { long usnHigh = cursor.usnHighPropUpdate; BaseTestSite.Log.Add(LogEntryKind.Comment, "{0} - usnHigh: {1}, usnChanged: {2}", objectDn, usnHigh, usnChanged); if (usnHigh >= usnChanged) { return(true); } } } return(false); }
public static string GetDnFromNcType(DsServer srv, NamingContext ncType) { string baseDn = ""; RootDSE rootDse = LdapUtility.GetRootDSE(srv); switch (ncType) { case NamingContext.DomainNC: baseDn = rootDse.defaultNamingContext; break; case NamingContext.ConfigNC: baseDn = rootDse.configurationNamingContext; break; case NamingContext.SchemaNC: baseDn = rootDse.schemaNamingContext; break; default: throw new NotImplementedException(); //break; } return(baseDn); }
protected virtual EnumMemberDeclarationSyntax?CreateEnumMember( ILocatedOpenApiElement <OpenApiSchema> schemaElement, IOpenApiAny value, INameFormatter nameFormatter, NamingContext namingContext) { if (value.AnyType != AnyType.Primitive) { return(null); } var primitive = (IOpenApiPrimitive)value; if (primitive.PrimitiveType != PrimitiveType.String) { return(null); } var stringPrimitive = (OpenApiPrimitive <string>)primitive; string memberName = namingContext.RegisterName(nameFormatter.Format(stringPrimitive.Value)); return(SyntaxFactory.EnumMemberDeclaration(memberName) .AddAttributeLists(SyntaxFactory.AttributeList().AddAttributes( CreateEnumMemberAttribute(stringPrimitive.Value)))); }
private BuilderVisitor(IList <Statement> /*!*/ statements, SemanticsBinder /*!*/ binder, NamingContext naming) { Contract.ThrowIfNull(statements); Contract.ThrowIfNull(binder); // TODO: Implement a cleaner way to enable SemanticsBinder to create BoundBlocks trough BuilderVisitor if (binder is GeneratorSemanticsBinder gsb) { gsb.GetNewBlock = this.NewBlock; } _binder = binder; _naming = naming; this.Start = WithNewOrdinal(new StartBlock() { Naming = _naming }); this.Exit = new ExitBlock(); _current = WithOpenScope(this.Start); statements.ForEach(this.VisitElement); FinalizeRoutine(); _current = Connect(_current, this.Exit); // WithNewOrdinal(this.Exit); CloseScope(); // Debug.Assert(_scopes.Count == 0); Debug.Assert(_tryTargets == null || _tryTargets.Count == 0); Debug.Assert(_breakTargets == null || _breakTargets.Count == 0); }
internal TypeRefContext(NamingContext naming, SourceUnit sourceUnit, SourceNamedTypeSymbol containingType) { _namingCtx = naming; _sourceUnit = sourceUnit; _typeRefs = new List <ITypeRef>(); _containingType = containingType; }
public override void VisitNamespaceDecl(NamespaceDecl x) { _naming = x.Naming; _current = Connect(_current, NewBlock()); // create new block with new naming base.VisitNamespaceDecl(x); }
/// <summary> /// get the DSName of the specified NC. /// </summary> /// <param name="domain">Domain that contains the NC.</param> /// <param name="ncType">The naming context type.</param> /// <returns>The DSName of the specified NC. Null if the NC is not existed.</returns> public static DSNAME GetNamingContextDSName(DsDomain domain, NamingContext ncType) { DSNAME ncDsName = new DSNAME(); if (ncType == NamingContext.ConfigNC) { ncDsName = domain.ConfigNC; } else if (ncType == NamingContext.SchemaNC) { ncDsName = domain.SchemaNC; } else if (ncType == NamingContext.DomainNC) { if (domain is AddsDomain) { ncDsName = ((AddsDomain)domain).DomainNC; } } else { if (domain is AdldsDomain) { ncDsName = ((AdldsDomain)domain).AppNCs[0]; } } return(ncDsName); }
public static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Please specify the nameservice url either as ior or corbaloc"); } string nameServiceUrl = args[0]; // register the channel int port = 8087; IiopChannel chan = new IiopChannel(port); ChannelServices.RegisterChannel(chan, false); AdderImpl adder = new AdderImpl(); string objectURI = "adder"; RemotingServices.Marshal(adder, objectURI); // publish the adder with an external name service NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameServiceUrl); NameComponent[] name = new NameComponent[] { new NameComponent("adder") }; nameService.bind(name, adder); Console.WriteLine("server running"); Console.ReadLine(); // unpublish with external name service nameService.unbind(name); }
public static void Main(string[] args) { try { string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root"; // the port the callback is listening on int callbackPort = 0; // auto assign if (args.Length > 0) { nameserviceLoc = args[0]; } if (args.Length > 1) { callbackPort = Int32.Parse(args[1]); } IiopChannel channel = new IiopChannel(callbackPort); ChannelServices.RegisterChannel(channel, false); NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""), new NameComponent("chatroomHome", "") }; // get the chatroom home interface ChatroomHome home = (ChatroomHome)nameService.resolve(name); Chatroom chatroom = home.create(); Application.Run(new Chatform(chatroom)); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
public static void Main(string[] args) { try { string nameserviceLoc = "corbaloc::localhost:8091/StandardNS/NameServer-POA/_root"; if (args.Length > 0) { nameserviceLoc = args[0]; } Console.WriteLine("input the two summands"); Console.WriteLine("sum1:"); double sum1 = Double.Parse(Console.ReadLine()); Console.WriteLine("sum2:"); double sum2 = Double.Parse(Console.ReadLine()); // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); // get reference to nameservice NamingContext nc = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); // get the reference to the adder Adder adder = (Adder)nc.resolve(new NameComponent[] { new NameComponent("Adder") }); // call add double result = adder.add(sum1, sum2); Console.WriteLine("result: " + result); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
/// <summary> /// 取个人基本信息 /// </summary> /// <param name="ylzh">医疗证号(解析前)</param> /// <param name="mm">医疗证号密码</param> /// <param name="theGRXX">个人基本信息</param> /// <param name="errMsg">异常信息</param> /// <returns></returns> public bool GetGRXBXX(string ylzh, string mm, out GRXX theGRXX, out string errMsg) { System.Collections.IDictionary dic = new System.Collections.Hashtable(); //dic.Add(IiopClientChannel.ALLOW_REQUEST_MULTIPLEX_KEY,"9"); //dic.Add(IiopClientChannel.CLIENT_CONNECTION_LIMIT_KEY,30000); //dic.Add(IiopClientChannel.CLIENT_RECEIVE_TIMEOUT_KEY, 30000); //dic.Add(IiopClientChannel.CLIENT_REQUEST_TIMEOUT_KEY, 30000); //dic.Add(IiopClientChannel.CLIENT_SEND_TIMEOUT_KEY, 30000); //dic.Add(IiopClientChannel.CLIENT_UNUSED_CONNECTION_KEEPALIVE_KEY, "3"); //dic.Add(IiopClientChannel.MAX_NUMBER_OF_MULTIPLEXED_REQUESTS_KEY, "3"); //dic.Add(IiopClientChannel.MAX_NUMBER_OF_RETRIES_KEY, "3"); //dic.Add(IiopClientChannel.RETRY_DELAY_KEY,30000); dic.Add(IiopClientChannel.CLIENT_RECEIVE_TIMEOUT_KEY, 30000); //30s dic.Add(IiopClientChannel.CLIENT_REQUEST_TIMEOUT_KEY, 30000); //30s dic.Add(IiopClientChannel.CLIENT_SEND_TIMEOUT_KEY, 30000); //30s IiopClientChannel channel = new IiopClientChannel(dic); try { if (string.IsNullOrEmpty(mm)) { mm = ""; } ChannelServices.RegisterChannel(channel, false); NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), strior); NameComponent[] name = new NameComponent[] { new NameComponent("MZYL", "Service") }; intMZ mz = (intMZ)nameService.resolve(name); short[] res = mz.GetGRJBXX(yljgbm, ylzh, mm, czybm, czy, out theGRXX); ChannelServices.UnregisterChannel(channel); string resStr = TransSAToString(res); if (resStr.StartsWith(SUCCESS)) { ////DataLog.SaveLog("获取患者医保个人信息成功"); errMsg = string.Empty; return(true); } else { if (isSaveExceptionLog) { ////DataLog.SaveLog(String.Format("GetGRXBXX:{0}\n", resStr)); } errMsg = resStr.Substring(resStr.IndexOf(")") + 1); return(false); } } catch (Exception ex) { ChannelServices.UnregisterChannel(channel); if (isSaveExceptionLog) { ////DataLog.SaveLog(String.Format("GetGRXBXX:{0}\n", ex.Message)); } errMsg = EXCEPTION; theGRXX = new GRXX(); return(false); } }
public NamingContext GetNameService(string host, int port, GiopVersion version) { string nsKey = String.Format("NameService:{0}:{1}:{2}.{3}", host, port, version.Major, version.Minor); lock (m_initalServices.SyncRoot) { NamingContext result = null; if (!m_initalServices.ContainsKey(nsKey)) { string corbaLoc = String.Format("corbaloc:iiop:{0}.{1}@{2}:{3}/{4}", version.Major, version.Minor, host, port, InitialCOSNamingContextImpl.INITIAL_NAMING_OBJ_NAME); result = (NamingContext)RemotingServices.Connect(typeof(NamingContext), corbaLoc); m_initalServices.Add(nsKey, result); } else { result = (NamingContext)m_initalServices[nsKey]; } return(result); } }
// <summary> // the function is used to create a DrsUpdateRef request // </summary> public DRS_MSG_UPDREFS CreateRequestForDrsUpdateRef( EnvironmentConfig.Machine machine, DsServer dest, DRS_OPTIONS options, NamingContext nc = NamingContext.ConfigNC) { string nc_name = null; Guid nc_guid = Guid.Empty; string nc_sid = null; DSNAME nc_obj; switch (nc) { case NamingContext.ConfigNC: nc_obj = dest.Domain.ConfigNC; break; case NamingContext.SchemaNC: nc_obj = dest.Domain.SchemaNC; break; case NamingContext.AppNC: if (EnvironmentConfig.TestDS) { nc_obj = ((AddsDomain)dest.Domain).OtherNCs[0]; } else { nc_obj = ((AdldsDomain)dest.Domain).AppNCs[0]; } break; case NamingContext.DomainNC: if (!EnvironmentConfig.TestDS) { nc_obj = new DSNAME(); } nc_obj = ((AddsDomain)dest.Domain).DomainNC; break; default: nc_obj = new DSNAME(); break; } nc_name = LdapUtility.ConvertUshortArrayToString(nc_obj.StringName); nc_guid = nc_obj.Guid; nc_sid = convertSidToString(nc_obj.Sid); DRS_MSG_UPDREFS?req = DRSClient.CreateUpdateRefsRequest( nc_name, nc_guid, nc_sid, dest.DsaNetworkAddress, dest.NtdsDsaObjectGuid, options); return((DRS_MSG_UPDREFS)req); }
public static void Call(NamingContext namingContext, DTypeDesc caller, string className) { ScriptContext context = ScriptContext.CurrentContext; // If class isn't defined autoload functions are called automatically until class is declared if (context.IsSplAutoloadEnabled) ScriptContext.CurrentContext.ResolveType(className, namingContext, caller, null, ResolveTypeFlags.UseAutoload); }
private void Destroy() { mz = null; sys = null; nameService = null; ChannelServices.UnregisterChannel(channel); channel = null; }
private NamingContext GetNameService() { // access COS nameing service CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService("localhost", 1050); return(nameService); }
public NamespaceDecl(Text.Span p, List <string> /*!*/ names, bool simpleSyntax) : base(p) { this.isAnonymous = false; this.qualifiedName = new QualifiedName(names, false, true); this.IsSimpleSyntax = simpleSyntax; this.naming = new NamingContext(this.qualifiedName, null); }
public NamespaceDecl(Text.Span p) : base(p) { this.isAnonymous = true; this.qualifiedName = new QualifiedName(Name.EmptyBaseName, Name.EmptyNames); this.IsSimpleSyntax = false; this.naming = new NamingContext(null, null); }
public void Open() { ChannelServices.RegisterChannel(new IiopChannel(0), false); CorbaInit m_Init = CorbaInit.GetInit(); m_NameService = m_Init.GetNameService(m_IPAddress, m_Port); }
public static DObject GetTypeOf(NamingContext/*!*/ namingContext, DTypeDesc caller, object typeNameOrObject) { ScriptContext context = ScriptContext.CurrentContext; DTypeDesc type = PhpObjects.ClassNameOrObjectToType(context, namingContext, caller, typeNameOrObject, true); if (type == null) return null; return ClrObject.Create(type.RealType); }
public void TearDownEnvironment() { if (m_test != null) { m_test.remove(); m_test = null; } m_nameService = null; // unregister the channel ChannelServices.UnregisterChannel(m_channel); }
public void Open() { ChannelServices.RegisterChannel(_iiopChannel, false); CorbaInit m_Init = CorbaInit.GetInit(); _nameService = m_Init.GetNameService(_ipAddress, _ipPort); RebindToNameService(); IsConnected = true; }
private RtecEventChannelAdmin.EventChannel ResolveEventChannel(NamingContext nameService) { NameComponent[] name = new NameComponent[] { new NameComponent("EventService", "") }; //Downcast the object reference to an EventChannel reference RtecEventChannelAdmin.EventChannel ec = (RtecEventChannelAdmin.EventChannel)nameService.resolve(name); return(ec); }
public static void Call(NamingContext namingContext, DTypeDesc caller, string className) { ScriptContext context = ScriptContext.CurrentContext; // If class isn't defined autoload functions are called automatically until class is declared if (context.IsSplAutoloadEnabled) { ScriptContext.CurrentContext.ResolveType(className, namingContext, caller, null, ResolveTypeFlags.UseAutoload); } }
private void RetrieveChatRoom(string nameServiceHost, int nameServicePort) { CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = (NamingContext)init.GetNameService(nameServiceHost, nameServicePort); NameComponent[] name = new NameComponent[] { new NameComponent("chatroom", "") }; // get the chatroom m_chatroom = (IChatroom)nameService.resolve(name); }
public DFSManager(DFServer srv, string id, NamingContext nc) { this.server = srv; this.id = id; server.registerInterface(this); objrefWellKnown = RemotingServices.Marshal(this, id); this.nameService = nc; if ( nameService != null ) nameService.rebind(new NameComponent[] { new NameComponent(id) }, this); }
/// <summary> /// Gets type mask representing given type name. /// </summary> public static TypeRefMask GetTypeMask(TypeRefContext/*!*/typeCtx, string tname, NamingContext naming, bool fullyQualified = false) { if (!string.IsNullOrEmpty(tname)) { // handle various array conventions if (tname.LastCharacter() == ']') { // "TName[]" if (tname.EndsWith("[]", StringComparison.Ordinal)) { var elementType = GetTypeMask(typeCtx, tname.Remove(tname.Length - 2), naming, fullyQualified); return typeCtx.GetArrayTypeMask(elementType); } // "array[TName]" var arrayTypeName = QualifiedName.Array.Name.Value; if (tname.Length > arrayTypeName.Length && tname[arrayTypeName.Length] == '[' && tname.StartsWith(arrayTypeName, StringComparison.OrdinalIgnoreCase)) { var elementTypeName = tname.Substring(arrayTypeName.Length + 1, tname.Length - arrayTypeName.Length - 2); var elementType = GetTypeMask(typeCtx, elementTypeName, naming, fullyQualified); return typeCtx.GetArrayTypeMask(elementType); } // unknown something // ... } else { var result = GetKnownTypeMask(typeCtx, tname); if (result.IsUninitialized) { var qname = NameUtils.MakeQualifiedName(tname, false); if (!fullyQualified && naming != null && !qname.IsReservedClassName) qname = QualifiedName.TranslateAlias(qname, AliasKind.Type, naming.Aliases, naming.CurrentNamespace); if (qname.IsPrimitiveTypeName) { result = GetKnownTypeMask(typeCtx, qname.Name.Value); if (!result.IsUninitialized) return result; } result = typeCtx.GetTypeMask(qname, true); } //Contract.Assert(!result.IsUninitialized); return result; } } return 0; }
public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service RmiIiopInit init = new RmiIiopInit("localhost", 7001); m_nameService = init.GetNameService(); NameComponent[] name = new NameComponent[] { new NameComponent("IntegrationTest", ""), new NameComponent("test", "") }; // get the reference to the test-home TestHome testhome = (TestHome) m_nameService.resolve(name); m_test = testhome.create(); }
public void SetupEnvironment() { SetupSslChannel(); // access COS nameing service string nameserviceLoc = "corbaloc:iiop-ssl:localhost:3529/JBoss/Naming/root"; m_nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); NameComponent[] name = new NameComponent[] { new NameComponent("IntegrationTest", ""), new NameComponent("test", "") }; // get the reference to the test-home TestHome testhome = (TestHome) m_nameService.resolve(name); m_test = testhome.create(); }
public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root"; m_nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); NameComponent[] name = new NameComponent[] { new NameComponent("IntegrationTest", ""), new NameComponent("testForwarder", "") }; // get the reference to the test-home TestHomeFwd testhome = (TestHomeFwd) m_nameService.resolve(name); m_test = testhome.create(); }
public void BindOrBiteMyLegsOff(DTypeDesc caller, NamingContext namingContext) { if (Callback != null) { if (Callback.TargetInstance == null && Parser._handlerObject != null) _currentCallback = new PhpCallback(Parser._handlerObject, Callback.RoutineName); else _currentCallback = Callback; Bound = _currentCallback.Bind(true, caller, namingContext); } else { Bound = false; } }
/// <summary> /// CargoHostInterface. This is the constructor for this /// class. It publishes XI and SNM objects for CargoHost to receive notifications /// /// Arguments: /// /// /// /// none /// Exceptions: /// none /// Return: /// none /// </summary> public CargoHostInterface() { try { // register the channel m_Channel = new IiopChannel(0); // assign port automatically ChannelServices.RegisterChannel(m_Channel, false); CorbaInit m_Init = CorbaInit.GetInit(); string CORBA_NS_Host = (string)ConfigurationManager.AppSettings["host"]; Int32 CORBA_NS_Port = Int32.Parse(ConfigurationManager.AppSettings["port"]); m_NameService = m_Init.GetNameService(CORBA_NS_Host, (int)CORBA_NS_Port); xrayInterface = new XI_Impl(); NameComponent[] ncXI = GetNameComponent(xrayInterface, "xi"); } catch (Exception e) { MessageBox.Show(e.StackTrace); return; } // Get Logger from CargoHost try { m_CargoHostLogger = (l3.cargo.corba.Logger)m_NameService.resolve(m_ncLogger); } catch (CargoException e1) { MessageBox.Show(e1.error_msg); } catch ( omg.org.CORBA.AbstractCORBASystemException a) { MessageBox.Show(a.Message); } }
public void RemoveFrame() { Top -= ArgCount; TypesTop -= TypeArgCount; ArgCount = 0; TypeArgCount = 0; Callback = false; Variables = null; NamingContext = null; //LateStaticBindType = null; }
internal void RestoreCallState(CallState old) { TypeArgCount = old.TypeCount; ArgCount = old.ArgCount; Callback = old.Callback; CalleeName = old.CalleeName; Variables = old.Variables; NamingContext = old.NamingContext; AllowProtectedCall = old.AllowProtectedCall; LateStaticBindType = old.LateStaticBindType; }
public CallState(int argCount, int typeCount, Dictionary<string, object> variables, NamingContext namingContext, string calleeName, bool callback, bool allowProtectedCall, DTypeDesc lateStaticBindType) { this.ArgCount = argCount; this.TypeCount = typeCount; this.Variables = variables; this.NamingContext = namingContext; this.CalleeName = calleeName; this.Callback = callback; this.AllowProtectedCall = allowProtectedCall; this.LateStaticBindType = lateStaticBindType; }
public static bool Register(NamingContext namingContext, DTypeDesc caller) { return Register(namingContext, caller, new PhpCallback(SplAutoloadFunction), true, false); }
public TransientCompilationUnit(string/*!*/ sourceCode, PhpSourceFile/*!*/ sourceFile, Encoding/*!*/ encoding, NamingContext namingContext, int line, int column, bool client) { Debug.Assert(sourceCode != null && sourceFile != null && encoding != null); Debug.Assert(!client); this.sourceUnit = new SourceCodeUnit(this, sourceCode, sourceFile, encoding, line, column); this.sourceUnit.AddImportedNamespaces(namingContext); }
public void RebindToNameService() { try { if (/*exists (avoid first try exceptions)?*/ _nameService != null) _nameService.rebind(_ncXi, new XiManagerCallback()); } catch { _nameService = null; #if false // HACK! ChannelServices.UnregisterChannel hangs. ChannelServices.UnregisterChannel(_iiopChannel); #endif throw; } finally { _nameService = null; _iiopChannel = null; } }
public bool Parse(DTypeDesc caller, NamingContext context, string input, bool isFinal) { // the problem is when isFinal == false // XmlReader (more precisely XmlTextReaderImpl) synchronously waits for data from underlying stream when Read is called // and there is no way to tell whether we have sufficient amount of data for the next Read call // and if underlying stream ends prematurely, reader will get into Error state (so these simple workarounds are not possible) // current solution caches the data until isFinal == true and then performs the parsing // this is not memory efficient (usually this method gets called in a cycle on small chunks to save memory) // other way would be to let the reader wait on another thread (in thread pool), which would not be that bad // since XmlParser gets freed eventually // theoretically the best way would be to implement XmlReader, that would be able to recognize whether there is enough // data, but we have not further analyzed this possibility since it seems to result in unappropriate amount of work // yet another possible way is to use parser for inner element, and let it come into error state (not tested or thought through) // this does not work since inner parser can only be created when the parser reads an element (not in the beginning) if (isFinal) { if (input == null) input = string.Empty; StringBuilder sb = new StringBuilder(input.Length); if (_inputQueue != null) { foreach (string s in _inputQueue) sb.Append(s); _inputQueue = null; } sb.Append(input); return ParseInternal(caller, context, sb.ToString(), null, null); } else { //just reset these values - we are still in the beginning _lastLineNumber = 0; _lastColumnNumber = 0; _lastLineNumber = 0; if (!string.IsNullOrEmpty(input)) { if (_inputQueue == null) _inputQueue = new Queue<string>(); _inputQueue.Enqueue(input); } return true; } }
public int MakeArgsAware(int encodedFormalCount) { int param_count = encodedFormalCount & 0xffff; PeekAllValues(param_count); int encoded_args_count = TypeArgCount << 16 | ArgCount; // store encoded formal param count on the top of the items stack: if (Top + 1 > Items.Length) ResizeItems(Top + 1); Items[Top++] = encoded_args_count; ArgCount = 0; TypeArgCount = 0; Callback = false; Variables = null; NamingContext = null; return encoded_args_count; }
public static bool Register(NamingContext namingContext, DTypeDesc caller, PhpCallback autoloadFunction, bool throwError) { return Register(namingContext, caller, autoloadFunction, throwError, false); }
protected CannotProceed(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { this.cxt = (NamingContext)info.GetValue("context", typeof(NamingContext)); this.rest_of_name = (NameComponent[])info.GetValue("rest_of_name", typeof(NameComponent[])); }
/// <summary> /// Converts a class name or class instance to <see cref="DTypeDesc"/> object. /// </summary> /// <param name="scriptContext">Current <see cref="ScriptContext"/>.</param> /// <param name="namingContext">Current <see cref="NamingContext"/>.</param> /// <param name="caller">The caller of the method to resolve visible properties properly. Can be UnknownTypeDesc.</param> /// <param name="classNameOrObject">The class name or class instance (<see cref="DObject"/>).</param> /// <param name="useAutoload"><B>True</B> iff the <c>__autoload</c> magic function should be used.</param> /// <returns>The type desc that corresponds to <paramref name="classNameOrObject"/> or <B>null</B> /// if the type could not be found or <paramref name="classNameOrObject"/> is neither a string /// nor <see cref="DObject"/>.</returns> internal static DTypeDesc ClassNameOrObjectToType(ScriptContext/*!*/ scriptContext, NamingContext namingContext, DTypeDesc caller, object classNameOrObject, bool useAutoload) { string class_name = PhpVariable.AsString(classNameOrObject); if (class_name != null) { // lookup the Type return scriptContext.ResolveType(class_name, namingContext, caller, null, (useAutoload ? ResolveTypeFlags.UseAutoload : ResolveTypeFlags.None)); } else { DObject obj = classNameOrObject as DObject; if (obj != null) return obj.TypeDesc; } return null; }
public static object New(DTypeDesc type, DTypeDesc caller, ScriptContext context, NamingContext nameContext) { // error has been thrown by Convert.ObjectToTypeDesc or MakeGenericTypeInstantiation if (type == null) { context.Stack.RemoveFrame(); return null; } // interfaces and abstract classes cannot be instantiated if (type.IsAbstract) { context.Stack.RemoveFrame(); PhpException.CannotInstantiateType(type.MakeFullName(), type.IsInterface); return null; } return type.New(context.Stack, caller, nameContext); }
public void bind_context([IdlSequenceAttribute(0L)] NameComponent[] nameComponents, NamingContext nameCtx) { throw new NO_IMPLEMENT(0, omg.org.CORBA.CompletionStatus.Completed_MayBe); }
/// <summary> /// Gets type mask representing given type name. /// </summary> public static TypeRefMask GetTypeMask(TypeRefContext/*!*/typeCtx, string[] tnames, NamingContext naming, bool fullyQualified = false) { TypeRefMask result = 0; foreach (var tname in tnames) result |= GetTypeMask(typeCtx, tname, naming, fullyQualified); return result; }
/// <summary> /// Gets type mask at target type context representing given type names from given routine. /// </summary> public static TypeRefMask GetTypeMask(TypeRefContext/*!*/targetCtx, TypeRefContext/*!*/ctx, string[] tnames, NamingContext naming, bool fullyQualified = false) { Contract.ThrowIfNull(targetCtx); Contract.ThrowIfNull(ctx); var mask = GetTypeMask(ctx, tnames, naming, fullyQualified); return targetCtx.AddToContext(ctx, mask); }
private bool ParseInternal(DTypeDesc caller, NamingContext context, string xml, PhpArray values, PhpArray indices) { StringReader stringReader = new StringReader(xml); XmlTextReader reader = new XmlTextReader(stringReader); Stack<ElementRecord> elementStack = new Stack<ElementRecord>(); TextRecord textChunk = null; _startElementHandler.BindOrBiteMyLegsOff(caller, context); _endElementHandler.BindOrBiteMyLegsOff(caller, context); _defaultHandler.BindOrBiteMyLegsOff(caller, context); _startNamespaceDeclHandler.BindOrBiteMyLegsOff(caller, context); _endNamespaceDeclHandler.BindOrBiteMyLegsOff(caller, context); _characterDataHandler.BindOrBiteMyLegsOff(caller, context); _processingInstructionHandler.BindOrBiteMyLegsOff(caller, context); while (reader.ReadState == ReadState.Initial || reader.ReadState == ReadState.Interactive) { try { reader.Read(); } catch (XmlException) { _lastLineNumber = reader.LineNumber; _lastColumnNumber = reader.LinePosition; _lastByteIndex = -1; _errorCode = (int)XmlParserError.XML_ERROR_GENERIC; return false; } //these are usually required _lastLineNumber = reader.LineNumber; _lastColumnNumber = reader.LinePosition; // we cannot do this - we could if we had underlying stream, but that would require // encoding string -> byte[] which is pointless switch (reader.ReadState) { case ReadState.Error: //report error break; case ReadState.EndOfFile: //end of file break; case ReadState.Closed: case ReadState.Initial: //nonsense Debug.Fail(); break; case ReadState.Interactive: //debug step, that prints out the current state of the parser (pretty printed) //Debug_ParseStep(reader); ParseStep(reader, elementStack, ref textChunk, values, indices); break; } if (reader.ReadState == ReadState.Error || reader.ReadState == ReadState.EndOfFile || reader.ReadState == ReadState.Closed) break; } return true; }
public bool ParseIntoStruct(DTypeDesc caller, NamingContext context, string input, PhpArray values, PhpArray indices) { return ParseInternal(caller, context, input, values, indices); }
public HostComm() { String caseManagerIP = (string)ConfigurationManager.AppSettings["host"]; Int32 caseManagerPort = Int32.Parse(ConfigurationManager.AppSettings["port"]); //connected with host manager m_Channel = new IiopChannel(0); ChannelServices.RegisterChannel(m_Channel, false); CorbaInit m_Init = CorbaInit.GetInit(); m_NameService = m_Init.GetNameService(caseManagerIP, (int)caseManagerPort); HostConnThread = new Thread(new ThreadStart(HostConnState)); }