Package org.uddi.api_v2

Examples of org.uddi.api_v2.TModel


        //Register a tModel for each portType
        for (QName qName : bindings.keySet()) {
            String localpart = qName.getLocalPart();
            String namespace = qName.getNamespaceURI();
            // Build the tModel
            TModel tModel = new TModel();
            // Set the Key
            tModel.setTModelKey(keyDomainURI + localpart);
            // Set the Name
            Name name = new Name();
            name.setLang(lang);
            name.setValue(localpart);
            tModel.setName(name);
            // Set the OverviewURL
            OverviewURL overviewURL = new OverviewURL();
            overviewURL.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
            overviewURL.setValue(wsdlURL);
            OverviewDoc overviewDoc = new OverviewDoc();
            overviewDoc.setOverviewURL(overviewURL);
            tModel.getOverviewDoc().add(overviewDoc);
            // Set the categoryBag
            CategoryBag categoryBag = new CategoryBag();

            if (namespace != null && !"".equals(namespace)) {
                // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                KeyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
                categoryBag.getKeyedReference().add(namespaceReference);
            }

            // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
            KeyedReference typesReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding");
            categoryBag.getKeyedReference().add(typesReference);

            // A keyedReference with a tModelKey of the WSDL portType Reference category system and a keyValue
            // of the tModelKey that models the wsdl:portType to which the wsdl:binding relates.
            Binding binding = bindings.get(qName);
            String portTypeKey = keyDomainURI + binding.getPortType().getQName().getLocalPart();
            KeyedReference namespaceReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference",
                    portTypeKey);
            categoryBag.getKeyedReference().add(namespaceReference);

            //  A keyedReference with a tModelKey of the UDDI Types category system and a keyValue of
            // "wsdlSpec" for backward compatibility.
            KeyedReference typesReferenceBackwardsCompatible = newKeyedReference(
                    "uddi:uddi.org:categorization:types", "uddi-org:types", "wsdlSpec");
            categoryBag.getKeyedReference().add(typesReferenceBackwardsCompatible);

            // One or two keyedReferences as required to capture the protocol
            for (Object object : binding.getExtensibilityElements()) {
                if (SOAPBinding.class.isAssignableFrom(object.getClass())) {
                    // If the wsdl:binding contains a soap:binding extensibility element from the
                    // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                    //include a keyedReference with a tModelKey of the Protocol Categorization
                    // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.
                    SOAPBinding soapBinding = (SOAPBinding) object;
                    KeyedReference soapProtocol = newKeyedReference(
                            "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                    categoryBag.getKeyedReference().add(soapProtocol);
                    // If the value of the transport attribute of the soap:binding element
                    // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                    // include a keyedReference with a tModelKey of the Transport Categorization
                    // category system and a keyValue of the tModelKey of the HTTP Transport tModel.
                    if ("http://schemas.xmlsoap.org/soap/http".equals(soapBinding.getTransportURI())) {
                        KeyedReference httpTransport = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                        categoryBag.getKeyedReference().add(httpTransport);
                    } else if (soapBinding.getTransportURI() != null) {
                        // TODO If the value of the transport attribute is anything else,
                        // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                        // of the Transport Categorization category system and a keyValue of the tModelKey of
                        // an appropriate transport tModel.
                        log.warn("not implemented");
                    }


                } else if (object.getClass().isInstance(HTTPBinding.class)) {

                    // If the wsdl:binding contains an http:binding extensibility element from the
                    // http://schemas.xmlsoap.org/wsdl/http/ namespace then the categoryBag MUST
                    // include a keyedReference with a tModelKey of the Protocol Categorization
                    // category system and a keyValue of the tModelKey of the HTTP Protocol tModel.
                    KeyedReference soapProtocol = newKeyedReference(
                            "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:http", "uddi:uddi.org:protocol:http");
                    categoryBag.getKeyedReference().add(soapProtocol);
                }
            }


            tModel.setCategoryBag(categoryBag);
            tModels.add(tModel);
        }
        return tModels;
    }
