Ejemplo n.º 1
0
        public void RegisterServiceComponent(IComponentProvider provider)
        {
            if (provider.MatchAgainstNameAllowed)
            {
                /* FIXME: We will need to do proper per-process cleanup in the future */
                foreach (IComponentProvider prov in componentDirectory.FindByName(provider.MatchedName))
                {
                    componentDirectory.UnRegister(prov);
                }
            }

            componentDirectory.Register(provider);
        }
Ejemplo n.º 2
0
        string[] RegisterAutoParametrization(IComponentDirectory destination, string[] args)
        {
            // We must add auto parametrization.
            ConfiguredComponent typeProvider = destination.FindByName(
                applicationDescriptor.ApplicationComponent)[0] as ConfiguredComponent;

            Type type = typeProvider.ComponentType;

            if (type.GetCustomAttributes(typeof(AutoParametrizeAttribute), true).Length > 0)
            {
                return(AutoParametrization.PerformAutoParametrization(type, localDirectory, args));
            }
            return(args.Clone() as string[]);
        }
Ejemplo n.º 3
0
        public IComponentProvider[] FindByName(string name)
        {
            bool allowParent;

            if (!AllowLookupByName(name, out allowParent))
            {
                throw new ComponentSecurityException();
            }

            if (name2Component.ContainsKey(name))
            {
                if (name2Component[name].Count == 0)
                {
                    name2Component.Remove(name);
                }
                else
                {
                    return(name2Component[name].ToArray());
                }
            }

            /* check the libraries */
            if (name.Contains("."))
            {
                IComponentProvider provider = LoadFromLibrary(name.Substring(0, name.LastIndexOf('.')), name.Substring(name.LastIndexOf('.') + 1), false);

                if (provider == null)
                {
                    return(nullComponents);
                }
                else
                {
                    return new IComponentProvider[] { provider }
                };
            }

            if (allowParent && parent != null)
            {
                return(parent.FindByName(name));
            }

            /* NOT FOUND */
            return(nullComponents);
        }