juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfa...@apache.org
Subject svn commit: r719464 - in /webservices/juddi/branches/v3_trunk/juddi-core: ./ src/main/java/org/apache/juddi/api/impl/ src/main/java/org/apache/juddi/config/ src/main/java/org/apache/juddi/query/ src/main/java/org/apache/juddi/validation/ src/main/resou...
Date Fri, 21 Nov 2008 03:53:44 GMT
Author: jfaath
Date: Thu Nov 20 19:53:43 2008
New Revision: 719464

URL: http://svn.apache.org/viewvc?rev=719464&view=rev
Log:
cleaned up some inquiry api issues, added list description element, chunked the IN clause
for sub-queries.

Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/pom.xml
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BindingTemplateQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BusinessServiceQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/EntityQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBindingTemplatesQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessEntitiesQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessServicesQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchTModelsQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByTModelKeyQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByDiscoveryURLQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByNamesQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByNameQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByNameQuery.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi.properties

Modified: webservices/juddi/branches/v3_trunk/juddi-core/pom.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/pom.xml?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/pom.xml (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/pom.xml Thu Nov 20 19:53:43 2008
@@ -47,7 +47,12 @@
         <version>2.4.2</version>
         <configuration>
           <suiteXmlFiles>
-            <suiteXmlFile>src/test/resources/suite-init.xml,src/test/resources/suite-save.xml,src/test/resources/suite-delete.xml,src/test/resources/suite-clean.xml</suiteXmlFile>
+            <suiteXmlFile>
+              src/test/resources/suite-init.xml,
+              src/test/resources/suite-save.xml,
+              src/test/resources/suite-delete.xml,
+              src/test/resources/suite-clean.xml
+            </suiteXmlFile>
           </suiteXmlFiles>
         </configuration>
       </plugin>

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
Thu Nov 20 19:53:43 2008
@@ -28,17 +28,13 @@
 import org.apache.juddi.query.FetchBusinessServicesQuery;
 import org.apache.juddi.query.FetchTModelsQuery;
 import org.apache.juddi.query.FindBindingByTModelKeyQuery;
-import org.apache.juddi.query.BindingTemplateQuery;
 import org.apache.juddi.query.FindBusinessByDiscoveryURLQuery;
 import org.apache.juddi.query.FindBusinessByIdentifierQuery;
 import org.apache.juddi.query.FindBusinessByNameQuery;
 import org.apache.juddi.query.FindServiceByNameQuery;
-import org.apache.juddi.query.BusinessServiceQuery;
 import org.apache.juddi.query.FindTModelByIdentifierQuery;
 import org.apache.juddi.query.FindTModelByNameQuery;
-import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.PersistenceManager;
-import org.apache.juddi.util.JPAUtil;
 import org.apache.juddi.validation.ValidateInquiry;
 import org.apache.juddi.error.InvalidKeyPassedException;
 import org.apache.juddi.error.ErrorMessage;
@@ -61,6 +57,7 @@
 import org.uddi.api_v3.ServiceList;
 import org.uddi.api_v3.TModelDetail;
 import org.uddi.api_v3.TModelList;
+import org.uddi.api_v3.ListDescription;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 import org.uddi.v3_service.UDDIInquiryPortType;
 import org.apache.juddi.api.datatype.GetPublisherDetail;
@@ -90,21 +87,16 @@
 		findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
 
 		List<?> keysFound = null;
-		if (body.getServiceKey() == null || body.getServiceKey().length() == 0) {
-			keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(),
keysFound);
-			//keysFound = FindBindingByCategoryQuery.select(em, findQualifiers, tmodelKeys, keysFound);
-		}
-		else {
-			DynamicQuery.Parameter keyRestriction = new DynamicQuery.Parameter(BindingTemplateQuery.ENTITY_ALIAS
+ "." + BusinessServiceQuery.KEY_NAME, body.getServiceKey(), DynamicQuery.PREDICATE_EQUALS);
-			if (body.getTModelBag() != null)
-				keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(),
keysFound, keyRestriction);
-			//keysFound = FindBindingByCategoryQuery.select(em, findQualifiers, tmodelKeys, keysFound,
keyRestriction);
-		}
+		keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(),
body.getServiceKey(), keysFound);
+		//keysFound = FindBindingByCategoryQuery.select(em, findQualifiers, tmodelKeys, body.getServiceKey(),
keysFound);
+
+		BindingDetail result = new BindingDetail();
+		ListDescription listDesc = new ListDescription();
+		result.setListDescription(listDesc);
 		
 		// Sort and retrieve the final results with paging taken into account
