當前位置: 首頁>>代碼示例>>Java>>正文


Java Project.getProperty方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.Project.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.getProperty方法的具體用法?Java Project.getProperty怎麽用?Java Project.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.Project的用法示例。


在下文中一共展示了Project.getProperty方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getProperty

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
public @Override String getProperty(String name) {
    verifyRunning();
    Project project = getProjectIfPropertiesDefined();
    if (project != null) {
        String v = project.getProperty(name);
        if (v != null) {
            return v;
        } else {
            Object o = project.getReference(name);
            if (o != null) {
                return o.toString();
            } else {
                return null;
            }
        }
    } else {
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:NbBuildLogger.java

示例2: assertProperty

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
private void assertProperty(Project prj, String propName, String modules[]) throws IOException {
    String listModules = prj.getProperty(propName);
    assertNotNull("prop " + propName + " was not defined",listModules);
    log(" listModules " + listModules);
    String arrayModules[] = (listModules.length() == 0) ? new String[0] :listModules.split(":");
    Set<File> set1 = new HashSet<>();
    for (int i = 0 ; i < arrayModules.length ; i++) {
        String module = arrayModules[i];
        if (module.length() == 1 && i < arrayModules.length + 1) { 
            // module is e:/dd/dd/ on windows
            module = module + ":" + arrayModules[++i];
        }
        log(i + " = " + module );
        set1.add(new File(module)); 
    }
    Set<File> set2 = new HashSet<>();
    for (int i = 0 ; i < modules.length ; i++) {
        set2.add(new File(getWorkDir(),modules[i]));
    }
    assertEquals("paths length",set2.size(),set1.size());
    assertEquals("Different paths: ", set2,set1);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:TestDistFilterTest.java

示例3: doScanSuite

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
private static void doScanSuite(Map<String,Entry> entries, File suite, Map<String,Object> properties, Project project) throws IOException {
    Project fakeproj = new Project();
    fakeproj.setBaseDir(suite); // in case ${basedir} is used somewhere
    Property faketask = new Property();
    faketask.setProject(fakeproj);
    faketask.setFile(new File(suite, "nbproject/private/private.properties".replace('/', File.separatorChar)));
    faketask.execute();
    faketask.setFile(new File(suite, "nbproject/project.properties".replace('/', File.separatorChar)));
    faketask.execute();
    String modulesS = fakeproj.getProperty("modules");
    if (modulesS == null) {
        throw new IOException("No definition of modules in " + suite);
    }
    String[] modules = Path.translatePath(fakeproj, modulesS);
    for (int i = 0; i < modules.length; i++) {
        File module = new File(modules[i]);
        if (!module.isDirectory()) {
            throw new IOException("No such module " + module + " referred to from " + suite);
        }
        if (!scanPossibleProject(module, entries, properties, null, ModuleType.SUITE, project, null)) {
            throw new IOException("No valid module found in " + module + " referred to from " + suite);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:ModuleListParser.java

示例4: isTarget

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
private boolean isTarget(
    final String propName,
    final File... targets) {
    final Project p = getProject();
    final String propVal = p.getProperty(propName);
    if (propVal == null) {
        return false;
    }
    final File resolvedFile = p.resolveFile(propVal);
    if (resolvedFile == null) {
        return false;
    }
    final File normalizedResolvedFile = FileUtil.normalizeFile(resolvedFile);
    for (File target : targets) {
        if (target == null) {
            continue;
        }
        final File normalizedTarget = FileUtil.normalizeFile(target);
        if (isParentOf(normalizedTarget, normalizedResolvedFile)) {
            return true;
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:DeleteTask.java

示例5: loadTextProps

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Description of the Method
 *
 * @param tp
 */
private void loadTextProps( String tp ) {
    Properties p = new Properties();
    Project project = getProject();
    StringTokenizer st = new StringTokenizer( tp, "$" );
    while ( st.hasMoreTokens() ) {
        String token = st.nextToken();
        int start = token.indexOf( "{" );
        int end = token.indexOf( "}" );
        if ( start > -1 && end > -1 && end > start ) {
            String name = token.substring( start + 1, end - start );
            String value = project.getProperty( name );
            if ( value != null )
                p.setProperty( name, value );
        }
    }
    addProperties( p );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:23,代碼來源:PostTask.java

示例6: getLocationOfTarget

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Try to find the location of an Ant target.
 * @param project if not null, the main project from which this target might have been imported
 */
private Location getLocationOfTarget(Target target, Project project) {
    if (targetGetLocation != null) {
        try {
            return (Location) targetGetLocation.invoke(target);
        } catch (Exception e) {
            LOG.log(Level.WARNING, null, e);
        }
    }
    // For Ant 1.6.2 and earlier, hope we got the right info from the hacks above.
    LOG.log(Level.FINEST, "knownImportedTargets: {0}", knownImportedTargets);
    if (project != null) {
        String file = project.getProperty("ant.file"); // NOI18N
        if (file != null) {
            Map<String,String> targetLocations = knownImportedTargets.get(file);
            if (targetLocations != null) {
                String importedFile = targetLocations.get(target.getName());
                if (importedFile != null) {
                    // Have no line number, note.
                    return new Location(importedFile);
                }
            }
        }
    }
    // Dunno.
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:NbBuildLogger.java

示例7: setProject

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Setter for the 'project' property.
 *
 * @param project New value for the 'project' property.
 */
public static void setProject(final Project project) {
    Utils.project = project;
    useInternalPacker = "true".equals(project.getProperty("use.internal.packer"));
    useInternalUnpacker = "true".equals(project.getProperty("use.internal.unpacker"));
    xmx = ARG_PREFIX + XMX_ARG + project.getProperty("pack200.xmx");
    permSize = ARG_PREFIX + PERM_SIZE_ARG + project.getProperty("pack200.perm.size");
    maxPermSize = ARG_PREFIX + MAX_PERM_SIZE_ARG + project.getProperty("pack200.max.perm.size");
    String output = "use.internal.packer? " + useInternalPacker;
    if (project != null) {
        project.log("            " + output);
    } else {
        System.out.println(output);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:Utils.java

示例8: execute

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Executes the task. If the source property was specified, its value is
 * evaluated and set as the value of the target property. Otherwise the literal
 * string value is used.
 */
public void execute() {        
    final Project project = getProject();
    final String string = (source != null) ? 
        project.getProperty(Utils.resolveProperty(source, project)) : 
        value;
    final String resolved = Utils.resolveProperty(string, project);
    log("Setting " + property + " to " + resolved);
    project.setProperty(property, resolved);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:SetProperty.java

示例9: getExternalJarsProp

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * SignJarsTask stores a project property with list of jars that have been signed
 * by a different keystore. These must not be referenced directly in jnlp but through
 * dedicated included jnlps. This method returns the list of such jars transferred from
 * SignJarsTask
 * @param prj
 * @return set of JAR file names
 */
private static Set<? extends String> getExternalJarsProp(final Project prj) {
    final Set<String> result = new HashSet<String>();
    final String extJarsProp = prj.getProperty(EXTERNAL_JARS_PROP);
    if(extJarsProp != null) {
        for(String extJar : extJarsProp.split(EXTERNAL_PROP_DELIMITER)) {
            if(!extJar.isEmpty()) {
                File f = new File(extJar);
                result.add(f.toString());
            }
        }
    }
    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:GenerateJnlpFileTask.java

示例10: getExternalJnlpsProp

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * SignJarsTask stores a project property with list of jnlp component files that 
 * represent JARs signed by a different keystore. These need to be referenced 
 * from the main jnlp as external components.
 * @param prj
 * @return set of maps, each containing href and possibly other attributes representing a jnlp component
 */
private static Set<Map<String,String>> getExternalJnlpsProp(final Project prj) {
    final Set<Map<String,String>> result = new HashSet<Map<String,String>>();
    final String extJnlpsProp = prj.getProperty(EXTERNAL_JNLPS_PROP);
    if(extJnlpsProp != null) {
        for(String extJnlp : extJnlpsProp.split(EXTERNAL_PROP_DELIMITER)) {
            if(!extJnlp.isEmpty()) {
                Map<String, String> m = new HashMap<String, String>();
                m.put(EXT_RESOURCE_SUFFIXES[0], extJnlp);
                result.add(m);
            }
        }
    }
    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:GenerateJnlpFileTask.java

示例11: getProperty

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Get Property
 * @param property name
 * @return The property value
 */
public String getProperty(String property) {
    Project currentProject = getProject();
    if (currentProject != null) {
        return currentProject.getProperty(property);
    } else {
        return properties.getProperty(property);
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:14,代碼來源:JMXAccessorTask.java

示例12: getProperty

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * get all Properties
 * @param property
 * @return The property
 */
public String getProperty(String property) {
    Project currentProject = getProject();
    if (currentProject != null) {
        return currentProject.getProperty(property);
    } else {
        return properties.getProperty(property);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:JMXAccessorTask.java

示例13: getProperty

import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
 * Get Property
 * 
 * @param property
 *            name
 * @return The property value
 */
public String getProperty(String property) {
	Project currentProject = getProject();
	if (currentProject != null) {
		return currentProject.getProperty(property);
	} else {
		return properties.getProperty(property);
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:16,代碼來源:JMXAccessorTask.java


注:本文中的org.apache.tools.ant.Project.getProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。