private void Context_InitComplete(object sender, EventArgs e)
        {
            IVulcanHandler handler = ServiceLocator.Current.GetInstance <IVulcanHandler>();

            // Clear static list so property mapping can be re-created.
            handler.DeletedIndices += ((IEnumerable <string> deletedIndices) =>
            {
                VulcanAttachmentPropertyMapper.AddedMappings.Clear();
            });

            if (_AttachmentSettings.Service.EnableAttachmentPlugins)
            {
                //todo: future 5.x support uses https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/ingest-attachment.html
                // not which 2.x uses https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/mapper-attachments.html

                IVulcanClient client = handler.GetClient(CultureInfo.InvariantCulture);
                var           info   = client.NodesInfo();

                if (info?.Nodes?.Any(x => x.Value?.Plugins?.Any(y => string.Compare(y.Name, "mapper-attachments", true) == 0) == true) != true)
                {
                    if (CurrentHostType != HostType.WebApplication ||
                        (CurrentHostType == HostType.WebApplication && HttpContext.Current?.IsDebuggingEnabled == true))
                    {
                        // Only throw exception if not a web application or is a web application with debug turned on
                        throw new Exception("No attachment plugin found, be sure to install the 'mapper-attachments' plugin on your Elastic Search Server!");
                    }
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// DI Constructor
 /// </summary>
 /// <param name="vulcanHandler"></param>
 /// <param name="vulcanIndexers"></param>
 /// <param name="vulcanIndexModifiers"></param>
 public HomeController
 (
     IVulcanHandler vulcanHandler,
     IEnumerable <IVulcanIndexer> vulcanIndexers,
     IEnumerable <IVulcanIndexingModifier> vulcanIndexModifiers
 ) : base(vulcanHandler)
 {
     _vulcanIndexers       = vulcanIndexers;
     _vulcanIndexModifiers = vulcanIndexModifiers;
 }
 /// <summary>
 /// Injected contructor
 /// </summary>
 /// <param name="vulcanHandler"></param>
 /// <param name="localizationService"></param>
 /// <param name="siteDefintionResolver"></param>
 /// <param name="contentRepository"></param>
 /// <param name="contentTypeRepository"></param>
 /// <param name="uiDescriptorRegistry"></param>
 public VulcanPageSearchProvider(
     IVulcanHandler vulcanHandler,
     LocalizationService localizationService,
     ISiteDefinitionResolver siteDefintionResolver,
     IContentRepository contentRepository,
     IContentTypeRepository contentTypeRepository,
     UIDescriptorRegistry uiDescriptorRegistry
     )
     : base(vulcanHandler, contentRepository, contentTypeRepository, localizationService, uiDescriptorRegistry, siteDefintionResolver)
 {
 }
Beispiel #4
0
        public void Initialize(InitializationEngine context)
        {
            var broadcaster = context.Locate.Advanced.GetInstance <CatalogKeyEventBroadcaster>();

            _contentLoader      = context.Locate.ContentLoader();
            _referenceConverter = context.Locate.ReferenceConverter();
            _vulcanHandler      = context.Locate.Advanced.GetInstance <IVulcanHandler>();

            broadcaster.InventoryUpdated += Broadcaster_InventoryUpdated;
            broadcaster.PriceUpdated     += Broadcaster_PriceUpdated;
        }
 public VulcanCatalogSearchProvider(
     IVulcanHandler vulcanHandler,
     LocalizationService localizationService,
     ISiteDefinitionResolver siteDefinitionResolver,
     IContentRepository contentRepository,
     IContentTypeRepository contentTypeRepository,
     UIDescriptorRegistry uiDescriptorRegistry
     )
     : base(vulcanHandler, contentRepository, contentTypeRepository, localizationService, uiDescriptorRegistry, siteDefinitionResolver)
 {
     EditPath = new Func <IContent, ContentReference, string, string>(GetEditPath);
 }
Beispiel #6
0
        /// <summary>
        /// Assigns private variables, and wires up content events
        /// </summary>
        /// <param name="context"></param>
        public void Initialize(InitializationEngine context)
        {
            _contentEvents     = context.Locate.ContentEvents();
            _contentRepository = context.Locate.ContentRepository();
            _vulcanHandler     = context.Locate.Advanced.GetInstance <IVulcanHandler>();

            // todo: Add content events to work with content area attribute to sync block changes that are searchable.

            _contentEvents.PublishedContent       += Service_PublishedContent;
            _contentEvents.MovedContent           += Service_MovedContent;
            _contentEvents.DeletedContent         += Service_DeletedContent;
            _contentEvents.DeletedContentLanguage += Service_DeletedContentLanguage;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="vulcanHandler"></param>
        /// <param name="contentRepository"></param>
        /// <param name="contentTypeRepository"></param>
        /// <param name="localizationService"></param>
        /// <param name="uiDescriptorRegistry"></param>
        /// <param name="enterpriseSettings"></param>
        protected VulcanSearchProviderBase(IVulcanHandler vulcanHandler, IContentRepository contentRepository, IContentTypeRepository contentTypeRepository, LocalizationService localizationService, UIDescriptorRegistry uiDescriptorRegistry, ISiteDefinitionResolver enterpriseSettings)
        {
            VulcanHandler          = vulcanHandler;
            ContentRepository      = contentRepository;
            ContentTypeRepository  = contentTypeRepository;
            LocalizationService    = localizationService;
            UiDescriptorRegistry   = uiDescriptorRegistry;
            SiteDefinitionResolver = enterpriseSettings;

            EditPath = (contentData, contentLink, languageName) =>
            {
                var uri = contentData.GetUri();

                return(!string.IsNullOrWhiteSpace(languageName) ? $"{uri}#language={languageName}" : uri);
            };
        }
Beispiel #8
0
 /// <summary>
 /// DI Constructor
 /// </summary>
 /// <param name="index"></param>
 /// <param name="indexAlias"></param>
 /// <param name="settings"></param>
 /// <param name="language"></param>
 /// <param name="contentLoader"></param>
 /// <param name="vulcanHandler"></param>
 /// <param name="vulcanPipelineSelector"></param>
 public VulcanClient
 (
     string index,
     string indexAlias,
     IConnectionSettingsValues settings,
     CultureInfo language,
     IContentLoader contentLoader,
     IVulcanHandler vulcanHandler,
     IVulcanPipelineSelector vulcanPipelineSelector) : base(settings)
 {
     Language                = language ?? throw new Exception("Vulcan client requires a language (you may use CultureInfo.InvariantCulture if needed for non-language specific data)");
     IndexName               = VulcanHelper.GetAliasName(index, language, indexAlias);
     IndexAlias              = indexAlias;
     ContentLoader           = contentLoader;
     VulcanHandler           = vulcanHandler;
     _vulcanPipelineSelector = vulcanPipelineSelector;
 }
 /// <summary>
 /// DI Constructor
 /// </summary>
 /// <param name="vulcanSearchContentLoader"></param>
 /// <param name="vulcanHandler"></param>
 /// <param name="vulcanPocoIndexingJob"></param>
 /// <param name="vulcanIndexers"></param>
 /// <param name="vulcanIndexContentJobSettings"></param>
 /// <param name="vulcanFeatures"></param>
 public VulcanIndexContentJob
 (
     IVulcanSearchContentLoader vulcanSearchContentLoader,
     IVulcanHandler vulcanHandler,
     IVulcanPocoIndexingJob vulcanPocoIndexingJob,
     IVulcanIndexContentJobSettings vulcanIndexContentJobSettings,
     IEnumerable <IVulcanIndexer> vulcanIndexers,
     IEnumerable <IVulcanFeature> vulcanFeatures
 )
 {
     _vulcanSearchContentLoader     = vulcanSearchContentLoader;
     _vulcanHandler                 = vulcanHandler;
     _vulcanPocoIndexHandler        = vulcanPocoIndexingJob;
     _vulcanIndexers                = vulcanIndexers;
     _vulcanIndexContentJobSettings = vulcanIndexContentJobSettings;
     _vulcanFeatures                = vulcanFeatures;
     IsStoppable = true;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="vulcanHandler"></param>
        /// <param name="contentRepository"></param>
        /// <param name="contentTypeRepository"></param>
        /// <param name="localizationService"></param>
        /// <param name="uiDescriptorRegistry"></param>
        /// <param name="enterpriseSettings"></param>
        public VulcanSearchProviderBase(IVulcanHandler vulcanHandler, IContentRepository contentRepository, IContentTypeRepository contentTypeRepository, LocalizationService localizationService, UIDescriptorRegistry uiDescriptorRegistry, ISiteDefinitionResolver enterpriseSettings)
        {
            _VulcanHandler          = vulcanHandler;
            _ContentRepository      = contentRepository;
            _ContentTypeRepository  = contentTypeRepository;
            _LocalizationService    = localizationService;
            _UIDescriptorRegistry   = uiDescriptorRegistry;
            _SiteDefinitionResolver = enterpriseSettings;

            EditPath = (contentData, contentLink, languageName) =>
            {
                var uri = SearchProviderExtensions.GetUri(contentData);

                if (!string.IsNullOrWhiteSpace(languageName))
                {
                    return(string.Format("{0}#language={1}", uri, languageName));
                }

                return(uri);
            };
        }
Beispiel #11
0
 protected BaseController(IVulcanHandler vulcanHandler)
 {
     VulcanHandler = vulcanHandler;
 }
Beispiel #12
0
 /// <summary>
 /// Injected constructor
 /// </summary>
 /// <param name="vulcanHandler"></param>
 public VulcanPocoIndexingJob(IVulcanHandler vulcanHandler)
 {
     _VulcanHander    = vulcanHandler;
     _InvariantClient = _VulcanHander.GetClient(CultureInfo.InvariantCulture);
 }
Beispiel #13
0
 /// <summary>
 /// Injected constructor
 /// </summary>
 /// <param name="vulcanHandler"></param>
 public VulcanPocoIndexingJob(IVulcanHandler vulcanHandler)
 {
     VulcanHander = vulcanHandler;
 }
Beispiel #14
0
 public VulcanApiController(IVulcanHandler vulcanHandler) : base(vulcanHandler)
 {
 }
Beispiel #15
0
 /// <summary>
 /// DI Constructor
 /// </summary>
 /// <param name="vulcanHandler"></param>
 public VulcanIndexClearJob(IVulcanHandler vulcanHandler)
 {
     _vulcanHandler = vulcanHandler;
     IsStoppable    = true;
 }