internal DelayLoadClientChannelEntry(RemotingXmlConfigFileData.ChannelEntry entry, bool ensureSecurity)
 {
     this._entry = entry;
     this._channel = null;
     this._bRegistered = false;
     this._ensureSecurity = ensureSecurity;
 }
 private static void ConfigureChannels(RemotingXmlConfigFileData configData, bool ensureSecurity)
 {
     RemotingServices.RegisterWellKnownChannels();
     foreach (RemotingXmlConfigFileData.ChannelEntry entry in configData.ChannelEntries)
     {
         if (!entry.DelayLoad)
         {
             ChannelServices.RegisterChannel(CreateChannelFromConfigEntry(entry), ensureSecurity);
         }
         else
         {
             _delayLoadChannelConfigQueue.Enqueue(new DelayLoadClientChannelEntry(entry, ensureSecurity));
         }
     }
 }
 private static void ConfigureRemoting(RemotingXmlConfigFileData configData, bool ensureSecurity)
 {
     try
     {
         string applicationName = configData.ApplicationName;
         if (applicationName != null)
         {
             ApplicationName = applicationName;
         }
         if (configData.CustomErrors != null)
         {
             _errorMode = configData.CustomErrors.Mode;
         }
         ConfigureChannels(configData, ensureSecurity);
         if (configData.Lifetime != null)
         {
             if (configData.Lifetime.IsLeaseTimeSet)
             {
                 LifetimeServices.LeaseTime = configData.Lifetime.LeaseTime;
             }
             if (configData.Lifetime.IsRenewOnCallTimeSet)
             {
                 LifetimeServices.RenewOnCallTime = configData.Lifetime.RenewOnCallTime;
             }
             if (configData.Lifetime.IsSponsorshipTimeoutSet)
             {
                 LifetimeServices.SponsorshipTimeout = configData.Lifetime.SponsorshipTimeout;
             }
             if (configData.Lifetime.IsLeaseManagerPollTimeSet)
             {
                 LifetimeServices.LeaseManagerPollTime = configData.Lifetime.LeaseManagerPollTime;
             }
         }
         _bUrlObjRefMode = configData.UrlObjRefMode;
         Info.StoreRemoteAppEntries(configData);
         Info.StoreActivatedExports(configData);
         Info.StoreInteropEntries(configData);
         Info.StoreWellKnownExports(configData);
         if (configData.ServerActivatedEntries.Count > 0)
         {
             ActivationServices.StartListeningForRemoteRequests();
         }
     }
     catch (Exception exception)
     {
         throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ConfigurationFailure"), new object[] { exception }));
     }
 }
コード例 #4
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
            //
            // XML Configuration Helper Functions
            //

            internal void StoreActivatedExports(RemotingXmlConfigFileData configData)
            {
                foreach (RemotingXmlConfigFileData.TypeEntry entry in configData.ServerActivatedEntries)
                {
                    ActivatedServiceTypeEntry aste =
                        new ActivatedServiceTypeEntry(entry.TypeName, entry.AssemblyName);
                    aste.ContextAttributes = 
                        CreateContextAttributesFromConfigEntries(entry.ContextAttributes);
                
                    RemotingConfiguration.RegisterActivatedServiceType(aste);
                }
            } // StoreActivatedExports
