Package org.apache.juddi.v3.error

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


      List<String> businessKeyList = body.getBusinessKey();
      for (String businessKey : businessKeyList) {
       
        org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
        if (modelBusinessEntity == null)
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey));
       
        org.uddi.api_v3.BusinessEntity apiBusinessEntity = new org.uddi.api_v3.BusinessEntity();
       
        MappingModelToApi.mapBusinessEntity(modelBusinessEntity, apiBusinessEntity);
       
View Full Code Here


      List<String> entityKeyList = body.getEntityKey();
      for (String entityKey : entityKeyList) {
       
        org.apache.juddi.model.UddiEntity modelUddiEntity = em.find(org.apache.juddi.model.UddiEntity.class, entityKey);
        if (modelUddiEntity == null)
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.EntityNotFound", entityKey));
       
        org.uddi.api_v3.OperationalInfo apiOperationalInfo = new org.uddi.api_v3.OperationalInfo();
       
        MappingModelToApi.mapOperationalInfo(modelUddiEntity, apiOperationalInfo);
       
View Full Code Here

      List<String> serviceKeyList = body.getServiceKey();
      for (String serviceKey : serviceKeyList) {
       
        org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
        if (modelBusinessService == null)
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey));
       
        org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService();
       
        MappingModelToApi.mapBusinessService(modelBusinessService, apiBusinessService);
       
View Full Code Here

      List<String> tmodelKeyList = body.getTModelKey();
      for (String tmodelKey : tmodelKeyList) {
       
        org.apache.juddi.model.Tmodel modelTModel = em.find(org.apache.juddi.model.Tmodel.class, tmodelKey);
        if (modelTModel == null) {
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", tmodelKey));
        }
       
        org.uddi.api_v3.TModel apiTModel = new org.uddi.api_v3.TModel();
       
        MappingModelToApi.mapTModel(modelTModel, apiTModel);
View Full Code Here

        this.getEntityPublisher(em, body.getAuthInfo());
        String subscriptionKey = body.getSubscriptionResultsList().getSubscription().getSubscriptionKey();
        org.apache.juddi.model.ClientSubscriptionInfo modelClientSubscriptionInfo =
          em.find(org.apache.juddi.model.ClientSubscriptionInfo.class, subscriptionKey);
        if (modelClientSubscriptionInfo == null) {
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.SubscripKeyNotFound", subscriptionKey));
        }
        apiClientSubscriptionInfo = new org.apache.juddi.api_v3.ClientSubscriptionInfo();
        MappingModelToApi.mapClientSubscriptionInfo(modelClientSubscriptionInfo, apiClientSubscriptionInfo);
   
        tx.commit();
View Full Code Here

      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getBusinessKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
      i++;
View Full Code Here

      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getServiceKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
      i++;
View Full Code Here

      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getBindingKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    // Checking for duplicates and existence
    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));

      i++;
View Full Code Here

      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getTModelKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    int i = 0;
    for (String entityKey : entityKeyList) {

      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      entityKeyList.set(i, entityKey);
     
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
      i++;
View Full Code Here

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

TOP

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

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.