BindingTemplate start = SubscriptionCallbackListener.start(client, "default");
//register for callbacks
SubscriptionCallbackListener.registerCallback(this);
Subscription sub = new Subscription();
sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
sub.setBindingKey(start.getBindingKey());
sub.setSubscriptionFilter(new SubscriptionFilter());
sub.getSubscriptionFilter().setFindBusiness(new FindBusiness());
sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());
sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));
Subscription subscriptionBiz = clerk.register(sub, clerk.getUDDINode().getApiNode());
System.out.println("Registered FindBusiness subscription key: " + (subscriptionBiz.getSubscriptionKey()) + " bindingkey: " + subscriptionBiz.getBindingKey());
sub = new Subscription();
sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
sub.setBindingKey(start.getBindingKey());
sub.setSubscriptionFilter(new SubscriptionFilter());
sub.getSubscriptionFilter().setFindService(new FindService());
sub.getSubscriptionFilter().getFindService().setFindQualifiers(new FindQualifiers());
sub.getSubscriptionFilter().getFindService().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
sub.getSubscriptionFilter().getFindService().getName().add(new Name(UDDIConstants.WILDCARD, null));
Subscription subscriptionSvc = clerk.register(sub, clerk.getUDDINode().getApiNode());
System.out.println("Registered FindService subscription key: " + (subscriptionSvc.getSubscriptionKey()) + " bindingkey: " + subscriptionSvc.getBindingKey());
sub = new Subscription();
sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
sub.setBindingKey(start.getBindingKey());
sub.setSubscriptionFilter(new SubscriptionFilter());
sub.getSubscriptionFilter().setFindTModel(new FindTModel());
sub.getSubscriptionFilter().getFindTModel().setFindQualifiers(new FindQualifiers());
sub.getSubscriptionFilter().getFindTModel().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
sub.getSubscriptionFilter().getFindTModel().setName(new Name(UDDIConstants.WILDCARD, null));
Subscription subscriptionTM = clerk.register(sub, clerk.getUDDINode().getApiNode());
System.out.println("Registered FindTModel subscription key: " + (subscriptionTM.getSubscriptionKey()) + " bindingkey: " + subscriptionTM.getBindingKey());
System.out.println("Waiting for callbacks. Now would be a good time to launch either another program or juddi-gui to make some changes. Press any key to stop!");
//Thread hook = new Thread(this);
// Runtime.getRuntime().addShutdownHook(hook);
System.in.read();
SubscriptionCallbackListener.stop(client, "default", start.getBindingKey());
clerk.unRegisterSubscription(subscriptionBiz.getSubscriptionKey());
clerk.unRegisterSubscription(subscriptionSvc.getSubscriptionKey());
clerk.unRegisterSubscription(subscriptionTM.getSubscriptionKey());
clerk.unRegisterTModel(createKeyGenator.getTModelKey());
clerk.unRegisterBusiness("uddi:somebusiness:somebusinesskey");