You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Sasikala Kottegoda <sa...@wso2.com> on 2017/10/19 14:52:34 UTC

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

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:

[image: 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

[image: https://wso2.com/signature] <https://wso2.com/signature>

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

Posted by Andreas Veithen <an...@gmail.com>.
On Thu, Oct 19, 2017 at 3:52 PM, Sasikala Kottegoda <sa...@wso2.com>
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:
>
> [image: 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 <+94%2077%20483%205928>
>
> [image: https://wso2.com/signature] <https://wso2.com/signature>
>