Beispiel #1
0
        void LoadConfig()
        {
            SetProviderSource();
            SetProviderDest();


            //cargo la grilla izquierda
            ucbServiceGrid1.Services     = ServiceMetadata.GetAllServices(_SourceProvider.Name);
            ucbServiceGrid1.Applications = ServiceMetadata.GetAllApplicationsId(_SourceProvider.Name);

            //lleno el combo de posibles proveedores destino
            foreach (ServiceProviderElement p in ServiceMetadata.ProviderSection.Providers)
            {
                if (!_SourceProvider.Name.Equals(p.Name))
                {
                    cmb2.Items.Add(p.Name);
                }
            }


            cmb2.SelectedIndex = 0;
            _SelectedProvider  = ServiceMetadata.ProviderSection.GetProvider(cmb2.SelectedItem.ToString());

            cmb2.SelectedValueChanged += new EventHandler(cb_SelectedValueChanged);


            this.Text = string.Concat("Export data from ", _SourceProvider.Name, " to ", _SourceProvider.Name);
        }
Beispiel #2
0
        /// <summary>
        /// CAmbia el proveedor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void cb_SelectedValueChanged(object sender, EventArgs e)
        {

            _SelectedProvider = ServiceMetadata.ProviderSection.GetProvider(cmb2.SelectedItem.ToString());

            SetProviderDest() ;


            try
            {
                
                //cargo la grilla derecha
                ucbServiceGrid2.Services = ServiceMetadata.GetAllServices(_SelectedProvider.Name);
                ucbServiceGrid2.Applications = ServiceMetadata.GetAllApplicationsId(_SelectedProvider.Name);

            

                //muestro el titulo
                this.Text = string.Concat("Export data from ", _SelectedProvider.Name, " to ", _SelectedProvider.Name);
            }
            catch (Exception ex)
            {

                base.ExceptionViewer.Show(ex);
               
                ucbServiceGrid1.Services = null;

            }
        }
Beispiel #3
0
        /// <summary>
        /// CAmbia el proveedor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void cb_SelectedValueChanged(object sender, EventArgs e)
        {
            _SelectedProvider = ServiceMetadata.ProviderSection.GetProvider(cmb2.SelectedItem.ToString());

            SetProviderDest();


            try
            {
                //cargo la grilla derecha
                ucbServiceGrid2.Services     = ServiceMetadata.GetAllServices(_SelectedProvider.Name);
                ucbServiceGrid2.Applications = ServiceMetadata.GetAllApplicationsId(_SelectedProvider.Name);



                //muestro el titulo
                this.Text = string.Concat("Export data from ", _SelectedProvider.Name, " to ", _SelectedProvider.Name);
            }
            catch (Exception ex)
            {
                base.ExceptionViewer.Show(ex);

                ucbServiceGrid1.Services = null;
            }
        }
Beispiel #4
0
        void LoadConfig()
        {
      

            SetProviderSource();
            SetProviderDest();


            //cargo la grilla izquierda
            ucbServiceGrid1.Services = ServiceMetadata.GetAllServices(_SourceProvider.Name);
            ucbServiceGrid1.Applications = ServiceMetadata.GetAllApplicationsId(_SourceProvider.Name);
    
            //lleno el combo de posibles proveedores destino
            foreach (ServiceProviderElement p in ServiceMetadata.ProviderSection.Providers)
            {
                if (!_SourceProvider.Name.Equals(p.Name))
                    cmb2.Items.Add(p.Name);
            }


            cmb2.SelectedIndex = 0;
            _SelectedProvider = ServiceMetadata.ProviderSection.GetProvider(cmb2.SelectedItem.ToString());

            cmb2.SelectedValueChanged += new EventHandler(cb_SelectedValueChanged);


            this.Text = string.Concat("Export data from ", _SourceProvider.Name, " to ", _SourceProvider.Name);
        }
        /// <summary>
        /// Elimina un seriovicio del repositorio y del origen de metadata de servicios.-
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <param name="serviceName">Nombre del servicio</param>
        public static void DeleteServiceConfiguration(string providerName, string serviceName)
        {
            ServiceProviderElement provider = GetProvider(providerName);

            ServiceConfigurationCollection svcList = GetAllServices(provider);

            if (!svcList.Exists(serviceName, provider.ApplicationId))
            {
                Exceptions.TechnicalException te = new Exceptions.TechnicalException(string.Format("El servicio {0} no se encuentra configurado.\r\nProveedor de Metadata: {1}\r\nApplicationId: {2}\r\n", serviceName, provider.Name, provider.ApplicationId));
                te.ErrorId = "7002";
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <ServiceMetadata>(te);

                throw te;
            }
            ServiceConfiguration wServiceConfigurationEnMemoria = svcList.GetServiceConfiguration(serviceName, provider.ApplicationId);

            svcList.Remove(wServiceConfigurationEnMemoria);

            if (provider.ProviderType == ServiceProviderType.xml)
            {
                XmlServiceConfigurationManager.DeleteServiceConfiguration(provider.SourceInfo, svcList);
            }
            else
            {
                DatabaseServiceConfigurationManager.DeleteServiceConfiguration(serviceName, provider.ApplicationId, provider.SourceInfo);
            }
        }
        /// <summary>
        /// Metodo privado que obtioene un proveedor . Si [providerName] es nulo se retornara el proveedor por defecto.-
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <returns></returns>
        static ServiceProviderElement GetProvider(string providerName)
        {
            ServiceProviderElement provider = _ProviderSection.GetProvider(providerName);

            CheckProvider(providerName, provider);

            if (string.IsNullOrEmpty(provider.SourceInfo))
            {
                System.Text.StringBuilder wMessage = new StringBuilder();
                wMessage.Append("Error al inicializar la metadata de los servicios  \r\n");
                wMessage.Append("El atributo SourceInfo no puede estar vasio.  \r\n");
                wMessage.AppendLine("Verifique el archivo de configuración en la sección FwkServiceMetadata el ");
                wMessage.AppendLine("atributo [type] y [SourceInfo]  posibles :");
                wMessage.AppendLine("Si tipo es XML espesifique nombre de archivo  ");
                wMessage.AppendLine("Si tipo es sqldatabase  espesifique nombre de connetionstring \r\n");


                TechnicalException te = new TechnicalException(wMessage.ToString());
                te.ErrorId = "7004";
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <ServiceMetadata>(te);

                throw te;
            }

            return(provider);
        }
        /// <summary>
        /// Crea un servicio en el origen de datos indicado por el proveedor
        /// El aaplication Id que se utiliza es el del  nuevo servicio. Si el provedor estra configurado para usar uno determinado este se ignora
        /// de esta manera un proveedor puede insertar servicios para diferentes aplicaciones
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <param name="pServiceConfiguration"><see cref="ServiceConfiguration"/></param>
        public static void AddServiceConfiguration(string providerName, ServiceConfiguration pServiceConfiguration)
        {
            ServiceProviderElement provider = GetProvider(providerName);

            ServiceConfigurationCollection svcList = GetAllServices(provider);

            if (svcList.Exists(pServiceConfiguration.Name, pServiceConfiguration.ApplicationId))
            {
                Exceptions.TechnicalException te = new Exceptions.TechnicalException(string.Format("El servicio {0} ya existe.\r\nProveedor de Metadata: {1}\r\nApplicationId: {2}\r\n", pServiceConfiguration.Name, provider.Name, provider.ApplicationId));
                te.ErrorId = "7002";
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <ServiceMetadata>(te);
                throw te;
            }



            svcList.Add(pServiceConfiguration);

            if (provider.ProviderType == ServiceProviderType.xml)
            {
                XmlServiceConfigurationManager.AddServiceConfiguration(pServiceConfiguration, provider.SourceInfo, svcList);
            }
            else
            {
                DatabaseServiceConfigurationManager.AddServiceConfiguration(pServiceConfiguration, pServiceConfiguration.ApplicationId, provider.SourceInfo);
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Validate())
            {
                return;
            }
            CreatedProvider = new ServiceProviderElement();
            if (cboType.Text == "xml")
            {
                CreatedProvider.SourceInfo = txtSource.Text;
            }
            else
            {
                CreatedProvider.SourceInfo = txtCnnStringName.Text;
                AddNewCnnString();
            }

            CreatedProvider.Name          = txtName.Text;
            CreatedProvider.ApplicationId = txtApplicationId.Text;

            CreatedProvider.ProviderType = (ServiceProviderType)Enum.Parse(typeof(ServiceProviderType), cboType.Text);
            AddNewProvider(CreatedProvider);

            this.DialogResult = DialogResult.OK;
        }
Beispiel #9
0
 public Provider(ServiceProviderElement p)
 {
     // TODO: Complete member initialization
     this.p             = p;
     this.ApplicationId = p.ApplicationId;
     this.Name          = p.Name;
     this.ProviderType  = p.ProviderType;
     this.SourceInfo    = p.SourceInfo;
 }
Beispiel #10
0
        void AddNewProvider(ServiceProviderElement newProvider)
        {
            ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];

            config.Providers.Add(newProvider);
            configuration.Save(ConfigurationSaveMode.Minimal, true);

            ServiceMetadata.ProviderSection.Providers.Add(newProvider);
        }
Beispiel #11
0
 public void Populate(ServiceProviderElement pProvider)
 {
     Provider = pProvider;
     if (pProvider == null)
     {
         return;
     }
     SetProvider();
 }
Beispiel #12
0
        public Provider(ServiceProviderElement p)
        {
            // TODO: Complete member initialization
            this.p = p;
            this.ApplicationId = p.ApplicationId;
            this.Name = p.Name;
            this.ProviderType = p.ProviderType;
            this.SourceInfo = p.SourceInfo;

        }
        /// <summary>
        /// Obtiene una lista de todas las aplicaciones configuradas en el origen de datos configurado por el
        /// proveedor
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <returns></returns>
        public static List <String> GetAllApplicationsId(string providerName)
        {
            ServiceProviderElement provider = GetProvider(providerName);

            ServiceConfigurationCollection svcList = GetAllServices(provider);

            IEnumerable <string> llist = from s in svcList
                                         where s.ApplicationId != null
                                         group s by s.ApplicationId into g
                                         select g.Key;

            return(llist.ToList <string>());
        }
Beispiel #14
0
        public void Populate(Provider pProvider)
        {
            Provider = new ServiceProviderElement();
            Provider.ApplicationId = pProvider.ApplicationId;
            Provider.Name = pProvider.Name;
            Provider.SecurityProviderName = pProvider.SecurityProviderName;
            Provider.ProviderType = pProvider.ProviderType;
            Provider.SourceInfo = pProvider.SourceInfo;


            if (pProvider == null) return;
            SetProvider();
        }
 private ServiceProvider ToServiceProvider(ServiceProviderElement serviceProvider)
 {
     if (serviceProvider == null) return null;
     return new ServiceProvider
     {
         AuthenticationContexts = new AuthenticationContexts(serviceProvider.AuthenticationContexts.Select(c => ToAuthenticationContext(c))) { Comparison = serviceProvider.AuthenticationContexts.Comparison },
         Endpoints = new ServiceProviderEndpoints(serviceProvider.Endpoints.Select(e => ToServiceProviderEndpoint(e))),
         Id = serviceProvider.Id,
         NameIdFormats = new NameIdFormats(serviceProvider.NameIdFormats.Select(f => ToNameIdFormat(f))),
         Server = serviceProvider.Server,
         SigningCertificate = serviceProvider.SigningCertificate.GetCertificate()
     };
 }
 /// <summary>
 /// Determina si el proveedor solicitado existe o no. para lanzar una exepcion en caso de que no exista.
 /// </summary>
 /// <param name="providerName"></param>
 /// <param name="provider"></param>
 internal static void CheckProvider(string providerName, ServiceProviderElement provider)
 {
     if (provider == null)
     {
         if (string.IsNullOrEmpty(providerName))
         {
             throw GetTechnicalException(string.Format(Fwk.Bases.Properties.Resources.ServiceManagement_MetadataProviderNotFound, "por defecto"), "7201", null);
         }
         else
         {
             throw GetTechnicalException(string.Format(Fwk.Bases.Properties.Resources.ServiceManagement_MetadataProviderNotFound, providerName), "7201", null);
         }
     }
 }
        ///date:2013-03-02 No se utilizara la actualizacion
        //private static FileSystemWatcher watcher;

        /// <summary>
        /// Obtiene todos los servicios del proveedor de metadata
        /// </summary>
        /// <param name="provider">Proveedor de la metadata</param>
        /// <returns></returns>
        public static ServiceConfigurationCollection GetAllServices(ServiceProviderElement provider)
        {
            ServiceConfigurationCollection svcList = null;

            //Si no esta cargado el provider en el repositorio
            if (!_Repository.ContainsKey(provider.Name))
            {
                #region xml

                ///date:2013-03-02 No se utilizara la actualizacion
                if (provider.ProviderType == ServiceProviderType.xml)
                {
                    //{
                    svcList = XmlServiceConfigurationManager.GetAllServices(provider.SourceInfo);
                }

                //    //Habilito FileSystemWatcher para detectar cualquie cambio sobre la metadata
                //    watcher = new System.IO.FileSystemWatcher();
                //    watcher.Filter = provider.SourceInfo;

                //    watcher.Path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location;
                //    watcher.EnableRaisingEvents = true;

                //    watcher.Changed += new FileSystemEventHandler(watcher_Changed);

                //}
                #endregion

                #region sqldatabase
                if (provider.ProviderType == ServiceProviderType.sqldatabase)
                {
                    svcList = DatabaseServiceConfigurationManager.GetAllServices(provider.ApplicationId, provider.SourceInfo);
                }
                #endregion
                try
                {
                    ///Se agrega try cath debido a que un subproseso pueda intentar agregar un item y aexistente
                    _Repository.Add(provider.Name, svcList);
                }
                catch (Exception)
                { }
            }
            else
            {
                svcList = _Repository[provider.Name];
            }

            return(svcList);
        }
