Uploaded image for project: 'Codehaus Cargo'
  1. CARGO-950

Improve/fix the logic in AbstractCopyingInstalledLocalDeployer.deploy(...) wrt expanded and shouldDeployExpanded

    Details

    • Type: Improvement
    • Status: Closed (View workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 1.1.0
    • Components: None
    • Labels:
      None
    • Environment:

      n/a

      Description

      There's a weird piece of code in AbstractCopyingInstalledLocalDeployer.deploy(...):

      try
      {
      if (deployable.getType() == DeployableType.WAR)
      {
      if (!deployable.isExpanded())
      {
      deployWar(deployableDir, (WAR) deployable);
      }
      else if (shouldDeployExpanded(DeployableType.WAR))
      {
      deployExpandedWar(deployableDir, (WAR) deployable);
      }
      }
      else if (deployable.getType() == DeployableType.EAR)
      {
      deployEar(deployableDir, (EAR) deployable);
      }
      else if (deployable.getType() == DeployableType.EJB)
      {
      deployEjb(deployableDir, (EJB) deployable);
      }
      else if (deployable.getType() == DeployableType.SAR)
      {
      if (deployable.isExpanded() && shouldDeployExpanded(DeployableType.SAR))
      {
      deployExpandedSar(deployableDir, (SAR) deployable);
      }
      else
      {
      deploySar(deployableDir, (SAR) deployable);
      }
      }
      else if (deployable.getType() == DeployableType.RAR)
      {
      if (deployable.isExpanded() && shouldDeployExpanded(DeployableType.RAR))
      {
      deployExpandedRar(deployableDir, (RAR) deployable);
      }
      else
      {
      deployRar(deployableDir, (RAR) deployable);
      }
      }
      else if (deployable.getType() == DeployableType.FILE)
      {
      deployFile(deployableDir, (File) deployable);
      }
      else if (deployable.getType() == DeployableType.BUNDLE)
      {
      deployBundle(deployableDir, (Bundle) deployable);
      }
      else
      {
      throw new ContainerException(
      "Deployable type is currently not supported");
      }
      }
      catch (Exception e)
      {
      throw new ContainerException("Failed to deploy [" + deployable.getFile() + "] to ["
      + deployableDir + "]", e);
      }
      

      1) War, EAR, etc are all Deployable and could then, according to that interface, be expanded. So why is the handling different for these types?
      2) If we look at the WAR part of the code. I see a case where nothing will happen and, even worse, the code will silently just continue on. The case is if the war is expanded and shouldDeployExpanded(WAR) returns false.
      3) Why is the code above handling WARs different from the one for SARs and RARs?
      4) What happens if the RAR/SAR is expanded, but shouldDeployExpanded(...) returns false? Cargo will try to deploy it as not expanded I believe, which shouldn't work... I guess it will be an exception that will be caught, but this ought to be possible to handle in a more elegant way I think.

      Discussion on the dev list:
      http://old.nabble.com/AbstractStandaloneLocalConfiguration.configureFiles%28%29-td31238817.html

        Attachments

          Activity

            People

            • Assignee:
              savasalitokmen Savas Ali Tokmen (Inactive)
              Reporter:
              andershammar Anders Hammar (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: