<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    AS 7 Deployment APIs
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/bstansberry%40jboss.com">Brian Stansberry</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/559597#559597">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Thread to discuss the client deployment APIs for AS&#160; 7.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This thread is closely related to and will probably interweave with ALR's thread at <a class="jive-link-external-small" href="https://community.jboss.org/thread/154922?tstart=0">https://community.jboss.org/thread/154922?tstart=0</a> but that thread has a scope beyond AS 7, so I want a separate one for the purely AS7-focused aspects.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've posted some thoughts on deployment API in code form in a topic branch on my github repo. See <a class="jive-link-external-small" href="http://github.com/bstansberry/jboss-as/tree/hot-deploy">http://github.com/bstansberry/jboss-as/tree/hot-deploy</a> and in particular <a class="jive-link-external-small" href="http://github.com/bstansberry/jboss-as/tree/hot-deploy/domain/src/main/java/org/jboss/as/deployment/plan/">http://github.com/bstansberry/jboss-as/tree/hot-deploy/domain/src/main/java/org/jboss/as/deployment/plan/</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>That work is just a draft and a basis for discussion. So thoughts and comments are very much wanted.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The <span style="font-family: courier new,courier;">impl</span> subpackages there aren't critical, particularly <span style="font-family: courier new,courier;">domain/impl</span> which is for sure wrong. I'm mostly interested in the other packages, which express the API. Note also that much if not all of this should probably move out of the domain module.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>There are 2 subpackages, <span style="font-family: courier new,courier;">domain</span> and <span style="font-family: courier new,courier;">standalone</span>. This is because the API for the full DomainController use case is significantly more complex. There is a fair bit of duplication between the two; perhaps some refactoring could be done once we decide what we want.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The core of this is a client:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>1) Gets a reference to <span style="font-family: courier new,courier;">DomainDeploymentManager</span> or <span style="font-family: courier new,courier;">StandaloneDeploymentManager</span>. How is TBD.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>2) Client creates a <span style="font-family: courier new,courier;">DeploymentPlan</span>. This describes a coherent unit of work that should be done to add deployment content, deploy content, undeploy content, remove content.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Creation of the DeploymentPlan is done by getting a Builder object from the deployment manager and invoking operations on it.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">StandaloneDeploymentManager deploymentManager = magicallyGetDeploymentManager();</span></p><p><span style="font-family: courier new,courier;">File war = getWarFileFromSomewhere();</span></p><p><span style="font-family: courier new,courier;">URL ear = getEarURLFromSomewhere();</span></p><p><span style="font-family: courier new,courier;"><br/></span></p><p><span style="font-family: courier new,courier;">DeploymentPlan plan = deploymentManager.newDeploymentPlan()</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .withGlobalRollback()</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .add(war).andDeploy()</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .add(ear).andDeploy();</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The main part of the API is in the Builder interfaces that start from the return value from <span style="font-family: courier new,courier;">StandaloneDeploymentManager.newDeploymentPlan()</span>. There are five basic operations:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>add -- makes deployment content available to the standalone server or to the domain controller</li><li>deploy -- instruction that previously added content should be deployed on a standalone server or to one or more server groups</li><li>undeploy -- instruction that previously deployed content should be undeployed from a standalone server or from one or more server groups</li><li>replace -- atomic deply+undeploy. So if rollback is enabled and deploying the new content fails, the old content would be deployed</li><li>remove -- remove no longer deployed content from the repository where the standalone server or domain controller keeps content.</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I tried to create a fluent API so following one directive to the builder, logically coherent other directives become available, e.g.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">add(war).andDeploy()</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>3) Client asks deployment manager to execute the plan; gets back a <span style="font-family: courier new,courier;">DeploymentPlanResult</span> which can be inspected to see what happened. The DeploymentPlanResult returns a Future for each action that went into the deployment plan, so the client can review the result asynchronously.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">DeploymentPlanResult result = deploymentManager.execute(plan);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'll post more later today on some of the nuances, but that's a quick intro. I did a lot of javadoc, so the best way to understand is to poke around.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>A few other basic points:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Deployment content once added to the system has a identifying key, in this draft represented by the <span style="font-family: courier new,courier;">DeploymentUnitKey</span> class. That's basically an encapsulation of the name of the deployment and it's SHA1 hash. Making clients use the DeploymentUnitKey class feels a bit clunky, so overloaded methods that just use a String form (e.g. "foo.war/a1b2...") are available. Perhaps we should only use the String form in the API?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The API also includes a "repository" notion, e.g. add(String name, String repository, URL content). This isn't core to the API -- it's to support a notion of separate locations where a standalone server could store deployment content, one or more of which might be a hot deployment repository with an associated scanner. We need a separate discussion on whether this is the right way to do hot deployment. If not, the "repository" notion in this API could go away.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/559597#559597">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>