Package javax.xml.registry

Examples of javax.xml.registry.Connection


                    "juddi".toCharArray());
            Set creds = new HashSet();
            creds.add(passwdAuth);
            ConnectionFactory factory = ConnectionFactoryImpl.newInstance();
            factory.setProperties(prop);
            Connection conn = factory.createConnection();
            if (conn == null) System.out.println("No Connection");
            conn.setCredentials(creds);
        } catch (Exception e) {
            e.printStackTrace();
        }//end catch
    }//end main
View Full Code Here


    public void testCreateConnection() throws JAXRException {
        Properties properties = new Properties();
        properties.setProperty(ConnectionFactoryImpl.QUERYMANAGER_PROPERTY, "http://localhost");
        properties.setProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY , "http://localhost");
        factory.setProperties(properties);
        Connection c = factory.createConnection();
        try {
            assertEquals(ConnectionImpl.class, c.getClass());
        } finally {
            c.close();
        }
    }
View Full Code Here

    }

    public void testCreateConnectionWithNullLifeCycleURL() throws JAXRException {
        Properties properties = new Properties();
        properties.setProperty(ConnectionFactoryImpl.QUERYMANAGER_PROPERTY, "http://localhost");
        Connection c = null;
        try {
            factory.setProperties(properties);
            c = factory.createConnection();
            assertEquals(ConnectionImpl.class, c.getClass());
        } catch (Exception e) {
            fail("it's ok to have a null lifeCycleURL");
        } finally {
            if (c!=null) c.close();
        }
    }
View Full Code Here

    }

    public void testCreateConnection() throws JAXRException {
        factory.setQueryManagerURL("http://localhost");
        factory.setLifeCycleManagerURL("http://localhost");
        Connection c = factory.createConnection();
        try {
            assertEquals(ConnectionImpl.class, c.getClass());
        } finally {
            c.close();
        }
    }
View Full Code Here

    }

    public void testCreateConnectionWithNullLifeCycleURL() throws JAXRException {
        factory.setQueryManagerURL("http://localhost");
        factory.setLifeCycleManagerURL(null);
        Connection c = factory.createConnection();
        try {
            assertEquals(ConnectionImpl.class, c.getClass());
        } finally {
            c.close();
        }
    }
View Full Code Here

public class JAXRQueryTest extends TestCase
{
    public void testQuery() throws Exception
    {
        String queryString = "IBM";
        Connection connection = null;

        // Define connection configuration properties
        // To query, you need only the query URL
        Properties props = new Properties();
        props.setProperty("javax.xml.registry.queryManagerURL",
                //        "http://uddi.microsoft.com:80/inquire");
                "http://localhost:8080/juddi/inquiry");
        props.setProperty("javax.xml.registry.factoryClass",
                "org.apache.ws.scout.registry.ConnectionFactoryImpl");

        try
        {
            // Create the connection, passing it the configuration properties
            ConnectionFactory factory = ConnectionFactory.newInstance();
            factory.setProperties(props);
            connection = factory.createConnection();
        } catch (JAXRException e)
        {
            e.printStackTrace();
            fail(e.getMessage());
        }

        try
        {
            // Get registry service and business query manager
            RegistryService rs = connection.getRegistryService();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            System.out.println("We have the Business Query Manager");

            // Define find qualifiers and name patterns
            Collection findQualifiers = new ArrayList();
            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
            Collection namePatterns = new ArrayList();
            namePatterns.add("%" + queryString + "%");

            // Find based upon qualifier type and values
            System.out.println("\n-- searching the registry --\n");
            BulkResponse response =
                    bqm.findOrganizations(findQualifiers,
                            namePatterns,
                            null,
                            null,
                            null,
                            null);

            // check how many organisation we have matched
            Collection orgs = response.getCollection();
            if (orgs == null)
            {
                System.out.println("\n-- Matched 0 orgs");

            } else
            {
                System.out.println("\n-- Matched " + orgs.size() + " organisations --\n");

                // then step through them
                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
                {
                    Organization org = (Organization) orgIter.next();
                    System.out.println("Org name: " + getName(org));
                    System.out.println("Org description: " + getDescription(org));
                    System.out.println("Org key id: " + getKey(org));

                    printUser(org);

                    printServices(org);
                    // Print spacer between organizations
                    System.out.println(" --- ");
                }
            }//end else
        } catch (JAXRException e)
        {
            e.printStackTrace();
            fail(e.getMessage());
        } finally
        {
            connection.close();
        }

    }
View Full Code Here

public class JAXRQueryTest extends TestCase
{
    public void testQuery() throws Exception
    {
        String queryString = "IBM";
        Connection connection = null;

        // Define connection configuration properties
        // To query, you need only the query URL
        Properties props = new Properties();
        props.setProperty("javax.xml.registry.queryManagerURL",
                //        "http://uddi.microsoft.com:80/inquire");
                "http://localhost:8080/juddi/inquiry");
        props.setProperty("javax.xml.registry.factoryClass",
                "org.apache.ws.scout.registry.ConnectionFactoryImpl");

        try
        {
            // Create the connection, passing it the configuration properties
            ConnectionFactory factory = ConnectionFactory.newInstance();
            factory.setProperties(props);
            connection = factory.createConnection();
        } catch (JAXRException e)
        {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }

        try
        {
            // Get registry service and business query manager
            RegistryService rs = connection.getRegistryService();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            System.out.println("We have the Business Query Manager");

            // Define find qualifiers and name patterns
            Collection findQualifiers = new ArrayList();
            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
            Collection namePatterns = new ArrayList();
            namePatterns.add("%" + queryString + "%");

            // Find based upon qualifier type and values
            System.out.println("\n-- searching the registry --\n");
            BulkResponse response =
                    bqm.findOrganizations(findQualifiers,
                            namePatterns,
                            null,
                            null,
                            null,
                            null);

            // check how many organisation we have matched
            Collection orgs = response.getCollection();
            if (orgs == null)
            {
                System.out.println("\n-- Matched 0 orgs");

            } else
            {
                System.out.println("\n-- Matched " + orgs.size() + " organisations --\n");

                // then step through them
                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
                {
                    Organization org = (Organization) orgIter.next();
                    System.out.println("Org name: " + getName(org));
                    System.out.println("Org description: " + getDescription(org));
                    System.out.println("Org key id: " + getKey(org));

                    printUser(org);

                    printServices(org);
                    // Print spacer between organizations
                    System.out.println(" --- ");
                }
            }//end else
        } catch (JAXRException e)
        {
            e.printStackTrace();
        } finally
        {
            connection.close();
        }

    }
View Full Code Here

TOP

Related Classes of javax.xml.registry.Connection

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.