dev@glassfish.java.net

[_at_GFv3] Why are Sniffer classes part of connector (a.k.a. gluecode) module?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Tue, 18 Mar 2008 09:22:54 +0530

[Jerome, correct me if I am wrong here]

Container Module Owners,

A quick check shows that some modules have packaged their Sniffer
implementations as part of the connector (gluecode) module. See the
output below:

glassfish@~/WS/gf/v3$ find . -name "*Sniffer.java"
./web/webtier/src/main/java/com/sun/enterprise/web/WebSniffer.java
./extras/rails/src/main/java/com/sun/enterprise/rails/RailsSniffer.java
./connectors/connectors-connector/src/main/java/com/sun/enterprise/connectors/module/ConnectorSniffer.java
./webservices/jsr109-impl/src/main/java/org/glassfish/webservices/WebServicesSniffer.java
./ejb/ejb-connector/src/main/java/org/glassfish/ejb/startup/EjbSniffer.java
./persistence/jpa-connector/src/main/java/org/glassfish/persistence/jpa/JPASniffer.java
./common/glassfish-api/src/main/java/org/glassfish/api/container/Sniffer.java
./core/kernel/src/main/java/com/sun/enterprise/v3/deployment/GenericSniffer.java
./core/kernel/src/main/java/com/sun/enterprise/v3/phobos/PhobosSniffer.java
./core/security/src/main/java/com/sun/enterprise/security/SecuritySniffer.java

Since the server has to load all the sniffers during deployment to
select the eligible sniffer, we end up loading all the gluecode modules.
Gluecode modules would have dependency on the actual container modules,
which effectively mean loading all the modules. This, I believe, is
contrary to the design of the system [1], which states the following:

/For the simple case the name of the connector module will follow the
pattern "gf-ContainerX-connector" and will be looked inside the
lib/connectors directory of the application server. Those connectors
usually imports classes from GlassFish (like the HK2 module management)
and from the container itself. Since the container is not necessarily
installed locally until the Sniffer.setUp() has been called, it is
important that such modules are not loaded/resolved by HK2 until the
setUp() has successfully finished.
/
A better approach is to separate each Sniffer into its own module. I
suggest naming them as gf-ContainerX-sniffer following the nomenclature
of gluecode modules.

Thanks,
Sahoo

[1] http://wiki.glassfish.java.net/Wiki.jsp?page=ContainerSPI