View Full Code Here


    public Set<TModel> createWSDLPortTypeTModels(String wsdlURL, Map<QName, PortType> portTypes) throws WSDLException {
        Set<TModel> tModels = new HashSet<TModel>();
        // Create a tModel for each portType
        for (QName qName : portTypes.keySet()) {
            // Build the tModel
            TModel tModel = new TModel();
            String localpart = qName.getLocalPart();
            String namespace = qName.getNamespaceURI();
            // Set the Key
            tModel.setTModelKey(keyDomainURI + localpart);
            // Set the Name. The uddi:name element of the tModel MUST be the value of
            // the name attribute of the wsdl:portType.
            Name name = new Name();
            name.setLang(lang);
            name.setValue(localpart);
            tModel.setName(name);
            // Set the OverviewURL. The tModel MUST contain an overviewDoc with an
            // overviewURL containing the location of the WSDL document that
            // describes the wsdl:portType.
            OverviewURL overviewURL = new OverviewURL();
            overviewURL.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
            overviewURL.setValue(wsdlURL);
            OverviewDoc overviewDoc = new OverviewDoc();
            overviewDoc.setOverviewURL(overviewURL);
            tModel.getOverviewDoc().add(overviewDoc);
            // Create the categoryBag, The tModel MUST contain a categoryBag
            CategoryBag categoryBag = new CategoryBag();

            // the categoryBag MUST contain a keyedReference with a tModelKey of the WSDL
            // Entity Type category system and a keyValue of "portType".
            KeyedReference typesReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "portType");
            categoryBag.getKeyedReference().add(typesReference);

            // If the wsdl:portType has a targetNamespace then the categoryBag MUST also contain an
            // additional keyedReference with a tModelKey of the XML Namespace category system and a
            // keyValue of the target namespace of the wsdl:definitions element that contains the
            // wsdl:portType. If the targetNamespace is absent from the portType, a categoryBag
            // MUST NOT contain a keyedReference to the XML Namespace category system.
            if (namespace != null && !"".equals(namespace)) {
                KeyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
                categoryBag.getKeyedReference().add(namespaceReference);
            }

            tModel.setCategoryBag(categoryBag);
            tModels.add(tModel);
        }
        return tModels;
    }
View Full Code Here

      tModels.addAll(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
      // Create the Binding tModels
      Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
      tModels.addAll(createWSDLBindingTModels(genericWSDLURL, bindings));
      // Create the BPEL4WS tModel
      TModel bpel4WSTModel = createBPEL4WSProcessTModel(serviceName, targetNamespace, portTypes, bpelOverviewURL);
        tModels.add(bpel4WSTModel);
        // Register these tModels
        for (TModel tModel : tModels) {
        clerk.register(tModel);
      }
View Full Code Here

            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()) ) {
View Full Code Here

   * @param portTypes
   * @param bpelOverviewURL
   * @return
   */
    public TModel createBPEL4WSProcessTModel(QName serviceName, String targetNamespace, Map<QName,PortType> portTypes, String bpelOverviewURL) {
      TModel tModel = new TModel();
      // Set the Key
      tModel.setTModelKey(keyDomainURI + serviceName.getLocalPart() + "Process");
      // Set the Name
      Name name = new Name();
      name.setLang("en");
      name.setValue(serviceName.getLocalPart());
      tModel.setName(name);
      // Set the OverviewURL
      OverviewURL overviewURL = new OverviewURL();
      overviewURL.setValue("http://localhost:8080/bpel-console/"); //should point to the bpel of this process, maybe in guvnor
      OverviewDoc overviewDoc = new OverviewDoc();
      overviewDoc.setOverviewURL(overviewURL);
      tModel.getOverviewDoc().add(overviewDoc);
      // Set the categoryBag
      CategoryBag categoryBag = new CategoryBag();
     
      if (targetNamespace!=null) {
        KeyedReference namespaceReference = WSDL2UDDI.newKeyedReference(
          "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", targetNamespace);
        categoryBag.getKeyedReference().add(namespaceReference);
      }
      KeyedReference typesReference = WSDL2UDDI.newKeyedReference(
          "uddi:uddi.org:bpel:types", "uddi-org:bpel:types", "process");
      categoryBag.getKeyedReference().add(typesReference);
      for (QName qName : portTypes.keySet()) {
        String portTypeKey = keyDomainURI + qName.getLocalPart();
        KeyedReference portTypeReference = WSDL2UDDI.newKeyedReference(
            "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference", portTypeKey);
        categoryBag.getKeyedReference().add(portTypeReference);
      }
     
      tModel.setCategoryBag(categoryBag);
     
      if (log.isDebugEnabled()) {
        log.debug(new PrintUDDI<TModel>().print(tModel));
      }
     
View Full Code Here

                //first some setup
                reset();
               
               
               
                TModel createKeyGenator = UDDIClerk.createKeyGenator("somebusiness", "A test key domain SubscriptionCallbackTest1", "SubscriptionCallbackTest1");
                Assert.assertNotNull(createKeyGenator);
                clerk.register(createKeyGenator);
                logger.info("Registered tModel keygen: " + createKeyGenator.getTModelKey());

                //setup the business to attach to
                BusinessEntity be = new BusinessEntity();
                be.setBusinessKey("uddi:somebusiness:somebusinesskey");
                be.getName().add(new Name("somebusiness SubscriptionCallbackTest1", null));
                be.setBusinessServices(new BusinessServices());
                BusinessService bs = new BusinessService();
                bs.setBusinessKey("uddi:somebusiness:somebusinesskey");
                bs.setServiceKey("uddi:somebusiness:someservicekey");
                bs.getName().add(new Name("service SubscriptionCallbackTest1", null));
                be.getBusinessServices().getBusinessService().add(bs);
                BusinessEntity register = clerk.register(be);
                logger.info("Registered business keygen: " + register.getBusinessKey());

                //start up our listener
                BindingTemplate start = SubscriptionCallbackListener.start(manager, "default");
                Assert.assertNotNull(start);

                if (TckCommon.isDebug()) {
                        PrintUDDI<BindingTemplate> p = new PrintUDDI<BindingTemplate>();
                        logger.info(p.print(start));
                }

                //register for callbacks
                SubscriptionCallbackListener.registerCallback(this);

                Subscription sub = new Subscription();

                sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
                sub.setBindingKey(start.getBindingKey());
                sub.setSubscriptionFilter(new SubscriptionFilter());
                sub.getSubscriptionFilter().setFindBusiness(new FindBusiness());
                sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());
                sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
                sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));

                Subscription subscription = clerk.register(sub, clerk.getUDDINode().getApiNode());
                if (TckCommon.isDebug()) {
                        PrintUDDI<Subscription> p2 = new PrintUDDI<Subscription>();
                        logger.info(p2.print(subscription));
                }
                Assert.assertNotNull(subscription);
                Assert.assertNotNull(subscription.getBindingKey());
                Assert.assertNotNull(subscription.getSubscriptionKey());
                logger.info("Registered subscription key: " + (subscription.getSubscriptionKey()) + " bindingkey: " + subscription.getBindingKey());

                //fetch the business just to verify binding registration
                BusinessEntity businessDetail = clerk.getBusinessDetail("uddi:somebusiness:somebusinesskey");
                Assert.assertNotNull(businessDetail);
                Assert.assertNotNull(businessDetail.getBusinessKey());
                Assert.assertNotNull(businessDetail.getBusinessServices());
                Assert.assertNotNull(businessDetail.getBusinessServices().getBusinessService().get(0));
                Assert.assertNotNull(businessDetail.getBusinessServices().getBusinessService().get(0).getBindingTemplates());
                Assert.assertNotNull(businessDetail.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0));
                if (TckCommon.isDebug()) {
                        PrintUDDI<BusinessEntity> p2 = new PrintUDDI<BusinessEntity>();
                        logger.info(p2.print(businessDetail));
                }

                //trigger the callback
                BusinessEntity trigger = new BusinessEntity();
                trigger.getName().add(new Name("somebusiness trigger SubscriptionCallbackTest1", null));
                BusinessEntity triggered = clerk.register(trigger);
                //wait up to 30 seconds or until we get something
                long wait = TckPublisher.getSubscriptionTimeout();
                while (wait > 0 && notifications == 0) {
                        Thread.sleep(1000);
                        System.out.print(".");
                        wait--;
                }

                logger.info("Callback check." + notifications);
                //Thread.sleep(2000);
                SubscriptionCallbackListener.stop(manager, "default", start.getBindingKey());
                clerk.unRegisterSubscription(subscription.getSubscriptionKey());
                clerk.unRegisterTModel(createKeyGenator.getTModelKey());

                clerk.unRegisterBusiness(triggered.getBusinessKey());
                clerk.unRegisterBusiness(businessDetail.getBusinessKey());
                //verify
                logger.info("Callback check." + notifications);
