perfsonar-dev - perfsonar: r5436 - in branches/new-structure-with-base2/ps-mdm-web-admin: schema/xsd src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util src/main/java/org/perfsonar/webadmin/base2/util src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201 src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl tomcat/classes/perfsonar/conf
Subject: perfsonar development work
List archive
perfsonar: r5436 - in branches/new-structure-with-base2/ps-mdm-web-admin: schema/xsd src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util src/main/java/org/perfsonar/webadmin/base2/util src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201 src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl tomcat/classes/perfsonar/conf
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5436 - in branches/new-structure-with-base2/ps-mdm-web-admin: schema/xsd src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util src/main/java/org/perfsonar/webadmin/base2/util src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201 src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl tomcat/classes/perfsonar/conf
- Date: Tue, 29 Dec 2009 10:14:10 -0500
Author: trzaszcz
Date: 2009-12-29 10:14:10 -0500 (Tue, 29 Dec 2009)
New Revision: 5436
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/schema/xsd/wa.xsd
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
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/HTMLUtil.java
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/waschema/v20090201/PlainType.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeDriver.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeHandler.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeImpl.java
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
Log:
servlet auth added + getting credential from wa.xml
Modified: branches/new-structure-with-base2/ps-mdm-web-admin/schema/xsd/wa.xsd
===================================================================
--- branches/new-structure-with-base2/ps-mdm-web-admin/schema/xsd/wa.xsd
2009-12-29 14:18:33 UTC (rev 5435)
+++ branches/new-structure-with-base2/ps-mdm-web-admin/schema/xsd/wa.xsd
2009-12-29 15:14:10 UTC (rev 5436)
@@ -56,6 +56,8 @@
<!-- Plain elements -->
<xs:complexType name ="PlainType">
<xs:choice>
+ <xs:element name="password"
type="wa:BaseUIType"
+
minOccurs="1" maxOccurs="1"/>
<xs:element name="textbox"
type="wa:BaseUIType"
minOccurs="1" maxOccurs="1"/>
<xs:element name="radio"
type="wa:ComplexUIType"
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -24,7 +24,7 @@
public class HTMLGenerator {
public enum UIType {
- DROPDOWN, RADIO, RADIOGROUP, TEXTBOX;
+ DROPDOWN, RADIO, RADIOGROUP, TEXTBOX, PASSOWRD;
public static UIType fromString(String s) {
s = s.toLowerCase();
if (s.equals("dropdown"))
@@ -35,6 +35,8 @@
return RADIOGROUP;
else if (s.equals("textbox"))
return TEXTBOX;
+ else if (s.equals("password"))
+ return PASSOWRD;
else
throw new RuntimeException("Bad string");
}
@@ -49,6 +51,8 @@
return "radiogroup";
case TEXTBOX:
return "textbox";
+ case PASSOWRD:
+ return "password";
}
return "";
}
@@ -177,6 +181,8 @@
translate(p.getRadio(), UIType.RADIO);
else if (p.getDropdown() != null)
translate(p.getDropdown(), UIType.DROPDOWN);
+ else if (p.getPassword() != null)
+ translateBaseUI(p.getPassword(), UIType.PASSOWRD);
else
throw new RuntimeException("Unexpected UI type.");
}
@@ -186,6 +192,10 @@
case TEXTBOX:
drawTextBox(getRawData(b.getTitle()),
getSingleData(b.getDefault()));
break;
+ case PASSOWRD:
+ drawPasswordBox(getRawData(b.getTitle()),
getSingleData(b.getDefault()));
+ break;
+
default:
throw new RuntimeException("Unexpected BaseUI type.");
}
@@ -293,6 +303,18 @@
}
+
+ public void drawPasswordBox(String title, Tuple<Integer, String> t) {
+ System.out.println("WA --- Drawing a box : title: \"" + title
+ + "\" value : \"" + t.second() + "\"");
+ try {
+ html.singlerow_begin(20);
+ html.passtextbox(t.first() + "", title, t.second());
+ html.singlerow_end();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
// ////////////////////////////////////////////////////
// TODO: External HTMLUtil.java -> HTML tags and so on
public void drawTextBox(String title, Tuple<Integer, String> t) {
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
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -1,5 +1,7 @@
package org.perfsonar.webadmin.base2.config;
+import java.io.FileNotFoundException;
+import java.net.MalformedURLException;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@@ -8,6 +10,7 @@
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import org.perfsonar.webadmin.base2.util.NSContext;
import org.perfsonar.webadmin.base2.util.Tuple;
@@ -38,11 +41,18 @@
NSContext namespaces;
boolean sync = false;
- public ObjectMap(String basePath, String confPath, String file)
- throws Exception {
+ public ObjectMap(String basePath, String confPath, String file){
// TODO: Unix paths
waconfigfile = basePath + "/" + confPath + "/" + file;
- waconfig = WAXMLReader.parseFile(waconfigfile);
+ try {
+ waconfig = WAXMLReader.parseFile(waconfigfile);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (JAXBException e) {
+ e.printStackTrace();
+ }
this.basePath = basePath;
makeMap();
}
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
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -10,18 +10,28 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.perfsonar.webadmin.base2.config.ObjectMap;
import org.perfsonar.webadmin.base2.servlet.util.Base64;
import org.perfsonar.webadmin.base2.servlet.util.ConfigurationServletHelper;
+import org.perfsonar.webadmin.base2.waschema.v20090201.Credential;
+/**
+ *
+ * @author Slawomir Trzaszczka
+ *
+ */
@SuppressWarnings("serial")
public class BasicConfigurationServlet extends HttpServlet {
private final Logger logger = Logger.getAnonymousLogger();
+ private ObjectMap map;
+ private Credential credential;
public void init(ServletConfig arg0) throws ServletException {
super.init(arg0);
logger.info("Servlet initialized");
- ConfigurationServletHelper.objectMap(getServletContext());
+ map =
ConfigurationServletHelper.objectMap(getServletContext());
+ credential = map.getWA().getCredential();
}
/**
@@ -32,27 +42,26 @@
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws
ServletException, IOException {
-
String auth = request.getHeader("Authorization");
- if (!allowUser(auth, "a","a")) {
+ if (!allowUser(auth)) {
response.setHeader("WWW-Authenticate", "BASIC
realm=\"users\"");
- response.sendError(response.SC_UNAUTHORIZED);
- }else{
- logger.info("WA --- DO READ");
+
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ } else {
+ logger.info("DO READ");
- ConfigurationServletHelper config = new
ConfigurationServletHelper(request,getServletContext());
- String htmlContent=config.getHTMLContent();
- if(htmlContent!=null){
+ ConfigurationServletHelper config = new
ConfigurationServletHelper(
+ request, getServletContext());
+ String htmlContent = config.getHTMLContent();
+ if (htmlContent != null) {
request.setAttribute("form", htmlContent);
- }else{
+ } else {
logger.warning("form html content is null !");
}
getServletConfig().getServletContext().getRequestDispatcher(
"/index.jsp?page=form").forward(request, response);
}
-
-
+
}
/**
@@ -65,17 +74,16 @@
ConfigurationServletHelper config = new
ConfigurationServletHelper(
request, response, getServletContext());
- logger.info("WA --- DO WRITE");
+ logger.info("DO WRITE");
String urlPath = "index.jsp?page=save";
if (config.processData()) {
urlPath += "&ok";
}
-
response.sendRedirect(urlPath);
}
-
+
/**
* checks if the user is allowed to invoke this servlet
*
@@ -85,26 +93,24 @@
* @return
* @throws IOException
*/
- protected boolean allowUser(String auth, String username, String
password)
- throws IOException {
- if (auth == null){
+ protected boolean allowUser(String auth) throws IOException {
+ if (auth == null) {
return false;
}
- if (!auth.toUpperCase(Locale.getDefault()).startsWith("BASIC
")){
+ if (!auth.toUpperCase(Locale.getDefault()).startsWith("BASIC
")) {
return false;
}
String userpassEncoded = auth.substring(6);
+ String userpassDecoded = new String(Base64
+ .decodeString(userpassEncoded));
- Base64 dec=new Base64();
- String userpassDecoded = new
String(dec.decodeString(userpassEncoded));
-
- if (userpassDecoded.equals(username + ":" + password))
+ if (userpassDecoded.equals(credential.getUsername() + ":"
+ + credential.getPassword()))
return true;
else
return false;
}
-
};
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
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -2,11 +2,9 @@
import java.io.IOException;
import java.io.PrintStream;
-import java.util.Map;
import java.util.logging.Logger;
import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -33,14 +31,12 @@
*/
static final String WA_FILE_NAME = "wa.xml";
- HttpServletRequest request;
- HttpServletResponse response;
- PrintStream out;
- HttpSession session;
- String user;
- String password;
- ServletContext context;
- HTMLGenerator gen;
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+ private PrintStream out;
+ private HttpSession session;
+ private ServletContext context;
+ private HTMLGenerator gen;
public static synchronized ObjectMap objectMap(ServletContext
servletContext) {
ObjectMap ret = (ObjectMap)
servletContext.getAttribute("ObjectMap");
@@ -48,12 +44,8 @@
return ret;
// TODO: Fix Unix-paths
String basePath = servletContext.getRealPath("/") +
"/WEB-INF";
- try {
- ret = new ObjectMap(basePath, WA_CONFIG_PATH,
WA_FILE_NAME);
- servletContext.setAttribute("ObjectMap", ret);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ ret = new ObjectMap(basePath, WA_CONFIG_PATH, WA_FILE_NAME);
+ servletContext.setAttribute("ObjectMap", ret);
return ret;
}
@@ -77,13 +69,14 @@
}
}
-
- public ConfigurationServletHelper(HttpServletRequest
request,ServletContext context) {
+
+ public ConfigurationServletHelper(HttpServletRequest request,
+ ServletContext context) {
this.request = request;
- this.session=request.getSession(true);
- this.context=context;
+ this.session = request.getSession(true);
+ this.context = context;
this.gen = new HTMLGenerator();
-
+
// Set max interval to session
if (session.isNew()) {
session.setMaxInactiveInterval(SESSION_INTERVAL);
@@ -95,21 +88,9 @@
return objectMap(context);
}
- public void displayPage() {
- String pageParameterValue = getHttpParameter("page");
- /*
- * if( "save".equals(page) ) { try { response.sendRedirect(
- * response.encodeRedirectURL( request.getContextPath() +
- * "/index.jsp?save=" + objectMap().save() )); } catch(
Exception e ) {
- * e.printStackTrace(); } } else
- */
- displayPage(pageParameterValue);
- }
-
-
public String getHTMLContent() {
String pageParameterValue = getHttpParameter("page");
- return getHTMLContent(pageParameterValue);
+ return getHTMLContent(pageParameterValue);
}
/**
@@ -119,7 +100,7 @@
* @param pageType
*/
private void displayPage(String pageType) {
-
+ // TODO: change location of this piece of code
Tuple<String, String> ret = renderPage(pageType);
if (ret != null) {
@@ -146,13 +127,12 @@
}
}
-
-
+
private String getHTMLContent(String pageType) {
Tuple<String, String> ret = renderPage(pageType);
- StringBuffer sb=new StringBuffer();
-
+ StringBuffer sb = new StringBuffer();
+
if (ret != null) {
try {
HTMLUtilStringBuffer u = new
HTMLUtilStringBuffer(sb);
@@ -165,7 +145,7 @@
sb.append(ret.second());
u.form_end();
u.postscript();
- String htmlContent=u.getContent();
+ String htmlContent = u.getContent();
return htmlContent;
} catch (IOException e) {
e.printStackTrace();
@@ -173,70 +153,28 @@
} else {
return null;
}
-
+
return null;
}
@SuppressWarnings("unchecked")
public boolean processData() {
- boolean saved=false;
+ boolean saved = false;
logger.info("WA --- Processing client data.");
objectMap().updateObjects(request.getParameterMap());
- if(objectMap().save()){
+ if (objectMap().save()) {
logger.info("configuration saved");
- saved=true;
- }else{
+ saved = true;
+ } else {
logger.info("problem with saving configuration");
- saved=false;
+ saved = false;
}
logger.info("Done processing client data.");
displayPage(getHttpParameter("form_key"));
-
+
return saved;
}
- public boolean authenticate(Map<String, String> userpass) {
- if (getBooleanValueFromHttpSession("authenticated") == false)
{
- if (userpass == null) {
- session.setAttribute("authenticated", true);
- return true;
- }
- authenticate();
- String pass = userpass.get(user);
- boolean ret = pass != null && pass.equals(password);
- session.setAttribute("authenticated", ret);
- return ret;
- }
- return true;
- }
-
- private void authenticate() {
- String authorization = request.getHeader("Authorization");
- if (authorization == null) {
- askForPassword();
- } else {
- String userInfo = authorization.substring(6).trim();
- String nameAndPassword = new
String(Base64.decode(userInfo));
- int index = nameAndPassword.indexOf(":");
- user = nameAndPassword.substring(0, index);
- password = nameAndPassword.substring(index + 1);
- }
- }
-
- private void askForPassword() {
- response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- response.setHeader("WWW-Authenticate",
- "BASIC realm=\"perfSONAR-Admin\"");
- }
-
- private boolean getBooleanValueFromHttpSession(String paramName) {
- Object o = session.getAttribute(paramName);
- if (o == null)
- return false;
- else
- return ((Boolean) o).booleanValue();
- }
-
/**
*
* get Parameter from HttpRequest
@@ -266,21 +204,12 @@
if (page == null) {
return null;
} else {
- System.out.println("WA --- Looking up page \"" + page
+ "\"");
+ logger.info("Looking up page \"" + page + "\"");
found = gen.translate(page, objectMap(), new
PrintStream(sout));
- System.out.println("WA --- Page \"" + page + "\"
found " + found);
+ logger.info("Page \"" + page + "\" found " + found);
return new Tuple<String, String>(found ? page : null,
sout
.toString());
}
}
- public void forward(String url){
- try {
- context.getRequestDispatcher(url).forward(request,
response);
- } catch (ServletException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
};
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/HTMLUtil.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/HTMLUtil.java
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/HTMLUtil.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -1,9 +1,7 @@
package org.perfsonar.webadmin.base2.util;
-import java.io.PrintStream;
import java.io.IOException;
-import java.io.File;
-import java.io.FileOutputStream;
+import java.io.PrintStream;
public class HTMLUtil {
private PrintStream out = null;
@@ -30,10 +28,6 @@
return "<" + name + attr + "/>\n";
}
- public static String tag(String name) {
- return "<" + name + "/>\n";
- }
-
public static String btag(String name, String body, String... atts) {
String ret = "<" + name + " ";
if (atts != null && atts.length > 0) {
@@ -89,66 +83,10 @@
"value", value), att("onClick", onClick));
}
- public static String html(String body) {
- return btag("html", body);
- }
-
- public static String body(String bd) {
- return btag("body", bd);
- }
-
- public static String head(String bd) {
- return btag("head", bd);
- }
-
- public static String title(String bd) {
- return btag("title", bd);
- }
-
- public static String ul(String bd) {
- return btag("ul", bd);
- }
-
- public static String li(String bd) {
- return btag("li", bd);
- }
-
- public static String h1(String bd) {
- return btag("h1", bd);
- }
-
- public static String a(String href, String bd) {
- return btag("a", bd, att("href", href));
- }
-
- public static String br(String body) {
- return btag("br", body);
- }
-
- public static String tr(String body) {
- return btag("tr", body);
- }
-
- public static String td(String body) {
- return btag("td", body);
- }
-
- public static String td_col(String body) {
- return btag("td", body, att("colspan", "2"));
- }
-
- public static String span(String cls, String body) {
- return btag("span", body, att("class", cls));
- }
-
public static String colouredtext(String text, String colour) {
return tag("font", att("color", colour), text);
}
- public static String greenasterisk() {
- return "<span class=\"greenasterisk\" >*</span>";
- }
-
private static final String doctype = "<!DOCTYPE HTML PUBLIC
\"-//W3C//DTD HTML 4.01"
+ " Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\"> ";
private static final String cssFile = "default.css";
@@ -320,11 +258,6 @@
+ att("cellspacing", spacing + "%") + " >");
}
- public void form_begin(String key, String val, String url)
- throws IOException {
- form_begin(key, val, url, 10);
- }
-
public void form_end() throws IOException {
println(tag("tr", tag("td", nbsp)
+ tag("td", att("align", "right")
@@ -366,12 +299,6 @@
println("</table></center></div>");
}
- public void lineoftext(String text, String colour, int fill) {
- singlerow_begin(1, 2);
- println(tag("tr", tag("td", colouredtext(text + times(fill),
colour))));
- singlerow_end();
- }
-
public void simplelineoftext(String text, String colour) { // +
// att("colspan",""+span)
println("<tr><td " + " >\n"
@@ -384,38 +311,4 @@
+ tag("tr", tag("td", tag("p",
colouredtext(text, colour))))
+ "</td></tr>");
}
-
- //
- public static void main(String[] args) throws Exception {
- PrintStream p = new PrintStream(new FileOutputStream(new
File(args[0])));
- HTMLUtil u = new HTMLUtil(p);
- //
- u.preamble();
- u.form_begin("fkey", "keyval", "lalala", 1);
- u.lineoftext("Please fill in the following fields:", "green",
20);
-
- u.simplelineoftext("eXist configuration", "green");
- u.singlerow_begin(20);
- u.dropdown("key1", "This is a drop down list", new String[] {
"Val1",
- "Val2", "Val3" });
- u.singlerow_end();
-
- u.singlerow_begin(20);
- u.textbox("key2", "This is a textbox", "default text");
- u.radio("key1", "Radio", new String[] { "true", "false" });
- u.singlerow_end();
-
- boolean enabled = false;
- u.singlerow_begin(20);
- u.radiogroup_begin("key3", "Grouped box", "yes", "no",
enabled);
- u.textbox("key6", "This is a textbox", "default hidden text");
- u.dropdown("key7", "This is a drop down list", new String[] {
"Val1",
- "Val2", "Val3" });
- u.radiogroup_end();
- u.singlerow_end();
-
- u.form_end();
- u.postscript();
- p.close();
- }
};
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
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/WAXMLReader.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -2,9 +2,12 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.net.MalformedURLException;
import java.util.List;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import org.perfsonar.webadmin.base2.waschema.v20090201.WebAdminInterface;
@@ -16,7 +19,7 @@
"org.perfsonar.webadmin.base2.waschema.v20090201"; //
.WebAdminInterface";
public static Tuple<WebAdminInterface, JAXBContext> parseFile(
- String fileName) throws Exception {
+ String fileName) throws FileNotFoundException,
MalformedURLException, JAXBException{
File f = new File(fileName);
InputSource isource = new InputSource(new FileInputStream(f));
isource.setSystemId(f.toURL().toString());
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/PlainType.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/PlainType.java
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/PlainType.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -1,6 +1,10 @@
package org.perfsonar.webadmin.base2.waschema.v20090201;
public interface PlainType {
+ public org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
getPassword();
+
+ public void
setPassword(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
pPassword);
+
public org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
getTextbox();
public void
setTextbox(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
pTextbox);
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeDriver.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeDriver.java
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeDriver.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -18,26 +18,31 @@
public void marshalChilds(org.apache.ws.jaxme.impl.JMSAXDriverController
pController, org.xml.sax.ContentHandler pHandler, java.lang.Object pObject)
throws org.xml.sax.SAXException {
org.perfsonar.webadmin.base2.waschema.v20090201.PlainType _1 =
(org.perfsonar.webadmin.base2.waschema.v20090201.PlainType) pObject;
- org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType _2 =
_1.getTextbox();
+ org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType _2 =
_1.getPassword();
if (_2 != null) {
org.apache.ws.jaxme.impl.JMSAXDriver _3 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType.class).getDriver();
- pController.marshal(_3,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "textbox",
_1.getTextbox());
+ pController.marshal(_3,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "password",
_1.getPassword());
}
- org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType _4 =
_1.getRadio();
+ org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType _4 =
_1.getTextbox();
if (_4 != null) {
- org.apache.ws.jaxme.impl.JMSAXDriver _5 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class).getDriver();
- pController.marshal(_5,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radio",
_1.getRadio());
+ org.apache.ws.jaxme.impl.JMSAXDriver _5 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType.class).getDriver();
+ pController.marshal(_5,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "textbox",
_1.getTextbox());
}
- org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType _6 =
_1.getRadiogroup();
+ org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType _6 =
_1.getRadio();
if (_6 != null) {
- org.apache.ws.jaxme.impl.JMSAXDriver _7 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType.class).getDriver();
- pController.marshal(_7,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radiogroup",
_1.getRadiogroup());
+ org.apache.ws.jaxme.impl.JMSAXDriver _7 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class).getDriver();
+ pController.marshal(_7,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radio",
_1.getRadio());
}
- org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType _8 =
_1.getDropdown();
+ org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType _8 =
_1.getRadiogroup();
if (_8 != null) {
- org.apache.ws.jaxme.impl.JMSAXDriver _9 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class).getDriver();
- pController.marshal(_9,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "dropdown",
_1.getDropdown());
+ org.apache.ws.jaxme.impl.JMSAXDriver _9 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType.class).getDriver();
+ pController.marshal(_9,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radiogroup",
_1.getRadiogroup());
}
+ org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType _10 =
_1.getDropdown();
+ if (_10 != null) {
+ org.apache.ws.jaxme.impl.JMSAXDriver _11 =
pController.getJMMarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class).getDriver();
+ pController.marshal(_11,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "dropdown",
_1.getDropdown());
+ }
}
}
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeHandler.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeHandler.java
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeHandler.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -16,12 +16,12 @@
public boolean startElement(java.lang.String pNamespaceURI,
java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes
pAttr) throws org.xml.sax.SAXException {
org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl _1 = getHandler();
- if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "textbox".equals(pLocalName)) {
+ if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "password".equals(pLocalName)) {
if (__state) {
if (__childNum != 0) {
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING,
"Multiple different particles present in a choive group.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
} else {
-
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}textbox has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
+
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}password has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
}
}
__state = true;
@@ -29,61 +29,78 @@
org.apache.ws.jaxme.JMManager _2 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType.class);
java.lang.Object _3 = _2.getElementS();
org.apache.ws.jaxme.impl.JMSAXElementParser _4 = _2.getHandler();
- _4.init(_1, _3,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "textbox",
_1.getLevel());
+ _4.init(_1, _3,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "password",
_1.getLevel());
_4.setAttributes(pAttr);
_1.addElementParser(_4);
return true;
- } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "radio".equals(pLocalName)) {
+ } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "textbox".equals(pLocalName)) {
if (__state) {
if (__childNum != 1) {
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING,
"Multiple different particles present in a choive group.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
} else {
-
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}radio has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
+
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}textbox has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
}
}
__state = true;
__childNum = 1;
- org.apache.ws.jaxme.JMManager _5 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class);
+ org.apache.ws.jaxme.JMManager _5 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType.class);
java.lang.Object _6 = _5.getElementS();
org.apache.ws.jaxme.impl.JMSAXElementParser _7 = _5.getHandler();
- _7.init(_1, _6,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radio",
_1.getLevel());
+ _7.init(_1, _6,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "textbox",
_1.getLevel());
_7.setAttributes(pAttr);
_1.addElementParser(_7);
return true;
- } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "radiogroup".equals(pLocalName)) {
+ } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "radio".equals(pLocalName)) {
if (__state) {
if (__childNum != 2) {
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING,
"Multiple different particles present in a choive group.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
} else {
-
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}radiogroup
has already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
+
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}radio has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
}
}
__state = true;
__childNum = 2;
- org.apache.ws.jaxme.JMManager _8 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType.class);
+ org.apache.ws.jaxme.JMManager _8 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class);
java.lang.Object _9 = _8.getElementS();
org.apache.ws.jaxme.impl.JMSAXElementParser _10 = _8.getHandler();
- _10.init(_1, _9,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radiogroup",
_1.getLevel());
+ _10.init(_1, _9,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radio",
_1.getLevel());
_10.setAttributes(pAttr);
_1.addElementParser(_10);
return true;
- } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "dropdown".equals(pLocalName)) {
+ } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "radiogroup".equals(pLocalName)) {
if (__state) {
if (__childNum != 3) {
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING,
"Multiple different particles present in a choive group.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
} else {
-
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}dropdown has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
+
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}radiogroup
has already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
}
}
__state = true;
__childNum = 3;
- org.apache.ws.jaxme.JMManager _11 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class);
+ org.apache.ws.jaxme.JMManager _11 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType.class);
java.lang.Object _12 = _11.getElementS();
org.apache.ws.jaxme.impl.JMSAXElementParser _13 = _11.getHandler();
- _13.init(_1, _12,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "dropdown",
_1.getLevel());
+ _13.init(_1, _12,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "radiogroup",
_1.getLevel());
_13.setAttributes(pAttr);
_1.addElementParser(_13);
return true;
+ } else if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "dropdown".equals(pLocalName)) {
+ if (__state) {
+ if (__childNum != 4) {
+
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING,
"Multiple different particles present in a choive group.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
+ } else {
+
getHandler().validationEvent(javax.xml.bind.ValidationEvent.WARNING, "The
element {http://webadmin.perfsonar.org/base2/waschema/v20090201}dropdown has
already been defined.",
org.apache.ws.jaxme.ValidationEvents.EVENT_CHOICE_GROUP_REUSE, null);
+ }
+ }
+ __state = true;
+ __childNum = 4;
+ org.apache.ws.jaxme.JMManager _14 =
getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType.class);
+ java.lang.Object _15 = _14.getElementS();
+ org.apache.ws.jaxme.impl.JMSAXElementParser _16 = _14.getHandler();
+ _16.init(_1, _15,
"http://webadmin.perfsonar.org/base2/waschema/v20090201", "dropdown",
_1.getLevel());
+ _16.setAttributes(pAttr);
+ _1.addElementParser(_16);
+ return true;
}
return false;
}
@@ -92,24 +109,30 @@
org.perfsonar.webadmin.base2.waschema.v20090201.PlainType _1 =
(org.perfsonar.webadmin.base2.waschema.v20090201.PlainType) result;
switch (__childNum) {
case 0:
+ if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "password".equals(pLocalName)) {
+
_1.setPassword(((org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType)
pResult));
+ return;
+ }
+ break;
+ case 1:
if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "textbox".equals(pLocalName)) {
_1.setTextbox(((org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType)
pResult));
return;
}
break;
- case 1:
+ case 2:
if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "radio".equals(pLocalName)) {
_1.setRadio(((org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType)
pResult));
return;
}
break;
- case 2:
+ case 3:
if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "radiogroup".equals(pLocalName)) {
_1.setRadiogroup(((org.perfsonar.webadmin.base2.waschema.v20090201.ComplexGroupUIType)
pResult));
return;
}
break;
- case 3:
+ case 4:
if
("http://webadmin.perfsonar.org/base2/waschema/v20090201".equals(pNamespaceURI)
&& "dropdown".equals(pLocalName)) {
_1.setDropdown(((org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType)
pResult));
return;
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeImpl.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeImpl.java
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl/PlainTypeImpl.java
2009-12-29 15:14:10 UTC (rev 5436)
@@ -1,6 +1,8 @@
package org.perfsonar.webadmin.base2.waschema.v20090201.impl;
public class PlainTypeImpl implements
org.perfsonar.webadmin.base2.waschema.v20090201.PlainType {
+ private org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
_password;
+
private org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
_textbox;
private org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType
_radio;
@@ -10,6 +12,14 @@
private org.perfsonar.webadmin.base2.waschema.v20090201.ComplexUIType
_dropdown;
+ public org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
getPassword() {
+ return _password;
+ }
+
+ public void
setPassword(org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
pPassword) {
+ _password = pPassword;
+ }
+
public org.perfsonar.webadmin.base2.waschema.v20090201.BaseUIType
getTextbox() {
return _textbox;
}
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
2009-12-29 14:18:33 UTC (rev 5435)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
2009-12-29 15:14:10 UTC (rev 5436)
@@ -6,8 +6,8 @@
<!-- credential for WA -->
<wa:credential>
- <wa:username>aaaa</wa:username>
- <wa:password>aaaa</wa:password>
+ <wa:username>perfsonaruser</wa:username>
+ <wa:password>perfsonarpass</wa:password>
</wa:credential>
<wa:basiclink>
@@ -49,14 +49,14 @@
</wa:textbox>
</wa:plain>
<wa:plain>
- <wa:textbox>
+ <wa:password>
<wa:default>
<wa:xpath>
doc("classes/perfsonar/conf/wa.xml")//webAdmin:interface/webAdmin:credential/webAdmin:password
</wa:xpath>
</wa:default>
<wa:title><wa:text>password</wa:text></wa:title>
- </wa:textbox>
+ </wa:password>
</wa:plain>
</wa:page>
- perfsonar: r5436 - in branches/new-structure-with-base2/ps-mdm-web-admin: schema/xsd src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util src/main/java/org/perfsonar/webadmin/base2/util src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201 src/main/java/org/perfsonar/webadmin/base2/waschema/v20090201/impl tomcat/classes/perfsonar/conf, svnlog, 12/29/2009
Archive powered by MHonArc 2.6.16.