[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: Reimplementing ClassPools for AS
alesj
do-not-reply at jboss.com
Mon Dec 15 05:38:47 EST 2008
"kabir.khan at jboss.com" wrote :
| Does a module represent a jar, thus meaning import everything from that jar?
|
I wouldn't call it 'import everything from that bundle'.
It's more like a plain bundle dependency, where you trust that bundle to have the packages/classes you need.
e.g. you know you're using Hibernate, so instead of doing every Hibernate import,
you just say I need Hibernate module, as you know that the Hibernate stuff you use it's gonna be there
"kabir.khan at jboss.com" wrote : And is package more fine-grained, meaning only import these packages from that jar?
|
Yup, exactly.
It's when you need more fine-grained dependencies.
"kabir.khan at jboss.com" wrote :
| Whatever the answer, I suppose the Module/Package difference would also apply to the capabilities?
|
Module capabilities are filtered.
e.g. VFSDeploymentClassLoaderPolicyModule
| // We have a module capability
| Object version = getVersion();
| Capability capability = factory.createModule(getName(), version);
| capabilities.add(capability);
|
| // Do we determine package capabilities
| ClassFilter included = getIncluded();
| ClassFilter excluded = getExcluded();
| ClassFilter excludedExport = getExcludedExport();
| ExportAll exportAll = getExportAll();
| if (exportAll != null)
| {
| Set<String> exportedPackages = PackageVisitor.determineAllPackages(roots, excludedRoots, exportAll, included, excluded, excludedExport);
| for (String packageName : exportedPackages)
| {
| capability = factory.createPackage(packageName, version);
| capabilities.add(capability);
| }
| }
|
| return capabilities;
|
Package capabilities would normally come from jboss-classloading.xml,
an explicit definition -> capabilities/package/name+version ...
"kabir.khan at jboss.com" wrote :
| Also, what is UsesPackageRequirement?
|
It's when some export depends on some other bundle/api.
| A comma-separated list of package names that are used by the
| exported package. Note that the use of a comma in the value requires it
| to be enclosed in double quotes. If this exported package is chosen as an
| export, then the resolver must ensure that importers of this package wire
| to the same versions of the package in this list.
|
| ...
|
| Classes can depend on classes in other packages. For example, when they
| extend classes from another package, or these other classes appear in
| method signatures. It can therefore be said that a package uses other packages.
| These inter-package dependencies are modeled with the uses directive
| on the Export-Package header.
| For example, org.osgi.service.http depends on the package javax.servlet
| because it is used in the API. The export definition of the
| org.osgi.service.http must therefore contain the uses directive with the
| javax.servlet package as its value.
|
So you need to import that, in order to resolve properly,
as 'uses' enforces a transitive dependency on exact version.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196509#4196509
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196509
More information about the jboss-dev-forums
mailing list