Hi all,
After discussing with team I will be implementing this scenario in below
described way,


   1. We will have a Interface called *Undeployer* in *appfactory.core* and
   this interface will be registered as a OSGi Service.
   2. There will be a class called *AbstractStratosUndeployer* in
   *appfactory.deployers* which implemented by *Undeployer* interface.
   3. In this abstract class there will be a method called
   *undeployArtifact()* which will delete an artifact for the given stage
   and given version of a given app.This method is capable of delete remote
   git repos without checking them out to a local repo.


ATM undeplyment is called in onDeletion methods
of JenkinsApplicationEventsListener and NonBuildableApplicationEventListner.
>From here onwards these onDeletion methods will call undeployArtifact()
method in class.

Any concerns ???

On Tue, Nov 4, 2014 at 11:21 PM, Mahesh Chinthaka <[email protected]> wrote:

> Hi Samith,
> Thanks , will check and do.
>
> On Tue, Nov 4, 2014 at 11:16 PM, Samith Dassanayake <[email protected]>
> wrote:
>
>> @Mahesh
>> IIRC you cannot use RepositoryManager.getAppRepositoryURL() instead of
>> getGitRepoUrlForTenant() since it is used get GIT repo url and what we
>> need here is S2Git repo url. As Janaka has suggested
>> AbstractStratosDeployer.generateRepoUrl() could be used. Please check.
>>
>> On Tue, Nov 4, 2014 at 11:06 PM, Mahesh Chinthaka <[email protected]>
>> wrote:
>>
>>> Hi Janaka,
>>> We initially decided to implement unDeployArtifact() in
>>> AbstractDeployer, now it seems better to implement it in
>>> AbstractStratosDeployer.
>>> +1 to implement it in AbstractStratosDeployer.
>>> @Harsha,
>>> WDYT ?
>>>
>>> On Tue, Nov 4, 2014 at 11:00 PM, Janaka Ranabahu <[email protected]>
>>> wrote:
>>>
>>>> Hi Mahesh,
>>>>
>>>> On Tue, Nov 4, 2014 at 10:51 PM, Mahesh Chinthaka <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Harsha,
>>>>> While following other codes i was able to figure out some usages and
>>>>> below is what im going to do. Let me know if anything wrong.
>>>>>
>>>>>
>>>>> *getRepositoryProviderAdminPassword()*
>>>>> *getRepositoryProviderAdminUser()*
>>>>>
>>>>> These two can be solved. We can
>>>>> use DeployerUtil.getRepositoryProviderProperty to get the repository
>>>>> provider admin username and password
>>>>>
>>>>> Please note that the current implementation of those methods are in
>>>> the NonBuildableArtifactDeployer. Please move them to
>>>> AbstractStratosDeployer so that in future, any deployment related operation
>>>> for stratos can use them.
>>>>
>>>>>
>>>>> *getGitRepoUrlForTenant()*
>>>>>
>>>>> RepositoryManager.getAppRepositoryURL can be used to do the job.
>>>>>
>>>>> Why can't you use the generateRepoUrl() method in
>>>> AbstractStratosDeployer for this. I didn't compare the implementations of
>>>> those 2 but they might be different since we are using 2 templates for Git
>>>> and S2Git. So please check that too.
>>>>
>>>>>
>>>>> *getServerDeploymentPaths()*
>>>>>
>>>>> This will be moved to AbstractDeployer.
>>>>>
>>>>> I would rather suggest to use AbstractStratosDeployer here since this
>>>> is related to stratos deployment and might not be the same for any other
>>>> deployment environment in the future
>>>>
>>>>>
>>>>> getFilesToDelete()
>>>>>
>>>>> I will move this in to AbstractDeployer, because unDeployAftifact is
>>>>> also in the AbstractDeployer and AbstractStratosDeployer is inherited from
>>>>> AbstractDeployer. So  I think we have to move it to AbstractDeployer
>>>>>
>>>>> Same as above.
>>>>
>>>> Thanks,
>>>> Janaka
>>>>
>>>>>
>>>>>
>>>>> 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
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *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
>>>
>>
>>
>>
>> --
>> Best Regards
>>
>> Samith Dassanayake
>> Software Engineer, WSO2 Inc.
>>
>>
>
>
> --
> *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
>



-- 
*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