Package org.apache.ws.scout.model.uddi.v2

Examples of org.apache.ws.scout.model.uddi.v2.BusinessService


        return pa;
    }

  public static BusinessService getBusinessServiceFromJAXRService(
      Service service) throws JAXRException {
    BusinessService bs = objectFactory.createBusinessService();
    try {
      InternationalString iname = service.getName();
           
      addNames(bs.getName(), iname);
          
            InternationalString idesc = service.getDescription();
   
           addDescriptions(bs.getDescription(), idesc);

            Organization o = service.getProvidingOrganization();

            /*
             * there may not always be a key...
             */
            if (o != null) {
                Key k = o.getKey();

        if (k != null && k.getId() != null) {
                    bs.setBusinessKey(k.getId());
                }
                   
      } else {
                /*
                 * gmj - I *think* this is the right thing to do
                 */
        throw new JAXRException(
            "Service has no associated organization");
            }

      if (service.getKey() != null && service.getKey().getId() != null) {
                bs.setServiceKey(service.getKey().getId());
            } else {
                bs.setServiceKey("");
            }

            CategoryBag catBag = getCategoryBagFromClassifications(service.getClassifications());
            if (catBag!=null) {
                bs.setCategoryBag(catBag);
            }

            //Add the ServiceBinding information
            BindingTemplates bt = getBindingTemplates(service.getServiceBindings());
            if (bt != null) {
                bs.setBindingTemplates(bt);
            }
          
            log.debug("BusinessService=" + bs.toString());
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return bs;
    }
View Full Code Here


      barr = new BusinessService[s.size()];

            Iterator<Service> iter = s.iterator();
      int barrPos = 0;
      while (iter.hasNext()) {
        BusinessService bs = ScoutJaxrUddiHelper
            .getBusinessServiceFromJAXRService((Service) iter
                .next());
        barr[barrPos] = bs;
        barrPos++;
            }
View Full Code Here

        Iterator iter = services.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                BusinessService bs = ScoutJaxrUddiHelper.getBusinessServiceFromJAXRService((Service) iter.next());
                sarr[currLoc] = bs;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        // Save Service
        ServiceDetail sd = null;
        try {
            sd = (ServiceDetail) executeOperation(sarr, "SAVE_SERVICE");
        }
        catch (RegistryException e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        List<BusinessService> bizServiceList = sd.getBusinessService();
        sarr = new BusinessService[bizServiceList.size()];
        bizServiceList.toArray(sarr);
       
        for (int i = 0; sarr != null && i < sarr.length; i++) {
            BusinessService entity = (BusinessService) sarr[i];
            coll.add(new KeyImpl(entity.getServiceKey()));
        }
        bulk.setCollection(coll);
        bulk.setExceptions(exceptions);

        return bulk;
View Full Code Here

        return pa;
    }

  public static BusinessService getBusinessServiceFromJAXRService(
      Service service) throws JAXRException {
    BusinessService bs = objectFactory.createBusinessService();
    try {
      InternationalString iname = service.getName();
           
      addNames(bs.getName(), iname);
          
            InternationalString idesc = service.getDescription();
   
           addDescriptions(bs.getDescription(), idesc);

            Organization o = service.getProvidingOrganization();

            /*
             * there may not always be a key...
             */
            if (o != null) {
                Key k = o.getKey();

        if (k != null && k.getId() != null) {
                    bs.setBusinessKey(k.getId());
                }
                   
      } else {
                /*
                 * gmj - I *think* this is the right thing to do
                 */
        throw new JAXRException(
            "Service has no associated organization");
            }

      if (service.getKey() != null && service.getKey().getId() != null) {
                bs.setServiceKey(service.getKey().getId());
            } else {
                bs.setServiceKey("");
            }

            CategoryBag catBag = getCategoryBagFromClassifications(service.getClassifications());
            if (catBag!=null) {
                bs.setCategoryBag(catBag);
            }

            //Add the ServiceBinding information
            BindingTemplates bt = getBindingTemplates(service.getServiceBindings());
            if (bt != null) {
                bs.setBindingTemplates(bt);
            }
          
            log.debug("BusinessService=" + bs.toString());
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return bs;
    }
View Full Code Here

      barr = new BusinessService[s.size()];

            Iterator<Service> iter = s.iterator();
      int barrPos = 0;
      while (iter.hasNext()) {
        BusinessService bs = ScoutJaxrUddiHelper
            .getBusinessServiceFromJAXRService((Service) iter
                .next());
        barr[barrPos] = bs;
        barrPos++;
            }
View Full Code Here

        Iterator iter = services.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                BusinessService bs = ScoutJaxrUddiHelper.getBusinessServiceFromJAXRService((Service) iter.next());
                sarr[currLoc] = bs;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        // Save Service
        ServiceDetail sd = null;
        try {
            sd = (ServiceDetail) executeOperation(sarr, "SAVE_SERVICE");
        }
        catch (RegistryException e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        List<BusinessService> bizServiceList = sd.getBusinessService();
        sarr = new BusinessService[bizServiceList.size()];
        bizServiceList.toArray(sarr);
       
        for (int i = 0; sarr != null && i < sarr.length; i++) {
            BusinessService entity = (BusinessService) sarr[i];
            coll.add(new KeyImpl(entity.getServiceKey()));
        }
        bulk.setCollection(coll);
        bulk.setExceptions(exceptions);

        return bulk;
View Full Code Here

       
        public static org.uddi.api_v2.BusinessService MapService(org.uddi.api_v3.BusinessService be) {
                if (be == null) {
                        return null;
                }
                BusinessService item = new org.uddi.api_v2.BusinessService();
                item.setCategoryBag(MapCategoryBag(be.getCategoryBag()));
                item.getDescription().addAll(MapDescription(be.getDescription()));
                item.setBusinessKey(be.getBusinessKey());
                item.setServiceKey(be.getServiceKey());
                item.getName().addAll(MapName(be.getName()));
                if (be.getBindingTemplates() != null && !be.getBindingTemplates().getBindingTemplate().isEmpty()) {
                        item.setBindingTemplates(new BindingTemplates());
                        item.getBindingTemplates().getBindingTemplate().addAll(MapBinding(be.getBindingTemplates().getBindingTemplate()));
                }
                return item;
        }
View Full Code Here

  }
  /**
   * Copies the Service from one UDDI to another UDDI.
   */
  public void xRegisterService() {
    BusinessService businessService;
    try {
      businessService = fromClerk.findService(entityKey,fromClerk.getUDDINode().getApiNode());
      log.info("xregister service " + businessService.getName().get(0).getValue() + " + from "
          + fromClerk.getName() + " to " + toClerk.getName());
      businessService.setBindingTemplates(null);
      toClerk.register(businessService,toClerk.getUDDINode().getApiNode());
    } catch (Exception e) {
      log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e);
    }
  }
View Full Code Here

  }
  /**
   * Copies the Service from one UDDI to another UDDI along with all the bindingTemplates.
   */
  public void xRegisterServiceAndBindings() {
    BusinessService businessService;
    try {
      businessService = fromClerk.findService(entityKey,fromClerk.getUDDINode().getApiNode());
      log.info("xregister service " + businessService.getName().get(0).getValue() + " + from "
          + fromClerk.getName() + " to " + toClerk.getName());
      toClerk.register(businessService,toClerk.getUDDINode().getApiNode());
    } catch (Exception e) {
      log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e);
    }
View Full Code Here

                clerk.unRegisterBinding(bindingTemplate.getBindingKey(), clerk.getUDDINode().getApiNode());
              }
            }
            if (removeServiceWithNoBindingTemplates) {
              try {
                BusinessService existingService = clerk.findService(businessService.getServiceKey(), clerk.getUDDINode().getApiNode());
                if (existingService.getBindingTemplates()==null || existingService.getBindingTemplates().getBindingTemplate().size()==0) {
                  clerk.unRegisterService(businessService.getServiceKey(),clerk.getUDDINode().getApiNode());
                }
              } catch (Exception e) {
                log.error(e.getMessage(),e);
              }
View Full Code Here

TOP

Related Classes of org.apache.ws.scout.model.uddi.v2.BusinessService

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.