Skip to content

Commit

Permalink
Track whether a dependency is user specified and use that information…
Browse files Browse the repository at this point in the history
… to log (or not log) warnings for unsupported/private modules
  • Loading branch information
dmlloyd authored and stuartwdouglas committed Feb 3, 2012
1 parent 47ba67f commit 0197cde
Show file tree
Hide file tree
Showing 28 changed files with 97 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader loader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);

moduleSpecification.addSystemDependency(new ModuleDependency(loader, CORBA_ID, false, true, true));
moduleSpecification.addSystemDependency(new ModuleDependency(loader, CORBA_ID, false, true, true, false));

final Set<ModuleIdentifier> moduleIdentifiers = new HashSet<ModuleIdentifier>();
final DeploymentUnit top = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro

final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, CMP, false, false, true));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, CMP, false, false, true, false));
}

public void undeploy(DeploymentUnit context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);

moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, RESOURCE_API_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, RESOURCE_API_ID, false, false, false, false));

if (phaseContext.getDeploymentUnit().getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY) == null) {
return; // Skip non ra deployments
}

//if a module depends on a rar it also needs a dep on all the rar's dependencies
moduleSpecification.setRequiresTransitiveDependencies(true);
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JMS_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VALIDATION_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IRON_JACAMAR_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IRON_JACAMAR_IMPL_ID, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HIBERNATE_VALIDATOR_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JMS_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VALIDATION_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IRON_JACAMAR_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IRON_JACAMAR_IMPL_ID, false, true, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HIBERNATE_VALIDATOR_ID, false, false, false, false));
}

public void undeploy(final DeploymentUnit context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);

final ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAEE_API_ID, false, false, true));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAEE_API_ID, false, false, true, false));
// TODO: Post 7.0, we have to rethink this whole hibernate dependencies that we add to user deployments
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HIBERNATE_VALIDATOR_ID, false, false, true));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HIBERNATE_VALIDATOR_ID, false, false, true, false));

//add jboss-invocation classes needed by the proxies
ModuleDependency invocation = new ModuleDependency(moduleLoader, JBOSS_INVOCATION_ID, false, false, false);
ModuleDependency invocation = new ModuleDependency(moduleLoader, JBOSS_INVOCATION_ID, false, false, false, false);
invocation.addImportFilter(PathFilters.is("org.jboss.invocation.proxy.classloading"), true);
moduleSpecification.addSystemDependency(invocation);

ModuleDependency ee = new ModuleDependency(moduleLoader, JBOSS_AS_EE, false, false, false);
ModuleDependency ee = new ModuleDependency(moduleLoader, JBOSS_AS_EE, false, false, false, false);
ee.addImportFilter(PathFilters.is("org.jboss.as.ee.component.serialization"), true);
moduleSpecification.addSystemDependency(ee);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
final String name = module.get(GlobalModulesDefinition.NAME).asString();
String slot = module.hasDefined(GlobalModulesDefinition.SLOT) ? module.get(GlobalModulesDefinition.SLOT).asString() : GlobalModulesDefinition.DEFAULT_SLOT;
final ModuleIdentifier identifier = ModuleIdentifier.create(name, slot);
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), identifier, false, false, true));
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), identifier, false, false, true, false));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);

//we always give them the EJB client
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_CLIENT, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_IIOP_CLIENT, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_CLIENT, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_IIOP_CLIENT, false, false, false, false));

//we always have to add this, as even non-ejb deployments may still lookup IIOP ejb's
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_SUBSYSTEM, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, EJB_SUBSYSTEM, false, false, false, false));

if (JacORBDeploymentMarker.isJacORBDeployment(deploymentUnit)) {
//needed for dynamic IIOP stubs
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACORB, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACORB, false, false, false, false));
}

// fetch the EjbJarMetaData
Expand All @@ -101,9 +101,9 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
// FIXME: still not the best way to do it
//this must be the first dep listed in the module
if (Boolean.getBoolean("org.jboss.as.ejb3.EMBEDDED"))
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.CLASSPATH, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.CLASSPATH, false, false, false, false));

moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAEE_MODULE_IDENTIFIER, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAEE_MODULE_IDENTIFIER, false, false, false, false));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);

final ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, CORBA_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAX_RMI_API_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, CORBA_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAX_RMI_API_ID, false, false, false, false));
//we need to add jacorb, as the orb is initaled from the context class loader of the deployment
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACORB_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACORB_ID, false, false, false, false));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
}

