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

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


              System.out.println("Service Key         = '" + businessService.getServiceKey() + "'");
              System.out.println("Service Description = '" + businessService.getDescription().get(0).getValue() + "'");
              System.out.println("BindingTemplates: " + businessService.getBindingTemplates().getBindingTemplate().size());
             
              for (int i=0; i<businessService.getBindingTemplates().getBindingTemplate().size(); i++) {
              BindingTemplate bindingTemplate = businessService.getBindingTemplates().getBindingTemplate().get(i);
              System.out.println("--BindingTemplate" + " " + i + ":");
              System.out.println("  bindingKey          = " + bindingTemplate.getBindingKey());
              System.out.println("  accessPoint useType = " + bindingTemplate.getAccessPoint().getUseType());
              System.out.println("  accessPoint value   = " + bindingTemplate.getAccessPoint().getValue());
              System.out.println("  description         = " + bindingTemplate.getDescription().get(0).getValue());
              }
            }
          }
             
          businessEntity.getBusinessServices();
View Full Code Here


            businessService = createBusinessService(serviceQName, wsdlDefinition);
            // Register this Service
            clerk.register(businessService);
        }
        //Add the BindingTemplate to this Service
        BindingTemplate binding = createWSDLBinding(serviceQName, portName, serviceUrl, wsdlDefinition);
        // Register BindingTemplate
        if (binding.getAccessPoint()!=null) {
          clerk.register(binding);
          if (businessService.getBindingTemplates() == null) {
              businessService.setBindingTemplates(new BindingTemplates());
          }
          businessService.getBindingTemplates().getBindingTemplate().add(binding);
          response.setBindingKey(binding.getBindingKey());
        }
        response.setBusinessService(businessService);
        return response;
    }
View Full Code Here

            //add the bindingTemplates
            URL serviceUrl = null;
            if (service.getPorts() != null && service.getPorts().size() > 0) {
                businessService.setBindingTemplates(new BindingTemplates());
                for (Object portName : service.getPorts().keySet()) {
                    BindingTemplate bindingTemplate = createWSDLBinding(serviceQName, (String) portName, serviceUrl, wsdlDefinition);
                    businessService.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
                }
            }
            businessServices.getBusinessService().add(businessService);
        }
