本文整理汇总了Java中org.jboss.as.server.deployment.DeploymentUnit类的典型用法代码示例。如果您正苦于以下问题:Java DeploymentUnit类的具体用法?Java DeploymentUnit怎么用?Java DeploymentUnit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentUnit类属于org.jboss.as.server.deployment包,在下文中一共展示了DeploymentUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的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.DeploymentUnit; //导入依赖的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: processClassNamedQualifier
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
private void processClassNamedQualifier(DeploymentUnit deploymentUnit, String profile) {
if (isEmpty(profile)) {
ROOT_LOGGER.annotationAttributeMissing("@Named", "value");
return;
}
SubsystemService service = getService();
String moduleName = service.moduleNameFromProfile(profile);
if (moduleName != null) {
savePerDeploymentModuleName(deploymentUnit, moduleName, service.vendorKey());
ROOT_LOGGER.scannedNamedQualifier(profile, moduleName);
} else {
ROOT_LOGGER.ignoringNamedQualifier(profile,getService().profileNames());
}
}
示例4: processMethodResource
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
protected void processMethodResource(final DeploymentUnit deploymentUnit, final MethodInfo methodInfo, final String lookup) throws DeploymentUnitProcessingException {
SubsystemService service = getService();
String moduleName = getService().moduleNameFromJndi(lookup);
if (moduleName != null) {
savePerDeploymentModuleName(deploymentUnit, moduleName, service.vendorKey());
ROOT_LOGGER.scannedResourceLookup(lookup, moduleName);
} else {
ROOT_LOGGER.ignoringResourceLookup(lookup, getService().jndiNames());
}
}
示例5: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (TeiidAttachments.isTranslator(deploymentUnit)) {
return;
}
List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
for (ResourceRoot resourceRoot : resourceRoots) {
final VirtualFile deploymentRoot = resourceRoot.getRoot();
if (deploymentRoot.getChild("META-INF/services/org.teiid.translator.ExecutionFactory").exists()) { //$NON-NLS-1$
TeiidAttachments.setAsTranslatorDeployment(deploymentUnit);
//deploymentUnit.putAttachment(Attachments.IGNORE_OSGI, Boolean.TRUE);
break;
}
}
}
示例6: undeploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
@Override
public void undeploy(final DeploymentUnit context) {
if (!TeiidAttachments.isTranslator(context)) {
return;
}
VDBTranslatorMetaData metadata = context.getAttachment(TeiidAttachments.TRANSLATOR_METADATA);
if (metadata == null) {
return;
}
final ServiceRegistry registry = context.getServiceRegistry();
final ServiceName serviceName = TeiidServiceNames.translatorServiceName(metadata.getName());
final ServiceController<?> controller = registry.getService(serviceName);
if (controller != null) {
controller.setMode(Mode.REMOVE);
}
}
示例7: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的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);
}
示例8: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!SwitchYardDeploymentMarker.isSwitchYardDeployment(deploymentUnit)) {
return;
}
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
// Add the Weld portable extension
final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
synchronized (parent) {
checkExtension(SWITCHYARD_CDI_EXTENSION, deploymentUnit, parent);
checkExtension(DELTASPIKE_CDI_EXTENSION, deploymentUnit, parent);
}
} else {
_logger.debug("SwitchYard Application for deployment unit '" + deploymentUnit.getName() + "' does not appear to contain CDI Beans "
+ "(no META-INF/beans.xml file in unit). Not attaching SwitchYard CDI Discovery Extension to deployment.");
}
}
示例9: doRunTestMethod
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
@Override
protected TestResult doRunTestMethod(TestRunner runner, Class<?> testClass, String methodName, Map<String, String> protocolProps) {
ClassLoader runWithClassLoader = ClassLoader.getSystemClassLoader();
if (Boolean.parseBoolean(protocolProps.get(ExtendedJMXProtocolConfiguration.PROPERTY_ENABLE_TCCL))) {
ArquillianConfig config = getArquillianConfig(testClass.getName(), 30000L);
DeploymentUnit depUnit = config.getDeploymentUnit().getValue();
Module module = depUnit.getAttachment(Attachments.MODULE);
if (module != null) {
runWithClassLoader = module.getClassLoader();
}
}
ClassLoader tccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(runWithClassLoader);
try {
return super.doRunTestMethod(runner, testClass, methodName, protocolProps);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(tccl);
}
}
示例10: 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);
}
}
}
示例11: registerLogContext
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
private void registerLogContext(final DeploymentUnit deploymentUnit, final AttachmentKey<LogContext> attachmentKey, final Module module, final LogContext logContext) {
LoggingLogger.ROOT_LOGGER.tracef("Registering LogContext %s for deployment %s", logContext, deploymentUnit.getName());
if (WildFlySecurityManager.isChecking()) {
WildFlySecurityManager.doUnchecked(new PrivilegedAction<Object>() {
@Override
public Object run() {
logContextSelector.registerLogContext(module.getClassLoader(), logContext);
return null;
}
});
} else {
logContextSelector.registerLogContext(module.getClassLoader(), logContext);
}
// Add the log context to the sub-deployment unit for later removal
deploymentUnit.putAttachment(attachmentKey, logContext);
}
示例12: unregisterLogContext
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的package包/类
private void unregisterLogContext(final DeploymentUnit deploymentUnit, final AttachmentKey<LogContext> attachmentKey, final Module module) {
final LogContext logContext = deploymentUnit.removeAttachment(attachmentKey);
if (logContext != null) {
final boolean success;
if (WildFlySecurityManager.isChecking()) {
success = WildFlySecurityManager.doUnchecked(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return logContextSelector.unregisterLogContext(module.getClassLoader(), logContext);
}
});
} else {
success = logContextSelector.unregisterLogContext(module.getClassLoader(), logContext);
}
if (success) {
LoggingLogger.ROOT_LOGGER.tracef("Removed LogContext '%s' from '%s'", logContext, module);
} else {
LoggingLogger.ROOT_LOGGER.logContextNotRemoved(logContext, deploymentUnit.getName());
}
}
}
示例13: 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();
// 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);
}
}
}
示例14: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的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);
}
}
示例15: getAnnotationIndexes
import org.jboss.as.server.deployment.DeploymentUnit; //导入依赖的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;
}