Package org.apache.juddi.v3.error

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


        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"));
   
    for (org.uddi.api_v3.BusinessService entity : entityList) {
      // Entity specific data validation
      validateBusinessService(em, entity, null, config);
    }
View Full Code Here


        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"));
   
    for (org.uddi.api_v3.BindingTemplate entity : entityList) {
      validateBindingTemplate(em, entity, null, config);
    }
  }
View Full Code Here

        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"));
   
    for (org.uddi.api_v3.TModel entity : entityList) {
      validateTModel(em, entity, config);
    }
  }
View Full Code Here

  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);
    }
  }
View Full Code Here

 
  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) {
   
View Full Code Here

 
  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;
    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);
     
      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));
    }
   
    // TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
   
    validateNames(businessEntity.getName());
View Full Code Here

    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);
    }
     
View Full Code Here

  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"));
   
    // 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();
      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);
          }
         
          // If existing service trying to be saved has a different parent key, then we have a problem
          // TODO: moving services is allowed according to spec?
          if (!parentKey.equalsIgnoreCase(bs.getBusinessEntity().getEntityKey()))
            throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.businessservice.ParentMismatch", parentKey + ", " + bs.getBusinessEntity().getEntityKey()));
         
          // 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));

        }
       
      }
     
      // 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));
      }

      // 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));

          // Make sure publisher owns this parent entity.
          if (!publisher.isOwner((UddiEntity)parentTemp))
            throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwnerParent", parentKey));
        }
      }

      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
     
      validateNames(businessService.getName());
View Full Code Here

    if (bindingTemplates == null)
      return;
 
    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) {
      validateBindingTemplate(em, bindingTemplate, parent, config);
    }
 
View Full Code Here

      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"));

    // 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);
    }

    // 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);
    }
   
    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()));
      }
      else
        parentKey = parent.getServiceKey();
    }
   
    boolean entityExists = false;
    if (entityKey == null || entityKey.length() == 0) {
      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;

        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);
        }
       
        // 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()));
       
        // 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));

      }
     
    }
   
    // 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));

        // Make sure publisher owns this parent entity.
        if (!publisher.isOwner((UddiEntity)parentTemp))
          throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwnerParent", parentKey));

      }
    }

    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 (bindingTemplate.getAccessPoint() == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplate.NoAccessPoint"));
   
    validateCategoryBag(bindingTemplate.getCategoryBag(), config);
    validateTModelInstanceDetails(bindingTemplate.getTModelInstanceDetails());
   
   
View Full Code Here

TOP

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

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.