/// <summary> /// Get a dictionary with all the system record types provided by Interface Booster. /// </summary> /// <returns></returns> public static IDictionary <SyneryType, IRecordType> GetSystemRecordTypes() { IDictionary <SyneryType, IRecordType> listOfRecordTypes = new Dictionary <SyneryType, IRecordType>(); // get the signatures of the default system record types listOfRecordTypes.Add(GetRecordTypeSignature(EventRecord.GetRecordType())); listOfRecordTypes.Add(GetRecordTypeSignature(ExceptionRecord.GetRecordType())); listOfRecordTypes.Add(GetRecordTypeSignature(ExecutionExceptionRecord.GetRecordType())); listOfRecordTypes.Add(GetRecordTypeSignature(LibraryPluginExceptionRecord.GetRecordType())); listOfRecordTypes.Add(GetRecordTypeSignature(ProviderPluginConnectionExceptionRecord.GetRecordType())); listOfRecordTypes.Add(GetRecordTypeSignature(ProviderPluginDataExchangeExceptionRecord.GetRecordType())); return(listOfRecordTypes); }
public void Run(SyneryParser.ProviderPluginStatementContext context) { ProviderPluginTask task; if (context.providerPluginConnectStatement() != null) { // interpret the statement and get the task for the ProviderPluginManager task = Controller.Interpret <SyneryParser.ProviderPluginConnectStatementContext, ProviderPluginConnectTask>( context.providerPluginConnectStatement()); } else if (context.providerPluginDataExchangeStatement() != null) { // interpret the statement and get the task for the ProviderPluginManager ProviderPluginDataExchangeTask dataExchangeTask = Controller. Interpret <SyneryParser.ProviderPluginDataExchangeStatementContext, ProviderPluginDataExchangeTask>( context.providerPluginDataExchangeStatement()); task = dataExchangeTask; } else { throw new SyneryInterpretationException(context, "Unknown statement in ProviderPluginStatementInterpreter. No interpreter found for the given context."); } // append the current state of the SyneryMemory to the task task.Memory = Memory; try { // execute the task Memory.ProviderPluginManager.RunTask(task); } catch (Exception ex) { // handle exception according to the task type ProviderPluginConnectTask connectTask = task as ProviderPluginConnectTask; ProviderPluginDataExchangeTask dataTask = task as ProviderPluginDataExchangeTask; // create a Synery exception that can be caught by the Synery developer if (connectTask != null) { ProviderPluginConnectionExceptionRecord syneryException = new ProviderPluginConnectionExceptionRecord(); syneryException.Message = ExceptionHelper.GetNestedExceptionMessages(ex); syneryException.ConnectionPath = connectTask.SyneryConnectionPath; syneryException.PluginInstanceReferenceIdentifier = connectTask.InstanceReferenceSyneryIdentifier; Controller.HandleSyneryEvent(context, syneryException.GetAsSyneryValue()); } else if (dataTask != null) { ProviderPluginDataExchangeExceptionRecord syneryException = new ProviderPluginDataExchangeExceptionRecord(); syneryException.Message = ExceptionHelper.GetNestedExceptionMessages(ex); syneryException.DataCommandType = dataTask.Type.ToString().ToUpper(); syneryException.FullPath = dataTask.FullSyneryPath; Controller.HandleSyneryEvent(context, syneryException.GetAsSyneryValue()); } } }