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  
25  /***
26   * @author D.A. Smedes
27   * @version $Id: DevelopmentManifest.java,v 1.16 2004/11/10 22:25:10 hippe Exp $
28   */
29  public final class DevelopmentManifest extends AbstractManifest {
30  
31    public String getType() {
32      return Manifest.DEVELOPMENT_MANIFEST;
33    }
34  
35    public DevelopmentManifest(WorkingContext workingContext, String name) throws ManifestException, LocationException {
36      super(workingContext, name);
37    }
38  
39    public DevelopmentManifest(WorkingContext context, ManifestStructure structure) throws LocationException {
40      super(context, structure);
41    }
42  
43    /***
44     * <p>Applies the current working context to a module in this release manifest.
45     *
46     * <p>This method also checks if the module is available locally. If so, the module will be matched with the module
47     * on disk to check if they are equal. This is to ensure that a changed manifest-definition is reflected on disk. If
48     * the manifest shows another module (which is in fact determined by its location), the version on disk will be
49     * removed.
50     */
51    protected void applyWorkingContext(WorkingContext context, Module module) {
52  
53      if (module.hasVersion()) {
54        setState(module, Module.STATIC);
55      } else {
56        if (isLocal(module)) {
57          setState(module, getState(module));
58        } else {
59          setState(module, Module.DYNAMIC);
60        }
61      }
62    }
63  
64  }