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

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


    String targetNamespace = wsdlDefinition.getTargetNamespace();
    String genericWSDLURL  = wsdlDefinition.getDocumentBaseURI();   //TODO maybe point to repository version
    String bpelOverviewURL = "http://localhost:8080/bpel-console/"; //TODO maybe point to bpel in console
   
    String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart());
    BusinessService service = lookupService(serviceKey);
    if (service==null) {
      List<TModel> tModels = new ArrayList<TModel>();
      // Create the PortType tModels
      Map<QName,PortType> portTypes = (Map<QName,PortType>) wsdlDefinition.getAllPortTypes();
      tModels.addAll(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
View Full Code Here


  }
 
  public String unRegister(QName serviceName, String portName, URL serviceUrl) throws RemoteException, ConfigurationException, TransportException {
   
    String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart());
    BusinessService service = lookupService(serviceKey);
    boolean isRemoveServiceIfNoTemplates = true;
    String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceName, portName, serviceUrl);
    //check if this bindingKey is in the service's binding templates
    for (BindingTemplate bindingTemplate : service.getBindingTemplates().getBindingTemplate()) {
      if (bindingKey.equals(bindingTemplate.getBindingKey())) {
        clerk.unRegisterBinding(bindingKey);
        //if this is the last binding for this service, and
        if (service.getBindingTemplates().getBindingTemplate().size()==1 && isRemoveServiceIfNoTemplates) {
          clerk.unRegisterService(serviceKey);
         
          FindTModel findTmodelForProcessName = createFindTModelForProcessName(serviceName);
          TModelList tModelList = clerk.findTModel(findTmodelForProcessName);
          if (tModelList!=null && tModelList.getTModelInfos()!=null && tModelList.getTModelInfos().getTModelInfo()!=null) {
            TModelInfo tModelInfo = tModelList.getTModelInfos().getTModelInfo().get(0);
            String bpel4WSTModelKey = tModelInfo.getTModelKey();
            clerk.unRegisterTModel(bpel4WSTModelKey);
            // now use this key to find the portType TModels
            GetTModelDetail findAllPortTypesForProcess = createFindAllPortTypesForProcess_1(bpel4WSTModelKey);
            TModelDetail tModelDetail = clerk.getTModelDetail(findAllPortTypesForProcess);
            if (tModelDetail!=null) {
              List<TModel> tModelPortTypeList = tModelDetail.getTModel();
              if (tModelPortTypeList!=null && tModelPortTypeList.size()>0) {
                TModel bpel4WSTModel = tModelPortTypeList.get(0);
                CategoryBag categoryBag = bpel4WSTModel.getCategoryBag();
                if (categoryBag!=null && categoryBag.getKeyedReference()!=null) {
                  List<KeyedReference> portTypeTModelKeys = new ArrayList<KeyedReference>();
                  KeyedReference namespaceRef = null;
                  for (KeyedReference keyedReference : categoryBag.getKeyedReference()) {
                    if ("uddi:uddi.org:wsdl:porttypereference".equals(keyedReference.getTModelKey()) ) {
                      portTypeTModelKeys.add(keyedReference);
                    }
                    if ("uddi:uddi.org:xml:namespace".equals(keyedReference.getTModelKey()) ) {
                      namespaceRef = keyedReference;
                    }
                  }
                  String namespace = null;
                  if (namespaceRef!=null) namespace = namespaceRef.getKeyValue();
                  //find the bindingTModel
                  for (KeyedReference keyedReference : portTypeTModelKeys) {
                    FindTModel findBindingTModel = WSDL2UDDI.createFindBindingTModelForPortType(keyedReference.getKeyValue(), namespace);
                    TModelList bindingTmodels = clerk.findTModel(findBindingTModel);
                    if (bindingTmodels!=null && bindingTmodels.getTModelInfos()!=null && bindingTmodels.getTModelInfos().getTModelInfo()!=null) {
                      for (TModelInfo bindingTModelInfo : bindingTmodels.getTModelInfos().getTModelInfo()) {
                        //delete the Binding TModel
                        clerk.unRegisterTModel(bindingTModelInfo.getTModelKey());
                      }
                    }
                    //delete the PortType TModel
                    clerk.unRegisterTModel(keyedReference.getKeyValue())
                  }
                 }
              }
            }
          }
        }
        break;
      }
    }
    return service.getServiceKey()
  }
View Full Code Here

   * @throws TransportException
   */
  public BusinessService lookupService(String serviceKey) throws RemoteException, ConfigurationException, TransportException {
   
    //Checking if this serviceKey already exist
    BusinessService service = clerk.findService(serviceKey);
    return service;
  }
