commitTransaction has some relation with the above method, which means
el.detach means not setting to fileData.setOMElement(null); thus skipping
the deletion operation
public synchronized void commitTransaction(String resourceId) throws
PersistenceException {
if (fileData != null &&* fileData.getOMElement() == null) {* //the
resource has been deleted
String childFilePath =
getFilePathFromResourceId(resourceId);
f = new File(metafilesDir, childFilePath);
if (f.exists()) {
* FileUtils.forceDelete(f);*
}
if(log.isDebugEnabled()){
log.debug("Successfully deleted persisted resource
contents " + resourceId + " " + f.getName());
}
resourceMap.remove(resourceId);
return;
} else if (fileData != null) {
f = fileData.getFile();
} else {
resourceMap.remove(resourceId);
throw new PersistenceException("persistence data not
found");
}
On Wed, Nov 13, 2013 at 5:19 PM, Dushan Abeyruwan <[email protected]> wrote:
> Hi All,
>
> It seems like service metatafile not deleted properly when deleting proxy
> as in AbstractFilePersistenceManager. it looks *detach* nodes *instead of
> deleting* is this a correct behavior..
>
>
> public boolean delete(String resourceId, String xpathStr) {
> ResourceFileData fileData = resourceMap.get(resourceId);
>
> try {
> if (fileData != null && fileData.isTransactionStarted()) {
> OMElement sgElement = fileData.getOMElement();
> AXIOMXPath xpathExpr = new AXIOMXPath(xpathStr);
> OMElement el = (OMElement)
> xpathExpr.selectSingleNode(sgElement);
> if (el == null) {
> return false;
> }
> if (el.getParent() == null) { //this is the root element
> fileData.setOMElement(null);
> } *else {*
> * el.detach();*
> * }*
> setMetaFileModification(resourceId);
> return true;
> } else {
> log.error("The Element specified by path not found or a
> transaction isn't started yet. " +
> xpathStr);
> return false;
> }
> } catch (JaxenException e) {
> log.error("Error parsing xpath string " + resourceId +
> xpathStr, e);
> return false;
> }
> }
>
>
> Cheers,
> Dushan Abeyruwan
> Associate Tech Lead
> *Integration Technologies Team*
> *WSO2 Inc. http://wso2.com/ <http://wso2.com/>*
> *Mobile:(+94)714408632 <%28%2B94%29714408632>*
>
--
Dushan Abeyruwan
Associate Tech Lead
*Integration Technologies Team*
*WSO2 Inc. http://wso2.com/ <http://wso2.com/>*
*Mobile:(+94)714408632 <%28%2B94%29714408632>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev