+1 for refactoring.
@Mahesh : These are good reads. Read these if you are not familiar to
refactoring.

[1] http://sourcemaking.com/refactoring/bad-smells-in-code
[2] http://sourcemaking.com/refactoring/duplicated-code


Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729

On Tue, Nov 4, 2014 at 10:21 PM, Harsha Thirimanna <[email protected]> wrote:

> Hi Mahesh,
>
> Don't write same code twice. Just move it. Because it is not suite to use
> those kind of method that keeping this Service Class. When we are doing
> some changes, we may have to re-factor according to the best practices.
> WDYT ?
>
>
> *Harsha Thirimanna*
> Senior Software Engineer; WSO2, Inc.; http://wso2.com
> * <http://www.apache.org/>*
> *email: **[email protected]* <[email protected]>* cell: +94 71 5186770  ,
> +94 *
> *774617784twitter: **http://twitter.com/
> <http://twitter.com/afkham_azeez>*
> *harshathirimannlinked-in: **http:
> <http://lk.linkedin.com/in/afkhamazeez>**//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122
> <http://www.linkedin.com/pub/harsha-thirimanna/10/ab8/122>*
>
> *Lean . Enterprise . Middleware*
>
>
> On Tue, Nov 4, 2014 at 10:18 PM, Mahesh Chinthaka <[email protected]>
> wrote:
>
>> Hi Harsha,
>> Why cant we just make those methods public and use them ? Since
>> appfactory.core is already a dependancy in appfactory.deployers
>> So we can avoid writing the same code twice.
>>
>> On Tue, Nov 4, 2014 at 10:13 PM, Harsha Thirimanna <[email protected]>
>> wrote:
>>
>>> Hi Janaka,
>>>
>>> There are no new utility method. Just keep it in right place as we can
>>> reuse it.
>>>
>>>
>>> *Harsha Thirimanna*
>>> Senior Software Engineer; WSO2, Inc.; http://wso2.com
>>> * <http://www.apache.org/>*
>>> *email: **[email protected]* <[email protected]>* cell: +94 71 5186770  ,
>>> +94 *
>>> *774617784twitter: **http://twitter.com/
>>> <http://twitter.com/afkham_azeez>*
>>> *harshathirimannlinked-in: **http:
>>> <http://lk.linkedin.com/in/afkhamazeez>**//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122
>>> <http://www.linkedin.com/pub/harsha-thirimanna/10/ab8/122>*
>>>
>>> *Lean . Enterprise . Middleware*
>>>
>>>
>>> On Tue, Nov 4, 2014 at 10:12 PM, Harsha Thirimanna <[email protected]>
>>> wrote:
>>>
>>>> ​sorry, I had sent half of the mail​.
>>>>
>>>> getFilesToDelete - you can move this method to AbstractStratosDeployer
>>>>
>>>> getRepositoryProviderAdminUser
>>>> getRepositoryProviderAdminPassword
>>>>
>>>> these two methods can move to AppFactoryUtil in common component and
>>>> make it public.
>>>>
>>>>
>>>>
>>>>
>>>> *Harsha Thirimanna*
>>>> Senior Software Engineer; WSO2, Inc.; http://wso2.com
>>>> * <http://www.apache.org/>*
>>>> *email: **[email protected]* <[email protected]>* cell: +94 71 5186770  ,
>>>> +94 *
>>>> *774617784twitter: **http://twitter.com/
>>>> <http://twitter.com/afkham_azeez>*
>>>> *harshathirimannlinked-in: **http:
>>>> <http://lk.linkedin.com/in/afkhamazeez>**//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122
>>>> <http://www.linkedin.com/pub/harsha-thirimanna/10/ab8/122>*
>>>>
>>>> *Lean . Enterprise . Middleware*
>>>>
>>>>
>>>> On Tue, Nov 4, 2014 at 10:03 PM, Harsha Thirimanna <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Janaka,
>>>>>
>>>>> As Mahesh mentioned some of here are Util methods as private.
>>>>>
>>>>> @Mahesh
>>>>>
>>>>> getGitRepoUrlForTenant - rename this method to getRepoUrlForTenant and
>>>>> move it to RepositoryClient interface. Implement it in GitRepositoryClient
>>>>> according to the Git.
>>>>> getServerDeploymentPaths - in this method, there is only static method
>>>>> call
>>>>>
>>>>>
>>>>> *Harsha Thirimanna*
>>>>> Senior Software Engineer; WSO2, Inc.; http://wso2.com
>>>>> * <http://www.apache.org/>*
>>>>> *email: **[email protected]* <[email protected]>* cell: +94 71 5186770  ,
>>>>> +94 *
>>>>> *774617784twitter: **http://twitter.com/
>>>>> <http://twitter.com/afkham_azeez>*
>>>>> *harshathirimannlinked-in: **http:
>>>>> <http://lk.linkedin.com/in/afkhamazeez>**//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122
>>>>> <http://www.linkedin.com/pub/harsha-thirimanna/10/ab8/122>*
>>>>>
>>>>> *Lean . Enterprise . Middleware*
>>>>>
>>>>>
>>>>> On Tue, Nov 4, 2014 at 9:52 PM, Janaka Ranabahu <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi Mahesh,
>>>>>>
>>>>>> On Tue, Nov 4, 2014 at 9:42 PM, Mahesh Chinthaka <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi all ,
>>>>>>> I was trying to move the exact functionality in
>>>>>>> *org.wso2.carbon.appfactory.core.deploy.ApplicationDeployer.undeployAllArtifactsOfAppFromDepSyncGitRepo()*
>>>>>>> to
>>>>>>> *org.wso2.carbon.appfactory.deployers.AbstractDeployer.unDeployArtifact()*
>>>>>>>
>>>>>>> while working on *unDeployArtifact()* i need to access some more
>>>>>>> methods inside *ApplicationDeployer* class, which are private.
>>>>>>> those are     : getRepositoryProviderAdminUser()
>>>>>>>                       getRepositoryProviderAdminPassword()
>>>>>>>                       getGitRepoUrlForTenant()
>>>>>>>                       getServerDeploymentPaths()
>>>>>>>                       getFilesToDelete()
>>>>>>>
>>>>>> Did you check how these parameters are sent when the deployment call
>>>>>> happens? IIRC, we pass a parameter map for that method which contains all
>>>>>> these parameters. Also those parameters are configured in the 
>>>>>> appfactory.xml
>>>>>> So please check how the deploy methods work. That should give you a
>>>>>> clue.
>>>>>>
>>>>>> Thanks,
>>>>>> Janaka
>>>>>>
>>>>>>>
>>>>>>> What kind of approach should I follow ?
>>>>>>>
>>>>>>> 1. Make above methods public and use them.
>>>>>>> 2. Implement same methods inside AbstactDeployer class and use them.
>>>>>>>
>>>>>>> FYI : *AbstractDeployer* class is implemented from *Deployer*
>>>>>>> interface and currently it has following methods.
>>>>>>> deployTaggedArtifact
>>>>>>> deployLatestSuccessArtifact
>>>>>>> deployPromotedArtifact
>>>>>>> unDeployArtifact
>>>>>>> handleException
>>>>>>>
>>>>>>> Thanks
>>>>>>> --
>>>>>>> *Mahesh Chinthaka Vidanagama* | Software Engineer
>>>>>>> WSO2, Inc | lean. enterprise. middleware.
>>>>>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>>>>>> Mobile: +94 71 63 63 083 | Work: +94 112 145 345
>>>>>>> Email: [email protected] | Web: www.wso2.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Janaka Ranabahu*
>>>>>> Senior Software Engineer; WSO2 Inc.; http://wso2.com
>>>>>>
>>>>>>
>>>>>> *E-mail: [email protected] <http://wso2.com>**M: **+94 718370861
>>>>>> <%2B94%20718370861>*
>>>>>>
>>>>>> Lean . Enterprise . Middleware
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> *Mahesh Chinthaka Vidanagama* | Software Engineer
>> WSO2, Inc | lean. enterprise. middleware.
>> #20, Palm Grove, Colombo 03, Sri Lanka
>> Mobile: +94 71 63 63 083 | Work: +94 112 145 345
>> Email: [email protected] | Web: www.wso2.com
>>
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to