View Full Code Here

   * @return
   */
  public BusinessService createBusinessService(QName serviceName, Definition wsdlDefinition) {
   
    log.debug("Constructing Service UDDI Information for " + serviceName);
    BusinessService service = new BusinessService();
    // BusinessKey
    service.setBusinessKey(businessKey);
    // ServiceKey
    service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart()));
    // Description
    String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
    if (wsdlDefinition.getService(serviceName) !=null) {
      // Override with the service description from the WSDL if present
      Element docElement = wsdlDefinition.getService(serviceName).getDocumentationElement();
      if (docElement!=null && docElement.getTextContent()!=null) {
        serviceDescription = docElement.getTextContent();
      }
    }
    Description description = new Description();
    description.setLang(lang);
    description.setValue(serviceDescription);
    service.getDescription().add(description);
    // Service name
    Name sName = new Name();
    sName.setLang(lang);
    sName.setValue(serviceName.getLocalPart());
    service.getName().add(sName);
   
    //customization to add KeyedReferences into the categoryBag of the service
    if (properties.containsKey(Property.SERVICE_CATEGORY_BAG)) {
      String serviceCategoryBag = properties.getProperty(Property.SERVICE_CATEGORY_BAG);
      log.debug("Adding KeyedReferences '" +  serviceCategoryBag + "' to service " + serviceName.getLocalPart());
      CategoryBag categoryBag = parseCategoryBag(serviceCategoryBag);
          service.setCategoryBag(categoryBag);
    }
   
    return service;
  }
View Full Code Here

         * @param node
         * @return the potentially modified service by the UDDI server or NULL if save failed
         */
        public BusinessService register(BusinessService service, Node node) {

                BusinessService businessService = null;
                if (service.getName().isEmpty()){
                        log.error("Unable to register service, a 'name' element is required");
                        return null;
                }
                log.info("Registering service " + service.getName().get(0).getValue()
View Full Code Here

         * @param serviceKey
         * @return a list of URI endpoints
         */
        public List<String> getEndpoints(String serviceKey) {
                List<String> items = new ArrayList<String>();
                BusinessService serviceDetail = null;
                try {
                        serviceDetail = this.getServiceDetail(serviceKey);
                } catch (Exception ex) {
                        log.error("Unable to fetch the specified service's details", ex);
                }
                if (serviceDetail == null) {
                        return items;
                }

                if (serviceDetail.getBindingTemplates() != null) {
                        for (int k = 0; k < serviceDetail.getBindingTemplates().getBindingTemplate().size(); k++) {
                                try {
                                        items.addAll(ParseBinding(serviceDetail.getBindingTemplates().getBindingTemplate().get(k)));
                                } catch (Exception ex) {
                                        log.warn(ex);
                                }
                        }
                }
View Full Code Here

        BusinessEntity be = new BusinessEntity();
        Name n = new Name();
        n.setValue("A Test business");
        be.getName().add(n);
        be.setBusinessServices(new BusinessServices());
        BusinessService bs = new BusinessService();
        n = new Name();
        n.setValue(str256);
        bs.getName().add(n);
        be.getBusinessServices().getBusinessService().add(bs);

        sb.getBusinessEntity().add(be);
        try {
            BusinessDetail saveBusiness = publication.saveBusiness(sb);
View Full Code Here

        BusinessEntity be = new BusinessEntity();
        Name n = new Name();
        n.setValue("A Test business");
        be.getName().add(n);
        be.setBusinessServices(new BusinessServices());
        BusinessService bs = new BusinessService();
        n = new Name();
        n.setValue(str255);
        bs.getName().add(n);
        be.getBusinessServices().getBusinessService().add(bs);

        sb.getBusinessEntity().add(be);
      
        BusinessDetail saveBusiness = publication.saveBusiness(sb);
View Full Code Here

        BusinessEntity be = new BusinessEntity();
        Name n = new Name();
        n.setValue("A Test business");
        be.getName().add(n);
        be.setBusinessServices(new BusinessServices());
        BusinessService bs = new BusinessService();
        n = new Name();
        n.setValue(str255);
        n.setLang(str26);
        bs.getName().add(n);
        be.getBusinessServices().getBusinessService().add(bs);

        sb.getBusinessEntity().add(be);
       
        BusinessDetail saveBusiness = publication.saveBusiness(sb);
View Full Code Here

        BusinessEntity be = new BusinessEntity();
        Name n = new Name();
        n.setValue("A Test business");
        be.getName().add(n);
        be.setBusinessServices(new BusinessServices());
        BusinessService bs = new BusinessService();
        n = new Name();
        n.setValue(str255);
        n.setLang(str27);
        bs.getName().add(n);
        be.getBusinessServices().getBusinessService().add(bs);

        sb.getBusinessEntity().add(be);
        try {
            BusinessDetail saveBusiness = publication.saveBusiness(sb);
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.