Package org.apache.ws.scout.uddi

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


        return address;
    }

  public static BindingTemplate getBindingTemplateFromJAXRSB(
      ServiceBinding serve) throws JAXRException {
    BindingTemplate bt = BindingTemplate.Factory.newInstance();
    if (serve.getKey() != null && serve.getKey().getId() != null) {
      bt.setBindingKey(serve.getKey().getId());
    } else {
      bt.setBindingKey("");
    }
 
    try {
      // Set Access URI
            String accessuri = serve.getAccessURI();
      if (accessuri != null) {
        AccessPoint ap = AccessPoint.Factory.newInstance();
                ap.setURLType(getURLType(accessuri));
        ap.setStringValue(accessuri);
                bt.setAccessPoint(ap);
            }
            ServiceBinding sb = serve.getTargetBinding();
      if (sb != null) {
        HostingRedirector red = HostingRedirector.Factory.newInstance();
                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(AccessPoint.Factory.newInstance());
              }
            }
      // TODO:Need to look further at the mapping b/w BindingTemplate and
      // Jaxr ServiceBinding

      // Get Service information
           Service svc = serve.getService();
      if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
              bt.setServiceKey(svc.getKey().getId());
           }
     
      InternationalString idesc = ((RegistryObject) serve).getDescription();
           
            if (idesc != null) {
                for (LocalizedString locName : idesc.getLocalizedStrings()) {
                    Description desc = bt.addNewDescription();
                    desc.setStringValue(locName.getValue());
                    desc.setLang(locName.getLocale().getLanguage());               
                }
            }

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

          TModelInstanceInfo emptyTInfo = tid
              .addNewTModelInstanceInfo();

                    RegistryObject specificationObject = slink.getSpecificationObject();
          if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
            emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                        if (specificationObject.getDescription()!=null) {
                            for (LocalizedString locDesc : specificationObject.getDescription().getLocalizedStrings()) {
                                Description description = emptyTInfo.addNewDescription();
                                description.setStringValue(locDesc.getValue());
                                description.setLang(locDesc.getLocale().getLanguage());
                            }
                        }
                        Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                        if (externalLinks!=null && externalLinks.size()>0) {
                            for (ExternalLink link : externalLinks) {
                                InstanceDetails ids = emptyTInfo.addNewInstanceDetails();
                                if (link.getDescription()!=null) {
                                    Description description = ids.addNewDescription();
                                    description.setStringValue(link.getDescription().getValue());
                                }
                                if (link.getExternalURI()!=null) {
                                    OverviewDoc overviewDoc = ids.addNewOverviewDoc();
                                    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


                BindingTemplate[] bindarr= l.getBindingTemplateArray();
                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

      //Populate the ServiceBindings for this Service
      BindingTemplates bts = bs.getBindingTemplates();
      BindingTemplate[] btarr = bts != null ? bts.getBindingTemplateArray() : null;
      for (int i = 0; btarr != null && i < btarr.length; i++)
      {
        BindingTemplate bindingTemplate = (BindingTemplate)btarr[i];
          serve.addServiceBinding(getServiceBinding(bindingTemplate, lcm));
      }
     
      serve.addClassifications(getClassifications(bs.getCategoryBag(), lcm));
     
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;
        }

        sbarr = bd.getBindingTemplateArray();
        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

TOP

Related Classes of org.apache.ws.scout.uddi.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.