private void addDepdenency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, true));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, true, false));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro

private void addDepdenency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader,
ModuleIdentifier moduleIdentifier) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, true));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, true, false));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro

private void addDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader,
ModuleIdentifier moduleIdentifier) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, false, false));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
if (kdxd.getBeanFactoriesCount() > 0) {
final ModuleSpecification moduleSpecification = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
ModuleDependency dependency = new ModuleDependency(moduleLoader, POJO_MODULE, false, false, false);
ModuleDependency dependency = new ModuleDependency(moduleLoader, POJO_MODULE, false, false, false, false);
PathFilter filter = PathFilters.isChildOf(BaseBeanFactory.class.getPackage().getName());
dependency.addImportFilter(filter, true);
dependency.addImportFilter(PathFilters.rejectAll(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
return; // Skip deployments with out a service xml descriptor
}

moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_MODULES_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_MODULES_ID, false, false, false, false));
}

public void undeploy(final DeploymentUnit context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, PICKETBOX_ID, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, PICKETBOX_ID, false, false, false, false));

//add the remoting login module
final ModuleDependency remoting = new ModuleDependency(moduleLoader, REMOTING_LOGIN_MODULE, false, false, false);
final ModuleDependency remoting = new ModuleDependency(moduleLoader, REMOTING_LOGIN_MODULE, false, false, false, false);
remoting.addImportFilter(PathFilters.is(RemotingLoginModule.class.getName().replace(".","/")), true);
moduleSpecification.addSystemDependency(remoting);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
if (root.getChild(path).exists()) {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false, false));
moduleSpecification.addResourceLoader(getSeamIntResourceLoader());
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
for (ResourceRoot root : resourceRoots) {
VirtualFile child = root.getRoot().getChild(SERVICE_FILE_NAME);
if (child.exists()) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JTA, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JTA, false, false, false, false));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES, dependencyId);
}

final ModuleDependency dependency = new ModuleDependency(dependencyLoader, dependencyId, optional, export, services);
final ModuleDependency dependency = new ModuleDependency(dependencyLoader, dependencyId, optional, export, services, true);
if(metaInf) {
dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
if (entries != null) {
for (ModuleIdentifier entry : entries) {
//class path items are always exported to make transitive dependencies work
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, entry, false, true, true));
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, entry, false, true, true, false));
}
}

Expand All @@ -65,10 +65,10 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
// this means that a module that references the additional module
// gets access to the transitive closure of its call-path entries
for (ModuleIdentifier entry : dependencies) {
additionalModule.addLocalDependency(new ModuleDependency(moduleLoader, entry, false, true, true));
additionalModule.addLocalDependency(new ModuleDependency(moduleLoader, entry, false, true, true, false));
}
// add a dependency on the top ear itself for good measure
additionalModule.addLocalDependency(new ModuleDependency(moduleLoader, deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER), false, false, true));
additionalModule.addLocalDependency(new ModuleDependency(moduleLoader, deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER), false, false, true, false));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public String toString() {
private final List<FilterSpecification> importFilters = new ArrayList<FilterSpecification>();
private final List<FilterSpecification> exportFilters = new ArrayList<FilterSpecification>();
private final boolean importServices;
private final boolean userSpecified;

/**
* Construct a new instance.
Expand All @@ -67,13 +68,15 @@ public String toString() {
* @param optional {@code true} if this is an optional dependency
* @param export {@code true} if resources should be exported by default
* @param importServices
* @param userSpecified {@code true} if this dependency was specified by the user, {@code false} if it was automatically added
*/
public ModuleDependency(final ModuleLoader moduleLoader, final ModuleIdentifier identifier, final boolean optional, final boolean export, final boolean importServices) {
public ModuleDependency(final ModuleLoader moduleLoader, final ModuleIdentifier identifier, final boolean optional, final boolean export, final boolean importServices, final boolean userSpecified) {
this.identifier = identifier;
this.optional = optional;
this.export = export;
this.moduleLoader = moduleLoader;
this.importServices = importServices;
this.userSpecified = userSpecified;
}

public ModuleLoader getModuleLoader() {
Expand All @@ -92,6 +95,10 @@ public boolean isExport() {
return export;
}

public boolean isUserSpecified() {
return userSpecified;
}

public void addImportFilter(PathFilter pathFilter, boolean include) {
importFilters.add(new FilterSpecification(pathFilter, include));
}
Expand Down
Loading

0 comments on commit 0197cde

Please sign in to comment.