当前位置: 首页>>代码示例>>Java>>正文


Java DeploymentUnit类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:22,代码来源:DriverDependencyProcessor.java

示例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());
    }


}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:17,代码来源:DriverScanDependencyProcessor.java

示例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());
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:11,代码来源:DriverScanDependencyProcessor.java

示例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;
        }
    }
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:TranslatorStructureDeployer.java

示例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);
    }
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:17,代码来源:TranslatorDeployer.java

示例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);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:SwitchYardDeploymentProcessor.java

示例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.");
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:20,代码来源:SwitchYardCdiIntegrationProcessor.java

示例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);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:19,代码来源:ArquillianService.java

示例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);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:AbstractLoggingDeploymentProcessor.java

示例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);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:AbstractLoggingDeploymentProcessor.java

示例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());
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:AbstractLoggingDeploymentProcessor.java

示例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);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:LoggingDependencyDeploymentProcessor.java

示例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);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:PermissionsValidationProcessor.java

示例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;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:AnnotationIndexUtils.java


注:本文中的org.jboss.as.server.deployment.DeploymentUnit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。