4 Replies Latest reply on Jan 5, 2007 10:42 AM by starksm64

    Deployment through the ProfileService api

    ccrouch

      I just wanted to make sure I've got the right idea about the steps to deploy something which doesnt have an associated DeploymentUnit, e.g. no underlying -ds.xml, using the ProfileService apis:


      a) From the ProfileService you call getProfile(ProfileKey key, String version). As we discussed on todays call the notion of version is going away, right?

      b) On the returned Profile you call getTemplate(String name). This name argument sounds like something for which there should be a definition around, e.g. static list of supported names?

      c) On the returned DeploymentTemplate call expand(Set values). Is Set<org.jboss.profileservice.spi.PropertyInfo> going to get replaced with Set<org.jboss.managed.api.ManagedProperty> or better yet just org.jboss.managed.api.ManagedObject? If so, thats another piece that requires a snapshot of jboss-managed.jar. Somehow expand() is also going to have to set the name attribute on the DeploymentContext it returns.

      d) On the Profile call addDeployment(DeploymentContext d) passing in the DeploymentContext returned from expand().

      e) If the deployment fails an exception of some variety is thrown.

        • 1. Re: Deployment through the ProfileService api
          starksm64

           

          "charles.crouch@jboss.com" wrote:
          I just wanted to make sure I've got the right idea about the steps to deploy something which doesnt have an associated DeploymentUnit, e.g. no underlying -ds.xml, using the ProfileService apis:


          a) From the ProfileService you call getProfile(ProfileKey key, String version). As we discussed on todays call the notion of version is going away, right?

          Correct.

          "charles.crouch@jboss.com" wrote:

          b) On the returned Profile you call getTemplate(String name). This name argument sounds like something for which there should be a definition around, e.g. static list of supported names?

          c) On the returned DeploymentTemplate call expand(Set<PropertyInfo> values). Is Set<org.jboss.profileservice.spi.PropertyInfo> going to get replaced with Set<org.jboss.managed.api.ManagedProperty> or better yet just org.jboss.managed.api.ManagedObject? If so, thats another piece that requires a snapshot of jboss-managed.jar. Somehow expand() is also going to have to set the name attribute on the DeploymentContext it returns.

          That is one way, but its not hooked up yet, and it needs to be synched up with the changes in the managed object api. The notion of a DeploymentTemplate was to create a deployment with preconfigured values coming from manged objects. We also need to actually create the templates.

          "charles.crouch@jboss.com" wrote:

          d) On the Profile call addDeployment(DeploymentContext d) passing in the DeploymentContext returned from expand().

          e) If the deployment fails an exception of some variety is thrown.


          Correct. However, for the initial tests I expect that the base deployment exists, so the way to add a deployment to a profile is:

           URL deploymentURL = ...
           VFS vfs = VFS.getVFS(deploymentURL);
           VirtualFile deploymentVF = vfs.getRoot();
           AbstractDeploymentContext context = new AbstractDeploymentContext(deploymentVF);
           ps.addDeployment(context);
          



          • 2. Re: Deployment through the ProfileService api
            ccrouch

             

            "scott.stark@jboss.org" wrote:

            Correct. However, for the initial tests I expect that the base deployment exists, so the way to add a deployment to a profile is:

             URL deploymentURL = ...
             VFS vfs = VFS.getVFS(deploymentURL);
             VirtualFile deploymentVF = vfs.getRoot();
             AbstractDeploymentContext context = new AbstractDeploymentContext(deploymentVF);
             ps.addDeployment(context);
            



            I'm confused about this last point.
            1) What do you mean a "base" deployment? What is the "base" deployment in the scenario of wanting to deploy a brand new datasource?
            2) In the pseudo code, deploymentURL presumably refers to this "base" deployment. Where would one obtain the deploymentURL from in the first place?

            Thanks


            • 3. Re: Deployment through the ProfileService api
              starksm64

              The base deploymentURL is the raw deployment content location (user supplied ear, war, sar, rar, etc.). It has not admin edits associated with it.

              See the current org.jboss.system.server.profileservice.VFSScanner for how the current basic ProfileImpl is feed the deployment contexts from the standard bootstrap, deployers and deploy directory contents.

              The Profile api is being refactored to tie together repository support so that there is a base deployment notion coming from the addProfileContent method:

              package org.jboss.profileservice.spi;
              
              import java.io.IOException;
              import java.util.Collection;
              import java.util.Map;
              import java.util.zip.ZipInputStream;
              
              import org.jboss.deployers.spi.structure.DeploymentContext;
              
              /**
               * A profile represents a named collection of deployments on a server.
               *
               * @author Scott.Stark@jboss.org
               * @version $Revision$
               */
              public interface Profile
              {
               /** The class of deployment */
               public enum DeploymentPhase {
               /** A deployment loaded during the server bootstrap phase */
               BOOTSTRAP,
               /** An mc/service deployment for a Deployer to be loaded after the BOOTSTRAP phase */
               DEPLOYER,
               /** Any deployment content to be loaded after the DEPLOYER phase */
               APPLICATION
               };
              
               /**
               * The x.y.z version of the profile
               *
               * @return the version if known, null if its unspecified.
               */
               public String getVersion();
              
               /**
               * Add raw content (bootstrap, deployers, deployments, libraries, etc) to a
               * profile.
               *
               * @param name - a logical name for the content added
               * @param contentIS - a zip input stream of the content layout as it is
               * to be added to the profile.
               * @param phase - the phase of the deployment as it relates to when the
               * deployment is loaded
               * @throws IOException
               */
               public void addProfileContent(String name, ZipInputStream contentIS, DeploymentPhase phase)
               throws IOException;
              
               /**
               * Add a deployment
               *
               * @param d the deployment
               * @param phase - the phase of the deployment as it relates to when the
               * deployment is loaded
               */
               public void addDeployment(DeploymentContext d, DeploymentPhase phase)
               throws Exception;
              
               /**
               * Remove a deployment
               *
               * @param name the name
               * @param phase - the phase of the deployment as it relates to when the
               * deployment is loaded
               */
               public void removeDeployment(String name, DeploymentPhase phase)
               throws Exception;
              
               /**
               * Get a named deployment.
               *
               * @param name - the deployment name
               * @param phase - the phase of the deployment as it relates to when the
               * deployment is loaded
               * @return the named bootstrap
               * @throws NoSuchDeploymentException - if there is no such bootstrap
               */
               public DeploymentContext getDeployment(String name, DeploymentPhase phase)
               throws NoSuchDeploymentException;
              
               /**
               * Get the names of the deployments in the profile
               * @return names of deployments
               */
               public Collection<String> getDeploymentNames();
              
               /**
               * Get the names of the deployments for the given phase defined in this profile
               * @param phase - the phase of the deployment as it relates to when the
               * deployment is loaded
               * @return names of deployments
               */
               public Collection<String> getDeploymentNames(DeploymentPhase phase);
              
               /**
               * Get all deployments for the given phase defined in this profile
               *
               * @param phase - the phase of the deployment as it relates to when the
               * deployment is loaded
               * @return the bootstrap instances in this profile.
               */
               public Collection<DeploymentContext> getDeployments(DeploymentPhase phase);
              
              
               /**
               * Get all deployments defined in this profile
               *
               * @return the deployment instances in this profile.
               */
               public Collection<DeploymentContext> getDeployments();
              
               /**
               * Get the config
               *
               * @return the config
               */
               public Map<String, Object> getConfig();
              }
              


              The DeploymentTemplate notion has been moved to the ManagedView since it depends on the ManagedObject/ManagedProperty notions. These have been updated to the new mc versions of the classes.

              I'm still working to finalize this by tieing together the Profile, ManagentView and repository notions with the aspects that map the admin edits to a ManagedProperty back to the profile repository in the form a DeploymentContext Attachment overrides to the base DeploymentContext Attachments.

              • 4. Re: Deployment through the ProfileService api
                starksm64

                Now that I have tried to make this usable by a remote client this is not going to work. We need another DeploymentContentRepository view from the ProfileService that allows a more natural content repository view for adding/removing/associating content with a Profile. The Profile interface is then a server side notion for expressing the the active deployment content to the deployers.