juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject svn commit: r1549946 [2/3] - in /juddi/branches/juddi-3.3.x: juddi-core-openjpa/src/test/resources/META-INF/ juddi-core/src/main/java/org/apache/juddi/api/impl/ juddi-core/src/main/java/org/apache/juddi/model/ juddi-core/src/main/java/org/apache/juddi/...
Date Tue, 10 Dec 2013 19:24:34 GMT
Modified: juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=1549946&r1=1549945&r2=1549946&view=diff
==============================================================================
--- juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (original)
+++ juddi/branches/juddi-3.3.x/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java Tue Dec 10 19:24:33 2013
@@ -18,8 +18,14 @@ package org.apache.juddi.validation;
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
@@ -39,12 +45,15 @@ import org.apache.juddi.config.Persisten
 import org.apache.juddi.config.Property;
 import org.apache.juddi.keygen.KeyGenerator;
 import org.apache.juddi.keygen.KeyGeneratorFactory;
+import org.apache.juddi.mapping.MappingModelToApi;
 import org.apache.juddi.model.Publisher;
 import org.apache.juddi.model.Tmodel;
 import org.apache.juddi.model.UddiEntity;
 import org.apache.juddi.model.UddiEntityPublisher;
 import org.apache.juddi.query.FindBusinessByPublisherQuery;
 import org.apache.juddi.query.FindTModelByPublisherQuery;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.TokenResolver;
 import org.apache.juddi.v3.error.AssertionNotFoundException;
 import org.apache.juddi.v3.error.ErrorMessage;
 import org.apache.juddi.v3.error.FatalErrorException;
@@ -57,6 +66,9 @@ import org.apache.juddi.v3.error.ValueNo
 import org.uddi.api_v3.AccessPoint;
 import org.uddi.api_v3.AddPublisherAssertions;
 import org.uddi.api_v3.AddressLine;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
 import org.uddi.api_v3.DeleteBinding;
 import org.uddi.api_v3.DeleteBusiness;
 import org.uddi.api_v3.DeletePublisherAssertions;
@@ -76,14 +88,16 @@ import org.uddi.api_v3.SaveBinding;
 import org.uddi.api_v3.SaveBusiness;
 import org.uddi.api_v3.SaveService;
 import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModel;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 
 /**
  * Provides validation of publish requests to Juddi
  *
  * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
- * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a> 
- * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a> Modified March 2013 to validate string length and ref integrity
+ * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a> Modified March
+ * 2013 to validate string length and ref integrity
  *
  * Advisory, be careful calling AppConfig.getConfiguration() from within
  * validation functions, it may inadvertently cause infinite loops during the
@@ -92,1804 +106,1838 @@ import org.uddi.v3_service.DispositionRe
  */
 public class ValidatePublish extends ValidateUDDIApi {
 
-    /**
-     * This flag will add additional output to stdout for debugging purposes,
-     * set this to true if
-     */
-    private Log log = LogFactory.getLog(this.getClass());
+        /**
+         * This flag will add additional output to stdout for debugging
+         * purposes, set this to true if
+         */
+        private Log log = LogFactory.getLog(this.getClass());
 
-    public ValidatePublish(UddiEntityPublisher publisher) {
-        super(publisher);
-    }
-
-    public void validateDeleteBusiness(EntityManager em, DeleteBusiness 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"));
+        public ValidatePublish(UddiEntityPublisher publisher) {
+                super(publisher);
         }
 
-        HashSet<String> dupCheck = new HashSet<String>();
-        int i = 0;
-        for (String entityKey : entityKeyList) {
+        public void validateDeleteBusiness(EntityManager em, DeleteBusiness body) throws DispositionReportFaultMessage {
 
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            entityKeyList.set(i, entityKey);
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-            boolean inserted = dupCheck.add(entityKey);
-            if (!inserted) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-            }
+                // No null or empty list
+                List<String> entityKeyList = body.getBusinessKey();
+                if (entityKeyList == null || entityKeyList.size() == 0) {
+                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                }
 
-            Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
-            if (obj == null) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", entityKey));
-            }
+                HashSet<String> dupCheck = new HashSet<String>();
+                int i = 0;
+                for (String entityKey : entityKeyList) {
 
-            if (!publisher.isOwner((UddiEntity) obj)) {
-                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-            }
+                        // Per section 4.4: keys must be case-folded
+                        entityKey = entityKey.toLowerCase();
+                        entityKeyList.set(i, entityKey);
 
-            i++;
-        }
-    }
+                        boolean inserted = dupCheck.add(entityKey);
+                        if (!inserted) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+                        }
 
-    public void validateDeleteService(EntityManager em, DeleteService body) throws DispositionReportFaultMessage {
+                        Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
+                        if (obj == null) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", entityKey));
+                        }
 
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                        if (!publisher.isOwner((UddiEntity) obj)) {
+                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                        }
 
-        // No null or empty list
-        List<String> entityKeyList = body.getServiceKey();
-        if (entityKeyList == null || entityKeyList.size() == 0) {
-            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                        i++;
+                }
         }
 
-        HashSet<String> dupCheck = new HashSet<String>();
-        int i = 0;
-        for (String entityKey : entityKeyList) {
+        public void validateDeleteService(EntityManager em, DeleteService body) throws DispositionReportFaultMessage {
 
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            entityKeyList.set(i, entityKey);
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-            boolean inserted = dupCheck.add(entityKey);
-            if (!inserted) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-            }
+                // No null or empty list
+                List<String> entityKeyList = body.getServiceKey();
+                if (entityKeyList == null || entityKeyList.size() == 0) {
+                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                }
 
-            Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
-            if (obj == null) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", entityKey));
-            }
+                HashSet<String> dupCheck = new HashSet<String>();
+                int i = 0;
+                for (String entityKey : entityKeyList) {
 
-            if (!publisher.isOwner((UddiEntity) obj)) {
-                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-            }
+                        // Per section 4.4: keys must be case-folded
+                        entityKey = entityKey.toLowerCase();
+                        entityKeyList.set(i, entityKey);
 
-            i++;
-        }
-    }
+                        boolean inserted = dupCheck.add(entityKey);
+                        if (!inserted) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+                        }
 
-    public void validateDeleteBinding(EntityManager em, DeleteBinding body) throws DispositionReportFaultMessage {
+                        Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+                        if (obj == null) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", entityKey));
+                        }
 
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                        if (!publisher.isOwner((UddiEntity) obj)) {
+                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                        }
 
-        // No null or empty list
-        List<String> entityKeyList = body.getBindingKey();
-        if (entityKeyList == null || entityKeyList.size() == 0) {
-            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                        i++;
+                }
         }
 
