JBoss Community

Extending AS 7

new comment by John Mazzitelli View all comments on this document

For the record, here's some code that answers my question I had with the Mixed Approach supporing exploded deployments  (I tested this and it works) - thanks to Brian for pointing me to the correct way to build the contentItem ModelNode. I put this if-stmt in there just to show you how you can do both exploded and unexploded deployment via this Mixed Approach (this is code that can go in Brian's prototype):

                URL url = module.getExportedResource("fibo.ear");
                ModelNode contentItem = new ModelNode();

                boolean explodedDeployment = true; // this is here just to keep the code around that deploys if we are unexploded
                if (explodedDeployment) {
                    String urlString = new File(url.toURI()).getAbsolutePath();
                    contentItem.get(PATH).set(urlString);
                    contentItem.get(ARCHIVE).set(false);
                } else {
                    String urlString = url.toExternalForm();
                    contentItem.get(URL).set(urlString);
                }

                op.get(CONTENT).add(contentItem);

So the idea is that you don't have to package fibo.ear as an unexploded deployment file in your module - you can actually package your module with fibo.ear exploded and this will enable it to be deployed properly