Logo Search packages:      
Sourcecode: aspectj version File versions  Download package

ProductModule.java

/* *******************************************************************
 * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
 * All rights reserved. 
 * This program and the accompanying materials are made available 
 * under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 *  
 * Contributors: 
 *     Xerox/PARC     initial implementation 
 * ******************************************************************/
package org.aspectj.internal.tools.build;

import java.io.File;

/**
 * Struct associating module with target product distribution jar
 * and assembly instructions.
 * When building product distributions, a zero-length jar file 
 * in the dist directory may signify a module to be built, 
 * renamed, and included in the distribution.
 */
00023 public class ProductModule {
    /** name of distribution directory in product directory */
00025     private static final String DIST = "dist";
    
    /** top-level product directory being produced */
00028     public final File productDir;
    
    /** path to file in distribution template dir for this module jar */
00031     public final File replaceFile;
    
    /** relative path within distribution of this product module jar */
00034     public final String relativePath;
    
    /** the module jar is the file to replace */
00037     public final Module module;

    /** if true, assemble all when building module */
00040     public final boolean assembleAll;
    
    public ProductModule(File productDir, File replaceFile, Module module, boolean assembleAll) {
        this.replaceFile = replaceFile;
        this.module = module;
        this.productDir = productDir;
        this.assembleAll = assembleAll;
        Util.iaxIfNull(module, "module");
        Util.iaxIfNotCanReadDir(productDir, "productDir");
        Util.iaxIfNotCanReadFile(replaceFile, "replaceFile");
        String productDirPath = productDir.getAbsolutePath();
        String replaceFilePath = replaceFile.getAbsolutePath();
        if (!replaceFilePath.startsWith(productDirPath)) {
            String m = "\"" + replaceFilePath 
                + "\" does not start with \""
                + productDirPath
                + "\"";
            throw new IllegalArgumentException(m);
        }
        replaceFilePath = replaceFilePath.substring(1+productDirPath.length());
        if (!replaceFilePath.startsWith(DIST)) {
            String m = "\"" + replaceFilePath 
                + "\" does not start with \"" + DIST + "\"";
            throw new IllegalArgumentException(m);
        }
        relativePath = replaceFilePath.substring(1 + DIST.length());
    }
    public String toString() {
        return "" + module + " for " + productDir;
    }
}

Generated by  Doxygen 1.6.0   Back to index