-        // Checking for duplicates and existence
-        HashSet<String> dupCheck = new HashSet<String>();
-        int i = 0;
-        for (String entityKey : entityKeyList) {
-            validateKeyLength(entityKey);
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            entityKeyList.set(i, entityKey);
+        public void validateDeleteBinding(EntityManager em, DeleteBinding body) throws DispositionReportFaultMessage {
 
-            boolean inserted = dupCheck.add(entityKey);
-            if (!inserted) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-            }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-            Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
-            if (obj == null) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
-            }
+                // No null or empty list
+                List<String> entityKeyList = body.getBindingKey();
+                if (entityKeyList == null || entityKeyList.size() == 0) {
+                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                }
 
-            if (!publisher.isOwner((UddiEntity) obj)) {
-                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-            }
+                // Checking for duplicates and existence
+                HashSet<String> dupCheck = new HashSet<String>();
+                int i = 0;
+                for (String entityKey : entityKeyList) {
+                        validateKeyLength(entityKey);
+                        // Per section 4.4: keys must be case-folded
+                        entityKey = entityKey.toLowerCase();
+                        entityKeyList.set(i, entityKey);
 
-            i++;
-        }
-    }
+                        boolean inserted = dupCheck.add(entityKey);
+                        if (!inserted) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+                        }
 
-    public void validateDeleteTModel(EntityManager em, DeleteTModel body) throws DispositionReportFaultMessage {
+                        Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
+                        if (obj == null) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
+                        }
 
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                        if (!publisher.isOwner((UddiEntity) obj)) {
+                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                        }
 
-        // No null or empty list
-        List<String> entityKeyList = body.getTModelKey();
-        if (entityKeyList == null || entityKeyList.size() == 0) {
-            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                        i++;
+                }
         }
 
-        HashSet<String> dupCheck = new HashSet<String>();
-        int i = 0;
-        for (String entityKey : entityKeyList) {
-            validateKeyLength(entityKey);
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            entityKeyList.set(i, entityKey);
+        public void validateDeleteTModel(EntityManager em, DeleteTModel body) throws DispositionReportFaultMessage {
 
-            boolean inserted = dupCheck.add(entityKey);
-            if (!inserted) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
-            }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-            Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
-            if (obj == null) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
-            }
+                // No null or empty list
+                List<String> entityKeyList = body.getTModelKey();
+                if (entityKeyList == null || entityKeyList.size() == 0) {
+                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+                }
 
-            if (!publisher.isOwner((UddiEntity) obj)) {
-                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-            }
+                HashSet<String> dupCheck = new HashSet<String>();
+                int i = 0;
+                for (String entityKey : entityKeyList) {
+                        validateKeyLength(entityKey);
+                        // Per section 4.4: keys must be case-folded
+                        entityKey = entityKey.toLowerCase();
+                        entityKeyList.set(i, entityKey);
 
-            i++;
-        }
-    }
+                        boolean inserted = dupCheck.add(entityKey);
+                        if (!inserted) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+                        }
 
-    public void validateDeletePublisherAssertions(EntityManager em, DeletePublisherAssertions body) throws DispositionReportFaultMessage {
+                        Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
+                        if (obj == null) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
+                        }
 
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                        if (!publisher.isOwner((UddiEntity) obj)) {
+                                throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                        }
 
-        // No null or empty list
-        List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
-        if (entityList == null || entityList.size() == 0) {
-            throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.NoPubAssertions"));
+                        i++;
+                }
         }
 
-        for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
-            validateKeyLength(entity.getFromKey());
-            validateKeyLength(entity.getToKey());
-            validatePublisherAssertion(em, entity);
+        public void validateDeletePublisherAssertions(EntityManager em, DeletePublisherAssertions body) throws DispositionReportFaultMessage {
 
-            org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(entity.getFromKey(), entity.getToKey());
-            Object obj = em.find(org.apache.juddi.model.PublisherAssertion.class, pubAssertionId);
-            if (obj == null) {
-                throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
-            } else {
-                org.apache.juddi.model.PublisherAssertion pubAssertion = (org.apache.juddi.model.PublisherAssertion) obj;
-                org.uddi.api_v3.KeyedReference keyedRef = entity.getKeyedReference();
-                if (keyedRef == null) {
-                    throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
                 }
 
-                if (!pubAssertion.getTmodelKey().equalsIgnoreCase(keyedRef.getTModelKey())
-                        || !pubAssertion.getKeyName().equalsIgnoreCase(keyedRef.getKeyName())
-                        || !pubAssertion.getKeyValue().equalsIgnoreCase(keyedRef.getKeyValue())) {
-                    throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
+                // No null or empty list
+                List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
+                if (entityList == null || entityList.size() == 0) {
+                        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.NoPubAssertions"));
                 }
 
-            }
-
-        }
-    }
-
-    public void validateSaveBusiness(EntityManager em, SaveBusiness body, Configuration config) throws DispositionReportFaultMessage {
-
-        if (config == null) {
-            try {
-                config = AppConfig.getConfiguration();
-            } catch (ConfigurationException ce) {
-                log.error("Could not optain config. " + ce.getMessage(), ce);
-            }
-        }
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+                        validateKeyLength(entity.getFromKey());
+                        validateKeyLength(entity.getToKey());
+                        validatePublisherAssertion(em, entity);
 
-        // No null or empty list
-        List<org.uddi.api_v3.BusinessEntity> entityList = body.getBusinessEntity();
-        if (entityList == null || entityList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.savebusiness.NoInput"));
-        }
+                        org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(entity.getFromKey(), entity.getToKey());
+                        Object obj = em.find(org.apache.juddi.model.PublisherAssertion.class, pubAssertionId);
+                        if (obj == null) {
+                                throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
+                        } else {
+                                org.apache.juddi.model.PublisherAssertion pubAssertion = (org.apache.juddi.model.PublisherAssertion) obj;
+                                org.uddi.api_v3.KeyedReference keyedRef = entity.getKeyedReference();
+                                if (keyedRef == null) {
+                                        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
+                                }
 
-        for (org.uddi.api_v3.BusinessEntity entity : entityList) {
-            validateBusinessEntity(em, entity, config);
-        }
-    }
+                                if (!pubAssertion.getTmodelKey().equalsIgnoreCase(keyedRef.getTModelKey())
+                                        || !pubAssertion.getKeyName().equalsIgnoreCase(keyedRef.getKeyName())
+                                        || !pubAssertion.getKeyValue().equalsIgnoreCase(keyedRef.getKeyValue())) {
+                                        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
+                                }
 
-    public void validateSaveBusinessMax(EntityManager em) throws DispositionReportFaultMessage {
+                        }
 
-        //Obtain the maxSettings for this publisher or get the defaults
-        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-        Integer maxBusinesses = publisher.getMaxBusinesses();
-        try {
-            if (maxBusinesses == null) {
-                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER)) {
-                    maxBusinesses = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER, -1);
-                } else {
-                    maxBusinesses = -1;
                 }