Beispiel #18
0
        /// <summary>
        /// Obtiene info del proveedor de metadata
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <returns></returns>
        public static MetadataProvider GetProviderInfo(string providerName)
        {
            ServiceProviderElement provider = ServiceMetadata.ProviderSection.GetProvider(providerName);

            ServiceMetadata.CheckProvider(providerName, provider);
            //if (provider == null)
            //{
            //    if (string.IsNullOrEmpty(providerName))
            //        throw GetTechnicalException("No se encuentra configurado un proveedor de metadatos de servicios por defecto en el despachador de servicios \r\n", "7201", null);
            //    else
            //        throw GetTechnicalException(string.Format("No se encuentra configurado el proveedor de metadatos de servicios con el nombre \"{0}\" en el despachador de servicios \r\n", providerName),"7201", null);
            //}

            return(new MetadataProvider(provider));
        }
        void AddNewProvider(ServiceProviderElement newProvider)
        {
            try
            {
                ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];
                config.Providers.Add(newProvider);

                configuration.Save(ConfigurationSaveMode.Minimal, true);

                ServiceMetadata.ProviderSection.Providers.Add(newProvider);
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }
        }
Beispiel #20
0
        public void Populate(Provider pProvider)
        {
            Provider = new ServiceProviderElement();
            Provider.ApplicationId        = pProvider.ApplicationId;
            Provider.Name                 = pProvider.Name;
            Provider.SecurityProviderName = pProvider.SecurityProviderName;
            Provider.ProviderType         = pProvider.ProviderType;
            Provider.SourceInfo           = pProvider.SourceInfo;


            if (pProvider == null)
            {
                return;
            }
            SetProvider();
        }
Beispiel #21
0
        public void CheckProvider()
        {
            ExeConfigurationFileMap map = new ExeConfigurationFileMap();

            map.ExeConfigFilename = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config";
            configuration         = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);


            ServiceProviderElement provider = new ServiceProviderElement();

            provider.Name          = "proividertest";
            provider.ApplicationId = "apptest";

            provider.ProviderType = ServiceProviderType.xml;
            AddNewProvider(provider);
        }
