本文整理汇总了Java中org.netbeans.spi.project.support.ant.PropertyUtils.sequentialPropertyEvaluator方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyUtils.sequentialPropertyEvaluator方法的具体用法?Java PropertyUtils.sequentialPropertyEvaluator怎么用?Java PropertyUtils.sequentialPropertyEvaluator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.spi.project.support.ant.PropertyUtils
的用法示例。
在下文中一共展示了PropertyUtils.sequentialPropertyEvaluator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEvaluator
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private PropertyEvaluator createEvaluator() {
PropertyProvider predefs = helper.getStockPropertyPreprovider();
File dir = getProjectDirectoryFile();
List<PropertyProvider> providers = new ArrayList<PropertyProvider>();
providers.add(helper.getPropertyProvider("nbproject/private/platform-private.properties")); // NOI18N
providers.add(helper.getPropertyProvider("nbproject/platform.properties")); // NOI18N
PropertyEvaluator baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
providers.add(new ApisupportAntUtils.UserPropertiesFileProvider(baseEval, dir));
baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
providers.add(new DestDirProvider(baseEval));
providers.add(helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH));
providers.add(helper.getPropertyProvider(AntProjectHelper.PROJECT_PROPERTIES_PATH));
Map<String,String> fixedProps = new HashMap<String,String>();
// synchronize with suite.xml
fixedProps.put(SuiteProperties.ENABLED_CLUSTERS_PROPERTY, "");
fixedProps.put(SuiteProperties.DISABLED_CLUSTERS_PROPERTY, "");
fixedProps.put(SuiteProperties.DISABLED_MODULES_PROPERTY, "");
fixedProps.put(SuiteBrandingModel.BRANDING_DIR_PROPERTY, "branding"); // NOI18N
fixedProps.put("suite.build.dir", "build"); // NOI18N
fixedProps.put("cluster", "${suite.build.dir}/cluster"); // NOI18N
fixedProps.put("dist.dir", "dist"); // NOI18N
fixedProps.put("test.user.dir", "${suite.build.dir}/testuserdir"); // NOI18N
providers.add(PropertyUtils.fixedPropertyProvider(fixedProps));
return PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
}
示例2: parseSuiteProperties
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private static PropertyEvaluator parseSuiteProperties(File root) throws IOException {
Properties p = System.getProperties();
Map<String,String> predefs;
synchronized (p) {
predefs = NbCollections.checkedMapByCopy(p, String.class, String.class, false);
}
predefs.put("basedir", root.getAbsolutePath()); // NOI18N
PropertyProvider predefsProvider = PropertyUtils.fixedPropertyProvider(predefs);
List<PropertyProvider> providers = new ArrayList<PropertyProvider>();
providers.add(loadPropertiesFile(new File(root, "nbproject" + File.separatorChar + "private" + File.separatorChar + "platform-private.properties"))); // NOI18N
providers.add(loadPropertiesFile(new File(root, "nbproject" + File.separatorChar + "platform.properties"))); // NOI18N
PropertyEvaluator eval = PropertyUtils.sequentialPropertyEvaluator(predefsProvider, providers.toArray(new PropertyProvider[providers.size()]));
String buildS = eval.getProperty("user.properties.file"); // NOI18N
if (buildS != null) {
providers.add(loadPropertiesFile(PropertyUtils.resolveFile(root, buildS)));
} else {
// Never been opened, perhaps - so fake it.
providers.add(PropertyUtils.globalPropertyProvider());
}
providers.add(loadPropertiesFile(new File(root, "nbproject" + File.separatorChar + "private" + File.separatorChar + "private.properties"))); // NOI18N
providers.add(loadPropertiesFile(new File(root, "nbproject" + File.separatorChar + "project.properties"))); // NOI18N
eval = PropertyUtils.sequentialPropertyEvaluator(predefsProvider, providers.toArray(new PropertyProvider[providers.size()]));
providers.add(new DestDirProvider(eval));
return PropertyUtils.sequentialPropertyEvaluator(predefsProvider, providers.toArray(new PropertyProvider[providers.size()]));
}
示例3: getClusterProperties
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public static Map<String,String> getClusterProperties(File nbroot) throws IOException {
Map<String, String> clusterDefs = null;
synchronized (clusterPropertiesFiles) {
clusterDefs = clusterPropertiesFiles.get(nbroot);
if (clusterDefs == null) {
PropertyProvider pp = loadPropertiesFile(getClusterPropertiesFile(nbroot)); // NOI18N
PropertyEvaluator clusterEval = PropertyUtils.sequentialPropertyEvaluator(
PropertyUtils.fixedPropertyProvider(Collections.<String, String>emptyMap()), pp);
clusterDefs = clusterEval.getProperties();
if (clusterDefs == null) {
// Definition failure of some sort.
clusterDefs = Collections.emptyMap();
}
clusterPropertiesFiles.put(nbroot, clusterDefs);
}
}
return clusterDefs;
}
示例4: R
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
R(
@NonNull final URL url,
@NonNull final MultiModule modules,
@NonNull final String moduleName,
@NonNull final String[] templates) {
Parameters.notNull("url", url); //NOI18N
Parameters.notNull("modules", modules); //NOI18N
Parameters.notNull("moduleName", moduleName); //NOI18N
Parameters.notNull("templates", templates); //NOI18N
this.url = url;
this.pp = new EvaluatorPropertyProvider(MultiModuleBinaryForSourceQueryImpl.this.evaluator);
this.evaluator = PropertyUtils.sequentialPropertyEvaluator(
PropertyUtils.fixedPropertyProvider(Collections.singletonMap("module.name",moduleName)), //NOI18N
pp);
this.modules = modules;
this.moduleName = moduleName;
this.templates = templates;
this.cache = new AtomicReference();
this.listeners = new ChangeSupport(this);
this.propsCache = new AtomicReference<>();
this.scp = new AtomicReference<>();
MultiModuleBinaryForSourceQueryImpl.this.evaluator.addPropertyChangeListener(WeakListeners.propertyChange(this, MultiModuleBinaryForSourceQueryImpl.this.evaluator));
this.modules.addPropertyChangeListener(WeakListeners.propertyChange(this, this.modules));
}
示例5: testGuessBuildFolders
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void testGuessBuildFolders() throws Exception {
File base = new File(getWorkDir(), "folder");
File proj1 = new File(base, "proj1");
proj1.mkdir();
File base2 = new File(getWorkDir(), "folder2");
base2.mkdir();
JavaProjectGenerator.JavaCompilationUnit cu = new JavaProjectGenerator.JavaCompilationUnit();
cu.output = new ArrayList();
cu.output.add("${outputfile}");
ArrayList units = new ArrayList();
units.add(cu);
Map m = new HashMap();
m.put("outputfile", "out.jar");
PropertyEvaluator evaluator = PropertyUtils.sequentialPropertyEvaluator(null, new PropertyProvider[]{
PropertyUtils.fixedPropertyProvider(m)});
List buildFolders = JavaProjectGenerator.guessBuildFolders(evaluator, units, proj1, proj1);
assertEquals("no build folder", 0, buildFolders.size());
cu.output.add(base2.getAbsolutePath());
buildFolders = JavaProjectGenerator.guessBuildFolders(evaluator, units, proj1, proj1);
assertEquals("one build-folder created", 1, buildFolders.size());
assertEquals("export is properly configured", base2.getAbsolutePath(), buildFolders.get(0));
cu.output.add(getWorkDir().getAbsolutePath());
buildFolders = JavaProjectGenerator.guessBuildFolders(evaluator, units, proj1, proj1);
assertEquals("one build-folder created", 1, buildFolders.size());
assertEquals("export is properly configured", getWorkDir().getAbsolutePath(), buildFolders.get(0));
// check that root of this is handled correctly
File diskRoot = getWorkDir();
while (diskRoot.getParentFile() != null) {
diskRoot = diskRoot.getParentFile();
}
cu.output.add(diskRoot.getAbsolutePath());
buildFolders = JavaProjectGenerator.guessBuildFolders(evaluator, units, proj1, proj1);
assertEquals("one build-folder created", 1, buildFolders.size());
assertEquals("export is properly configured", diskRoot.getAbsolutePath(), buildFolders.get(0));
}
示例6: testCreateEmptyModel
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void testCreateEmptyModel() throws Exception {
File baseFolder = new File(getWorkDir(), "somefolder/");
File nbProjectFolder = new File(getWorkDir(), "nbprojfolder/");
Map<String,String> p = new HashMap<String,String>();
p.put("key", "value");
PropertyEvaluator evaluator = PropertyUtils.sequentialPropertyEvaluator(null, PropertyUtils.fixedPropertyProvider(p));
ProjectModel pm = ProjectModel.createEmptyModel(baseFolder, nbProjectFolder, evaluator);
assertNotNull(pm);
assertEquals("Base folder incorrect", baseFolder, pm.getBaseFolder());
assertEquals("NB project folder incorrect", nbProjectFolder, pm.getNBProjectFolder());
assertEquals("Evaluator incorrect", evaluator, pm.getEvaluator());
assertEquals("Evaluator is different", 1, pm.getEvaluator().getProperties().size());
}
示例7: createEmptyProjectModel
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
private ProjectModel createEmptyProjectModel() throws Exception {
File baseFolder = new File(getWorkDir(), "somefolder/");
File nbProjectFolder = new File(getWorkDir(), "nbprojfolder/");
Map<String,String> p = new HashMap<String,String>();
p.put("key", "value");
PropertyEvaluator evaluator = PropertyUtils.sequentialPropertyEvaluator(null, PropertyUtils.fixedPropertyProvider(p));
return ProjectModel.createEmptyModel(baseFolder, nbProjectFolder, evaluator);
}
示例8: createPropertyEvaluator
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
/**
* Creates a {@link PropertyEvaluator} with {@link ProjectConfiguration} support.
* @param project the project to create {@link PropertyEvaluator} for
* @param helper the {@link Project}'s {@link AntProjectHelper}
* @param additionalPropertyProviders the additional {@link PropertyProvider}s
* @return a new {@link PropertyEvaluator}
*/
@NonNull
public static PropertyEvaluator createPropertyEvaluator(
@NonNull final Project project,
@NonNull final AntProjectHelper helper,
@NonNull final PropertyProvider... additionalPropertyProviders) {
Parameters.notNull("project", project); //NOI18N
Parameters.notNull("helper", helper); //NOI18N
Parameters.notNull("additionalPropertyProviders", additionalPropertyProviders); //NOI18N
PropertyEvaluator baseEval1 = PropertyUtils.sequentialPropertyEvaluator(
helper.getStockPropertyPreprovider(),
helper.getPropertyProvider(ProjectConfigurations.CONFIG_PROPS_PATH));
PropertyEvaluator baseEval2 = PropertyUtils.sequentialPropertyEvaluator(
helper.getStockPropertyPreprovider(),
helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH));
final Queue<PropertyProvider> providers = new ArrayDeque<>(additionalPropertyProviders.length + 7);
providers.offer(helper.getPropertyProvider(ProjectConfigurations.CONFIG_PROPS_PATH));
providers.offer(new ConfigPropertyProvider(baseEval1, "nbproject/private/configs", helper)); //NOI18N
providers.offer(helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH));
providers.offer(helper.getProjectLibrariesPropertyProvider());
providers.offer(PropertyUtils.userPropertiesProvider(baseEval2,
"user.properties.file", FileUtil.toFile(project.getProjectDirectory()))); //NOI18N
providers.offer(new ConfigPropertyProvider(baseEval1, "nbproject/configs", helper)); //NOI18N
providers.offer(helper.getPropertyProvider(AntProjectHelper.PROJECT_PROPERTIES_PATH));
Collections.addAll(providers, additionalPropertyProviders);
return PropertyUtils.sequentialPropertyEvaluator(
helper.getStockPropertyPreprovider(),
providers.toArray(new PropertyProvider[providers.size()]));
}
示例9: getBuildArtifacts
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
@Override
public AntArtifact[] getBuildArtifacts() {
final List<AntArtifact> artifacts = new ArrayList<>();
final EvaluatorPropertyProvider pp = new EvaluatorPropertyProvider(eval);
for (String modName : srcModules.getModuleNames()) {
final String moduleDistJarKey = String.format(
"module.%s.dist.jar", //NOI18N
modName);
final String moduleDistJarVal = String.format(
"${%s}/%s.jar", //NOI18N
ProjectProperties.DIST_DIR,
modName);
final PropertyEvaluator extEval = PropertyUtils.sequentialPropertyEvaluator(
null,
pp,
PropertyUtils.fixedPropertyProvider(Collections.singletonMap(
moduleDistJarKey,
moduleDistJarVal)));
final AntArtifact artifact = helper.createSimpleAntArtifact(
JavaProjectConstants.ARTIFACT_TYPE_JAR,
moduleDistJarKey,
extEval,
buildTarget,
cleanTarget,
ProjectProperties.BUILD_SCRIPT);
artifacts.add(new ModuleIdDecorator(modName, artifact));
}
return artifacts.toArray(new AntArtifact[artifacts.size()]);
}
示例10: testGuessSubprojects
import org.netbeans.spi.project.support.ant.PropertyUtils; //导入方法依赖的package包/类
public void testGuessSubprojects() throws Exception {
AntProjectHelper helper = createEmptyProject("proj1", "proj1", false);
FileObject base = helper.getProjectDirectory();
Project p = ProjectManager.getDefault().findProject(base);
assertNotNull("Project was not created", p);
assertEquals("Project folder is incorrect", base, p.getProjectDirectory());
ArrayList exports = new ArrayList();
JavaProjectGenerator.Export e = new JavaProjectGenerator.Export();
e.type = JavaProjectConstants.ARTIFACT_TYPE_JAR;
e.location = "libs/some.jar"; // this jar is created in createEmptyProject() so let's use it as export
e.buildTarget = "build_target";
exports.add(e);
JavaProjectGenerator.putExports(helper, exports);
ProjectManager.getDefault().saveAllProjects();
String lib1path = lib1.getAbsolutePath();
String proj1path = FileUtil.toFile(base).getAbsolutePath();
AntProjectHelper helper2 = createEmptyProject("proj2", "proj2", false);
FileObject base2 = helper.getProjectDirectory();
File projBase = FileUtil.toFile(base2);
Project p2 = ProjectManager.getDefault().findProject(base2);
assertNotNull("Project was not created", p2);
assertEquals("Project folder is incorrect", base2, p.getProjectDirectory());
PropertyEvaluator evaluator = PropertyUtils.sequentialPropertyEvaluator(null, new PropertyProvider[]{
PropertyUtils.fixedPropertyProvider(
Collections.singletonMap("lib1", lib1path))});
ArrayList units = new ArrayList();
JavaProjectGenerator.JavaCompilationUnit cu = new JavaProjectGenerator.JavaCompilationUnit();
JavaProjectGenerator.JavaCompilationUnit.CP cp = new JavaProjectGenerator.JavaCompilationUnit.CP();
cp.mode = "compile";
cp.classpath = "../something.jar;${lib1};";
cu.classpath = new ArrayList();
cu.classpath.add(cp);
units.add(cu);
cu = new JavaProjectGenerator.JavaCompilationUnit();
cp = new JavaProjectGenerator.JavaCompilationUnit.CP();
cp.mode = "compile";
cp.classpath = lib1path+";";
cu.classpath = new ArrayList();
cu.classpath.add(cp);
units.add(cu);
List l = JavaProjectGenerator.guessSubprojects(evaluator, units, projBase, projBase);
assertEquals("one subproject", 1, l.size());
assertEquals("project1 is subproject", /*proj1path*/ ".", l.get(0));
}