View Full Code Here

        return service;
    }

    protected BindingTemplate createWSDLBinding(QName serviceQName, String portName, URL serviceUrl, Definition wsdlDefinition) {

        BindingTemplate bindingTemplate = new BindingTemplate();
        // Set BusinessService Key
        bindingTemplate.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));

        if (serviceUrl != null) {
            // Set AccessPoint
            AccessPoint accessPoint = new AccessPoint();
            accessPoint.setUseType(AccessPointType.END_POINT.toString());
            accessPoint.setValue(urlLocalizer.rewrite(serviceUrl));
            bindingTemplate.setAccessPoint(accessPoint);
            // Set Binding Key
            String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, serviceUrl);
            bindingTemplate.setBindingKey(bindingKey);
        }

        Service service = wsdlDefinition.getService(serviceQName);
        if (service != null) {
            TModelInstanceDetails tModelInstanceDetails = new TModelInstanceDetails();

            Port port = service.getPort(portName);
            if (port != null) {
                if (serviceUrl == null) {
                    for (Object element : port.getExtensibilityElements()) {
                      String location = null;
                        if (element instanceof SOAPAddress) {
                            SOAPAddress address = (SOAPAddress) element;
                            location = address.getLocationURI();
                        }
                        else if (element instanceof HTTPAddress) {
                          HTTPAddress address = (HTTPAddress) element;
                            location = address.getLocationURI();
                        }
                        else if (element instanceof SOAP12Address) {
                          SOAP12Address address = (SOAP12Address) element;
                            location = address.getLocationURI();
                        }
                        if (location != null ) {
                            try {
                              URL locationURI = new URL(location);
                                AccessPoint accessPoint = new AccessPoint();
                                accessPoint.setUseType(AccessPointType.END_POINT.toString());
                                accessPoint.setValue(urlLocalizer.rewrite(locationURI));
                                bindingTemplate.setAccessPoint(accessPoint);
                                // Set Binding Key
                                String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, locationURI);
                                bindingTemplate.setBindingKey(bindingKey);
                                break;
                            } catch (MalformedURLException e) {
                                log.error(e.getMessage());
                            }
                        }
                    }

                }
                Binding binding = port.getBinding();
                // Set the Binding Description
                String bindingDescription = properties.getProperty(Property.BINDING_DESCRIPTION, Property.DEFAULT_BINDING_DESCRIPTION);
                // Override with the service description from the WSDL if present
                Element docElement = binding.getDocumentationElement();
                if (docElement != null && docElement.getTextContent() != null) {
                    bindingDescription = docElement.getTextContent();
                }
                Description description = new Description();
                description.setLang(lang);
                description.setValue(bindingDescription);
                bindingTemplate.getDescription().add(description);

                // reference wsdl:binding tModel
                TModelInstanceInfo tModelInstanceInfoBinding = new TModelInstanceInfo();
                tModelInstanceInfoBinding.setTModelKey(keyDomainURI + binding.getQName().getLocalPart());
                InstanceDetails instanceDetails = new InstanceDetails();
                instanceDetails.setInstanceParms(portName);
                tModelInstanceInfoBinding.setInstanceDetails(instanceDetails);
                Description descriptionB = new Description();
                descriptionB.setLang(lang);
                descriptionB.setValue("The wsdl:binding that this wsdl:port implements. " + bindingDescription
                        + " The instanceParms specifies the port local name.");
                tModelInstanceInfoBinding.getDescription().add(descriptionB);
                tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBinding);

                // reference wsdl:portType tModel
                PortType portType = binding.getPortType();
                TModelInstanceInfo tModelInstanceInfoPortType = new TModelInstanceInfo();
                tModelInstanceInfoPortType.setTModelKey(keyDomainURI + portType.getQName().getLocalPart());
                String portTypeDescription = "";
                docElement = portType.getDocumentationElement();
                if (docElement != null && docElement.getTextContent() != null) {
                    portTypeDescription = docElement.getTextContent();
                }
                Description descriptionPT = new Description();
                descriptionPT.setLang(lang);
                descriptionPT.setValue("The wsdl:portType that this wsdl:port implements." + portTypeDescription);
                tModelInstanceInfoPortType.getDescription().add(descriptionPT);
                tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoPortType);

                bindingTemplate.setTModelInstanceDetails(tModelInstanceDetails);
            } else {
                log.error("Could not find Port with portName: " + portName);
            }
        } else {
            log.error("Could not find Service with serviceName: " + serviceQName.getLocalPart());
View Full Code Here

   * Register a BindingTemplate.
   *
   */
  public BindingTemplate register(BindingTemplate binding, Node node) {
   
    BindingTemplate bindingTemplate=null;
    log.info("Registering bindingTemplate with key " + binding.getBindingKey());
    try {
      String authToken = getAuthToken(node.getSecurityUrl());
      SaveBinding saveBinding = new SaveBinding();
      saveBinding.setAuthInfo(authToken);
      saveBinding.getBindingTemplate().add(binding);
      BindingDetail bindingDetail = getUDDINode().getTransport().getUDDIPublishService(node.getPublishUrl()).saveBinding(saveBinding);
      bindingTemplate = bindingDetail.getBindingTemplate().get(0);
      if (log.isDebugEnabled()) log.debug("Registering template binding " + binding.getBindingKey() + " completed.");
    } catch (Exception e) {
      log.error("Unable to register template binding " + bindingTemplate.getBindingKey()
          + " ." + e.getMessage(),e);
    } catch (Throwable t) {
      log.error("Unable to register template binding " + bindingTemplate.getBindingKey()
          + " ." + t.getMessage(),t);
    }
    return bindingTemplate;
  }
View Full Code Here

        CategoryBag categoryBag = parseCategoryBag(uddiService.categoryBag());
            service.setCategoryBag(categoryBag);
      }
     
      //bindingTemplate on service
      BindingTemplate bindingTemplate = parseServiceBinding(clazz, lang, webServiceAnnotation, properties);
      if (bindingTemplate!=null) {
        bindingTemplate.setServiceKey(service.getServiceKey());
        if (service.getBindingTemplates()==null) {
          service.setBindingTemplates(new BindingTemplates());
        }
        service.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
      }
