View Javadoc

1   /*
2   Karma core - Core of the Karma application
3   Copyright (C) 2004  Toolforge <www.toolforge.nl>
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19  package nl.toolforge.karma.core.manifest;
20  
21  import nl.toolforge.karma.core.boot.WorkingContext;
22  import nl.toolforge.karma.core.location.LocationException;
23  import nl.toolforge.karma.core.module.Module;
24  import nl.toolforge.karma.core.vc.cvsimpl.threads.PatchLineThread;
25  import nl.toolforge.karma.core.vc.threads.ParallelRunner;
26  
27  /***
28   * A <code>ReleaseManifest</code> is created when the Release Manager collects all stable versions of modules.
29   * Effectively, the latest promoted version of all modules in.
30   *
31   * @author W.H. Schraal
32   * @author D.A. Smedes
33   * @version $Id: ReleaseManifest.java,v 1.20 2004/11/10 23:53:09 asmedes Exp $
34   */
35  public final class ReleaseManifest extends AbstractManifest {
36  
37    public ReleaseManifest(WorkingContext context, ManifestStructure structure) throws LocationException {
38      super(context, structure);
39  
40      // For a release manifest, we need to know if patch lines are available.
41      //
42      checkForPatchLines();
43    }
44  
45    /***
46     * Checks (in parallel) if modules have a <code>PatchLine</code> associated.
47     */
48    private void checkForPatchLines() {
49      ParallelRunner runner = new ParallelRunner(this, PatchLineThread.class);
50  
51      long delay = 100;
52      runner.execute(delay);
53    }
54  
55    public String getType() {
56      return Manifest.RELEASE_MANIFEST;
57    }
58  
59    /***
60     * <p>Applies the current working context to a module in this release manifest.
61     *
62     * <p>This method also checks if the module is available locally. If so, the module will be matched with the module
63     * on disk to check if they are equal. This is to ensure that a changed manifest-definition is reflected on disk. If
64     * the manifest shows another module (which is in fact determined by its location), the version on disk will be
65     * removed.
66     */
67    protected void applyWorkingContext(WorkingContext context, Module module) {
68  
69      module.markDevelopmentLine(false);
70  
71      if (!isLocal(module)) {
72        // Module is static by definition when it is not locally available.
73        //
74        setState(module, Module.STATIC);
75      }
76    }
77  
78  }