예제 #1
0
        /// <summary>
        /// Provides initialization information from the External Content Library to the Provider.<see cref="T:Tridion.ExternalContentLibrary.V2.IContentLibrary" />
        /// </summary>
        /// <param name="mountPointId">The string ID of the IContentLibraryContract instance. Note that this is the <see cref="P:Tridion.ExternalContentLibrary.V2.IEclUri.MountPointId" /> part of the URI, not the full <see cref="T:Tridion.ExternalContentLibrary.V2.IEclUri" /></param>
        /// <param name="configurationXmlElement">The XML element containing the configuration for the External Content Library.
        /// Providers can read custom elements and attributes to access configuration data specific to the Provider.</param>
        /// <param name="hostServices">Provides access to a number of services available from the External Content Library host.</param>
        /// <remarks>
        /// Initialize is called only once immediately after the <see cref="T:Tridion.ExternalContentLibrary.V2.IContentLibrary" /> is instantiated and before any other method is called. The instance is
        /// used until the Tridion process hosting the Provider is terminated, or its <see cref="T:System.AppDomain" /> is recycled.
        /// </remarks>
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            _hostServices = hostServices;
            _cache        = new MemoryCache(mountPointId);

            XElement xmlConfig = XElement.Parse(configurationXmlElement);
            XElement s3Config  = xmlConfig.Element(S3Ns + "S3ECLProvider");

            if (s3Config == null)
            {
                throw new ConfigurationErrorsException("No S3 configuration node with namespace http://www.sdltridion.com/S3EclProvider/Configuration found.");
            }

            Dictionary <String, String> config =
                s3Config
                .Elements()
                .ToDictionary(e => e.Name.LocalName, e => e.Value);

            S3 = new S3(
                config["Region"],
                VirtualPathUtility.RemoveTrailingSlash(config["BucketName"]),
                config["AccessKeyId"],
                config["SecretAccessKey"],
                VirtualPathUtility.AppendTrailingSlash(config["BucketUrl"]),
                VirtualPathUtility.AppendTrailingSlash(config["Prefix"]));

            if (!int.TryParse(config["CacheTime"], out _cacheTime))
            {
                _cacheTime = 120;
            }
        }
예제 #2
0
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            MountPointId = mountPointId;
            HostServices = hostServices;

            // read ExtenalContentLibrary.xml for this mountpoint
            XElement config = XElement.Parse(configurationXmlElement);
            Wufoo = new WufooWrapper(config.Element(WufooNs + "WufooApiKey").Value, config.Element(WufooNs + "WufooUser").Value);
        }
예제 #3
0
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            MountPointId = mountPointId;
            HostServices = hostServices;

            // read ExtenalContentLibrary.xml for this mountpoint
            XElement config = XElement.Parse(configurationXmlElement);

            Wufoo = new WufooWrapper(config.Element(WufooNs + "WufooApiKey").Value, config.Element(WufooNs + "WufooUser").Value);
        }
예제 #4
0
 public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
 {
     MountPointId = mountPointId;
     HostServices = hostServices;
     ConfigurationXmlElement = configurationXmlElement;
     
     // read ExtenalContentLibrary.xml for this mountpoint
     XElement config = XElement.Parse(configurationXmlElement);
     Flickr = new Flickr(config.Element(FlickrNs + "FlickrApiKey").Value, config.Element(FlickrNs + "FlickrNSID").Value);
 }
예제 #5
0
        public static void Initialize( )
        {
            _hostServices = HostServicesSingleton.HostServices;
            if (_hostServices == null)
            {
                return;
            }

            SubscribeToEvents();
        }
예제 #6
0
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            MountPointId            = mountPointId;
            HostServices            = hostServices;
            ConfigurationXmlElement = configurationXmlElement;

            // read ExtenalContentLibrary.xml for this mountpoint
            XElement config = XElement.Parse(configurationXmlElement);

            Flickr = new Flickr(config.Element(FlickrNs + "FlickrApiKey").Value, config.Element(FlickrNs + "FlickrNSID").Value);
        }
예제 #7
0
        private void showMessagesFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IHostServices host = HostServicesSingleton.HostServices;

            if (host == null)
            {
                return;
            }

            host.MsgService.ShowMessages();
        }
예제 #8
0
        /// <summary>
        /// Initialize the ECL provider
        /// </summary>
        /// <param name="mountPointId"></param>
        /// <param name="configurationXmlElement"></param>
        /// <param name="hostServices"></param>
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            MountPointId = mountPointId;
            HostServices = hostServices;

            // read ExtenalContentLibrary.xml for this mountpoint
            XElement config = XElement.Parse(configurationXmlElement);

            // Initialize the product catalog with config
            //
            ProductCatalog = this.CreateProductCatalog(config);
        }
