public ProblemGatherer(BehaviorGraph graph, IViewProblemStoreCache cache, ITemplateRegistry<ITemplate> sparkTemplates, IParsingRegistrations<ITemplate> parsings) { _graph = graph; _cache = cache; _sparkTemplates = sparkTemplates; _parsings = parsings; }
public Context(ITemplateRegistry templateRegistry) { _dictionaries[DictionaryFields.Global] = _globalDictionary; _dictionaries[DictionaryFields.Template] = _templateDictionary; _dictionaries[DictionaryFields.Type] = _applicationTypeDictionary; _templateRegistry = templateRegistry ?? new BasicTemplateRegistry(); }
protected override void beforeEach() { const string viewPath = "/_Package1_/Handlers/Models/SerieSL.spark"; var appRoot = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates"); var packageRoot = Path.Combine(appRoot, "App", "fubu-packages", "Package1", "WebContent"); var binding1 = new Template(Path.Combine(packageRoot, "Handlers", "Shared", "bindings.xml"), packageRoot, "Package1"); var binding2 = new Template(Path.Combine(appRoot, "Shared", "bindings.xml"), appRoot, FubuSparkConstants.HostOrigin); var viewPathPolicy = new ViewPathPolicy(); viewPathPolicy.Apply(binding1); viewPathPolicy.Apply(binding2); _viewFolder = MockFor <IViewFolder>(); _viewFolder.Expect(x => x.GetViewSource(binding1.ViewPath)).Return(new FileSystemViewFile(binding1.FilePath)); _viewFolder.Expect(x => x.GetViewSource(binding2.ViewPath)).Return(new FileSystemViewFile(binding2.FilePath)); _request = new BindingRequest(_viewFolder) { ViewPath = viewPath }; _templateRegistry = MockFor <ITemplateRegistry>(); _templateRegistry.Expect(x => x.BindingsForView(viewPath)).Return(new[] { binding1, binding2 }); }
private IEnumerable<string> getDirectories(ITemplate template, ITemplateRegistry templateRegistry, bool includeDirectAncestor) { foreach (var directory in _builder.BuildBy(template.FilePath, template.RootPath, includeDirectAncestor)) { yield return directory; } if (template.FromHost()) { yield break; } var hostTemplate = templateRegistry.FromHost().FirstOrDefault(); if (hostTemplate == null) { yield break; } var hostRoot = hostTemplate.RootPath; if (includeDirectAncestor) { yield return hostRoot; } foreach (var sharedFolder in _builder.SharedFolderNames) { yield return Path.Combine(hostRoot, sharedFolder); } }
public Session(IConnection connection, ISessionProtocol protocol, ITemplateRegistry inboundRegistry, ITemplateRegistry outboundRegistry) { var inContext = new Context(); inContext.TemplateRegistry.RegisterAll(inboundRegistry); var outContext = new Context(); outContext.TemplateRegistry.RegisterAll(outboundRegistry); inContext.ErrorHandler = this; _connection = connection; _protocol = protocol; try { _inStream = new MessageInputStream(connection.InputStream.BaseStream, inContext); _outStream = new MessageOutputStream(connection.OutputStream.BaseStream, outContext); } catch (IOException e) { _errorHandler.OnError(e, DynError.Undefined, "Error occurred in connection."); throw new IllegalStateException(e); } protocol.ConfigureSession(this); }
private IEnumerable <string> getDirectories(ITemplate template, ITemplateRegistry templateRegistry, bool includeDirectAncestor) { foreach (var directory in _builder.BuildBy(template.FilePath, template.RootPath, includeDirectAncestor)) { yield return(directory); } if (template.FromHost()) { yield break; } var hostTemplate = templateRegistry.FromHost().FirstOrDefault(); if (hostTemplate == null) { yield break; } var hostRoot = hostTemplate.RootPath; if (includeDirectAncestor) { yield return(hostRoot); } foreach (var sharedFolder in _builder.SharedFolderNames) { yield return(Path.Combine(hostRoot, sharedFolder)); } }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns")); bool optional = fieldDef.GetBool("Optional"); GroupValue exponentDef = fieldDef.GetGroup("Exponent"); GroupValue exponentOperatorDef = exponentDef.GetGroup("Operator").GetGroup(0); Operator exponentOperator = GetOperator(exponentOperatorDef.Group); ScalarValue exponentDefaultValue = ScalarValue.Undefined; if (exponentDef.IsDefined("InitialValue")) exponentDefaultValue = new IntegerValue(exponentDef.GetInt("InitialValue")); GroupValue mantissaDef = fieldDef.GetGroup("Mantissa"); GroupValue mantissaOperatorDef = mantissaDef.GetGroup("Operator").GetGroup(0); Operator mantissaOperator = GetOperator(mantissaOperatorDef.Group); ScalarValue mantissaDefaultValue = ScalarValue.Undefined; if (mantissaDef.IsDefined("InitialValue")) mantissaDefaultValue = new LongValue(mantissaDef.GetInt("InitialValue")); ComposedScalar composedDecimal = Util.ComposedDecimal(name, exponentOperator, exponentDefaultValue, mantissaOperator, mantissaDefaultValue, optional); IFieldValue retAuxId; if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId!=null) { composedDecimal.Id = retAuxId.ToString(); } return composedDecimal; }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns")); bool optional = fieldDef.GetBool("Optional"); GroupValue exponentDef = fieldDef.GetGroup("Exponent"); GroupValue exponentOperatorDef = exponentDef.GetGroup("Operator").GetGroup(0); Operator exponentOperator = GetOperator(exponentOperatorDef.Group); ScalarValue exponentDefaultValue = ScalarValue.Undefined; if (exponentDef.IsDefined("InitialValue")) { exponentDefaultValue = new IntegerValue(exponentDef.GetInt("InitialValue")); } GroupValue mantissaDef = fieldDef.GetGroup("Mantissa"); GroupValue mantissaOperatorDef = mantissaDef.GetGroup("Operator").GetGroup(0); Operator mantissaOperator = GetOperator(mantissaOperatorDef.Group); ScalarValue mantissaDefaultValue = ScalarValue.Undefined; if (mantissaDef.IsDefined("InitialValue")) { mantissaDefaultValue = new LongValue(mantissaDef.GetInt("InitialValue")); } ComposedScalar composedDecimal = Util.ComposedDecimal(name, exponentOperator, exponentDefaultValue, mantissaOperator, mantissaDefaultValue, optional); IFieldValue retAuxId; if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null) { composedDecimal.Id = retAuxId.ToString(); } return(composedDecimal); }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { var scalar = (Scalar) base.Convert(fieldDef, templateRegistry, context); IFieldValue retLength; if (fieldDef.TryGetValue("Length", out retLength) && retLength != null) scalar.AddAttribute(FastConstants.LengthField, ((GroupValue) retLength).GetString("Name")); return scalar; }
private IEnumerable<ITemplate> locateTemplates(string name, ITemplate fromTemplate, ITemplateRegistry templateRegistry, bool sharedsOnly) { var directories = sharedsOnly ? _provider.SharedPathsOf(fromTemplate, templateRegistry) : _provider.ReachablesOf(fromTemplate, templateRegistry); return templateRegistry.ByNameUnderDirectories(name, directories); }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns")); MessageTemplate template; if (templateRegistry.TryGetTemplate(name, out template)) return new StaticTemplateReference(template); throw new ArgumentOutOfRangeException("fieldDef", name, "Referenced template name not defined."); }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { var scalar = (Scalar)base.Convert(fieldDef, templateRegistry, context); IFieldValue retLength; if (fieldDef.TryGetValue("Length", out retLength) && retLength != null) { scalar.AddAttribute(FastConstants.LengthField, ((GroupValue)retLength).GetString("Name")); } return(scalar); }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns")); MessageTemplate template; if (templateRegistry.TryGetTemplate(name, out template)) { return(new StaticTemplateReference(template)); } throw new ArgumentOutOfRangeException("fieldDef", name, "Referenced template name not defined."); }
public void Compose(ITemplateRegistry templates) { templates.AllTemplates().Each(t => { var bindRequest = createBindRequest(t, templates); var binders = _binders.Where(x => x.CanBind(bindRequest)); var policies = _policies.Where(x => x.Matches(t)); binders.Each(binder => binder.Bind(bindRequest)); policies.Each(policy => policy.Apply(t)); }); }
public override Session Connect(string senderName, IConnection connection, ITemplateRegistry inboundRegistry, ITemplateRegistry outboundRegistry, IMessageListener messageListener, ISessionListener sessionListener) { var session = new Session(connection, this, TemplateRegistryFields.Null, TemplateRegistryFields.Null); session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName)); Message message = session.MessageInputStream.ReadMessage(); string serverName = message.GetString(1); session.Client = new BasicClient(serverName, "unknown"); return(session); }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { string name = fieldDef.GetString("Name"); string ns = fieldDef.GetString("Ns"); var qname = new QName(name, ns); Field[] fields = GroupConverter.ParseFieldInstructions(fieldDef, templateRegistry, context); bool optional = fieldDef.GetBool("Optional"); Scalar length = null; IFieldValue retLength; if (fieldDef.TryGetValue("Length", out retLength) && retLength!=null) { GroupValue lengthDef = (GroupValue)retLength; QName lengthName; string id = null; IFieldValue retName; if (lengthDef.TryGetValue("Name", out retName) && retName != null) { GroupValue nameDef = (GroupValue)retName; lengthName = new QName(nameDef.GetString("Name"), nameDef.GetString("Ns")); IFieldValue retAuxId; if (nameDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null) id = retAuxId.ToString(); } else lengthName = Global.CreateImplicitName(qname); Operator op = Operator.None; IFieldValue retOperator; if (lengthDef.TryGetValue("Operator", out retOperator) && retOperator != null) op = GetOperator(((GroupValue)retOperator).GetGroup(0).Group); ScalarValue initialValue = ScalarValue.Undefined; IFieldValue retInitialValue; if (lengthDef.TryGetValue("InitialValue", out retInitialValue) && retInitialValue != null) initialValue = (ScalarValue) retInitialValue; length = new Scalar(lengthName, FastType.U32, op, initialValue, optional) {Id = id}; } var sequence = new Sequence(qname, length, fields, optional); IFieldValue retTypeRef; if (fieldDef.TryGetValue("TypeRef", out retTypeRef) && retTypeRef != null) { GroupValue typeRef = (GroupValue)retTypeRef; string typeRefName = typeRef.GetString("Name"); string typeRefNs = ""; // context.getNamespace(); IFieldValue rettypeRefNs; if (typeRef.TryGetValue("Ns", out rettypeRefNs) && rettypeRefNs!=null) typeRefNs = rettypeRefNs.ToString(); sequence.TypeReference = new QName(typeRefName, typeRefNs); } return sequence; }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { FastType type = _templateTypeMap[fieldDef.Group]; bool optional = fieldDef.GetBool("Optional"); IFieldValue retInitialValue; ScalarValue initialValue = fieldDef.TryGetValue("InitialValue", out retInitialValue) && retInitialValue != null ? (ScalarValue)retInitialValue : ScalarValue.Undefined; string name = fieldDef.GetString("Name"); IFieldValue rettempNs; string tempNs = fieldDef.TryGetValue("Ns", out rettempNs) && rettempNs != null?rettempNs.ToString() : ""; var qname = new QName(name, tempNs); Scalar scalar; IFieldValue retOperator; if (fieldDef.TryGetValue("Operator", out retOperator) && retOperator != null) { GroupValue operatorGroup = ((GroupValue)retOperator).GetGroup(0); Operator operatortemp = GetOperator(operatorGroup.Group); scalar = new Scalar(qname, type, operatortemp, initialValue, optional); IFieldValue retDictionary; if (operatorGroup.TryGetValue("Dictionary", out retDictionary) && retDictionary != null) { scalar.Dictionary = retDictionary.ToString(); } IFieldValue retKey; if (operatorGroup.TryGetValue("Key", out retKey) && retKey != null) { GroupValue retOperatorGroup = (GroupValue)retKey; string keyName = retOperatorGroup.GetString("Name"); string ns = retOperatorGroup.GetString("Ns"); scalar.Key = new QName(keyName, ns); } } else { scalar = new Scalar(qname, type, Operator.None, initialValue, optional); } IFieldValue retAuxId; if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null) { scalar.Id = retAuxId.ToString(); } return(scalar); }
private BindRequest createBindRequest(ITemplate template, ITemplateRegistry templateRegistry) { var chunks = _chunkLoader.Load(template); return(new BindRequest { Target = template, Types = _types, TemplateRegistry = templateRegistry, Master = chunks.Master(), ViewModelType = chunks.ViewModel(), Namespaces = chunks.Namespaces(), Logger = SparkLogger.Default() }); }
public override void RegisterAll(ITemplateRegistry registry) { if (registry == null) { return; } MessageTemplate[] templatesp = registry.Templates; if (templatesp != null) { foreach (MessageTemplate t in templatesp) { Add(registry.GetId(t), t); } } }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { FastType type = _templateTypeMap[fieldDef.Group]; bool optional = fieldDef.GetBool("Optional"); IFieldValue retInitialValue; ScalarValue initialValue = fieldDef.TryGetValue("InitialValue",out retInitialValue) && retInitialValue!=null ? (ScalarValue)retInitialValue : ScalarValue.Undefined; string name = fieldDef.GetString("Name"); IFieldValue rettempNs; string tempNs = fieldDef.TryGetValue("Ns", out rettempNs) && rettempNs != null ? rettempNs.ToString() : ""; var qname = new QName(name, tempNs); Scalar scalar; IFieldValue retOperator; if (fieldDef.TryGetValue("Operator", out retOperator) && retOperator!=null) { GroupValue operatorGroup = ((GroupValue)retOperator).GetGroup(0); Operator operatortemp = GetOperator(operatorGroup.Group); scalar = new Scalar(qname, type, operatortemp, initialValue, optional); IFieldValue retDictionary; if (operatorGroup.TryGetValue("Dictionary", out retDictionary) && retDictionary != null) scalar.Dictionary = retDictionary.ToString(); IFieldValue retKey; if (operatorGroup.TryGetValue("Key", out retKey) && retKey != null) { GroupValue retOperatorGroup = (GroupValue) retKey; string keyName = retOperatorGroup.GetString("Name"); string ns = retOperatorGroup.GetString("Ns"); scalar.Key = new QName(keyName, ns); } } else { scalar = new Scalar(qname, type, Operator.None, initialValue, optional); } IFieldValue retAuxId; if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId!=null) { scalar.Id = retAuxId.ToString(); } return scalar; }
protected override void beforeEach() { _template1 = new Template("tmpl1.spark", "x", "o1"); _template2 = new Template("tmpl2.spark", "z", "o2"); _templateRegistry = new TemplateRegistry <ITemplate>(new[] { _template1, _template2 }); var parsingRegistrations = MockFor <IParsingRegistrations <ITemplate> >(); parsingRegistrations.Stub(x => x.ParsingFor(Arg <Template> .Is.Anything)).Return(new Parsing()); Services.Inject(_types); configurePolicies(); configureBinders(); registerBindersAndPolicies(); OtherTemplateBinder.Reset(); OtherTemplatePolicy.Reset(); }
public void Compose(ITemplateRegistry templates) { templates.AllTemplates().Each(t => { var bindRequest = new BindRequest { Target = t, Parsing = _parsings.ParsingFor(t), Types = _types, TemplateRegistry = templates, Logger = SparkLogger.Default() }; var binders = _binders.Where(x => x.CanBind(bindRequest)); var policies = _policies.Where(x => x.Matches(t)); binders.Each(binder => binder.Bind(bindRequest)); policies.Each(policy => policy.Apply(t)); }); }
static SessionControlProtocol11() { FastResetTemplate.AddAttribute(ResetProperty, "yes"); TemplateRegistry = new BasicTemplateRegistry { { HelloTemplateId, HelloTemplate }, { AlertTemplateId, AlertTemplate }, { ResetTemplateId, FastResetTemplate }, { TemplateDeclId, TemplateDeclaration }, { TemplateDefId, TemplateDefinition }, { Int32InstrId, Int32Instr }, { Uint32InstrId, Uint32Instr }, { Int64InstrId, Int64Instr }, { Uint64InstrId, Uint64Instr }, { DecimalInstrId, DecimalInstr }, { CompDecimalInstrId, CompDecimalInstr }, { AsciiInstrId, AsciiInstr }, { UnicodeInstrId, UnicodeInstr }, { ByteVectorInstrId, ByteVectorInstr }, { StatTempRefInstrId, StatTempRefInstr }, { DynTempRefInstrId, DynTempRefInstr }, { SequenceInstrId, SequenceInstr }, { GroupInstrId, GroupInstr }, { ConstantOpId, ConstantOp }, { DefaultOpId, DefaultOp }, { CopyOpId, CopyOp }, { IncrementOpId, IncrementOp }, { DeltaOpId, DeltaOp }, { TailOpId, TailOp }, { ForeignInstrId, ForeignInstr }, { ElementId, Element }, { TextId, Text } }; // TODO: move this into a unit test foreach (MessageTemplate t in TemplateRegistry.Templates) { VerifyChildNamespaces(t); } }
public static Field[] ParseFieldInstructions(GroupValue groupDef, ITemplateRegistry registry, ConversionContext context) { SequenceValue instructions = groupDef.GetSequence("Instructions"); var fields = new Field[instructions.Length]; for (int i = 0; i < fields.Length; i++) { GroupValue fieldDef = instructions[i].GetGroup(0); IFieldInstructionConverter converter = context.GetConverter(fieldDef.Group); if (converter == null) { throw new SystemException( string.Format("Encountered unknown group {0} while processing field instructions {1}", fieldDef.Group, groupDef.Group)); } fields[i] = converter.Convert(fieldDef, registry, context); } return(fields); }
protected override void beforeEach() { _template1 = new Template("tmpl1.spark", "x", "o1"); _template2 = new Template("tmpl2.spark", "z", "o2"); _templateRegistry = new TemplateRegistry { _template1, _template2 }; var chunkLoader = MockFor <IChunkLoader>(); chunkLoader.Stub(x => x.Load(Arg <Template> .Is.Anything)).Return(Enumerable.Empty <Chunk>()); Services.Inject(_types); configurePolicies(); configureBinders(); registerBindersAndPolicies(); OtherTemplateBinder.Reset(); OtherTemplatePolicy.Reset(); }
public override Session Connect(string senderName, IConnection connection, ITemplateRegistry inboundRegistry, ITemplateRegistry outboundRegistry, IMessageListener messageListener, ISessionListener sessionListener) { var session = new Session(connection, this, TemplateRegistryFields.Null, TemplateRegistryFields.Null); session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName)); try { Thread.Sleep(new TimeSpan((Int64)10000 * 20)); } catch (ThreadInterruptedException) { } Message message = session.MessageInputStream.ReadMessage(); string serverName = message.GetString(1); string vendorId = message.IsDefined(2) ? message.GetString(2) : "unknown"; session.Client = new BasicClient(serverName, vendorId); return(session); }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { string name = fieldDef.GetString("Name"); string namespacetemp = ""; IFieldValue retns; if (fieldDef.TryGetValue("Ns", out retns) && retns != null) { namespacetemp = retns.ToString(); } Field[] fields = ParseFieldInstructions(fieldDef, templateRegistry, context); bool optional = fieldDef.GetBool("Optional"); var group = new Group(new QName(name, namespacetemp), fields, optional); IFieldValue retTypeRef; if (fieldDef.TryGetValue("TypeRef", out retTypeRef) && retTypeRef != null) { var typeRef = (GroupValue)retTypeRef; String typeRefName = typeRef.GetString("Name"); String typeRefNs = ""; // context.getNamespace(); IFieldValue retNsTypeRef; if (typeRef.TryGetValue("Ns", out retNsTypeRef) && retNsTypeRef != null) { typeRefNs = retNsTypeRef.ToString(); } group.TypeReference = new QName(typeRefName, typeRefNs); } IFieldValue retAuxId; if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null) { group.Id = retAuxId.ToString(); } return(group); }
public void SendTemplates(ITemplateRegistry registry) { if (!_protocol.SupportsTemplateExchange) { throw new NotSupportedException("The procotol " + _protocol + " does not support template exchange."); } foreach (MessageTemplate template in registry.Templates) { _outStream.WriteMessage(_protocol.CreateTemplateDefinitionMessage(template)); int templateId = registry.GetId(template); _outStream.WriteMessage(_protocol.CreateTemplateDeclarationMessage(template, templateId)); // BUG? double check if IsRegister() done on the same object as RegisterTemplate if (!_outStream.TemplateRegistry.IsRegistered(template)) { _outStream.RegisterTemplate(templateId, template); } } }
protected override void beforeEach() { _template1 = new Template("tmpl1.cshtml", "x", "o1"); _template2 = new Template("tmpl2.cshtml", "z", "o2"); _templateRegistry = new TemplateRegistry <IRazorTemplate>(new[] { _template1, _template2 }); var viewParser = MockFor <IViewParser>(); //null here probably won't work viewParser.Stub(x => x.Parse(null)).Return(Enumerable.Empty <Span>()); Func <string, IViewParser> parser = file => viewParser; Services.Inject(parser); Services.Inject(_types); configurePolicies(); configureBinders(); registerBindersAndPolicies(); OtherTemplateBinder.Reset(); OtherTemplatePolicy.Reset(); }
public SharedTemplateLocator(ITemplateDirectoryProvider provider, ITemplateRegistry templates) { _provider = provider; _templates = templates; }
public virtual void RegisterSessionTemplates(ITemplateRegistry registry) { registry.Add(HelloTemplateId, HelloTemplate); registry.Add(AlertTemplateId, AlertTemplate); registry.Add(ResetTemplateId, FastResetTemplate); }
public RazorViewFacility(ITemplateRegistry<IRazorTemplate> templateRegistry) { _templateRegistry = templateRegistry; }
public FubuBindingProvider(ITemplateRegistry templateRegistry) { _templateRegistry = templateRegistry; }
public static Field[] ParseFieldInstructions(GroupValue groupDef, ITemplateRegistry registry, ConversionContext context) { SequenceValue instructions = groupDef.GetSequence("Instructions"); var fields = new Field[instructions.Length]; for (int i = 0; i < fields.Length; i++) { GroupValue fieldDef = instructions[i].GetGroup(0); IFieldInstructionConverter converter = context.GetConverter(fieldDef.Group); if (converter == null) throw new SystemException( string.Format("Encountered unknown group {0} while processing field instructions {1}", fieldDef.Group, groupDef.Group)); fields[i] = converter.Convert(fieldDef, registry, context); } return fields; }
public MessageInputStream(Stream inputStream, ITemplateRegistry templateRegistry) : this(inputStream, new Context(templateRegistry)) { }
public IEnumerable<ITemplate> LocateBindings(string bindingName, ITemplate fromTemplate, ITemplateRegistry templateRegistry) { return locateTemplates(bindingName, fromTemplate, templateRegistry, false) .Where(x => x.IsXml()); }
public ITemplate LocateMaster(string masterName, ITemplate fromTemplate, ITemplateRegistry templateRegistry) { return locateTemplates(masterName, fromTemplate, templateRegistry, true) .Where(x => x.IsSparkView()) .FirstOrDefault(); }
public SparkActivator(ITemplateRegistry templateRegistry, ISparkViewEngine engine) { _templateRegistry = templateRegistry; _engine = engine; }
public abstract Field Convert(GroupValue param1, ITemplateRegistry param2, ConversionContext param3);
public abstract Session Connect(string param1, IConnection param2, ITemplateRegistry inboundRegistry, ITemplateRegistry outboundRegistry, IMessageListener messageListener, ISessionListener sessionListener);
public virtual Field Convert(GroupValue groupValue, ITemplateRegistry templateRegistry, ConversionContext context) { return DynamicTemplateReference.Instance; }
private IEnumerable <ITemplate> locateTemplates(string name, ITemplate fromTemplate, ITemplateRegistry templateRegistry, bool sharedsOnly) { var directories = sharedsOnly ? _provider.SharedPathsOf(fromTemplate, templateRegistry) : _provider.ReachablesOf(fromTemplate, templateRegistry); return(templateRegistry.ByNameUnderDirectories(name, directories)); }
public SharingAttacherActivator(ITemplateRegistry <T> templates, IEnumerable <ISharingAttacher <T> > attachers) { _templates = templates; _attachers = attachers; }
public void RegisterAll(ITemplateRegistry registry) { }
public SparkActivator(ITemplateRegistry templateRegistry, ISparkViewEngine engine) { _templateRegistry = templateRegistry; _engine = engine; _logger = PackageRegistry.Diagnostics.LogFor(this); }
public TemplateDirectoryProvider(ISharedPathBuilder builder, ITemplateRegistry <T> templates, ISharingGraph graph) { _builder = builder; _templates = templates; _graph = graph; }
public void SendTemplates(ITemplateRegistry registry) { if (!_protocol.SupportsTemplateExchange) { throw new NotSupportedException("The procotol " + _protocol + " does not support template exchange."); } foreach (MessageTemplate template in registry.Templates) { _outStream.WriteMessage(_protocol.CreateTemplateDefinitionMessage(template)); int templateId = registry.GetId(template); _outStream.WriteMessage(_protocol.CreateTemplateDeclarationMessage(template, templateId)); // BUG? double check if IsRegister() done on the same object as RegisterTemplate if (!_outStream.TemplateRegistry.IsRegistered(template)) _outStream.RegisterTemplate(templateId, template); } }
public SparkViewFacility(ITemplateRegistry templateRegistry) { _templateRegistry = templateRegistry; }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { string name = fieldDef.GetString("Name"); string namespacetemp = ""; IFieldValue retns; if (fieldDef.TryGetValue("Ns", out retns) && retns != null) namespacetemp = retns.ToString(); Field[] fields = ParseFieldInstructions(fieldDef, templateRegistry, context); bool optional = fieldDef.GetBool("Optional"); var group = new Group(new QName(name, namespacetemp), fields, optional); IFieldValue retTypeRef; if (fieldDef.TryGetValue("TypeRef", out retTypeRef) && retTypeRef != null) { var typeRef = (GroupValue) retTypeRef; String typeRefName = typeRef.GetString("Name"); String typeRefNs = ""; // context.getNamespace(); IFieldValue retNsTypeRef; if (typeRef.TryGetValue("Ns", out retNsTypeRef) && retNsTypeRef != null) typeRefNs = retNsTypeRef.ToString(); group.TypeReference = new QName(typeRefName, typeRefNs); } IFieldValue retAuxId; if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null) group.Id = retAuxId.ToString(); return group; }
public virtual Field Convert(GroupValue groupValue, ITemplateRegistry templateRegistry, ConversionContext context) { return(DynamicTemplateReference.Instance); }
public override Session Connect(string senderName, IConnection connection, ITemplateRegistry inboundRegistry, ITemplateRegistry outboundRegistry, IMessageListener messageListener, ISessionListener sessionListener) { var session = new Session(connection, this, TemplateRegistryFields.Null, TemplateRegistryFields.Null); session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName)); Message message = session.MessageInputStream.ReadMessage(); string serverName = message.GetString(1); session.Client = new BasicClient(serverName, "unknown"); return session; }
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context) { string name = fieldDef.GetString("Name"); string ns = fieldDef.GetString("Ns"); var qname = new QName(name, ns); Field[] fields = GroupConverter.ParseFieldInstructions(fieldDef, templateRegistry, context); bool optional = fieldDef.GetBool("Optional"); Scalar length = null; IFieldValue retLength; if (fieldDef.TryGetValue("Length", out retLength) && retLength != null) { GroupValue lengthDef = (GroupValue)retLength; QName lengthName; string id = null; IFieldValue retName; if (lengthDef.TryGetValue("Name", out retName) && retName != null) { GroupValue nameDef = (GroupValue)retName; lengthName = new QName(nameDef.GetString("Name"), nameDef.GetString("Ns")); IFieldValue retAuxId; if (nameDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null) { id = retAuxId.ToString(); } } else { lengthName = Global.CreateImplicitName(qname); } Operator op = Operator.None; IFieldValue retOperator; if (lengthDef.TryGetValue("Operator", out retOperator) && retOperator != null) { op = GetOperator(((GroupValue)retOperator).GetGroup(0).Group); } ScalarValue initialValue = ScalarValue.Undefined; IFieldValue retInitialValue; if (lengthDef.TryGetValue("InitialValue", out retInitialValue) && retInitialValue != null) { initialValue = (ScalarValue)retInitialValue; } length = new Scalar(lengthName, FastType.U32, op, initialValue, optional) { Id = id }; } var sequence = new Sequence(qname, length, fields, optional); IFieldValue retTypeRef; if (fieldDef.TryGetValue("TypeRef", out retTypeRef) && retTypeRef != null) { GroupValue typeRef = (GroupValue)retTypeRef; string typeRefName = typeRef.GetString("Name"); string typeRefNs = ""; // context.getNamespace(); IFieldValue rettypeRefNs; if (typeRef.TryGetValue("Ns", out rettypeRefNs) && rettypeRefNs != null) { typeRefNs = rettypeRefNs.ToString(); } sequence.TypeReference = new QName(typeRefName, typeRefNs); } return(sequence); }
public IEnumerable<string> SharedPathsOf(ITemplate template, ITemplateRegistry templateRegistry) { return getDirectories(template, templateRegistry, false); }
public SharedTemplateLocator(ITemplateDirectoryProvider <T> provider, ITemplateRegistry <T> templates, ITemplateSelector <T> templateSelector) { _provider = provider; _templates = templates; _templateSelector = templateSelector; }
public IEnumerable<string> ReachablesOf(ITemplate template, ITemplateRegistry templateRegistry) { return getDirectories(template, templateRegistry, true); }