*
*/
protected Resource reloadResource(String contextPath, Element resourceXML)
throws SoapFault
{
ResourceManager manager = getResourceManager();
//
// the XML from the file is the reference parameters of an EPR, so
// we're going to construct the rest of the EPR XML around it and
// then turn it into an EPR object
//
//
// wrap parameter XML in a wsa:EndpointReference element
//
Document doc = resourceXML.getOwnerDocument();
Element eprXML = XmlUtils.createElement(doc, WsaConstants.EPR_QNAME);
eprXML.appendChild(resourceXML);
//
// get the right address URI for the wsa:Address element - this is
// the default URI (has the proper host/port/app) with the context
// path for the resource type at the end
//
String address = manager.getEnvironment().getDefaultURI();
int lastSlash = address.lastIndexOf('/');
address = address.substring(0, lastSlash + 1) + contextPath;
XmlUtils.setElement(eprXML, WsaConstants.ADDRESS_QNAME, address);
//
// create EPR object from XML and set it on the newly-created resource
//
EndpointReference epr = new EndpointReference(eprXML);
Resource resource = manager.createResource(contextPath);
resource.setEndpointReference(epr);
//
// continue initialization/registration
//
resource.initialize();
manager.addResource(epr, resource);
return resource;
}