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

Reply via email to