Package javax.xml.registry

Examples of javax.xml.registry.BulkResponse


      getJAXREssentials();
      Collection orgs = new ArrayList();
      Organization org = createOrganization("JBOSS");

      orgs.add(org);
      BulkResponse br = blm.saveOrganizations(orgs);
      if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
      {
         log.debug("Organization Saved");
         Collection coll = br.getCollection();
         Iterator iter = coll.iterator();
         while (iter.hasNext())
         {
            Key key = (Key)iter.next();
            keyid = key.getId();
            log.debug("Saved Key=" + key.getId());
            assertNotNull(keyid);
         }//end while
      }
      else
      {
         log.error("JAXRExceptions " + "occurred during save:");
         Collection exceptions = br.getExceptions();
         Iterator iter = exceptions.iterator();
         while (iter.hasNext())
         {
            Exception e = (Exception)iter.next();
            log.error(e.toString());
View Full Code Here


      getJAXREssentials();
      Collection orgs = new ArrayList();
      Organization org = createOrganization("JBOSS");

      orgs.add(org);
      BulkResponse br = blm.saveOrganizations(orgs);
      if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
      {
         Collection coll = br.getCollection();
         Iterator iter = coll.iterator();
         while (iter.hasNext())
         {
            Key key = (Key)iter.next();
            keyid = key.getId();
            assertNotNull(keyid);
            orgKey = key;
         }//end while
      }
      else
      {
         Collection exceptions = br.getExceptions();
         Iterator iter = exceptions.iterator();
         while (iter.hasNext())
         {
            Exception e = (Exception)iter.next();
            fail(e.toString());
View Full Code Here

      Collection<String> findQualifiers = new ArrayList<String>();
      findQualifiers.add(FindQualifier.AND_ALL_KEYS);
      findQualifiers.add(FindQualifier.EXACT_NAME_MATCH);
      findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
      logger.log(Level.DEBUG, "Going to query the registry for name pattern " + namePatterns);
      BulkResponse response = bqm.findServices(null, findQualifiers,
          namePatterns, classifications, specifications);
      if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
        return response.getCollection();
      } else {
        throw new RegistryException();
      }
    } finally {
      jaxrConnectionFactory.closeConnection(connection);
View Full Code Here

      String name=classificationScheme.getName().getValue();
      logger.debug("Name=" + name);
      Collection<String> nameParams = new ArrayList<String>();
      //The name of the service is wild
      nameParams.add("%");
      BulkResponse bs = bqm.findServices(null, null,nameParams,classifications, null);
      int status = bs.getStatus();
      logger.debug("status=" + status);
    } catch (JAXRException je) {
      logger.error(je);
    }
    finally{
View Full Code Here

      } else {
        namePatterns.add("%" + organizationName + "%");
      }
          //Find based upon qualifier type and values
      logger.log(Level.DEBUG,"Going to query the registry for name pattern " + namePatterns);
      BulkResponse response = bqm.findOrganizations(findQualifiers,
          namePatterns, null, null, null, null);
      if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
        for (Iterator orgIter = response.getCollection().iterator(); orgIter.hasNext();)
        {
          Organization org = (Organization) orgIter.next();
          logger.log(Level.DEBUG, "Organization name: " + org.getName().getValue());
          logger.log(Level.DEBUG, "Description: " + org.getDescription().getValue());
          logger.log(Level.DEBUG, "Key id: " + org.getKey().getId());
          User primaryContact = org.getPrimaryContact();
          logger.log(Level.DEBUG, "Primary Contact: " + primaryContact.getPersonName().getFullName());
          if (orgIter.hasNext()) {
            logger.log(Level.ERROR, "Found " + response.getCollection().size()
                + " Organization, while expecting only one of name " + organizationName);
          }
          return org;
        }
      }
View Full Code Here

      Collection<String> findQualifiers = new ArrayList<String>();
      findQualifiers.add(FindQualifier.AND_ALL_KEYS);
      findQualifiers.add(FindQualifier.EXACT_NAME_MATCH);
      findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
      logger.log(Level.DEBUG, "Going to query the registry for name pattern " + namePatterns);
      BulkResponse response = bqm.findServices(null, findQualifiers,
          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

      findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
      Collection<Classification> classifications = new ArrayList<Classification>();
            classifications.add(classification);
          //Find based upon qualifier type and values
      logger.log(Level.DEBUG, "Going to query the registry for classification " + classifications);
      BulkResponse response = bqm.findServices(null, findQualifiers,
          null, classifications, null);
      if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
        services = (Collection<Service>) response.getCollection();
      }
      return services;
    } finally {
      JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
    }