예제 #9
0
        private void InitializeHostServices( )
        {
            _hostServices = HostServicesSingleton.HostServices;
            if (_hostServices == null)
            {
                AddError("Host Services not available!");
            }

            _hostServices.ActiveContentChanged         += new EventHandler(_hostServices_ActiveContentChanged);
            _hostServices.EditorServices.EditorClosed  += new FormClosedEventHandler(EditorServices_EditorClosed);
            _hostServices.EditorServices.EditorClosing += new FormClosingEventHandler(EditorServices_EditorClosing);
            _hostServices.EditorServices.EditorReady   += new EventHandler(EditorServices_EditorReady);
        }
예제 #10
0
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            MountPointId = mountPointId;
            HostServices = hostServices;
            XElement config = XElement.Parse(configurationXmlElement);

            S3 = new S3(
                config.Element(S3Ns + "S3BucketName").Value,
                config.Element(S3Ns + "S3SecretKey").Value,
                config.Element(S3Ns + "S3AccessId").Value,
                config.Element(S3Ns + "FullBucketUrl").Value
                );
        }
예제 #11
0
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            var configSource = System.Xml.Linq.XElement.Parse(configurationXmlElement);
            _config = new Configuration(configSource);
            HostServices = hostServices;
            MountpointId = mountPointId;
            Client = FotoWareClient.GetInstance(_config.BaseUrl, _config.UserName, _config.Password);

            if(HostServices!=null)
            {
                HostServices.LogMessage(LoggingSeverity.Debug,
                    string.Format("FotoWare client logged in as {0} with authentication token {1}", _config.UserName, Client.AuthenticationToken)
                );
            }
        }
예제 #12
0
        public void Initialize(string mountPointId, string configurationXmlElement, IHostServices hostServices)
        {
            MountPointId = mountPointId;
            HostServices = hostServices;
            var config = XElement.Parse(configurationXmlElement);

            var usersList = config.Element(Namespace + "Users");

            var youtubeUsers = usersList.Elements(Namespace + "User").Select(xUsers => xUsers.Value).ToList();

            var proxyURI      = String.Empty;
            var proxyUser     = String.Empty;
            var proxyPassword = String.Empty;

            WebProxy proxy = new WebProxy();

            if (config.Element(Namespace + "ProxyURI") != null)
            {
                proxyURI = config.Element(Namespace + "ProxyURI").Value;
                proxy    = new WebProxy(proxyURI, true);
            }
            if (config.Element(Namespace + "ProxyUser") != null)
            {
                proxyUser = config.Element(Namespace + "ProxyUser").Value;
            }
            if (config.Element(Namespace + "ProxyPassword") != null)
            {
                proxyPassword = config.Element(Namespace + "ProxyPassword").Value;
            }

            if (!String.IsNullOrEmpty(proxyUser) && !String.IsNullOrEmpty(proxyPassword))
            {
                proxy.Credentials = new NetworkCredential(proxyUser, proxyPassword);
            }


            Client = new YouTubeClient(config.Element(Namespace + "AppName").Value,
                                       config.Element(Namespace + "ApiKey").Value,
                                       config.Element(Namespace + "Username").Value,
                                       proxy)
            {
                Users = youtubeUsers
            };
        }
예제 #13
0
 public UserController(IUserManager userManager, IHostServices hostServices)
 {
     _userManager  = userManager;
     _hostServices = hostServices;
 }
예제 #14
0
 public DefaultDeepCopier(IHostServices hostServices)
 {
     this.hostServices = hostServices;
     byType            = new Dictionary <Type, DataContractSerializer>();
 }
예제 #15
0
 internal EclSessionMockup(IHostServices hostServices, ITridionUser user)
 {
     HostServices = hostServices;
     TridionUser = user;
 }
예제 #16
0
 public EventsController(IEventManager eventManager, IHostServices hostServices, ILogHelper logger)
 {
     _eventManager = eventManager;
     _hostServices = hostServices;
     _logger       = logger;
 }
예제 #17
0
 public PostController(IPostManager postManager, IHostServices hostServices)
 {
     _postManager  = postManager;
     _hostServices = hostServices;
 }
예제 #18
0
 public UsersController(IUserManager userManager, IHostServices hostServices, ILogHelper logger)
 {
     _userManager  = userManager;
     _hostServices = hostServices;
     _logger       = logger;
 }