Beispiel #22
0
        void cnfg()
        {
            provider1.SetConnected(false);

            ComboBox cb = (ComboBox)cmbProviders.Control;

            foreach (ServiceProviderElement p in ServiceMetadata.ProviderSection.Providers)
            {
                cb.Items.Add(p.Name);
            }

            cmbProviders.SelectedIndex = 0;
            CurrentProvider            = ServiceMetadata.ProviderSection.GetProvider(cmbProviders.SelectedItem.ToString());
            provider1.Populate(CurrentProvider);

            cb.SelectedValueChanged += new EventHandler(cb_SelectedValueChanged);
        }
        ///date:2013-03-02 No se utilizara la actualizacion
        ///// <summary>
        ///// Si algun cambio ocurre en el archivo de metadata de algun proveedor xml
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //static void watcher_Changed(object sender, FileSystemEventArgs e)
        //{
        //    try
        //    {
        //        //Busco todos los providers que esten asociados al mismo archivo. Esta es una situacion muy rara pero podria darce
        //        foreach (ServiceProviderElement provider in _ProviderSection.Providers)
        //        {
        //            if (e.Name.Equals(provider.SourceInfo) && provider.ProviderType == ServiceProviderType.xml)
        //                ReloadAllServices(provider);
        //        }
        //    }
        //    catch (TechnicalException ex)
        //    {
        //        Fwk.Logging.Event ev = new Event();
        //        ev.LogType = EventType.Error;
        //        ev.Machine = ex.Machine;
        //        ev.User = ex.UserName;
        //        String str = string.Concat(
        //            "Se intento modificar la metadata de servicios y se arrojó el siguiente error \r\n",
        //            Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex),
        //            "\r\n la metadata se encuentra en: \r\n",
        //            e.FullPath);

        //        ev.Message.Text = str;

        //        Fwk.Logging.StaticLogger.Log(Fwk.Logging.Targets.TargetType.WindowsEvent, ev, null, null);

        //    }
        //}

        /// <summary>
        /// Este metodo elimina quita la lista de servicios del provider en el repositorio deservicios y
        /// los vuelve a cargar desde su origen
        /// </summary>
        /// <param name="provider">Proveedor de metadata</param>
        static void ReloadAllServices(ServiceProviderElement provider)
        {
            ///date:2013-03-02 No se utilizara la actualizacion
            //_Repository.Remove(provider.Name);

            if (provider.ProviderType == ServiceProviderType.xml)
            {
                ServiceConfigurationCollection svcList = XmlServiceConfigurationManager.GetAllServices(provider.SourceInfo);

                //    Habilito FileSystemWatcher para detectar cualquie cambio sobre la metadata
                //watcher = new System.IO.FileSystemWatcher();
                //watcher.Filter = provider.SourceInfo;
                //watcher.Path = System.Reflection.Assembly.GetExecutingAssembly().Location;
                //watcher.EnableRaisingEvents = true;

                //watcher.Changed += new FileSystemEventHandler(watcher_Changed);
            }
        }
Beispiel #24
0
        public frmExport2(ServiceProviderElement from, ServiceProviderElement to, ServiceConfigurationCollection services)
        {
            InitializeComponent();
            _SourceProvider   = from;
            _SelectedProvider = to;
            _Services         = services;

            if (string.IsNullOrEmpty(_SelectedProvider.ApplicationId))
            {
                txtAppId.Enabled = true;
                txtAppId.Text    = string.Empty;
            }
            else
            {
                txtAppId.Enabled = false;
                txtAppId.Text    = _SelectedProvider.ApplicationId;
            }
        }
Beispiel #25
0
        public void UpdateAppConfig()
        {
            //ExeConfigurationFileMap map = new ExeConfigurationFileMap();
            //map.ExeConfigFilename = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config";
            //System.Configuration.Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
            //ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];


            ServiceProviderElement p1 = new ServiceProviderElement();

            p1.ApplicationId = "xxx";
            p1.Name          = "p1";
            p1.SourceInfo    = "";
            //config.Providers.Add(p1);
            //configuration.Save(ConfigurationSaveMode.Modified,true);

            ServiceMetadata.ProviderSection.AddNewProvider(p1);
        }
Beispiel #26
0
        public frmExport2(ServiceProviderElement from, ServiceProviderElement to, ServiceConfigurationCollection services)
        {
            InitializeComponent();
            _SourceProvider = from;
            _SelectedProvider = to;
            _Services = services;

            if (string.IsNullOrEmpty(_SelectedProvider.ApplicationId))
            {
                txtAppId.Enabled = true;
                txtAppId.Text = string.Empty;
            }
            else 
            {
                txtAppId.Enabled = false;
                txtAppId.Text = _SelectedProvider.ApplicationId;
            }
        }
Beispiel #27
0
        public void UpdateAppConfig()
        {
            

            //ExeConfigurationFileMap map = new ExeConfigurationFileMap();
            //map.ExeConfigFilename = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config";
            //System.Configuration.Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
            //ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"]; 


            ServiceProviderElement p1 = new ServiceProviderElement ();
            p1.ApplicationId = "xxx";
            p1.Name = "p1";
            p1.SourceInfo = "";
            //config.Providers.Add(p1);
            //configuration.Save(ConfigurationSaveMode.Modified,true);
           
            ServiceMetadata.ProviderSection.AddNewProvider(p1);
        }
