Package javax.xml.registry.infomodel

Examples of javax.xml.registry.infomodel.Service


    registry.findService(TEST_SERVICE_CATEGORY, TEST_SERVICE_NAME + "3");
    Collection services = findMultipleServices(TEST_SERVICE_CATEGORY, TEST_SERVICE_NAME + "3");
    assertEquals(1, services.size());

    for (Iterator iter = services.iterator(); iter.hasNext();) {
      Service s = (Service) iter.next();
      assertEquals(s.getName().getValue(), TEST_SERVICE_NAME+"3");
      assertEquals(s.getDescription().getValue(), TEST_SERVICE_DESC);
      assertEquals(2, s.getServiceBindings().size());
    }
  }
View Full Code Here


    Collection services = findMultipleServices(TEST_SERVICE_CATEGORY, TEST_SERVICE_NAME + "4");
    assertEquals(1, services.size());
   
    boolean foundService = false;
    for (Iterator iter = services.iterator(); iter.hasNext();) {
      Service s = (Service) iter.next();
      if ((TEST_SERVICE_NAME+"4").equals(s.getName().getValue())) {
        assertEquals(s.getName().getValue(), TEST_SERVICE_NAME + "4");
        assertEquals(s.getDescription().getValue(), TEST_SERVICE_DESC);
        assertEquals(2, s.getServiceBindings().size());
        foundService = true;
      }
    }
    assertTrue(foundService);
  }
View Full Code Here

   * @return Service
   * @throws JAXRException
   */
  protected Service registerService(String category, String serviceName, String serviceDescription) throws JAXRException
  {
    Service service =null;
    Organization organization = getJBossESBOrganization();
    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
    try {
      RegistryService rs = connection.getRegistryService();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
      BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
        //Adding the category as prefix for the name
      service = blm.createService(blm.createInternationalString(serviceName));
      if (isV3 && ((serviceDescription == null) || ("".equals(serviceDescription)))) {
        service.setDescription(blm.createInternationalString(SERVICE_DESCRIPTION));
      } else {
        service.setDescription(blm.createInternationalString(serviceDescription));
      }
      ClassificationScheme cScheme = getClassificationScheme(bqm, blm);
            Classification classification = blm.createClassification(cScheme, "category", category);
      service.addClassification(classification);
      organization.addService(service);
      saveRegistryObject(service, jaxrConnectionFactory);
    } finally {
      JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
    }
View Full Code Here

   * @throws ServiceNotFoundException
   */
    public void unRegisterService(String category, String serviceName) throws RegistryException, ServiceNotFoundException{
        //    first find the ServiceBindings for this service
    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
        Service service = null;
        try {
            service = findService(category, serviceName);
            if (service==null) {
                throw new ServiceNotFoundException("No such EPR found for service with name = " + serviceName);
            }
            RegistryService rs = connection.getRegistryService();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            Collection<Key> serviceKeys = new ArrayList<Key>();
            serviceKeys.add(service.getKey());
            blm.deleteServices(serviceKeys);
        } catch (JAXRException je) {
            throw new RegistryException(je.getLocalizedMessage(), je);
        } finally {
      JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
View Full Code Here

    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
        try {
      final Concept jbossTModel = getJBossESBTModel(connection);
   
            //Find the service
            Service service = findService(category,serviceName);
            if (service==null) {
                logger.log(Level.DEBUG, "Service " + serviceName + " does not yet exist, creating now..");
                service = registerService(category, serviceName, serviceDescription);
            }

            RegistryService rs = connection.getRegistryService();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            ServiceBinding serviceBinding = blm.createServiceBinding();
            String xml = EPRHelper.toXMLString(epr);
            serviceBinding.setAccessURI(xml);
           
            ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
            SpecificationLink sl = new SpecificationLinkImpl(blm);
            sl.setSpecificationObject(jbossTModel);
            serviceBinding.getSpecificationLinks().add(sl);
            if (isV3 && ((eprDescription == null) || ("".equals(eprDescription)))) {
               serviceBinding.setDescription(blm.createInternationalString(REGISTERED_BY_JBOSSESB));
            } else {
               serviceBinding.setDescription(blm.createInternationalString(eprDescription));
            }
            serviceBindings.add(serviceBinding);
           
            service.addServiceBindings(serviceBindings);
            ClassificationScheme cScheme = getClassificationScheme(bqm, blm);
            Classification classification = blm.createClassification(cScheme, "category", category);
            service.addClassification(classification);
           
            saveRegistryObject(serviceBinding, jaxrConnectionFactory);
        } catch (JAXRException je) {
            throw new RegistryException(je.getLocalizedMessage(), je);
        } catch (MarshalException me) {
View Full Code Here

   * @throws ServiceNotFoundException
   */
  public void unRegisterEPR(String category, String serviceName, EPR toBeDeletedEPR) throws RegistryException, ServiceNotFoundException{
        //first find the ServiceBindings for this service
    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
        Service service = null;
        try {
            service = findService(category, serviceName);
            if (service==null) {
                throw new ServiceNotFoundException("No such Service found for service with category= "
                        + category + " and name = " + serviceName);
View Full Code Here

    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
    try {
      final Concept jbossTModel = getJBossESBTModel(connection);

      Service service = findService(category, serviceName);
      if (service==null){
                throw new ServiceNotFoundException("Could not find service with category=" + category + " and serviceName=" + serviceName);
      }
      // Get registry service and business query manager
      Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
View Full Code Here

        EPR epr = null ;
    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
        try {
      final Concept jbossTModel = getJBossESBTModel(connection);

            Service service = findService(category, serviceName);
            if (service==null){
                throw new ServiceNotFoundException("Could not find service with category=" + category + " and serviceName=" + serviceName);
            }
            // Get registry service and business query manager
            Collection<ServiceBinding> serviceBindings = findServiceBindings(service);
View Full Code Here

          namePatterns, classifications, specifications);
      if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
        if (response.getCollection().size() <= 1) {
          for (Iterator servIter = response.getCollection().iterator(); servIter.hasNext();)
          {
            Service service = (Service) servIter.next();
            logger.log(Level.DEBUG, "Service name: " + service.getName().getValue());
            if (service.getDescription()!=null) {
              logger.log(Level.DEBUG, "Description: " + service.getDescription().getValue());
            }
            return service;
          }         
        } else {
          logger.log(Level.ERROR, "Found " + response.getCollection().size()
              + " Services, while expecting only one by the name of "
              + serviceName + " in category " + category);

         
          ArrayList services = new ArrayList<Service>();
          for (Iterator servIter = response.getCollection().iterator(); servIter.hasNext();)
          {
            Service service = (Service) servIter.next();
            services.add(service);
          }
          return coalesceServices(services, connection);
        }
      }
View Full Code Here

  @SuppressWarnings("unchecked")
  protected Service coalesceServices(List<Service> services, Connection connection)
    throws JAXRException {
    logger.error("begin coalesceServices");

    Service aggService = null;
    Hashtable eprHash = new Hashtable();
   
    for (Service s : services) {
      if (aggService == null) {
        aggService = s;
View Full Code Here

TOP

Related Classes of javax.xml.registry.infomodel.Service

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.