コード例 #5
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
        [System.Security.SecurityCritical]  // auto-generated
        internal static IChannel CreateChannelFromConfigEntry(
            RemotingXmlConfigFileData.ChannelEntry entry)
        {       
            Type type = RemotingConfigInfo.LoadType(entry.TypeName, entry.AssemblyName);
            
            bool isServerChannel = typeof(IChannelReceiver).IsAssignableFrom(type);
            bool isClientChannel = typeof(IChannelSender).IsAssignableFrom(type);

            IClientChannelSinkProvider clientProviderChain = null;
            IServerChannelSinkProvider serverProviderChain = null;

            if (entry.ClientSinkProviders.Count > 0)
                clientProviderChain = CreateClientChannelSinkProviderChain(entry.ClientSinkProviders);
            if (entry.ServerSinkProviders.Count > 0)
                serverProviderChain = CreateServerChannelSinkProviderChain(entry.ServerSinkProviders);

            // construct argument list
            Object[] args;
            
            if (isServerChannel && isClientChannel)
            {
                args = new Object[3];
                args[0] = entry.Properties;
                args[1] = clientProviderChain;
                args[2] = serverProviderChain;
            }
            else
            if (isServerChannel)
            {
                args = new Object[2];
                args[0] = entry.Properties;
                args[1] = serverProviderChain;
            }
            else
            if (isClientChannel)
            {
                args = new Object[2];
                args[0] = entry.Properties;
                args[1] = clientProviderChain;
            }
            else
            {
                throw new RemotingException(
                    String.Format(
                        CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_InvalidChannelType"), 
                    type.FullName));
            }

            IChannel channel = null;

            try
            {
                channel = (IChannel)Activator.CreateInstance(type, 
                                                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, 
                                                        null, 
                                                        args, 
                                                        null, 
                                                        null);

            }
            catch (MissingMethodException)
            {
                String ctor = null;
                
                if (isServerChannel && isClientChannel)
                    ctor = "MyChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)";
                else
                if (isServerChannel)
                    ctor = "MyChannel(IDictionary properties, IServerChannelSinkProvider serverSinkProvider)";
                else
                if (isClientChannel)
                    ctor = "MyChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider)";
                
                throw new RemotingException(
                    String.Format(
                        CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ChannelMissingCtor"),
                    type.FullName, ctor));
            }
            
            return channel;
        } //  CreateChannelFromEntry
コード例 #6
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
        [System.Security.SecurityCritical]  // auto-generated
        private static void ConfigureRemoting(RemotingXmlConfigFileData configData, bool ensureSecurity)
        {
            try
            {
                String appName = configData.ApplicationName;
                if (appName != null)
                    ApplicationName = appName;
                
                if (configData.CustomErrors != null)
                    _errorMode = configData.CustomErrors.Mode;

                // configure channels
                ConfigureChannels(configData, ensureSecurity);
            
                // configure lifetime
                if (configData.Lifetime != null)
                {
                    if (configData.Lifetime.IsLeaseTimeSet)
                        LifetimeServices.LeaseTime = configData.Lifetime.LeaseTime;
                    if (configData.Lifetime.IsRenewOnCallTimeSet)
                        LifetimeServices.RenewOnCallTime = configData.Lifetime.RenewOnCallTime;
                    if (configData.Lifetime.IsSponsorshipTimeoutSet)    
                        LifetimeServices.SponsorshipTimeout = configData.Lifetime.SponsorshipTimeout;
                    if (configData.Lifetime.IsLeaseManagerPollTimeSet)
                        LifetimeServices.LeaseManagerPollTime = configData.Lifetime.LeaseManagerPollTime;
                }

                _bUrlObjRefMode = configData.UrlObjRefMode;

                // configure other entries
                Info.StoreRemoteAppEntries(configData);
                Info.StoreActivatedExports(configData);
                Info.StoreInteropEntries(configData);
                Info.StoreWellKnownExports(configData);

                // start up activation listener if there are any activated objects exposed
                if (configData.ServerActivatedEntries.Count > 0)
                    ActivationServices.StartListeningForRemoteRequests();                
            }
            catch (Exception e)
            {
                throw new RemotingException(
                    String.Format(
                        CultureInfo.CurrentCulture, Environment.GetResourceString(
                            "Remoting_Config_ConfigurationFailure"),                        
                        e));
            }
        } // ConfigureRemoting
