Package org.apache.juddi.v3.error

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


      throw new ValueNotAllowedException(new ErrorMessage("errors.clerk.NoName"));
   
    //make sure clerk exists
    Object obj = em.find(org.apache.juddi.model.Clerk.class, name);
    if (obj == null)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ClerkNotFound", name));
  }
View Full Code Here


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

    HashSet<String> dupCheck = new HashSet<String>();
    for (String clientSubscriptionKey : clientSubscriptionKeyList) {
      boolean inserted = dupCheck.add(clientSubscriptionKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", clientSubscriptionKey));
    }
  }
View Full Code Here

                                try {
                                        modelPublisher = em.find(org.apache.juddi.model.Publisher.class, publisherId);
                                } catch (ClassCastException e) {
                                }
                                if (modelPublisher == null) {
                                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.PublisherNotFound", publisherId));
                                }

                                org.apache.juddi.api_v3.Publisher apiPublisher = new org.apache.juddi.api_v3.Publisher();

                                MappingModelToApi.mapPublisher(modelPublisher, apiPublisher);
View Full Code Here

                                try {
                                        modelClientSubscriptionInfo = em.find(org.apache.juddi.model.ClientSubscriptionInfo.class, subscriptionKey);
                                } catch (ClassCastException e) {
                                }
                                if (modelClientSubscriptionInfo == null) {
                                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.SubscripKeyNotFound", subscriptionKey));
                                }

                                org.apache.juddi.api_v3.ClientSubscriptionInfo apiClientSubscriptionInfo = new org.apache.juddi.api_v3.ClientSubscriptionInfo();

                                MappingModelToApi.mapClientSubscriptionInfo(modelClientSubscriptionInfo, apiClientSubscriptionInfo);
View Full Code Here

                                try {
                                        modelClientSubscriptionInfo = em.find(org.apache.juddi.model.ClientSubscriptionInfo.class, subscriptionKey);
                                } catch (ClassCastException e) {
                                }
                                if (modelClientSubscriptionInfo == null) {
                                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.SubscripKeyNotFound", subscriptionKey));
                                }
                                org.apache.juddi.api_v3.ClientSubscriptionInfo apiClientSubscriptionInfo = new org.apache.juddi.api_v3.ClientSubscriptionInfo();
                                MappingModelToApi.mapClientSubscriptionInfo(modelClientSubscriptionInfo, apiClientSubscriptionInfo);
                                clientSubscriptionInfoMap.put(apiClientSubscriptionInfo.getSubscriptionKey(), apiClientSubscriptionInfo);
                        }
View Full Code Here

                }

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

                                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.
                                 AccessCheck(obj, entityKey);
                                //if (!publisher.isOwner((UddiEntity) obj)&& !((Publisher) publisher).isAdmin()) {
//                                        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.
                                AccessCheck(parentTemp, parentKey);
//                                if (!publisher.isOwner((UddiEntity) parentTemp)) {
View Full Code Here

              org.apache.juddi.model.BusinessService modelBusinessService = null;
              try {
                em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
              } catch (ClassCastException e) {}
                  if (modelBusinessService == null)
                      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey));

          }
      }
      BindingDetail result = InquiryHelper.getBindingDetailFromKeys(body, findQualifiers, em, keysFound);
      tx.rollback();
View Full Code Here

                pubAssertion.setToKey(toKey);
                validateKeyLength(toKey);
                validateKeyLength(fromKey);
                Object fromObj = em.find(org.apache.juddi.model.BusinessEntity.class, fromKey);
                if (fromObj == null) {
                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", fromKey));
                }

                Object toObj = em.find(org.apache.juddi.model.BusinessEntity.class, pubAssertion.getToKey());
                if (toObj == null) {
                        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", toKey));
                }

                if (!publisher.isOwner((UddiEntity) fromObj) && !publisher.isOwner((UddiEntity) toObj)) {
                        throw new UserMismatchException(new ErrorMessage("errors.pubassertion.UserMismatch", fromKey + " & " + toKey));
                }
View Full Code Here

                      org.apache.juddi.model.BusinessEntity modelBusinessEntity = null;
                      try {
                        modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
                      } catch (ClassCastException e) {}
                      if (modelBusinessEntity == null) {
                          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey));
                      }
                }
            }

      ServiceList result = InquiryHelper.getServiceListFromKeys(body, findQualifiers, em, keysFound);
View Full Code Here

        org.apache.juddi.model.BindingTemplate modelBindingTemplate = null;
        try {
          modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, bindingKey);
        } catch (ClassCastException e) {}
        if (modelBindingTemplate == null)
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", bindingKey));

        org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();

        MappingModelToApi.mapBindingTemplate(modelBindingTemplate, apiBindingTemplate);
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.