You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2008/10/31 05:30:20 UTC
svn commit: r709344 [1/2] - in
/webservices/juddi/branches/v3_trunk/juddi-core/src:
main/java/org/apache/juddi/api/impl/ main/java/org/apache/juddi/error/
main/java/org/apache/juddi/validation/ main/resources/
test/java/org/apache/juddi/test/
Author: jfaath
Date: Thu Oct 30 21:30:19 2008
New Revision: 709344
URL: http://svn.apache.org/viewvc?rev=709344&view=rev
Log:
JUDDI-140, JUDDI-138: lots of work on validating user input and returning the appropriate error. Implemented messages that can be internationalized.
Added:
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/AssertionNotFoundException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ErrorMessage.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/FatalErrorException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidCombinationException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidKeyPassedException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidProjectionException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/KeyUnavailableException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/RegistryException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UserMismatchException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ValueNotAllowedException.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (with props)
Modified:
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/error/UDDIErrorHelper.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/businessEntity1.xml
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=709344&r1=709343&r2=709344&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 Oct 30 21:30:19 2008
@@ -17,16 +17,11 @@
package org.apache.juddi.api.impl;
-import java.util.Iterator;
import java.util.List;
-
import javax.jws.WebService;
-
import javax.persistence.EntityTransaction;
import javax.persistence.EntityManager;
-import org.apache.juddi.config.ResourceConfig;
-import org.apache.juddi.error.UDDIErrorHelper;
import org.apache.juddi.mapping.MappingModelToApi;
import org.apache.juddi.query.FetchBindingTemplatesQuery;
import org.apache.juddi.query.FetchBusinessEntitiesQuery;
@@ -43,6 +38,9 @@
import org.apache.juddi.query.FindTModelByNameQuery;
import org.apache.juddi.query.util.DynamicQuery;
import org.apache.juddi.util.JPAUtil;
+import org.apache.juddi.validation.ValidateInquiry;
+import org.apache.juddi.error.InvalidKeyPassedException;
+import org.apache.juddi.error.ErrorMessage;
import org.uddi.api_v3.BindingDetail;
import org.uddi.api_v3.BusinessDetail;
import org.uddi.api_v3.BusinessList;
@@ -75,36 +73,34 @@
public BindingDetail findBinding(FindBinding body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+ ValidateInquiry.validateFindBinding(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
- // TODO: Validate input here
- org.uddi.api_v3.TModelBag tmodelKeys = body.getTModelBag();
- org.uddi.api_v3.CategoryBag categories = body.getCategoryBag();
-
- org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
- findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
-
EntityManager em = JPAUtil.getEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
+ org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
+ findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
+
List<?> keysFound = null;
if (body.getServiceKey() == null || body.getServiceKey().length() == 0) {
- keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, tmodelKeys, keysFound);
+ 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);
- keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, tmodelKeys, keysFound, keyRestriction);
+ if (body.getTModelBag() != null)
+ keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(), keysFound, keyRestriction);
//keysFound = FindBindingByCategoryQuery.select(em, findQualifiers, tmodelKeys, keysFound, keyRestriction);
}
// Sort and retrieve the final results with paging taken into account
List<?> queryResults = FetchBindingTemplatesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
+ org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.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();
@@ -123,29 +119,25 @@
public BusinessList findBusiness(FindBusiness body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.BusinessList result = new org.uddi.api_v3.BusinessList();
+ ValidateInquiry.validateFindBusiness(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
-
- // TODO: Validate input here
- org.uddi.api_v3.IdentifierBag identifiers = body.getIdentifierBag();
- org.uddi.api_v3.DiscoveryURLs discURLs = body.getDiscoveryURLs();
- org.uddi.api_v3.CategoryBag categories = body.getCategoryBag();
- List<org.uddi.api_v3.Name> names = body.getName();
-
- org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
- findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
-
+
EntityManager em = JPAUtil.getEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
+
+ org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
+ findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
List<?> keysFound = null;
- keysFound = FindBusinessByIdentifierQuery.select(em, findQualifiers, identifiers, keysFound);
- keysFound = FindBusinessByDiscoveryURLQuery.select(em, findQualifiers, discURLs, keysFound);
- //keysFound = FindBusinessByCategoryQuery.select(em, findQualifiers, categories, keysFound);
- keysFound = FindBusinessByNameQuery.select(em, findQualifiers, names, keysFound);
+ keysFound = FindBusinessByIdentifierQuery.select(em, findQualifiers, body.getIdentifierBag(), keysFound);
+ keysFound = FindBusinessByDiscoveryURLQuery.select(em, findQualifiers, body.getDiscoveryURLs(), keysFound);
+ //keysFound = FindBusinessByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);
+ keysFound = FindBusinessByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
+
+ org.uddi.api_v3.BusinessList result = new org.uddi.api_v3.BusinessList();
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchBusinessEntitiesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
@@ -176,27 +168,24 @@
public ServiceList findService(FindService body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.ServiceList result = new org.uddi.api_v3.ServiceList();
+ ValidateInquiry.validateFindService(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
- // TODO: Validate input here
- org.uddi.api_v3.CategoryBag categories = body.getCategoryBag();
- List<org.uddi.api_v3.Name> names = body.getName();
-
- org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
- findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
-
-
EntityManager em = JPAUtil.getEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
+
+ org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
+ findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
List<?> keysFound = null;
- //keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, categories, keysFound);
- keysFound = FindServiceByNameQuery.select(em, findQualifiers, names, keysFound);
+ //keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);
+ keysFound = FindServiceByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
+ org.uddi.api_v3.ServiceList result = new org.uddi.api_v3.ServiceList();
+
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchBusinessServicesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
if (queryResults != null && queryResults.size() > 0)
@@ -220,27 +209,24 @@
public TModelList findTModel(FindTModel body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.TModelList result = new org.uddi.api_v3.TModelList();
+ ValidateInquiry.validateFindTModel(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
-
- // TODO: Validate input here
- org.uddi.api_v3.IdentifierBag identifiers = body.getIdentifierBag();
- org.uddi.api_v3.CategoryBag categories = body.getCategoryBag();
- org.uddi.api_v3.Name name = body.getName();
-
- org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
- findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
-
+
EntityManager em = JPAUtil.getEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
+
+ org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
+ findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
List<?> keysFound = null;
- keysFound = FindTModelByIdentifierQuery.select(em, findQualifiers, identifiers, keysFound);
- //keysFound = FindTModelByCategoryQuery.select(em, findQualifiers, identifiers, keysFound);
- keysFound = FindTModelByNameQuery.select(em, findQualifiers, name, keysFound);
+ keysFound = FindTModelByIdentifierQuery.select(em, findQualifiers, body.getIdentifierBag(), keysFound);
+ //keysFound = FindTModelByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);
+ keysFound = FindTModelByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
+
+ org.uddi.api_v3.TModelList result = new org.uddi.api_v3.TModelList();
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchTModelsQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
@@ -265,7 +251,7 @@
public BindingDetail getBindingDetail(GetBindingDetail body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+ ValidateInquiry.validateGetBindingDetail(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
@@ -273,18 +259,15 @@
EntityManager em = JPAUtil.getEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
+
+ org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
List<String> bindingKeyList = body.getBindingKey();
- Iterator<String> bindingKeyListItr = bindingKeyList.iterator();
- while (bindingKeyListItr.hasNext()) {
- String bindingKey = bindingKeyListItr.next();
-
+ for (String bindingKey : bindingKeyList) {
org.apache.juddi.model.BindingTemplate modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, bindingKey);
- if (modelBindingTemplate == null) {
- throw new DispositionReportFaultMessage(ResourceConfig.getGlobalMessage("errors.invalidkey.BindingTemplateNotFound") + ": " + bindingKey,
- UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
- }
+ if (modelBindingTemplate == null)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", bindingKey));
org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();
@@ -302,7 +285,7 @@
public BusinessDetail getBusinessDetail(GetBusinessDetail body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+ ValidateInquiry.validateGetBusinessDetail(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
@@ -311,17 +294,14 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
+ org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+
List<String> businessKeyList = body.getBusinessKey();
- Iterator<String> businessKeyListItr = businessKeyList.iterator();
- while (businessKeyListItr.hasNext()) {
- String businessKey = businessKeyListItr.next();
-
+ for (String businessKey : businessKeyList) {
org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
- if (modelBusinessEntity == null) {
- throw new DispositionReportFaultMessage(ResourceConfig.getGlobalMessage("errors.invalidkey.BusinessNotFound") + ": " + businessKey,
- UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
- }
+ if (modelBusinessEntity == null)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey));
org.uddi.api_v3.BusinessEntity apiBusinessEntity = new org.uddi.api_v3.BusinessEntity();
@@ -345,7 +325,7 @@
public ServiceDetail getServiceDetail(GetServiceDetail body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+ ValidateInquiry.validateGetServiceDetail(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
@@ -354,17 +334,14 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
+ org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+
List<String> serviceKeyList = body.getServiceKey();
- Iterator<String> serviceKeyListItr = serviceKeyList.iterator();
- while (serviceKeyListItr.hasNext()) {
- String serviceKey = serviceKeyListItr.next();
-
+ for (String serviceKey : serviceKeyList) {
org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
- if (modelBusinessService == null) {
- throw new DispositionReportFaultMessage(ResourceConfig.getGlobalMessage("errors.invalidkey.ServiceNotFound") + ": " + serviceKey,
- UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
- }
+ if (modelBusinessService == null)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey));
org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService();
@@ -382,7 +359,7 @@
public TModelDetail getTModelDetail(GetTModelDetail body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.TModelDetail result = new org.uddi.api_v3.TModelDetail();
+ ValidateInquiry.validateGetTModelDetail(body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
@@ -391,16 +368,14 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
+ org.uddi.api_v3.TModelDetail result = new org.uddi.api_v3.TModelDetail();
+
List<String> tmodelKeyList = body.getTModelKey();
- Iterator<String> tmodelKeyListItr = tmodelKeyList.iterator();
- while (tmodelKeyListItr.hasNext()) {
- String tmodelKey = tmodelKeyListItr.next();
-
+ for (String tmodelKey : tmodelKeyList) {
org.apache.juddi.model.Tmodel modelTModel = em.find(org.apache.juddi.model.Tmodel.class, tmodelKey);
if (modelTModel == null) {
- throw new DispositionReportFaultMessage(ResourceConfig.getGlobalMessage("errors.invalidkey.TModelNotFound") + ": " + tmodelKey,
- UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", tmodelKey));
}
org.uddi.api_v3.TModel apiTModel = new org.uddi.api_v3.TModel();
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=709344&r1=709343&r2=709344&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 Oct 30 21:30:19 2008
@@ -21,6 +21,8 @@
import java.util.Iterator;
import javax.jws.WebService;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
import javax.xml.ws.Holder;
import org.uddi.api_v3.AddPublisherAssertions;
@@ -49,6 +51,7 @@
import org.apache.juddi.util.JPAUtil;
import org.apache.juddi.error.UDDIErrorHelper;
import org.apache.juddi.config.ResourceConfig;
+import org.apache.juddi.validation.ValidatePublish;
/**
* @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
@@ -82,78 +85,114 @@
public void deleteBinding(DeleteBinding body)
throws DispositionReportFaultMessage {
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateDeleteBinding(em, body);
+
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
List<String> entityKeyList = body.getBindingKey();
- Iterator<String> entityKeyListListItr = entityKeyList.iterator();
- while (entityKeyListListItr.hasNext()) {
- String entityKey = entityKeyListListItr.next();
-
- JPAUtil.deleteEntity(org.apache.juddi.model.BindingTemplate.class, entityKey);
+ for (String entityKey : entityKeyList) {
+ Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
+ em.remove(obj);
}
+
+ tx.commit();
+ em.close();
}
public void deleteBusiness(DeleteBusiness body)
throws DispositionReportFaultMessage {
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateDeleteBusiness(em, body);
+
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
-
+
List<String> entityKeyList = body.getBusinessKey();
- Iterator<String> entityKeyListListItr = entityKeyList.iterator();
- while (entityKeyListListItr.hasNext()) {
- String entityKey = entityKeyListListItr.next();
-
- JPAUtil.deleteEntity(org.apache.juddi.model.BusinessEntity.class, entityKey);
+ for (String entityKey : entityKeyList) {
+ Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
+ em.remove(obj);
}
+
+ tx.commit();
+ em.close();
}
public void deletePublisherAssertions(DeletePublisherAssertions body)
throws DispositionReportFaultMessage {
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateDeletePublisherAssertions(em, body);
+
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
-
- List<org.uddi.api_v3.PublisherAssertion> apiPubAssertionList = body.getPublisherAssertion();
- Iterator<org.uddi.api_v3.PublisherAssertion> apiPubAssertionListItr = apiPubAssertionList.iterator();
- while (apiPubAssertionListItr.hasNext()) {
- org.uddi.api_v3.PublisherAssertion apiPubAssertion = apiPubAssertionListItr.next();
- org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(apiPubAssertion.getFromKey(), apiPubAssertion.getToKey());
- JPAUtil.deleteEntity(org.apache.juddi.model.PublisherAssertion.class, pubAssertionId);
+ List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
+ for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+ org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(entity.getFromKey(), entity.getToKey());
+ Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, pubAssertionId);
+ em.remove(obj);
}
+
+ tx.commit();
+ em.close();
}
public void deleteService(DeleteService body)
throws DispositionReportFaultMessage {
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateDeleteService(em, body);
+
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
-
+
List<String> entityKeyList = body.getServiceKey();
- Iterator<String> entityKeyListListItr = entityKeyList.iterator();
- while (entityKeyListListItr.hasNext()) {
- String entityKey = entityKeyListListItr.next();
-
- JPAUtil.deleteEntity(org.apache.juddi.model.BusinessService.class, entityKey);
+ for (String entityKey : entityKeyList) {
+ Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+ em.remove(obj);
}
+
+ tx.commit();
+ em.close();
}
public void deleteTModel(DeleteTModel body)
throws DispositionReportFaultMessage {
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateDeleteTModel(em, body);
+
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
-
+
+ // tModels are only lazily deleted!
List<String> entityKeyList = body.getTModelKey();
- Iterator<String> entityKeyListListItr = entityKeyList.iterator();
- while (entityKeyListListItr.hasNext()) {
- String entityKey = entityKeyListListItr.next();
-
- JPAUtil.deleteEntity(org.apache.juddi.model.Tmodel.class, entityKey);
+ for (String entityKey : entityKeyList) {
+ Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
+ ((org.apache.juddi.model.Tmodel)obj).setDeleted(true);
}
+
+ tx.commit();
+ em.close();
}
@@ -182,23 +221,19 @@
public BindingDetail saveBinding(SaveBinding body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateSaveBinding(em, body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
+ org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+
List<org.uddi.api_v3.BindingTemplate> apiBindingTemplateList = body.getBindingTemplate();
- Iterator<org.uddi.api_v3.BindingTemplate> apiBindingTemplateListItr = apiBindingTemplateList.iterator();
- while (apiBindingTemplateListItr.hasNext()) {
- org.uddi.api_v3.BindingTemplate apiBindingTemplate = apiBindingTemplateListItr.next();
-
- //TODO: Validate the input here
- if (JPAUtil.getEntity(org.apache.juddi.model.BusinessService.class, apiBindingTemplate.getServiceKey()) == null) {
- throw new DispositionReportFaultMessage(ResourceConfig.getGlobalMessage("errors.invalidkey.ServiceNotFound") + ": " + apiBindingTemplate.getServiceKey(),
- UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
- }
- //TODO: Test if key is null, and if so, apply key-generation strategy
- String bindingKey = apiBindingTemplate.getBindingKey();
+ for (org.uddi.api_v3.BindingTemplate apiBindingTemplate : apiBindingTemplateList) {
org.apache.juddi.model.BindingTemplate modelBindingTemplate = new org.apache.juddi.model.BindingTemplate();
org.apache.juddi.model.BusinessService modelBusinessService = new org.apache.juddi.model.BusinessService();
@@ -206,10 +241,18 @@
MappingApiToModel.mapBindingTemplate(apiBindingTemplate, modelBindingTemplate, modelBusinessService);
- JPAUtil.persistEntity(modelBindingTemplate, modelBindingTemplate.getBindingKey());
+ Object existingUddiEntity = em.find(modelBindingTemplate.getClass(), modelBindingTemplate.getBindingKey());
+ if (existingUddiEntity != null)
+ em.remove(existingUddiEntity);
+
+ em.persist(modelBindingTemplate);
result.getBindingTemplate().add(apiBindingTemplate);
}
+
+ tx.commit();
+ em.close();
+
return result;
}
@@ -217,28 +260,36 @@
public BusinessDetail saveBusiness(SaveBusiness body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateSaveBusiness(em, body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
+ org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+
List<org.uddi.api_v3.BusinessEntity> apiBusinessEntityList = body.getBusinessEntity();
- Iterator<org.uddi.api_v3.BusinessEntity> apiBusinessEntityListItr = apiBusinessEntityList.iterator();
- while (apiBusinessEntityListItr.hasNext()) {
- org.uddi.api_v3.BusinessEntity apiBusinessEntity = apiBusinessEntityListItr.next();
-
- //TODO: Validate the input here
- //TODO: Test if key is null, and if so, apply key-generation strategy
- String businessKey = apiBusinessEntity.getBusinessKey();
+ for (org.uddi.api_v3.BusinessEntity apiBusinessEntity : apiBusinessEntityList) {
org.apache.juddi.model.BusinessEntity modelBusinessEntity = new org.apache.juddi.model.BusinessEntity();
MappingApiToModel.mapBusinessEntity(apiBusinessEntity, modelBusinessEntity);
- JPAUtil.persistEntity(modelBusinessEntity, modelBusinessEntity.getBusinessKey());
+ Object existingUddiEntity = em.find(modelBusinessEntity.getClass(), modelBusinessEntity.getBusinessKey());
+ if (existingUddiEntity != null)
+ em.remove(existingUddiEntity);
+
+ em.persist(modelBusinessEntity);
result.getBusinessEntity().add(apiBusinessEntity);
}
+
+ tx.commit();
+ em.close();
+
return result;
}
@@ -246,23 +297,19 @@
public ServiceDetail saveService(SaveService body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateSaveService(em, body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
+ org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+
List<org.uddi.api_v3.BusinessService> apiBusinessServiceList = body.getBusinessService();
- Iterator<org.uddi.api_v3.BusinessService> apiBusinessServiceListItr = apiBusinessServiceList.iterator();
- while (apiBusinessServiceListItr.hasNext()) {
- org.uddi.api_v3.BusinessService apiBusinessService = apiBusinessServiceListItr.next();
-
- //TODO: Validate the input here
- if (JPAUtil.getEntity(org.apache.juddi.model.BusinessEntity.class, apiBusinessService.getBusinessKey()) == null) {
- throw new DispositionReportFaultMessage(ResourceConfig.getGlobalMessage("errors.invalidkey.BusinessNotFound") + ": " + apiBusinessService.getBusinessKey(),
- UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
- }
- //TODO: Test if key is null, and if so, apply key-generation strategy
- String serviceKey = apiBusinessService.getServiceKey();
+ for (org.uddi.api_v3.BusinessService apiBusinessService : apiBusinessServiceList) {
org.apache.juddi.model.BusinessService modelBusinessService = new org.apache.juddi.model.BusinessService();
org.apache.juddi.model.BusinessEntity modelBusinessEntity = new org.apache.juddi.model.BusinessEntity();
@@ -270,10 +317,18 @@
MappingApiToModel.mapBusinessService(apiBusinessService, modelBusinessService, modelBusinessEntity);
- JPAUtil.persistEntity(modelBusinessService, modelBusinessService.getServiceKey());
+ Object existingUddiEntity = em.find(modelBusinessService.getClass(), modelBusinessService.getServiceKey());
+ if (existingUddiEntity != null)
+ em.remove(existingUddiEntity);
+
+ em.persist(modelBusinessService);
result.getBusinessService().add(apiBusinessService);
}
+
+ tx.commit();
+ em.close();
+
return result;
}
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/AssertionNotFoundException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/AssertionNotFoundException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/AssertionNotFoundException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/AssertionNotFoundException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_assertionNotFound: (30000) Signifies that a particular publisher assertion cannot be identified in a save or delete operation.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class AssertionNotFoundException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public AssertionNotFoundException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_ASSERTION_NOT_FOUND));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/AssertionNotFoundException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ErrorMessage.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ErrorMessage.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ErrorMessage.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ErrorMessage.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+import org.apache.juddi.config.ResourceConfig;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class ErrorMessage {
+ private String message;
+ private String value;
+
+ public ErrorMessage(String messageCode) {
+ this(messageCode, null);
+ }
+
+ public ErrorMessage(String messageCode, String value) {
+ this.message = ResourceConfig.getGlobalMessage(messageCode);
+ this.value = value;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ return message + ": " + value;
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ErrorMessage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/FatalErrorException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/FatalErrorException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/FatalErrorException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/FatalErrorException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_fatalError: (10500) Signifies that a serious technical error has occurred while processing the request.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class FatalErrorException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public FatalErrorException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_FATAL_ERROR));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/FatalErrorException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidCombinationException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidCombinationException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidCombinationException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidCombinationException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_invalidCombination: (40500) Signifies conflicting find qualifiers have been specified. The find qualifiers that caused the problem SHOULD be
+ * clearly indicated in the error text.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class InvalidCombinationException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidCombinationException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_COMBINATION));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidCombinationException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidKeyPassedException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidKeyPassedException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidKeyPassedException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidKeyPassedException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_invalidKeyPassed: (10210) Signifies that the uddiKey value passed did not match with any known key values. The details on the invalid key SHOULD be
+ * included in the dispositionReport element.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class InvalidKeyPassedException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidKeyPassedException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidKeyPassedException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidProjectionException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidProjectionException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidProjectionException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidProjectionException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_invalidProjection: (20230) Signifies that an attempt was made to save a businessEntity containing a service projection where the serviceKey does not
+ * belong to the business designated by the businessKey. The serviceKey of at least one such businessService SHOULD be included in the dispositionReport.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class InvalidProjectionException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidProjectionException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_PROJECTION));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/InvalidProjectionException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/KeyUnavailableException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/KeyUnavailableException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/KeyUnavailableException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/KeyUnavailableException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_keyUnavailable: (40100) Signifies that the proposed key is in a partition that has already been assigned to some other publisher.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class KeyUnavailableException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public KeyUnavailableException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_KEY_UNAVAILABLE));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/KeyUnavailableException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/RegistryException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/RegistryException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/RegistryException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/RegistryException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.api_v3.DispositionReport;
+
+/**
+ * Parent Exception for all UDDI registry exceptions
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class RegistryException extends DispositionReportFaultMessage {
+
+ private static final long serialVersionUID = 1L;
+
+ public RegistryException(ErrorMessage message, DispositionReport dispReport) {
+ super(message.toString(), dispReport);
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/RegistryException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UDDIErrorHelper.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UDDIErrorHelper.java?rev=709344&r1=709343&r2=709344&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UDDIErrorHelper.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UDDIErrorHelper.java Thu Oct 30 21:30:19 2008
@@ -40,7 +40,9 @@
public static final int E_INVALID_COMPLETION_STATUS = 30100;
public static final int E_INVALID_URL_PASSED = 10220;
public static final int E_INVALID_VALUE = 20200;
+ public static final int E_INVALID_COMBINATION = 40500;
public static final int E_KEY_RETIRED = 10310;
+ public static final int E_KEY_UNAVAILABLE = 40100;
public static final int E_LANGUAGE_ERROR = 10060;
public static final int E_MESSAGE_TOO_LARGE = 30110;
public static final int E_NAME_TOO_LONG = 10020;
@@ -70,9 +72,11 @@
case E_BUSY : return "E_busy";
case E_CATEGORIZATION_NOT_ALLOWED : return "E_categorizationNotAllowed";
case E_FATAL_ERROR : return "E_fatalError";
+ case E_INVALID_COMBINATION : return "E_invalidCombination";
case E_INVALID_CATEGORY : return "E_invalidCategory";
case E_INVALID_COMPLETION_STATUS : return "E_invalidCompletionStatus";
case E_INVALID_KEY_PASSED : return "E_invalidKeyPassed";
+ case E_KEY_UNAVAILABLE : return "E_keyUnavailable";
case E_INVALID_PROJECTION : return "E_invalidProjection";
case E_INVALID_TIME : return "E_invalidTime";
case E_INVALID_URL_PASSED : return "E_invalidURLPassed";
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UserMismatchException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UserMismatchException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UserMismatchException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UserMismatchException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_userMismatch: (10140) Signifies that an attempt was made to use the publishing API to change data that is controlled by another party.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class UserMismatchException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public UserMismatchException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_USER_MISMATCH));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/UserMismatchException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ValueNotAllowedException.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ValueNotAllowedException.java?rev=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ValueNotAllowedException.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ValueNotAllowedException.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.error;
+
+/**
+ * E_valueNotAllowed: (20210) Signifies that a value did not pass validation because of contextual issues. The value may be valid in some contexts, but
+ * not in the context used. The error text MAY contain information about the contextual problem.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class ValueNotAllowedException extends RegistryException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ValueNotAllowedException(ErrorMessage message) {
+ super(message, UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_VALUE_NOT_ALLOWED));
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/error/ValueNotAllowedException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=709344&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java Thu Oct 30 21:30:19 2008
@@ -0,0 +1,349 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.validation;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Hashtable;
+
+import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetServiceDetail;
+import org.uddi.api_v3.GetBindingDetail;
+import org.uddi.api_v3.GetTModelDetail;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindBinding;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.TModelBag;
+
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+import org.apache.juddi.error.ErrorMessage;
+import org.apache.juddi.error.FatalErrorException;
+import org.apache.juddi.error.InvalidKeyPassedException;
+import org.apache.juddi.error.ValueNotAllowedException;
+import org.apache.juddi.error.InvalidCombinationException;
+import org.apache.juddi.query.util.FindQualifiers;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class ValidateInquiry {
+
+ public static void validateGetBusinessDetail(GetBusinessDetail body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<String> entityKeyList = body.getBusinessKey();
+ if (entityKeyList == null || entityKeyList.size() == 0)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ for (String entityKey : entityKeyList) {
+ boolean inserted = dupCheck.add(entityKey);
+ if (!inserted)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+ }
+ }
+
+ public static void validateGetServiceDetail(GetServiceDetail body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<String> entityKeyList = body.getServiceKey();
+ if (entityKeyList == null || entityKeyList.size() == 0)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ for (String entityKey : entityKeyList) {
+ boolean inserted = dupCheck.add(entityKey);
+ if (!inserted)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+ }
+ }
+
+ public static void validateGetBindingDetail(GetBindingDetail body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<String> entityKeyList = body.getBindingKey();
+ if (entityKeyList == null || entityKeyList.size() == 0)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ for (String entityKey : entityKeyList) {
+ boolean inserted = dupCheck.add(entityKey);
+ if (!inserted)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+ }
+ }
+
+ public static void validateGetTModelDetail(GetTModelDetail body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<String> entityKeyList = body.getTModelKey();
+ if (entityKeyList == null || entityKeyList.size() == 0)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ for (String entityKey : entityKeyList) {
+ boolean inserted = dupCheck.add(entityKey);
+ if (!inserted)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+ }
+ }
+
+ public static void validateFindBusiness(FindBusiness body) throws DispositionReportFaultMessage {
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName() == null &&
+ body.getIdentifierBag() == null && body.getDiscoveryURLs() == null && body.getFindRelatedBusinesses() == null)
+ throw new FatalErrorException(new ErrorMessage("errors.findbusiness.NoInput"));
+
+ validateFindQualifiers(body.getFindQualifiers());
+ validateTModelBag(body.getTModelBag());
+ validateFindTModel(body.getFindTModel());
+ ValidatePublish.validateDiscoveryUrls(body.getDiscoveryURLs());
+ ValidatePublish.validateIdentifierBag(body.getIdentifierBag());
+ ValidatePublish.validateCategoryBag(body.getCategoryBag());
+
+ }
+
+ public static void validateFindService(FindService body) throws DispositionReportFaultMessage {
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName() == null)
+ throw new FatalErrorException(new ErrorMessage("errors.findservice.NoInput"));
+
+ validateFindQualifiers(body.getFindQualifiers());
+ validateTModelBag(body.getTModelBag());
+ validateFindTModel(body.getFindTModel());
+ ValidatePublish.validateCategoryBag(body.getCategoryBag());
+
+ }
+
+ public static void validateFindBinding(FindBinding body) throws DispositionReportFaultMessage {
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null)
+ throw new FatalErrorException(new ErrorMessage("errors.findbinding.NoInput"));
+
+ validateFindQualifiers(body.getFindQualifiers());
+ validateTModelBag(body.getTModelBag());
+ validateFindTModel(body.getFindTModel());
+ 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"));
+
+ if (body.getCategoryBag() == null && body.getIdentifierBag() == null && body.getName() == null)
+ throw new FatalErrorException(new ErrorMessage("errors.findtmodel.NoInput"));
+
+ validateFindQualifiers(body.getFindQualifiers());
+ ValidatePublish.validateIdentifierBag(body.getIdentifierBag());
+ ValidatePublish.validateCategoryBag(body.getCategoryBag());
+ }
+
+ public static void validateTModelBag(TModelBag tmodelBag) throws DispositionReportFaultMessage {
+ // tmodelBag is optional
+ if (tmodelBag == null)
+ return;
+
+ if (tmodelBag.getTModelKey() == null || tmodelBag.getTModelKey().size() == 0)
+ throw new ValueNotAllowedException(new ErrorMessage("errors.tmodelbag.NoInput"));
+
+ }
+
+ private static void validateFindQualifiers(org.uddi.api_v3.FindQualifiers findQualifiers) throws DispositionReportFaultMessage {
+ if (findQualifiers == null)
+ return;
+
+ List<String> fqList = findQualifiers.getFindQualifier();
+ if (fqList == null || fqList.size() == 0)
+ throw new ValueNotAllowedException(new ErrorMessage("errors.findqualifiers.NoInput"));
+
+
+ Hashtable<String, String> fqTable = new Hashtable<String, String>();
+ for (String fq : fqList) {
+ String result = fqTable.put(fq.toUpperCase(), fq.toUpperCase());
+ if (result != null)
+ throw new ValueNotAllowedException(new ErrorMessage("errors.findqualifiers.DuplicateValue", result));
+
+ // Invalid combo: andAllKeys, orAllKeys, and orLikeKeys
+ if (fq.equalsIgnoreCase(FindQualifiers.AND_ALL_KEYS) || fq.equalsIgnoreCase(FindQualifiers.AND_ALL_KEYS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.OR_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_ALL_KEYS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_ALL_KEYS));
+
+ if (fqTable.get(FindQualifiers.OR_LIKE_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_LIKE_KEYS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_LIKE_KEYS));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.OR_ALL_KEYS) || fq.equalsIgnoreCase(FindQualifiers.OR_ALL_KEYS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.AND_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.AND_ALL_KEYS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.AND_ALL_KEYS));
+
+ if (fqTable.get(FindQualifiers.OR_LIKE_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_LIKE_KEYS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_LIKE_KEYS));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.OR_LIKE_KEYS) || fq.equalsIgnoreCase(FindQualifiers.OR_LIKE_KEYS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.AND_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.AND_ALL_KEYS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.AND_ALL_KEYS));
+
+ if (fqTable.get(FindQualifiers.OR_ALL_KEYS.toUpperCase()) != null || fqTable.get(FindQualifiers.OR_ALL_KEYS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.OR_ALL_KEYS));
+ }
+
+ // Invalid combo: sortByNameAsc and sortByNameDesc
+ if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_ASC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_ASC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_NAME_DESC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_NAME_DESC_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_NAME_DESC));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_DESC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_NAME_DESC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_NAME_ASC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_NAME_ASC_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_NAME_ASC));
+ }
+
+ // Invalid combo: sortByDateAsc and sortByDateDesc
+ if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_ASC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_ASC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_DATE_DESC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_DATE_DESC_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_DATE_DESC));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_DESC) || fq.equalsIgnoreCase(FindQualifiers.SORT_BY_DATE_DESC_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SORT_BY_DATE_ASC.toUpperCase()) != null || fqTable.get(FindQualifiers.SORT_BY_DATE_ASC_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SORT_BY_DATE_ASC));
+ }
+
+ // Invalid combo: combineCategoryBags, serviceSubset and bindingSubset
+ if (fq.equalsIgnoreCase(FindQualifiers.COMBINE_CATEGORY_BAGS) || fq.equalsIgnoreCase(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SERVICE_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.SERVICE_SUBSET_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SERVICE_SUBSET));
+
+ if (fqTable.get(FindQualifiers.BINDING_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.BINDING_SUBSET_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINDING_SUBSET));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.SERVICE_SUBSET) || fq.equalsIgnoreCase(FindQualifiers.SERVICE_SUBSET_TMODEL)) {
+ if (fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS.toUpperCase()) != null || fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.COMBINE_CATEGORY_BAGS));
+
+ if (fqTable.get(FindQualifiers.BINDING_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.BINDING_SUBSET_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINDING_SUBSET));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.BINDING_SUBSET) || fq.equalsIgnoreCase(FindQualifiers.BINDING_SUBSET_TMODEL)) {
+ if (fqTable.get(FindQualifiers.SERVICE_SUBSET.toUpperCase()) != null || fqTable.get(FindQualifiers.SERVICE_SUBSET_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.SERVICE_SUBSET));
+
+ if (fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS.toUpperCase()) != null || fqTable.get(FindQualifiers.COMBINE_CATEGORY_BAGS_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.COMBINE_CATEGORY_BAGS));
+ }
+
+ // Invalid combo: exactMatch and approximateMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.APPROXIMATE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.APPROXIMATE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.APPROXIMATE_MATCH));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.APPROXIMATE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.APPROXIMATE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
+ }
+
+ // Invalid combo: exactMatch and caseInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_MATCH));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
+ }
+
+ // Invalid combo: binarySort and UTS-10
+ if (fq.equalsIgnoreCase(FindQualifiers.BINARY_SORT) || fq.equalsIgnoreCase(FindQualifiers.BINARY_SORT_TMODEL)) {
+ if (fqTable.get(FindQualifiers.UTS_10.toUpperCase()) != null || fqTable.get(FindQualifiers.UTS_10_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.UTS_10));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.UTS_10) || fq.equalsIgnoreCase(FindQualifiers.UTS_10_TMODEL)) {
+ if (fqTable.get(FindQualifiers.BINARY_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.BINARY_SORT_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.BINARY_SORT));
+ }
+
+ // Invalid combo: diacriticSensitiveMatch and diacriticInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_SENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_SENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_INSENSITIVE_MATCH));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.DIACRITIC_SENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_SENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_SENSITIVE_MATCH));
+ }
+
+ // Invalid combo: exactMatch and diacriticInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH) || fq.equalsIgnoreCase(FindQualifiers.EXACT_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.DIACRITIC_INSENSITIVE_MATCH));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.DIACRITIC_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.EXACT_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.EXACT_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.EXACT_MATCH));
+ }
+
+ // Invalid combo: caseSensitiveSort and caseInsensitiveSort
+ if (fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_SORT) || fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_SORT));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_SORT) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_SORT_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_SENSITIVE_SORT.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_SENSITIVE_SORT_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_SENSITIVE_SORT));
+ }
+
+ // Invalid combo: caseSensitiveMatch and caseInsensitiveMatch
+ if (fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_INSENSITIVE_MATCH));
+ }
+ else if (fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH) || fq.equalsIgnoreCase(FindQualifiers.CASE_INSENSITIVE_MATCH_TMODEL)) {
+ if (fqTable.get(FindQualifiers.CASE_SENSITIVE_MATCH.toUpperCase()) != null || fqTable.get(FindQualifiers.CASE_SENSITIVE_MATCH_TMODEL.toUpperCase()) != null)
+ throw new InvalidCombinationException(new ErrorMessage("errors.findqualifiers.InvalidCombo", fq + " & " + FindQualifiers.CASE_SENSITIVE_MATCH));
+ }
+
+ }
+ }
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org