Beispiel #28
0
 private ServiceProvider ToServiceProvider(ServiceProviderElement serviceProvider)
 {
     if (serviceProvider == null)
     {
         return(null);
     }
     return(new ServiceProvider
     {
         AuthenticationContexts = new AuthenticationContexts(serviceProvider.AuthenticationContexts.Select(c => ToAuthenticationContext(c)))
         {
             Comparison = serviceProvider.AuthenticationContexts.Comparison
         },
         Endpoints = new ServiceProviderEndpoints(serviceProvider.Endpoints.Select(e => ToServiceProviderEndpoint(e))),
         Id = serviceProvider.Id,
         NameIdFormats = new NameIdFormats(serviceProvider.NameIdFormats.Select(f => ToNameIdFormat(f))),
         Server = serviceProvider.Server,
         SigningCertificate = serviceProvider.SigningCertificate.GetCertificate()
     });
 }
Beispiel #29
0
        void cb_SelectedValueChanged(object sender, EventArgs e)
        {
            CurrentProvider = ServiceMetadata.ProviderSection.GetProvider(cmbProviders.SelectedItem.ToString());

            provider1.Populate(CurrentProvider);

            try
            {
                ucbServiceGrid1.Services = Fwk.ServiceManagement.ServiceMetadata.GetAllServices(CurrentProvider.Name);

                ucbServiceGrid1.Applications = Fwk.ServiceManagement.ServiceMetadata.GetAllApplicationsId(CurrentProvider.Name);
                provider1.SetConnected(true);
            }
            catch (Exception ex)
            {
                base.ExceptionViewer.Show(ex);
                provider1.SetConnected(false);
                ucbServiceGrid1.Services = null;
            }
        }
        /// <summary>
        /// Obtine un servicio del repositorio
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <param name="serviceName">Nombre del servicio</param>
        /// <returns></returns>
        public static ServiceConfiguration GetServiceConfiguration(string providerName, string serviceName)
        {
            ServiceConfiguration   svc      = null;
            ServiceProviderElement provider = GetProvider(providerName);

            ServiceConfigurationCollection svcList = GetAllServices(provider);

            svc = svcList.GetServiceConfiguration(serviceName, provider.ApplicationId);


            if (svc == null)
            {
                Exceptions.TechnicalException te = new Exceptions.TechnicalException(
                    string.Format("El servicio {0} no se encuentra configurado.\r\nProveedor de Metadata: {1}\r\nApplicationId: {2}\r\n", serviceName, provider.Name, provider.ApplicationId));
                te.ErrorId = "7002";
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <ServiceMetadata>(te);
                throw te;
            }

            return(svc);
        }
        /// <summary>
        /// Obtiene una lista de metadata de servicios
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <returns></returns>
        public static ServiceConfigurationCollection GetAllServices(string providerName)
        {
            ServiceProviderElement provider = GetProvider(providerName);

            return(GetAllServices(provider));
        }
Beispiel #32
0
        void cnfg()
        {
            
          
            
            provider1.SetConnected(false);

            ComboBox cb = (ComboBox)cmbProviders.Control;

            foreach (ServiceProviderElement p in ServiceMetadata.ProviderSection.Providers)
            {
                cb.Items.Add(p.Name);
            }

            cmbProviders.SelectedIndex = 0;
            CurrentProvider = ServiceMetadata.ProviderSection.GetProvider(cmbProviders.SelectedItem.ToString());
            provider1.Populate(CurrentProvider);

            cb.SelectedValueChanged += new EventHandler(cb_SelectedValueChanged);

        }
  /// <summary>
  /// Constructor de ConfigProviderSection.
  /// </summary>
 public ServiceProviderSection()
  {
      _ServiceProviderElement = new ServiceProviderElement();
    
  }
Beispiel #34
0
 public frmExport1(ServiceProviderElement sourceProvider)
 {
     _SourceProvider = sourceProvider;
     InitializeComponent(); 
     LoadConfig();
 }