-		List<?> queryResults = FetchBindingTemplatesQuery.select(em, findQualifiers, keysFound,
body.getMaxRows(), body.getListHead());
+		List<?> queryResults = FetchBindingTemplatesQuery.select(em, findQualifiers, keysFound,
body.getMaxRows(), body.getListHead(), listDesc);
 
-		BindingDetail result = new BindingDetail();
 		for (Object item : queryResults) {
 			org.apache.juddi.model.BindingTemplate modelBindingTemplate = (org.apache.juddi.model.BindingTemplate)item;
 			org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();
@@ -142,9 +134,11 @@
 		keysFound = FindBusinessByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
 
 		BusinessList result = new BusinessList();
+		ListDescription listDesc = new ListDescription();
+		result.setListDescription(listDesc);
 
 		// Sort and retrieve the final results taking paging into account
-		List<?> queryResults = FetchBusinessEntitiesQuery.select(em, findQualifiers, keysFound,
body.getMaxRows(), body.getListHead());
+		List<?> queryResults = FetchBusinessEntitiesQuery.select(em, findQualifiers, keysFound,
body.getMaxRows(), body.getListHead(), listDesc);
 		if (queryResults != null && queryResults.size() > 0)
 			result.setBusinessInfos(new org.uddi.api_v3.BusinessInfos());
 
@@ -185,13 +179,15 @@
 		findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
 
 		List<?> keysFound = null;
-		//keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(),
keysFound);
-		keysFound = FindServiceByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
+		//keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(),
body.getBusinessKey, keysFound);
+		keysFound = FindServiceByNameQuery.select(em, findQualifiers, body.getName(), body.getBusinessKey(),
keysFound);
 
 		ServiceList result = new ServiceList();
+		ListDescription listDesc = new ListDescription();
+		result.setListDescription(listDesc);
 		
 		// Sort and retrieve the final results taking paging into account
-		List<?> queryResults = FetchBusinessServicesQuery.select(em, findQualifiers, keysFound,
body.getMaxRows(), body.getListHead());
+		List<?> queryResults = FetchBusinessServicesQuery.select(em, findQualifiers, keysFound,
body.getMaxRows(), body.getListHead(), listDesc);
 		if (queryResults != null && queryResults.size() > 0)
 			result.setServiceInfos(new org.uddi.api_v3.ServiceInfos());
 
@@ -213,7 +209,7 @@
 	public TModelList findTModel(FindTModel body)
 			throws DispositionReportFaultMessage {
 
-		ValidateInquiry.validateFindTModel(body);
+		ValidateInquiry.validateFindTModel(body, false);
 		
 		// TODO: Perform necessary authentication logic
 		String authInfo = body.getAuthInfo();
@@ -231,9 +227,11 @@
 		keysFound = FindTModelByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
 
 		TModelList result = new TModelList();
+		ListDescription listDesc = new ListDescription();
+		result.setListDescription(listDesc);
 
 		// Sort and retrieve the final results taking paging into account
-		List<?> queryResults = FetchTModelsQuery.select(em, findQualifiers, keysFound, body.getMaxRows(),
body.getListHead());
+		List<?> queryResults = FetchTModelsQuery.select(em, findQualifiers, keysFound, body.getMaxRows(),
body.getListHead(), listDesc);
 		if (queryResults != null && queryResults.size() > 0)
 			result.setTModelInfos(new org.uddi.api_v3.TModelInfos());
 		

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
Thu Nov 20 19:53:43 2008
@@ -323,7 +323,7 @@
 		RegisteredInfo result = new RegisteredInfo();
 		
 		// Sort and retrieve the final results
-		List<?> queryResults = FetchBusinessEntitiesQuery.select(em, new FindQualifiers(),
businessKeysFound, null, null);
+		List<?> queryResults = FetchBusinessEntitiesQuery.select(em, new FindQualifiers(),
businessKeysFound, null, null, null);
 		if (queryResults != null && queryResults.size() > 0)
 			result.setBusinessInfos(new org.uddi.api_v3.BusinessInfos());
 		
@@ -337,7 +337,7 @@
 		}
 
 		// Sort and retrieve the final results
