juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject [1/3] git commit: JUDDI-887 done and documented
Date Sun, 02 Nov 2014 00:17:12 GMT
Repository: juddi
Updated Branches:
  refs/heads/master b72eba072 -> 36e9b7fe6


JUDDI-887 done and documented


Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/fdbf5a07
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/fdbf5a07
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/fdbf5a07

Branch: refs/heads/master
Commit: fdbf5a0786e9c0f7e96902b1de08c2be1e270f35
Parents: b72eba0
Author: alexoree <alexoree@apache.org>
Authored: Sat Nov 1 19:30:47 2014 -0400
Committer: alexoree <alexoree@apache.org>
Committed: Sat Nov 1 19:30:47 2014 -0400

----------------------------------------------------------------------
 .../en-US/GuideConfigurationServer.asciidoc     | 12 ++++
 .../apache/juddi/api/impl/UDDIInquiryImpl.java  | 64 +++++++++++++++++---
 .../src/main/webapp/WEB-INF/classes/juddiv3.xml |  4 ++
 3 files changed, 70 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/fdbf5a07/docs/asciidoc/Guide/en-US/GuideConfigurationServer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/Guide/en-US/GuideConfigurationServer.asciidoc b/docs/asciidoc/Guide/en-US/GuideConfigurationServer.asciidoc
index 0edeac4..fbe195e 100644
--- a/docs/asciidoc/Guide/en-US/GuideConfigurationServer.asciidoc
+++ b/docs/asciidoc/Guide/en-US/GuideConfigurationServer.asciidoc
@@ -145,6 +145,18 @@ RMI Proxy properties that can be referenced in the _juddiv3.xml_ file
and is onl
 |===========================================================================================
 
 
+=== Logging
+
+.These properties are used to enable additional logging capabilities.
+
+Logging properties that can be referenced in the _juddiv3.xml_ file.
+[options="header"]
+|===========================================================================================
+|Property Name                   		|Description         |Required     |Default Value or [Example
Value]
+|_juddi/logging/logInquirySearchPayloads| Enables request payload logging for the Inquiry
Find apis    |N| false
+|===========================================================================================
+
+
 
 === Deploying two or more jUDDI server on the same application server
 

http://git-wip-us.apache.org/repos/asf/juddi/blob/fdbf5a07/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
index 416185e..ee0627b 100644
--- a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
+++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
@@ -17,25 +17,22 @@
 
 package org.apache.juddi.api.impl;
 
+import java.io.File;
+import java.io.FileOutputStream;
 import java.util.List;
-import java.util.UUID;
-
 import javax.jws.WebService;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
-
+import javax.xml.bind.JAXB;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.juddi.api.util.InquiryQuery;
-import org.apache.juddi.api.util.PublicationQuery;
 import org.apache.juddi.api.util.QueryStatus;
 import org.apache.juddi.config.AppConfig;
 import org.apache.juddi.config.PersistenceManager;
 import org.apache.juddi.config.Property;
 import org.apache.juddi.mapping.MappingModelToApi;
-import org.apache.juddi.model.TempKey;
-import org.apache.juddi.query.util.FindQualifiers;
 import org.apache.juddi.v3.error.ErrorMessage;
 import org.apache.juddi.v3.error.InvalidKeyPassedException;
 import org.apache.juddi.validation.ValidateInquiry;
@@ -73,13 +70,58 @@ public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiry
 
 
     private static Log log = LogFactory.getLog(UDDIInquiryImpl.class);
+
+        private static boolean isLogRequestPayloads() {
+                boolean result = false;
+		try {
+			result = AppConfig.getConfiguration().getBoolean(Property.JUDDI_LOGGING_FindApiCalls,
false);
+		} catch (ConfigurationException e) {
+			log.error("Configuration exception occurred retrieving: " + Property.JUDDI_LOGGING_FindApiCalls,
e);
+		}
+		return result;
+        }
     private UDDIServiceCounter serviceCounter;
         
     public UDDIInquiryImpl() {
         super();
         serviceCounter = ServiceCounterLifecycleResource.getServiceCounter(UDDIInquiryImpl.class);
     }
-	
+    
+    
+    private static void LogFindRelatedBusinessRequest(FindRelatedBusinesses request) {
+                 request.setAuthInfo(null);
+                 LogRequest(request);
+        }
+        private static void LogFindBindingRequest(FindBinding request) {
+                 request.setAuthInfo(null);
+                 LogRequest(request);
+        }
+        private static void LogFindTModelRequest(FindTModel request) {
+                 request.setAuthInfo(null);
+                 LogRequest(request);
+        }
+        private static void LogFindServiceRequest(FindService request) {
+                 request.setAuthInfo(null);
+                 LogRequest(request);
+        }
+        private static void LogFindBusinessRequest(FindBusiness request) {
+                 request.setAuthInfo(null);
+                 LogRequest(request);
+        }
+	 private static synchronized void LogRequest(Object request) {
+                 if (isLogRequestPayloads())
+                  try {
+                        File f = new File(System.currentTimeMillis()+".xml");
+                        FileOutputStream fos = new FileOutputStream(f);
+                        JAXB.marshal(request, fos);
+                        fos.close();
+                        f = null;
+                } catch (Exception ex) {
+                        logger.warn("Unable to log request payload", ex);
+                }
+         }
+         
+         
     public BindingDetail findBinding(FindBinding body)
 			throws DispositionReportFaultMessage {
                 long startTime = System.currentTimeMillis();
@@ -99,6 +141,7 @@ public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiry
 			if (isAuthenticated())
 				this.getEntityPublisher(em, body.getAuthInfo());
 
+                        LogFindBindingRequest(body);
 			org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
 			findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
 
@@ -151,7 +194,7 @@ public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiry
 
 			if (isAuthenticated())
 				this.getEntityPublisher(em, body.getAuthInfo());
-
+                        LogFindBusinessRequest(body);
 			org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
 			findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
 
@@ -191,6 +234,7 @@ public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiry
 
 			if (isAuthenticated())
 				this.getEntityPublisher(em, body.getAuthInfo());
+                        LogFindRelatedBusinessRequest(body);
 
 			// TODO: findQualifiers aren't really used for this call, except maybe for sorting.  Sorting
must be done in Java due to the retrieval method used.  Right now
 			// no sorting is performed.
@@ -231,7 +275,7 @@ public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiry
 
 			if (isAuthenticated())
 				this.getEntityPublisher(em, body.getAuthInfo());
-
+                        LogFindServiceRequest(body);
 			org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
 			findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
 
@@ -286,7 +330,7 @@ public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiry
 
 			if (isAuthenticated())
 				this.getEntityPublisher(em, body.getAuthInfo());
-
+                        LogFindTModelRequest(body);
 			org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
 			findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
 

http://git-wip-us.apache.org/repos/asf/juddi/blob/fdbf5a07/juddiv3-war/src/main/webapp/WEB-INF/classes/juddiv3.xml
----------------------------------------------------------------------
diff --git a/juddiv3-war/src/main/webapp/WEB-INF/classes/juddiv3.xml b/juddiv3-war/src/main/webapp/WEB-INF/classes/juddiv3.xml
index 330f71d..3468b3d 100644
--- a/juddiv3-war/src/main/webapp/WEB-INF/classes/juddiv3.xml
+++ b/juddiv3-war/src/main/webapp/WEB-INF/classes/juddiv3.xml
@@ -189,5 +189,9 @@
 				<password encrypted="false">pass</password>-->
 			</smtp>
 		</mail>
+		
+		<logging>
+			<logInquirySearchPayloads>false</logInquirySearchPayloads>
+		</logging>
 	</juddi>
 </config>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message