use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class WSIntegrationProcessorJAXWS_EJB method processAnnotation.
@SuppressWarnings("rawtypes")
private static void processAnnotation(final DeploymentUnit unit, final Class annotationType) {
final EEModuleDescription moduleDescription = getRequiredAttachment(unit, EE_MODULE_DESCRIPTION);
final JAXWSDeployment jaxwsDeployment = getJaxwsDeployment(unit);
for (EEModuleClassDescription description : moduleDescription.getClassDescriptions()) {
@SuppressWarnings("unchecked") ClassAnnotationInformation classAnnotationInfo = description.getAnnotationInformation(annotationType);
if (classAnnotationInfo != null && !classAnnotationInfo.getClassLevelAnnotations().isEmpty()) {
Object obj = classAnnotationInfo.getClassLevelAnnotations().get(0);
AnnotationTarget target = null;
if (obj instanceof WebServiceAnnotationInfo) {
target = ((WebServiceAnnotationInfo) obj).getTarget();
} else if (obj instanceof WebServiceProviderAnnotationInfo) {
target = ((WebServiceProviderAnnotationInfo) obj).getTarget();
} else {
return;
}
final ClassInfo webServiceClassInfo = (ClassInfo) target;
final String webServiceClassName = webServiceClassInfo.name().toString();
final List<ComponentDescription> componentDescriptions = moduleDescription.getComponentsByClassName(webServiceClassName);
final List<SessionBeanComponentDescription> sessionBeans = getSessionBeans(componentDescriptions);
// TODO: assembly processed for each endpoint!
final Set<String> securityRoles = getDeclaredSecurityRoles(unit, webServiceClassInfo);
final WebContextAnnotationWrapper webCtx = getWebContextWrapper(webServiceClassInfo);
final String authMethod = webCtx.getAuthMethod();
final boolean isSecureWsdlAccess = webCtx.isSecureWsdlAccess();
final String transportGuarantee = webCtx.getTransportGuarantee();
final String realmName = webCtx.getRealmName();
for (final SessionBeanComponentDescription sessionBean : sessionBeans) {
if (sessionBean.isStateless() || sessionBean.isSingleton()) {
final EJBViewDescription ejbViewDescription = sessionBean.addWebserviceEndpointView();
final ServiceName ejbViewName = ejbViewDescription.getServiceName();
jaxwsDeployment.addEndpoint(new EJBEndpoint(sessionBean, ejbViewName, securityRoles, authMethod, realmName, isSecureWsdlAccess, transportGuarantee));
}
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class XTSInterceptorDeploymentProcessor method deploy.
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
if (component instanceof SessionBeanComponentDescription) {
registerSessionBeanInterceptors((SessionBeanComponentDescription) component);
}
if (component instanceof WSComponentDescription) {
registerWSPOJOInterceptors((WSComponentDescription) component);
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class EEJndiViewExtension method handleModule.
private void handleModule(final JndiViewExtensionContext context, final DeploymentUnit deploymentUnit, final ModelNode modulesNode, final ServiceRegistry serviceRegistry) throws OperationFailedException {
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
// If it isn't an EE module, just return
if (moduleDescription == null) {
return;
}
final String appName = moduleDescription.getApplicationName();
final String moduleName = moduleDescription.getModuleName();
final ModelNode moduleNode = modulesNode.get(moduleDescription.getModuleName());
final ServiceName moduleContextName = ContextNames.contextServiceNameOfModule(appName, moduleName);
final ServiceController<?> moduleContextController = serviceRegistry.getService(moduleContextName);
if (moduleContextController != null) {
final NamingStore moduleStore = NamingStore.class.cast(moduleContextController.getValue());
try {
context.addEntries(moduleNode.get("java:module"), new NamingContext(moduleStore, null));
} catch (NamingException e) {
throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:module", appName, moduleName)));
}
final Collection<ComponentDescription> componentDescriptions = moduleDescription.getComponentDescriptions();
for (ComponentDescription componentDescription : componentDescriptions) {
final String componentName = componentDescription.getComponentName();
final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(appName, moduleName, componentName);
final ServiceController<?> compContextController = serviceRegistry.getService(compContextServiceName);
if (compContextController != null) {
final ModelNode componentNode = moduleNode.get("components").get(componentName);
final NamingStore compStore = NamingStore.class.cast(compContextController.getValue());
try {
context.addEntries(componentNode.get("java:comp"), new NamingContext(compStore, null));
} catch (NamingException e) {
throw new OperationFailedException(e, new ModelNode().set(EeLogger.ROOT_LOGGER.failedToRead("java:comp", appName, moduleName, componentName)));
}
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class InApplicationClientBindingProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (moduleDescription == null) {
return;
}
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
//if this is a war we need to bind to the modules comp namespace
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName());
bindServices(deploymentUnit, serviceTarget, moduleContextServiceName);
}
for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
if (component.getNamingMode() == ComponentNamingMode.CREATE) {
final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName());
bindServices(deploymentUnit, serviceTarget, compContextServiceName);
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class EEConcurrencyContextHandleFactoryProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (eeModuleDescription == null) {
return;
}
final ComponentConfigurator componentConfigurator = new ComponentConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
final TransactionLeakContextHandleFactory transactionLeakContextHandleFactory = new TransactionLeakContextHandleFactory();
context.addDependency(TransactionManagerService.SERVICE_NAME, TransactionManager.class, transactionLeakContextHandleFactory);
configuration.getConcurrentContext().addFactory(transactionLeakContextHandleFactory);
}
};
for (ComponentDescription componentDescription : eeModuleDescription.getComponentDescriptions()) {
componentDescription.getConfigurators().add(componentConfigurator);
}
}
Aggregations