Beispiel #1
0
 internal ProviderIntrinsics(SessionStateInternal sessionState)
 {
     using (ProviderIntrinsics.tracer.TraceConstructor((object)this))
     {
         this.item               = sessionState != null ? new ItemCmdletProviderIntrinsics(sessionState) : throw ProviderIntrinsics.tracer.NewArgumentNullException(nameof(sessionState));
         this.childItem          = new ChildItemCmdletProviderIntrinsics(sessionState);
         this.content            = new ContentCmdletProviderIntrinsics(sessionState);
         this.property           = new PropertyCmdletProviderIntrinsics(sessionState);
         this.securityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);
     }
 }
Beispiel #2
0
 internal ProviderIntrinsics(SessionStateInternal sessionState)
 {
     if (sessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("sessionState");
     }
     this.item = new ItemCmdletProviderIntrinsics(sessionState);
     this.childItem = new ChildItemCmdletProviderIntrinsics(sessionState);
     this.content = new ContentCmdletProviderIntrinsics(sessionState);
     this.property = new PropertyCmdletProviderIntrinsics(sessionState);
     this.securityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);
 }
Beispiel #3
0
 internal ProviderIntrinsics(Cmdlet cmdlet)
 {
     using (ProviderIntrinsics.tracer.TraceConstructor((object)this))
     {
         this.cmdlet             = cmdlet != null ? (InternalCommand)cmdlet : throw ProviderIntrinsics.tracer.NewArgumentNullException(nameof(cmdlet));
         this.item               = new ItemCmdletProviderIntrinsics(cmdlet);
         this.childItem          = new ChildItemCmdletProviderIntrinsics(cmdlet);
         this.content            = new ContentCmdletProviderIntrinsics(cmdlet);
         this.property           = new PropertyCmdletProviderIntrinsics(cmdlet);
         this.securityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(cmdlet);
     }
 }
 internal ProviderIntrinsics(SessionStateInternal sessionState)
 {
     if (sessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("sessionState");
     }
     this.item               = new ItemCmdletProviderIntrinsics(sessionState);
     this.childItem          = new ChildItemCmdletProviderIntrinsics(sessionState);
     this.content            = new ContentCmdletProviderIntrinsics(sessionState);
     this.property           = new PropertyCmdletProviderIntrinsics(sessionState);
     this.securityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);
 }
        /// <summary>
        /// Constructs a facade over the "real" session state API.
        /// </summary>
        /// <param name="sessionState">
        /// An instance of the cmdlet.
        /// </param>
        internal ProviderIntrinsics(SessionStateInternal sessionState)
        {
            if (sessionState == null)
            {
                throw PSTraceSource.NewArgumentNullException(nameof(sessionState));
            }

            Item               = new ItemCmdletProviderIntrinsics(sessionState);
            ChildItem          = new ChildItemCmdletProviderIntrinsics(sessionState);
            Content            = new ContentCmdletProviderIntrinsics(sessionState);
            Property           = new PropertyCmdletProviderIntrinsics(sessionState);
            SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);
        }
Beispiel #6
0
 internal ProviderIntrinsics(Cmdlet cmdlet)
 {
     if (cmdlet == null)
     {
         throw PSTraceSource.NewArgumentNullException("cmdlet");
     }
     this.cmdlet = cmdlet;
     this.item = new ItemCmdletProviderIntrinsics(cmdlet);
     this.childItem = new ChildItemCmdletProviderIntrinsics(cmdlet);
     this.content = new ContentCmdletProviderIntrinsics(cmdlet);
     this.property = new PropertyCmdletProviderIntrinsics(cmdlet);
     this.securityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(cmdlet);
 }
 internal ProviderIntrinsics(Cmdlet cmdlet)
 {
     if (cmdlet == null)
     {
         throw PSTraceSource.NewArgumentNullException("cmdlet");
     }
     this.cmdlet             = cmdlet;
     this.item               = new ItemCmdletProviderIntrinsics(cmdlet);
     this.childItem          = new ChildItemCmdletProviderIntrinsics(cmdlet);
     this.content            = new ContentCmdletProviderIntrinsics(cmdlet);
     this.property           = new PropertyCmdletProviderIntrinsics(cmdlet);
     this.securityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(cmdlet);
 }
        /// <summary>
        /// Constructs a facade over the "real" session state API.
        /// </summary>
        /// <param name="cmdlet">
        /// An instance of the cmdlet.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="cmdlet"/> is null.
        /// </exception>
        internal ProviderIntrinsics(Cmdlet cmdlet)
        {
            if (cmdlet == null)
            {
                throw PSTraceSource.NewArgumentNullException(nameof(cmdlet));
            }

            _cmdlet            = cmdlet;
            Item               = new ItemCmdletProviderIntrinsics(cmdlet);
            ChildItem          = new ChildItemCmdletProviderIntrinsics(cmdlet);
            Content            = new ContentCmdletProviderIntrinsics(cmdlet);
            Property           = new PropertyCmdletProviderIntrinsics(cmdlet);
            SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(cmdlet);
        }
Beispiel #9
0
        internal ProviderIntrinsics(Cmdlet cmdlet)
        {
            if (cmdlet == null)
            {
                throw new NullReferenceException("Cmdlet can't be null.");
            }

            _cmdlet            = cmdlet;
            ChildItem          = new ChildItemCmdletProviderIntrinsics(cmdlet);
            Content            = new ContentCmdletProviderIntrinsics(cmdlet);
            Item               = new ItemCmdletProviderIntrinsics(cmdlet);
            Property           = new PropertyCmdletProviderIntrinsics(cmdlet);
            SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(cmdlet);
        }
