in modules/core/src/main/java/org/apache/savan/publication/client/PublicationClient.java [59:109]
public void sendPublication(OMElement eventData, AxisService service, URI eventName)
throws SavanException {
try {
SubscriberStore subscriberStore = CommonUtil.getSubscriberStore(service);
if (subscriberStore == null)
throw new SavanException("Cannot find the Subscriber Store");
PublicationReport report = new PublicationReport();
if (eventName != null) {
//there should be a valid operation or a SubscriberGroup to match this event.
AxisOperation operation = getAxisOperationFromEventName(eventName);
if (operation != null) {
//send to all subscribers with this operation.
throw new UnsupportedOperationException("Not implemented");
} else {
//there should be a valid SubscriberGroup to match this eventName
String groupId = eventName.toString();
SubscriberGroup group =
(SubscriberGroup)subscriberStore.getSubscriberGroup(groupId);
if (group != null)
group.sendEventDataToGroup(eventData);
else
throw new SavanException(
"Could not find a subscriberGroup or an operation to match the eventName");
}
} else {
//no event name, so send it to everybody.
//sending to all individual subscribers
for (Iterator iter = subscriberStore.retrieveAllSubscribers(); iter.hasNext();) {
Subscriber subscriber = (Subscriber)iter.next();
subscriber.sendEventData(eventData);
}
//sending to all Subscriber Groups
for (Iterator iter = subscriberStore.retrieveAllSubscriberGroups();
iter.hasNext();) {
SubscriberGroup subscriberGroup = (SubscriberGroup)iter.next();
subscriberGroup.sendEventDataToGroup(eventData);
}
}
} catch (AxisFault e) {
String message = "Could not send the publication";
throw new SavanException(message, e);
}
}