-            }
-        } catch (ConfigurationException e) {
-            log.error(e.getMessage(), e);
-            maxBusinesses = -1; //in case the configuration is not available
-        }
-        //if we have the maxBusinesses set for this publisher then we need to make sure we did not exceed it.
-        if (maxBusinesses > 0) {
-            //get the businesses owned by this publisher
-            List<?> businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, null);
-            if (businessKeysFound != null && businessKeysFound.size() > maxBusinesses) {
-                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBusinessesExceeded"));
-            }
         }
 
-    }
+        public void validateSaveBusiness(EntityManager em, SaveBusiness body, Configuration config) throws DispositionReportFaultMessage {
 
-    public void validateSaveService(EntityManager em, SaveService body, Configuration config) throws DispositionReportFaultMessage {
-
-        if (config == null) {
-            try {
-                config = AppConfig.getConfiguration();
-            } catch (ConfigurationException ce) {
-                log.error("Could not optain config. " + ce.getMessage(), ce);
-            }
-        }
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                if (config == null) {
+                        try {
+                                config = AppConfig.getConfiguration();
+                        } catch (ConfigurationException ce) {
+                                log.error("Could not optain config. " + ce.getMessage(), ce);
+                        }
+                }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-        // No null or empty list
-        List<org.uddi.api_v3.BusinessService> entityList = body.getBusinessService();
-        if (entityList == null || entityList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.saveservice.NoInput"));
-        }
+                // No null or empty list
+                List<org.uddi.api_v3.BusinessEntity> entityList = body.getBusinessEntity();
+                if (entityList == null || entityList.size() == 0) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.savebusiness.NoInput"));
+                }
 
-        for (org.uddi.api_v3.BusinessService entity : entityList) {
-            // Entity specific data validation
-            validateBusinessService(em, entity, null, config);
+                for (org.uddi.api_v3.BusinessEntity entity : entityList) {
+                        validateBusinessEntity(em, entity, config);
+                        validateCheckedTModels(entity, config);
+                }
         }
-    }
 
-    public void validateSaveServiceMax(EntityManager em, String businessKey) throws DispositionReportFaultMessage {
+        public void validateSaveBusinessMax(EntityManager em) throws DispositionReportFaultMessage {
 
-        //Obtain the maxSettings for this publisher or get the defaults
-        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-        Integer maxServices = publisher.getMaxBusinesses();
-        try {
-            if (maxServices == null) {
-                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_SERVICES_PER_BUSINESS)) {
-                    maxServices = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_SERVICES_PER_BUSINESS, -1);
-                } else {
-                    maxServices = -1;
+                //Obtain the maxSettings for this publisher or get the defaults
+                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+                Integer maxBusinesses = publisher.getMaxBusinesses();
+                try {
+                        if (maxBusinesses == null) {
+                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER)) {
+                                        maxBusinesses = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER, -1);
+                                } else {
+                                        maxBusinesses = -1;
+                                }
+                        }
+                } catch (ConfigurationException e) {
+                        log.error(e.getMessage(), e);
+                        maxBusinesses = -1; //in case the configuration is not available
+                }
+                //if we have the maxBusinesses set for this publisher then we need to make sure we did not exceed it.
+                if (maxBusinesses > 0) {
+                        //get the businesses owned by this publisher
+                        List<?> businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, null);
+                        if (businessKeysFound != null && businessKeysFound.size() > maxBusinesses) {
+                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBusinessesExceeded"));
+                        }
                 }
-            }
-        } catch (ConfigurationException e) {
-            log.error(e.getMessage(), e);
-            maxServices = -1; //incase the configuration isn't available
-        }
-        //if we have the maxServices set for a business then we need to make sure we did not exceed it.
-        if (maxServices > 0) {
-            //get the businesses owned by this publisher
-            org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
-            if (modelBusinessEntity.getBusinessServices() != null && modelBusinessEntity.getBusinessServices().size() > maxServices) {
-                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxServicesExceeded"));
-            }
+
         }
-    }
 
-    public void validateSaveBinding(EntityManager em, SaveBinding body, Configuration config) throws DispositionReportFaultMessage {
+        public void validateSaveService(EntityManager em, SaveService body, Configuration config) throws DispositionReportFaultMessage {
 
-        if (config == null) {
-            try {
-                config = AppConfig.getConfiguration();
-            } catch (ConfigurationException ce) {
-                log.error("Could not optain config. " + ce.getMessage(), ce);
-            }
-        }
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                if (config == null) {
+                        try {
+                                config = AppConfig.getConfiguration();
+                        } catch (ConfigurationException ce) {
+                                log.error("Could not optain config. " + ce.getMessage(), ce);
+                        }
+                }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-        // No null or empty list
-        List<org.uddi.api_v3.BindingTemplate> entityList = body.getBindingTemplate();
-        if (entityList == null || entityList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.savebinding.NoInput"));
-        }
+                // No null or empty list
+                List<org.uddi.api_v3.BusinessService> entityList = body.getBusinessService();
+                if (entityList == null || entityList.size() == 0) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.saveservice.NoInput"));
+                }
 
-        for (org.uddi.api_v3.BindingTemplate entity : entityList) {
-            validateBindingTemplate(em, entity, null, config);
+                for (org.uddi.api_v3.BusinessService entity : entityList) {
+                        // Entity specific data validation
+                        validateBusinessService(em, entity, null, config);
+                        validateCheckedTModels(entity, config);
+                }
         }
-    }
 
-    public void validateSaveBindingMax(EntityManager em, String serviceKey) throws DispositionReportFaultMessage {
+        public void validateSaveServiceMax(EntityManager em, String businessKey) throws DispositionReportFaultMessage {
 
-        //Obtain the maxSettings for this publisher or get the defaults
-        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-        Integer maxBindings = publisher.getMaxBindingsPerService();
-        try {
-            if (maxBindings == null) {
-                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BINDINGS_PER_SERVICE)) {
-                    maxBindings = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BINDINGS_PER_SERVICE, -1);
-                } else {
-                    maxBindings = -1;
+                //Obtain the maxSettings for this publisher or get the defaults
+                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+                Integer maxServices = publisher.getMaxBusinesses();
+                try {
+                        if (maxServices == null) {
+                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_SERVICES_PER_BUSINESS)) {
+                                        maxServices = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_SERVICES_PER_BUSINESS, -1);
+                                } else {
+                                        maxServices = -1;
+                                }
+                        }
+                } catch (ConfigurationException e) {
+                        log.error(e.getMessage(), e);
+                        maxServices = -1; //incase the configuration isn't available
+                }
+                //if we have the maxServices set for a business then we need to make sure we did not exceed it.
+                if (maxServices > 0) {
+                        //get the businesses owned by this publisher
+                        org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
+                        if (modelBusinessEntity.getBusinessServices() != null && modelBusinessEntity.getBusinessServices().size() > maxServices) {
+                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxServicesExceeded"));
+                        }
                 }
