use of org.jboss.metadata.ejb.spec.EjbJarMetaData in project wildfly by wildfly.
the class ResourceAdaptorMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final MessageDrivenComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
final String ejbName = componentConfiguration.getEJBName();
final EjbJarMetaData metaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (metaData == null) {
return;
}
final AssemblyDescriptorMetaData assemblyDescriptor = metaData.getAssemblyDescriptor();
if (assemblyDescriptor == null) {
return;
}
final List<EJBBoundResourceAdapterBindingMetaData> resourceAdapterBindingDataList = assemblyDescriptor.getAny(EJBBoundResourceAdapterBindingMetaData.class);
String configuredAdapterName = null;
if (resourceAdapterBindingDataList != null) {
for (EJBBoundResourceAdapterBindingMetaData resourceAdapterBindingData : resourceAdapterBindingDataList) {
if ("*".equals(resourceAdapterBindingData.getEjbName()) && configuredAdapterName == null) {
configuredAdapterName = resourceAdapterBindingData.getResourceAdapterName();
} else if (ejbName.equals(resourceAdapterBindingData.getEjbName())) {
configuredAdapterName = resourceAdapterBindingData.getResourceAdapterName();
}
}
}
if (configuredAdapterName != null) {
final String adapterName = addEarPrefixIfRelativeName(configuredAdapterName, deploymentUnit, componentClass);
componentConfiguration.setResourceAdapterName(adapterName);
}
}
use of org.jboss.metadata.ejb.spec.EjbJarMetaData in project wildfly by wildfly.
the class SecurityDomainMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException {
String securityDomain = getJBossAppSecurityDomain(deploymentUnit);
String globalSecurityDomain = null;
final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (ejbJarMetaData != null) {
final AssemblyDescriptorMetaData assemblyMetadata = ejbJarMetaData.getAssemblyDescriptor();
if (assemblyMetadata != null) {
final List<EJBBoundSecurityMetaData> securityMetaDatas = assemblyMetadata.getAny(EJBBoundSecurityMetaData.class);
if (securityMetaDatas != null) {
for (final EJBBoundSecurityMetaData securityMetaData : securityMetaDatas) {
if (securityMetaData.getEjbName().equals(description.getComponentName())) {
securityDomain = securityMetaData.getSecurityDomain();
break;
}
// check global security domain
if (securityMetaData.getEjbName().equals("*")) {
globalSecurityDomain = securityMetaData.getSecurityDomain();
continue;
}
}
}
}
}
if (securityDomain != null)
description.setSecurityDomain(securityDomain);
else if (globalSecurityDomain != null)
description.setSecurityDomain(globalSecurityDomain);
}
use of org.jboss.metadata.ejb.spec.EjbJarMetaData in project wildfly by wildfly.
the class EjbJarParsingDeploymentUnitProcessor method deploy.
/**
* Finds an ejb-jar.xml (at WEB-INF of a .war or META-INF of a .jar) parses the file and creates
* metadata out of it. The metadata is then attached to the deployment unit.
*
* @param deploymentPhase
* @throws DeploymentUnitProcessingException
*
*/
@Override
public void deploy(DeploymentPhaseContext deploymentPhase) throws DeploymentUnitProcessingException {
// get hold of the deployment unit.
final DeploymentUnit deploymentUnit = deploymentPhase.getDeploymentUnit();
// get the root of the deployment unit
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses applicationClassesDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final EjbJarMetaData ejbJarMetaData;
final EjbJarMetaData specMetaData = parseEjbJarXml(deploymentUnit);
final EjbJarMetaData jbossMetaData = parseJBossEjb3Xml(deploymentUnit);
if (specMetaData == null) {
if (jbossMetaData == null)
return;
ejbJarMetaData = jbossMetaData;
} else if (jbossMetaData == null) {
ejbJarMetaData = specMetaData;
} else {
ejbJarMetaData = jbossMetaData.createMerged(specMetaData);
}
// Mark it as an EJB deployment
EjbDeploymentMarker.mark(deploymentUnit);
if (!deploymentUnit.hasAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION)) {
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final EjbJarDescription ejbModuleDescription = new EjbJarDescription(moduleDescription, applicationClassesDescription, deploymentUnit.getName().endsWith(".war"));
deploymentUnit.putAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION, ejbModuleDescription);
}
// attach the EjbJarMetaData to the deployment unit
deploymentUnit.putAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA, ejbJarMetaData);
// if the jboss-ejb3.xml has a distinct-name configured then attach it to the deployment unit
if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) {
deploymentUnit.putAttachment(org.jboss.as.ee.structure.Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName());
}
if (ejbJarMetaData.getModuleName() != null) {
eeModuleDescription.setModuleName(ejbJarMetaData.getModuleName());
}
if (ejbJarMetaData.isMetadataComplete()) {
MetadataCompleteMarker.setMetadataComplete(deploymentUnit, true);
}
if (!ejbJarMetaData.isEJB3x()) {
//EJB spec 20.5.1, we do not process annotations for older deployments
MetadataCompleteMarker.setMetadataComplete(deploymentUnit, true);
}
if (ejbJarMetaData.getEnterpriseBeans() != null) {
//check for entity beans
StringBuilder beans = new StringBuilder();
boolean error = false;
for (AbstractEnterpriseBeanMetaData bean : ejbJarMetaData.getEnterpriseBeans()) {
if (bean.getEjbType() == EjbType.ENTITY) {
if (!error) {
error = true;
} else {
beans.append(", ");
}
beans.append(bean.getEjbName());
}
}
if (error) {
throw EjbLogger.ROOT_LOGGER.entityBeansAreNotSupported(beans.toString());
}
}
}
use of org.jboss.metadata.ejb.spec.EjbJarMetaData in project wildfly by wildfly.
the class EjbIIOPDeploymentUnitProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!IIOPDeploymentMarker.isIIOPDeployment(deploymentUnit)) {
return;
}
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit)) {
return;
}
// a bean-name -> IIOPMetaData map, reflecting the assembly descriptor IIOP configuration.
Map<String, IIOPMetaData> iiopMetaDataMap = new HashMap<String, IIOPMetaData>();
final EjbJarMetaData ejbMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (ejbMetaData != null && ejbMetaData.getAssemblyDescriptor() != null) {
List<IIOPMetaData> iiopMetaDatas = ejbMetaData.getAssemblyDescriptor().getAny(IIOPMetaData.class);
if (iiopMetaDatas != null && iiopMetaDatas.size() > 0) {
for (IIOPMetaData metaData : iiopMetaDatas) {
iiopMetaDataMap.put(metaData.getEjbName(), metaData);
}
}
}
final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
if (moduleDescription != null) {
for (final ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
if (componentDescription instanceof EJBComponentDescription) {
final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentDescription;
if (ejbComponentDescription.getEjbRemoteView() != null && ejbComponentDescription.getEjbHomeView() != null) {
// check if there is IIOP metadata for the bean - first using the bean name, then the wildcard "*" if needed.
IIOPMetaData iiopMetaData = iiopMetaDataMap.get(ejbComponentDescription.getEJBName());
if (iiopMetaData == null) {
iiopMetaData = iiopMetaDataMap.get(IIOPMetaData.WILDCARD_BEAN_NAME);
}
// has been enabled by default in the EJB3 subsystem.
if (iiopMetaData != null || settingsService.isEnabledByDefault()) {
processEjb(ejbComponentDescription, deploymentReflectionIndex, module, phaseContext.getServiceTarget(), iiopMetaData);
}
}
}
}
}
}
use of org.jboss.metadata.ejb.spec.EjbJarMetaData in project wildfly by wildfly.
the class AbstractDeploymentModelBuilder method propagateAttachments.
private void propagateAttachments(final DeploymentUnit unit, final ArchiveDeployment dep) {
dep.addAttachment(DeploymentUnit.class, unit);
unit.putAttachment(DEPLOYMENT_KEY, dep);
final JBossWebMetaData webMD = getJBossWebMetaData(unit);
dep.addAttachment(JBossWebMetaData.class, webMD);
final WebservicesMetaData webservicesMD = getOptionalAttachment(unit, WEBSERVICES_METADATA_KEY);
dep.addAttachment(WebservicesMetaData.class, webservicesMD);
JBossWebservicesMetaData jbossWebservicesMD = getOptionalAttachment(unit, JBOSS_WEBSERVICES_METADATA_KEY);
if (unit.getParent() != null) {
jbossWebservicesMD = JBossWebservicesMetaData.merge(getOptionalAttachment(unit.getParent(), JBOSS_WEBSERVICES_METADATA_KEY), jbossWebservicesMD);
}
dep.addAttachment(JBossWebservicesMetaData.class, jbossWebservicesMD);
final JAXWSDeployment jaxwsDeployment = getOptionalAttachment(unit, JAXWS_ENDPOINTS_KEY);
dep.addAttachment(JAXWSDeployment.class, jaxwsDeployment);
final EjbJarMetaData ejbJarMD = getOptionalAttachment(unit, EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
dep.addAttachment(EjbJarMetaData.class, ejbJarMD);
final RejectionRule rr = getOptionalAttachment(unit, REJECTION_RULE_KEY);
if (rr != null) {
dep.addAttachment(RejectionRule.class, rr);
}
}
Aggregations