use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class JBossWebParsingDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
// Skip non web deployments
return;
}
final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
final VirtualFile jbossWebXml = deploymentRoot.getChild(JBOSS_WEB_XML);
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
assert warMetaData != null;
if (jbossWebXml.exists()) {
InputStream is = null;
try {
is = jbossWebXml.openStream();
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setXMLResolver(NoopXMLResolver.create());
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
final JBossWebMetaData jBossWebMetaData = JBossWebMetaDataParser.parse(xmlReader, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
warMetaData.setJBossWebMetaData(jBossWebMetaData);
// deployment unit
if (jBossWebMetaData.getValves() != null) {
for (ValveMetaData valve : jBossWebMetaData.getValves()) {
UndertowLogger.ROOT_LOGGER.unsupportedValveFeature(valve.getValveClass());
}
}
if (jBossWebMetaData.getDistinctName() != null) {
deploymentUnit.putAttachment(org.jboss.as.ee.structure.Attachments.DISTINCT_NAME, jBossWebMetaData.getDistinctName());
}
} catch (XMLStreamException e) {
throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(jbossWebXml.toString(), e.getLocation().getLineNumber(), e.getLocation().getColumnNumber()), e);
} catch (IOException e) {
throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(jbossWebXml.toString()), e);
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
}
} else {
// jboss web embedded inside jboss-all.xml
final JBossWebMetaData jbMeta = deploymentUnit.getAttachment(WebJBossAllParser.ATTACHMENT_KEY);
if (jbMeta != null) {
warMetaData.setJBossWebMetaData(jbMeta);
}
}
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class WebMetaDataCreator method create.
/**
* Creates web meta data for Jakarta Enterprise Beans deployments.
*
* @param dep webservice deployment
*/
void create(final Deployment dep) {
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
WarMetaData warMD = ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
JBossWebMetaData jbossWebMD = warMD != null ? warMD.getMergedJBossWebMetaData() : null;
if (warMD == null) {
warMD = new WarMetaData();
}
if (jbossWebMD == null) {
jbossWebMD = new JBossWebMetaData();
warMD.setMergedJBossWebMetaData(jbossWebMD);
unit.putAttachment(WarMetaData.ATTACHMENT_KEY, warMD);
}
createWebAppDescriptor(dep, jbossWebMD);
createJBossWebAppDescriptor(dep, jbossWebMD);
dep.addAttachment(JBossWebMetaData.class, jbossWebMD);
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class UndertowDeploymentProcessor method processDeployment.
private void processDeployment(final WarMetaData warMetaData, final DeploymentUnit deploymentUnit, final ServiceTarget serviceTarget, final String deploymentName, final String hostName, final String serverInstanceName) throws DeploymentUnitProcessingException {
ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null) {
throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failedToResolveModule(deploymentUnit));
}
final JBossWebMetaData metaData = warMetaData.getMergedJBossWebMetaData();
final List<SetupAction> setupActions = deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS);
ScisMetaData scisMetaData = deploymentUnit.getAttachment(ScisMetaData.ATTACHMENT_KEY);
final Set<ServiceName> dependentComponents = new HashSet<>();
// see AS7-2077
// basically we want to ignore components that have failed for whatever reason
// if they are important they will be picked up when the web deployment actually starts
final List<ServiceName> components = deploymentUnit.getAttachmentList(WebComponentDescription.WEB_COMPONENTS);
final Set<ServiceName> failed = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.FAILED_COMPONENTS);
for (final ServiceName component : components) {
if (!failed.contains(component)) {
dependentComponents.add(component);
}
}
String servletContainerName = metaData.getServletContainerName();
if (servletContainerName == null) {
servletContainerName = defaultContainer;
}
boolean componentRegistryExists = true;
ComponentRegistry componentRegistry = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.COMPONENT_REGISTRY);
if (componentRegistry == null) {
componentRegistryExists = false;
//we do this to avoid lots of other null checks
//this will only happen if the EE subsystem is not installed
componentRegistry = new ComponentRegistry(null);
}
final WebInjectionContainer injectionContainer = new WebInjectionContainer(module.getClassLoader(), componentRegistry);
String jaccContextId = metaData.getJaccContextID();
if (jaccContextId == null) {
jaccContextId = deploymentUnit.getName();
}
if (deploymentUnit.getParent() != null) {
jaccContextId = deploymentUnit.getParent().getName() + "!" + jaccContextId;
}
final String pathName = pathNameOfDeployment(deploymentUnit, metaData);
boolean securityEnabled = deploymentUnit.hasAttachment(SecurityAttachments.SECURITY_ENABLED);
String metaDataSecurityDomain = metaData.getSecurityDomain();
if (metaDataSecurityDomain == null) {
metaDataSecurityDomain = getJBossAppSecurityDomain(deploymentUnit);
}
if (metaDataSecurityDomain != null) {
metaDataSecurityDomain = metaDataSecurityDomain.trim();
}
final String securityDomain;
if (securityEnabled) {
securityDomain = metaDataSecurityDomain == null ? defaultSecurityDomain : SecurityUtil.unprefixSecurityDomain(metaDataSecurityDomain);
} else {
securityDomain = null;
}
final Set<ServiceName> additionalDependencies = new HashSet<>();
for (final SetupAction setupAction : setupActions) {
Set<ServiceName> dependencies = setupAction.dependencies();
if (dependencies != null) {
additionalDependencies.addAll(dependencies);
}
}
SharedSessionManagerConfig sharedSessionManagerConfig = deploymentUnit.getParent() != null ? deploymentUnit.getParent().getAttachment(UndertowAttachments.SHARED_SESSION_MANAGER_CONFIG) : null;
if (!deploymentResourceRoot.isUsePhysicalCodeSource()) {
try {
deploymentUnit.addToAttachmentList(ServletContextAttribute.ATTACHMENT_KEY, new ServletContextAttribute(Constants.CODE_SOURCE_ATTRIBUTE_NAME, deploymentRoot.toURL()));
} catch (MalformedURLException e) {
throw new DeploymentUnitProcessingException(e);
}
}
deploymentUnit.addToAttachmentList(ServletContextAttribute.ATTACHMENT_KEY, new ServletContextAttribute(Constants.PERMISSION_COLLECTION_ATTRIBUTE_NAME, deploymentUnit.getAttachment(Attachments.MODULE_PERMISSIONS)));
additionalDependencies.addAll(warMetaData.getAdditionalDependencies());
final ServiceName hostServiceName = UndertowService.virtualHostName(serverInstanceName, hostName);
final ServiceName deploymentServiceName = UndertowService.deploymentServiceName(serverInstanceName, hostName, pathName);
TldsMetaData tldsMetaData = deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY);
UndertowDeploymentInfoService undertowDeploymentInfoService = UndertowDeploymentInfoService.builder().setAttributes(deploymentUnit.getAttachmentList(ServletContextAttribute.ATTACHMENT_KEY)).setContextPath(pathName).setDeploymentName(//todo: is this deployment name concept really applicable?
deploymentName).setDeploymentRoot(deploymentRoot).setMergedMetaData(warMetaData.getMergedJBossWebMetaData()).setModule(module).setScisMetaData(scisMetaData).setJaccContextId(jaccContextId).setSecurityDomain(securityDomain).setSharedTlds(tldsMetaData == null ? Collections.<TldMetaData>emptyList() : tldsMetaData.getSharedTlds(deploymentUnit)).setTldsMetaData(tldsMetaData).setSetupActions(setupActions).setSharedSessionManagerConfig(sharedSessionManagerConfig).setOverlays(warMetaData.getOverlays()).setExpressionFactoryWrappers(deploymentUnit.getAttachmentList(ExpressionFactoryWrapper.ATTACHMENT_KEY)).setPredicatedHandlers(deploymentUnit.getAttachment(UndertowHandlersDeploymentProcessor.PREDICATED_HANDLERS)).setInitialHandlerChainWrappers(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS)).setInnerHandlerChainWrappers(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_INNER_HANDLER_CHAIN_WRAPPERS)).setOuterHandlerChainWrappers(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_OUTER_HANDLER_CHAIN_WRAPPERS)).setThreadSetupActions(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_THREAD_SETUP_ACTIONS)).setServletExtensions(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_SERVLET_EXTENSIONS)).setExplodedDeployment(ExplodedDeploymentMarker.isExplodedDeployment(deploymentUnit)).setWebSocketDeploymentInfo(deploymentUnit.getAttachment(UndertowAttachments.WEB_SOCKET_DEPLOYMENT_INFO)).setTempDir(warMetaData.getTempDir()).setExternalResources(deploymentUnit.getAttachmentList(UndertowAttachments.EXTERNAL_RESOURCES)).setAllowSuspendedRequests(deploymentUnit.getAttachmentList(UndertowAttachments.ALLOW_REQUEST_WHEN_SUSPENDED)).createUndertowDeploymentInfoService();
final ServiceName deploymentInfoServiceName = deploymentServiceName.append(UndertowDeploymentInfoService.SERVICE_NAME);
ServiceBuilder<DeploymentInfo> infoBuilder = serviceTarget.addService(deploymentInfoServiceName, undertowDeploymentInfoService).addDependency(UndertowService.SERVLET_CONTAINER.append(servletContainerName), ServletContainerService.class, undertowDeploymentInfoService.getContainer()).addDependency(UndertowService.UNDERTOW, UndertowService.class, undertowDeploymentInfoService.getUndertowService()).addDependency(hostServiceName, Host.class, undertowDeploymentInfoService.getHost()).addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, undertowDeploymentInfoService.getServerEnvironmentInjectedValue()).addDependency(SuspendController.SERVICE_NAME, SuspendController.class, undertowDeploymentInfoService.getSuspendControllerInjectedValue()).addDependencies(additionalDependencies);
if (securityDomain != null) {
if (knownSecurityDomain.test(securityDomain)) {
infoBuilder.addDependency(deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT).getCapabilityServiceName(ApplicationSecurityDomainDefinition.APPLICATION_SECURITY_DOMAIN_CAPABILITY, securityDomain), BiFunction.class, undertowDeploymentInfoService.getSecurityFunctionInjector());
} else {
infoBuilder.addDependency(SecurityDomainService.SERVICE_NAME.append(securityDomain), SecurityDomainContext.class, undertowDeploymentInfoService.getSecurityDomainContextValue());
}
}
if (RequestControllerActivationMarker.isRequestControllerEnabled(deploymentUnit)) {
String topLevelName;
if (deploymentUnit.getParent() == null) {
topLevelName = deploymentUnit.getName();
} else {
topLevelName = deploymentUnit.getParent().getName();
}
infoBuilder.addDependency(ControlPointService.serviceName(topLevelName, UndertowExtension.SUBSYSTEM_NAME), ControlPoint.class, undertowDeploymentInfoService.getControlPointInjectedValue());
}
final Set<String> seenExecutors = new HashSet<String>();
if (metaData.getExecutorName() != null) {
final InjectedValue<Executor> executor = new InjectedValue<Executor>();
infoBuilder.addDependency(IOServices.WORKER.append(metaData.getExecutorName()), Executor.class, executor);
undertowDeploymentInfoService.addInjectedExecutor(metaData.getExecutorName(), executor);
seenExecutors.add(metaData.getExecutorName());
}
if (metaData.getServlets() != null) {
for (JBossServletMetaData servlet : metaData.getServlets()) {
if (servlet.getExecutorName() != null && !seenExecutors.contains(servlet.getExecutorName())) {
final InjectedValue<Executor> executor = new InjectedValue<Executor>();
infoBuilder.addDependency(IOServices.WORKER.append(servlet.getExecutorName()), Executor.class, executor);
undertowDeploymentInfoService.addInjectedExecutor(servlet.getExecutorName(), executor);
seenExecutors.add(servlet.getExecutorName());
}
}
}
if (componentRegistryExists) {
infoBuilder.addDependency(ComponentRegistry.serviceName(deploymentUnit), ComponentRegistry.class, undertowDeploymentInfoService.getComponentRegistryInjectedValue());
} else {
undertowDeploymentInfoService.getComponentRegistryInjectedValue().setValue(new ImmediateValue<>(componentRegistry));
}
if (sharedSessionManagerConfig != null) {
infoBuilder.addDependency(deploymentUnit.getParent().getServiceName().append(SharedSessionManagerConfig.SHARED_SESSION_MANAGER_SERVICE_NAME), SessionManagerFactory.class, undertowDeploymentInfoService.getSessionManagerFactoryInjector());
infoBuilder.addDependency(deploymentUnit.getParent().getServiceName().append(SharedSessionManagerConfig.SHARED_SESSION_IDENTIFIER_CODEC_SERVICE_NAME), SessionIdentifierCodec.class, undertowDeploymentInfoService.getSessionIdentifierCodecInjector());
} else {
CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
ServiceName sessionManagerFactoryServiceName = installSessionManagerFactory(support, serviceTarget, deploymentServiceName, deploymentName, module, metaData, deploymentUnit.getAttachment(UndertowAttachments.SERVLET_CONTAINER_SERVICE));
infoBuilder.addDependency(sessionManagerFactoryServiceName, SessionManagerFactory.class, undertowDeploymentInfoService.getSessionManagerFactoryInjector());
ServiceName sessionIdentifierCodecServiceName = installSessionIdentifierCodec(serviceTarget, deploymentServiceName, deploymentName, metaData);
infoBuilder.addDependency(sessionIdentifierCodecServiceName, SessionIdentifierCodec.class, undertowDeploymentInfoService.getSessionIdentifierCodecInjector());
}
infoBuilder.install();
final boolean isWebappBundle = deploymentUnit.hasAttachment(Attachments.OSGI_MANIFEST);
final UndertowDeploymentService service = new UndertowDeploymentService(injectionContainer, !isWebappBundle);
final ServiceBuilder<UndertowDeploymentService> builder = serviceTarget.addService(deploymentServiceName, service).addDependencies(dependentComponents).addDependency(UndertowService.SERVLET_CONTAINER.append(defaultContainer), ServletContainerService.class, service.getContainer()).addDependency(hostServiceName, Host.class, service.getHost()).addDependencies(deploymentUnit.getAttachmentList(Attachments.WEB_DEPENDENCIES)).addDependency(deploymentInfoServiceName, DeploymentInfo.class, service.getDeploymentInfoInjectedValue());
// inject the server executor which can be used by the WebDeploymentService for blocking tasks in start/stop
// of that service
Services.addServerExecutorDependency(builder, service.getServerExecutorInjector(), false);
deploymentUnit.addToAttachmentList(Attachments.DEPLOYMENT_COMPLETE_SERVICES, deploymentServiceName);
// adding JACC service
if (securityEnabled) {
AbstractSecurityDeployer<WarMetaData> deployer = new WarJACCDeployer();
JaccService<WarMetaData> jaccService = deployer.deploy(deploymentUnit, jaccContextId);
if (jaccService != null) {
final ServiceName jaccServiceName = deploymentUnit.getServiceName().append(JaccService.SERVICE_NAME);
ServiceBuilder<?> jaccBuilder = serviceTarget.addService(jaccServiceName, jaccService);
if (deploymentUnit.getParent() != null) {
// add dependency to parent policy
final DeploymentUnit parentDU = deploymentUnit.getParent();
jaccBuilder.addDependency(parentDU.getServiceName().append(JaccService.SERVICE_NAME), PolicyConfiguration.class, jaccService.getParentPolicyInjector());
}
// add dependency to web deployment service
jaccBuilder.addDependency(deploymentServiceName);
jaccBuilder.setInitialMode(Mode.PASSIVE).install();
}
}
// OSGi web applications are activated in {@link WebContextActivationProcessor} according to bundle lifecycle changes
if (isWebappBundle) {
UndertowDeploymentService.ContextActivatorImpl activator = new UndertowDeploymentService.ContextActivatorImpl(builder.install());
deploymentUnit.putAttachment(ContextActivator.ATTACHMENT_KEY, activator);
deploymentUnit.addToAttachmentList(Attachments.BUNDLE_ACTIVE_DEPENDENCIES, deploymentServiceName);
} else {
builder.install();
}
// Process the web related mgmt information
final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
final ModelNode node = deploymentResourceSupport.getDeploymentSubsystemModel(UndertowExtension.SUBSYSTEM_NAME);
node.get(DeploymentDefinition.CONTEXT_ROOT.getName()).set("".equals(pathName) ? "/" : pathName);
node.get(DeploymentDefinition.VIRTUAL_HOST.getName()).set(hostName);
node.get(DeploymentDefinition.SERVER.getName()).set(serverInstanceName);
processManagement(deploymentUnit, metaData);
}
use of org.jboss.as.web.common.WarMetaData in project wildfly by wildfly.
the class UndertowNativeWebSocketDeploymentProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
WarMetaData metaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
if (metaData == null) {
return;
}
JBossWebMetaData mergedMetaData = metaData.getMergedJBossWebMetaData();
if (!mergedMetaData.isEnableWebSockets()) {
return;
}
if (mergedMetaData.getServlets() != null) {
for (final JBossServletMetaData servlet : mergedMetaData.getServlets()) {
if (servlet.getServletClass() != null) {
try {
Class<?> clazz = ClassLoadingUtils.loadClass(servlet.getServletClass(), deploymentUnit);
if (WebSocketConnectionCallback.class.isAssignableFrom(clazz)) {
servlet.setServletClass(WebSocketServlet.class.getName());
if (servlet.getInitParam() == null) {
servlet.setInitParam(new ArrayList<ParamValueMetaData>());
}
final ParamValueMetaData param = new ParamValueMetaData();
param.setParamName(WebSocketServlet.SESSION_HANDLER);
param.setParamValue(clazz.getName());
servlet.getInitParam().add(param);
}
} catch (ClassNotFoundException e) {
throw new DeploymentUnitProcessingException(e);
}
}
}
}
}
use of org.jboss.as.web.common.WarMetaData in project camunda-bpm-platform by camunda.
the class ProcessApplicationProcessor method detectExistingComponent.
/**
* Detect an existing {@link ProcessApplication} component.
*/
protected ComponentDescription detectExistingComponent(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses eeApplicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final CompositeIndex compositeIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
// extract deployment metadata
List<AnnotationInstance> processApplicationAnnotations = null;
List<AnnotationInstance> postDeployAnnnotations = null;
List<AnnotationInstance> preUndeployAnnnotations = null;
Set<ClassInfo> servletProcessApplications = null;
if (compositeIndex != null) {
processApplicationAnnotations = compositeIndex.getAnnotations(DotName.createSimple(ProcessApplication.class.getName()));
postDeployAnnnotations = compositeIndex.getAnnotations(DotName.createSimple(PostDeploy.class.getName()));
preUndeployAnnnotations = compositeIndex.getAnnotations(DotName.createSimple(PreUndeploy.class.getName()));
servletProcessApplications = compositeIndex.getAllKnownSubclasses(DotName.createSimple(ServletProcessApplication.class.getName()));
} else {
return null;
}
if (processApplicationAnnotations.isEmpty()) {
// no pa found, this is not a process application deployment.
return null;
} else if (processApplicationAnnotations.size() > 1) {
// found multiple PAs -> unsupported.
throw new DeploymentUnitProcessingException("Detected multiple classes annotated with @" + ProcessApplication.class.getSimpleName() + ". A deployment must only provide a single @" + ProcessApplication.class.getSimpleName() + " class.");
} else {
// found single PA
AnnotationInstance annotationInstance = processApplicationAnnotations.get(0);
ClassInfo paClassInfo = (ClassInfo) annotationInstance.target();
String paClassName = paClassInfo.name().toString();
ComponentDescription paComponent = null;
// it can either be a Servlet Process Application or a Singleton Session Bean Component or
if (servletProcessApplications.contains(paClassInfo)) {
// Servlet Process Applications can only be deployed inside Web Applications
if (warMetaData == null) {
throw new DeploymentUnitProcessingException("@ProcessApplication class is a ServletProcessApplication but deployment is not a Web Application.");
}
// check whether it's already a servlet context listener:
JBossWebMetaData mergedJBossWebMetaData = warMetaData.getMergedJBossWebMetaData();
List<ListenerMetaData> listeners = mergedJBossWebMetaData.getListeners();
if (listeners == null) {
listeners = new ArrayList<ListenerMetaData>();
mergedJBossWebMetaData.setListeners(listeners);
}
boolean isListener = false;
for (ListenerMetaData listenerMetaData : listeners) {
if (listenerMetaData.getListenerClass().equals(paClassInfo.name().toString())) {
isListener = true;
}
}
if (!isListener) {
// register as Servlet Context Listener
ListenerMetaData listener = new ListenerMetaData();
listener.setListenerClass(paClassName);
listeners.add(listener);
// synthesize WebComponent
WebComponentDescription paWebComponent = new WebComponentDescription(paClassName, paClassName, eeModuleDescription, deploymentUnit.getServiceName(), eeApplicationClasses);
eeModuleDescription.addComponent(paWebComponent);
deploymentUnit.addToAttachmentList(WebComponentDescription.WEB_COMPONENTS, paWebComponent.getStartServiceName());
paComponent = paWebComponent;
} else {
// lookup the existing component
paComponent = eeModuleDescription.getComponentsByClassName(paClassName).get(0);
}
// deactivate sci
} else {
// if its not a ServletProcessApplication it must be a session bean component
List<ComponentDescription> componentsByClassName = eeModuleDescription.getComponentsByClassName(paClassName);
if (!componentsByClassName.isEmpty() && (componentsByClassName.get(0) instanceof SessionBeanComponentDescription)) {
paComponent = componentsByClassName.get(0);
} else {
throw new DeploymentUnitProcessingException("Class " + paClassName + " is annotated with @" + ProcessApplication.class.getSimpleName() + " but is neither a ServletProcessApplication nor an EJB Session Bean Component.");
}
}
if (!postDeployAnnnotations.isEmpty()) {
if (postDeployAnnnotations.size() == 1) {
ProcessApplicationAttachments.attachPostDeployDescription(deploymentUnit, postDeployAnnnotations.get(0));
} else {
throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PostDeploy. Found [" + postDeployAnnnotations + "]");
}
}
if (!preUndeployAnnnotations.isEmpty()) {
if (preUndeployAnnnotations.size() == 1) {
ProcessApplicationAttachments.attachPreUndeployDescription(deploymentUnit, preUndeployAnnnotations.get(0));
} else {
throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PreUndeploy. Found [" + preUndeployAnnnotations + "]");
}
}
return paComponent;
}
}
Aggregations