Beispiel #35
0
        void cb_SelectedValueChanged(object sender, EventArgs e)
        {

            CurrentProvider = ServiceMetadata.ProviderSection.GetProvider(cmbProviders.SelectedItem.ToString());

            provider1.Populate(CurrentProvider);
           
            try
            {

               ucbServiceGrid1.Services = Fwk.ServiceManagement.ServiceMetadata.GetAllServices(CurrentProvider.Name);

                ucbServiceGrid1.Applications = Fwk.ServiceManagement.ServiceMetadata.GetAllApplicationsId(CurrentProvider.Name);
                provider1.SetConnected(true);
            }
            catch (Exception ex)
            {

                base.ExceptionViewer.Show(ex);
                provider1.SetConnected(false);
                ucbServiceGrid1.Services = null;

            }
        }
        /// <summary>
        /// Agrega un nuevo proveedor si este no existe
        /// </summary>
        /// <param name="newProvider"></param>
        public void AddNewProvider(ServiceProviderElement newProvider)
        {
            if (this.GetProvider(newProvider.Name) == null)
            {
                this.Providers.Add(newProvider);

                //ExeConfigurationFileMap map = new ExeConfigurationFileMap();
                //map.ExeConfigFilename = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config";
                //map.ExeConfigFilename = AssemblyDirectory();
                //System.Configuration.Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
                //ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];


                //config.Providers.Add(newProvider);
                //configuration.Save(ConfigurationSaveMode.Minimal, true);
                
            }
        }
Beispiel #37
0
        /// <summary>
        /// Determina si el proveedor solicitado existe o no. para lanzar una exepcion en caso de que no exista.
        /// </summary>
        /// <param name="providerName"></param>
        /// <param name="provider"></param>
        internal static void CheckProvider(string providerName, ServiceProviderElement provider)
        {
            if (provider == null)
                if (string.IsNullOrEmpty(providerName))
                    throw GetTechnicalException(string.Format(Fwk.Bases.Properties.Resources.ServiceManagement_MetadataProviderNotFound, "por defecto"), "7201", null);
                else
                    throw GetTechnicalException(string.Format(Fwk.Bases.Properties.Resources.ServiceManagement_MetadataProviderNotFound, providerName), "7201", null);

        }
Beispiel #38
0
        public void CheckProvider()
        {
            ExeConfigurationFileMap map = new ExeConfigurationFileMap();
            map.ExeConfigFilename = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config";
            configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);


            ServiceProviderElement provider = new ServiceProviderElement();
            provider.Name = "proividertest";
            provider.ApplicationId = "apptest";

            provider.ProviderType = ServiceProviderType.xml;
            AddNewProvider(provider);

        }
Beispiel #39
0
        void AddNewProvider(ServiceProviderElement newProvider)
        {
            try
            {

                ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];
                config.Providers.Add(newProvider);

                configuration.Save(ConfigurationSaveMode.Minimal, true);
                
                ServiceMetadata.ProviderSection.Providers.Add(newProvider);
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }
        }
 /// <summary>
 /// Retorna el índice del proveedor de metadata.
 /// </summary>
 /// <param name="configProviderElement">ConfigProviderElement que se desea conocer su </param>
 /// <returns>índice</returns>
 public int IndexOf(ServiceProviderElement configProviderElement)
 {
     return BaseIndexOf(configProviderElement);
 }
Beispiel #41
0
        ///date:2013-03-02 No se utilizara la actualizacion
        ///// <summary>
        ///// Si algun cambio ocurre en el archivo de metadata de algun proveedor xml
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //static void watcher_Changed(object sender, FileSystemEventArgs e)
        //{
        //    try
        //    {
        //        //Busco todos los providers que esten asociados al mismo archivo. Esta es una situacion muy rara pero podria darce
        //        foreach (ServiceProviderElement provider in _ProviderSection.Providers)
        //        {
        //            if (e.Name.Equals(provider.SourceInfo) && provider.ProviderType == ServiceProviderType.xml)
        //                ReloadAllServices(provider);
        //        }
        //    }
        //    catch (TechnicalException ex)
        //    {
        //        Fwk.Logging.Event ev = new Event();
        //        ev.LogType = EventType.Error;
        //        ev.Machine = ex.Machine;
        //        ev.User = ex.UserName;
        //        String str = string.Concat(
        //            "Se intento modificar la metadata de servicios y se arrojó el siguiente error \r\n",
        //            Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex),
        //            "\r\n la metadata se encuentra en: \r\n",
        //            e.FullPath);

        //        ev.Message.Text = str;

        //        Fwk.Logging.StaticLogger.Log(Fwk.Logging.Targets.TargetType.WindowsEvent, ev, null, null);

        //    }
        //}

        /// <summary>
        /// Este metodo elimina quita la lista de servicios del provider en el repositorio deservicios y 
        /// los vuelve a cargar desde su origen
        /// </summary>
        /// <param name="provider">Proveedor de metadata</param>
        static void ReloadAllServices(ServiceProviderElement provider)
        {
             ///date:2013-03-02 No se utilizara la actualizacion
            //_Repository.Remove(provider.Name);

            if (provider.ProviderType == ServiceProviderType.xml)
            {
                ServiceConfigurationCollection svcList = XmlServiceConfigurationManager.GetAllServices(provider.SourceInfo);

                //    Habilito FileSystemWatcher para detectar cualquie cambio sobre la metadata
                //watcher = new System.IO.FileSystemWatcher();
                //watcher.Filter = provider.SourceInfo;
                //watcher.Path = System.Reflection.Assembly.GetExecutingAssembly().Location;
                //watcher.EnableRaisingEvents = true;

                //watcher.Changed += new FileSystemEventHandler(watcher_Changed);

            }


        }
