private FluentBuilder( FluentBuilder parent, Func <Type, object> factory, IPackage packageContext, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory, IDataSupplierFactory dataSupplierFactory) { _nameManager = parent._nameManager; _assemblies = parent._assemblies; _types = parent._types; _packageContext = packageContext; _dataCatalog = dataCatalog; _dataDependencyFactory = dataDependencyFactory; _dataSupplierFactory = dataSupplierFactory; _factory = factory; ModuleBuilder = parent.ModuleBuilder; PageBuilder = parent.PageBuilder; LayoutBuilder = parent.LayoutBuilder; RegionBuilder = parent.RegionBuilder; ComponentBuilder = parent.ComponentBuilder; ServiceBuilder = parent.ServiceBuilder; PackageBuilder = parent.PackageBuilder; DataProviderBuilder = parent.DataProviderBuilder; }
public void Setup() { Reset(); _dataProviderDependenciesFactory = SetupMock <IDataProviderDependenciesFactory>(); _nameManager = SetupMock <INameManager>(); _dataCatalog = SetupMock <IDataCatalog>(); _dataSupplierFactory = SetupMock <IDataSupplierFactory>(); _dataDependencyFactory = SetupMock <IDataDependencyFactory>(); _requestRouter = SetupMock <IRequestRouter>(); _frameworkConfiguration = SetupMock <IFrameworkConfiguration>(); _elementConfiguror = new ElementConfiguror( _dataSupplierFactory, _dataDependencyFactory, _nameManager, _requestRouter); _fluentBuilder = new FluentBuilder( _nameManager, _dataCatalog, _dataProviderDependenciesFactory.DataDependencyFactory, _dataProviderDependenciesFactory.DataSupplierFactory, _frameworkConfiguration); _fluentBuilder.DataProviderBuilder = new DataProviderBuilder( _dataProviderDependenciesFactory, _elementConfiguror, _nameManager, _fluentBuilder); }
public PageDependenciesFactory( IRenderContextFactory renderContextFactory, IIdManager idManager, IAssetManager assetManager, INameManager nameManager, ICssWriterFactory cssWriterFactory, IJavascriptWriterFactory javascriptWriterFactory, IDataScopeProviderFactory dataScopeProviderFactory, IDataConsumerFactory dataConsumerFactory, IDictionaryFactory dictionaryFactory, IDataContextBuilderFactory dataContextBuilderFactory, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory) { _renderContextFactory = renderContextFactory; _idManager = idManager; _assetManager = assetManager; _nameManager = nameManager; _cssWriterFactory = cssWriterFactory; _javascriptWriterFactory = javascriptWriterFactory; _dataScopeProviderFactory = dataScopeProviderFactory; _dataConsumerFactory = dataConsumerFactory; _dictionaryFactory = dictionaryFactory; _dataContextBuilderFactory = dataContextBuilderFactory; _dataCatalog = dataCatalog; _dataDependencyFactory = dataDependencyFactory; }
public void Setup() { Reset(); _dataCatalog = new DataCatalog( SetupMock <IDictionaryFactory>()); }
public DataContextBuilderFactory( IDataContextFactory dataContextFactory, IIdManager idManager, IDataCatalog dataCatalog) { _dataContextFactory = dataContextFactory; _idManager = idManager; _dataCatalog = dataCatalog; }
//--- Constructors --- /// <summary> /// Create a new storage instance. /// </summary> /// <param name="catalog">DataCatalog to use for collection storage.</param> /// <param name="indexer">Indexing service.</param> public MysqlDocStore(IDataCatalog catalog, IMysqlDocStoreIndexer indexer) { _catalog = catalog; _indexer = indexer; _name = _indexer.Name; _idXPath = _indexer.Config["id-xpath"].AsText ?? "@id"; _namespaceMap.Add(new KeyValuePair<string, string>("docstore", "mindtouch.dream.docstore")); foreach(XDoc doc in _indexer.Config["namespaces/namespace"]) { _namespaceMap.Add(new KeyValuePair<string, string>(doc["@prefix"].AsText, doc["@urn"].AsText)); } }
//--- Constructors --- /// <summary> /// Create a new storage instance. /// </summary> /// <param name="catalog">DataCatalog to use for collection storage.</param> /// <param name="indexer">Indexing service.</param> public MysqlDocStore(IDataCatalog catalog, IMysqlDocStoreIndexer indexer) { _catalog = catalog; _indexer = indexer; _name = _indexer.Name; _idXPath = _indexer.Config["id-xpath"].AsText ?? "@id"; _namespaceMap.Add(new KeyValuePair <string, string>("docstore", "mindtouch.dream.docstore")); foreach (XDoc doc in _indexer.Config["namespaces/namespace"]) { _namespaceMap.Add(new KeyValuePair <string, string>(doc["@prefix"].AsText, doc["@urn"].AsText)); } }
public FluentBuilder( INameManager nameManager, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory, IDataSupplierFactory dataSupplierFactory) { _nameManager = nameManager; _dataCatalog = dataCatalog; _dataDependencyFactory = dataDependencyFactory; _dataSupplierFactory = dataSupplierFactory; _assemblies = new HashSet <string>(); _types = new HashSet <Type>(); }
public ServiceDependenciesFactory( IRenderContextFactory renderContextFactory, IAssetManager assetManager, INameManager nameManager, IRequestRouter requestRouter, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory) { _renderContextFactory = renderContextFactory; AssetManager = assetManager; NameManager = nameManager; RequestRouter = requestRouter; DataCatalog = dataCatalog; DataDependencyFactory = dataDependencyFactory; }
public FluentBuilder( INameManager nameManager, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory, IDataSupplierFactory dataSupplierFactory, IFrameworkConfiguration frameworkConfiguration) { _nameManager = nameManager; _dataCatalog = dataCatalog; _dataDependencyFactory = dataDependencyFactory; _dataSupplierFactory = dataSupplierFactory; _assemblies = new HashSet <string>(); _types = new HashSet <Type>(); frameworkConfiguration.Subscribe(config => _debugLogging = config.DebugLogging); }
/// <summary> /// Drop the entire data store. /// </summary> /// <param name="catalog"></param> /// <param name="name"></param> public static void DropDataStore(IDataCatalog catalog, string name) { string tables = string.Empty; catalog.NewQuery("SHOW TABLES LIKE ?PREFIX") .With("PREFIX", name + "_store%") .Execute(delegate(IDataReader reader) { while (reader.Read()) { if (tables != string.Empty) { tables += ", "; } tables += reader.GetString(0); } }); if (tables != string.Empty) { catalog.NewQuery(string.Format("DROP TABLE IF EXISTS {0}", tables)).Execute(); } }
public EndpointRequest( Action <IOwinContext, Func <string> > trace, IRequestRouter requestRouter, IOwinContext context, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory, IRequestDeserializer deserializer, IResponseSerializer serializer, EndpointParameter[] parameters) { _trace = trace; _requestRouter = requestRouter; _context = context; _dataCatalog = dataCatalog; _dataDependencyFactory = dataDependencyFactory; _deserializer = deserializer; _serializer = serializer; _parameters = parameters; Success(); }
//--- Constructors --- /// <summary> /// Create a new storage manager. /// </summary> /// <param name="catalog">Database catalog to use.</param> /// <param name="config">Collection and index configuration.</param> public MysqlDocStoreManager(IDataCatalog catalog, XDoc config) { _catalog = catalog; _config = config; _name = "docstore_" + _config["name"].AsText; _indexLookupTable = _name + "_indicies"; if (string.IsNullOrEmpty(_name)) { throw new ArgumentException("Missing name for store table"); } if (_catalog == null) { throw new ArgumentException("Missing DataCatalog"); } _namespaceMap.Add(new KeyValuePair <string, string>("docstore", "mindtouch.dream.docstore")); foreach (XDoc doc in _config["namespaces/namespace"]) { _namespaceMap.Add(new KeyValuePair <string, string>(doc["@prefix"].AsText, doc["@urn"].AsText)); } _processingQueue = new ProcessingQueue <WorkItem>(Update, 5); // create storage & index lookup tables if required _catalog.NewQuery(string.Format(@" CREATE TABLE IF NOT EXISTS {0} ( id int primary key auto_increment not null, revision int not null default 1, doc_id varchar(255) unique not null, doc text not null )", _name)) .Execute(); _catalog.NewQuery(string.Format(@" CREATE TABLE IF NOT EXISTS {0} ( idx_name varchar(255) primary key not null, idx_xpath text not null )", _indexLookupTable)) .Execute(); RefreshIndicies(); }
public ServiceEndpoint( string path, Method[] methods, Action <IEndpointRequest> method, MethodInfo methodInfo, string userSegmentKey, AnalyticsLevel analytics, IDataCatalog dataCatalog, IDataDependencyFactory dataDependencyFactory, IRequestRouter requestRouter) { Path = path; MethodInfo = methodInfo; _userSegmentKey = userSegmentKey; _method = method; _dataCatalog = dataCatalog; _dataDependencyFactory = dataDependencyFactory; _requestRouter = requestRouter; _pathElements = path .Split('/') .Where(p => !string.IsNullOrEmpty(p)) .ToArray(); AddStatistics(analytics, path, methods); }
//--- Constructors --- /// <summary> /// Create a new storage manager. /// </summary> /// <param name="catalog">Database catalog to use.</param> /// <param name="config">Collection and index configuration.</param> public MysqlDocStoreManager(IDataCatalog catalog, XDoc config) { _catalog = catalog; _config = config; _name = "docstore_" + _config["name"].AsText; _indexLookupTable = _name + "_indicies"; if(string.IsNullOrEmpty(_name)) { throw new ArgumentException("Missing name for store table"); } if(_catalog == null) { throw new ArgumentException("Missing DataCatalog"); } _namespaceMap.Add(new KeyValuePair<string, string>("docstore", "mindtouch.dream.docstore")); foreach(XDoc doc in _config["namespaces/namespace"]) { _namespaceMap.Add(new KeyValuePair<string, string>(doc["@prefix"].AsText, doc["@urn"].AsText)); } _processingQueue = new ProcessingQueue<WorkItem>(Update, 5); // create storage & index lookup tables if required _catalog.NewQuery(string.Format(@" CREATE TABLE IF NOT EXISTS {0} ( id int primary key auto_increment not null, revision int not null default 1, doc_id varchar(255) unique not null, doc text not null )", _name)) .Execute(); _catalog.NewQuery(string.Format(@" CREATE TABLE IF NOT EXISTS {0} ( idx_name varchar(255) primary key not null, idx_xpath text not null )", _indexLookupTable)) .Execute(); RefreshIndicies(); }
public DataContextBuilder( IDataContextFactory dataContextFactory, IIdManager idManager, IDataCatalog dataCatalog, IDataScopeRules dataScopeRules) { _dataContextFactory = dataContextFactory; _idManager = idManager; _dataCatalog = dataCatalog; Id = idManager.GetUniqueId(); var dataScopes = dataScopeRules.DataScopes; _dataScopes = dataScopes == null ? new List <IDataScope>() : dataScopes.ToList(); var dataSupplies = dataScopeRules.DataSupplies; _requiredDataSupplies = dataSupplies == null ? new List <IDataSupply>() : dataSupplies.ToList(); var suppliedDependencies = dataScopeRules.SuppliedDependencies; _requiredSuppliedDependencies = suppliedDependencies == null ? new List <SuppliedDependency>() : suppliedDependencies.Select(sd => new SuppliedDependency(sd)).ToList(); #if DETAILED_TRACE Trace.WriteLine("Data context builder #" + Id + " constructing from data scope rules " + dataScopeRules); if (_dataScopes.Count > 0) { Trace.WriteLine("Data context builder #" + Id + " scopes:"); foreach (var s in _dataScopes) { Trace.WriteLine(" " + s); } } if (_requiredDataSupplies.Count > 0) { Trace.WriteLine("Data context builder #" + Id + " data supplies:"); foreach (var s in _requiredDataSupplies) { Trace.WriteLine(" " + s); } } if (_requiredSuppliedDependencies.Count > 0) { Trace.WriteLine("Data context builder #" + Id + " supplied dependencies:"); foreach (var s in _requiredSuppliedDependencies) { Trace.WriteLine(" " + s); } } #endif }
public void Setup() { _catalog = _mockCatalog = new MockDataCatalog(); }
/// <summary> /// Drop the entire data store. /// </summary> /// <param name="catalog"></param> /// <param name="name"></param> public static void DropDataStore(IDataCatalog catalog, string name) { string tables = string.Empty; catalog.NewQuery("SHOW TABLES LIKE ?PREFIX") .With("PREFIX", name + "_store%") .Execute(delegate(IDataReader reader) { while(reader.Read()) { if(tables != string.Empty) { tables += ", "; } tables += reader.GetString(0); } }); if(tables != string.Empty) { catalog.NewQuery(string.Format("DROP TABLE IF EXISTS {0}", tables)).Execute(); } }