本文整理汇总了Java中org.jboss.as.server.deployment.DeploymentUnit.addToAttachmentList方法的典型用法代码示例。如果您正苦于以下问题:Java DeploymentUnit.addToAttachmentList方法的具体用法?Java DeploymentUnit.addToAttachmentList怎么用?Java DeploymentUnit.addToAttachmentList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.server.deployment.DeploymentUnit
的用法示例。
在下文中一共展示了DeploymentUnit.addToAttachmentList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpec = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE_SPECIFICATION);
final Map<ModuleIdentifier, DeploymentUnit> deployments = new HashMap<ModuleIdentifier, DeploymentUnit>();
//local classes are always first
deploymentUnit.addToAttachmentList(Attachments.ACCESSIBLE_SUB_DEPLOYMENTS, deploymentUnit);
buildModuleMap(deploymentUnit, deployments);
for (final ModuleDependency dependency : moduleSpec.getAllDependencies()) {
final DeploymentUnit sub = deployments.get(dependency.getIdentifier());
if (sub != null) {
deploymentUnit.addToAttachmentList(Attachments.ACCESSIBLE_SUB_DEPLOYMENTS, sub);
}
}
}
示例2: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
// Get the CDI-enabled ValidatorFactory and add it to the servlet context
ValidatorFactory validatorFactory = deploymentUnit.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY);
deploymentUnit.addToAttachmentList(ServletContextAttribute.ATTACHMENT_KEY,
new ServletContextAttribute(VALIDATOR_FACTORY_KEY, validatorFactory));
}
示例3: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.getParent() != null) {
return;
}
final List<DeploymentUnit> deploymentUnits = new ArrayList<DeploymentUnit>();
deploymentUnits.add(deploymentUnit);
deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS));
for (DeploymentUnit unit : deploymentUnits) {
final ResourceRoot mainRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (mainRoot == null)
continue;
VirtualFile root = mainRoot.getRoot();
for (String path : SEAM_FILES) {
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,
false)); // for VFS scanner
try {
ResourceLoader resourceLoader = ResourceLoaders.createJarResourceLoader(SEAM_INT_JAR, new JarFile(
getSeamIntResourceRoot().getRoot().getPathName()));
moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader));
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
unit.addToAttachmentList(Attachments.RESOURCE_ROOTS, getSeamIntResourceRoot());
return;
}
}
}
}
示例4: createAdditionalModule
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
private ModuleIdentifier createAdditionalModule(final ResourceRoot resourceRoot, final DeploymentUnit topLevelDeployment, final VirtualFile topLevelRoot, final Map<VirtualFile, AdditionalModuleSpecification> additionalModules, final VirtualFile classPathFile, final ArrayDeque<RootEntry> resourceRoots) throws DeploymentUnitProcessingException {
final ResourceRoot root = createResourceRoot(classPathFile, topLevelDeployment, topLevelRoot);
final String pathName = root.getRoot().getPathNameRelativeTo(topLevelRoot);
ModuleIdentifier identifier = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + topLevelDeployment.getName() + "." + pathName);
AdditionalModuleSpecification module = new AdditionalModuleSpecification(identifier, root);
topLevelDeployment.addToAttachmentList(Attachments.ADDITIONAL_MODULES, module);
additionalModules.put(classPathFile, module);
resourceRoot.addToAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS, root);
//add this to the list of roots to be processed, so transitive class path entries will be respected
resourceRoots.add(new RootEntry(module, root));
return identifier;
}
示例5: handleDeployment
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
private void handleDeployment(final DeploymentPhaseContext phaseContext, final DeploymentUnit deploymentUnit, final ModuleSpecification moduleSpec, final ModuleStructureSpec rootDeploymentSpecification, Set<ModuleIdentifier> additionalModules) throws DeploymentUnitProcessingException {
final Map<VirtualFile, ResourceRoot> resourceRoots = resourceRoots(deploymentUnit);
moduleSpec.addUserDependencies(rootDeploymentSpecification.getModuleDependencies());
moduleSpec.addExclusions(rootDeploymentSpecification.getExclusions());
moduleSpec.addAliases(rootDeploymentSpecification.getAliases());
moduleSpec.addModuleSystemDependencies(rootDeploymentSpecification.getSystemDependencies());
for (final ResourceRoot additionalResourceRoot : rootDeploymentSpecification.getResourceRoots()) {
final ResourceRoot existingRoot = resourceRoots.get(additionalResourceRoot.getRoot());
if (existingRoot != null) {
//we already have to the resource root
//so now we want to merge it
existingRoot.merge(additionalResourceRoot);
} else if (!additionalResourceRoot.getRoot().exists()) {
ServerLogger.DEPLOYMENT_LOGGER.additionalResourceRootDoesNotExist(additionalResourceRoot.getRoot().getPathName());
} else {
deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, additionalResourceRoot);
//compute the annotation index for the root
ResourceRootIndexer.indexResourceRoot(additionalResourceRoot);
ModuleRootMarker.mark(additionalResourceRoot);
}
}
for (final String classFileTransformer : rootDeploymentSpecification.getClassFileTransformers()) {
moduleSpec.addClassFileTransformer(classFileTransformer);
}
//handle annotations
for (final ModuleIdentifier dependency : rootDeploymentSpecification.getAnnotationModules()) {
deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES, dependency);
//additional modules will not be created till much later, a dep on them would fail
if(dependency.getName().startsWith(ServiceModuleLoader.MODULE_PREFIX) && !additionalModules.contains(dependency)) {
phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleServiceName(dependency));
}
}
moduleSpec.setLocalLast(rootDeploymentSpecification.isLocalLast());
if(rootDeploymentSpecification.getExcludedSubsystems() != null) {
deploymentUnit.putAttachment(Attachments.EXCLUDED_SUBSYSTEMS, rootDeploymentSpecification.getExcludedSubsystems());
}
}
示例6: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
/**
* Process the deployment root for module dependency information.
*
* @param phaseContext the deployment unit context
* @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
*/
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServiceModuleLoader deploymentModuleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
final List<ResourceRoot> allResourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
DeploymentUnit top = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
Set<ModuleIdentifier> additionalModules = new HashSet<>();
for(AdditionalModuleSpecification i : top.getAttachmentList(Attachments.ADDITIONAL_MODULES)) {
additionalModules.add(i.getModuleIdentifier());
}
for (final ResourceRoot resourceRoot : allResourceRoots) {
final Manifest manifest = resourceRoot.getAttachment(Attachments.MANIFEST);
if (manifest == null)
continue;
final String dependencyString = ManifestHelper.getMainAttributeValue(manifest, DEPENDENCIES_ATTR);
if (dependencyString == null)
continue;
if(deploymentUnit.getParent() == null &&
SubDeploymentMarker.isSubDeployment(resourceRoot)) {
//we do not want ears reading sub deployments manifests
continue;
}
final String[] dependencyDefs = dependencyString.split(",");
for (final String dependencyDef : dependencyDefs) {
final String trimmed = dependencyDef.trim();
if(trimmed.isEmpty()) {
continue;
}
final String[] dependencyParts = trimmed.split(" ");
final ModuleIdentifier dependencyId = ModuleIdentifier.fromString(dependencyParts[0]);
final boolean export = containsParam(dependencyParts, EXPORT_PARAM);
final boolean optional = containsParam(dependencyParts, OPTIONAL_PARAM);
final boolean services = containsParam(dependencyParts, SERVICES_PARAM);
final boolean annotations = containsParam(dependencyParts, ANNOTATIONS_PARAM);
final boolean metaInf = containsParam(dependencyParts, META_INF);
final ModuleLoader dependencyLoader;
if (dependencyId.getName().startsWith("deployment.")) {
dependencyLoader = deploymentModuleLoader;
} else {
dependencyLoader = Module.getBootModuleLoader();
}
if(annotations) {
deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES, dependencyId);
if(dependencyLoader == deploymentModuleLoader && !additionalModules.contains(dependencyId)) {
//additional modules will not be created till much later, a dep on them would fail
phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleServiceName(dependencyId));
}
}
final ModuleDependency dependency = new ModuleDependency(dependencyLoader, dependencyId, optional, export, services, true);
if(metaInf) {
dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), true);
dependency.addImportFilter(PathFilters.getMetaInfFilter(), true);
}
deploymentUnit.addToAttachmentList(Attachments.MANIFEST_DEPENDENCIES, dependency);
}
}
}