return response;
}
private Node getSubscriptions(HttpSession session, UDDIClerk clerk, UDDIClerk toClerk) {
Node modelNode = new Node();
UDDINode node = clerk.getUDDINode();
modelNode.setName(node.getName());
modelNode.setClerkName(clerk.getName());
modelNode.setDescription(node.getDescription());
try {
UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(clerk.getManagerName());
String clazz = manager.getClientConfig().getUDDINode(clerk.getUDDINode().getName()).getProxyTransport();
Class<?> transportClass = ClassUtil.forName(clazz, Transport.class);
Transport transport = (Transport) transportClass.getConstructor(String.class,String.class).newInstance(clerk.getManagerName(),clerk.getUDDINode().getName());
String authToken = (String) session.getAttribute("token-" + clerk.getName());
UDDISubscriptionPortType subscriptionService = transport.getUDDISubscriptionService();
List<org.uddi.sub_v3.Subscription> subscriptions = subscriptionService.getSubscriptions(authToken);
for (org.uddi.sub_v3.Subscription subscription : subscriptions) {
String expiresAfter = null;
if (subscription.getExpiresAfter()!=null) expiresAfter = subscription.getExpiresAfter().toString();
String rawFilter = JAXBMarshaller.marshallToString(new ObjectFactory().createSubscriptionFilter(subscription.getSubscriptionFilter()), "org.uddi.sub_v3");
Subscription modelSubscription = new Subscription(
(subscription.getBindingKey()==null)?"":subscription.getBindingKey(),
subscription.isBrief(),
expiresAfter,
subscription.getMaxEntities(),
(subscription.getNotificationInterval()==null)?"":subscription.getNotificationInterval().toString(),
rawFilter,
subscription.getSubscriptionKey());
modelSubscription.setNode(modelNode);
modelSubscription.setToClerkName(toClerk.getName());
modelNode.getSubscriptions().add(modelSubscription);
}
modelNode.setStatus(UP);
} catch (Exception e) {
logger.error("Could not obtain subscription due to " + e.getCause(), e);
modelNode.setStatus("Down, communication problem: " + e.getCause());
}
return modelNode;
}