Concern regarding axis2 deployment of same file with a different modified time

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Concern regarding axis2 deployment of same file with a different modified time

Sasikala Kottegoda
Hi all,

We are using apache axis2 version 1.6.1 for the deployment of our artifacts and the flow that takes place is as follows:

Inline image 1

What is expected here is for the artifacts that are deployed/undeployed/redployed to be commited to svn. What we could observe was that, when we add the same artifact to the deployment directoy, within axis2, it is considered as modified file since the last modified time of the file has changed. Thus the redployment takes place. However, since it is the same file that was redeployed, the md5sum will not be changed hence svn commit will not take place. Would it be a better approach if we modify the axis2 engine so that an artifact is cosidered modified if and only if it's md5sum has changed?

Right now, the isModified() method of WSInfoList is as follows:
private boolean isModified(File file, WSInfo wsInfo) {
long currentTimeStamp = wsInfo.getLastModifiedDate();

setLastModifiedDate(file, wsInfo);

return (currentTimeStamp != wsInfo.getLastModifiedDate());
}
My suggestion is to improve it as below:
private boolean isModified(File file, WSInfo wsInfo) {

long previousModifiedDate = wsInfo.getLastModifiedDate();
setLastModifiedDate(file, wsInfo);
String previousMD5Sum = wsInfo.getMd5Sum();
setMD5Sum(file, wsInfo);
String currentMd5Sum = wsInfo.getMd5Sum();
    if ((wsInfo.getLastModifiedDate() != previousModifiedDate) && (wsInfo.getMd5Sum().equals(previousMD5Sum))) {
log.info("The file has been touched without a modification. Thus not considered for redeployment");
}
return (!wsInfo.getMd5Sum().equals(previousMD5Sum));

}
Any suggestion is warmly welcome.

Thank you,
Sasikala

--
Sasikala Kottegoda
Senior Software Engineer
WSO2 Inc., http://wso2.com/
lean. enterprise. middleware

Mobile: +94 774835928

https://wso2.com/signature
Reply | Threaded
Open this post in threaded view
|

Re: Concern regarding axis2 deployment of same file with a different modified time

Andreas Veithen-2
On Thu, Oct 19, 2017 at 3:52 PM, Sasikala Kottegoda <[hidden email]> wrote:
Hi all,

We are using apache axis2 version 1.6.1 for the deployment of our artifacts

I guess it's the forked version of Axis2 that WSO2 bases its products on. In that case, you can just modify that code.
 
and the flow that takes place is as follows:

Inline image 1

What is expected here is for the artifacts that are deployed/undeployed/redployed to be commited to svn. What we could observe was that, when we add the same artifact to the deployment directoy, within axis2, it is considered as modified file since the last modified time of the file has changed. Thus the redployment takes place. However, since it is the same file that was redeployed, the md5sum will not be changed hence svn commit will not take place. Would it be a better approach if we modify the axis2 engine so that an artifact is cosidered modified if and only if it's md5sum has changed?

Right now, the isModified() method of WSInfoList is as follows:
private boolean isModified(File file, WSInfo wsInfo) {
long currentTimeStamp = wsInfo.getLastModifiedDate();

setLastModifiedDate(file, wsInfo);

return (currentTimeStamp != wsInfo.getLastModifiedDate());
}
My suggestion is to improve it as below:
private boolean isModified(File file, WSInfo wsInfo) {

long previousModifiedDate = wsInfo.getLastModifiedDate();
setLastModifiedDate(file, wsInfo);
String previousMD5Sum = wsInfo.getMd5Sum();
setMD5Sum(file, wsInfo);
String currentMd5Sum = wsInfo.getMd5Sum();
    if ((wsInfo.getLastModifiedDate() != previousModifiedDate) && (wsInfo.getMd5Sum().equals(previousMD5Sum))) {
log.info("The file has been touched without a modification. Thus not considered for redeployment");
}
return (!wsInfo.getMd5Sum().equals(previousMD5Sum));

}
Any suggestion is warmly welcome.

Thank you,
Sasikala

--
Sasikala Kottegoda
Senior Software Engineer
WSO2 Inc., http://wso2.com/
lean. enterprise. middleware

Mobile: <a href="tel:+94%2077%20483%205928" value="+94774835928" target="_blank">+94 774835928

https://wso2.com/signature