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

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


        return address;
    }

  public static BindingTemplate getBindingTemplateFromJAXRSB(
      ServiceBinding serviceBinding) throws JAXRException {
    BindingTemplate bt = objectFactory.createBindingTemplate();
    if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
      bt.setBindingKey(serviceBinding.getKey().getId());
    } else {
      bt.setBindingKey("");
    }
 
    try {
      // Set Access URI
            String accessuri = serviceBinding.getAccessURI();
      if (accessuri != null) {
        AccessPoint accessPoint = objectFactory.createAccessPoint();
                accessPoint.setURLType(getURLType(accessuri));
        accessPoint.setValue(accessuri);
                bt.setAccessPoint(accessPoint);
            }
            ServiceBinding sb = serviceBinding.getTargetBinding();
      if (sb != null) {
        HostingRedirector red = objectFactory.createHostingRedirector();
                Key key = sb.getKey();
        if (key != null && key.getId() != null) {
          red.setBindingKey(key.getId());
                } else {
                    red.setBindingKey("");
                }
                bt.setHostingRedirector(red);
            } else {
              if (bt.getAccessPoint() == null) {
                bt.setAccessPoint(objectFactory.createAccessPoint());
              }
            }
      // TODO:Need to look further at the mapping b/w BindingTemplate and
      // Jaxr ServiceBinding

      // Get Service information
           Service svc = serviceBinding.getService();
      if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
              bt.setServiceKey(svc.getKey().getId());
           }
     
      InternationalString idesc = serviceBinding.getDescription();
           
            addDescriptions(bt.getDescription(), idesc);

      // SpecificationLink
           Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
      TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
      if (slcol != null && !slcol.isEmpty()) {
              Iterator<SpecificationLink> iter = slcol.iterator();
        while (iter.hasNext()) {
          SpecificationLink slink = (SpecificationLink) iter.next();

          TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
          tid.getTModelInstanceInfo().add(emptyTInfo);

                    RegistryObject specificationObject = slink.getSpecificationObject();
          if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
            emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                        if (specificationObject.getDescription()!=null) {
                            for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
                                LocalizedString locDesc = (LocalizedString) o;
                                Description description = objectFactory.createDescription();
                                emptyTInfo.getDescription().add(description);
                                description.setValue(locDesc.getValue());
                                description.setLang(locDesc.getLocale().getLanguage());
                            }
                        }
                        Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                        if (externalLinks!=null && externalLinks.size()>0) {
                            for (ExternalLink link : externalLinks) {
                                InstanceDetails ids = objectFactory.createInstanceDetails();
                                emptyTInfo.setInstanceDetails(ids);
                                if (link.getDescription()!=null) {
                                    Description description = objectFactory.createDescription();
                                    ids.getDescription().add(description);
                                    description.setValue(link.getDescription().getValue());
                                }
                                if (link.getExternalURI()!=null) {
                                    OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
                                    ids.setOverviewDoc(overviewDoc);
                                    overviewDoc.setOverviewURL(link.getExternalURI());
                                }
                            }
                        }
          }
              }
            }
      bt.setTModelInstanceDetails(tid);
      log.debug("BindingTemplate=" + bt.toString());
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return bt;
    }
View Full Code Here


                bindingTemplateList.toArray(bindarr);
               
                LinkedHashSet<ServiceBinding> col = new LinkedHashSet<ServiceBinding>();

                for (int i=0; bindarr != null && i < bindarr.length; i++) {
                    BindingTemplate si = bindarr[i];
                    ServiceBinding sb =  ScoutUddiJaxrHelper.getServiceBinding(si,
                            registryService.getBusinessLifeCycleManager());
                    col.add(sb);
                   //Fill the Service object by making a call to registry
                   Service s = (Service)getRegistryObject(serviceKey.getId(), LifeCycleManager.SERVICE);
View Full Code Here

        Iterator iter = bindings.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                BindingTemplate bs = ScoutJaxrUddiHelper.getBindingTemplateFromJAXRSB((ServiceBinding) iter.next());
                sbarr[currLoc] = bs;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        // Save ServiceBinding
        BindingDetail bd = null;
        try {
            bd = (BindingDetail) executeOperation(sbarr, "SAVE_SERVICE_BINDING");
        }
        catch (RegistryException e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        List<BindingTemplate> bindingTemplateList = bd.getBindingTemplate();
        sbarr = new BindingTemplate[bindingTemplateList.size()];
        bindingTemplateList.toArray(sbarr);
       
        for (int i = 0; sbarr != null && i < sbarr.length; i++) {
            BindingTemplate bt = (BindingTemplate) sbarr[i];
            coll.add(new KeyImpl(bt.getBindingKey()));
        }
        if (coll.size()>0) {
            bulk.setCollection(coll);
        }
        bulk.setExceptions(exceptions);
View Full Code Here

        return address;
    }

  public static BindingTemplate getBindingTemplateFromJAXRSB(
      ServiceBinding serviceBinding) throws JAXRException {
    BindingTemplate bt = objectFactory.createBindingTemplate();
    if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
      bt.setBindingKey(serviceBinding.getKey().getId());
    } else {
      bt.setBindingKey("");
    }
 
    try {
      // Set Access URI
            String accessuri = serviceBinding.getAccessURI();
      if (accessuri != null) {
        AccessPoint accessPoint = objectFactory.createAccessPoint();
                accessPoint.setURLType(getURLType(accessuri));
        accessPoint.setValue(accessuri);
                bt.setAccessPoint(accessPoint);
            }
            ServiceBinding sb = serviceBinding.getTargetBinding();
      if (sb != null) {
        HostingRedirector red = objectFactory.createHostingRedirector();
                Key key = sb.getKey();
        if (key != null && key.getId() != null) {
          red.setBindingKey(key.getId());
                } else {
                    red.setBindingKey("");
                }
                bt.setHostingRedirector(red);
            } else {
              if (bt.getAccessPoint() == null) {
                bt.setAccessPoint(objectFactory.createAccessPoint());
              }
            }
      // TODO:Need to look further at the mapping b/w BindingTemplate and
      // Jaxr ServiceBinding

      // Get Service information
           Service svc = serviceBinding.getService();
      if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
              bt.setServiceKey(svc.getKey().getId());
           }
     
      InternationalString idesc = serviceBinding.getDescription();
           
            addDescriptions(bt.getDescription(), idesc);

      // SpecificationLink
           Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
      TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
      if (slcol != null && !slcol.isEmpty()) {
              Iterator<SpecificationLink> iter = slcol.iterator();
        while (iter.hasNext()) {
          SpecificationLink slink = (SpecificationLink) iter.next();

          TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
          tid.getTModelInstanceInfo().add(emptyTInfo);

                    RegistryObject specificationObject = slink.getSpecificationObject();
          if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
            emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                        if (specificationObject.getDescription()!=null) {
                            for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
                                LocalizedString locDesc = (LocalizedString) o;
                                Description description = objectFactory.createDescription();
                                emptyTInfo.getDescription().add(description);
                                description.setValue(locDesc.getValue());
                                description.setLang(locDesc.getLocale().getLanguage());
                            }
                        }
                        Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                        if (externalLinks!=null && externalLinks.size()>0) {
                            for (ExternalLink link : externalLinks) {
                                InstanceDetails ids = objectFactory.createInstanceDetails();
                                emptyTInfo.setInstanceDetails(ids);
                                if (link.getDescription()!=null) {
                                    Description description = objectFactory.createDescription();
                                    ids.getDescription().add(description);
                                    description.setValue(link.getDescription().getValue());
                                }
                                if (link.getExternalURI()!=null) {
                                    OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
                                    ids.setOverviewDoc(overviewDoc);
                                    overviewDoc.setOverviewURL(link.getExternalURI());
                                }
                            }
                        }
          }
              }
            }
      bt.setTModelInstanceDetails(tid);
      log.debug("BindingTemplate=" + bt.toString());
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return bt;
    }
