Search in sources :

Example 56 with DeploymentUnitProcessingException

use of org.jboss.as.server.deployment.DeploymentUnitProcessingException in project wildfly by wildfly.

the class XTSHandlerDeploymentProcessor method deploy.

public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    final List<WebserviceDescriptionMetaData> webserviceDescriptions = new ArrayList<WebserviceDescriptionMetaData>();
    boolean modifiedWSMeta = false;
    for (String endpoint : getDeploymentClasses(unit)) {
        try {
            final EndpointMetaData endpointMetaData = EndpointMetaData.build(unit, endpoint);
            if (endpointMetaData.isXTSEnabled()) {
                XTSDeploymentMarker.mark(unit);
                final boolean result = updateXTSEndpoint(endpoint, endpointMetaData, webserviceDescriptions, unit);
                modifiedWSMeta = modifiedWSMeta || result;
            }
        } catch (XTSException e) {
            throw new DeploymentUnitProcessingException("Error processing endpoint '" + endpoint + "'", e);
        }
    }
    if (modifiedWSMeta) {
        unit.putAttachment(WSAttachmentKeys.WEBSERVICES_METADATA_KEY, new WebservicesMetaData(null, webserviceDescriptions));
    }
}
Also used : WebserviceDescriptionMetaData(org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) ArrayList(java.util.ArrayList) EndpointMetaData(org.jboss.as.xts.jandex.EndpointMetaData) WebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 57 with DeploymentUnitProcessingException

use of org.jboss.as.server.deployment.DeploymentUnitProcessingException in project wildfly by wildfly.

the class EarMetaDataParsingProcessor method handleJbossMetadata.

private JBossAppMetaData handleJbossMetadata(VirtualFile deploymentFile, final PropertyReplacer propertyReplacer, final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
    final VirtualFile applicationXmlFile = deploymentFile.getChild(JBOSS_APP_XML);
    if (!applicationXmlFile.exists()) {
        //may have been in jboss-all.xml
        return deploymentUnit.getAttachment(AppJBossAllParser.ATTACHMENT_KEY);
    }
    InputStream inputStream = null;
    try {
        inputStream = applicationXmlFile.openStream();
        final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        inputFactory.setXMLResolver(NoopXMLResolver.create());
        XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(inputStream);
        return JBossAppMetaDataParser.INSTANCE.parse(xmlReader, propertyReplacer);
    } catch (Exception e) {
        throw EeLogger.ROOT_LOGGER.failedToParse(e, applicationXmlFile);
    } finally {
        VFSUtils.safeClose(inputStream);
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) XMLStreamReader(javax.xml.stream.XMLStreamReader) InputStream(java.io.InputStream) XMLInputFactory(javax.xml.stream.XMLInputFactory) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Example 58 with DeploymentUnitProcessingException

use of org.jboss.as.server.deployment.DeploymentUnitProcessingException in project wildfly by wildfly.

the class EarMetaDataParsingProcessor method handleSpecMetadata.

private EarMetaData handleSpecMetadata(VirtualFile deploymentFile, final PropertyReplacer propertyReplacer) throws DeploymentUnitProcessingException {
    final VirtualFile applicationXmlFile = deploymentFile.getChild(APPLICATION_XML);
    if (!applicationXmlFile.exists()) {
        return null;
    }
    InputStream inputStream = null;
    try {
        inputStream = applicationXmlFile.openStream();
        final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        inputFactory.setXMLResolver(NoopXMLResolver.create());
        XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(inputStream);
        return EarMetaDataParser.INSTANCE.parse(xmlReader, propertyReplacer);
    } catch (Exception e) {
        throw EeLogger.ROOT_LOGGER.failedToParse(e, applicationXmlFile);
    } finally {
        VFSUtils.safeClose(inputStream);
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) XMLStreamReader(javax.xml.stream.XMLStreamReader) InputStream(java.io.InputStream) XMLInputFactory(javax.xml.stream.XMLInputFactory) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Example 59 with DeploymentUnitProcessingException

use of org.jboss.as.server.deployment.DeploymentUnitProcessingException in project wildfly by wildfly.

the class JMSConnectionFactoryDefinitionInjectionSource method getResourceValue.

@Override
public void getResourceValue(ResolutionContext context, ServiceBuilder<?> serviceBuilder, DeploymentPhaseContext phaseContext, Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (targetsPooledConnectionFactory(getActiveMQServerName(properties), resourceAdapter, phaseContext.getServiceRegistry())) {
        try {
            startedPooledConnectionFactory(context, jndiName, serviceBuilder, phaseContext.getServiceTarget(), deploymentUnit, injector);
        } catch (OperationFailedException e) {
            throw new DeploymentUnitProcessingException(e);
        }
    } else {
        // delegate to the resource-adapter subsystem to create a generic JCA connection factory.
        ConnectionFactoryDefinitionInjectionSource cfdis = new ConnectionFactoryDefinitionInjectionSource(jndiName, interfaceName, resourceAdapter);
        cfdis.setMaxPoolSize(maxPoolSize);
        cfdis.setMinPoolSize(minPoolSize);
        cfdis.setTransactionSupportLevel(transactional ? TransactionSupport.TransactionSupportLevel.XATransaction : TransactionSupport.TransactionSupportLevel.NoTransaction);
        // transfer all the generic properties + the additional properties specific to the JMSConnectionFactoryDefinition
        for (Map.Entry<String, String> property : properties.entrySet()) {
            cfdis.addProperty(property.getKey(), property.getValue());
        }
        if (!user.isEmpty()) {
            cfdis.addProperty("user", user);
        }
        if (!password.isEmpty()) {
            cfdis.addProperty("password", password);
        }
        if (!clientId.isEmpty()) {
            cfdis.addProperty("clientId", clientId);
        }
        cfdis.getResourceValue(context, serviceBuilder, phaseContext, injector);
    }
}
Also used : DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) OperationFailedException(org.jboss.as.controller.OperationFailedException) ConnectionFactoryDefinitionInjectionSource(org.jboss.as.connector.deployers.ra.ConnectionFactoryDefinitionInjectionSource) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) Map(java.util.Map) HashMap(java.util.HashMap)

