Package org.apache.juddi.v3.error

Examples of org.apache.juddi.v3.error.ValueNotAllowedException


      String rootPartition, Configuration config)
  throws DispositionReportFaultMessage {

    // A supplied businessService can't be null
    if (businessEntity == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
   
    // The business key should already be set to the previously calculated and validated nodeId.  This validation is unnecessary but kept for
    // symmetry with the other entity validations.
    String entityKey = businessEntity.getBusinessKey();
    if (entityKey == null || entityKey.length() == 0) {
      entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
      businessEntity.setBusinessKey(entityKey);
    }
    else {
      ValidateUDDIKey.validateUDDIv3Key(entityKey);
      String keyPartition = entityKey.substring(0, entityKey.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
      if (!rootPartition.equalsIgnoreCase(keyPartition))
        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
    }

    ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
   
    validatePublish.validateNames(businessEntity.getName());
    validatePublish.validateDiscoveryUrls(businessEntity.getDiscoveryURLs());
    validatePublish.validateContacts(businessEntity.getContacts());
    validatePublish.validateCategoryBag(businessEntity.getCategoryBag(),config);
    validatePublish.validateIdentifierBag(businessEntity.getIdentifierBag(),config);

    org.uddi.api_v3.BusinessServices businessServices = businessEntity.getBusinessServices();
    if (businessServices != null) {
      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) {
        validateRootBusinessService(businessService, businessEntity, rootPublisher, rootPartition, config);
      }
    }
View Full Code Here


      UddiEntityPublisher rootPublisher, String rootPartition, Configuration config)
  throws DispositionReportFaultMessage {

    // A supplied businessService can't be null
    if (businessService == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
 
    // A business key doesn't have to be provided, but if it is, it should match the parent business's key
    String parentKey = businessService.getBusinessKey();
    if (parentKey != null && parentKey.length()> 0) {
      if (!parentKey.equalsIgnoreCase(parent.getBusinessKey()))
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
    }
   
    // Retrieve the service's passed key
    String entityKey = businessService.getServiceKey();
    if (entityKey == null || entityKey.length() == 0) {
      entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
      businessService.setServiceKey(entityKey);
    }
    else {
      ValidateUDDIKey.validateUDDIv3Key(entityKey);
      String keyPartition = entityKey.substring(0, entityKey.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
      if (!rootPartition.equalsIgnoreCase(keyPartition))
        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
    }
   
    ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
   
    validatePublish.validateNames(businessService.getName());
    validatePublish.validateCategoryBag(businessService.getCategoryBag(), config);

    org.uddi.api_v3.BindingTemplates bindingTemplates = businessService.getBindingTemplates();
    if (bindingTemplates != null) {
      List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
      if (bindingTemplateList == null || bindingTemplateList.size() == 0)
        throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplates.NoInput"));
     
      for (org.uddi.api_v3.BindingTemplate bindingTemplate : bindingTemplateList) {
        validateRootBindingTemplate(bindingTemplate, businessService, rootPublisher, rootPartition, config);
      }
    }
View Full Code Here

      UddiEntityPublisher rootPublisher, String rootPartition, Configuration config)
  throws DispositionReportFaultMessage {

    // A supplied businessService can't be null
    if (bindingTemplate == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NullInput"));
 
    // A service key doesn't have to be provided, but if it is, it should match the parent service's key
    String parentKey = bindingTemplate.getServiceKey();
    if (parentKey != null && parentKey.length()> 0) {
      if (!parentKey.equalsIgnoreCase(parent.getServiceKey()))
View Full Code Here

  }

  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 entityExists = false;
    String entityKey = tModel.getTModelKey();
    if (entityKey == null || entityKey.length() == 0) {
      KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
      entityKey = keyGen.generate();
      tModel.setTModelKey(entityKey);
    }
    else {
      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      tModel.setTModelKey(entityKey);
     
      Object obj = em.find(org.apache.juddi.model.Tmodel.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
       
        // 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);
         
          // 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"));
         
          // It's a valid Key Generator, but is it available for this publisher?
          if (!publisher.isKeyGeneratorAvailable(em, entityKey))
            throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
       
        }
        else {
          // If not a key generator, then simply 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));
    }
   
    // TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
   
    if (tModel.getName() == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.tmodel.NoName"));
   
    validateCategoryBag(tModel.getCategoryBag(), config);
    validateIdentifierBag(tModel.getIdentifierBag(), config);

    List<org.uddi.api_v3.OverviewDoc> overviewDocList = tModel.getOverviewDoc();
View Full Code Here

  }
 
  public void validatePublisherAssertion(EntityManager em, org.uddi.api_v3.PublisherAssertion pubAssertion) throws DispositionReportFaultMessage {
    // A supplied publisher assertion can't be null
    if (pubAssertion == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.NullInput"));
   
    // The keyedRef must not be blank and every field must contain data.
    org.uddi.api_v3.KeyedReference keyedRef = pubAssertion.getKeyedReference();
    if (keyedRef == null ||
      keyedRef.getTModelKey() == null || keyedRef.getTModelKey().length() == 0 ||
      keyedRef.getKeyName() == null || keyedRef.getKeyName().length() == 0 ||
      keyedRef.getKeyValue() == null || keyedRef.getKeyValue().length() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.BlankKeyedRef"));
   
    String fromKey = pubAssertion.getFromKey();
    if (fromKey == null || fromKey.length() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.BlankFromKey"));

    String toKey = pubAssertion.getToKey();
    if (toKey == null || toKey.length() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.BlankToKey"));
   
    if (fromKey.equalsIgnoreCase(toKey))
      throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.SameBusinessKey"));
   
    Object fromObj = em.find(org.apache.juddi.model.BusinessEntity.class, fromKey);
    if (fromObj == null)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", fromKey));
View Full Code Here

  }
 
  public void validateNames(List<org.uddi.api_v3.Name> names) throws DispositionReportFaultMessage {
    // At least one name is required
    if (names == null || names.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoInput"));
   
    for (Name n : names) {
      if (n.getValue() == null || n.getValue().length() == 0)
        throw new ValueNotAllowedException(new ErrorMessage("errors.names.NoValue"));
    }
   
  }
View Full Code Here

      return;
   
    // If contacts do exist, at least one contact is required
    List<org.uddi.api_v3.Contact> contactList = contacts.getContact();
    if (contactList == null || contactList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.contacts.NoInput"));
   
    for (org.uddi.api_v3.Contact contact : contactList) {
      validateContact(contact);
    }
   
View Full Code Here

  }

  public void validateContact(org.uddi.api_v3.Contact contact) throws DispositionReportFaultMessage {
    // A supplied contact can't be null
    if (contact == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.contact.NullInput"));
   
    // At least one personName is required
    List<org.uddi.api_v3.PersonName> pnameList = contact.getPersonName();
    if (pnameList == null || pnameList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.contact.NoPersonName"));
   
    List<org.uddi.api_v3.Address> addressList = contact.getAddress();
    if (addressList != null) {
      for (org.uddi.api_v3.Address address : addressList) {
        if (address != null) {
          if (address.getAddressLine() == null || address.getAddressLine().size() == 0)
            throw new ValueNotAllowedException(new ErrorMessage("errors.contact.NoAddressLine"));
        }
      }
    }
  }
View Full Code Here

      return;

    // If discUrls does exist, it must have at least one element
    List<org.uddi.api_v3.DiscoveryURL> discUrlList = discUrls.getDiscoveryURL();
    if (discUrlList == null || discUrlList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.discurls.NoInput"));
 
View Full Code Here

   
    // If category bag does exist, it must have at least one element
    List<KeyedReference> elems = categories.getKeyedReference();
    List<KeyedReferenceGroup> groups = categories.getKeyedReferenceGroup();
    if (groups.size() == 0 && elems.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.categorybag.NoInput"));
   
    for (Object elem : elems) {
      if (elem instanceof org.uddi.api_v3.KeyedReference) {
        validateKeyedReference((KeyedReference) elem, config);
      }
View Full Code Here

TOP

Related Classes of org.apache.juddi.v3.error.ValueNotAllowedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.