Search in sources :

Example 91 with DeploymentUnitProcessingException

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

the class KernelDeploymentParsingProcessor method parseDescriptors.

/**
     * Find and parse -jboss-beans.xml files.
     *
     * @param unit the deployment unit
     * @param root the root
     * @throws DeploymentUnitProcessingException
     *          for any error
     */
protected void parseDescriptors(DeploymentUnit unit, VirtualFile root) throws DeploymentUnitProcessingException {
    if (root == null || root.exists() == false)
        return;
    Collection<VirtualFile> beans;
    final String name = root.getName();
    if (name.endsWith("jboss-beans.xml")) {
        beans = Collections.singleton(root);
    } else {
        VirtualFileFilter filter = new SuffixMatchFilter("jboss-beans.xml");
        beans = new ArrayList<VirtualFile>();
        try {
            // try plain .jar/META-INF
            VirtualFile metainf = root.getChild("META-INF");
            if (metainf.exists())
                beans.addAll(metainf.getChildren(filter));
            // allow for WEB-INF/*-jboss-beans.xml
            VirtualFile webinf = root.getChild("WEB-INF");
            if (webinf.exists()) {
                beans.addAll(webinf.getChildren(filter));
                // allow WEB-INF/classes/META-INF
                metainf = webinf.getChild("classes/META-INF");
                if (metainf.exists())
                    beans.addAll(metainf.getChildren(filter));
            }
        } catch (IOException e) {
            throw new DeploymentUnitProcessingException(e);
        }
    }
    for (VirtualFile beansXmlFile : beans) parseDescriptor(unit, beansXmlFile);
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) VirtualFileFilter(org.jboss.vfs.VirtualFileFilter) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) IOException(java.io.IOException)

Example 92 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 93 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 94 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 95 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