This content has been marked as final.
Show 2 replies
-
1. Re: module.xml and jboss-deployment-structure.xml marshalling unmarshlling api
jaysensharma Dec 4, 2014 2:10 AM (in response to linbingjin)I do not see an option to generate jboss-deployment-structure.xml using some programming interface, However we can add a module using jboss-cli.sh script hsing "module add" command as following, Which will create the module structure and will generate the module.xml file as well:
module add --name=xyz.org.mysql --resources=/PATH/TO/mysql-connector-java-5.1.13-bin.jar --dependencies=javax.api,javax.transaction.api
The same command above command can also be executed using "org.jboss.as.cli.CommandContext" based java program as well as an alternative to programmetic approach
import java.io.IOException; import org.jboss.as.cli.CommandContext; import org.jboss.as.cli.CommandContextFactory; import org.jboss.as.cli.CommandLineException; public class Main { public static void main(String[] args) throws CommandLineException, IOException { String host = "localhost"; // 10.10.10.10 int port = 9990; String username="admin"; char[] password="admin@123".toCharArray(); CommandContext ctx=null; try { ctx = CommandContextFactory.getInstance().newCommandContext(username,password); ctx.connectController(host, port); String cliCommand="module add --name=xyz.org.mysql --resources=/PATH/TO/mysql-connector-java-5.1.13-bin.jar --dependencies=javax.api,javax.transaction.api"; ctx.handle(cliCommand); ctx.disconnectController(); } catch (CommandLineException e) { e.printStackTrace(); } finally { ctx.terminateSession(); } } }
You can also try the jboss DMR APIs
-
2. Re: module.xml and jboss-deployment-structure.xml marshalling unmarshlling api
linbingjin Dec 4, 2014 6:13 AM (in response to jaysensharma)Thanks! that would be useful for me.