-            }
-        } catch (ConfigurationException e) {
-            log.error(e.getMessage(), e);
-            maxBindings = -1; //incase the config isn't available
-        }
-        //if we have the maxBindings set for a service then we need to make sure we did not exceed it.
-        if (maxBindings > 0) {
-            //get the bindings owned by this service
-            org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
-            if (modelBusinessService.getBindingTemplates() != null && modelBusinessService.getBindingTemplates().size() > maxBindings) {
-                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBindingsExceeded"));
-            }
         }
-    }
 
-    public void validateSaveTModel(EntityManager em, SaveTModel body, Configuration config) throws DispositionReportFaultMessage {
+        public void validateSaveBinding(EntityManager em, SaveBinding body, Configuration config) throws DispositionReportFaultMessage {
 
-        if (config == null) {
-            try {
-                config = AppConfig.getConfiguration();
-            } catch (ConfigurationException ce) {
-                log.error("Could not optain config. " + ce.getMessage(), ce);
-            }
-        }
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
+                if (config == null) {
+                        try {
+                                config = AppConfig.getConfiguration();
+                        } catch (ConfigurationException ce) {
+                                log.error("Could not optain config. " + ce.getMessage(), ce);
+                        }
+                }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-        // No null or empty list
-        List<org.uddi.api_v3.TModel> entityList = body.getTModel();
-        if (entityList == null || entityList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.savetmodel.NoInput"));
-        }
+                // No null or empty list
+                List<org.uddi.api_v3.BindingTemplate> entityList = body.getBindingTemplate();
+                if (entityList == null || entityList.size() == 0) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.savebinding.NoInput"));
+                }
 
-        for (org.uddi.api_v3.TModel entity : entityList) {
-            validateTModel(em, entity, config);
+                for (org.uddi.api_v3.BindingTemplate entity : entityList) {
+                        validateBindingTemplate(em, entity, null, config);
+                        validateCheckedTModels(entity, config);
+                }
         }
-    }
 
-    public void validateSaveTModelMax(EntityManager em) throws DispositionReportFaultMessage {
+        public void validateSaveBindingMax(EntityManager em, String serviceKey) throws DispositionReportFaultMessage {
 
-        //Obtain the maxSettings for this publisher or get the defaults
-        Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
-        Integer maxTModels = publisher.getMaxTmodels();
-        try {
-            if (maxTModels == null) {
-                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER)) {
-                    maxTModels = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER, -1);
-                } else {
-                    maxTModels = -1;
-                }
-            }
-        } catch (ConfigurationException e) {
-            log.error(e.getMessage(), e);
-            maxTModels = -1; //incase the config isn't available
-        }
-        //if we have the TModels set for a publisher then we need to make sure we did not exceed it.
-        if (maxTModels > 0) {
-            //get the tmodels owned by this publisher
-            List<?> tmodelKeysFound = FindTModelByPublisherQuery.select(em, null, publisher, null);
-            if (tmodelKeysFound != null && tmodelKeysFound.size() > maxTModels) {
-                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxTModelsExceeded"));
-            }
-        }
-    }
-
-    public void validateAddPublisherAssertions(EntityManager em, AddPublisherAssertions body) throws DispositionReportFaultMessage {
-
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
-
-        // No null or empty list
-        List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
-        if (entityList == null || entityList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.addpublisherassertions.NoInput"));
-        }
-
-        for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
-            validatePublisherAssertion(em, entity);
-        }
-    }
-
-    public void validateSetPublisherAssertions(EntityManager em, Holder<List<org.uddi.api_v3.PublisherAssertion>> body) throws DispositionReportFaultMessage {
-
-        // No null input
-        if (body == null) {
-            throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
-        }
-
-        // Assertion list can be null or empty - it signifies that publisher is deleting all their assertions
-        List<org.uddi.api_v3.PublisherAssertion> entityList = body.value;
-        if (entityList != null && entityList.size() > 0) {
-
-            for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
-                validatePublisherAssertion(em, entity);
-            }
-        }
-    }
-    
-    void validateNotSigned(org.uddi.api_v3.BusinessEntity item) throws ValueNotAllowedException{
-        if (item==null)
-            return;
-        if (item.getBusinessKey()==null && !item.getSignature().isEmpty())
-            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
-        if (item.getBusinessServices()!=null && !item.getSignature().isEmpty())
-        {
-            for (int i=0; i < item.getBusinessServices().getBusinessService().size(); i++){
-                if (item.getBusinessServices().getBusinessService().get(i).getBusinessKey()==null ||
-                        item.getBusinessServices().getBusinessService().get(i).getBusinessKey().length()==0){
-                    throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service("+i+")/businessKey"));        
-                }
-                if (item.getBusinessServices().getBusinessService().get(i).getServiceKey()==null ||
-                        item.getBusinessServices().getBusinessService().get(i).getServiceKey().length()==0){
-                    throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service("+i+")/serviceKey"));        
-                }
-                if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates()!=null){
-                    for (int k=0; k < item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++){
-                        if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey()==null ||
-                                item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey().length()==0)
-                        {
-                            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service("+i+")/bindingTemplate)"+k+")/bindingKey"));        
+                //Obtain the maxSettings for this publisher or get the defaults
+                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+                Integer maxBindings = publisher.getMaxBindingsPerService();
+                try {
+                        if (maxBindings == null) {
+                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BINDINGS_PER_SERVICE)) {
+                                        maxBindings = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BINDINGS_PER_SERVICE, -1);
+                                } else {
+                                        maxBindings = -1;
+                                }
+                        }
+                } catch (ConfigurationException e) {
+                        log.error(e.getMessage(), e);
+                        maxBindings = -1; //incase the config isn't available
+                }
+                //if we have the maxBindings set for a service then we need to make sure we did not exceed it.
+                if (maxBindings > 0) {
+                        //get the bindings owned by this service
+                        org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
+                        if (modelBusinessService.getBindingTemplates() != null && modelBusinessService.getBindingTemplates().size() > maxBindings) {
+                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBindingsExceeded"));
                         }
-                    }
                 }
-            }
         }
