本文整理汇总了Java中org.jboss.as.server.deployment.Attachments类的典型用法代码示例。如果您正苦于以下问题:Java Attachments类的具体用法?Java Attachments怎么用?Java Attachments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attachments类属于org.jboss.as.server.deployment包,在下文中一共展示了Attachments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
Module module = deploymentUnit.getAttachment(Attachments.MODULE);
WildFlyConfigBuilder builder = new WildFlyConfigBuilder();
builder.forClassLoader(module.getClassLoader())
.addDefaultSources()
.addDiscoveredSources()
.addDiscoveredConverters();
addConfigSourcesFromServices(builder, phaseContext.getServiceRegistry(), module.getClassLoader());
Config config = builder.build();
WildFlyConfigProviderResolver.INSTANCE.registerConfig(config, module.getClassLoader());
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(deploymentUnit);
extensions.registerExtensionInstance(new ConfigExtension(), deploymentUnit);
}
}
开发者ID:wildfly-extras,项目名称:wildfly-microprofile-config,代码行数:22,代码来源:SubsystemDeploymentProcessor.java
示例2: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
/**
* Add dependencies for modules required for NoSQL deployments
*/
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final Map<String, String> nosqlDriverModuleNameMap = DriverScanDependencyProcessor.getPerDeploymentDeploymentModuleName(deploymentUnit);
if (nosqlDriverModuleNameMap == null) {
return;
}
for (String nosqlDriverModuleName : nosqlDriverModuleNameMap.values()) {
if (nosqlDriverModuleName != null) {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
addDependency(moduleSpecification, moduleLoader, ModuleIdentifier.fromString(nosqlDriverModuleName));
addMongoCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
addCassandraCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
addNeo4jCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
addOrientCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
}
}
}
示例3: stop
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
/**
* Stop the application.
*/
public void stop() {
ClassLoader origCL = Thread.currentThread().getContextClassLoader();
try {
final Module module = _deployUnit.getAttachment(Attachments.MODULE);
Thread.currentThread().setContextClassLoader(module.getClassLoader());
if (_deploymentState == SwitchYardDeploymentState.STARTED) {
_deployment.stop();
setDeploymentState(SwitchYardDeploymentState.STOPPED);
unregisterManagementNodes();
}
if (_deploymentState == SwitchYardDeploymentState.STARTING
|| _deploymentState == SwitchYardDeploymentState.STOPPED) {
_deployment.destroy();
setDeploymentState(SwitchYardDeploymentState.DESTROYED);
}
} finally {
Thread.currentThread().setContextClassLoader(origCL);
}
}
示例4: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!SwitchYardDeploymentMarker.isSwitchYardDeployment(deploymentUnit)) {
return;
}
final DeploymentUnit parent = deploymentUnit.getParent();
Boolean initializeInOrder = false;
if (parent != null) {
final EarMetaData earConfig = deploymentUnit.getParent().getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
if (earConfig != null) {
initializeInOrder = earConfig.getInitializeInOrder();
}
}
doDeploy(phaseContext, deploymentUnit, initializeInOrder);
}
示例5: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的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());
}
}
}
}
示例6: undeploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的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);
}
}
}
示例7: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的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();
// Add the logging modules
for (ModuleIdentifier moduleId : LOGGING_MODULES) {
try {
LoggingLogger.ROOT_LOGGER.tracef("Adding module '%s' to deployment '%s'", moduleId, deploymentUnit.getName());
moduleLoader.loadModule(moduleId);
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleId, false, false, false, false));
} catch (ModuleLoadException ex) {
LoggingLogger.ROOT_LOGGER.debugf("Module not found: %s", moduleId);
}
}
}
示例8: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final List<PermissionFactory> permissionFactories = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION).getPermissionFactories();
final StringBuilder failedPermissions = new StringBuilder();
for (PermissionFactory factory : permissionFactories) {
// all permissions granted internally by the container are of type ImmediatePermissionFactory - they should
// not be considered when validating the permissions granted to deployments via subsystem or deployment
// descriptors.
if (!(factory instanceof ImmediatePermissionFactory)) {
Permission permission = factory.construct();
boolean implied = this.maxPermissions.implies(permission);
if (!implied) {
failedPermissions.append("\n\t\t" + permission);
}
}
}
if (failedPermissions.length() > 0) {
throw SecurityManagerLogger.ROOT_LOGGER.invalidDeploymentConfiguration(failedPermissions);
}
}
示例9: getAnnotationIndexes
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
public static Map<ResourceRoot, Index> getAnnotationIndexes(final DeploymentUnit deploymentUnit) {
final List<ResourceRoot> allResourceRoots = new ArrayList<ResourceRoot>();
allResourceRoots.addAll(deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS));
allResourceRoots.add(deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT));
Map<ResourceRoot, Index> indexes = new HashMap<ResourceRoot, Index>();
for (ResourceRoot resourceRoot : allResourceRoots) {
if (resourceRoot == null)
continue;
Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
if (index != null) {
indexes.put(resourceRoot, index);
}
}
return indexes;
}
示例10: handleClassPathItems
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
/**
* Loops through all resource roots that have been made available transitively via Class-Path entries, and
* adds them to the list of roots to be processed.
*/
private Collection<? extends ResourceRoot> handleClassPathItems(final DeploymentUnit deploymentUnit) {
final Set<ResourceRoot> additionalRoots = new HashSet<ResourceRoot>();
final ArrayDeque<ResourceRoot> toProcess = new ArrayDeque<ResourceRoot>();
final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
toProcess.addAll(resourceRoots);
final Set<ResourceRoot> processed = new HashSet<ResourceRoot>(resourceRoots);
while (!toProcess.isEmpty()) {
final ResourceRoot root = toProcess.pop();
final List<ResourceRoot> classPathRoots = root.getAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS);
for(ResourceRoot cpRoot : classPathRoots) {
if(!processed.contains(cpRoot)) {
additionalRoots.add(cpRoot);
toProcess.add(cpRoot);
processed.add(cpRoot);
}
}
}
return additionalRoots;
}
示例11: handlingExistingClassPathEntry
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
private void handlingExistingClassPathEntry(final ArrayDeque<RootEntry> resourceRoots, final DeploymentUnit topLevelDeployment, final VirtualFile topLevelRoot, final Map<VirtualFile, ResourceRoot> subDeployments, final Map<VirtualFile, AdditionalModuleSpecification> additionalModules, final Set<VirtualFile> existingAccessibleRoots, final ResourceRoot resourceRoot, final Attachable target, final VirtualFile classPathFile) throws DeploymentUnitProcessingException {
if (existingAccessibleRoots.contains(classPathFile)) {
ServerLogger.DEPLOYMENT_LOGGER.debugf("Class-Path entry %s in %s ignored, as target is already accessible", classPathFile, resourceRoot.getRoot());
} else if (additionalModules.containsKey(classPathFile)) {
final AdditionalModuleSpecification moduleSpecification = additionalModules.get(classPathFile);
//as class path entries are exported, transitive dependencies will also be available
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, moduleSpecification.getModuleIdentifier());
} else if (subDeployments.containsKey(classPathFile)) {
//now we need to calculate the sub deployment module identifier
//unfortunately the sub deployment has not been setup yet, so we cannot just
//get it from the sub deployment directly
final ResourceRoot otherRoot = subDeployments.get(classPathFile);
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, ModuleIdentifierProcessor.createModuleIdentifier(otherRoot.getRootName(), otherRoot, topLevelDeployment, topLevelRoot, false));
} else {
ModuleIdentifier identifier = createAdditionalModule(resourceRoot, topLevelDeployment, topLevelRoot, additionalModules, classPathFile, resourceRoots);
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, identifier);
}
}
示例12: createResourceRoot
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
/**
* Creates a {@link ResourceRoot} for the passed {@link VirtualFile file} and adds it to the list of {@link ResourceRoot}s
* in the {@link DeploymentUnit deploymentUnit}
*
*
* @param file The file for which the resource root will be created
* @return Returns the created {@link ResourceRoot}
* @throws java.io.IOException
*/
private synchronized ResourceRoot createResourceRoot(final VirtualFile file, final DeploymentUnit deploymentUnit, final VirtualFile deploymentRoot) throws DeploymentUnitProcessingException {
try {
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
String relativeName = file.getPathNameRelativeTo(deploymentRoot);
MountedDeploymentOverlay overlay = overlays.get(relativeName);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(file.isFile()) {
closable = VFS.mountZip(file, file, TempFileProviderService.provider());
}
final MountHandle mountHandle = new MountHandle(closable);
final ResourceRoot resourceRoot = new ResourceRoot(file, mountHandle);
ModuleRootMarker.mark(resourceRoot);
ResourceRootIndexer.indexResourceRoot(resourceRoot);
return resourceRoot;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例13: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的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;
}
}
}
}
示例14: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的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);
}
}
}
示例15: deploy
import org.jboss.as.server.deployment.Attachments; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY);
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null || transformer == null) {
return;
}
try {
for (String transformerClassName : moduleSpecification.getClassFileTransformers()) {
transformer.addTransformer((ClassFileTransformer) module.getClassLoader().loadClass(transformerClassName).newInstance());
}
// activate transformer only after all delegate transformers have been added
// so that transformers themselves are not instrumented
transformer.setActive(true);
} catch (Exception e) {
throw ServerLogger.ROOT_LOGGER.failedToInstantiateClassFileTransformer(ClassFileTransformer.class.getSimpleName(), e);
}
}