You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2010/09/03 03:17:58 UTC
svn commit: r992166 [2/2] - in /incubator/oodt/trunk: ./ grid/ grid/src/
grid/src/main/ grid/src/main/java/ grid/src/main/java/org/
grid/src/main/java/org/apache/ grid/src/main/java/org/apache/oodt/
grid/src/main/java/org/apache/oodt/grid/ grid/src/mai...
Added: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java (added)
+++ incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java Fri Sep 3 01:17:56 2010
@@ -0,0 +1,255 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.grid;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.xml.sax.SAXException;
+import org.apache.oodt.xmlquery.XMLQuery;
+
+/**
+ * Query servlet provides common query functionality for profile queries and product
+ * queries. It treats GETs as POSTs, retrieves the complete XMLQuery (if the
+ * <code>xmlq</code> request parameter appears) or constructs a new XMLQuery (using the
+ * <code>q</code> request parameter, which contains just a query expression), updates
+ * system properties for the handlers, instantiates any new handlers, and then runs the
+ * query.
+ *
+ */
+public abstract class QueryServlet extends GridServlet {
+ /**
+ * Get a list of {@link Server}s that will provide handlers to handle the query.
+ * Subclasses implement this by returning a list of either {@link ProductServer}s
+ * or {@link ProfileServer}s.
+ *
+ * @param config a <code>Configuration</code> value.
+ * @return a <code>List</code> value of {@link Server}s of some kind.
+ */
+ protected abstract List getServers(Configuration config);
+
+ /**
+ * Handle the query. Subclasses implement this by parsing the query and returning
+ * some results.
+ *
+ * @param query The query to handle.
+ * @param handlers A list of either product <code>QueryHandler</code>s or profile <code>ProfileHandler</code>s.
+ * @param req a <code>HttpServletRequest</code> value.
+ * @param res a <code>HttpServletResponse</code> value.
+ * @throws IOException if an I/O error occurs.
+ * @throws ServletException if a servlet error occurs.
+ */
+ protected abstract void handleQuery(XMLQuery query, List handlers, HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException;
+
+ /**
+ * Treat GETs as POSTs.
+ *
+ * @param req a <code>HttpServletRequest</code> value.
+ * @param res a <code>HttpServletResponse</code> value.
+ * @throws IOException if an error occurs.
+ * @throws ServletException if an error occurs.
+ */
+ public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+ doPost(req, res);
+ }
+
+ /**
+ * Handle the query.
+ *
+ * @param req a <code>HttpServletRequest</code> value.
+ * @param res a <code>HttpServletResponse</code> value.
+ * @throws IOException if an error occurs.
+ * @throws ServletException if an error occurs.
+ */
+ public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+ try {
+ XMLQuery query = getQuery(req, res); // Get the query
+ if (query == null) return; // No query? My favorite case, right here!
+
+ Configuration config = getConfiguration(); // Get the current configuration.
+ updateProperties(config); // Using it, update the system properties
+ updateHandlers(getServers(config)); // And any servers.
+
+ List handlerObjects = new ArrayList(handlers.size()); // Start with no handlers.
+ for (Iterator i = handlers.iterator(); i.hasNext();) { // For each server
+ InstantiedHandler ih = (InstantiedHandler) i.next(); // Get its handler
+ handlerObjects.add(ih.getHandler()); // Add its handler
+ }
+ handleQuery(query, handlerObjects, req, res); // Handlers: handle query, please
+ } catch (RuntimeException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new ServletException(ex);
+ }
+ }
+
+ /**
+ * Get the query from an HTTP request. The request must have either a
+ * <code>xmlq</code> parameter (which is given priority) or a <code>q</code>
+ * parameter. We expect <code>xmlq</code> to contain the XML text format of an
+ * XMLQuery object. <code>q</code> can contain just the query expression, from
+ * which we'll construct a fresh <code>XMLQuery</code> with reasonable defaults.
+ * If the user specifies the <code>q</code> paramater, we'll treat it as a parsed
+ * query, letting the XMLQuery class parse it and build its various expression
+ * stacks according to the DIS syntax. The user can specify the <code>unp</code>
+ * parameter to control this behavior, though. Set to the string
+ * <code>true</code> and we'll treat the query as <em>unparsed</em>, and the
+ * XMLQuery class should leave it alone. Otherwise, an other value (or
+ * unspecified) will be interpreted as <code>false</code>, meaning the query will
+ * be parsed.
+ *
+ * @param req a <code>HttpServletRequest</code> value.
+ * @param res a <code>HttpServletResponse</code> value.
+ * @return a <code>XMLQuery</code> value.
+ * @throws IOException if an error occurs.
+ */
+ private XMLQuery getQuery(HttpServletRequest req, HttpServletResponse res) throws IOException {
+ String xmlq = req.getParameter("xmlq"); // Grab any xmlq
+ String q = req.getParameter("q"); // Grab any q
+ String unp = req.getParameter("unp"); // And grab any unp (pronounced "unp")
+ if (xmlq == null) xmlq = ""; // No xmlq? Use epsilon
+ if (q == null) q = ""; // No q? Use lambda
+ if (unp == null) unp = ""; // Use some other greek letter for empty str
+ String[] mimes = req.getParameterValues("mime"); // Grab any mimes
+ if (mimes == null) mimes = EMPTY_STRING_ARRAY; // None? Use empty array
+
+ if (xmlq.length() > 0) try { // Was there an xmlq?
+ return new XMLQuery(xmlq); // Use it in its entirety, ignoring the rest
+ } catch (SAXException ex) { // Can't parse it?
+ res.sendError(HttpServletResponse.SC_BAD_REQUEST, // Then that's a bad ...
+ "cannot parse xmlq: " + ex.getMessage()); // ... request, which I hate
+ return null; // so flag it with a null
+ } else if (q.length() > 0) { // Was there a q?
+ boolean unparsed = "true".equals(unp); // If so, was there also an unp?
+ return new XMLQuery(q, "wgq", "Web Grid Query", // Use it to make an XMLQuery
+ "Query from Web-Grid", /*ddID*/null, // And all of these extra
+ /*resultModeId*/null, /*propType*/null, // parameters really annoy
+ /*propLevels*/null, /*maxResults*/Integer.MAX_VALUE, // the poop out of me
+ Arrays.asList(mimes), !unparsed); // It's just a query for /sbin/fsck sake!
+ }
+
+ res.sendError(HttpServletResponse.SC_BAD_REQUEST, "xmlq or q parameters required");
+ return null;
+ }
+
+ /**
+ * Update the query handlers instantiated.
+ *
+ * @param servers a <code>List</code> of {@link Server}s.
+ * @throws ClassNotFoundException if a class can't be found.
+ * @throws InstantiationException if a class can't be instantiated.
+ * @throws IllegalAccessException if a constructor isn't public.
+ */
+ private synchronized void updateHandlers(List servers) throws ClassNotFoundException, InstantiationException,
+ IllegalAccessException {
+ eachServer:
+ for (Iterator i = servers.iterator(); i.hasNext();) { // For each server
+ Server server = (Server) i.next(); // Grab the server
+ for (Iterator j = handlers.iterator(); j.hasNext();) { // For each handler
+ InstantiedHandler handler = (InstantiedHandler) j.next(); // Grab the handler
+ if (handler.getServer().equals(server)) // Have we already instantiated?
+ continue eachServer; // Yes, try the next server
+ }
+ InstantiedHandler handler // No. Create ...
+ = new InstantiedHandler(server, server.createHandler()); // ... a fresh handler
+ handlers.add(handler); // Save it
+ }
+
+ for (Iterator i = handlers.iterator(); i.hasNext();) { // Now, for each handler
+ InstantiedHandler handler = (InstantiedHandler) i.next(); // Grab the handler
+ if (!servers.contains(handler.getServer())) // Does its server still exist?
+ i.remove(); // If not, remove the handler
+ }
+ }
+
+ /**
+ * Update system properties used by query handlers, if any have changed.
+ *
+ * @param config a <code>Configuration</code> value.
+ */
+ private synchronized void updateProperties(Configuration config) {
+ if (properties != null) { // Any old properties?
+ if (properties.equals(config.getProperties())) return; // Yes, any changes? No? Then done.
+ for (Iterator i = properties.keySet().iterator(); i.hasNext();) // Yes, then grab each old setting
+ System.getProperties().remove(i.next()); // and remove it.
+ }
+ properties = (Properties) config.getProperties().clone(); // Now copy the new settings
+ System.getProperties().putAll(properties); // And set them!
+ }
+
+ /**
+ * Instantiated query handlers.
+ *
+ * These are either <code>ProfileHandler</code>s or product <code>QueryHandler</code>s.
+ */
+ protected List handlers = new ArrayList();
+
+ /** Current settings of system properties. */
+ private Properties properties;
+
+ /**
+ * An instantiated handler. This is a <code>ProfileHandler</code> or a product
+ * <code>QueryHandler</code> along with the {@link Server} that defined it.
+ */
+ private static class InstantiedHandler {
+ /**
+ * Creates a new <code>InstantiedHandler</code> instance.
+ *
+ * @param server a <code>Server</code>.
+ * @param handler a <code>ProfileHandler</code> or a product <code>QueryHandler</code>.
+ */
+ InstantiedHandler(Server server, Object handler) {
+ this.server = server;
+ this.handler = handler;
+ }
+
+ /**
+ * Get the server that defined this handler.
+ *
+ * @return a <code>Server</code> value.
+ */
+ public Server getServer() {
+ return server;
+ }
+
+ /**
+ * Get the handler.
+ *
+ * @return a <code>ProfileHandler</code> or a product <code>QueryHandler</code>.
+ */
+ public Object getHandler() {
+ return handler;
+ }
+
+ /** Server that defines the handler. */
+ private Server server;
+
+ /** A <code>ProfileHandler</code> or a product <code>QueryHandler</code> */
+ private Object handler;
+ }
+
+ /** So we don't create a bunch of empty string arrays, here's the only one we'll ever need. */
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+}
Propchange: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Server.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Server.java?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Server.java (added)
+++ incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Server.java Fri Sep 3 01:17:56 2010
@@ -0,0 +1,170 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.grid;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.net.URLClassLoader;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import java.util.List;
+
+/**
+ * An abstract server defines the code base and class name of a query handler.
+ *
+ */
+public abstract class Server implements Serializable {
+ /**
+ * Creates a new <code>Server</code> instance.
+ *
+ * @param configuration
+ * System configuration.
+ * @param className
+ * Class name of the query handler.
+ */
+ public Server(Configuration configuration, String className) {
+ this.configuration = configuration;
+ this.className = className;
+ }
+
+ /**
+ * Render this server into XML.
+ *
+ * @param owner
+ * Owning document.
+ * @return This server, as XML.
+ */
+ public Node toXML(Document owner) {
+ Element elem = owner.createElement("server");
+ elem.setAttribute("className", className);
+ elem.setAttribute("type", getType());
+ return elem;
+ }
+
+ /**
+ * Get the class name of the query handler.
+ *
+ * @return Class name of the query handler.
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * Create the handler.
+ *
+ * @return an instantiated handlre.
+ * @throws ClassNotFoundException
+ * if the handler class can't be found.
+ * @throws InstantiationException
+ * if the handler object can't be created.
+ * @throws IllegalAccessException
+ * if the handler class doesn't provide a public no-args
+ * constructor.
+ */
+ public Object createHandler() throws ClassNotFoundException,
+ InstantiationException, IllegalAccessException {
+ List urlList = configuration.getCodeBases();
+ Class clazz;
+ if (urlList.isEmpty())
+ clazz = Class.forName(className);
+ else {
+ URL[] urls = (URL[]) urlList.toArray(EMPTY_URL_ARRAY);
+ URLClassLoader loader = new URLClassLoader(urls, getClass()
+ .getClassLoader());
+ clazz = loader.loadClass(className);
+ }
+ return clazz.newInstance();
+ }
+
+ /**
+ * Set the class name of the handler.
+ *
+ * @param className
+ * Class name of the handler.
+ */
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ /**
+ * Return the type of the handler.
+ *
+ * @return Either <code>product</code> or <code>profile</code>.
+ */
+ protected abstract String getType();
+
+ public int hashCode() {
+ return configuration.hashCode() ^ className.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj instanceof Server) {
+ Server rhs = (Server) obj;
+ return configuration.equals(configuration)
+ && className.equals(rhs.className);
+ }
+ return false;
+ }
+
+ public String toString() {
+ return "Server[className=" + className + "]";
+ }
+
+ /**
+ * Create a server from an XML element.
+ *
+ * @param elem
+ * XML element, presumed to be a <server> element.
+ * @return a <code>Server</code> subclass.
+ * @throws SAXException
+ * if the element can't be properly parsed.
+ */
+ public static Server create(Configuration configuration, Element elem)
+ throws SAXException {
+ String type = elem.getAttribute("type");
+ if (type == null)
+ throw new SAXException("type attribute missing from <"
+ + elem.getNodeName() + ">");
+
+ String className = elem.getAttribute("className");
+ if (className == null)
+ throw new SAXException("className attribute missing from <"
+ + elem.getNodeName() + ">");
+
+ // Replace with a factory some day...
+ if ("product".equals(type))
+ return new ProductServer(configuration, className);
+ else if ("profile".equals(type))
+ return new ProfileServer(configuration, className);
+ else
+ throw new SAXException("unknown server type `" + type + "'");
+ }
+
+ /** Configuration. */
+ protected Configuration configuration;
+
+ /** Class name of the handler class. */
+ protected String className;
+
+ private static final URL[] EMPTY_URL_ARRAY = new URL[0];
+}
Propchange: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Server.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Utility.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Utility.java?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Utility.java (added)
+++ incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Utility.java Fri Sep 3 01:17:56 2010
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.grid;
+
+/**
+ * Utility methods for web grid.
+ *
+ */
+public class Utility {
+ /**
+ * Provide XHTML-safe escaping for a string. Basically, this is the same as
+ * XML-escaping, but since some user agents don't recognize
+ * <code>&apos;</code>, we use <code>&#39;</code> instead.
+ *
+ * @param str
+ * String to escape.
+ * @return <var>str</var> escaped.
+ */
+ public static String esc(String str) {
+ StringBuffer s = new StringBuffer(str.length()); // Assume at least the same
+ // length
+ for (int i = 0; i < str.length(); ++i) { // For each character
+ char c = str.charAt(i); // Grab the character
+ switch (c) { // Now consider what it is ...
+ case '<': // A less than?
+ s.append("<"); // Well, that's <
+ break;
+ case '>': // A greater than?
+ s.append(">"); // That's >
+ break;
+ case '&': // An ampersand?
+ s.append("&"); // We all know what that is
+ break;
+ case '\'': // A tick?
+ s.append("'"); // Not ' ! TRICKY!
+ break;
+ case '\"': // A quote?
+ s.append("""); // Yadda, yadda, yadda
+ break;
+ default: // Anything else may pass
+ s.append(c); // ... through unchanged
+ break;
+ }
+ }
+ return s.toString(); // Donenacious.
+ }
+
+ /**
+ * Tell if a host name refers to the localhost. This checks the standard IPv6
+ * address, IPv4 address, and host name for localhost.
+ *
+ * @param host
+ * Host name to check.
+ * @return True if <var>host</var> names the localhost.
+ */
+ public static boolean isLocalhost(String host) {
+ return "0:0:0:0:0:0:0:1".equals(host) || "127.0.0.1".equals(host)
+ || "localhost".equals(host);
+ }
+
+ /**
+ * Do not call.
+ */
+ private Utility() {
+ throw new IllegalStateException("This is a \u00abutility\u00bb class");
+ }
+}
Propchange: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Utility.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/oodt/trunk/grid/src/main/java/org/apache/oodt/grid/Utility.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/META-INF/context.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/META-INF/context.xml?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/META-INF/context.xml (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/META-INF/context.xml Fri Sep 3 01:17:56 2010
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<Context
+ cookies='true'
+ override='true'
+ privileged='false'
+ reloadable='false'
+ unpackWAR='true'/>
Propchange: incubator/oodt/trunk/grid/src/main/webapp/META-INF/context.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/jetty-web.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/jetty-web.xml?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/jetty-web.xml (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/jetty-web.xml Fri Sep 3 01:17:56 2010
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<!DOCTYPE Configure PUBLIC '-//Mort Bay Consulting//DTD Configure 1.2//EN' 'http://jetty.mortbay.org/configure_1_2.dtd'>
+<Configure class='org.mortbay.jetty.servlet.WebApplicationContext'>
+ <Set name='extractWAR'>true</Set>
+</Configure>
Propchange: incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/jetty-web.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/web.xml?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/web.xml Fri Sep 3 01:17:56 2010
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <icon>
+ <small-icon>images/webapp-small.png</small-icon>
+ <large-icon>images/webapp-large.png</large-icon>
+ </icon>
+ <display-name>Web Grid</display-name>
+ <description>
+ Web Grid is an OODT web application that provides HTTP based
+ access to OODT profile and product query handlers. It also
+ includes web accessible configuration and updates with a simple
+ administrative security policy.
+ </description>
+ <distributable/>
+ <servlet>
+ <servlet-name>product</servlet-name>
+ <display-name>Product</display-name>
+ <description>
+ </description>
+ <servlet-class>org.apache.oodt.grid.ProductQueryServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>profile</servlet-name>
+ <display-name>Profile</display-name>
+ <description>
+ </description>
+ <servlet-class>org.apache.oodt.grid.ProfileQueryServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>config</servlet-name>
+ <display-name>Configure</display-name>
+ <description>
+ </description>
+ <servlet-class>org.apache.oodt.grid.ConfigServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>login</servlet-name>
+ <display-name>Login</display-name>
+ <description>
+ </description>
+ <servlet-class>org.apache.oodt.grid.LoginServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>product</servlet-name>
+ <url-pattern>/prod</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>profile</servlet-name>
+ <url-pattern>/prof</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>config</servlet-name>
+ <url-pattern>/conf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>login</servlet-name>
+ <url-pattern>/login</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>0</session-timeout>
+ </session-config>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+ <error-page>
+ <exception-type>org.apache.oodt.grid.AuthenticationRequiredException</exception-type>
+ <location>/error.jsp</location>
+ </error-page>
+</web-app>
Propchange: incubator/oodt/trunk/grid/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/config.jsp
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/config.jsp?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/config.jsp (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/config.jsp Fri Sep 3 01:17:56 2010
@@ -0,0 +1,195 @@
+<%@ page language="java" session="true" contentType="text/html; charset=UTF-8" info="Config" errorPage="error.jsp"
+ import="java.util.Map,java.util.Iterator,org.apache.oodt.grid.Server,org.apache.oodt.grid.Utility,java.net.URL" %>
+<%--
+Copyright 2005 California Institute of Technology. ALL RIGHTS
+RESERVED. U.S. Government Sponsorship acknowledged.
+
+$Id: config.jsp,v 1.4 2005/06/14 20:00:40 kelly Exp $
+--%>
+<jsp:useBean id="cb" scope="session" class="org.apache.oodt.grid.ConfigBean"/>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
+ <head>
+ <title>Web Grid Configuration</title>
+ <link rel='stylesheet' type='text/css' href='style.css'/>
+ </head>
+ <body>
+ <h1>Web Grid Configuration</h1>
+
+ <% if (cb.getMessage().length() > 0) { %>
+ <div class='error'><jsp:getProperty name='cb' property='message'/></div>
+ <% } %>
+
+ <form action='conf' method='post'>
+
+ <fieldset>
+ <legend>Administrative Settings</legend>
+ <div class='field'>
+ <label for='passwordField'>New Administrator Password</label>
+ <div class='fieldHelp'>
+ Leave blank to leave password unchanged.
+ </div>
+ <input id='passwordField' type='password' name='password'/>
+ </div>
+
+ <div class='field'>
+ <label for='lhf'>Require Administrative Access from Local Host Only</label>
+ <div class='fieldHelp'>
+ Click Yes to enable administrative access from browsers
+ running on the local web-server host only. Click No to
+ allow any host to access these administrative pages.
+ </div>
+ <input id='lhf' type='radio' name='localhost' value='on' <%= cb.isLocalhostRequired()? "checked='checked'" : "" %> />Yes
+ <input type='radio' name='localhost' value='off' <%= !cb.isLocalhostRequired()? "checked='checked'" : "" %> />No
+ </div>
+
+ <div class='field'>
+ <label for='httpsField'>Require HTTPS for Administrative Access</label>
+ <div class='fieldHelp'>
+ Click Yes to require HTTPS for access to these administrative pages. Note that this will require
+ your web server to also support HTTPS. If you're not sure, <strong>click No</strong>.
+ </div>
+ <input id='httpsField' type='radio' name='https' value='on' <%= cb.isHttpsRequired()? "checked='checked'" : "" %> />Yes
+ <input type='radio' name='https' value='off' <%= !cb.isHttpsRequired()? "checked='checked'" : "" %> />No
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <legend>System Properties</legend>
+ <div class='field'>
+ <div class='fieldHelp'>To add a new system property, enter
+ its key and value at the bottom. You can change the values
+ of existing properties. To delete an existing property,
+ check the box to its right.</div>
+ <table>
+ <thead><tr><th>#</th><th>Key</th><th>Value</th><th>Delete?</th></tr></thead>
+ <tbody>
+ <% int row = 1; for (Iterator i = cb.getProperties().entrySet().iterator(); i.hasNext(); ++row) {
+ Map.Entry entry = (Map.Entry) i.next();
+ String key = (String) entry.getKey();
+ String val = (String) entry.getValue();
+ %>
+ <tr class='<%= row % 2 == 0? "evenRow" : "oddRow"%>'>
+ <td><%= row %>.</td>
+ <td><span class='key'><%= Utility.esc(key) %></span></td>
+ <td><input type='text' name='val-<%= Utility.esc(key) %>' value='<%= Utility.esc(val) %>'/></td>
+ <td><input type='checkbox' name='del-<%= Utility.esc(key) %>'/></td>
+ </tr>
+ <% } %>
+ <tr class='newRow'>
+ <td>(New)</td>
+ <td><input type='text' id='newkey' name='newkey'/></td>
+ <td><input type='text' id='newval' name='newval'/></td>
+ <td> </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <legend>Code Bases</legend>
+ <div class='fieldHelp'>Specify a URL for each code base. URLs
+ to files are assumed to be jar files. URLs that end in a
+ <code>/</code> refer to directories containing class files.
+ Check the box to delete a code base.
+ </div>
+
+ <table>
+ <thead><tr><th>#</th><th>Code Base</th><th>Delete?</th></thead>
+ <tbody>
+ <% row = 0; for (Iterator i = cb.getConfiguration().getCodeBases().iterator(); i.hasNext(); ++row) {
+ URL codeBaseURL = (URL) i.next();
+ %>
+ <tr class='<%= row+1 % 2 == 0? "evenRow" : "oddRow"%>'>
+ <td><%= row+1 %>.</td>
+ <td><%= Utility.esc(codeBaseURL.toString()) %></td>
+ <td><input type='checkbox' name='delcb-<%= row %>'/></td>
+ </tr>
+ <% } %>
+ <tr class='newRow'>
+ <td>(New)</td>
+ <td><input type='text' name='newcb'/></td>
+ <td> </td>
+ </tr>
+ </tbody>
+ </table>
+ </fieldset>
+
+ <table>
+ <caption>Query Handlers</caption>
+ <tbody>
+ <tr style="vertical-align: top;">
+ <td>
+ <fieldset>
+ <legend>Product Query Handlers</legend>
+ <div class='field'>
+ <div class='fieldHelp'>Specify the class name for each
+ product query handler; the class must implement the
+ <code>jpl.eda.product.QueryHandler</code> interface.</div>
+ <table>
+ <thead><tr><th>#</th><th>Class Name</th><th>Delete?</th></tr></thead>
+ <tbody>
+ <% row = 0; for (Iterator i = cb.getProductServers().iterator(); i.hasNext(); ++row) {
+ Server server = (Server) i.next();
+ String className = server.getClassName();
+ %>
+ <tr class='<%= row % 2 == 0? "oddRow" : "evenRow" %>'>
+ <td><%= row+1 %>.</td>
+ <td><code><%= Utility.esc(className) %></code></td>
+ <td><input type='checkbox' name='drm-<%= row %>'/></td>
+ </tr>
+ <% } %>
+ <tr class='newRow'>
+ <td>(New)</td>
+ <td><input type='text' name='d-newcn'/></td>
+ <td> </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </fieldset>
+ </td>
+ <td>
+ <fieldset>
+ <legend>Profile Query Handlers</legend>
+ <div class='field'>
+ <div class='fieldHelp'>Specify the class name for each
+ profile query handler; the class must implement the
+ <code>jpl.eda.profile.handlers.ProfileHandler</code> interface.</div>
+ <table>
+ <thead><tr><th>#</th><th>Class Name</th><th>Delete?</th></tr></thead>
+ <tbody>
+ <% row = 0; for (Iterator i = cb.getProfileServers().iterator(); i.hasNext(); ++row) {
+ Server server = (Server) i.next();
+ String className = server.getClassName();
+ %>
+ <tr class='<%= row % 2 == 0? "oddRow" : "evenRow" %>'>
+ <td><%= row+1 %>.</td>
+ <td><code><%= Utility.esc(className) %></code></td>
+ <td><input type='checkbox' name='mrm-<%= row %>'/></td>
+ </tr>
+ <% } %>
+ <tr class='newRow'>
+ <td>(New)</td>
+ <td><input type='text' name='m-newcn'/></td>
+ <td> </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </fieldset>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class='formControls'>
+ <input type='submit' name='submit' value='Save Changes'/>
+ </div>
+
+ </form>
+
+ </body>
+</html>
Propchange: incubator/oodt/trunk/grid/src/main/webapp/config.jsp
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/error.jsp
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/error.jsp?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/error.jsp (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/error.jsp Fri Sep 3 01:17:56 2010
@@ -0,0 +1,60 @@
+<%@ page language="java" session="true" contentType="text/html; charset=UTF-8" info="Config" isErrorPage="true"
+ import="org.apache.oodt.grid.AuthenticationRequiredException,java.io.StringWriter,java.io.PrintWriter"
+%>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<jsp:useBean id="cb" scope="session" class="org.apache.oodt.grid.ConfigBean"/>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
+ <head>
+ <title>Web Grid</title>
+ <link rel='stylesheet' type='text/css' href='style.css'/>
+ </head>
+ <body>
+ <%! StringWriter s = new StringWriter();
+ PrintWriter w = new PrintWriter(s); %>
+ <% exception.printStackTrace(w); w.close(); %>
+
+ <h1>Web Grid</h1>
+ <% if (cb.getMessage().length() > 0) { %>
+ <div class='error'><jsp:getProperty name='cb' property='message'/></div>
+ <% } %>
+
+ <% if (exception instanceof AuthenticationRequiredException) { %>
+ <form action='login' method='post'>
+ <fieldset>
+ <legend>Log In</legend>
+ <div class='field'>
+ <label for='pw'>Administrator password:</label>
+ <div class='fieldHelp'>
+ Passwords are case sensitve; check your CAPS LOCK key, if necessary.
+ </div>
+ <input id='pw' type='password' name='password'/>
+ </div>
+ <div class='formControls'>
+ <input type='submit' name='submit' value='Log In'/>
+ </div>
+ </fieldset>
+ </form>
+ <% } else { %>
+ <h1>Error</h1>
+ <div>Exception <code><%= exception.getClass().getName() %></code>: <%= exception.getMessage() %></div>
+ <pre><%= s.getBuffer().toString() %></pre>
+ <% } %>
+ </body>
+</html>
Propchange: incubator/oodt/trunk/grid/src/main/webapp/error.jsp
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/images/webapp-large.png
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/images/webapp-large.png?rev=992166&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/oodt/trunk/grid/src/main/webapp/images/webapp-large.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/oodt/trunk/grid/src/main/webapp/images/webapp-large.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/oodt/trunk/grid/src/main/webapp/images/webapp-small.png
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/images/webapp-small.png?rev=992166&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/oodt/trunk/grid/src/main/webapp/images/webapp-small.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/oodt/trunk/grid/src/main/webapp/images/webapp-small.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/oodt/trunk/grid/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/index.html?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/index.html (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/index.html Fri Sep 3 01:17:56 2010
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
+ <head>
+ <title>Web Grid</title>
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ </head>
+ <h1>Web Grid</h1>
+ <ul>
+ <li><a href='config.jsp'>Configure</a> the system</li>
+ <li><a href='http://oodt.jpl.nasa.gov/web-grid/'>Learn more</a> about OODT web-based grid technologies</li>
+ </ul>
+ <p>OODT is a product of the <a href="http://www.apache.org/">Apache Software Foundation</a>. Check out
+ our <a href="http://incubator.apache.org/oodt/">web page</a> for more information.
+ </p>
+</html>
Propchange: incubator/oodt/trunk/grid/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/main/webapp/style.css
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/main/webapp/style.css?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/main/webapp/style.css (added)
+++ incubator/oodt/trunk/grid/src/main/webapp/style.css Fri Sep 3 01:17:56 2010
@@ -0,0 +1,161 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+*/
+body {
+ font-family: "Lucida Grande", Helvetica, sans;
+ background-color: white;
+ color: black;
+ margin: 2em;
+ padding: 0;
+ vertical-align: top;
+}
+
+h1 {
+ font-size: 160%;
+}
+
+h2 {
+ font-size: 150%;
+}
+
+h3 {
+ font-size: 140%;
+ border-bottom: none;
+ font-weight: bold;
+}
+
+fieldset {
+ border: 1 solid #336699;
+ margin: 1em 0em 1em 0em;
+ padding: 0em 1em 1em 1em;
+ line-height: 1.5em;
+ width: auto;
+}
+
+legend {
+ background: white;
+ padding: 0.5em;
+ font-size: 90%;
+}
+
+form {
+ border: none;
+ margin: 0;
+}
+
+textarea {
+ font: 110% "American Typewriter", Courier, monospace;
+ border: 1 solid #369;
+ color: black;
+ background-color: white;
+ width: 100%;
+}
+
+input {
+ font-family: <dtml-var fontFamily>;
+ visibility: visible;
+ border: 1 solid #369;
+ color: black;
+ background-color: white;
+ vertical-align: middle;
+}
+
+select {
+ border: 1 solid #369;
+ color: black;
+ vertical-align: top;
+}
+
+.field {
+ top: 0;
+ left: 0;
+ margin: 0 1em 1em 0;
+}
+
+.field .field {
+ margin: 1em 0 0 0;
+}
+
+.field label {
+ font-size: 100%;
+ font-weight: bold;
+}
+
+.fieldRequired {
+ background: url(required.gif) center left no-repeat;
+ padding: 0 0 0 8px;
+ color: black;
+}
+
+.fieldHelp {
+ font-size: 90%;
+ color: #666;
+ margin: 0 0 0.2em 0;
+}
+
+.formHelp:hover {
+ color: black;
+ cursor: default;
+}
+
+.formControls {
+ margin: 1em 0 0 0;
+}
+
+.error {
+ /* Class for error indication in forms */
+ color: #ff6633;
+ border: 1 solid #ff6633;
+ padding: 1em;
+ margin: 0 0 1em 0;
+ width: 68% !important;
+}
+
+.evenRow {
+ background: #eee;
+}
+
+.newRow {
+ border-top: solid;
+ border-width: 1;
+ background: #ffe;
+}
+
+th {
+ border-bottom: solid;
+ border-width: 1px;
+ vertical-align: top;
+}
+
+tr {
+ vertical-align: top;
+}
+
+td {
+ vertical-align: top;
+}
+
+tbody {
+ vertical-align: top;
+}
+
+table {
+ vertical-align: top;
+}
+
+caption {
+ font-size: 150%
+}
Propchange: incubator/oodt/trunk/grid/src/main/webapp/style.css
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/site/resources/images/web-grid.jpg
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/site/resources/images/web-grid.jpg?rev=992166&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/oodt/trunk/grid/src/site/resources/images/web-grid.jpg
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/oodt/trunk/grid/src/site/resources/images/web-grid.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/oodt/trunk/grid/src/site/resources/images/web-grid.psd
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/site/resources/images/web-grid.psd?rev=992166&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/oodt/trunk/grid/src/site/resources/images/web-grid.psd
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/oodt/trunk/grid/src/site/resources/images/web-grid.psd
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/oodt/trunk/grid/src/site/resources/slides.pdf
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/site/resources/slides.pdf?rev=992166&view=auto
==============================================================================
Files incubator/oodt/trunk/grid/src/site/resources/slides.pdf (added) and incubator/oodt/trunk/grid/src/site/resources/slides.pdf Fri Sep 3 01:17:56 2010 differ
Propchange: incubator/oodt/trunk/grid/src/site/resources/slides.pdf
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/site/site.xml?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/site/site.xml (added)
+++ incubator/oodt/trunk/grid/src/site/site.xml Fri Sep 3 01:17:56 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<project name="Web Grid">
+
+ <body>
+ <links>
+ <item name="OODT" href="../oodt-site/"/>
+ <item name="Grid" href="../grid/"/>
+ </links>
+
+ <menu ref="reports" inherit="bottom"/>
+
+ </body>
+
+</project>
Added: incubator/oodt/trunk/grid/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/site/xdoc/index.xml?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/site/xdoc/index.xml (added)
+++ incubator/oodt/trunk/grid/src/site/xdoc/index.xml Fri Sep 3 01:17:56 2010
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
+license agreements. See the NOTICE.txt file distributed with this work for
+additional information regarding copyright ownership. The ASF licenses this
+file to you under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<document>
+ <properties>
+ <title>Web Grid</title>
+ <author email='Sean.Kelly@jpl.nasa.gov'>Sean Kelly</author>
+ </properties>
+ <!-- Sirius Isness - Irrational Substance -->
+ <body>
+ <section name='Web Grid'>
+ <p>The OODT <a href='/grid/'>grid services</a>
+ (<a href='/grid-product/'>product</a>
+ and <a href='/grid-profile/'>profile</a> services) use CORBA
+ or RMI as their underlying network transport. However,
+ limitations of CORBA and RMI make them inappropriate for
+ large-scale deployments. For one, both are procedural
+ mechanisms, providing a remote interface that resembles a
+ method call. This makes streaming of data from a service
+ impossible, because there are limitations to the sizes of data
+ structures that can be passed over a remote method call.
+ Instead, repeated calls must be made to retrieve each block of
+ a product, making transfer speeds horribly slow compared to
+ HTTP or FTP. (Block-based retrieval of profiles was never
+ implemented, resulting in out of memory conditions for large
+ profile results, which is another problem.)
+ </p>
+ <p>Second, both CORBA and RMI rely on a central name registry.
+ The registry makes an object independent of its network
+ location, enabling a client to call it by name (looking up its
+ last known location in the registry). However, this requires
+ that server objects be able to make outbound network calls to
+ the registry (through any outbound firewall), and that the
+ registry accept those registrations (through any inbound
+ firewall). This required administrative action at
+ institutions hosting server objects and at the institution
+ hosting the registry. Often, these firewall exceptions would
+ change without notice as system adminstrators changed at each
+ location (apparently firewall exceptions are poorly documented
+ everywhere).
+ </p>
+ <p>Further, in the two major deployments of OODT (PDS and EDRN),
+ server objects have almost never moved, nullifying any benefit
+ of the registry. This project, OODT Web Grid, avoids the
+ prolems of CORBA and RMI by using HTTP as the transport
+ mechanism for products and profiles. Further, it provides a
+ password-protected mechanism to add new sets of product and
+ profile query handlers, enabling seamless activation of
+ additional capabilities.
+ </p>
+ </section>
+ <section name='Documentation'>
+ <p>Further documentation on Web Grid is forthcoming. In the
+ mean time, check out these <a href='slides.pdf'>presentation
+ slides</a>. (Don't worry, they're not in PowerPoint format.)
+ </p>
+ </section>
+ </body>
+</document>
Propchange: incubator/oodt/trunk/grid/src/site/xdoc/index.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/oodt/trunk/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java?rev=992166&view=auto
==============================================================================
--- incubator/oodt/trunk/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java (added)
+++ incubator/oodt/trunk/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java Fri Sep 3 01:17:56 2010
@@ -0,0 +1,180 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.grid;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Arrays;
+import junit.framework.TestCase;
+import org.xml.sax.SAXException;
+
+/**
+ * Test the {@link Configuration} class.
+ *
+ */
+public class ConfigurationTest extends TestCase {
+ /**
+ * Creates a new <code>ConfigurationTest</code> instance.
+ *
+ * @param caseName
+ * Test case name.
+ */
+ public ConfigurationTest(String caseName) {
+ super(caseName);
+ }
+
+ /**
+ * Set up by creating a temporary config file.
+ *
+ * @throws Exception
+ * if an error occurs.
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
+ "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ System.setProperty("javax.xml.parsers.SAXParserFactory",
+ "org.apache.xerces.jaxp.SAXParserFactoryImpl");
+ System.setProperty("javax.xml.transform.TransformerFactory",
+ "org.apache.xalan.processor.TransformerFactoryImpl");
+ configFile = File.createTempFile("config", ".xml");
+ configFile.deleteOnExit();
+ }
+
+ /**
+ * Tear down by deleting the temporary config file.
+ *
+ * @throws Exception
+ * if an error occurs.
+ */
+ public void tearDown() throws Exception {
+ configFile.delete();
+ super.tearDown();
+ }
+
+ /**
+ * Test to see if the default values of the {@link Configuration} are
+ * reasonable.
+ *
+ * @throws IOException
+ * if an error occurs.
+ * @throws SAXException
+ * if an error occurs.
+ */
+ public void testDefaults() throws IOException, SAXException {
+ Configuration config = new Configuration(configFile);
+ assertTrue("Expect localhost not required by default", !config
+ .isLocalhostRequired());
+ assertTrue("Expect https not required by default", !config
+ .isHTTPSrequired());
+ assertTrue("Expect no product servers by default", config
+ .getProductServers().isEmpty());
+ assertTrue("Expect no profile servers by default", config
+ .getProfileServers().isEmpty());
+ assertTrue("Default password not set", Arrays.equals(
+ Configuration.DEFAULT_PASSWORD, config.getPassword()));
+ assertTrue("Expect no properties", config.getProperties().isEmpty());
+ assertTrue("Expect no code bases", config.getCodeBases().isEmpty());
+ }
+
+ /**
+ * Test to see if the mutators work.
+ *
+ * @throws IOException
+ * if an error occurs.
+ * @throws SAXException
+ * if an error occurs.
+ */
+ public void testMutators() throws IOException, SAXException {
+ Configuration config = new Configuration(configFile);
+
+ assertTrue(!config.isHTTPSrequired());
+ config.setHTTPSrequired(true);
+ assertTrue("Cannot set https as required", config.isHTTPSrequired());
+
+ assertTrue(!config.isLocalhostRequired());
+ config.setLocalhostRequired(true);
+ assertTrue("Cannot set localhost as required", config.isLocalhostRequired());
+
+ byte[] password = { (byte) 'x', (byte) 'y', (byte) 'z' };
+ assertTrue(Arrays.equals(Configuration.DEFAULT_PASSWORD, config
+ .getPassword()));
+ config.setPassword(password);
+ assertTrue("Cannot change password", Arrays.equals(password, config
+ .getPassword()));
+
+ try {
+ config.setPassword(null);
+ fail("Null password allowed");
+ } catch (IllegalArgumentException good) {
+ }
+
+ // Profile/product servers in the config have no mutators to test (they
+ // return references to each Set). Same with Properties and code bases.
+ }
+
+ /**
+ * Test to see if XML serialization works.
+ *
+ * @throws IOException
+ * if an error occurs.
+ * @throws SAXException
+ * if an error occurs.
+ */
+ public void testSerialization() throws IOException, SAXException {
+ Configuration a = new Configuration(configFile);
+
+ byte[] password = { (byte) 'x', (byte) 'y', (byte) 'z' };
+ URL prodServerURL = new URL("http://localhost/prod.jar");
+ URL profServerURL = new URL("http://localhost/prof.jar");
+ ProductServer prod = new ProductServer(a, "prod");
+ ProfileServer prof = new ProfileServer(a, "prof");
+
+ a.setLocalhostRequired(true);
+ a.setHTTPSrequired(true);
+ a.setPassword(password);
+ a.getProductServers().add(prod);
+ a.getProfileServers().add(prof);
+ a.getProperties().setProperty("a", "b");
+ a.getCodeBases().add(prodServerURL);
+ a.getCodeBases().add(profServerURL);
+ a.save();
+
+ Configuration b = new Configuration(configFile);
+ assertTrue("localhost state not saved", b.isLocalhostRequired());
+ assertTrue("https state not saved", b.isHTTPSrequired());
+ assertTrue("Password not saved", Arrays.equals(password, b.getPassword()));
+ assertEquals("Product server not saved", 1, b.getProductServers().size());
+ assertEquals("Product server not saved properly", prod, b
+ .getProductServers().iterator().next());
+ assertEquals("Profile server not saved", 1, b.getProfileServers().size());
+ assertEquals("Profile server not saved properly", prof, b
+ .getProfileServers().iterator().next());
+ assertEquals("Properties not saved properly", "b", b.getProperties()
+ .getProperty("a"));
+ assertEquals("Code bases not saved properly", 2, b.getCodeBases().size());
+ assertTrue(b.getCodeBases().contains(prodServerURL));
+ assertTrue(b.getCodeBases().contains(profServerURL));
+
+ assertEquals("Configuration.equals doesn't work", a, b);
+ }
+
+ /** Test config file. */
+ private File configFile;
+}
Propchange: incubator/oodt/trunk/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/oodt/trunk/grid/src/test/org/apache/oodt/grid/ConfigurationTest.java
------------------------------------------------------------------------------
svn:executable = *