コード例 #7
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
            } // StoreInteropEntries

            internal void StoreRemoteAppEntries(RemotingXmlConfigFileData configData)
            {
                char[] slash = new char[]{'/'};
            
                // add each remote app to the table
                foreach (RemotingXmlConfigFileData.RemoteAppEntry remApp in configData.RemoteAppEntries)
                {
                    // form complete application uri by combining specified uri with app-name
                    //  (make sure appUri ends with slash, and that app name doesn't start,
                    //   with one. then make sure that the combined form has no trailing slashes).
                    String appUri = remApp.AppUri;
                    if ((appUri != null) && !appUri.EndsWith("/", StringComparison.Ordinal))
                        appUri = appUri.TrimEnd(slash);
                        
                    // add each client activated type for this remote app
                    foreach (RemotingXmlConfigFileData.TypeEntry cae in remApp.ActivatedObjects)
                    {
                        ActivatedClientTypeEntry acte = 
                            new ActivatedClientTypeEntry(cae.TypeName, cae.AssemblyName, 
                                                         appUri);
                        acte.ContextAttributes = 
                            CreateContextAttributesFromConfigEntries(cae.ContextAttributes);
                   
                        RemotingConfiguration.RegisterActivatedClientType(acte);
                    }

                    // add each well known object for this remote app
                    foreach (RemotingXmlConfigFileData.ClientWellKnownEntry cwke in remApp.WellKnownObjects)
                    {                    
                        WellKnownClientTypeEntry wke = 
                            new WellKnownClientTypeEntry(cwke.TypeName, cwke.AssemblyName, 
                                                         cwke.Url);
                        wke.ApplicationUrl = appUri;
                        
                        RemotingConfiguration.RegisterWellKnownClientType(wke);
                    }          
                }
            } // StoreRemoteAppEntries            
コード例 #8
0
        } // ProcessServiceNode


        // appears under "application"
        private static void ProcessClientNode(ConfigNode node, RemotingXmlConfigFileData configData)
        {
            String remoteAppUri = null;

            // process attributes
            foreach (DictionaryEntry entry in node.Attributes)
            {
                String key = entry.Key.ToString();
                switch (key)
                {
                case "url": remoteAppUri = (String)entry.Value; break;

                case "displayName": break; // displayName is ignored (used by config utility for labelling the application)

                default: break;
                } // switch
            } // foreach attribute

            RemotingXmlConfigFileData.RemoteAppEntry remoteApp =
                configData.AddRemoteAppEntry(remoteAppUri);            

            // process child nodes
            foreach (ConfigNode childNode in node.Children)
            {
                switch (childNode.Name)
                {
                case "wellknown": ProcessClientWellKnownNode(childNode, configData, remoteApp); break;
                case "activated": ProcessClientActivatedNode(childNode, configData, remoteApp); break;

                default: break;
                } // switch
            } // foreach child node


            // if there are any activated entries, we require a remote app url.
            if ((remoteApp.ActivatedObjects.Count > 0) && (remoteAppUri == null))
                ReportMissingAttributeError(node, "url", configData);
        } // ProcessClientNode
コード例 #9
0
        private static void ProcessLifetimeNode(ConfigNode parentNode, ConfigNode node, RemotingXmlConfigFileData configData)
        {
            if (configData.Lifetime != null)
                ReportUniqueSectionError(node, parentNode, configData);
        
            configData.Lifetime = new RemotingXmlConfigFileData.LifetimeEntry();

            foreach (DictionaryEntry entry in node.Attributes)
            {
                String key = entry.Key.ToString();
                switch (key)
                {
                
                case "leaseTime": 
                    configData.Lifetime.LeaseTime = ParseTime((String)entry.Value, configData);
                    break;
                    
                case "sponsorshipTimeout":
                    configData.Lifetime.SponsorshipTimeout = ParseTime((String)entry.Value, configData);
                    break;

                case "renewOnCallTime":
                    configData.Lifetime.RenewOnCallTime = ParseTime((String)entry.Value, configData);
                    break;

                case "leaseManagerPollTime":
                    configData.Lifetime.LeaseManagerPollTime = ParseTime((String)entry.Value, configData);
                    break;

                default: break;
                
                } // switch
            } // foreach
            
        } // ProcessLifetimeNode
コード例 #10
0
        } // ReportUnknownValueError

        private static void ReportMissingAttributeError(ConfigNode node, String attributeName,
                                                        RemotingXmlConfigFileData configData)
        {
            ReportMissingAttributeError(node.Name, attributeName, configData);
        } // ReportMissingAttributeError
コード例 #11
0
        } // ReportUniqueSectionError

        private static void ReportUnknownValueError(ConfigNode node, String value,
                                                        RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_UnknownValue"),
                    node.Name, value),
                configData);
        } // ReportUnknownValueError
