Hi Chamila, Seems it looks un readable though it does the work. Better to rename the variable. Could you please send a PR.
On Thu, Sep 18, 2014 at 10:57 AM, Chamila De Alwis <chami...@wso2.com> wrote: > From further investigation I found that an ArtifactUpdatedEvent is > published when a subscription is made using FrameworkCartridgeSubscription > and InternalRepoBasedCartridgeSubscription. This creates the need to check > if the execution of the onArtifactUpdatedEvent() method is for the initial > cloning or not. > > > Regards, > Chamila de Alwis > Software Engineer | WSO2 | +94772207163 > Blog: code.chamiladealwis.com > > > > On Thu, Sep 18, 2014 at 12:35 AM, Chamila De Alwis <chami...@wso2.com> > wrote: > >> Hi, >> >> In Cartridge Agent ArtifactUpdatedEvent is handled by >> DefaultExtensionHandler.onArtifactUpdatedEvent() method. There are few >> lines of code which I don't properly understand here. >> >> Before checking out the repository URL, it is checked whether the cloned >> folder exists. >> >> boolean cloneExists = >> GitBasedArtifactRepository.getInstance().cloneExists(repoInformation); >> >> After checking out (which would clone if the folder doesn't exist, and >> thereby set cloneExists flag to true) the value stored previously is >> checked for false and InstanceActivatedEvent is published by the agent. >> >> if (!cloneExists) { >> // Executed git clone, publish instance activated event >> >> CartridgeAgentEventPublisher.publishInstanceActivatedEvent(); >> } >> >> What I don't understand is the use of cloneExists condition here. >> >> Is it to check whether this particular event is an event published after >> the first event which is published by SM on the initial spawning? >> >> What are the other points in the cartridge life cycle during which >> ArtifactUpdatedEvent is published? >> >> Regards, >> Chamila de Alwis >> Software Engineer | WSO2 | +94772207163 >> Blog: code.chamiladealwis.com >> >> >> > -- Udara Liyanage Software Engineer WSO2, Inc.: http://wso2.com lean. enterprise. middleware web: http://udaraliyanage.wordpress.com phone: +94 71 443 6897