View Full Code Here

  }
 
  protected BindingTemplate parseServiceBinding(Class<?> classWithAnnotations, String lang,
      WebService webServiceAnnotation, Properties properties) {
   
    BindingTemplate bindingTemplate = null;
    UDDIServiceBinding uddiServiceBinding= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class);
    //binding
    if (uddiServiceBinding!=null) {
      bindingTemplate = new BindingTemplate();
     
      bindingTemplate.setBindingKey(TokenResolver.replaceTokens(uddiServiceBinding.bindingKey(), properties));
     
      String bindingLang = String.valueOf(lang);
      if (uddiServiceBinding.lang()!=null) {
        bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang(),properties);
      }
      Description bindingDescription = new Description();
      bindingDescription.setLang(bindingLang);
      bindingDescription.setValue(TokenResolver.replaceTokens(uddiServiceBinding.description(),properties));
      bindingTemplate.getDescription().add(bindingDescription);
     
      AccessPoint accessPoint = new AccessPoint();
      accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
      if (!"".equals(uddiServiceBinding.accessPointType())) {
        accessPoint.setUseType(uddiServiceBinding.accessPointType());
      }
      if (!"".equals(uddiServiceBinding.accessPoint())) {
        String endPoint = uddiServiceBinding.accessPoint();
        endPoint = TokenResolver.replaceTokens(endPoint, properties);
                log.debug("AccessPoint EndPoint=" + endPoint);
        accessPoint.setValue(endPoint);
      } else if (webServiceAnnotation!=null && webServiceAnnotation.wsdlLocation()!=null) {
        accessPoint.setValue(webServiceAnnotation.wsdlLocation());
      }
      bindingTemplate.setAccessPoint(accessPoint);
     
      //tModelKeys on the binding
      if (!"".equals(uddiServiceBinding.tModelKeys())) {
        String[] tModelKeys= uddiServiceBinding.tModelKeys().split(",");
        for (String tModelKey : tModelKeys) {
          TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
          instanceInfo.setTModelKey(tModelKey);
          if (bindingTemplate.getTModelInstanceDetails()==null) {
            bindingTemplate.setTModelInstanceDetails(new TModelInstanceDetails());
          }
          bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
        }
      }
      //categoryBag on the binding
      if (!"".equals(uddiServiceBinding.categoryBag())) {
        CategoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag());
            bindingTemplate.setCategoryBag(categoryBag);
      }
    } else {
      log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations);
    }
    return bindingTemplate;
View Full Code Here

 
  public void saveNotifierBinding(String authInfo, String bindingXML, String bindingKey, Integer port) {
    try {
      SaveBinding sb = new SaveBinding();
      sb.setAuthInfo(authInfo);
      BindingTemplate btIn = (BindingTemplate)EntityCreator.buildFromDoc(bindingXML, "org.uddi.api_v3");
      String value = btIn.getAccessPoint().getValue();
      value = value.replace("{randomPort}", port.toString());
      sb.getBindingTemplate().add(btIn);
      publication.saveBinding(sb);   
    }
    catch(Exception e) {
View Full Code Here

        service = createBusinessService(serviceName, wsdlDefinition);
        // Register this BPEL Service
        clerk.register(service);
    }
    //Add the BindingTemplate to this Service
    BindingTemplate binding = createBPELBinding(serviceName, portName, serviceUrl, wsdlDefinition);
    // Register BindingTemplate
    clerk.register(binding);
    return binding;
  }