Beispiel #10
0
        internal ProviderIntrinsics(Cmdlet cmdlet)
        {
            if (cmdlet == null)
            {
                throw new NullReferenceException("Cmdlet can't be null.");
            }

            _cmdlet = cmdlet;
            ChildItem = new ChildItemCmdletProviderIntrinsics(_cmdlet);
            Content = new ContentCmdletProviderIntrinsics(_cmdlet);
            Item = new ItemCmdletProviderIntrinsics(_cmdlet);
            Property = new PropertyCmdletProviderIntrinsics(_cmdlet);
            SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(_cmdlet);
        }
        } // ProviderIntrinsics internal

        /// <summary>
        /// Constructs a facade over the "real" session state API
        /// </summary>
        ///
        /// <param name="sessionState">
        /// An instance of the cmdlet.
        /// </param>
        ///
        internal ProviderIntrinsics(SessionStateInternal sessionState)
        {
            if (sessionState == null)
            {
                throw PSTraceSource.NewArgumentNullException("sessionState");
            }

            Item      = new ItemCmdletProviderIntrinsics(sessionState);
            ChildItem = new ChildItemCmdletProviderIntrinsics(sessionState);
            Content   = new ContentCmdletProviderIntrinsics(sessionState);
            Property  = new PropertyCmdletProviderIntrinsics(sessionState);
#if SUPPORTS_IMULTIVALUEPROPERTYCMDLETPROVIDER
            this.propertyValue = new PropertyValueCmdletProviderIntrinsics(sessionState);
#endif
            SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);

#if RELATIONSHIP_SUPPORTED
            // 2004/11/24-JeffJon - Relationships have been removed from the Exchange release
            this.relationship = new RelationshipProviderIntrinsics(sessionState);
#endif
        } // ProviderIntrinsics internal
        } // ProviderIntrinsics internal

        /// <summary>
        /// Constructs a facade over the "real" session state API
        /// </summary>
        ///
        /// <param name="sessionState">
        /// An instance of the cmdlet.
        /// </param>
        ///
        internal ProviderIntrinsics(SessionStateInternal sessionState)
        {
            if (sessionState == null)
            {
                throw PSTraceSource.NewArgumentNullException("sessionState");
            }

            Item = new ItemCmdletProviderIntrinsics(sessionState);
            ChildItem = new ChildItemCmdletProviderIntrinsics(sessionState);
            Content = new ContentCmdletProviderIntrinsics(sessionState);
            Property = new PropertyCmdletProviderIntrinsics(sessionState);
#if SUPPORTS_IMULTIVALUEPROPERTYCMDLETPROVIDER
            this.propertyValue = new PropertyValueCmdletProviderIntrinsics(sessionState);
#endif
            SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);

#if RELATIONSHIP_SUPPORTED
    // 2004/11/24-JeffJon - Relationships have been removed from the Exchange release
            this.relationship = new RelationshipProviderIntrinsics(sessionState);
#endif
        } // ProviderIntrinsics internal
Beispiel #13
0
        Collection<string> BuiltInGlobbing(CmdletProvider provider, string path, ProviderRuntime runtime)
        {
            var containerProvider = CmdletProvider.As<ContainerCmdletProvider>(provider);
            var ciIntrinsics = new ChildItemCmdletProviderIntrinsics(_sessionState);
            // first we split the path into globbable components and put them on a stack to work with
            var componentStack = PathToStack(containerProvider, path, runtime);


            // we create a working list with partially globbed paths. each iteration will take all items from the
            // list and add the newly globbed part
            var workingPaths = new List<string>() { "" };
            while (componentStack.Count > 0)
            {
                var partialPaths = new List<string>(workingPaths);
                workingPaths.Clear();
                var globComp = componentStack.Pop();
                // check if the current stack component has wildcards. If not, simply append it to all partialPaths
                // and add to workingPaths
                if (!WildcardPattern.ContainsWildcardCharacters(globComp))
                {
                    workingPaths.AddRange(from p in partialPaths select Path.Combine(containerProvider, p, globComp, runtime));
                    continue;
                }

                // otherwise get all childnames, check wildcard and combine the paths
                var globWC = new WildcardPattern(globComp, WildcardOptions.IgnoreCase);
                foreach (var partPath in partialPaths)
                {
                    if (!containerProvider.ItemExists(partPath, runtime) ||
                        !containerProvider.HasChildItems(partPath, runtime))
                    {
                        // TODO: throw an error if there was no globbing already performed (then the first part of
                        // the path already did not exists as in a pattern like "/home/notExisting/*.txt"
                        continue;
                    }
                    // TODO: verify if we should only consider matching containers or all. maybe the filter won't
                    // apply to partial parts and we need to consider all
                    var childNames = ciIntrinsics.GetValidChildNames(containerProvider, partPath,
                                         ReturnContainers.ReturnMatchingContainers, runtime);
                    // TODO: check if Include/Exclude also match partial parts, but i guess only complete ones
                    // add all combined path to the workingPaths for the next stack globbing iteration
                    workingPaths.AddRange(from c in childNames
                                          where globWC.IsMatch(c)
                                          select Path.Combine(containerProvider, partPath, c, runtime));
                }
            }
            // now filter the working paths by include/exlude. last flag is false or we wouldn't be globbing
            var filter = new IncludeExcludeFilter(runtime.Include, runtime.Exclude, false);
            var globbedPaths = from p in workingPaths where filter.Accepts(p) select p;
            return new Collection<string>(globbedPaths.ToList());
        }