-		queryResults = FetchTModelsQuery.select(em, new FindQualifiers(), tmodelKeysFound, null,
null);
+		queryResults = FetchTModelsQuery.select(em, new FindQualifiers(), tmodelKeysFound, null,
null, null);
 		if (queryResults != null && queryResults.size() > 0)
 			result.setTModelInfos(new org.uddi.api_v3.TModelInfos());
 		

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Property.java
Thu Nov 20 19:53:43 2008
@@ -18,4 +18,6 @@
 	public final static String JUDDI_KEYGENERATOR                ="juddi.keygenerator";
 	public final static String JUDDI_VALIDATOR                   ="juddi.validator";
 	public final static String JUDDI_USERSFILE                   ="juddi.usersfile";
+	public final static String JUDDI_MAX_ROWS                    ="juddi.maxRows";
+	public final static String JUDDI_MAX_IN_CLAUSE               ="juddi.maxInClause";
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BindingTemplateQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BindingTemplateQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BindingTemplateQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BindingTemplateQuery.java
Thu Nov 20 19:53:43 2008
@@ -25,6 +25,7 @@
 	public static final String ENTITY_NAME = "BindingTemplate";
 	public static final String ENTITY_ALIAS = "b";
 	public static final String KEY_NAME = "bindingKey";
+	public static final String KEY_NAME_PARENT = "businessService." + BusinessServiceQuery.KEY_NAME;
 	
 	protected static String selectSQL;
 

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BusinessServiceQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BusinessServiceQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BusinessServiceQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/BusinessServiceQuery.java
Thu Nov 20 19:53:43 2008
@@ -25,6 +25,7 @@
 	public static final String ENTITY_NAME = "BusinessService";
 	public static final String ENTITY_ALIAS = "s";
 	public static final String KEY_NAME = "serviceKey";
+	public static final String KEY_NAME_PARENT = "businessEntity." + BusinessEntityQuery.KEY_NAME;
 	
 	protected static String selectSQL;
 

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/EntityQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/EntityQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/EntityQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/EntityQuery.java
Thu Nov 20 19:53:43 2008
@@ -18,17 +18,29 @@
 package org.apache.juddi.query;
 
 import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
 
+import org.apache.commons.configuration.ConfigurationException;
+import org.uddi.api_v3.ListDescription;
+import org.apache.juddi.config.AppConfig;
+import org.apache.juddi.config.Property;
 import org.apache.juddi.query.util.DynamicQuery;
