Exemplo n.º 1
0
        public void Import(PipelineContext ctx, IDatasourceSink sink)
        {
            workerQueue = AsyncRequestQueue.Create(maxParallel);
            ctx.ImportLog.Log("TikaDS starting. maxparallel={0}, dbgstore={1}, Q={2}", maxParallel, DbgStoreDir, workerQueue);
            if (maxParallel >= 2 && ServicePointManager.DefaultConnectionLimit < maxParallel)
            {
                ctx.ImportLog.Log("Updating connectionLimit for {0} to {1}", ServicePointManager.DefaultConnectionLimit, maxParallel);
                ServicePointManager.DefaultConnectionLimit = maxParallel;
            }

            ensureTikaServiceStarted(ctx);
            previousRun = ctx.RunAdministrations.GetLastOKRunDateShifted(ctx.DatasourceAdmin);
            ctx.ImportLog.Log("Previous (shifted) run was {0}.", previousRun);
            //GenericStreamProvider.DumpRoots(ctx, streamDirectory);
            try
            {
                if (this.mustEmitSecurity)
                {
                    securityCache = new SecurityCache(TikaSecurityAccount.FactoryImpl);
                }
                foreach (var elt in streamDirectory.GetProviders(ctx))
                {
                    try
                    {
                        importUrl(ctx, sink, elt);
                    }
                    catch (Exception e)
                    {
                        throw new BMException(e, "{0}\r\nUrl={1}.", e.Message, elt);
                    }
                }
                //Handle still queued workers
                while (true)
                {
                    TikaAsyncWorker popped = pushPop(ctx, sink, null);
                    if (popped == null)
                    {
                        break;
                    }
                    importUrl(ctx, sink, popped);
                }
            }
            finally
            {
                workerQueue.PopAllWithoutException();
                Utils.FreeAndNil(ref securityCache);
            }
        }
Exemplo n.º 2
0
        private bool isGroup(SecurityCache parent)
        {
            PrincipalContext ctx;
            GroupPrincipal   grp = null;

            String[] parts = NTAccount.Value.Split(accountSplitChar);
            String   domain, local;

            if (parts.Length < 2)
            {
                domain = null;
                local  = parts[0];
            }
            else
            {
                domain = parts[0];
                local  = parts[1];
            }

            try
            {
                if (!IsAccoundSid)
                {
                    return(false);
                }
                if (domain == null)
                {
                    ctx = parent.GetPricipalContext("", ContextType.Machine);
                    //Logs.ErrorLog.Log("ctxl=" + SecurityCache.CtxToString(ctx));
                    grp = getGroup(ctx, local);
                    return(grp != null);
                }
                ctx = parent.GetPricipalContext(domain, ContextType.Machine, ContextType.Domain, ContextType.ApplicationDirectory);
                //Logs.ErrorLog.Log("ctxd=" + SecurityCache.CtxToString(ctx));
                grp = getGroup(ctx, local);
                return(grp != null);
            }
            finally
            {
                Utils.FreeAndNil(ref grp);
            }
        }
Exemplo n.º 3
0
 public static SecurityAccount FactoryImpl(SecurityCache parent, IdentityReference ident)
 {
     return(new TikaSecurityAccount(parent, ident));
 }
Exemplo n.º 4
0
 internal protected TikaSecurityAccount(SecurityCache parent, IdentityReference ident) : base(parent, ident)
 {
     ExportedName = WellKnownSid == null ? base.Sid.Value : ((WellKnownSidType)WellKnownSid).ToString();
 }