View Full Code Here

                bindingTemplateList.toArray(bindarr);
               
                LinkedHashSet<ServiceBinding> col = new LinkedHashSet<ServiceBinding>();

                for (int i=0; bindarr != null && i < bindarr.length; i++) {
                    BindingTemplate si = bindarr[i];
                    ServiceBinding sb =  ScoutUddiJaxrHelper.getServiceBinding(si,
                            registryService.getBusinessLifeCycleManager());
                    col.add(sb);
                   //Fill the Service object by making a call to registry
                   Service s = (Service)getRegistryObject(serviceKey.getId(), LifeCycleManager.SERVICE);
View Full Code Here

        Iterator iter = bindings.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                BindingTemplate bs = ScoutJaxrUddiHelper.getBindingTemplateFromJAXRSB((ServiceBinding) iter.next());
                sbarr[currLoc] = bs;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        // Save ServiceBinding
        BindingDetail bd = null;
        try {
            bd = (BindingDetail) executeOperation(sbarr, "SAVE_SERVICE_BINDING");
        }
        catch (RegistryException e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        List<BindingTemplate> bindingTemplateList = bd.getBindingTemplate();
        sbarr = new BindingTemplate[bindingTemplateList.size()];
        bindingTemplateList.toArray(sbarr);
       
        for (int i = 0; sbarr != null && i < sbarr.length; i++) {
            BindingTemplate bt = (BindingTemplate) sbarr[i];
            coll.add(new KeyImpl(bt.getBindingKey()));
        }
        if (coll.size()>0) {
            bulk.setCollection(coll);
        }
        bulk.setExceptions(exceptions);
View Full Code Here

  /**
   * Copies the TemplateBinding from one UDDI to another UDDI.
   */
  public void xRegisterServiceBinding() {
    try {
      BindingTemplate bindingTemplate = fromClerk.findServiceBinding(entityKey,fromClerk.getUDDINode().getApiNode());
      log.info("xregister binding " + bindingTemplate.getBindingKey()+ " + from "
          + fromClerk.getName() + " to " + toClerk.getName());
      toClerk.register(bindingTemplate,toClerk.getUDDINode().getApiNode());
    } catch (Exception e) {
      log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e);
    }
View Full Code Here

      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");
     
      assertEquals(btIn.getServiceKey(), btOut.getServiceKey());
      assertEquals(btIn.getBindingKey(), btOut.getBindingKey());
     
      TckValidator.checkDescriptions(btIn.getDescription(), btOut.getDescription());
      TckValidator.checkCategories(btIn.getCategoryBag(), btOut.getCategoryBag());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown:  " + e.getMessage());
    }
View Full Code Here

    try {
      // First save the entity
      SaveBinding sb = new SaveBinding();
      sb.setAuthInfo(authInfo);
     
      BindingTemplate btIn = (BindingTemplate)EntityCreator.buildFromDoc(bindingXML, "org.uddi.api_v3");
      sb.getBindingTemplate().add(btIn);
      publication.saveBinding(sb);
     
      // Now get the entity and check the values
      GetBindingDetail gb = new GetBindingDetail();
      gb.getBindingKey().add(bindingKey);
      BindingDetail bd = inquiry.getBindingDetail(gb);
      List<BindingTemplate> btOutList = bd.getBindingTemplate();
      BindingTemplate btOut = btOutList.get(0);

      assertEquals(btIn.getServiceKey(), btOut.getServiceKey());
      assertEquals(btIn.getBindingKey(), btOut.getBindingKey());
     
      TckValidator.checkDescriptions(btIn.getDescription(), btOut.getDescription());
      TckValidator.checkCategories(btIn.getCategoryBag(), btOut.getCategoryBag());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown: " + e.getMessage());
    }
View Full Code Here

  public void saveNotifierBinding(String authInfo, String bindingXML, String bindingKey) {
    try {
      SaveBinding sb = new SaveBinding();
      sb.setAuthInfo(authInfo);
     
      BindingTemplate btIn = (BindingTemplate)EntityCreator.buildFromDoc(bindingXML, "org.uddi.api_v3");
      sb.getBindingTemplate().add(btIn);
      publication.saveBinding(sb);   
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
View Full Code Here

TOP

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

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.