perfsonar-dev - perfsonar: r5454 - in branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2: config servlet servlet/util util
Subject: perfsonar development work
List archive
perfsonar: r5454 - in branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2: config servlet servlet/util util
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5454 - in branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2: config servlet servlet/util util
- Date: Mon, 4 Jan 2010 07:24:58 -0500
Author: wiku
Date: 2010-01-04 07:24:58 -0500 (Mon, 04 Jan 2010)
New Revision: 5454
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/WAXMLReader.java
Log:
logger to log4j changes
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
2010-01-04 11:30:46 UTC (rev 5453)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
2010-01-04 12:24:58 UTC (rev 5454)
@@ -7,11 +7,12 @@
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
-import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
+import org.apache.log4j.Logger;
+
import org.perfsonar.webadmin.base2.util.NSContext;
import org.perfsonar.webadmin.base2.util.Tuple;
import org.perfsonar.webadmin.base2.util.WAXMLReader;
@@ -32,7 +33,7 @@
@SuppressWarnings("serial")
public class ObjectMap extends Hashtable<Integer, Object> {
- private Logger logger = Logger.getAnonymousLogger();
+ private Logger logger = Logger.getLogger(ObjectMap.class);
Tuple<WebAdminInterface, JAXBContext> waconfig;
String waconfigfile = "";
@@ -118,7 +119,7 @@
if (ret != null)
return ret;
String path = basePath + "/" + uri;
- logger.info("WA --- Attempting to locate URI : \"" + path +
"\"");
+ logger.debug("Attempting to locate URI : \"" + path + "\"");
file2doc.put(uri, (ret = XMLUtil.readDocument(path)));
return ret;
}
@@ -130,16 +131,14 @@
Integer inputName =
Integer.parseInt(entry.getKey());
myobj = get(inputName);
if (myobj == null) {
- logger
- .warning("element " +
entry.getKey()
- + "
not found !");
+ logger.warn("element " +
entry.getKey() + " not found !");
}
if (myobj instanceof BaseType)
updateBase((BaseType) myobj,
entry.getValue());
else if (myobj instanceof NodeList)
updateNodeList((NodeList) myobj,
entry.getValue());
else {
- logger.warning(" Cannot match object
type :"
+ logger.warn(" Cannot match object
type :"
+ myobj.getClass());
}
} catch (NumberFormatException ex) {
@@ -155,9 +154,9 @@
}
private void updateBase(BaseType o, String[] valueArray) {
- logger.info("WA --- Should update base type");
+ logger.debug("Should update base type");
if (valueArray.length == 0) {
- logger.warning("value is empty");
+ logger.debug("value is empty");
return;
}
@@ -166,15 +165,15 @@
s += "," + valueArray[i];
// NOTE:Assuming that this is a text element (not xpath)
o.setText(s);
- logger.info("base type updated");
+ logger.debug("base type updated");
}
private void updateNodeList(NodeList t, String[] valueArray) {
if (t.getLength() == 0) {
- logger.warning("empty node list");
+ logger.debug("empty node list");
return;
} else if (valueArray.length == 0) {
- logger.warning("value is empty !");
+ logger.debug("value is empty !");
return;
}
Node n = t.item(0);
@@ -190,7 +189,7 @@
n.setTextContent(s);
}
- logger.info("list node updated");
+ logger.debug("list node updated");
}
};
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
2010-01-04 11:30:46 UTC (rev 5453)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
2010-01-04 12:24:58 UTC (rev 5454)
@@ -2,7 +2,6 @@
import java.io.IOException;
import java.util.Locale;
-import java.util.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -10,6 +9,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.log4j.Logger;
+
import org.perfsonar.webadmin.base2.config.ObjectMap;
import org.perfsonar.webadmin.base2.servlet.util.Base64;
import org.perfsonar.webadmin.base2.servlet.util.ConfigurationServletHelper;
@@ -23,13 +24,14 @@
@SuppressWarnings("serial")
public class BasicConfigurationServlet extends HttpServlet {
- private final Logger logger = Logger.getAnonymousLogger();
+ private final Logger logger = Logger
+ .getLogger(BasicConfigurationServlet.class);
private ObjectMap map;
private Credential credential;
public void init(ServletConfig arg0) throws ServletException {
super.init(arg0);
- logger.info("Servlet initialized");
+ logger.debug("Servlet initialized");
map =
ConfigurationServletHelper.objectMap(getServletContext());
credential = map.getWA().getCredential();
}
@@ -48,7 +50,7 @@
response.setHeader("WWW-Authenticate", "BASIC
realm=\"users\"");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
} else {
- logger.info("DO READ");
+ logger.debug("DO READ");
ConfigurationServletHelper config = new
ConfigurationServletHelper(
request, getServletContext());
@@ -56,7 +58,7 @@
if (htmlContent != null) {
request.setAttribute("form", htmlContent);
} else {
- logger.warning("form html content is null !");
+ logger.debug("form html content is null !");
}
getServletConfig().getServletContext().getRequestDispatcher(
"/index.jsp?page=form").forward(request, response);
@@ -74,7 +76,7 @@
ConfigurationServletHelper config = new
ConfigurationServletHelper(
request, response, getServletContext());
- logger.info("DO WRITE");
+ logger.debug("DO WRITE");
String urlPath = "index.jsp?page=save";
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
2010-01-04 11:30:46 UTC (rev 5453)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
2010-01-04 12:24:58 UTC (rev 5454)
@@ -2,13 +2,14 @@
import java.io.IOException;
import java.io.PrintStream;
-import java.util.logging.Logger;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.apache.log4j.Logger;
+
import org.perfsonar.webadmin.base2.config.HTMLGenerator;
import org.perfsonar.webadmin.base2.config.ObjectMap;
import org.perfsonar.webadmin.base2.util.HTMLUtil;
@@ -18,7 +19,8 @@
public class ConfigurationServletHelper {
- private final Logger logger = Logger.getAnonymousLogger();
+ private final Logger logger = Logger
+ .getLogger(ConfigurationServletHelper.class);
static final short SESSION_INTERVAL = 3600;
/**
@@ -161,16 +163,16 @@
@SuppressWarnings("unchecked")
public boolean processData() {
boolean saved = false;
- logger.info("WA --- Processing client data.");
+ logger.debug("Processing client data.");
objectMap().updateObjects(request.getParameterMap());
if (objectMap().save()) {
- logger.info("configuration saved");
+ logger.debug("configuration saved");
saved = true;
} else {
- logger.info("problem with saving configuration");
+ logger.debug("problem with saving configuration");
saved = false;
}
- logger.info("Done processing client data.");
+ logger.debug("Done processing client data.");
displayPage(getHttpParameter("form_key"));
return saved;
@@ -186,7 +188,7 @@
private String getHttpParameter(String s) {
String p = request.getParameter(s);
if (p == null) {
- logger.info("parameter " + s + " not found in
HTTPRequest");
+ logger.debug("parameter " + s + " not found in
HTTPRequest");
return null;
} else {
return p.trim();
@@ -205,9 +207,9 @@
if (page == null) {
return null;
} else {
- logger.info("Looking up page \"" + page + "\"");
+ logger.debug("Looking up page \"" + page + "\"");
found = gen.translate(page, objectMap(), new
PrintStream(sout));
- logger.info("Page \"" + page + "\" found " + found);
+ logger.debug("Page \"" + page + "\" found " + found);
return new Tuple<String, String>(found ? page : null,
sout
.toString());
}
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/WAXMLReader.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/WAXMLReader.java
2010-01-04 11:30:46 UTC (rev 5453)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/WAXMLReader.java
2010-01-04 12:24:58 UTC (rev 5454)
@@ -5,18 +5,18 @@
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.util.List;
-import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
+import org.apache.log4j.Logger;
import org.perfsonar.webadmin.base2.waschema.v20090201.WebAdminInterface;
import org.xml.sax.InputSource;
public class WAXMLReader {
- private final static Logger logger = Logger.getAnonymousLogger();
+ private final static Logger logger =
Logger.getLogger(WAXMLReader.class);
private final static String CLASS_NAME =
// FIXME: Should read this from JAXB xml file
@@ -38,6 +38,6 @@
public static void main(String[] args) throws Exception {
WebAdminInterface r = parseFile(args[0]).first();
List p = r.getPage();
- logger.info("Pages " + p.size() + " " +
p.get(0).getClass().getName());
+ logger.debug("Pages " + p.size() + " " +
p.get(0).getClass().getName());
}
};
- perfsonar: r5454 - in branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2: config servlet servlet/util util, svnlog, 01/04/2010
Archive powered by MHonArc 2.6.16.