コード例 #12
0
        } // ReportError

        // means section must be unique
        private static void ReportUniqueSectionError(ConfigNode parent, ConfigNode child,
                                                     RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_NodeMustBeUnique"),
                    child.Name, parent.Name),
                configData);
        } // ReportUniqueSectionError
コード例 #13
0
        } // ParseConfigFile


        private static void ReportError(String errorStr, RemotingXmlConfigFileData configData)
        {
            // <

        
            throw new RemotingException(errorStr);
        } // ReportError
コード例 #14
0
        private static RemotingXmlConfigFileData ParseConfigNode(ConfigNode rootNode)
        {
            RemotingXmlConfigFileData configData = new RemotingXmlConfigFileData();
        
            // check to see if this file has a system.runtime.remoting section
            if (rootNode == null)
                return null;

            // process attributes
            foreach (DictionaryEntry entry in rootNode.Attributes)
            {
                String key = entry.Key.ToString();
                switch (key)
                {
                case "version":
                {
                    // we ignore the version attribute because this may be used
                    //   by the configuration system
                    break;
                }                
                    
                default: break;
                } // switch
            } // foreach

            ConfigNode appNode = null;       // "application" node
            ConfigNode channelsNode = null;  // "channels" node
            ConfigNode providerNode = null;  // "channelSinkProviders" node
            ConfigNode debugNode = null;     // "debug" node
            ConfigNode customErrorsNode = null;     // "customErrors" node
                        
            foreach (ConfigNode node in rootNode.Children)
            {
                switch (node.Name)
                {
                
                case "application":
                {
                    // there can only be one application node in a config file
                    if (appNode != null)
                        ReportUniqueSectionError(rootNode, appNode, configData);

                    appNode = node;
                    break;
                } // case "application"
                
                case "channels":
                {
                    if (channelsNode != null)
                        ReportUniqueSectionError(rootNode, channelsNode, configData);
                
                    channelsNode = node;
                    break;
                } // case "channels"

                case "channelSinkProviders":
                {
                    if (providerNode != null)
                        ReportUniqueSectionError(rootNode, providerNode, configData);
                
                    providerNode = node;
                    break;
                } // case "channelSinkProviders"

                case "debug":
                {
                    if (debugNode != null)
                        ReportUniqueSectionError(rootNode, debugNode, configData);
                
                    debugNode = node;
                    break;
                } // case "debug"
                
                case "customErrors":
                {
                    if (customErrorsNode != null)
                        ReportUniqueSectionError(rootNode, customErrorsNode, configData);
                
                    customErrorsNode = node;
                    break;
                }// case "customErrors"
                
                default: break;
                } // switch
            } // foreach


            if (debugNode != null)
                ProcessDebugNode(debugNode, configData);

            if (providerNode != null)
                ProcessChannelSinkProviderTemplates(providerNode, configData);

            if (channelsNode != null)
                ProcessChannelTemplates(channelsNode, configData);

            if (appNode != null)
                ProcessApplicationNode(appNode, configData);
            
            if (customErrorsNode != null)
                ProcessCustomErrorsNode(customErrorsNode, configData);                

            return configData;
        } // ParseConfigFile
