Package org.uddi.api_v2

Examples of org.uddi.api_v2.BindingDetail


      org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
      findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());
     
      List<?> keysFound = InquiryHelper.findBinding(body, findQualifiers, em);
 
      BindingDetail result = InquiryHelper.getBindingDetailFromKeys(body, findQualifiers, em, keysFound);
      tx.commit();
      return result;
    } finally {
      if (tx.isActive()) {
        tx.rollback();
View Full Code Here


      tx.begin();
 
      if (isAuthenticated())
        this.getEntityPublisher(em, body.getAuthInfo());
     
      BindingDetail result = new BindingDetail();
 
      List<String> bindingKeyList = body.getBindingKey();
      for (String bindingKey : bindingKeyList) {
       
        org.apache.juddi.model.BindingTemplate modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, bindingKey);
        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);
       
        result.getBindingTemplate().add(apiBindingTemplate);
      }
 
      tx.commit();
      return result;
    } finally {
View Full Code Here

          fb.setListHead(null);
          fb.setMaxRows(null);
          // Setting the start index to the chunkData
          Holder<Integer> subscriptionStartIndex = new Holder<Integer>(chunkData);
         
          BindingDetail bindingDetail = InquiryHelper.getBindingDetailFromKeys(fb, findQualifiers, em, currentMatchingKeys,
                                             startPointDate, endPointDate, subscriptionStartIndex, modelSubscription.getMaxEntities());
             
          // Upon exiting above function, if more results are to be had, the subscriptionStartIndex will contain the latest value (or null
          // if no more results)
          chunkData = subscriptionStartIndex.value;
         
          result.setBindingDetail(bindingDetail);
        }
      }
      if (subscriptionFilter.getFindBusiness() != null) {
        //Get the current matching keys
        List<?> currentMatchingKeys = getSubscriptionMatches(subscriptionFilter, em);
 
        List<String> missingKeys = getMissingKeys(currentMatchingKeys, modelSubscription.getSubscriptionMatches());
        if (missingKeys != null && missingKeys.size() > 0) {
          KeyBag missingKeyBag = new KeyBag();
          missingKeyBag.setDeleted(true);
          for (String key : missingKeys)
            missingKeyBag.getBusinessKey().add(key);
 
          result.getKeyBag().add(missingKeyBag);
        }
       
        // Re-setting the subscription matches to the new matching key collection
        //modelSubscription.getSubscriptionMatches().clear();
        //for (Object key : currentMatchingKeys) {
        //  SubscriptionMatch subMatch = new SubscriptionMatch(modelSubscription, (String)key);
        //  modelSubscription.getSubscriptionMatches().add(subMatch);
        //}
       
        // Now, finding the necessary entities, within the coverage period limits
        if (modelSubscription.isBrief()) {
          KeyBag resultsKeyBag = new KeyBag();
          for (String key : (List<String>)currentMatchingKeys)
            resultsKeyBag.getBusinessKey().add(key);
         
          result.getKeyBag().add(resultsKeyBag);
        }
        else {
          FindBusiness fb = subscriptionFilter.getFindBusiness();
          org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
          findQualifiers.mapApiFindQualifiers(fb.getFindQualifiers());
         
          // To do subscription "chunking", the listHead and maxRows are nulled which will set them to system default.  User settings for
          // these values don't make sense with the "chunking" feature.
          fb.setListHead(null);
          fb.setMaxRows(null);
          // Setting the start index to the chunkData
          Holder<Integer> subscriptionStartIndex = new Holder<Integer>(chunkData);
         
          BusinessList businessList = InquiryHelper.getBusinessListFromKeys(fb, findQualifiers, em, currentMatchingKeys,
                                            startPointDate, endPointDate, subscriptionStartIndex, modelSubscription.getMaxEntities());
         
          // Upon exiting above function, if more results are to be had, the subscriptionStartIndex will contain the latest value (or null
          // if no more results)
          chunkData = subscriptionStartIndex.value;
         
          result.setBusinessList(businessList);
        }
      }
      if (subscriptionFilter.getFindService() != null) {
        //Get the current matching keys
        List<?> currentMatchingKeys = getSubscriptionMatches(subscriptionFilter, em);
 
        List<String> missingKeys = getMissingKeys(currentMatchingKeys, modelSubscription.getSubscriptionMatches());
        if (missingKeys != null && missingKeys.size() > 0) {
          KeyBag missingKeyBag = new KeyBag();
          missingKeyBag.setDeleted(true);
          for (String key : missingKeys)
            missingKeyBag.getServiceKey().add(key);
 
          result.getKeyBag().add(missingKeyBag);
        }
       
        // Re-setting the subscription matches to the new matching key collection
        //modelSubscription.getSubscriptionMatches().clear();
        //for (Object key : currentMatchingKeys) {
        //  SubscriptionMatch subMatch = new SubscriptionMatch(modelSubscription, (String)key);
        //  modelSubscription.getSubscriptionMatches().add(subMatch);
        //}
       
        // Now, finding the necessary entities, within the coverage period limits
        if (modelSubscription.isBrief()) {
          KeyBag resultsKeyBag = new KeyBag();
          for (String key : (List<String>)currentMatchingKeys)
            resultsKeyBag.getServiceKey().add(key);
         
          result.getKeyBag().add(resultsKeyBag);
        }
        else {
          FindService fs = subscriptionFilter.getFindService();
          org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
          findQualifiers.mapApiFindQualifiers(fs.getFindQualifiers());
         
          // To do subscription "chunking", the listHead and maxRows are nulled which will set them to system default.  User settings for
          // these values don't make sense with the "chunking" feature.
          fs.setListHead(null);
          fs.setMaxRows(null);
          // Setting the start index to the chunkData
          Holder<Integer> subscriptionStartIndex = new Holder<Integer>(chunkData);
 
          ServiceList serviceList = InquiryHelper.getServiceListFromKeys(fs, findQualifiers, em, currentMatchingKeys,
                                           startPointDate, endPointDate, subscriptionStartIndex, modelSubscription.getMaxEntities());
          if (serviceList.getServiceInfos()==null || serviceList.getServiceInfos().getServiceInfo().size()==0) {
            serviceList=null;
          }
          // Upon exiting above function, if more results are to be had, the subscriptionStartIndex will contain the latest value (or null
          // if no more results)
          chunkData = subscriptionStartIndex.value;
         
          result.setServiceList(serviceList);
        }
      }
      if (subscriptionFilter.getFindTModel() != null) {
        //Get the current matching keys
        List<?> currentMatchingKeys = getSubscriptionMatches(subscriptionFilter, em);
 
        List<String> missingKeys = getMissingKeys(currentMatchingKeys, modelSubscription.getSubscriptionMatches());
        if (missingKeys != null && missingKeys.size() > 0) {
          KeyBag missingKeyBag = new KeyBag();
          missingKeyBag.setDeleted(true);
          for (String key : missingKeys)
            missingKeyBag.getTModelKey().add(key);
 
          result.getKeyBag().add(missingKeyBag);
        }
       
        // Re-setting the subscription matches to the new matching key collection
        //modelSubscription.getSubscriptionMatches().clear();
        //for (Object key : currentMatchingKeys) {
        //  SubscriptionMatch subMatch = new SubscriptionMatch(modelSubscription, (String)key);
        //  modelSubscription.getSubscriptionMatches().add(subMatch);
        //}
       
        // Now, finding the necessary entities, within the coverage period limits
        if (modelSubscription.isBrief()) {
          KeyBag resultsKeyBag = new KeyBag();
          for (String key : (List<String>)currentMatchingKeys)
            resultsKeyBag.getTModelKey().add(key);
         
          result.getKeyBag().add(resultsKeyBag);
        }
        else {
          FindTModel ft = subscriptionFilter.getFindTModel();
          org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();
          findQualifiers.mapApiFindQualifiers(ft.getFindQualifiers());
 
          // To do subscription "chunking", the listHead and maxRows are nulled which will set them to system default.  User settings for
          // these values don't make sense with the "chunking" feature.
          ft.setListHead(null);
          ft.setMaxRows(null);
          // Setting the start index to the chunkData
          Holder<Integer> subscriptionStartIndex = new Holder<Integer>(chunkData);
         
          // If more results are to be had, chunkData will come out with a value and a new token will be generated below.  Otherwise, it will
          // be null and no token will be generated.
          TModelList tmodelList = InquiryHelper.getTModelListFromKeys(ft, findQualifiers, em, currentMatchingKeys,
                                        startPointDate, endPointDate, subscriptionStartIndex, modelSubscription.getMaxEntities());
 
          // Upon exiting above function, if more results are to be had, the subscriptionStartIndex will contain the latest value (or null
          // if no more results)
          chunkData = subscriptionStartIndex.value;
         
          result.setTModelList(tmodelList);
        }
       
      }
      if (subscriptionFilter.getFindRelatedBusinesses() != null) {
        FindRelatedBusinesses findRelatedBusiness = subscriptionFilter.getFindRelatedBusinesses();
        RelatedBusinessesList  relatedBusinessList = InquiryHelper.getRelatedBusinessesList(findRelatedBusiness, em, startPointDate, endPointDate);
        result.setRelatedBusinessesList(relatedBusinessList);
      }
      if (subscriptionFilter.getGetBindingDetail() != null) {
        GetBindingDetail getDetail = subscriptionFilter.getGetBindingDetail();
       
        // Running through the key list here to determine the deleted keys and store the existing entities.
        KeyBag missingKeyBag = new KeyBag();
        missingKeyBag.setDeleted(true);
        List<org.apache.juddi.model.BindingTemplate> existingList = new ArrayList<org.apache.juddi.model.BindingTemplate>(0);
        for (String key : getDetail.getBindingKey()) {
          org.apache.juddi.model.BindingTemplate modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, key);
          if (modelBindingTemplate != null)
            existingList.add(modelBindingTemplate);
          else
            missingKeyBag.getBindingKey().add(key);
        }
        // Store deleted keys in the results
        if (missingKeyBag.getBindingKey() != null && missingKeyBag.getBindingKey().size() > 0)
          result.getKeyBag().add(missingKeyBag);
       
        KeyBag resultsKeyBag = new KeyBag();
        BindingDetail bindingDetail = new BindingDetail();
 
        // Set the currentIndex to 0 or the value of the chunkData
        int currentIndex = 0;
        if (chunkData != null)
          currentIndex = chunkData;
 
        int returnedRowCount = 0;
        while(currentIndex < existingList.size()) {
 
          org.apache.juddi.model.BindingTemplate modelBindingTemplate = existingList.get(currentIndex);
           
          if (startPointDate.after(modelBindingTemplate.getModifiedIncludingChildren())) {
            currentIndex++;
            continue;
          }
         
          if (endPointDate.before(modelBindingTemplate.getModifiedIncludingChildren())) {
            currentIndex++;
            continue;
          }
         
          if (modelSubscription.isBrief()) {
            resultsKeyBag.getBindingKey().add(modelBindingTemplate.getEntityKey());
          }
          else {
            org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();
            MappingModelToApi.mapBindingTemplate(modelBindingTemplate, apiBindingTemplate);
            bindingDetail.getBindingTemplate().add(apiBindingTemplate);
           
            returnedRowCount++;
          }
 
          // If the returned rows equals the max allowed, we can end the loop.
View Full Code Here

    }
   
    //BINDING DETAIL
    if (list.getBindingDetail()!=null) {
      log.info("Subscription result for BindingDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BindingDetail bindingDetail = list.getBindingDetail();
      if (bindingDetail.isTruncated()) {
        log.info("The bindingDetail is truncated, the maxEntries must have been hit. The number of bindings is " + bindingDetail.getBindingTemplate().size());
      }
      for (BindingTemplate bindingTemplate : bindingDetail.getBindingTemplate()) {
        try {
          //check if the service exist
          BusinessService existingToService = uddiToClerk.findService(bindingTemplate.getServiceKey(), toClerk.getNode());
          if (existingToService!=null) {
            log.debug("Found service with key " +  existingToService.getServiceKey() + ". No need to add it again");
View Full Code Here

  }
  public void findBinding(String findQualifier) {
    try {
      FindBinding body = (FindBinding)EntityCreator.buildFromDoc(FIND_BINDING_XML, "org.uddi.api_v3");
      if (findQualifier!=null) body.getFindQualifiers().getFindQualifier().add(findQualifier);
      BindingDetail result = inquiry.findBinding(body);
      if (result == null)
        Assert.fail("Null result from find binding operation");
      List<BindingTemplate> btList = result.getBindingTemplate();
      if (btList == null || btList.size() == 0)
        Assert.fail("No result from find binding operation");
      BindingTemplate btOut = btList.get(0);
     
      BindingTemplate btIn = (BindingTemplate)EntityCreator.buildFromDoc(TckBindingTemplate.JOE_BINDING_XML, "org.uddi.api_v3");
View Full Code Here

      UddiEntityPublisher publisher = this.getEntityPublisher(em, body.getAuthInfo());
     
      ValidatePublish validator = new ValidatePublish(publisher);
      validator.validateSaveBinding(em, body, null);
 
      BindingDetail result = new BindingDetail();
                        result.setListDescription(new ListDescription());
      List<org.uddi.api_v3.BindingTemplate> apiBindingTemplateList = body.getBindingTemplate();
      for (org.uddi.api_v3.BindingTemplate apiBindingTemplate : apiBindingTemplateList) {
       
        org.apache.juddi.model.BindingTemplate modelBindingTemplate = new org.apache.juddi.model.BindingTemplate();
                               
        org.apache.juddi.model.BusinessService modelBusinessService = new org.apache.juddi.model.BusinessService();
        modelBusinessService.setEntityKey(apiBindingTemplate.getServiceKey());
       
        MappingApiToModel.mapBindingTemplate(apiBindingTemplate, modelBindingTemplate, modelBusinessService);
 
        setOperationalInfo(em, modelBindingTemplate, publisher, false);
 
        em.persist(modelBindingTemplate);
       
        result.getBindingTemplate().add(apiBindingTemplate);
                                result.getListDescription().setActualCount(result.getListDescription().getActualCount()+1);
                                result.getListDescription().setIncludeCount(result.getListDescription().getIncludeCount()+1);
        validator.validateSaveBindingMax(em, modelBindingTemplate.getBusinessService().getEntityKey());
      }
 
      tx.commit();
                        long procTime = System.currentTimeMillis() - startTime;
View Full Code Here

    }
   
    //BINDING DETAIL
    if (list.getBindingDetail()!=null) {
      log.info("Subscription result for BindingDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BindingDetail bindingDetail = list.getBindingDetail();
      if (bindingDetail.isTruncated()) {
        log.info("The bindingDetail is truncated, the maxEntries must have been hit. The number of bindings is " + bindingDetail.getBindingTemplate().size());
      }
      for (BindingTemplate bindingTemplate : bindingDetail.getBindingTemplate()) {
        try {
          //check if the service exist
          BusinessService existingToService = uddiToClerk.findService(bindingTemplate.getServiceKey(), toClerk.getNode());
          if (existingToService!=null) {
            log.debug("Found service with key " +  existingToService.getServiceKey() + ". No need to add it again");
View Full Code Here

                  if (modelBusinessService == null)
                      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey));

          }
      }
      BindingDetail result = InquiryHelper.getBindingDetailFromKeys(body, findQualifiers, em, keysFound);
      tx.rollback();
                        long procTime = System.currentTimeMillis() - startTime;
                        serviceCounter.update(InquiryQuery.FIND_BINDING, QueryStatus.SUCCESS, procTime);                     

      return result;
View Full Code Here

      tx.begin();

      if (isAuthenticated())
        this.getEntityPublisher(em, body.getAuthInfo());

      BindingDetail result = new BindingDetail();

      List<String> bindingKeyList = body.getBindingKey();
      for (String bindingKey : bindingKeyList) {
        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);

        result.getBindingTemplate().add(apiBindingTemplate);
      }

      tx.commit();
                        long procTime = System.currentTimeMillis() - startTime;
                        serviceCounter.update(InquiryQuery.GET_BINDINGDETAIL, QueryStatus.SUCCESS, procTime);                     
View Full Code Here

        private static boolean CheckExistingBindingForSignature(String bindingKey, UDDIInquiryPortType uddiInquiryService, String token, SignatureBehavior behavior) {
                GetBindingDetail gbd = new GetBindingDetail();
                gbd.setAuthInfo(token);
                gbd.getBindingKey().add(bindingKey);
                try {
                        BindingDetail bindingDetail = uddiInquiryService.getBindingDetail(gbd);
                        if (bindingDetail != null
                                && !bindingDetail.getBindingTemplate().isEmpty()
                                && !bindingDetail.getBindingTemplate().get(0).getSignature().isEmpty()) {
                                log.info("the binding template with key=" + bindingKey + " exists and is digitally signed");
                        }
                        return true;
                } catch (Exception ex) {
                        log.debug("Error caught checking for the existence of and if a signature is present for binding key " + bindingKey + " this may be ignorable", ex);
View Full Code Here

TOP

Related Classes of org.uddi.api_v2.BindingDetail

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.