Package org.apache.juddi.util.jdbc

Examples of org.apache.juddi.util.jdbc.Transaction


  }

  public static void test(Connection connection)
    throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    try
    {
      String businessKey = uuidgen.uuidgen();
      BusinessEntity business = new BusinessEntity();
      business.setBusinessKey(businessKey);
      business.setAuthorizedName("Steve Viens");
      business.setOperator("www.jUDDI.org");

      String publisherID = "sviens";

      // begin a new transaction
      txn.begin(connection);

      // insert a new BusinessEntity
      BusinessEntityTable.insert(business,publisherID,connection);

      // select one of the BusinessEntity objects
      business = BusinessEntityTable.select(businessKey,connection);

      // delete that BusinessEntity object
      //BusinessEntityTable.delete(businessKey,connection);

      // re-select that BusinessEntity object
      business = BusinessEntityTable.select(businessKey,connection);

      // commit the transaction
      txn.commit();
    }
    catch(Exception ex)
    {
      try { txn.rollback(); }
      catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); }
      throw ex;
    }
  }
View Full Code Here


    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("sviens");
        business.setOperator("WebServiceRegistry.com");

        String serviceKey = uuidgen.uuidgen();
        BusinessService service = new BusinessService();
        service.setServiceKey(serviceKey);
        service.setBusinessKey(businessKey);

        Vector keyRefs = new Vector();
        keyRefs.add(new KeyedReference(uuidgen.uuidgen(), "blah, blah, blah"));
        keyRefs.add(
          new KeyedReference(uuidgen.uuidgen(), "Yadda, Yadda, Yadda"));
        keyRefs.add(
          new KeyedReference(uuidgen.uuidgen(), "WhoobWhoobWhoobWhoob"));

        String authorizedUserID = "sviens";

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a new BusinessService
        BusinessServiceTable.insert(service, connection);

        // insert a Collection of new Category KeyedReference objects
        ServiceCategoryTable.insert(serviceKey, keyRefs, connection);

        // insert another new BusinessService
        service.setServiceKey(uuidgen.uuidgen());
        BusinessServiceTable.insert(service, connection);

        // insert another Collection of new Category KeyedReference objects
        ServiceCategoryTable.insert(
          service.getServiceKey(),
          keyRefs,
          connection);

        // select a Collection of Category KeyedReference objects
        keyRefs = ServiceCategoryTable.select(serviceKey, connection);

        // delete a Collection of Category KeyedReference objects
        ServiceCategoryTable.delete(serviceKey, connection);

        // re-select a Collection of Category KeyedReference objects
        keyRefs = ServiceCategoryTable.select(serviceKey, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("sviens");
        business.setOperator("WebServiceRegistry.com");

        Vector descList = new Vector();
        descList.add(new Description("blah, blah, blah", "en"));
        descList.add(new Description("Yadda, Yadda, Yadda", "it"));
        descList.add(new Description("WhoobWhoobWhoobWhoob", "cy"));
        descList.add(new Description("Haachachachacha", "km"));

        String authorizedUserID = "sviens";

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a Collection of Description objects
        BusinessDescTable.insert(businessKey, descList, connection);

        // select the Collection of Description objects
        descList = BusinessDescTable.select(businessKey, connection);

        //  // delete the Collection of Description objects
        //  BusinessDescTable.delete(businessKey,connection);

        // re-select the Collection of Description objects
        descList = BusinessDescTable.select(businessKey, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        //BusinessKey businessKey = BusinessKey.createKey();
        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("sviens");
        business.setOperator("WebServiceRegistry.com");

        //ServiceKey serviceKey = ServiceKey.createKey();
        String serviceKey = uuidgen.uuidgen();
        BusinessService service = new BusinessService();
        service.setServiceKey(serviceKey);
        service.setBusinessKey(businessKey);

        //BindingKey bindingKey = BindingKey.createKey();
        String bindingKey = uuidgen.uuidgen();
        BindingTemplate binding = new BindingTemplate();
        binding.setAccessPoint(
          new AccessPoint("http://www.juddi.org/binding.html", "http"));
        binding.setHostingRedirector(null);
        binding.setBindingKey(bindingKey);
        binding.setServiceKey(serviceKey);

        Vector descList = new Vector();
        descList.add(new Description("blah, blah, blah", "en"));
        descList.add(new Description("Yadda, Yadda, Yadda", "it"));
        descList.add(new Description("WhoobWhoobWhoobWhoob", "cy"));
        descList.add(new Description("Haachachachacha", "km"));

        String authorizedUserID = "sviens";

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a new BusinessService
        BusinessServiceTable.insert(service, connection);

        // insert a new BindingTemplate
        BindingTemplateTable.insert(binding, connection);

        // insert a Collection of Description objects
        BindingDescTable.insert(bindingKey, descList, connection);

        // select the Collection of Description objects
        descList = BindingDescTable.select(bindingKey, connection);

        // delete the Collection of Description objects
        BindingDescTable.delete(bindingKey, connection);

        // select the Collection of Description objects
        descList = BindingDescTable.select(bindingKey, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();

    if (connection != null)
    {
      try
      {
        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("sviens");
        business.setOperator("WebServiceRegistry.com");

        Vector urlList = new Vector();
        urlList.add(
          new DiscoveryURL("businessEntity", "http://www.steveviens.com/abc"));
        urlList.add(
          new DiscoveryURL("businessEntity", "http://www.steveviens.com/def"));
        urlList.add(
          new DiscoveryURL(
            "businessEntityExt",
            "http://www.steveviens.com/ghi"));
        urlList.add(
          new DiscoveryURL(
            "businessEntityExt",
            "http://www.steveviens.com/jkl"));

        String authorizedUserID = "sviens";

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a Collection DiscoveryURL objects
        DiscoveryURLTable.insert(businessKey, urlList, connection);

        // select a Collection DiscoveryURL objects by BusinessKey
        urlList = DiscoveryURLTable.select(businessKey, connection);

        // delete a Collection DiscoveryURL objects by BusinessKey
        DiscoveryURLTable.delete(businessKey, connection);

        // re-select a Collection DiscoveryURL objects by BusinessKey
        urlList = DiscoveryURLTable.select(businessKey, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        String authorizedUserID = "sviens";

        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("sviens");
        business.setOperator("WebServiceRegistry.com");

        Vector contactList = new Vector();
        Contact contact = new Contact("Bill Bob");
        contact.setUseType("server");
        contactList.add(contact);
        int contactID = 0;

        Vector addrList = new Vector();
        Address address = null;

        address = new Address();
        address.setUseType("Mailing");
        address.setSortCode("a");
        addrList.add(address);

        address = new Address();
        address.setUseType("Shipping");
        address.setSortCode("b");
        addrList.add(address);

        address = new Address();
        address.setUseType("Marketing");
        address.setSortCode("c");
        addrList.add(address);

        address = new Address();
        address.setUseType("Sales");
        address.setSortCode("d");
        addrList.add(address);

        address = new Address();
        address.setUseType("Engineering");
        address.setSortCode("e");
        addrList.add(address);

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a new Contact
        ContactTable.insert(businessKey, contactList, connection);

        // insert a Collection of Address objects
        AddressTable.insert(businessKey, contactID, addrList, connection);

        // select the Collection of Address objects
        addrList = AddressTable.select(businessKey, contactID, connection);

        // delete the Collection of Address objects
        AddressTable.delete(businessKey, connection);

        // re-select the Collection of Address objects
        addrList = AddressTable.select(businessKey, contactID, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex) {
          sqlex.printStackTrace();
        }
       
View Full Code Here

  }

  public static void test(Connection connection)
    throws Exception
  {
    Transaction txn = new Transaction();

    if (connection != null)
    {
      try
      {
        // begin a new transaction
        txn.begin(connection);

        // insert a few new publishers
        Publisher publisher = new Publisher();
        publisher.setPublisherID("bcrosby");
        publisher.setName("Bing Crosby");
        publisher.setLastName("Crosby");
        publisher.setFirstName("Bing");
        publisher.setWorkPhone("978.123-4567");
        publisher.setMobilePhone("617-765-9876");
        publisher.setPager("800-123-4655 ID: 501");
        publisher.setEmailAddress("bcrosby@juddi.org");
        publisher.setAdmin(false);
        publisher.setEnabled(false);
        PublisherTable.insert(publisher,connection);

        // select each inserted publisher
        System.out.println(PublisherTable.select("bcrosby",connection));

        publisher.setFirstName("Bart");
        publisher.setName("Barthalomue Crosby");
        publisher.setEnabled(true);
        PublisherTable.update(publisher,connection);

        // select each inserted publisher
        System.out.println(PublisherTable.select("bcrosby",connection));

        // delete two of the inserted publishers
        PublisherTable.delete("bcrosby",connection);

        // select each inserted publisher
        System.out.println(PublisherTable.select("bcrosby",connection));
        System.out.println("");

        // commit the transaction
        txn.commit();
      }
      catch(Exception ex)
      {
        try { txn.rollback(); }
        catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); }
        throw ex;
      }
    }
  }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("mleblanc");
        business.setOperator("XMLServiceRegistry.com");

        String serviceKey = uuidgen.uuidgen();
        BusinessService service = new BusinessService();
        service.setBusinessKey(businessKey);
        service.setServiceKey(serviceKey);

        String bindingKey = uuidgen.uuidgen();
        BindingTemplate binding = new BindingTemplate();
        binding.setServiceKey(serviceKey);
        binding.setBindingKey(bindingKey);
        binding.setAccessPoint(
          new AccessPoint(
            "http://www.juddi.org/tmodelinstanceinfo.html",
            "http"));

        Vector infoList = new Vector();
        infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
        infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
        infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
        infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));

        String authorizedUserID = "sviens";

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a new BusinessService
        BusinessServiceTable.insert(service, connection);

        // insert a new BindingTemplate
        BindingTemplateTable.insert(binding, connection);

        // insert a Collection of TModelInstanceInfo objects
        TModelInstanceInfoTable.insert(bindingKey, infoList, connection);

        // select a Collection of TModelInstanceInfo objects (by BindingKey)
        infoList = TModelInstanceInfoTable.select(bindingKey, connection);

        // delete a Collection of TModelInstanceInfo objects (by BindingKey)
        TModelInstanceInfoTable.delete(bindingKey, connection);

        // re-select a Collection of TModelInstanceInfo objects (by BindingKey)
        infoList = TModelInstanceInfoTable.select(bindingKey, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

    }
  }

  public static void test(Connection connection) throws Exception
  {
    Transaction txn = new Transaction();
    UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();

    if (connection != null)
    {
      try
      {
        String businessKey = uuidgen.uuidgen();
        BusinessEntity business = new BusinessEntity();
        business.setBusinessKey(businessKey);
        business.setAuthorizedName("sviens");
        business.setOperator("WebServiceRegistry.com");

        Vector keyRefs = new Vector();
        keyRefs.add(new KeyedReference(uuidgen.uuidgen(), "blah, blah, blah"));
        keyRefs.add(
          new KeyedReference(uuidgen.uuidgen(), "Yadda, Yadda, Yadda"));
        keyRefs.add(
          new KeyedReference(uuidgen.uuidgen(), "WhoobWhoobWhoobWhoob"));
        keyRefs.add(new KeyedReference(uuidgen.uuidgen(), "Haachachachacha"));

        String authorizedUserID = "sviens";

        // begin a new transaction
        txn.begin(connection);

        // insert a new BusinessEntity
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert a Collection of new Identifier KeyedReference objects
        BusinessIdentifierTable.insert(businessKey, keyRefs, connection);

        // insert another new BusinessEntity
        business.setBusinessKey(uuidgen.uuidgen());
        BusinessEntityTable.insert(business, authorizedUserID, connection);

        // insert another Collection of new Identifier KeyedReference objects
        BusinessIdentifierTable.insert(
          business.getBusinessKey(),
          keyRefs,
          connection);

        // select a Collection of Identifier KeyedReference objects
        keyRefs = BusinessIdentifierTable.select(businessKey, connection);

        // delete a Collection of Identifier KeyedReference objects
        BusinessIdentifierTable.delete(businessKey, connection);

        // re-select a Collection of Identifier KeyedReference objects
        keyRefs = BusinessIdentifierTable.select(businessKey, connection);

        // commit the transaction
        txn.commit();
      }
      catch (Exception ex)
      {
        try
        {
          txn.rollback();
        }
        catch (java.sql.SQLException sqlex)
        {
          sqlex.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of org.apache.juddi.util.jdbc.Transaction

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.