+import org.apache.log4j.Logger;
 
 /**
  * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
  */
 public abstract class EntityQuery {
+	private static Logger log = Logger.getLogger(EntityQuery.class);
+
 	public static final String GENERAL_KEYWORD_TMODEL = "uddi:uddi-org:general_keywords";
 	
+	public static final int DEFAULT_MAXROWS = 100;
+	public static final int DEFAULT_MAXINCLAUSE = 1000;
+	
 	public static String buildAlias(String entityName) {
 		if (entityName == null || entityName.length() == 0)
 			return "x";
@@ -36,21 +48,101 @@
 		return entityName.substring(0, entityName.length() - 3);
 	}
 	
-	public static List<?> getPagedResult(EntityManager em, DynamicQuery dynamicQry, Integer
maxRows, Integer listHead) {
-		
-		if (maxRows == null || maxRows <= 0)
-			maxRows = 10; //TODO: set to system default
+	/*
+	 * Used to retrieve the final results of find operations.  Handles paging as specified by
user.  
+	 * 
+	 * TODO: This query will use an IN clause, however, it is not restricted per the global
parameter.  This is so the query can
+	 * take advantage of sorting through SQL.  The fix would be to apply the parameter, but
only if the IN list is greater than the
+	 * parameter.  In this case, sorting would have to be done in java.
+	 * 
+	 */
+	public static List<?> getPagedResult(EntityManager em, DynamicQuery dynamicQry, Integer
maxRowsUser, Integer listHead, ListDescription listDesc) {
+		
+		int maxRows = DEFAULT_MAXROWS;
+		try {
+			maxRows = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_ROWS, DEFAULT_MAXROWS);
+		}
+		catch(ConfigurationException ce) {
+			log.error("Configuration exception occurred retrieving: " + Property.JUDDI_MAX_ROWS);
+		}
+		
+		if (maxRowsUser == null || maxRowsUser <= 0) {
+			if (maxRowsUser < maxRows)
+				maxRows = maxRowsUser;
+		}
 		
 		if (listHead == null || listHead <= 0)
-			listHead = 0;
+			listHead = 1;
 		
 		
 		Query qry = dynamicQry.buildJPAQuery(em);
-		qry.setMaxResults(maxRows);
-		qry.setFirstResult(listHead);
+		List<?> result = qry.getResultList();
+		int resultSize = result.size();
+
+		if (listDesc != null) {
+			listDesc.setActualCount(resultSize);
+			listDesc.setListHead(listHead);
+		}
+		
+		int startIndex = (listHead - 1) * maxRows;
+		if (startIndex >= resultSize) {
+			if (listDesc != null)
+				listDesc.setIncludeCount(0);
+
+			return Collections.emptyList();
+		}
+		else {
+			int endIndex = Math.min(startIndex + maxRows, resultSize);
+			if (listDesc != null)
+				listDesc.setIncludeCount(endIndex - startIndex);
+
+			return result.subList(startIndex, endIndex);
+		}
+	}
+	
+	/*
+	 * Used for all the find operation sub-queries.  Restricts size of the IN clause based on
global parameter
+	 */
+	public static List<?> getQueryResult(EntityManager em, DynamicQuery dynamicQry, List<?>
keysIn, String inListTerm) {
+		
+		List<Object> result = new ArrayList<Object>(0);
+		// If keysIn is null, then no IN list is applied to the query - we simply need to run the
query.  Otherwise, the IN list is chunked based on
+		// the application property.
+		if (keysIn == null) {
+			Query qry = dynamicQry.buildJPAQuery(em);
+			result = qry.getResultList();
+		}
+		else {
+			int maxInClause = DEFAULT_MAXINCLAUSE;
+			try {
+				maxInClause = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_IN_CLAUSE, DEFAULT_MAXINCLAUSE);
+			}
+			catch(ConfigurationException ce) {
+				log.error("Configuration exception occurred retrieving: " + Property.JUDDI_MAX_IN_CLAUSE);
+			}
+			
+			int inParamsLeft = keysIn.size();
+			int startIndex = 0;
+			while(inParamsLeft > 0) {
+				int endIndex = startIndex + Math.min(inParamsLeft, maxInClause);
+				
+				List<?> subKeysIn = keysIn.subList(startIndex, endIndex);
+				dynamicQry.appendInListWithAnd(inListTerm, subKeysIn);
+				log.debug(dynamicQry);
+	
+				Query qry = dynamicQry.buildJPAQuery(em);
+				List<Object> resultChunk = qry.getResultList();
+				result.addAll(resultChunk);
+				
+				inParamsLeft = inParamsLeft - (endIndex - startIndex);
+				startIndex = endIndex;
+			}
+		}
 		
-		return qry.getResultList();
+		return result;
 		
 
 	}