-    }
-    
-    void validateNotSigned(org.uddi.api_v3.BindingTemplate item) throws ValueNotAllowedException{
-        if (item==null)
-            return;
-        if (item.getBindingKey()==null && !item.getSignature().isEmpty())
-            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "bindingKey"));
-        if (item.getServiceKey()==null && !item.getSignature().isEmpty())
-            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
-    }
-    void validateNotSigned(org.uddi.api_v3.TModel item) throws ValueNotAllowedException{
-        if (item==null)
-            return;
-        if (item.getTModelKey()==null && !item.getSignature().isEmpty())
-            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "tModelKey"));
-    }
-    
-    void validateNotSigned(org.uddi.api_v3.BusinessService item) throws ValueNotAllowedException{
-        if (item==null)
-            return;
-        if (item.getBusinessKey()==null && !item.getSignature().isEmpty())
-            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
-        if (item.getServiceKey()==null && !item.getSignature().isEmpty())
-            throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
-        //if i'm signed and a key isn't defined in a bt
-        if (item.getBindingTemplates()!=null && !item.getSignature().isEmpty())
-            for (int i=0; i < item.getBindingTemplates().getBindingTemplate().size(); i++)
-            {
-                if (item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey()==null ||
-                        item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey().length()==0)
-                {
-                    throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessService/bindingTemplate(" + i + ")/bindingKey"));
-                }
-        }
-    }
-
-    public void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity, Configuration config) throws DispositionReportFaultMessage {
-
-        // A supplied businessEntity can't be null
-        if (businessEntity == null) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
-        }
-
-        boolean entityExists = false;
-        validateNotSigned(businessEntity);
-        String entityKey = businessEntity.getBusinessKey();
-        if (entityKey == null || entityKey.length() == 0) {
-            KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-            entityKey = keyGen.generate();
-            businessEntity.setBusinessKey(entityKey);
-        } else {
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            businessEntity.setBusinessKey(entityKey);
-            validateKeyLength(entityKey);
-            Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
-            if (obj != null) {
-                entityExists = true;
-
-                // Make sure publisher owns this entity.
-                if (!publisher.isOwner((UddiEntity) obj)) {
-                    throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                }
-            } else {
-                // Inside this block, we have a key proposed by the publisher on a new entity
-
-                // Validate key and then check to see that the proposed key is valid for this publisher
-                ValidateUDDIKey.validateUDDIv3Key(entityKey);
-                if (!publisher.isValidPublisherKey(em, entityKey)) {
-                    throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
-                }
-
-            }
-        }
-
-        if (!entityExists) {
-            // Check to make sure key isn't used by another entity.
-            if (!isUniqueKey(em, entityKey)) {
-                throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
-            }
-        }
-
-        // was TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
-        //covered by ref integrity checks
-
-        validateNames(businessEntity.getName());
-        validateDiscoveryUrls(businessEntity.getDiscoveryURLs());
-        validateContacts(businessEntity.getContacts(), config);
-        validateCategoryBag(businessEntity.getCategoryBag(), config,false);
-        validateIdentifierBag(businessEntity.getIdentifierBag(), config,false);
-        validateDescriptions(businessEntity.getDescription());
-        validateBusinessServices(em, businessEntity.getBusinessServices(), businessEntity, config);
-
-    }
-
-    public void validateBusinessServices(EntityManager em, org.uddi.api_v3.BusinessServices businessServices, org.uddi.api_v3.BusinessEntity parent, Configuration config)
-            throws DispositionReportFaultMessage {
-        // Business services is optional
-        if (businessServices == null) {
-            return;
-        }
-        List<org.uddi.api_v3.BusinessService> businessServiceList = businessServices.getBusinessService();
-        if (businessServiceList == null || businessServiceList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.businessservices.NoInput"));
-        }
-
-        for (org.uddi.api_v3.BusinessService businessService : businessServiceList) {
-            validateBusinessService(em, businessService, parent, config);
-        }
-
-    }
-
-    public void validateBusinessService(EntityManager em, org.uddi.api_v3.BusinessService businessService, org.uddi.api_v3.BusinessEntity parent, Configuration config)
-            throws DispositionReportFaultMessage {
-
-        // A supplied businessService can't be null
-        if (businessService == null) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
-        }
-
-        validateNotSigned(businessService);
-        // Retrieve the service's passed key
-        String entityKey = businessService.getServiceKey();
-        if (entityKey != null && entityKey.length() > 0) {
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            validateKeyLength(entityKey);
-            businessService.setServiceKey(entityKey);
-        }
-
-        // The parent key is either supplied or provided by the higher call to the parent entity save.  If the passed-in parent's business key differs from 
-        // the (non-null) business key retrieved from the service, then we have a possible service projection.
-        String parentKey = businessService.getBusinessKey();
-        if (parentKey != null && parentKey.length() > 0) {
-            // Per section 4.4: keys must be case-folded
-            parentKey = parentKey.toLowerCase();
-            businessService.setBusinessKey(parentKey);
-        }
-
-        boolean isProjection = false;
-        if (parent != null) {
-            if (parentKey != null && parentKey.length() > 0) {
-                if (!parentKey.equalsIgnoreCase(parent.getBusinessKey())) {
-                    // Possible projected service - if we have differing parent businesses but a service key was not provided, this is an error as it is not possible 
-                    // for the business that doesn't "own" the service to generate the key for it.
-                    if (entityKey == null || entityKey.length() == 0) {
-                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceKeyNotProvidedWithProjection", parentKey + ", " + parent.getBusinessKey()));
-                    }
-
-                    isProjection = true;
-                }
-            } else {
-                parentKey = parent.getBusinessKey();
-            }
-        }
-
-        // Projections don't require as rigorous testing as only the projected service's business key and service key are examined for validity.
-        if (isProjection) {
-
-         
-            Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
-            // Can't project a service that doesn't exist!
-            if (obj == null) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ProjectedServiceNotFound", parentKey + ", " + entityKey));
-            } else {
-                // If the supplied business key doesn't match the existing service's business key, the projection is invalid.
-                org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
-                if (!businessService.getBusinessKey().equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
-                    throw new InvalidProjectionException(new ErrorMessage("errors.invalidprojection.ParentMismatch", businessService.getBusinessKey() + ", " + bs.getBusinessEntity().getEntityKey()));
-                }
-            }
-            obj = null;
-        } else {
-            boolean entityExists = false;
-            if (entityKey == null || entityKey.length() == 0) {
-                KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-                entityKey = keyGen.generate();
-                businessService.setServiceKey(entityKey);
-            } else {
-
-                Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
-                if (obj != null) {
-                    entityExists = true;
-
-                    org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
-
-                    // If the object exists, and the parentKey was not found to this point, then a save on an existing service with a blank
-                    // business key has occurred.  It is set here and added to the entity being saved - a necessary step for the object to be
-                    // persisted properly. (This condition makes some validation tests below unnecessary as the parent is "verified" but it's OK to
-                    // still run them).
-                    if (parentKey == null || parentKey.length() == 0) {
-                        parentKey = bs.getBusinessEntity().getEntityKey();
-                        businessService.setBusinessKey(parentKey);
-                    }
 
-                    // Make sure publisher owns this entity.
-                    if (!publisher.isOwner((UddiEntity) obj)) {
-                        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                    }
-
-                    // If existing service trying to be saved has a different parent key, then we have a problem
-                    if (!parentKey.equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
-                        // if both businesses are owned by this publisher then we allow it.
-                        // we already check the current business is owned, lets see if the old one is too
-                        if (!publisher.isOwner(bs.getBusinessEntity())) {
-                            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.businessservice.ParentMismatch", parentKey + ", " + bs.getBusinessEntity().getEntityKey()));
-                        } else {
-                            if (log.isDebugEnabled()) {
-                                log.debug("Services moved from business " + bs.getBusinessEntity() + " to " + businessService.getBusinessKey());
-                            }
-                        }
-                    }
+        public void validateSaveTModel(EntityManager em, SaveTModel body, Configuration config) throws DispositionReportFaultMessage {
 
-                } else {
-                    // Inside this block, we have a key proposed by the publisher on a new entity
+                if (config == null) {
+                        try {
+                                config = AppConfig.getConfiguration();
+                        } catch (ConfigurationException ce) {
+                                log.error("Could not optain config. " + ce.getMessage(), ce);
+                        }
+                }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-                    // Validate key and then check to see that the proposed key is valid for this publisher
-                    ValidateUDDIKey.validateUDDIv3Key(entityKey);
-                    if (!publisher.isValidPublisherKey(em, entityKey)) {
-                        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
-                    }
+                // No null or empty list
+                List<org.uddi.api_v3.TModel> entityList = body.getTModel();
+                if (entityList == null || entityList.size() == 0) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.savetmodel.NoInput"));
+                }
 
+                for (org.uddi.api_v3.TModel entity : entityList) {
+                        validateTModel(em, entity, config);
+                        validateCheckedTModels(entity, config);
                 }
+        }
 
-            }
+        public void validateSaveTModelMax(EntityManager em) throws DispositionReportFaultMessage {
 
-            // Parent key must be passed if this is a new entity
-            if (!entityExists) {
-                if (parentKey == null || parentKey.length() == 0) {
-                    throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
+                //Obtain the maxSettings for this publisher or get the defaults
+                Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName());
+                Integer maxTModels = publisher.getMaxTmodels();
+                try {
+                        if (maxTModels == null) {
+                                if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER)) {
+                                        maxTModels = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER, -1);
+                                } else {
+                                        maxTModels = -1;
+                                }
+                        }
+                } catch (ConfigurationException e) {
+                        log.error(e.getMessage(), e);
+                        maxTModels = -1; //incase the config isn't available
+                }
+                //if we have the TModels set for a publisher then we need to make sure we did not exceed it.
+                if (maxTModels > 0) {
+                        //get the tmodels owned by this publisher
+                        List<?> tmodelKeysFound = FindTModelByPublisherQuery.select(em, null, publisher, null);
+                        if (tmodelKeysFound != null && tmodelKeysFound.size() > maxTModels) {
+                                throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxTModelsExceeded"));
+                        }
                 }
