This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Se crea la instancia del builder necesario para leer el fichero xml | |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
DocumentBuilder builder = factory.newDocumentBuilder(); | |
// Se lee el fichero xml | |
Document document = builder.parse(getClass().getResourceAsStream("path/al/fichero.xml")); | |
// Instancia de xPath necesaria para compilar las expresiones | |
XPath xpath = XPathFactory.newInstance().newXPath(); | |
XPathExpression exprParameter = xpath.compile("//parameter"); | |
/* Una vez compilada la expresión se evalua teniendo en cuenta que el resultado pueden ser múltiples nodos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.persistence.EntityManager; | |
import org.hibernate.Session; | |
import org.hibernate.ejb.HibernateEntityManager; | |
import org.hibernate.jdbc.Work; | |
import net.sf.jasperreports.engine.JRException; | |
import net.sf.jasperreports.engine.JasperCompileManager; | |
import net.sf.jasperreports.engine.JasperFillManager; | |
import net.sf.jasperreports.engine.JasperPrint; | |
import net.sf.jasperreports.engine.JasperReport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.naming.Context; | |
import javax.naming.InitialContext; | |
import javax.sql.DataSource; | |
import java.sql.Connection; | |
... | |
String datasource = "FNOSDS" | |
Context ctx = new InitialContext(); | |
DataSource ds = (DataSource)ctx.lookup(datasource); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>2.4.1</version> | |
<executions> | |
<!-- Ejecutar el goal "shade" en la fase de empaquetado "package" --> | |
<execution> | |
<phase>package</phase> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module xmlns="urn:jboss:module:1.1" name="com.bitsmi.jboss_modules_poc-main"> (1) | |
<main-class name="com.bitsmi.jboss.modules.poc.main.MainProgram" /> (2) | |
<resources> | |
<resource-root path="jboss_modules_poc-main-1.0.0-SNAPSHOT.jar"/> (3) | |
</resources> | |
<dependencies> | |
<module name="javax.api" /> (4) | |
<module name="org.slf4j.slf4j-api" /> (4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServiceLoader<IPluginService> services = Module.getCallerModule().loadService(IPluginService.class); | |
for(IPluginService service:services){ | |
// Para cada uno de ellos ejecutamos una acción | |
log.info("MSG: {}", service.getMessage()); | |
} |