Beispiel #1
0
        public DatasourceAdmin(PipelineContext ctx, XmlNode node)
            : base(node)
        {
            Type     = node.ReadStr("@type");
            Active   = node.ReadBool("@active", true);
            LogAdds  = node.ReadInt(1, "@logadds", -1);
            MaxAdds  = node.ReadInt(1, "@maxadds", -1);
            MaxEmits = node.ReadInt(1, "@maxemits", -1);
            String tmp = node.ReadStr(1, "@shiftlastruntime", null);

            ShiftLastRuntime = computeRuntimeShift(tmp);
            if (ShiftLastRuntime == int.MinValue)
            {
                throw new BMNodeException(node, "Invalid shiftlastruntime [{0}]: must be <int>[d|h|m|s].", tmp);
            }

            String pipelineName = node.ReadStr(1, "@pipeline", null);

            Pipeline = ctx.ImportEngine.Pipelines.GetByNamesOrFirst(pipelineName, Name);

            String endpoint = node.ReadStr(1, "@endpoint", null);

            if (endpoint != null)
            {
                endpoint = endpoint.Replace("*", Name);
                ctx.ImportEngine.Endpoints.CheckDataEndpoint(ctx, endpoint, true);
                EndpointName = endpoint;
            }
            String endpointExpr = node.ReadStr(1, "@endpoint_expr", null);

            if (endpointExpr != null)
            {
                if (endpoint != null)
                {
                    throw new BMNodeException(node, "@endpoint and @endpoint_expr cannot be specified both.");
                }
                EndpointName = PerlRegex.Replace(endpointExpr, Name);
                ctx.ImportEngine.Endpoints.CheckDataEndpoint(ctx, EndpointName, true);
            }

            Pipeline.CheckEndpoints(ctx, this);


            //if (!Active) return; Zie notes: ws moet een datasource definitief kunnen worden uitgeschakeld. iets als active=true/false/disabled
            Datasource = ImportEngine.CreateObject <Datasource> (Type);
            Datasource.Init(ctx, node);
        }
        public PostProcessors(ImportEngine engine, XmlNode collNode)
        {
            postProcessors = new StringDict <IPostProcessor>();
            if (collNode == null)
            {
                return;
            }

            var nodes = collNode.SelectNodes("postprocessor");

            for (int i = 0; i < nodes.Count; i++)
            {
                XmlNode        c = nodes[i];
                IPostProcessor p = ImportEngine.CreateObject <IPostProcessor> (c, engine, c);
                postProcessors.Add(p.Name, p);
            }
        }
Beispiel #3
0
 private static Endpoint create (ImportEngine engine, XmlNode n)
 {
    String type = n.ReadStr("@type");
    if (String.Equals("nop", type, StringComparison.InvariantCultureIgnoreCase)) return new Endpoint(engine, n);
    return ImportEngine.CreateObject<Endpoint>(n, engine, n);
 }