-            }
+        }
 
-            // If parent key IS passed, whether new entity or not, it must be valid.  Additionally, the current publisher must be the owner of the parent.  Note that
-            // if a parent ENTITY was passed in, then we don't need to check for any of this since this is part of a higher call.
-            if (parentKey != null) {
-                if (parent == null) {
-                    Object parentTemp = em.find(org.apache.juddi.model.BusinessEntity.class, parentKey);
-                    if (parentTemp == null) {
-                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
-                    }
+        public void validateAddPublisherAssertions(EntityManager em, AddPublisherAssertions body) throws DispositionReportFaultMessage {
 
-                    // Make sure publisher owns this parent entity.
-                    if (!publisher.isOwner((UddiEntity) parentTemp)) {
-                        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwnerParent", parentKey));
-                    }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
                 }
-            }
 
-            if (!entityExists) {
-                // Check to make sure key isn't used by another entity.
-                if (!isUniqueKey(em, entityKey)) {
-                    throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
+                // No null or empty list
+                List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
+                if (entityList == null || entityList.size() == 0) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.addpublisherassertions.NoInput"));
                 }
-            }
 
-            // TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
-
-            validateNames(businessService.getName());
-            validateCategoryBag(businessService.getCategoryBag(), config,false);
-            validateDescriptions(businessService.getDescription());
-            validateBindingTemplates(em, businessService.getBindingTemplates(), businessService, config);
+                for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+                        validatePublisherAssertion(em, entity);
+                }
         }
 
-    }
+        public void validateSetPublisherAssertions(EntityManager em, Holder<List<org.uddi.api_v3.PublisherAssertion>> body) throws DispositionReportFaultMessage {
 
-    public void validateBindingTemplates(EntityManager em, org.uddi.api_v3.BindingTemplates bindingTemplates, org.uddi.api_v3.BusinessService parent, Configuration config)
-            throws DispositionReportFaultMessage {
-        // Binding templates is optional
-        if (bindingTemplates == null) {
-            return;
-        }
+                // No null input
+                if (body == null) {
+                        throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+                }
 
-        List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
-        if (bindingTemplateList == null || bindingTemplateList.size() == 0) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplates.NoInput"));
-        }
+                // Assertion list can be null or empty - it signifies that publisher is deleting all their assertions
+                List<org.uddi.api_v3.PublisherAssertion> entityList = body.value;
+                if (entityList != null && entityList.size() > 0) {
 
-        for (org.uddi.api_v3.BindingTemplate bindingTemplate : bindingTemplateList) {
-            validateBindingTemplate(em, bindingTemplate, parent, config);
+                        for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
+                                validatePublisherAssertion(em, entity);
+                        }
+                }
         }
 
-    }
-
-    public void validateBindingTemplate(EntityManager em, org.uddi.api_v3.BindingTemplate bindingTemplate,
-            org.uddi.api_v3.BusinessService parent, Configuration config)
-            throws DispositionReportFaultMessage {
-
-        // A supplied bindingTemplate can't be null
-        if (bindingTemplate == null) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NullInput"));
+        void validateNotSigned(org.uddi.api_v3.BusinessEntity item) throws ValueNotAllowedException {
+                if (item == null) {
+                        return;
+                }
+                if (item.getBusinessKey() == null && !item.getSignature().isEmpty()) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
+                }
+                if (item.getBusinessServices() != null && !item.getSignature().isEmpty()) {
+                        for (int i = 0; i < item.getBusinessServices().getBusinessService().size(); i++) {
+                                if (item.getBusinessServices().getBusinessService().get(i).getBusinessKey() == null
+                                        || item.getBusinessServices().getBusinessService().get(i).getBusinessKey().length() == 0) {
+                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service(" + i + ")/businessKey"));
+                                }
+                                if (item.getBusinessServices().getBusinessService().get(i).getServiceKey() == null
+                                        || item.getBusinessServices().getBusinessService().get(i).getServiceKey().length() == 0) {
+                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service(" + i + ")/serviceKey"));
+                                }
+                                if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates() != null) {
+                                        for (int k = 0; k < item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().size(); k++) {
+                                                if (item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey() == null
+                                                        || item.getBusinessServices().getBusinessService().get(i).getBindingTemplates().getBindingTemplate().get(k).getBindingKey().length() == 0) {
+                                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "business/Service(" + i + ")/bindingTemplate)" + k + ")/bindingKey"));
+                                                }
+                                        }
+                                }
+                        }
+                }
         }
 