Beispiel #42
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Validate()) return;
            CreatedProvider = new ServiceProviderElement();
            if (cboType.Text == "xml")
            {
                CreatedProvider.SourceInfo = txtSource.Text;
            }
            else
            {
                CreatedProvider.SourceInfo = txtCnnStringName.Text;
                AddNewCnnString();
            }

            CreatedProvider.Name = txtName.Text;
            CreatedProvider.ApplicationId = txtApplicationId.Text;

            CreatedProvider.ProviderType = (ServiceProviderType)Enum.Parse(typeof(ServiceProviderType), cboType.Text);
            AddNewProvider(CreatedProvider);

            this.DialogResult = DialogResult.OK; 
        }
Beispiel #43
0
 public frmExport1(ServiceProviderElement sourceProvider)
 {
     _SourceProvider = sourceProvider;
     InitializeComponent();
     LoadConfig();
 }
Beispiel #44
0
 public void Populate(ServiceProviderElement pProvider)
 {
     Provider = pProvider;
     if (pProvider == null) return;
     SetProvider();
 }
 /// <summary>
 /// Agrega un nuevo proveedor si este no existe
 /// </summary>
 /// <param name="name"></param>
 /// <param name="sourceInfo"></param>
 /// <param name="applicationId"></param>
 /// <param name="type"></param>
 public void AddNewProvider(string name, string sourceInfo, string applicationId, ServiceProviderType type)
 {
     
         ServiceProviderElement p = new ServiceProviderElement();
         p.Name = name;
         p.SourceInfo = sourceInfo;
         p.ApplicationId = applicationId;
         p.ProviderType = type;
         this.AddNewProvider(p);
     
 }
Beispiel #46
0
        ///date:2013-03-02 No se utilizara la actualizacion
        //private static FileSystemWatcher watcher;

        /// <summary>
        /// Obtiene todos los servicios del proveedor de metadata
        /// </summary>
        /// <param name="provider">Proveedor de la metadata</param>
        /// <returns></returns>
        public static ServiceConfigurationCollection GetAllServices(ServiceProviderElement provider)
        {
            ServiceConfigurationCollection svcList = null;

            //Si no esta cargado el provider en el repositorio
            if (!_Repository.ContainsKey(provider.Name))
            {
                #region xml

                ///date:2013-03-02 No se utilizara la actualizacion
                if (provider.ProviderType == ServiceProviderType.xml)
                //{
                    svcList = XmlServiceConfigurationManager.GetAllServices(provider.SourceInfo);

                //    //Habilito FileSystemWatcher para detectar cualquie cambio sobre la metadata
                //    watcher = new System.IO.FileSystemWatcher();
                //    watcher.Filter = provider.SourceInfo;

                //    watcher.Path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location;
                //    watcher.EnableRaisingEvents = true;

                //    watcher.Changed += new FileSystemEventHandler(watcher_Changed);

                //}
                #endregion

                #region sqldatabase
                if (provider.ProviderType == ServiceProviderType.sqldatabase)
                {
                    svcList = DatabaseServiceConfigurationManager.GetAllServices(provider.ApplicationId, provider.SourceInfo);
                }
                #endregion
                try
                {
                    ///Se agrega try cath debido a que un subproseso pueda intentar agregar un item y aexistente
                    _Repository.Add(provider.Name, svcList);
                }
                catch (Exception )
                { }
            }
            else
                svcList = _Repository[provider.Name];

            return svcList;
        }
Beispiel #47
0
        void AddNewProvider(ServiceProviderElement newProvider)
        {

            ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];
            config.Providers.Add(newProvider);
            configuration.Save(ConfigurationSaveMode.Minimal, true);

            ServiceMetadata.ProviderSection.Providers.Add(newProvider);
        }