Exemplo n.º 1
0
        /// <summary>
        /// Process a single <code>Request</code>.
        /// </summary>
        /// <param name="state">The <code>Request</code> to process.</param>
        static void processRequest(Object state)
        {
            Request request = (Request) state;
            if (request == null) return;

            List<Result> results = new RequestRunner(request).retrieveItems();

            RdfFile rdf = new RdfFile();
            foreach (Result r in results)
            {
                RDFMetaData rdfmd = new RDFMetaData();
                rdfmd.Subject = request.topic;
                rdfmd.Title = r.Title;
                rdfmd.Description = r.Description;
                rdfmd.Date = r.Datetime;
                rdfmd.Identifier = r.Url;
                rdfmd.Size = r.Size;
                rdfmd.Format = r.MimeType;
                //Length, Height, Width could be used, but Dublin Core doesn't care

                HttpMetaData httpmd = new HttpMetaData(rdfmd);
                if (httpmd.wasFound)
                    httpmd.addMetaData();

                rdf.addDescription(rdfmd.getDescription());
            }

            StreamWriter fw = new StreamWriter(ControllerConfig.ouputDirectory
                            + DateTime.UtcNow.ToFileTimeUtc().ToString()
                            + ControllerConfig.outputFileSuffix);
            fw.AutoFlush = true;
            rdf.Save(fw);
            fw.Close();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Setup the HTTP HEAD retriever with a possibly existing HTTP
 /// response.
 /// </summary>
 /// <param name="metadata">The metadata to add to.</param>
 /// <param name="headResponse">An HTTP response, if one has already
 /// been received.</param>
 public HttpMetaData(RDFMetaData metadata, HttpWebResponse headResponse = null)
 {
     this.metadata = metadata;
     this.headResponse = headResponse;
     this.wasFound = false;
 }