[Osaas-commits] r25 - in trunk: . client/java client/java/owsproxy

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 29 15:36:53 CEST 2007


Author: bh
Date: 2007-08-29 15:36:53 +0200 (Wed, 29 Aug 2007)
New Revision: 25

Added:
   trunk/client/java/owsproxy/
   trunk/client/java/owsproxy/README.txt
   trunk/client/java/owsproxy/owsproxy.diff
Modified:
   trunk/ChangeLog
Log:
* client/java/owsproxy/owsproxy.diff, client/java/owsproxy/README.txt:
New.  The deegree OWSProxy patch


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-29 11:10:55 UTC (rev 24)
+++ trunk/ChangeLog	2007-08-29 13:36:53 UTC (rev 25)
@@ -1,5 +1,10 @@
 2007-08-29  Bernhard Herzog  <bh at intevation.de>
 
+	* client/java/owsproxy/owsproxy.diff, client/java/owsproxy/README.txt:
+	New.  The deegree OWSProxy patch
+
+2007-08-29  Bernhard Herzog  <bh at intevation.de>
+
 	* client/java/README.txt: Add license information
 
 	* client/java/LGPL.txt: New. Copy of the LGPL

Added: trunk/client/java/owsproxy/README.txt
===================================================================
--- trunk/client/java/owsproxy/README.txt	2007-08-29 11:10:55 UTC (rev 24)
+++ trunk/client/java/owsproxy/README.txt	2007-08-29 13:36:53 UTC (rev 25)
@@ -0,0 +1,54 @@
+OSAAS OWSProxy Patch
+====================
+
+The file owsproxy.diff contains a patch for deegree's owsproxy that
+makes it log successful requests to an OSAAS server.
+
+
+Applying the patch
+------------------
+
+ 1. Check out deegree:
+
+    svn co https://svn.wald.intevation.org/svn/deegree/base/trunk deegree-osaas
+    
+ 2. Apply the patch
+
+    cd deegree-osaas
+    patch -p 0 < owsproxy.diff
+
+ 3. The build deegree in the usual way.  To build a jar-file it's
+    usually just
+
+    ant build-lib
+
+
+Configuring the OSAAS logging
+-----------------------------
+
+The OSAAS-logging settings are read from the same file as the other
+OWSProxy configuration: WEB-INF/web.xml.  The OSAAS patch adds these
+further settings to the <filter> element:
+
+    <!-- The URL to which the OSAAS logging information is to be posted -->
+    <init-param>
+       <param-name>OSAAS_URL</param-name>
+       <param-value>http://localhost:8989/owsaccounting/</param-value>
+    </init-param>
+
+    <!-- The user name and password to use for authentication with the
+         OSASS server -->
+    <init-param>
+       <param-name>OSAAS_USERNAME</param-name>
+       <param-value>aUser</param-value>
+    </init-param>
+    <init-param>
+       <param-name>OSAAS_PASSWORD</param-name>
+       <param-value>secret</param-value>
+    </init-param>
+
+    <!-- The file into which failed logging attempts are written -->
+    <init-param>
+       <param-name>OSAAS_FAILLOG</param-name>
+       <param-value>/usr/share/tomcat/logs/osaas-faillog</param-value>
+    </init-param>


Property changes on: trunk/client/java/owsproxy/README.txt
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/client/java/owsproxy/owsproxy.diff
===================================================================
--- trunk/client/java/owsproxy/owsproxy.diff	2007-08-29 11:10:55 UTC (rev 24)
+++ trunk/client/java/owsproxy/owsproxy.diff	2007-08-29 13:36:53 UTC (rev 25)
@@ -0,0 +1,106 @@
+This patch was produced against revision 8074 of the deegree SVN on 2007-08-29.
+
+
+Index: src/org/deegree/enterprise/servlet/SimpleProxyServlet.java
+===================================================================
+--- src/org/deegree/enterprise/servlet/SimpleProxyServlet.java	(revision 8074)
++++ src/org/deegree/enterprise/servlet/SimpleProxyServlet.java	(working copy)
+@@ -106,6 +106,9 @@
+             String hostAddr = this.getInitParameter( pn );
+             host.put( tmp[0], hostAddr );
+         }
++
++        // Make the host mapping available to the OSAAS hook.
++        getServletConfig().getServletContext().setAttribute("osaas.hostaddrs", host);
+     }
+ 
+     /**
+Index: src/org/deegree/security/owsproxy/OWSProxyServletFilter.java
+===================================================================
+--- src/org/deegree/security/owsproxy/OWSProxyServletFilter.java	(revision 8074)
++++ src/org/deegree/security/owsproxy/OWSProxyServletFilter.java	(working copy)
+@@ -58,6 +58,7 @@
+ import java.util.Enumeration;
+ import java.util.Map;
+ import java.util.Properties;
++import java.util.HashMap;
+ 
+ import javax.servlet.Filter;
+ import javax.servlet.FilterChain;
+@@ -97,6 +98,8 @@
+ import org.deegree.security.owsrequestvalidator.PolicyDocument;
+ import org.w3c.dom.Document;
+ 
++import de.intevation.osaas.OSAASClient;
++
+ /**
+  * An OWSProxyPolicyFilter can be registered as a ServletFilter to a web context. It offeres a
+  * facade that looks like a OWS but additionaly enables validating incoming requests and outgoing
+@@ -130,6 +133,8 @@
+ 
+     private boolean imageExpected = false;
+ 
++    private OSAASClient osaasClient;
++
+     /**
+      * initialize the filter with parameters from the deployment descriptor
+      * 
+@@ -175,6 +180,28 @@
+             }
+ 
+         }
++
++        String urlstring = config.getInitParameter("OSAAS_URL");
++        try {
++            URL url = new URL(urlstring);
++            String username = config.getInitParameter("OSAAS_USERNAME");
++            String password = config.getInitParameter("OSAAS_PASSWORD");
++            String errorlog = config.getInitParameter("OSAAS_FAILLOG");
++            try {
++                osaasClient = new OSAASClient(url, username, password,
++                                              new File(errorlog));
++            }
++            catch (Exception e) {
++                LOG.logError( "Couldn't instantiate the OSAASClient: "
++                              + e.getMessage() );
++            }
++        }
++        catch (MalformedURLException e) {
++            LOG.logError( "Couldn't create an url from the configured OSAAS_URL parameter: " + urlstring
++                          + " because: " + e.getMessage() );
++
++        }
++
+         // } catch ( Exception e ) {
+         // LOG.logError( e.getMessage(), e );
+         // throw new ServletException( e );
+@@ -355,6 +382,9 @@
+             return;
+         }
+ 
++        logToOSAAS(owsReq, (HttpServletRequest) request,
++                   (HttpServletResponse) response, user);
++
+         response.setContentType( resWrap.getContentType() );
+         // write result back to the client
+         os = response.getOutputStream();
+@@ -362,6 +392,19 @@
+         os.close();
+     }
+ 
++    private void logToOSAAS(OGCWebServiceRequest owsReq,
++                            HttpServletRequest request,
++                            HttpServletResponse response,
++                            User user) {
++        HashMap<String, String> host =
++            (HashMap<String, String>) config.getServletContext().getAttribute("osaas.hostaddrs");
++        osaasClient.sendRequest(user.getName(),
++                                request.getQueryString(),
++                                config.getInitParameter("PROXYURL"),
++                                host.get(owsReq.getServiceName()));
++    }
++
++
+     /**
+      * logs a requests parameters and meta informations
+      * 



More information about the Osaas-commits mailing list