public synchronized void destroy() throws ResourceNotDestroyedFault { if (getResource().getEndpointReference().getParameter( WsaConstants.DEFAULT_RESOURCE_ID_QNAME) == null) throw new ResourceNotDestroyedFault("default resource can not be destroyed."); try { // // all we're doing is making the shutdown task public... // getResource().shutdown(); } catch (SoapFault fault) { throw new ResourceNotDestroyedFault(fault); } } }
public void resourceRemoved(EndpointReference epr) throws SoapFault { if (!isAdvertised(epr)) return; Element payload = XmlUtils.createElement(MuwsConstants.DESTROY_NOTIFICATION_QNAME); sendMessage(epr, MuwsConstants.ADV_ME_DESTRUCTION_TOPIC, WefConstants.DESTROY_SITUATION_QNAME, payload); Resource advertiser = getResource(); if (advertiser.hasBeenShutdown()) advertiser.getResourceManager().removeListener(this); }
EndpointReference epr = resource.getEndpointReference(); String address = epr.getAddress().toString(); int slash = address.lastIndexOf('/'); String contextPath = resource.getContextPath();
public void initialize() throws SoapFault { super.initialize(); // // make sure the owner resource type IS a service group // Resource resource = getResource(); if (!resource.hasCapability(WssgConstants.SERVICE_GROUP_URI)) { Object[] filler = { resource.getContextPath(), resource.getCapabilityURIs() }; throw new RuntimeException(_MESSAGES.get("NoServiceGroupCapability", filler)); } }
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 boolean isAdvertised(EndpointReference epr) { return getResource().getEndpointReference().equals(epr); } }
reporter.setName(WefConstants.REPORTER_COMP_QNAME); address = factory.createComponentAddress(advertiser.getEndpointReference()); reporter.setAddress(address); event.setSituation(situation); NotificationProducer wsn = (NotificationProducer)advertiser.getCapability(WsnConstants.PRODUCER_URI); wsn.publish(topicName, event.toXML());
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); } }
if (resource.hasCapability(WssgConstants.SERVICE_GROUP_URI) || resource.hasCapability(WssgConstants.ENTRY_URI)) return; if (resource.hasCapability(WsrlConstants.SCHEDULED_TERMINATION_URI)) (ScheduledTermination)resource.getCapability(WsrlConstants.SCHEDULED_TERMINATION_URI); termination = wsrl.getTerminationTime();
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); } } }
public void initialize() throws SoapFault { super.initialize(); // // find pullpoint resource type so we can create instances of it // in createPullPoint() // ResourceManager manager = getResource().getResourceManager(); _pullPointPath = manager.getResourceContextPath(PullPoint.class); if (_pullPointPath == null) throw new RuntimeException("No PullPoint endpoint deployed"); } }
/** * * This implementation loops through all existing resource instances * and tells them to shutdown(). * */ public void shutdown() throws SoapFault { Iterator i = getResourceEPRs(); while (i.hasNext()) { Resource next = getResource((EndpointReference)i.next()); next.shutdown(); } _hasBeenShutdown = true; } }
protected Element getWSDL() { Resource owner = getResource(); Environment env = owner.getEnvironment(); String path = owner.getWsdlPath(); Document wsdlDoc = WsdlUtils.createWSDL(env, path, true); Element wsdl = XmlUtils.getFirstElement(wsdlDoc); WsdlUtils.removeWsdlReferences(wsdl); WsdlUtils.removeSchemaReferences(wsdl); return wsdl; }
/** * * This implementation checks to see if the resource type is one that * is being persisted, and if so, creates a file for the instance. * */ public void resourceAdded(EndpointReference epr, Resource resource) throws SoapFault { String contextPath = resource.getContextPath(); if (getResourceManager().isUsingPersistence(contextPath)) createResourceFile(epr, resource); }
public EndpointReference createPullPoint() throws UnableToCreatePullPointFault ResourceManager manager = getResource().getResourceManager(); NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI); WsResource sub = null;
public void setMembershipContentRule(MembershipContentRule[] mcr) { if (mcr == null) mcr = _EMPTY_CONTENT_RULES; _contentRules = mcr; // // make sure all MCRs are using this SG's EPR for outgoing messages // EndpointReference sgEPR = getResource().getEndpointReference(); for (int n = 0; n < _contentRules.length; ++n) _contentRules[n].setServiceGroupEPR(sgEPR); }
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 initializeCompleted() throws SoapFault { Persistence persistence = getPersistence(); // // if the capability defines a persistence mechanism, we // should ask it to reload any saved data // if (persistence != null) { ResourceManager manager = getResource().getResourceManager(); persistence.setResourceManager(manager); persistence.reload(); } }
/** * * Creates the proper file name for the given resource instance and then * delegates creation of the file's contents to the abstract method of * the same name. * * @param epr * @param resource * * @see #getNextFileNumber(String) * @see #createResourceFile(EndpointReference, Resource, File) * */ protected void createResourceFile(EndpointReference epr, Resource resource) throws SoapFault { String contextPath = resource.getContextPath(); int nextNumber = getNextFileNumber(contextPath); String nextFileName = getNextFileName(nextNumber); File resourceTypeDir = getResourceTypeDirectory(contextPath); File resourceFile = new File(resourceTypeDir, nextFileName); createResourceFile(epr, resource, resourceFile); Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath); fileNumbersByEPR.put(epr, new Integer(nextNumber)); }
message.setSubscriptionReference(getResource().getEndpointReference()); getResource().shutdown();