You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by jr...@apache.org on 2002/10/30 16:40:44 UTC

cvs commit: jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/containers/ant GenericAntProvider.java

jruaux      2002/10/30 07:40:44

  Modified:    Eclipse-Plugin/src/java/org/apache/cactus/eclipse/containers/ant
                        GenericAntProvider.java
  Log:
  Polished the javadoc
  
  Revision  Changes    Path
  1.2       +35 -13    jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/containers/ant/GenericAntProvider.java
  
  Index: GenericAntProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/containers/ant/GenericAntProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GenericAntProvider.java	30 Oct 2002 14:15:01 -0000	1.1
  +++ GenericAntProvider.java	30 Oct 2002 15:40:44 -0000	1.2
  @@ -99,26 +99,33 @@
       private String contextPath = null;
   
       /**
  +     * Array containing all the information needed
  +     * (target mask & container home directory)
  +     * to call the scripts
  +     */
  +    private ContainerHome[] containerHomes;
  +
  +    /**
        * Constructor.
        * @param thePort the port that will be used when setting up the container
        * @param theTargetDir the directory to be used for container configuration
  +     * @param theHomes ContainerHome array for container config
        */
  -    public GenericAntProvider(int thePort, String theTargetDir)
  +    public GenericAntProvider(
  +        int thePort,
  +        String theTargetDir,
  +        ContainerHome[] theHomes)
       {
           port = thePort;
  -        ContainerHome[] containerDirs =
  -            {
  -                 new ContainerHome(
  -                    "tomcat.home.40",
  -                    "D:/dev/jakarta-tomcat-4.1.12")};
  +        containerHomes = theHomes;
           antArguments = new Vector();
           antArguments.add("-Dtest.port=" + thePort);
  -        for (int i = 0; i < containerDirs.length; i++)
  +        for (int i = 0; i < containerHomes.length; i++)
           {
  -            ContainerHome currentContainerHome = containerDirs[i];
  +            ContainerHome currentContainerHome = containerHomes[i];
               antArguments.add(
  -                "-D"
  -                    + currentContainerHome.getTarget()
  +                "-Dhome."
  +                    + currentContainerHome.getTargetMask()
                       + "="
                       + currentContainerHome.getDirectory());
           }
  @@ -136,7 +143,7 @@
        */
       public void start(ContainerInfo theContainerInfo) throws CoreException
       {
  -        String[] targets = { "start.all" };
  +        String[] targets = getMasked("start.");
           AntRunner runner = createAntRunner(targets);
           StartServerHelper startHelper = new StartServerHelper(runner);
           URL testURL = null;
  @@ -178,7 +185,7 @@
           String warPath = theDeployableObject.getPath();
           antArguments.add("-Dwar.path=" + warPath);
           antArguments.add("-Dcontext.path=" + theContextPath);
  -        String[] targets = { "prepare.all" };
  +        String[] targets = getMasked("prepare.");
           createAntRunner(targets).run();
   
       }
  @@ -198,7 +205,7 @@
        */
       public void stop(ContainerInfo theContainerInfo) throws CoreException
       {
  -        String[] targets = { "stop.all" };
  +        String[] targets = getMasked("stop.");
           createAntRunner(targets).run();
       }
   
  @@ -214,5 +221,20 @@
           runner.setArguments((String[]) antArguments.toArray(new String[0]));
           runner.setExecutionTargets(theTargets);
           return runner;
  +    }
  +
  +    /**
  +     * Returns a String array adding the containerHomes masks to the elements.
  +     * @param thePrefix prefix to add to the mask
  +     * @return String[] the masked array
  +     */
  +    private String[] getMasked(String thePrefix)
  +    {
  +        String[] result = new String[containerHomes.length];
  +        for (int i = 0; i < result.length; i++)
  +        {
  +            result[i] = thePrefix + containerHomes[i].getTargetMask();
  +        }
  +        return result;
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>