View Full Code Here

                namePatterns.add(orgCategory);
            } else {
              namePatterns.add("%" + orgCategory + "%");
            }
           
            BulkResponse response = bqm.findConcepts(findQualifiers, namePatterns, null, null, null);
      if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
        Collection<RegistryObject> regs = (Collection<RegistryObject>) response.getCollection();
        Iterator<RegistryObject> orgIter = regs.iterator();
        if (orgIter.hasNext())
        {
          jbossTModelXXX = (Concept) orgIter.next();
        }
View Full Code Here

  {
//    Getting the connection to the Registry (reading config)
    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
    try {

      BulkResponse br = null;
      //Logging in
      RegistryService rs = connection.getRegistryService();
      //Building organization
      BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();

      final String interfaceName ;
      if (registryObject instanceof Organization) {
        interfaceName = Organization.class.getCanonicalName() ;
        Collection<Organization> orginations = new ArrayList<Organization>();
       
        orginations.add((Organization) registryObject);
        br = blm.saveOrganizations(orginations);
      } else if (registryObject instanceof Service) {
        interfaceName = Organization.class.getCanonicalName() ;
        Collection<Service> services = new ArrayList<Service>();
        services.add((Service) registryObject);
        br = blm.saveServices(services);
      } else if (registryObject instanceof ServiceBinding) {
        interfaceName = Organization.class.getCanonicalName() ;
        Collection<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
        serviceBindings.add((ServiceBinding) registryObject);
        br = blm.saveServiceBindings(serviceBindings);
      } else {
        logger.log(Level.ERROR, "Trying to save an unsupported RegistryObject");
        throw new JAXRException("Trying to save an unsupported RegistryObject");
      }
            //Verify the return
      if (br!=null && br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
        logger.log(Level.DEBUG, interfaceName + " successfully saved");
        Collection coll = br.getCollection();
        Iterator iter = coll.iterator();
        while (iter.hasNext()) {
          Key key = (Key) iter.next();
          registryObject.setKey(key);
          logger.log(Level.DEBUG, "Saved Key=" + key.getId());
        }
      } else {
        logger.log(Level.ERROR, "Errors occurred during save.");
        if (br!=null) {
          Collection exceptions = br.getExceptions();
          if (exceptions != null) {
            Iterator iter = exceptions.iterator();
            StringBuilder errors = new StringBuilder();
            JAXRException je = new JAXRException("JAXRExceptions occurred during save");
            while (iter.hasNext()) {
              Exception e = (Exception) iter.next();
              errors.append(e.getLocalizedMessage()).append("\n");
              je.setStackTrace(e.getStackTrace());
              logger.log(Level.ERROR, e.getLocalizedMessage(), e);
              //if it's the last error, throw it now and set the current stacktrace
              if (!iter.hasNext()) {
                throw new JAXRException(errors.toString(), e);
              }
            }
          }
          throw new JAXRException("Errors occurred during save. Response status=" + br.getStatus());
        }
        throw new JAXRException("Errors occurred during save");
      }
    } finally {
      JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
View Full Code Here

      findQualifiers.add(FindQualifier.EXACT_NAME_MATCH);
      findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
      ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, JBOSS_ESB_CATEGORY);
      // If the scheme returned null, then we have to create a org.jboss.soa.esb.:category scheme to use
      if (cScheme == null) {
        BulkResponse br = null;
        try {
          ClassificationScheme scheme = blm.createClassificationScheme(JBOSS_ESB_CATEGORY, JBOSS_ESB_CATEGORY);
          ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>();
          cSchemes.add(scheme);
          br = blm.saveClassificationSchemes(cSchemes);
         
          if (br!=null && br.getStatus() != JAXRResponse.STATUS_SUCCESS) {
            throw new JAXRException("Tried to saveClassificationsSchemes, got result "
                + br.getStatus());
          }

        } catch (Exception e) {
          throw new JAXRException(e);
        }
View Full Code Here

TOP

Related Classes of javax.xml.registry.BulkResponse

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.