View Full Code Here

      return tModel;
    }
   
    public BindingTemplate createBPELBinding(QName serviceName, String portName, URL serviceUrl, Definition wsdlDefinition) {
   
      BindingTemplate bindingTemplate = new BindingTemplate();
    // Set BusinessService Key
    bindingTemplate.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart()));
    // Set Binding Key
    String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceName, portName, serviceUrl);
    bindingTemplate.setBindingKey(bindingKey);
    // Set AccessPoint
    AccessPoint accessPoint = new AccessPoint();
    accessPoint.setUseType(AccessPointType.END_POINT.toString());
    accessPoint.setValue(urlLocalizer.rewrite(serviceUrl));
    bindingTemplate.setAccessPoint(accessPoint);
   
    Service service =  wsdlDefinition.getService(serviceName);
   
    if (service!=null) {
      TModelInstanceDetails tModelInstanceDetails = new TModelInstanceDetails();
     
      Port port = service.getPort(portName);
      if (port!=null) {
        Binding binding = port.getBinding();
        // Set the Binding Description
        String bindingDescription = properties.getProperty(Property.BINDING_DESCRIPTION, Property.DEFAULT_BINDING_DESCRIPTION);
        // Override with the service description from the WSDL if present
        Element docElement = binding.getDocumentationElement();
        if (docElement!=null && docElement.getTextContent()!=null) {
          bindingDescription = docElement.getTextContent();
        }
        Description description = new Description();
        description.setLang(lang);
        description.setValue(bindingDescription);
        bindingTemplate.getDescription().add(description);
       
        // reference wsdl:binding tModel
        TModelInstanceInfo tModelInstanceInfoBinding = new TModelInstanceInfo();
        tModelInstanceInfoBinding.setTModelKey(keyDomainURI + binding.getQName().getLocalPart());
        InstanceDetails instanceDetails = new InstanceDetails();
        instanceDetails.setInstanceParms(portName)
        tModelInstanceInfoBinding.setInstanceDetails(instanceDetails);
        Description descriptionB = new Description();
        descriptionB.setLang(lang);
        descriptionB.setValue("The wsdl:binding that this wsdl:port implements. " + bindingDescription +
            " The instanceParms specifies the port local name.");
        tModelInstanceInfoBinding.getDescription().add(descriptionB);
        tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBinding);
       
        // reference wsdl:portType tModel
        PortType portType = binding.getPortType();
        TModelInstanceInfo tModelInstanceInfoPortType = new TModelInstanceInfo();
        tModelInstanceInfoPortType.setTModelKey(keyDomainURI + portType.getQName().getLocalPart());
        String portTypeDescription = "";
        docElement = portType.getDocumentationElement();
        if (docElement!=null && docElement.getTextContent()!=null) {
          portTypeDescription = docElement.getTextContent();
        }
        Description descriptionPT = new Description();
        descriptionPT.setLang(lang);
        descriptionPT.setValue("The wsdl:portType that this wsdl:port implements." + portTypeDescription );
        tModelInstanceInfoPortType.getDescription().add(descriptionPT);
        tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoPortType);
       
        //reference bpel:process tModel
        TModelInstanceInfo tModelInstanceInfoBPEL = new TModelInstanceInfo();
        tModelInstanceInfoBPEL.setTModelKey(keyDomainURI + service.getQName().getLocalPart() + "Process");
        Description descriptionBPEL = new Description();
        // Description
        String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
        // Override with the service description from the WSDL if present
        docElement = wsdlDefinition.getService(serviceName).getDocumentationElement();
        if (docElement!=null && docElement.getTextContent()!=null) {
          serviceDescription = docElement.getTextContent();
        }
        descriptionBPEL.setLang(lang);
        descriptionBPEL.setValue("The bpel:process this wsdl:port supports." + serviceDescription);
        tModelInstanceInfoBPEL.getDescription().add(descriptionBPEL);
        tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBPEL);
       
        bindingTemplate.setTModelInstanceDetails(tModelInstanceDetails);
      } else {
        log.error("Could not find Port with portName: " + portName);
      }
    } else {
      log.error("Could not find Service with serviceName: " + serviceName.getLocalPart());
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.