Skip to Content.
Sympa Menu

perfsonar-dev - r1503 - trunk/perfsonar/src/org/perfsonar/service/web

Subject: perfsonar development work

List archive

r1503 - trunk/perfsonar/src/org/perfsonar/service/web


Chronological Thread 
  • From:
  • To:
  • Subject: r1503 - trunk/perfsonar/src/org/perfsonar/service/web
  • Date: Tue, 1 Aug 2006 07:41:12 -0400

Author: roman
Date: 2006-08-01 07:41:12 -0400 (Tue, 01 Aug 2006)
New Revision: 1503

Modified:
trunk/perfsonar/src/org/perfsonar/service/web/RequestHandler.java
Log:
Ulisses' log messages removed

Modified: trunk/perfsonar/src/org/perfsonar/service/web/RequestHandler.java
===================================================================
--- trunk/perfsonar/src/org/perfsonar/service/web/RequestHandler.java
2006-08-01 11:38:30 UTC (rev 1502)
+++ trunk/perfsonar/src/org/perfsonar/service/web/RequestHandler.java
2006-08-01 11:41:12 UTC (rev 1503)
@@ -31,26 +31,32 @@
public class RequestHandler {


+
// ----------------------------------------------------- constants
-
-
+
+
+
private static final String INIT_SERVICE_MESSAGE_TYPE = "InitService";


private static final String SAX_PARSER_CONFIG =
"service.sax_parser.config";

-
+
+
// -------------------------------------------- instance variables

-
+
+
private ConfigurationComponent configuration = null;

private LoggerComponent logger = null;

-
+
+
// ---------------------------------- public methods


+
/**
* Accepts web service based calls and gives back responses
*
@@ -62,31 +68,31 @@
* are being catched and converted to PerfSONAR result codes
*/
public Document acceptCall(Document request) {
-
+
/*
*
* The first invocation of AuxiliaryComponentManager.getInstance()
* creates the static instance of AuxiliaryComponentManager.
*
*/
-
+
try {

//get configuration component (and create Aux Comp Manager
-
+
configuration =
(ConfigurationComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.CONFIG);
-
- if (configuration==null) throw new PerfSONARException(
+
+ if (configuration == null) throw new PerfSONARException(
"error.common.no_configuration",
"Cannot read configuration file");

//get logger component
-
+
logger = (LoggerComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.LOGGER);

-
- if (logger==null) throw new PerfSONARException(
+
+ if (logger == null) throw new PerfSONARException(
"error.common.no_logger",
"Cannot find logger component");

@@ -95,38 +101,38 @@
"Calling on parser to parse the request");

//convert input Document into Message - requestMessage
-
+
Message requestMessage = null;
try {
-
+
requestMessage = XMLUtils.convertToMessage(
request,
configuration.getProperty(SAX_PARSER_CONFIG));
-
+
} catch (Exception e) {

throw new PerfSONARException("error.common.parse_error",
"Parse/validation error, " +
"Cannot convert request to Message. " +
"Nested error messsage was "+e.getMessage());
-
+
}

//if parsed well
-
+
if (requestMessage!=null) {
-
+
logger.info("RequestHandler: " +
"Message object constructed from request. " +
"Request is of type: " +
requestMessage.getType());
-
+
/*
* Check if it is not InitService message only
*/
if (INIT_SERVICE_MESSAGE_TYPE.
equalsIgnoreCase(requestMessage.getType())) {
-
+
//if so, response that service was set up correctly
throw new PerfSONARException("service.common.success",
"Service initialized correctly");
@@ -148,43 +154,27 @@
"Calling on MessageHandler ["+
messageHandler.getClass()+"] to satisfy request");

-
+
//run proper message handler,
//which will run ServiceEngine
//*****************************************************
-
+
Message responseMessage = messageHandler.execute(
requestMessage);
-
+
//*****************************************************
-
+
// convert response Message into Document
Document responseDocument = XMLUtils.
convertMessageToDOM( responseMessage );

//if everything went fine, return response document to Axis

- // TODO: ulisses: remove this
-
- logger.debug("RequestHandler: ulisses: ");
-
- try {
-
- String m= "RequestHandler: ulisses: printing message:" +
XMLUtils.serializeXML(responseMessage);
- logger.debug(m);
-
- m= "RequestHandler: ulisses: printing DOM:" +
XMLUtils.serializeDOM(responseDocument);
- logger.debug(m);
-
- } catch (Exception e) {
-
- logger.fatal("finished");
- }
-
return responseDocument;
-
-
+
+
} else {
+
//if anything went wrong with parsing, throw exception
logger.error("RequestHandler: " +
"Message object constructed as null from request");
@@ -198,53 +188,38 @@


} catch (PerfSONARException pex) {
-
+
/*
* If any error occured
* response with result/error code
*/
-
+
//create common result code
-
+
Message responseMessage =
ResultCodesUtil.createResultCodeMetadata(
null,
pex);
-
+
//convert it into Document
Document responseDocument = null;
try {
-
+
responseDocument = XMLUtils.convertMessageToDOM(
responseMessage);
-
+
} catch (PerfSONARException e) {
-
+
//or send null if impossible
-
+
logger.fatal("RequestHandler: " +
"Return null response - neither can create " +
"response message nor error code message!");
-
+
}

- // TODO: ulisses: remove this
- logger.debug("RequestHandler: ulisses: ");
-
- try {
-
- String m= "RequestHandler: ulisses: printing message:" +
XMLUtils.serializeXML(responseMessage);
- logger.debug(m);
-
- m= "RequestHandler: ulisses: printing DOM:" +
XMLUtils.serializeDOM(responseDocument);
- logger.debug(m);
-
- } catch (Exception e) {
-
- logger.fatal("finished");
- }
-
return responseDocument;
+
}

}



  • r1503 - trunk/perfsonar/src/org/perfsonar/service/web, svnlog, 08/01/2006

Archive powered by MHonArc 2.6.16.

Top of Page