コード例 #15
0
        } // CheckAssemblyNameForVersionInfo


        private static TimeSpan ParseTime(String time, RemotingXmlConfigFileData configData)
        {
            // time formats, e.g.
            //   10D -> 10 days
            //   10H -> 10 hours
            //   10M -> 10 minutes
            //   10S -> 10 seconds
            //   10MS -> 10 milliseconds
            //   10 -> default is seconds: 10 seconds

            String specifiedTime = time;

            String metric = "s"; // default is seconds
            int metricLength = 0;

            char lastChar = ' ';
            if (time.Length > 0)
                lastChar = time[time.Length - 1];

            TimeSpan span = TimeSpan.FromSeconds(0);         
            
            try
            {                                              
                if (!Char.IsDigit(lastChar))
                {
                    if (time.Length == 0)
                        ReportInvalidTimeFormatError(specifiedTime, configData);

                    time = time.ToLower(CultureInfo.InvariantCulture);

                    metricLength = 1;
                    if (time.EndsWith("ms", StringComparison.Ordinal))
                        metricLength = 2;
                    metric = time.Substring(time.Length - metricLength, metricLength);
                }   
                
                int value = Int32.Parse(time.Substring(0, time.Length - metricLength), CultureInfo.InvariantCulture);   
     
                switch (metric)
                {
                    case "d": span = TimeSpan.FromDays(value); break;
                    case "h": span = TimeSpan.FromHours(value); break;
                    case "m": span = TimeSpan.FromMinutes(value); break;
                    case "s": span = TimeSpan.FromSeconds(value); break;
                    case "ms": span = TimeSpan.FromMilliseconds(value); break;

                    default:
                    {
                        ReportInvalidTimeFormatError(specifiedTime, configData);
                        break;
                    }
                } // switch
                
            } 
            catch (Exception)
            {
                ReportInvalidTimeFormatError(specifiedTime, configData);
            }

            return span;
        } // ParseTime        
コード例 #16
0
        } // ProcessDebugNode
        

        private static void ProcessApplicationNode(ConfigNode node, RemotingXmlConfigFileData configData)
        {
            foreach (DictionaryEntry entry in node.Attributes)
            {
                String key = entry.Key.ToString();
                if (key.Equals("name"))
                    configData.ApplicationName = (String)entry.Value;
            }
        
            foreach (ConfigNode childNode in node.Children)
            {
                switch (childNode.Name)
                {
                case "channels": ProcessChannelsNode(childNode, configData); break;
                case "client": ProcessClientNode(childNode, configData); break;                                       
                case "lifetime": ProcessLifetimeNode(node, childNode, configData); break;
                case "service": ProcessServiceNode(childNode, configData); break;
                case "soapInterop": ProcessSoapInteropNode(childNode, configData); break;         

                default: break;
                } // switch
            } // foreach
        } // ProcessApplicationNode
コード例 #17
0
        } // ProcessApplicationNode

        private static void ProcessCustomErrorsNode(ConfigNode node, RemotingXmlConfigFileData configData) {
            foreach (DictionaryEntry entry in node.Attributes)
            {
                String key = entry.Key.ToString();
                if (key.Equals("mode")) {
                    string value = (string)entry.Value;
                    CustomErrorsModes mode = CustomErrorsModes.On;
                     
                    if (String.Compare(value, "on", StringComparison.OrdinalIgnoreCase) == 0)                                        
                        mode = CustomErrorsModes.On; 
                    else if (String.Compare(value, "off", StringComparison.OrdinalIgnoreCase) == 0)
                        mode = CustomErrorsModes.Off; 
                    else if (String.Compare(value, "remoteonly", StringComparison.OrdinalIgnoreCase) == 0)
                        mode = CustomErrorsModes.RemoteOnly; 
                    else
                        ReportUnknownValueError(node, value, configData);
                    
                    configData.CustomErrors = new RemotingXmlConfigFileData.CustomErrorsEntry(mode);
                }                                                        
            }
                        
        }
コード例 #18
0
        } // ReportMissingAttributeError

        private static void ReportMissingAttributeError(String nodeDescription, String attributeName,
                                                        RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_RequiredXmlAttribute"),
                    nodeDescription, attributeName),
                configData);
        } // ReportMissingAttributeError
コード例 #19
0
        } // ProcessLifetimeNode


        // appears under "application"
        private static void ProcessServiceNode(ConfigNode node, RemotingXmlConfigFileData configData)
        {       
            foreach (ConfigNode childNode in node.Children)
            {
                switch (childNode.Name)
                {
                case "wellknown": ProcessServiceWellKnownNode(childNode, configData); break;
                case "activated": ProcessServiceActivatedNode(childNode, configData); break;

                default: break;
                } // switch
            } // foreach
        } // ProcessServiceNode
コード例 #20
0
        } // ReportMissingAttributeError

        private static void ReportMissingXmlTypeAttributeError(ConfigNode node, String attributeName,
                                                               RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_MissingXmlTypeAttribute"),
                    node.Name, attributeName),
                configData);
        } // ReportMissingAttributeError
