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);
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations