Package org.apache.juddi.v3.client.config

Examples of org.apache.juddi.v3.client.config.XRegistration


public class UDDIClerkManagerTest {
 
     @Test
     public void testReadingTheConfig() {
       try {
         UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(null);
         manager.start();
         manager.getClientConfig().getUDDINode("default");
         assertEquals(2,manager.getClientConfig().getUDDIClerks().size());
         Thread.sleep(500);
         manager.stop();
       } catch (Exception e) {
         //we should not have any issues reading the config
           e.printStackTrace();
           Assert.fail();
       }
View Full Code Here


     }
    
     @Test
     public void testMultipleClientConfigFiles() {
       try {
         UDDIClerkManager manager = new UDDIClerkManager("META-INF/uddi.xml");
         manager.start();
       assertEquals("test-manager", manager.getName());
      
         UDDIClerkManager manager2 = new UDDIClerkManager("META-INF/uddi2.xml");
         manager2.start();
       assertEquals("second-manager", manager2.getName());
       Thread.sleep(500);
       manager.stop();
       manager2.stop();
      
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      Assert.fail("No exceptions are expected");
View Full Code Here

     }
    
     @Test
     public void testDefaultConfigFile() {
       try {
         UDDIClerkManager manager = new UDDIClerkManager(null);
         //We're expecting the manager defined in the META-INF/uddi.xml file.
         manager.start();
       assertEquals("test-manager", manager.getName());
       Thread.sleep(500);
       manager.stop();
      
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      Assert.fail("No exceptions are expected");
View Full Code Here

    logger.debug("Publisher " + publisher + " sending getSubscription request..");
    try {
      boolean isMatchingClerk=false;
      UDDIClerk toClerk = null;
      UDDIClerkManager manager = WebHelper.getUDDIClerkManager(session.getServletContext());
      UDDINode homeNode = WebHelper.getUDDIHomeNode(session.getServletContext());
      Map<String, UDDIClerk> clerks = manager.getClientConfig().getUDDIClerks();
      for (UDDIClerk clerk : clerks.values()) {
        if (publisher.equals(clerk.getPublisher())
            && homeNode.getName().equals(clerk.getUDDINode().getName())) {
          toClerk = clerk;
        }
      }
      for (UDDIClerk clerk : clerks.values()) {
        if (publisher.equals(clerk.getPublisher())) {
View Full Code Here

  }

  private Node getSubscriptions(HttpSession session, UDDIClerk clerk, UDDIClerk toClerk) {

    Node modelNode = new Node();
    UDDINode node = clerk.getUDDINode();
    modelNode.setName(node.getName());
    modelNode.setClerkName(clerk.getName());
    modelNode.setDescription(node.getDescription());
    try {
      UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(clerk.getManagerName());
      String clazz = manager.getClientConfig().getUDDINode(clerk.getUDDINode().getName()).getProxyTransport();
      Class<?> transportClass = ClassUtil.forName(clazz, Transport.class);
      Transport transport = (Transport) transportClass.getConstructor(String.class,String.class).newInstance(clerk.getManagerName(),clerk.getUDDINode().getName())
View Full Code Here

    logger.info("Sending saveSubscriptions request..");
    try {
      //before sending this we need to ready the listener node
      UDDIClerkManager manager = WebHelper.getUDDIClerkManager(session.getServletContext());
      UDDINode homeNode = WebHelper.getUDDIHomeNode(session.getServletContext());
      UDDIClerk clerk = manager.getClientConfig().getUDDIClerks().get(modelSubscription.getFromClerkName());
      UDDIClerk toClerk = manager.getClientConfig().getUDDIClerks().get(modelSubscription.getToClerkName());
      if (toClerk==null) {
        String publisher = (String) session.getAttribute("UserName");
        Map<String, UDDIClerk> clerks = manager.getClientConfig().getUDDIClerks();
        for (UDDIClerk uddiClerk : clerks.values()) {
          if (publisher.equals(uddiClerk.getPublisher())
              && homeNode.getName().equals(uddiClerk.getUDDINode().getName())) {
            toClerk = uddiClerk;
          }
        }
      }
     
View Full Code Here

  public static void handle(Clerk fromClerk, Clerk toClerk, SubscriptionResultsList list) {
   
    if (list.getServiceList()!=null) {
      for (ServiceInfo serviceInfo : list.getServiceList().getServiceInfos().getServiceInfo() ) {
        serviceInfo.getBusinessKey();
        new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
        new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterService();
      }
    }
   
  }
View Full Code Here

          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
    //SERVICE DETAIL
    if (list.getServiceDetail()!=null) {
      log.info("Subscription result for ServiceDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      ServiceDetail serviceDetail = list.getServiceDetail();
      if (serviceDetail.isTruncated()) {
        log.info("The serviceDetail is truncated, the maxEntries must have been hit. The number of services is " + serviceDetail.getBusinessService().size());
      }
      for (BusinessService service : serviceDetail.getBusinessService()) {
        BusinessEntity existingBusinessEntity = null;
        try {
          if (existingBusinessEntity==null) {
            existingBusinessEntity = uddiToClerk.findBusiness(service.getBusinessKey(), toClerk.getNode());
          }
          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(service.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(service.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
   
    //BUSINESS LIST
    if (list.getBusinessList()!=null) {
      log.info("Subscription result for BusinessList with subscription key=" + list.getSubscription().getSubscriptionKey());
      for (BusinessInfo businessInfo : list.getBusinessList().getBusinessInfos().getBusinessInfo()) {
        new XRegistration(businessInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //BUSINESS DETAIL
    if (list.getBusinessDetail()!=null) {
      log.info("Subscription result for BusinessDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BusinessDetail businessDetail = list.getBusinessDetail();
      if (businessDetail.isTruncated()) {
        log.info("The businessDetail is truncated, the maxEntries must have been hit. The number of businesses is " + businessDetail.getBusinessEntity().size());
      }
      for (BusinessEntity businessEntity : businessDetail.getBusinessEntity()) {
        new XRegistration(businessEntity.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //KEY BAG, NOT IMPLEMENTED
    if (list.getKeyBag()!=null) {
      log.info("Returning results when a 'brief' format is selected, please do not use 'brief' results when using the XRegistration functionality");
    }
   
    //BINDING DETAIL
    if (list.getBindingDetail()!=null) {
      log.info("Subscription result for BindingDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BindingDetail bindingDetail = list.getBindingDetail();
      if (bindingDetail.isTruncated()) {
        log.info("The bindingDetail is truncated, the maxEntries must have been hit. The number of bindings is " + bindingDetail.getBindingTemplate().size());
      }
      for (BindingTemplate bindingTemplate : bindingDetail.getBindingTemplate()) {
        try {
          //check if the service exist
          BusinessService existingToService = uddiToClerk.findService(bindingTemplate.getServiceKey(), toClerk.getNode());
          if (existingToService!=null) {
            log.debug("Found service with key " +  existingToService.getServiceKey() + ". No need to add it again");
          } else {
            BusinessService fromService = uddiFromClerk.findService(bindingTemplate.getServiceKey(), fromClerk.getNode());
            fromService.getBusinessKey();
            //check if the business exist
            BusinessEntity existingBusinessEntity = uddiToClerk.findBusiness(fromService.getBusinessKey(), toClerk.getNode());
            if (existingBusinessEntity!=null) {
              log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
            } else {
              log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                  + ", going to add it in.");
              new XRegistration(fromService.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
            }
            log.info("Service was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(fromService.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterService();
          }
          //now the service exists in the toNode and we can add this binding
          new XRegistration(bindingTemplate.getBindingKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceBinding();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
View Full Code Here

          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
    //SERVICE DETAIL
    if (list.getServiceDetail()!=null) {
      log.info("Subscription result for ServiceDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      ServiceDetail serviceDetail = list.getServiceDetail();
      if (serviceDetail.isTruncated()) {
        log.info("The serviceDetail is truncated, the maxEntries must have been hit. The number of services is " + serviceDetail.getBusinessService().size());
      }
      for (BusinessService service : serviceDetail.getBusinessService()) {
        BusinessEntity existingBusinessEntity = null;
        try {
          if (existingBusinessEntity==null) {
            existingBusinessEntity = uddiToClerk.findBusiness(service.getBusinessKey(), toClerk.getNode());
          }
          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(service.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(service.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
   
    //BUSINESS LIST
    if (list.getBusinessList()!=null) {
      log.info("Subscription result for BusinessList with subscription key=" + list.getSubscription().getSubscriptionKey());
      for (BusinessInfo businessInfo : list.getBusinessList().getBusinessInfos().getBusinessInfo()) {
        new XRegistration(businessInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //BUSINESS DETAIL
    if (list.getBusinessDetail()!=null) {
      log.info("Subscription result for BusinessDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BusinessDetail businessDetail = list.getBusinessDetail();
      if (businessDetail.isTruncated()) {
        log.info("The businessDetail is truncated, the maxEntries must have been hit. The number of businesses is " + businessDetail.getBusinessEntity().size());
      }
      for (BusinessEntity businessEntity : businessDetail.getBusinessEntity()) {
        new XRegistration(businessEntity.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //KEY BAG, NOT IMPLEMENTED
    if (list.getKeyBag()!=null) {
      log.info("Returning results when a 'brief' format is selected, please do not use 'brief' results when using the XRegistration functionality");
    }
   
    //BINDING DETAIL
    if (list.getBindingDetail()!=null) {
      log.info("Subscription result for BindingDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BindingDetail bindingDetail = list.getBindingDetail();
      if (bindingDetail.isTruncated()) {
        log.info("The bindingDetail is truncated, the maxEntries must have been hit. The number of bindings is " + bindingDetail.getBindingTemplate().size());
      }
      for (BindingTemplate bindingTemplate : bindingDetail.getBindingTemplate()) {
        try {
          //check if the service exist
          BusinessService existingToService = uddiToClerk.findService(bindingTemplate.getServiceKey(), toClerk.getNode());
          if (existingToService!=null) {
            log.debug("Found service with key " +  existingToService.getServiceKey() + ". No need to add it again");
          } else {
            BusinessService fromService = uddiFromClerk.findService(bindingTemplate.getServiceKey(), fromClerk.getNode());
            fromService.getBusinessKey();
            //check if the business exist
            BusinessEntity existingBusinessEntity = uddiToClerk.findBusiness(fromService.getBusinessKey(), toClerk.getNode());
            if (existingBusinessEntity!=null) {
              log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
            } else {
              log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                  + ", going to add it in.");
              new XRegistration(fromService.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
            }
            log.info("Service was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(fromService.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterService();
          }
          //now the service exists in the toNode and we can add this binding
          new XRegistration(bindingTemplate.getBindingKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceBinding();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
View Full Code Here

          if (existingEntity!=null) {
            log.info("Found business with key " +  existingEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterService();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.juddi.v3.client.config.XRegistration

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.