-        // Retrieve the binding's passed key
-        String entityKey = bindingTemplate.getBindingKey();
-        if (entityKey != null && entityKey.length() > 0) {
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            bindingTemplate.setBindingKey(entityKey);
-            validateKeyLength(entityKey);
+        void validateNotSigned(org.uddi.api_v3.BindingTemplate item) throws ValueNotAllowedException {
+                if (item == null) {
+                        return;
+                }
+                if (item.getBindingKey() == null && !item.getSignature().isEmpty()) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "bindingKey"));
+                }
+                if (item.getServiceKey() == null && !item.getSignature().isEmpty()) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
+                }
         }
 
-        // The parent key is either supplied or provided by the higher call to the parent entity save.  If it is provided in both instances, if they differ, an 
-        // error occurs.
-        String parentKey = bindingTemplate.getServiceKey();
-        if (parentKey != null && parentKey.length() > 0) {
-            // Per section 4.4: keys must be case-folded
-            parentKey = parentKey.toLowerCase();
-            bindingTemplate.setServiceKey(parentKey);
+        void validateNotSigned(org.uddi.api_v3.TModel item) throws ValueNotAllowedException {
+                if (item == null) {
+                        return;
+                }
+                if (item.getTModelKey() == null && !item.getSignature().isEmpty()) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "tModelKey"));
+                }
         }
 
-        if (parent != null) {
-            if (parentKey != null && parentKey.length() > 0) {
-                if (!parentKey.equalsIgnoreCase(parent.getServiceKey())) {
-                    throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.bindingtemplate.ParentMismatch", parentKey + ", " + parent.getBusinessKey()));
+        void validateNotSigned(org.uddi.api_v3.BusinessService item) throws ValueNotAllowedException {
+                if (item == null) {
+                        return;
+                }
+                if (item.getBusinessKey() == null && !item.getSignature().isEmpty()) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessKey"));
+                }
+                if (item.getServiceKey() == null && !item.getSignature().isEmpty()) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "serviceKey"));
+                }
+                //if i'm signed and a key isn't defined in a bt
+                if (item.getBindingTemplates() != null && !item.getSignature().isEmpty()) {
+                        for (int i = 0; i < item.getBindingTemplates().getBindingTemplate().size(); i++) {
+                                if (item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey() == null
+                                        || item.getBindingTemplates().getBindingTemplate().get(i).getBindingKey().length() == 0) {
+                                        throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "businessService/bindingTemplate(" + i + ")/bindingKey"));
+                                }
+                        }
                 }
-            } else {
-                parentKey = parent.getServiceKey();
-            }
         }
 