Example 60 with DeploymentUnitProcessingException

use of org.jboss.as.server.deployment.DeploymentUnitProcessingException in project wildfly by wildfly.

the class JMSDestinationDefinitionInjectionSource method startActiveMQDestination.

private void startActiveMQDestination(ResolutionContext context, ServiceBuilder<?> serviceBuilder, DeploymentPhaseContext phaseContext, Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final String uniqueName = uniqueName(context);
    try {
        ServiceName serviceName = MessagingServices.getActiveMQServiceName(getActiveMQServerName(properties));
        if (interfaceName.equals(Queue.class.getName())) {
            startQueue(uniqueName, phaseContext.getServiceTarget(), serviceName, serviceBuilder, deploymentUnit, injector);
        } else {
            startTopic(uniqueName, phaseContext.getServiceTarget(), serviceName, serviceBuilder, deploymentUnit, injector);
        }
    } catch (Exception e) {
        throw new DeploymentUnitProcessingException(e);
    }
}
Also used : DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) ServiceName(org.jboss.msc.service.ServiceName) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) Queue(javax.jms.Queue) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Aggregations

DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)95 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)45 Module (org.jboss.modules.Module)28 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)26 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)26 VirtualFile (org.jboss.vfs.VirtualFile)22 InputStream (java.io.InputStream)20 IOException (java.io.IOException)19 ArrayList (java.util.ArrayList)18 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)18 ViewConfiguration (org.jboss.as.ee.component.ViewConfiguration)18 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)17 ViewDescription (org.jboss.as.ee.component.ViewDescription)16 Method (java.lang.reflect.Method)15 ViewConfigurator (org.jboss.as.ee.component.ViewConfigurator)15 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)15 ServiceName (org.jboss.msc.service.ServiceName)15 ImmediateInterceptorFactory (org.jboss.invocation.ImmediateInterceptorFactory)14 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)12 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)12