View Full Code Here

    // Reading the WSDL
    Definition wsdlDefinition = rw.readWSDL("bpel/bpel-technote.wsdl");
   
      @SuppressWarnings("unchecked")
    Map<QName,PortType> portTypes= (Map<QName,PortType>) wsdlDefinition.getAllPortTypes();
      TModel bpel4WSTModel = bpel2UDDI.createBPEL4WSProcessTModel(serviceName, targetNamespace, portTypes, bpelOverViewUrl);
     
    System.out.println("***** BPEL4WS Process TModel: " + bpel4WSTModel.getName().getValue());
                if (serialize)
    System.out.println(pTModel.print(bpel4WSTModel));
   
    Assert.assertNotNull(bpel4WSTModel);
  }
View Full Code Here

    // Reading the WSDL
    Definition wsdlDefinition = rw.readWSDL("bpel/HelloWorld.wsdl");
   
      @SuppressWarnings("unchecked")
    Map<QName,PortType> portTypes= (Map<QName,PortType>) wsdlDefinition.getAllPortTypes();
      TModel bpel4WSTModel = bpel2UDDI.createBPEL4WSProcessTModel(serviceName, targetNamespace, portTypes, bpelOverViewUrl);
     
    System.out.println("***** BPEL4WS Process TModel: " + bpel4WSTModel.getName().getValue());
                if (serialize)
    System.out.println(pTModel.print(bpel4WSTModel));
   
    Assert.assertNotNull(bpel4WSTModel);
  }
View Full Code Here

                logger.info("Fetching " + httpGet.getURI());
                HttpResponse response = client.execute(httpGet);
               
                Assert.assertTrue(response.getStatusLine().getStatusCode() == 200);
                logger.info("Response content: " + response.getEntity().getContent());
                TModel unmarshal = JAXB.unmarshal(response.getEntity().getContent(), TModel.class);
                client.getConnectionManager().shutdown();
                Assert.assertNotNull(unmarshal);
                Assert.assertEquals(unmarshal.getTModelKey(), findTModel.getTModelInfos().getTModelInfo().get(0).getTModelKey());


        }
View Full Code Here

        public static org.uddi.api_v3.TModel MapTModel(org.uddi.api_v2.TModel be) {
                if (be == null) {
                        return null;
                }
                TModel item = new org.uddi.api_v3.TModel();
                item.setTModelKey(be.getTModelKey());
                item.setName(new Name(be.getName().getValue(), be.getName().getLang()));
                item.setCategoryBag(MapCategoryBag(be.getCategoryBag()));
                item.setIdentifierBag(MapIdentBag(be.getIdentifierBag()));
                item.getDescription().addAll(MapDescription(be.getDescription()));
                OverviewDoc MapOverviewDoc = MapOverviewDoc(be.getOverviewDoc());
                if (MapOverviewDoc != null) {
                        item.getOverviewDoc().add(MapOverviewDoc);
                }
                return item;
        }
View Full Code Here

TOP

Related Classes of org.uddi.api_v2.TModel

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.