Revision 5770
Added by berkley about 13 years ago
ResourceHandler.java | ||
---|---|---|
486 | 486 |
//health monitoring calls |
487 | 487 |
System.out.println("processing monitor request"); |
488 | 488 |
String pathInfo = request.getPathInfo(); |
489 |
if (httpVerb == GET && pathInfo.toLowerCase().equals("ping")) { |
|
490 |
System.out.println("processing ping request"); |
|
489 |
if(httpVerb == GET) |
|
490 |
{ |
|
491 |
System.out.println("verb is GET"); |
|
492 |
System.out.println("pathInfo is " + pathInfo); |
|
493 |
pathInfo = pathInfo.substring(1); |
|
491 | 494 |
HealthService hs = new HealthService(request, response); |
492 |
hs.ping(); |
|
495 |
if (pathInfo.toLowerCase().equals("ping")) { |
|
496 |
System.out.println("processing ping request"); |
|
497 |
hs.ping(); |
|
498 |
} else if (pathInfo.toLowerCase().equals("status")) { |
|
499 |
System.out.println("processing status request"); |
|
500 |
hs.getStatus(); |
|
501 |
} else if (pathInfo.toLowerCase().equals("object")) { |
|
502 |
System.out.println("processing object request"); |
|
503 |
boolean day = false; |
|
504 |
Identifier pid = null; |
|
505 |
String url = null; |
|
506 |
ObjectFormat of = null; |
|
507 |
Date time = null; |
|
508 |
|
|
509 |
if(params.containsKey("day")) |
|
510 |
{ |
|
511 |
day = true; |
|
512 |
} |
|
513 |
if(params.containsKey("pid")) |
|
514 |
{ |
|
515 |
String id = params.get("pid")[0]; |
|
516 |
pid = new Identifier(); |
|
517 |
pid.setValue(id); |
|
518 |
} |
|
519 |
if(params.containsKey("url")) |
|
520 |
{ |
|
521 |
url = params.get("url")[0]; |
|
522 |
} |
|
523 |
if(params.containsKey("format")) |
|
524 |
{ |
|
525 |
String format = params.get("format")[0]; |
|
526 |
of = ObjectFormat.convert(format); |
|
527 |
} |
|
528 |
if(params.containsKey("time")) |
|
529 |
{ |
|
530 |
String t = params.get("time")[0]; |
|
531 |
time = dateFormat.parse(t); |
|
532 |
} |
|
533 |
|
|
534 |
hs.getObjectStatistics(day, pid, url, of, time); |
|
535 |
} else if (pathInfo.toLowerCase().equals("event")) { |
|
536 |
System.out.println("processing event request"); |
|
537 |
boolean day = false; |
|
538 |
Identifier pid = null; |
|
539 |
Date created = null; |
|
540 |
ObjectFormat of = null; |
|
541 |
Date time = null; |
|
542 |
String ipAddress = null; |
|
543 |
String event = null; |
|
544 |
|
|
545 |
if(params.containsKey("day")) |
|
546 |
{ |
|
547 |
day = true; |
|
548 |
} |
|
549 |
if(params.containsKey("pid")) |
|
550 |
{ |
|
551 |
String id = params.get("pid")[0]; |
|
552 |
pid = new Identifier(); |
|
553 |
pid.setValue(id); |
|
554 |
} |
|
555 |
if(params.containsKey("created")) |
|
556 |
{ |
|
557 |
String t = params.get("created")[0]; |
|
558 |
created = dateFormat.parse(t); |
|
559 |
} |
|
560 |
if(params.containsKey("format")) |
|
561 |
{ |
|
562 |
String format = params.get("format")[0]; |
|
563 |
of = ObjectFormat.convert(format); |
|
564 |
} |
|
565 |
if(params.containsKey("eventtime")) |
|
566 |
{ |
|
567 |
String t = params.get("eventtime")[0]; |
|
568 |
time = dateFormat.parse(t); |
|
569 |
} |
|
570 |
if(params.containsKey("ip_address")) |
|
571 |
{ |
|
572 |
ipAddress = params.get("ip_address")[0]; |
|
573 |
} |
|
574 |
if(params.containsKey("event")) |
|
575 |
{ |
|
576 |
event = params.get("event")[0]; |
|
577 |
} |
|
578 |
|
|
579 |
hs.getOperationStatistics(day, pid, of, created, time, ipAddress, event); |
|
580 |
} |
|
493 | 581 |
} |
494 | 582 |
status = true; |
495 | 583 |
} |
Also available in: Unified diff
implemented health api