}
}
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);
// Keyed References for the Binding Template CategoryBag.
Vector keyRefs = new Vector();
keyRefs.add(
new KeyedReference(
"uuid:" + uuidgen.uuidgen(),
"alpha",
"abcdefghi"));
keyRefs.add(
new KeyedReference("uuid:" + uuidgen.uuidgen(), "beta", "jklmnopqr"));
keyRefs.add(
new KeyedReference("uuid:" + uuidgen.uuidgen(), "omega", "stuvwxyz"));
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 new Category KeyedReference objects
BindingCategoryTable.insert(bindingKey, keyRefs, connection);
// select the Collection of KeyedReference objects
keyRefs = BindingCategoryTable.select(bindingKey, connection);
for (int i = 0; i < keyRefs.size(); i++)
{
KeyedReference keyRef = (KeyedReference) keyRefs.elementAt(i);
System.out.println(" Key Name: " + keyRef.getKeyName());
System.out.println("Key Value: " + keyRef.getKeyValue());
System.out.println("TModelKey: " + keyRef.getTModelKey());
}
// delete the Collection of KeyedReference objects
BindingCategoryTable.delete(bindingKey, connection);
// select the Collection of KeyedReference objects
keyRefs = BindingCategoryTable.select(bindingKey, connection);
// commit the transaction
txn.commit();
}
catch (Exception ex)
{
try
{
txn.rollback();
}
catch (java.sql.SQLException sqlex)
{
sqlex.printStackTrace();
}