use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class DefaultJMSConnectionFactoryBindingProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(EAR, deploymentUnit)) {
return;
}
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (moduleDescription == null) {
return;
}
final String defaultJMSConnectionFactory = moduleDescription.getDefaultResourceJndiNames().getJmsConnectionFactory();
if (defaultJMSConnectionFactory == null) {
return;
}
final LookupInjectionSource injectionSource = new LookupInjectionSource(defaultJMSConnectionFactory);
if (DeploymentTypeMarker.isType(WAR, deploymentUnit)) {
moduleDescription.getBindingConfigurations().add(new BindingConfiguration(MODULE_DEFAULT_JMS_CONNECTION_FACTORY, injectionSource));
} else {
if (DeploymentTypeMarker.isType(APPLICATION_CLIENT, deploymentUnit)) {
moduleDescription.getBindingConfigurations().add(new BindingConfiguration(COMP_DEFAULT_JMS_CONNECTION_FACTORY, injectionSource));
}
for (ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
if (componentDescription.getNamingMode() == ComponentNamingMode.CREATE) {
componentDescription.getBindingConfigurations().add(new BindingConfiguration(COMP_DEFAULT_JMS_CONNECTION_FACTORY, injectionSource));
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class TransactionJndiBindingProcessor 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)) {
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 WebComponentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
return;
}
final Map<String, ComponentDescription> componentByClass = new HashMap<String, ComponentDescription>();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses applicationClassesDescription = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final CompositeIndex compositeIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
if (moduleDescription == null) {
//not an EE deployment
return;
}
for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
componentByClass.put(component.getComponentClassName(), component);
}
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
final TldsMetaData tldsMetaData = deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY);
final Set<String> classes = getAllComponentClasses(deploymentUnit, compositeIndex, warMetaData, tldsMetaData);
for (String clazz : classes) {
if (clazz == null || clazz.trim().isEmpty()) {
continue;
}
ComponentDescription description = componentByClass.get(clazz);
if (description != null) {
//TODO: make sure the component is a managed bean
if (!(description.getViews().size() == 1)) {
throw UndertowLogger.ROOT_LOGGER.wrongComponentType(clazz);
}
} else {
//we do not make the standard tags into components, as there is no need
if (compositeIndex.getClassByName(DotName.createSimple(clazz)) == null) {
boolean found = false;
for (String pack : BUILTIN_TAGLIBS) {
if (clazz.startsWith(pack)) {
found = true;
break;
}
}
if (found) {
continue;
}
}
description = new WebComponentDescription(clazz, clazz, moduleDescription, deploymentUnit.getServiceName(), applicationClassesDescription);
moduleDescription.addComponent(description);
deploymentUnit.addToAttachmentList(WebComponentDescription.WEB_COMPONENTS, description.getStartServiceName());
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class WSIntegrationProcessorJAXWS_HANDLER method processAnnotation.
@Override
protected void processAnnotation(final DeploymentUnit unit, final EEModuleDescription moduleDescription) throws DeploymentUnitProcessingException {
final WSEndpointHandlersMapping mapping = getOptionalAttachment(unit, WS_ENDPOINT_HANDLERS_MAPPING_KEY);
final VirtualFile root = unit.getAttachment(DEPLOYMENT_ROOT).getRoot();
final JBossWebservicesMetaData jbossWebservicesMD = unit.getAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY);
final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
final boolean war = DeploymentTypeMarker.isType(DeploymentType.WAR, unit);
final JBossWebMetaData jwmd = ASHelper.getJBossWebMetaData(unit);
for (EEModuleClassDescription classDescription : moduleDescription.getClassDescriptions()) {
ClassInfo classInfo = null;
ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription.getAnnotationInformation(WebService.class);
if (annotationInfo != null) {
classInfo = (ClassInfo) annotationInfo.getClassLevelAnnotations().get(0).getTarget();
}
final ClassAnnotationInformation<WebServiceProvider, WebServiceProviderAnnotationInfo> providreInfo = classDescription.getAnnotationInformation(WebServiceProvider.class);
if (providreInfo != null) {
classInfo = (ClassInfo) providreInfo.getClassLevelAnnotations().get(0).getTarget();
}
if (classInfo != null && isJaxwsEndpoint(classInfo, index, false)) {
final String endpointClassName = classInfo.name().toString();
final ConfigResolver configResolver = new ConfigResolver(classInfo, jbossWebservicesMD, jwmd, root, war);
final EndpointConfig config = configResolver.resolveEndpointConfig();
if (config != null) {
registerConfigMapping(endpointClassName, config, unit);
}
final Set<String> handlers = getHandlers(endpointClassName, config, configResolver, mapping);
if (!handlers.isEmpty()) {
if (isEjb3(classInfo)) {
for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
if (endpointClassName.equals(ejbEndpoint.getClassName())) {
for (final String handlerClassName : handlers) {
final String ejbEndpointName = ejbEndpoint.getName();
final String handlerName = ejbEndpointName + "-" + handlerClassName;
final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit, handlerName, handlerClassName, ejbEndpointName);
propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
}
}
}
} else {
for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
if (endpointClassName.equals(pojoEndpoint.getClassName())) {
for (final String handlerClassName : handlers) {
final String pojoEndpointName = pojoEndpoint.getName();
final String handlerName = pojoEndpointName + "-" + handlerClassName;
createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
}
}
}
}
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class WSIntegrationProcessorJAXWS_POJO method processAnnotation.
// @Override
protected void processAnnotation(final DeploymentUnit unit, final EEModuleDescription moduleDescription) throws DeploymentUnitProcessingException {
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, unit)) {
return;
}
final Map<String, EEModuleClassDescription> classDescriptionMap = new HashMap<String, org.jboss.as.ee.component.EEModuleClassDescription>();
final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
for (EEModuleClassDescription classDescritpion : moduleDescription.getClassDescriptions()) {
if (isJaxwsEndpoint(classDescritpion, index) && !exclude(unit, classDescritpion)) {
classDescriptionMap.put(classDescritpion.getClassName(), classDescritpion);
}
}
final JBossWebMetaData jbossWebMD = getJBossWebMetaData(unit);
final JAXWSDeployment jaxwsDeployment = getJaxwsDeployment(unit);
if (jbossWebMD != null) {
final Set<String> matchedEps = new HashSet<String>();
for (final ServletMetaData servletMD : getServlets(jbossWebMD)) {
final String endpointClassName = getEndpointClassName(servletMD);
final String endpointName = getEndpointName(servletMD);
if (classDescriptionMap.containsKey(endpointClassName) || matchedEps.contains(endpointClassName)) {
// creating component description for POJO endpoint
final ComponentDescription pojoComponent = createComponentDescription(unit, endpointName, endpointClassName, endpointName);
final ServiceName pojoViewName = registerView(pojoComponent, endpointClassName);
final String urlPattern = getUrlPattern(endpointName, unit);
jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointName, endpointClassName, pojoViewName, urlPattern));
classDescriptionMap.remove(endpointClassName);
matchedEps.add(endpointClassName);
} else {
if (unit.getParent() != null && DeploymentTypeMarker.isType(DeploymentType.EAR, unit.getParent())) {
final EEModuleDescription eeModuleDescription = unit.getParent().getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final CompositeIndex parentIndex = unit.getParent().getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
for (EEModuleClassDescription classDescription : eeModuleDescription.getClassDescriptions()) {
if (classDescription.getClassName().equals(endpointClassName) && isJaxwsEndpoint(classDescription, parentIndex)) {
final ComponentDescription pojoComponent = createComponentDescription(unit, endpointName, endpointClassName, endpointName);
final ServiceName pojoViewName = registerView(pojoComponent, endpointClassName);
final String urlPattern = getUrlPattern(endpointName, unit);
jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointName, endpointClassName, pojoViewName, urlPattern));
}
}
}
}
}
}
for (EEModuleClassDescription classDescription : classDescriptionMap.values()) {
ClassInfo classInfo = null;
String serviceName = null;
String urlPattern = null;
// #1 Override serviceName with the explicit urlPattern from port-component/port-component-uri in jboss-webservices.xml
EJBEndpoint ejbEndpoint = getWebserviceMetadataEJBEndpoint(jaxwsDeployment, classDescription.getClassName());
if (ejbEndpoint != null) {
urlPattern = UrlPatternUtils.getUrlPatternByPortComponentURI(getJBossWebserviceMetaDataPortComponent(unit, ejbEndpoint.getName()));
}
// #2 Override serviceName with @WebContext.urlPattern
if (urlPattern == null) {
final ClassAnnotationInformation<WebContext, WebContextAnnotationInfo> annotationWebContext = classDescription.getAnnotationInformation(WebContext.class);
if (annotationWebContext != null) {
WebContextAnnotationInfo wsInfo = annotationWebContext.getClassLevelAnnotations().get(0);
if (wsInfo != null && wsInfo.getUrlPattern().length() > 0) {
urlPattern = wsInfo.getUrlPattern();
}
}
}
// #3 use serviceName declared in a class annotation
if (urlPattern == null) {
final ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription.getAnnotationInformation(WebService.class);
if (annotationInfo != null) {
WebServiceAnnotationInfo wsInfo = annotationInfo.getClassLevelAnnotations().get(0);
serviceName = wsInfo.getServiceName();
classInfo = (ClassInfo) wsInfo.getTarget();
urlPattern = UrlPatternUtils.getUrlPattern(classInfo.name().local(), serviceName);
if (jaxwsDeployment.contains(urlPattern)) {
urlPattern = UrlPatternUtils.getUrlPattern(classInfo.name().local(), serviceName, wsInfo.getName());
}
}
final ClassAnnotationInformation<WebServiceProvider, WebServiceProviderAnnotationInfo> annotationProviderInfo = classDescription.getAnnotationInformation(WebServiceProvider.class);
if (annotationProviderInfo != null) {
WebServiceProviderAnnotationInfo wsInfo = annotationProviderInfo.getClassLevelAnnotations().get(0);
serviceName = wsInfo.getServiceName();
classInfo = (ClassInfo) wsInfo.getTarget();
}
}
if (classInfo != null) {
final String endpointClassName = classDescription.getClassName();
final ComponentDescription pojoComponent = createComponentDescription(unit, endpointClassName, endpointClassName, endpointClassName);
final ServiceName pojoViewName = registerView(pojoComponent, endpointClassName);
if (urlPattern == null) {
urlPattern = UrlPatternUtils.getUrlPattern(classInfo.name().local(), serviceName);
}
// register POJO endpoint
jaxwsDeployment.addEndpoint(new POJOEndpoint(endpointClassName, pojoViewName, UrlPatternUtils.getUrlPattern(urlPattern)));
}
}
}
Aggregations