コード例 #21
0
        } // ProcessClientNode


        // appears under "application"
        private static void ProcessSoapInteropNode(ConfigNode node, RemotingXmlConfigFileData configData)
        {
            // process attributes
            foreach (DictionaryEntry entry in node.Attributes)
            {
                String key = entry.Key.ToString();
                switch (key)
                {
                case "urlObjRef":
                {
                    configData.UrlObjRefMode = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
                    break;
                }
                
                default: break;
                } // switch
            } // foreach attribute
        
            foreach (ConfigNode childNode in node.Children)
            {
                switch (childNode.Name)
                {
                case "preLoad": ProcessPreLoadNode(childNode, configData); break;
                case "interopXmlElement": ProcessInteropXmlElementNode(childNode, configData); break;
                case "interopXmlType": ProcessInteropXmlTypeNode(childNode, configData); break;

                default: break;
                } // switch
            }
        } // ProcessSoapInteropNode
コード例 #22
0
        } // ReportMissingAttributeError

        private static void ReportInvalidTimeFormatError(String time,
                                                         RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_InvalidTimeFormat"),
                    time),
                configData);
        } // ReportInvalidTypeFormatError
コード例 #23
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
 [System.Security.SecurityCritical]  // auto-generated
 internal void StoreWellKnownExports(RemotingXmlConfigFileData configData)
 {
     // <
 
     foreach (RemotingXmlConfigFileData.ServerWellKnownEntry entry in configData.ServerWellKnownEntries)
     {
         WellKnownServiceTypeEntry wke = 
             new WellKnownServiceTypeEntry(
                 entry.TypeName, entry.AssemblyName, entry.ObjectURI, 
                 entry.ObjectMode);
         wke.ContextAttributes = null;
     
         // Register the well known entry but do not startup the object
         RemotingConfigHandler.RegisterWellKnownServiceType(wke);
     }
 } // StoreWellKnownExports
コード例 #24
0
        } // ReportInvalidTypeFormatError

        // If nodes can be represented as a template, only a template version
        //   can have an 'id' attribute
        private static void ReportNonTemplateIdAttributeError(ConfigNode node, 
                                                              RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_NonTemplateIdAttribute"),
                    node.Name),
                configData);
        } // ReportNonTemplateIdAttributeError
コード例 #25
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
 [System.Security.SecurityCritical]  // auto-generated
 private static void ConfigureChannels(RemotingXmlConfigFileData configData, bool ensureSecurity)
 {
     // Register our x-context & x-AD channels first
     RemotingServices.RegisterWellKnownChannels();
     
     foreach (RemotingXmlConfigFileData.ChannelEntry entry in configData.ChannelEntries)
     {
         if (!entry.DelayLoad)
         {
             IChannel chnl = CreateChannelFromConfigEntry(entry);
             ChannelServices.RegisterChannel(chnl, ensureSecurity);
         }
         else
             _delayLoadChannelConfigQueue.Enqueue(new DelayLoadClientChannelEntry(entry, ensureSecurity));
     }
 } //  ConfigureChannels
コード例 #26
0
        } // ReportTemplateCannotReferenceTemplateError

        private static void ReportUnableToResolveTemplateReferenceError(
            ConfigNode node, String referenceName, 
            RemotingXmlConfigFileData configData)
        {
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_UnableToResolveTemplate"),
                    node.Name, referenceName),
                configData);
        } // ReportUnableToResolveTemplateReferenceError
