Пример #1
0
 public StreamProvider(StreamDirectory parent, XmlNode contextNode)
 {
     this.contextNode = contextNode;
     this.parent      = parent;
     lastModUtc       = DateTime.MinValue;
     size             = -1;
 }
 protected StreamDirectoryEnumerator(PipelineContext ctx, StreamDirectory parent, StackDirElt topElt)
 {
     this.ctx    = ctx;
     this.parent = parent;
     stack       = new List <StackElt>();
     stack.Add(topStackElement = topElt);
     logger = ctx.ImportLog.Clone(parent.GetType().Name);
 }
Пример #3
0
 public virtual void SetNextProvider(StreamDirectory d)
 {
     if (d == null)
     {
         return;
     }
     if (forcedNext == null)
     {
         forcedNext = new Queue <Object>();
     }
     forcedNext.Enqueue(d);
 }
Пример #4
0
 public StreamProvider(StreamProvider other)
 {
     parent                 = other.parent;
     contextNode            = other.contextNode;
     fullName               = other.fullName;
     virtualName            = other.virtualName;
     virtualRoot            = other.virtualRoot;
     relativeName           = other.relativeName;
     uri                    = other.uri;
     credentialCache        = other.credentialCache;
     protocol               = other.protocol;
     lastModUtc             = other.lastModUtc;
     attributes             = other.attributes;
     size                   = other.size;
     credentialsNeeded      = other.credentialsNeeded;
     credentialsInitialized = other.credentialsInitialized;
     silent                 = other.silent;
     isDir                  = other.isDir;
 }
Пример #5
0
        public RootStreamDirectory(PipelineContext ctx, XmlNode node)
            : base(ctx, node)
        {
            children = new List <StreamDirectory>();
            StreamDirectory x = createFromNode(ctx, ContextNode, ContextNode, false);

            if (x != null)
            {
                children.Add(x);
            }
            else
            {
                XmlNodeList nodes = ContextNode.SelectNodes("provider");
                for (int i = 0; i < nodes.Count; i++)
                {
                    children.Add(createFromNode(ctx, (XmlElement)nodes[i], ContextNode, true));
                }
            }

            if (children.Count == 0)
            {
                throw new BMNodeException(node, "No providers found. No <provider> child is found and no url/file/root attributes are found.");
            }
        }
Пример #6
0
        public ShellStreamProvider(PipelineContext ctx, XmlNode node, XmlNode parentNode, StreamDirectory parent)
            : base(parent, node)
        {
            engine = ctx.ImportEngine;
            if (parentNode == null)
            {
                parentNode = node;
            }
            silent = (ctx.ImportFlags & _ImportFlags.Silent) != 0;

            uri = new Uri("cmd://something");

            resultTypes = new ProcessResultTypes();
            resultTypes.Add(0, 0);
            resultTypes.Add(node.ReadStr("@ignore_errors", null), 1);
            resultTypes.Add(node.ReadStr("@ok_errors", null), 0);

            buffered       = node.ReadBool("@buffered", true);
            stderrToStdout = node.ReadBool("@stderr_to_stdout", false);

            Command   = node.ReadStr("@cmd");
            Arguments = node.ReadStr("@args", null);
            ViaShell  = node.ReadBool("@viashell", false);
            if (ViaShell && Arguments != null)
            {
                throw new BMNodeException(node, "Attributes @args cannot be specified when @viashell=true.");
            }
        }
 public StreamDirectoryEnumerator(PipelineContext ctx, StreamDirectory parent, IEnumerable <object> e)
     : this(ctx, parent, new StackDirElt(parent, e.GetEnumerator()))
 {
 }
 public StackDirElt(StreamDirectory d, IEnumerator <Object> e)
 {
     Directory  = d;
     Enumerator = e;
 }
 public StackDirElt(PipelineContext ctx, StreamDirectory d)
 {
     Directory  = d;
     Enumerator = d.GetProviders(ctx).GetEnumerator();
 }
Пример #10
0
        public SSHStreamProvider(PipelineContext ctx, XmlNode node, XmlNode parentNode, StreamDirectory parent)
            : base(parent, node)
        {
            credentialsNeeded = true;
            if (parentNode == null)
            {
                parentNode = node;
            }
            silent = (ctx.ImportFlags & _ImportFlags.Silent) != 0;

            uri = new Uri("ssh://192.168.76.134/");
            createClient();
        }
Пример #11
0
        public WebStreamProvider(PipelineContext ctx, XmlNode node, XmlNode parentNode, StreamDirectory parent)
            : base(parent, node)
        {
            if (parentNode == null)
            {
                parentNode = node;
            }
            silent = (ctx.ImportFlags & _ImportFlags.Silent) != 0;
            String root = parentNode.ReadStr("@root", null);
            String url  = node.LocalName == "url" ? node.ReadStr(null) : node.ReadStr("@url");

            uri       = root == null ? new Uri(url) : new Uri(new Uri(root), url);
            fullName  = uri.ToString();
            KeepAlive = node.ReadBool(1, "@keepalive", true);
        }