-        boolean entityExists = false;
-        if (entityKey == null || entityKey.length() == 0) {
-            validateNotSigned(bindingTemplate);
-            KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-            entityKey = keyGen.generate();
-            bindingTemplate.setBindingKey(entityKey);
-        } else {
-
-            Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
-            if (obj != null) {
-                entityExists = true;
+        public void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity, Configuration config) throws DispositionReportFaultMessage {
 
-                org.apache.juddi.model.BindingTemplate bt = (org.apache.juddi.model.BindingTemplate) obj;
-
-                // If the object exists, and the parentKey was not found to this point, then a save on an existing binding with a blank
-                // service key has occurred.  It is set here and added to the entity being saved - a necessary step for the object to be
-                // persisted properly. (This condition makes some validation tests below unnecessary as the parent is "verified" but it's OK to
-                // still run them).
-                if (parentKey == null || parentKey.length() == 0) {
-                    parentKey = bt.getBusinessService().getEntityKey();
-                    bindingTemplate.setServiceKey(parentKey);
+                // A supplied businessEntity can't be null
+                if (businessEntity == null) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
                 }
 
-                // If existing binding trying to be saved has a different parent key, then we have a problem
-                // TODO: moving bindings is allowed according to spec?
-                if (!parentKey.equalsIgnoreCase(bt.getBusinessService().getEntityKey())) {
-                    throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.bindingtemplate.ParentMismatch", parentKey + ", " + bt.getBusinessService().getEntityKey()));
-                }
+                boolean entityExists = false;
+                validateNotSigned(businessEntity);
+                String entityKey = businessEntity.getBusinessKey();
+                if (entityKey == null || entityKey.length() == 0) {
+                        KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
+                        entityKey = keyGen.generate();
+                        businessEntity.setBusinessKey(entityKey);
+                } else {
+                        // Per section 4.4: keys must be case-folded
+                        entityKey = entityKey.toLowerCase();
+                        businessEntity.setBusinessKey(entityKey);
+                        validateKeyLength(entityKey);
+                        Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
+                        if (obj != null) {
+                                entityExists = true;
+
+                                // Make sure publisher owns this entity.
+                                if (!publisher.isOwner((UddiEntity) obj)) {
+                                        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
+                                }
+                        } else {
+                                // Inside this block, we have a key proposed by the publisher on a new entity
 
-                // Make sure publisher owns this entity.
-                if (!publisher.isOwner((UddiEntity) obj)) {
-                    throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                }
+                                // Validate key and then check to see that the proposed key is valid for this publisher
+                                ValidateUDDIKey.validateUDDIv3Key(entityKey);
+                                if (!publisher.isValidPublisherKey(em, entityKey)) {
+                                        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+                                }
 
-            } else {
-                // Inside this block, we have a key proposed by the publisher on a new entity
+                        }
+                }
 
-                // Validate key and then check to see that the proposed key is valid for this publisher
-                ValidateUDDIKey.validateUDDIv3Key(entityKey);
-                if (!publisher.isValidPublisherKey(em, entityKey)) {
-                    throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
+                if (!entityExists) {
+                        // Check to make sure key isn't used by another entity.
+                        if (!isUniqueKey(em, entityKey)) {
+                                throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
+                        }
                 }
 
-            }
+                // was TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
+                //covered by ref integrity checks
 
-        }
+                validateNames(businessEntity.getName());
+                validateDiscoveryUrls(businessEntity.getDiscoveryURLs());
+                validateContacts(businessEntity.getContacts(), config);
+                validateCategoryBag(businessEntity.getCategoryBag(), config, false);
+                validateIdentifierBag(businessEntity.getIdentifierBag(), config, false);
+                validateDescriptions(businessEntity.getDescription());
+                validateBusinessServices(em, businessEntity.getBusinessServices(), businessEntity, config);
 
-        // Parent key must be passed if this is a new entity
-        if (!entityExists) {
-            if (parentKey == null || parentKey.length() == 0) {
-                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentServiceNotFound", parentKey));
-            }
         }
 
-        // If parent key IS passed, whether new entity or not, it must be valid.  Additionally, the current publisher must be the owner of the parent.  Note that
-        // if a parent ENTITY was passed in, then we don't need to check for any of this since this is part of a higher call.
-        if (parentKey != null) {
-            if (parent == null) {
-                Object parentTemp = em.find(org.apache.juddi.model.BusinessService.class, parentKey);
-                if (parentTemp == null) {
-                    throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
+        public void validateBusinessServices(EntityManager em, org.uddi.api_v3.BusinessServices businessServices, org.uddi.api_v3.BusinessEntity parent, Configuration config)
+                throws DispositionReportFaultMessage {
+                // Business services is optional
+                if (businessServices == null) {
+                        return;
+                }
+                List<org.uddi.api_v3.BusinessService> businessServiceList = businessServices.getBusinessService();
+                if (businessServiceList == null || businessServiceList.size() == 0) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.businessservices.NoInput"));
                 }
 
-                // Make sure publisher owns this parent entity.
-                if (!publisher.isOwner((UddiEntity) parentTemp)) {
-                    throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwnerParent", parentKey));
+                for (org.uddi.api_v3.BusinessService businessService : businessServiceList) {
+                        validateBusinessService(em, businessService, parent, config);
                 }
 
-            }
         }
 
-        if (!entityExists) {
-            // Check to make sure key isn't used by another entity.
-            if (!isUniqueKey(em, entityKey)) {
-                throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
-            }
-        }
+        public void validateBusinessService(EntityManager em, org.uddi.api_v3.BusinessService businessService, org.uddi.api_v3.BusinessEntity parent, Configuration config)
+                throws DispositionReportFaultMessage {
 
-        //was TODO validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
+                // A supplied businessService can't be null
+                if (businessService == null) {
+                        throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
+                }
 
-        //at least one must be defined
-        if (bindingTemplate.getAccessPoint() == null && bindingTemplate.getHostingRedirector() == null) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NoAccessPoint"));
-        }
-        //but not both
-        if (bindingTemplate.getAccessPoint() != null && bindingTemplate.getHostingRedirector() != null) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NoAccessPoint"));
-        }
-        validateCategoryBag(bindingTemplate.getCategoryBag(), config,false);
-        validateTModelInstanceDetails(bindingTemplate.getTModelInstanceDetails(), config,false);
-        validateAccessPoint(em, bindingTemplate.getAccessPoint(), config);
-        validateDescriptions(bindingTemplate.getDescription());
-        validateHostingRedirector(em, bindingTemplate.getHostingRedirector(), config);
+                validateNotSigned(businessService);
+                // Retrieve the service's passed key
+                String entityKey = businessService.getServiceKey();
+                if (entityKey != null && entityKey.length() > 0) {
+                        // Per section 4.4: keys must be case-folded
+                        entityKey = entityKey.toLowerCase();
+                        validateKeyLength(entityKey);
+                        businessService.setServiceKey(entityKey);
+                }
 
-    }
+                // The parent key is either supplied or provided by the higher call to the parent entity save.  If the passed-in parent's business key differs from 
+                // the (non-null) business key retrieved from the service, then we have a possible service projection.
+                String parentKey = businessService.getBusinessKey();
+                if (parentKey != null && parentKey.length() > 0) {
+                        // Per section 4.4: keys must be case-folded
+                        parentKey = parentKey.toLowerCase();
+                        businessService.setBusinessKey(parentKey);
+                }
 
-    public void validateTModel(EntityManager em, org.uddi.api_v3.TModel tModel, Configuration config) throws DispositionReportFaultMessage {
-        // A supplied tModel can't be null
-        if (tModel == null) {
-            throw new ValueNotAllowedException(new ErrorMessage("errors.tmodel.NullInput"));
-        }
+                boolean isProjection = false;
+                if (parent != null) {
+                        if (parentKey != null && parentKey.length() > 0) {
+                                if (!parentKey.equalsIgnoreCase(parent.getBusinessKey())) {
+                                        // Possible projected service - if we have differing parent businesses but a service key was not provided, this is an error as it is not possible 
+                                        // for the business that doesn't "own" the service to generate the key for it.
+                                        if (entityKey == null || entityKey.length() == 0) {
+                                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceKeyNotProvidedWithProjection", parentKey + ", " + parent.getBusinessKey()));
+                                        }
 
-        boolean entityExists = false;
-        String entityKey = tModel.getTModelKey();
-        if (entityKey == null || entityKey.length() == 0) {
-            KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
-            entityKey = keyGen.generate();
-            validateNotSigned(tModel);
-            tModel.setTModelKey(entityKey);
-        } else {
-            // Per section 4.4: keys must be case-folded
-            entityKey = entityKey.toLowerCase();
-            tModel.setTModelKey(entityKey);
+                                        isProjection = true;
+                                }
+                        } else {
+                                parentKey = parent.getBusinessKey();
+                        }
+                }
 
-            Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
-            if (obj != null) {
-                entityExists = true;
+                // Projections don't require as rigorous testing as only the projected service's business key and service key are examined for validity.
+                if (isProjection) {
 
-                // Make sure publisher owns this entity.
-                if (!publisher.isOwner((UddiEntity) obj)) {
-                    throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
-                }
-            } else {
-                // Inside this block, we have a key proposed by the publisher on a new entity
 
-                // First test to see if this is a Key Generator tModel. The keyGenerator suffix appearing in the key is the indicator, since this is not
-                // allowed *unless* it's a key generator.
-                if (entityKey.toUpperCase().contains(KeyGenerator.KEYGENERATOR_SUFFIX.toUpperCase())) {
-                    ValidateUDDIKey.validateUDDIv3KeyGeneratorTModel(tModel);
+                        Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+                        // Can't project a service that doesn't exist!
+                        if (obj == null) {
+                                throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ProjectedServiceNotFound", parentKey + ", " + entityKey));
+                        } else {
+                                // If the supplied business key doesn't match the existing service's business key, the projection is invalid.
+                                org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService) obj;
+                                if (!businessService.getBusinessKey().equalsIgnoreCase(bs.getBusinessEntity().getEntityKey())) {
+                                        throw new InvalidProjectionException(new ErrorMessage("errors.invalidprojection.ParentMismatch", businessService.getBusinessKey() + ", " + bs.getBusinessEntity().getEntityKey()));
+                                }
+                        }
+                        obj = null;
+                } else {
+                        boolean entityExists = false;
+                        if (entityKey == null || entityKey.length() == 0) {
+                                KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
+                                entityKey = keyGen.generate();
+                                businessService.setServiceKey(entityKey);
+                        } else {
 
-                    // The root publisher is only allowed one key generator.  This is published in the installation.
-                    String rootPublisherStr = "root";
-                    try {
-                        rootPublisherStr = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PUBLISHER);
-                    } catch (ConfigurationException ce) {
-                        log.error("Could not read the root publisher setting in the configuration.");
-                    }
-                    if (publisher.getAuthorizedName().equals(rootPublisherStr)) {
-                        throw new FatalErrorException(new ErrorMessage("errors.tmodel.keygenerator.RootKeyGen"));
-                    }
+                                Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
+                                if (obj != null) {
+                                        entityExists = true;
+

[... 2162 lines stripped ...]


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


Mime
View raw message