コード例 #27
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
        [System.Security.SecurityCritical]  // auto-generated
        private static Object CreateChannelSinkProvider(RemotingXmlConfigFileData.SinkProviderEntry entry,
                                                        bool bServer)
        {
            Object sinkProvider = null;

            Type type = RemotingConfigInfo.LoadType(entry.TypeName, entry.AssemblyName);            

            if (bServer)
            {
                // make sure this is a client provider                
                if (!typeof(IServerChannelSinkProvider).IsAssignableFrom(type))
                {
                    throw new RemotingException(
                        String.Format(
                            CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_InvalidSinkProviderType"),
                            type.FullName,
                            "IServerChannelSinkProvider"));
                }
            }
            else
            {
                // make sure this is a server provider
                if (!typeof(IClientChannelSinkProvider).IsAssignableFrom(type))
                {
                    throw new RemotingException(
                        String.Format(
                            CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_InvalidSinkProviderType"),
                            type.FullName,
                            "IClientChannelSinkProvider"));
                }
            }

            // check to see if something labelled as a formatter is a formatter
            if (entry.IsFormatter)
            {
                if ((bServer && !typeof(IServerFormatterSinkProvider).IsAssignableFrom(type)) ||
                    (!bServer && !typeof(IClientFormatterSinkProvider).IsAssignableFrom(type)))
                {
                    throw new RemotingException(
                        String.Format(
                            CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_SinkProviderNotFormatter"),
                            type.FullName));
                }
            }                        
            
            // setup the argument list and call the constructor
            Object[] args = new Object[2];
            args[0] = entry.Properties;
            args[1] = entry.ProviderData;

            try
            {
                sinkProvider = Activator.CreateInstance(type, 
                                                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, 
                                                        null, 
                                                        args, 
                                                        null, 
                                                        null);
            }
            catch (MissingMethodException)
            {
                throw new RemotingException(
                    String.Format(
                        CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_SinkProviderMissingCtor"),
                        type.FullName, 
                        "MySinkProvider(IDictionary properties, ICollection providerData)"));
            }

            return sinkProvider;
        } // CreateChannelSinkProvider
コード例 #28
0
        } // ReportUnableToResolveTemplateReferenceError

        private static void ReportAssemblyVersionInfoPresent(
            String assemName, String entryDescription,
            RemotingXmlConfigFileData configData)
        {
            // for some entries, version information is not allowed in the assembly name
            ReportError(
                String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_VersionPresent"),
                    assemName, entryDescription),
                configData);
        } // ReportAssemblyVersionInfoPresent
コード例 #29
0
ファイル: configuration.cs プロジェクト: REALTOBIZ/mono
            [System.Security.SecurityCritical]  // auto-generated
            internal void StoreInteropEntries(RemotingXmlConfigFileData configData)
            {
                // process interop xml element entries
                foreach (RemotingXmlConfigFileData.InteropXmlElementEntry entry in
                         configData.InteropXmlElementEntries)
                {
                    Assembly assembly = Assembly.Load(entry.UrtAssemblyName);
                    Type type = assembly.GetType(entry.UrtTypeName);
                    SoapServices.RegisterInteropXmlElement(entry.XmlElementName,
                                                           entry.XmlElementNamespace,
                                                           type);
                }

                // process interop xml type entries
                foreach (RemotingXmlConfigFileData.InteropXmlTypeEntry entry in
                         configData.InteropXmlTypeEntries)
                {
                    Assembly assembly = Assembly.Load(entry.UrtAssemblyName);
                    Type type = assembly.GetType(entry.UrtTypeName);
                    SoapServices.RegisterInteropXmlType(entry.XmlTypeName,
                                                        entry.XmlTypeNamespace,
                                                        type);
                }

                // process preload entries
                foreach (RemotingXmlConfigFileData.PreLoadEntry entry in configData.PreLoadEntries)
                {
                    Assembly assembly = Assembly.Load(entry.AssemblyName);

                    if (entry.TypeName != null)
                    {
                        Type type = assembly.GetType(entry.TypeName);
                        SoapServices.PreLoad(type);
                    }
                    else
                    {
                        SoapServices.PreLoad(assembly);
                    }
                }
            } // StoreInteropEntries
コード例 #30
0
        } // ReportAssemblyVersionInfoPresent
       

        private static void ProcessDebugNode(ConfigNode node, RemotingXmlConfigFileData configData)
        {
            foreach (DictionaryEntry entry in node.Attributes)
            {
                String key = entry.Key.ToString();
                switch (key)
                {
                case "loadTypes":
                    RemotingXmlConfigFileData.LoadTypes = 
                        Convert.ToBoolean((String)entry.Value, CultureInfo.InvariantCulture);
                    break;
                    
                default: break;
                } // switch
            } // foreach
            
        } // ProcessDebugNode