dev@glassfish.java.net

Resource Autodeploy Question (issue 4490)

From: Jason Lee <jason_at_steeplesoft.com>
Date: Wed, 23 Apr 2008 00:18:12 -0500

I'm reading through the v3 source for the autodeployer, trying to make sure
I understand what's going on before I get too excited about changing
things. From that effort, I made these notes:

HK2 services:
    AutoDeployService - Implements Startup, so hk2 creates a Singleton
instance at startup
    AutoDeploymentOperation - Exposed as a service, with a new instance
created "per lookup" via habitat.getComponent()
    AutoOperation - ditto, but never created directly; abstract
    AutoUndeploymentOperation - same as AutoDeploymentOperation
    AutodeployRetryManager - much like ADO, but @Injected into ADO and
manually created in AutoDeployer. Why the difference?
    AutoDeployer - not a service. simple class created by ADS. Gets needed
components via habitat

Does that sound right so far? My HK2 knowledge is pretty nascent, but I'm
working on it. Based on what I'm seeing in code, I think the above is
pretty accurate. That leads me to this depiction of the execution path:

AutoDeployer
    AutoDeployDirectoryScanner.getAllDeployableModules()
        AutoDeployedFilesManager.loadStatus()
        getListOfFiles()
            getListOfFilesAsSet() <- file ext check
        AutoDeployedFilesManager.getFilesForDeployment() // get list of
files that haven't been deployed or whose tstamp is newer than status file
    deploy()
        retryManager.testFileAsArchive() <-- something here's going to have
to change. File ext check?
        AutoDeploymentOperation.newInstance()
        AutoDeploymentOperation.run()
            commandRunner.doCommand() // AutoOperation.java:116
                DeployCommand.execute() // line 253 - Synchronous commands
                    getSniffers()

And I'm stumped at about line 165 in DeployCommand (it doesn't help that
it's after midnight, though I'm sure those involved in J1 will have much
sympathy for me :). I see that it checks to make sure there are Sniffers,
then doesn't come back to that for a long time. More importantly, what is a
Sniffer? In his comments on 4490, tjquinn mentioned something about
sniffers, but I'm not sure what they are, what they do, how they plug in
here, etc. Is there any documentation on them, or can someone cobble
together and quick-n-dirty explanation for me? Beyond that question, am I
reading the source correctly, on the right path, etc?

I hope all that makes sense. I'm going to go crash and hope it's as
coherent in the morning as it seems to me now :P

Thanks! :)

-- 
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
Mojarra and Mojarra Scales Dev Team
https://mojarra.dev.java.net
https://scales.dev.java.net
http://blogs.steeplesoft.com