本文整理汇总了Java中org.jboss.as.server.deployment.DeploymentUnit.hasAttachment方法的典型用法代码示例。如果您正苦于以下问题:Java DeploymentUnit.hasAttachment方法的具体用法?Java DeploymentUnit.hasAttachment怎么用?Java DeploymentUnit.hasAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.server.deployment.DeploymentUnit
的用法示例。
在下文中一共展示了DeploymentUnit.hasAttachment方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
// If the log context is already defined, skip the rest of the processing
if (!hasRegisteredLogContext(deploymentUnit)) {
if (deploymentUnit.hasAttachment(Attachments.MODULE) && deploymentUnit.hasAttachment(Attachments.DEPLOYMENT_ROOT)) {
// don't process sub-deployments as they are processed by processing methods
final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (SubDeploymentMarker.isSubDeployment(root)) return;
processDeployment(phaseContext, deploymentUnit, root);
// If we still don't have a context registered on the root deployment, register the current context.
// This is done to avoid any logging from the root deployment to have access to a sub-deployments log
// context. For example any library logging from a EAR/lib should use the EAR's configured log context,
// not a log context from a WAR or EJB library.
if (!hasRegisteredLogContext(deploymentUnit) && !deploymentUnit.hasAttachment(DEFAULT_LOG_CONTEXT_KEY)) {
// Register the current log context as this could be an embedded server or overridden another way
registerLogContext(deploymentUnit, DEFAULT_LOG_CONTEXT_KEY, deploymentUnit.getAttachment(Attachments.MODULE), LogContext.getLogContext());
}
}
}
}
示例2: undeploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public final void undeploy(final DeploymentUnit context) {
// OSGi bundles deployments may not have a module attached
if (context.hasAttachment(Attachments.MODULE)) {
// don't process sub-deployments as they are processed by processing methods
final ResourceRoot root = context.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (SubDeploymentMarker.isSubDeployment(root)) return;
// Remove any log context selector references
final Module module = context.getAttachment(Attachments.MODULE);
// Remove either the default log context or a defined log context. It's safe to attempt to remove a
// nonexistent context.
unregisterLogContext(context, DEFAULT_LOG_CONTEXT_KEY, module);
unregisterLogContext(context, LOG_CONTEXT_KEY, module);
// Unregister all sub-deployments
final List<DeploymentUnit> subDeployments = getSubDeployments(context);
for (DeploymentUnit subDeployment : subDeployments) {
final Module subDeploymentModule = subDeployment.getAttachment(Attachments.MODULE);
// Sub-deployment should never have a default log context
unregisterLogContext(subDeployment, LOG_CONTEXT_KEY, subDeploymentModule);
}
}
}
示例3: 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 moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
if (deploymentUnit.hasAttachment(Attachments.RESOURCE_ROOTS)) {
final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
for (ResourceRoot root : resourceRoots) {
VirtualFile child = root.getRoot().getChild(SERVICE_FILE_NAME);
if (child.exists()) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JTA, false, false, false, false));
break;
}
}
}
}
示例4: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.hasAttachment(DeploymentDependencies.ATTACHMENT_KEY)) {
if (deploymentUnit.getParent() != null) {
ServerLogger.DEPLOYMENT_LOGGER.deploymentDependenciesAreATopLevelElement(deploymentUnit.getName());
} else {
processDependencies(phaseContext, deploymentUnit);
}
}
if (deploymentUnit.getParent() != null) {
DeploymentUnit parent = deploymentUnit.getParent();
if (parent.hasAttachment(DeploymentDependencies.ATTACHMENT_KEY)) {
processDependencies(phaseContext, parent);
}
}
}
示例5: getSubDeployments
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
static List<DeploymentUnit> getSubDeployments(final DeploymentUnit deploymentUnit) {
if (deploymentUnit.hasAttachment(Attachments.SUB_DEPLOYMENTS)) {
final List<DeploymentUnit> result = new ArrayList<DeploymentUnit>();
result.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS));
return result;
}
return Collections.emptyList();
}
示例6: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.hasAttachment(Attachments.MODULE))
return;
deployModuleSpec(phaseContext);
}
示例7: hasRegisteredLogContext
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
/**
* Checks the deployment to see if it has a registered {@link org.jboss.logmanager.LogContext log context}.
*
* @param deploymentUnit the deployment unit to check
*
* @return {@code true} if the deployment unit has a log context, otherwise {@code false}
*/
static boolean hasRegisteredLogContext(final DeploymentUnit deploymentUnit) {
return deploymentUnit.hasAttachment(LOG_CONTEXT_KEY);
}