+
+	
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBindingTemplatesQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBindingTemplatesQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBindingTemplatesQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBindingTemplatesQuery.java
Thu Nov 20 19:53:43 2008
@@ -25,6 +25,7 @@
 import org.apache.juddi.query.util.FindQualifiers;
 import org.apache.log4j.Logger;
 import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.api_v3.ListDescription;
 
 /**
  * The "select" method retrieves all the entities for the input key list and sorts according
to the user settings.  Paging is taken into account when retrieving 
@@ -49,7 +50,7 @@
 		selectSQL = sql.toString();
 	}
 	
-	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead) throws DispositionReportFaultMessage {
+	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead, ListDescription listDesc) throws DispositionReportFaultMessage
{
 		
 		// If keysIn is null or empty, then nothing to fetch.
 		if ((keysIn == null) || (keysIn.size() == 0))
@@ -62,7 +63,7 @@
 
 		log.debug(dynamicQry);
 		
-		return getPagedResult(em, dynamicQry, maxRows, listHead);
+		return getPagedResult(em, dynamicQry, maxRows, listHead, listDesc);
 	}
 	
 	private static void appendSortTables(DynamicQuery qry) {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessEntitiesQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessEntitiesQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessEntitiesQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessEntitiesQuery.java
Thu Nov 20 19:53:43 2008
@@ -25,6 +25,7 @@
 import org.apache.juddi.query.util.FindQualifiers;
 import org.apache.log4j.Logger;
 import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.api_v3.ListDescription;
 
 /**
  * The "select" method retrieves all the entities for the input key list and sorts according
to the user settings.  Paging is taken into account when retrieving 
@@ -49,7 +50,7 @@
 		selectSQL = sql.toString();
 	}
 	
-	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead) throws DispositionReportFaultMessage {
+	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead, ListDescription listDesc) throws DispositionReportFaultMessage
{
 		
 		// If keysIn is null or empty, then nothing to fetch.
 		if ((keysIn == null) || (keysIn.size() == 0))
@@ -62,7 +63,7 @@
 
 		log.debug(dynamicQry);
 		
-		return getPagedResult(em, dynamicQry, maxRows, listHead);
+		return getPagedResult(em, dynamicQry, maxRows, listHead, listDesc);
 	}
 	
 	private static void appendSortTables(DynamicQuery qry) {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessServicesQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessServicesQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessServicesQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchBusinessServicesQuery.java
Thu Nov 20 19:53:43 2008
@@ -25,6 +25,7 @@
 import org.apache.juddi.query.util.FindQualifiers;
 import org.apache.log4j.Logger;
 import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.api_v3.ListDescription;
 
 /**
  * The "select" method retrieves all the entities for the input key list and sorts according
to the user settings.  Paging is taken into account when retrieving 
@@ -49,7 +50,7 @@
 		selectSQL = sql.toString();
 	}
 	
-	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead) throws DispositionReportFaultMessage {
+	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead, ListDescription listDesc) throws DispositionReportFaultMessage
{
 		
 		// If keysIn is null or empty, then nothing to fetch.
 		if ((keysIn == null) || (keysIn.size() == 0))
@@ -62,7 +63,7 @@
 
 		log.debug(dynamicQry);
 		
-		return getPagedResult(em, dynamicQry, maxRows, listHead);
+		return getPagedResult(em, dynamicQry, maxRows, listHead, listDesc);
 	}
 	
 	private static void appendSortTables(DynamicQuery qry) {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchTModelsQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchTModelsQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchTModelsQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FetchTModelsQuery.java
Thu Nov 20 19:53:43 2008
@@ -25,6 +25,7 @@
 import org.apache.juddi.query.util.FindQualifiers;
 import org.apache.log4j.Logger;
 import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.api_v3.ListDescription;
 
 /**
  * The "select" method retrieves all the entities for the input key list and sorts according
to the user settings.  Paging is taken into account when retrieving 
@@ -49,7 +50,7 @@
 		selectSQL = sql.toString();
 	}
 	
-	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead) throws DispositionReportFaultMessage {
+	public static List<?> select(EntityManager em, FindQualifiers fq, List<?> keysIn,
Integer maxRows, Integer listHead, ListDescription listDesc) throws DispositionReportFaultMessage
{
 		
 		// If keysIn is null or empty, then nothing to fetch.
 		if ((keysIn == null) || (keysIn.size() == 0))
@@ -62,7 +63,7 @@
 
 		log.debug(dynamicQry);
 		
-		return getPagedResult(em, dynamicQry, maxRows, listHead);
+		return getPagedResult(em, dynamicQry, maxRows, listHead, listDesc);
 	}
 	
 	private static void appendSortTables(DynamicQuery qry) {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByTModelKeyQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByTModelKeyQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByTModelKeyQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBindingByTModelKeyQuery.java
Thu Nov 20 19:53:43 2008
@@ -19,7 +19,6 @@
 
 import java.util.List;
 import javax.persistence.EntityManager;
-import javax.persistence.Query;
 
 import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.util.FindQualifiers;
@@ -54,7 +53,7 @@
 		entityAliasChild = buildAlias(ENTITY_NAME_CHILD);
 	}
 
-	public static List<?> select(EntityManager em, FindQualifiers fq, TModelBag tModels,
List<?> keysIn, DynamicQuery.Parameter... restrictions) {
+	public static List<?> select(EntityManager em, FindQualifiers fq, TModelBag tModels,
String parentKey, List<?> keysIn, DynamicQuery.Parameter... restrictions) {
 		// If keysIn is not null and empty, then search is over.
 		if ((keysIn != null) && (keysIn.size() == 0))
 			return keysIn;
@@ -68,18 +67,13 @@
 		
 		DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
 		appendConditions(dynamicQry, fq, tmodelKeys);
+		if (parentKey != null && parentKey.length() > 0)
+			dynamicQry.AND().pad().appendGroupedAnd(new DynamicQuery.Parameter(BindingTemplateQuery.ENTITY_ALIAS
+ "." + BindingTemplateQuery.KEY_NAME_PARENT, parentKey, DynamicQuery.PREDICATE_EQUALS));
+		
 		if (restrictions != null && restrictions.length > 0)
 			dynamicQry.AND().pad().appendGroupedAnd(restrictions);
 		
-		// TODO: Break up the IN clause into an amount that is configurable (see JUDDI-146)
-		dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
-		
-		log.debug(dynamicQry);
-		
-		Query qry = dynamicQry.buildJPAQuery(em);
-		List<?> result = qry.getResultList();
-		
-		return result;
+		return getQueryResult(em, dynamicQry, keysIn, ENTITY_ALIAS + "." + KEY_NAME);
 	}
 	
 	

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByDiscoveryURLQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByDiscoveryURLQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByDiscoveryURLQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindBusinessByDiscoveryURLQuery.java
Thu Nov 20 19:53:43 2008
@@ -19,7 +19,6 @@
 
 import java.util.List;
 import javax.persistence.EntityManager;
-import javax.persistence.Query;
 
 import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.util.FindQualifiers;
@@ -70,15 +69,7 @@
 		if (restrictions != null && restrictions.length > 0)
 			dynamicQry.AND().pad().appendGroupedAnd(restrictions);
 
-		// TODO: Break up the IN clause into an amount that is configurable (see JUDDI-146)
-		dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
-		
-		log.debug(dynamicQry);
-		
-		Query qry = dynamicQry.buildJPAQuery(em);
-		List<?> result = qry.getResultList();
-		
-		return result;
+		return getQueryResult(em, dynamicQry, keysIn, ENTITY_ALIAS + "." + KEY_NAME);
 	}
 	
 	/*

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByIdentifierQuery.java
Thu Nov 20 19:53:43 2008
@@ -20,7 +20,6 @@
 import java.util.List;
 import java.util.Collections;
 import javax.persistence.EntityManager;
-import javax.persistence.Query;
 
 import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.util.FindQualifiers;
@@ -109,16 +108,8 @@
 		appendConditions(dynamicQry, fq, keyedRefs);
 		if (restrictions != null && restrictions.length > 0)
 			dynamicQry.AND().pad().appendGroupedAnd(restrictions);
-		
-		// TODO: Break up the IN clause into an amount that is configurable (see JUDDI-146)
-		dynamicQry.appendInListWithAnd(entityAlias + "." + keyName, keysIn);
-		
-		log.debug(dynamicQry);
-		
-		Query qry = dynamicQry.buildJPAQuery(em);
-		List<?> result = qry.getResultList();
-		
-		return result;
+
+		return getQueryResult(em, dynamicQry, keysIn, entityAlias + "." + keyName);
 	}
 	
 	

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByNamesQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByNamesQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByNamesQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindEntityByNamesQuery.java
Thu Nov 20 19:53:43 2008
@@ -19,7 +19,6 @@
 
 import java.util.List;
 import javax.persistence.EntityManager;
-import javax.persistence.Query;
 
 import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.util.FindQualifiers;
@@ -94,15 +93,7 @@
 		if (restrictions != null && restrictions.length > 0)
 			dynamicQry.AND().pad().appendGroupedAnd(restrictions);
 
-		// TODO: Break up the IN clause into an amount that is configurable (see JUDDI-146)
-		dynamicQry.appendInListWithAnd(entityAlias + "." + keyName, keysIn);
-		
-		log.debug(dynamicQry);
-		
-		Query qry = dynamicQry.buildJPAQuery(em);
-		List<?> result = qry.getResultList();
-		
-		return result;
+		return getQueryResult(em, dynamicQry, keysIn, entityAlias + "." + keyName);
 	}
 	
 	/*

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByNameQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByNameQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByNameQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindServiceByNameQuery.java
Thu Nov 20 19:53:43 2008
@@ -20,6 +20,7 @@
 import java.util.List;
 import javax.persistence.EntityManager;
 
+import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.util.FindQualifiers;
 import org.uddi.api_v3.Name;
 
@@ -52,8 +53,14 @@
 		findQuery = new FindEntityByNamesQuery(BusinessServiceQuery.ENTITY_NAME, BusinessServiceQuery.ENTITY_ALIAS,
BusinessServiceQuery.KEY_NAME, ENTITY_NAME_CHILD);
 	}
 
-	public static List<?> select(EntityManager em, FindQualifiers fq, List<Name>
names, List<?> keysIn) {
-		return findQuery.select(em, fq, names, keysIn);
+	public static List<?> select(EntityManager em, FindQualifiers fq, List<Name>
names, String parentKey, List<?> keysIn) {
+		if (parentKey != null && parentKey.length() > 0) {
+			DynamicQuery.Parameter param = new DynamicQuery.Parameter(BusinessServiceQuery.ENTITY_ALIAS
+ "." + BusinessServiceQuery.KEY_NAME_PARENT, parentKey, DynamicQuery.PREDICATE_EQUALS); 
+			return findQuery.select(em, fq, names, keysIn, param);
+		}
+		else
+			return findQuery.select(em, fq, names, keysIn);
+			
 	}
 	
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByNameQuery.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByNameQuery.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByNameQuery.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/query/FindTModelByNameQuery.java
Thu Nov 20 19:53:43 2008
@@ -19,7 +19,6 @@
 
 import java.util.List;
 import javax.persistence.EntityManager;
-import javax.persistence.Query;
 
 import org.apache.juddi.query.util.DynamicQuery;
 import org.apache.juddi.query.util.FindQualifiers;
@@ -64,15 +63,7 @@
 		if (restrictions != null && restrictions.length > 0)
 			dynamicQry.AND().pad().appendGroupedAnd(restrictions);
 		
-		// TODO: Break up the IN clause into an amount that is configurable (see JUDDI-146)
-		dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
-		
-		log.debug(dynamicQry);
-		
-		Query qry = dynamicQry.buildJPAQuery(em);
-		List<?> result = qry.getResultList();
-		
-		return result;
+		return getQueryResult(em, dynamicQry, keysIn, ENTITY_ALIAS + "." + KEY_NAME);
 	}
 	
 	public static void appendConditions(DynamicQuery qry, FindQualifiers fq, Name name) {

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
Thu Nov 20 19:53:43 2008
@@ -152,7 +152,7 @@
 
 		validateFindQualifiers(body.getFindQualifiers());
 		validateTModelBag(body.getTModelBag());
-		validateFindTModel(body.getFindTModel());
+		validateFindTModel(body.getFindTModel(), true);
 		ValidatePublish.validateDiscoveryUrls(body.getDiscoveryURLs());
 		ValidatePublish.validateIdentifierBag(body.getIdentifierBag());
 		ValidatePublish.validateCategoryBag(body.getCategoryBag());
@@ -169,7 +169,7 @@
 
 		validateFindQualifiers(body.getFindQualifiers());
 		validateTModelBag(body.getTModelBag());
-		validateFindTModel(body.getFindTModel());
+		validateFindTModel(body.getFindTModel(), true);
 		ValidatePublish.validateCategoryBag(body.getCategoryBag());
 		
 	}
@@ -184,16 +184,20 @@
 
 		validateFindQualifiers(body.getFindQualifiers());
 		validateTModelBag(body.getTModelBag());
-		validateFindTModel(body.getFindTModel());
+		validateFindTModel(body.getFindTModel(), true);
 		ValidatePublish.validateCategoryBag(body.getCategoryBag());
 		
 		
 	}
 	
-	public static void validateFindTModel(FindTModel body) throws DispositionReportFaultMessage
 {
-		// No null input
-		//if (body == null)
-		//	throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+	public static void validateFindTModel(FindTModel body, boolean nullAllowed) throws DispositionReportFaultMessage
 {
+		if (body == null) {
+			// When FindTModel objects are embedded in other find calls, null is allowed.
+			if (nullAllowed)
+				return;
+			else
+				throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+		}
 
 		if (body.getCategoryBag() == null && body.getIdentifierBag() == null &&
body.getName() == null)
 			throw new FatalErrorException(new ErrorMessage("errors.findtmodel.NoInput"));

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi.properties?rev=719464&r1=719463&r2=719464&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/juddi.properties Thu
Nov 20 19:53:43 2008
@@ -21,6 +21,14 @@
 juddi.maxNameLength=255
 juddi.maxNameElementsAllowed=5
 #
+#
+# The maximum number of rows returned in a find_* operation.  Each call can set
+# this independently, but this property defines a global maximum.
+juddi.maxRows=100
+# The maximum number of "IN" clause parameters.  Some RDMBS limit the number of 
+# parameters allowed in a SQL "IN" clause.
+juddi.maxInClause=1000
+#
 # The maximum number of UDDI artifacts allowed
 # per publisher. A value of '-1' indicates any 
 # number of artifacts is valid (These values can be



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


Mime
View raw message