protected void createResourceFile(EndpointReference epr, Resource resource, File resourceFile) throws SoapFault { // // write subscription ws-rp doc to file // SubscriptionManager sub = (SubscriptionManager)resource.getCapability(WsnConstants.SUBSCRIPTION_MGR_URI); Element subXML = sub.toXML(); try { XmlUtils.toFile(subXML, resourceFile); } catch (IOException error) { throw new SoapFault(error); } }
protected void createResourceFile(EndpointReference epr, Resource resource, File resourceFile) throws SoapFault { // // write the service group entry XML infoset to file // Entry entry = (Entry)resource.getCapability(WssgConstants.ENTRY_URI); Element entryXML = entry.toXML(); try { XmlUtils.toFile(entryXML, resourceFile); } catch (IOException error) { throw new SoapFault(error); } }
public void resourceRemoved(EndpointReference epr) throws SoapFault { ServiceGroup serviceGroup = (ServiceGroup)getResource().getCapability(WssgConstants.SERVICE_GROUP_URI); if (serviceGroup.getEntry(epr) != null) { Element payload = XmlUtils.createElement(MuwsConstants.DESTROY_NOTIFICATION_QNAME); sendMessage(epr, MuwsConstants.ADV_ME_DESTRUCTION_TOPIC, WefConstants.DESTROY_SITUATION_QNAME, payload); } } }
public void initialize() throws SoapFault { super.initialize(); _dataStore = createDataStore(); _dataStore.initialize(); // // register for messages so we can add them to the data store // NotificationConsumer wsn = (NotificationConsumer)getResource().getCapability(WsnConstants.CONSUMER_URI); wsn.addMessageListener(this); }
public void resourceAdded(EndpointReference epr, Resource resource) throws SoapFault { Entry entry = (Entry)resource.getCapability(WssgConstants.ENTRY_URI); // // resource is not a service group entry // if (entry == null) return; // // if the resource the service group that owns the entry, send a message // if (isAdvertised(entry.getServiceGroupEPR())) { Element payload = XmlUtils.createElement(MuwsConstants.MANAGEABILITY_EPR_QNAME, epr.toXML()); sendMessage(epr, MuwsConstants.ADV_ME_CREATION_TOPIC, WefConstants.CREATE_SITUATION_QNAME, payload); } }
public void initializeCompleted() throws SoapFault { super.initializeCompleted(); Resource resource = getResource(); // // this allows the advertisement capability to hear about // all resource lifecycle events that happen in the application // ResourceManager manager = resource.getResourceManager(); manager.addListener(this); // // initialize the advertisement topics // NotificationProducer wsn = (NotificationProducer)resource.getCapability(WsnConstants.PRODUCER_URI); wsn.addTopic(MuwsConstants.ADV_ME_CREATION_TOPIC); wsn.addTopic(MuwsConstants.ADV_ME_DESTRUCTION_TOPIC); // // create subscriptions for all event consumer that are going to // receive notifications from the above topics // subscribeInitialConsumer(); }
protected void subscribeInitialConsumer() throws SoapFault { String fileName = getInitializationParameter(_CONSUMER_EPR_PARAM); // // pre-existing consumer is optional - other consumers can // still subscribe using WS-N // if (fileName != null) { Environment env = getResource().getEnvironment(); Document eprDoc = env.getDocument(fileName); Element eprXML = XmlUtils.getFirstElement(eprDoc); EndpointReference epr = new EndpointReference(eprXML); NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI); wsn.subscribe(epr, new TopicFilter(MuwsConstants.ADV_ME_CREATION_TOPIC), null, null); wsn.subscribe(epr, new TopicFilter(MuwsConstants.ADV_ME_DESTRUCTION_TOPIC), null, null); } } }
(ScheduledTermination)resource.getCapability(WsrlConstants.SCHEDULED_TERMINATION_URI); termination = wsrl.getTerminationTime();
NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI); WsResource sub = null;
event.setSituation(situation); NotificationProducer wsn = (NotificationProducer)advertiser.getCapability(WsnConstants.PRODUCER_URI); wsn.publish(topicName, event.toXML());