Project

General

Profile

« Previous | Next » 

Revision 6281

add the old ecogrid query code (still commented out) from the old Rest handler

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
398 398
	  NotImplemented {
399 399

  
400 400
		throw new NotImplemented("4281", "search not implemented");
401
		
402
		// the code block below is from an older implementation
403
		
404
		/*  This block commented out because of the EcoGrid circular dependency.
405
         *  For now, query will not be supported until the circularity can be
406
         *  resolved, probably by moving the ecogrid query syntax transformers
407
         *  directly into the Metacat codebase.  MBJ 2010-02-03
408
         
409
        try {
410
            EcogridQueryParser parser = new EcogridQueryParser(request
411
                    .getReader());
412
            parser.parseXML();
413
            QueryType queryType = parser.getEcogridQuery();
414
            EcogridJavaToMetacatJavaQueryTransformer queryTransformer = 
415
                new EcogridJavaToMetacatJavaQueryTransformer();
416
            QuerySpecification metacatQuery = queryTransformer
417
                    .transform(queryType);
401 418

  
419
            DBQuery metacat = new DBQuery();
420

  
421
            boolean useXMLIndex = (new Boolean(PropertyService
422
                    .getProperty("database.usexmlindex"))).booleanValue();
423
            String xmlquery = "query"; // we don't care the query in resultset,
424
            // the query can be anything
425
            PrintWriter out = null; // we don't want metacat result, so set out null
426

  
427
            // parameter: queryspecification, user, group, usingIndexOrNot
428
            StringBuffer result = metacat.createResultDocument(xmlquery,
429
                    metacatQuery, out, username, groupNames, useXMLIndex);
430

  
431
            // create result set transfer       
432
            String saxparser = PropertyService.getProperty("xml.saxparser");
433
            MetacatResultsetParser metacatResultsetParser = new MetacatResultsetParser(
434
                    new StringReader(result.toString()), saxparser, queryType
435
                            .getNamespace().get_value());
436
            ResultsetType records = metacatResultsetParser.getEcogridResult();
437

  
438
            System.out
439
                    .println(EcogridResultsetTransformer.toXMLString(records));
440
            response.setContentType("text/xml");
441
            out = response.getWriter();
442
            out.print(EcogridResultsetTransformer.toXMLString(records));
443

  
444
        } catch (Exception e) {
445
            e.printStackTrace();
446
        }*/
447
		
448

  
402 449
	}
403 450

  
404 451
	/**

Also available in: Unified diff