当前位置: 首页>>代码示例>>Java>>正文


Java Dependency类代码示例

本文整理汇总了Java中org.openide.modules.Dependency的典型用法代码示例。如果您正苦于以下问题:Java Dependency类的具体用法?Java Dependency怎么用?Java Dependency使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Dependency类属于org.openide.modules包,在下文中一共展示了Dependency类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ModuleData

import org.openide.modules.Dependency; //导入依赖的package包/类
ModuleData(ObjectInput dis) throws IOException {
    try {
        this.codeName = dis.readUTF();
        this.codeNameBase = dis.readUTF();
        this.codeNameRelease = dis.readInt();
        this.coveredPackages = readStrings(dis, new HashSet<String>(), true);
        this.dependencies = (Dependency[]) dis.readObject();
        this.implVersion = dis.readUTF();
        this.buildVersion = dis.readUTF();
        this.provides = readStrings(dis);
        this.friendNames = readStrings(dis, new HashSet<String>(), false);
        this.specVers = new SpecificationVersion(dis.readUTF());
        this.publicPackages = Module.PackageExport.read(dis);
        this.agentClass = dis.readUTF();
        String s = dis.readUTF();
        if (s != null) {
            s = s.trim();
        }
        this.fragmentHostCodeName = s == null || s.isEmpty() ? null : s;
    } catch (ClassNotFoundException cnfe) {
        throw new IOException(cnfe);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ModuleData.java

示例2: addToJaveleonDisableList

import org.openide.modules.Dependency; //导入依赖的package包/类
private void addToJaveleonDisableList(Set<Module> willDisable, Module m) {
    if (willDisable.contains(m)) {
        return;
    }
    willDisable.add(m);
    for (Module other : modules) {
        if (! other.isEnabled() || willDisable.contains(other)) {
            continue;
        }
        Dependency[] depenencies = other.getDependenciesArray();
        for (int i = 0; i < depenencies.length; i++) {
            Dependency dep = depenencies[i];
            if (dep.getType() == Dependency.TYPE_MODULE) {
                if (Util.parseCodeName(dep.getName())[0].equals(m.getCodeNameBase())) {
                    addToJaveleonDisableList(willDisable, other);
                    break;
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ModuleManager.java

示例3: testProblemsStillCorrectWithHardAndSoftMixture

import org.openide.modules.Dependency; //导入依赖的package包/类
/** @see "#76917" */
public void testProblemsStillCorrectWithHardAndSoftMixture() throws Exception {
    File m1j = new File(getWorkDir(), "m1.jar");
    createJar(m1j, Collections.<String,String>emptyMap(), Collections.singletonMap("OpenIDE-Module", "m1"));
    File m2j = new File(getWorkDir(), "m2.jar");
    Map<String,String> mani = new HashMap<String,String>();
    mani.put("OpenIDE-Module", "m2");
    mani.put("OpenIDE-Module-Module-Dependencies", "m1");
    mani.put("OpenIDE-Module-Java-Dependencies", "Java > 2046");
    createJar(m2j, Collections.<String,String>emptyMap(), mani);
    MockModuleInstaller installer = new MockModuleInstaller();
    MockEvents ev = new MockEvents();
    ModuleManager mgr = new ModuleManager(installer, ev);
    mgr.mutexPrivileged().enterWriteAccess();
    try {
        Module m2 = mgr.create(m2j, null, false, false, false);
        assertEquals("initially m2 has two problems: Java and m1", 2, m2.getProblems().size());
        Module m1 = mgr.create(m1j, null, false, false, false);
        assertEquals("m1 has no problems", Collections.emptySet(), m1.getProblems());
        assertEquals("now m2 should have just one problem: Java", 1, m2.getProblems().size());
        Dependency d = (Dependency) m2.getProblems().iterator().next();
        assertEquals(Dependency.TYPE_JAVA, d.getType());
    } finally {
        mgr.mutexPrivileged().exitWriteAccess();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ModuleManagerTest.java

示例4: parseFriends

import org.openide.modules.Dependency; //导入依赖的package包/类
private static String[] parseFriends(final String friends) {
    Set<String> set = new HashSet<String>();
    StringTokenizer tok = new StringTokenizer(friends, ", "); // NOI18N
    while (tok.hasMoreTokens()) {
        String piece = tok.nextToken();
        if (piece.indexOf('/') != -1) {
            throw new IllegalArgumentException("May specify only module code name bases in OpenIDE-Module-Friends, not major release versions: " + piece); // NOI18N
        }
        // Indirect way of checking syntax:
        Dependency.create(Dependency.TYPE_MODULE, piece);
        // OK, add it.
        set.add(piece);
    }
    if (set.isEmpty()) {
        throw new IllegalArgumentException("Empty OpenIDE-Module-Friends: " + friends); // NOI18N
    }
    return set.toArray(new String[set.size()]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ManifestManager.java

示例5: assertProvidesRequires

import org.openide.modules.Dependency; //导入依赖的package包/类
private static void assertProvidesRequires(Module m, String provides, String requires) {
    List<String> p = Arrays.asList(m.getProvides());
    assertTrue("Bundles provide their packages: " + p, p.contains(provides));

    for (Dependency d : m.getDependencies()) {
        if (d.getType() == Dependency.TYPE_RECOMMENDS) {
            if (!d.getName().startsWith("cnb.")) {
                continue;
            }
            if (requires.equals(d.getName().substring(4))) {
                return;
            }
        }
    }
    fail("Module " + m + " does not require " + requires);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NetigsoOSGiCanRequestTest.java

示例6: apply

import org.openide.modules.Dependency; //导入依赖的package包/类
/**
       * Transform some dependencies.
       */
      public void apply(Map<String, Dependency> modDeps,
Map<String, Dependency> tokDeps, Map<String, Dependency> pkgDeps,
Set<Dependency> dependencies) {
          Dependency d = trigger.applies(modDeps, tokDeps, pkgDeps, dependencies, triggerType);
          if (d != null) {
              // It matched.
              if (triggerType.equals("cancel")) {
                  // Remove it now.
                  dependencies.remove(d);
              } else if (triggerType.equals("older")) {
                  // Fine, don't.
              } else {
                  throw new IllegalStateException(triggerType);
              }
              // Add in results.
              Iterator it = results.iterator();
              while (it.hasNext()) {
                  Dep nue = (Dep)it.next();
                  nue.update(modDeps, tokDeps, pkgDeps, dependencies);
              }
          }
      }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:AutomaticDependencies.java

示例7: older

import org.openide.modules.Dependency; //导入依赖的package包/类
/**
 * Is the given dependency older than this pattern?
 */
private boolean older(Dependency d) {
    if (d.getType() != Dependency.TYPE_MODULE) throw new IllegalArgumentException();
    if (d.getComparison() == Dependency.COMPARE_IMPL) {
        // #46961; do not upgrade impl deps like this.
        return false;
    }
    Integer dRelI = (Integer)Util.parseCodeName(d.getName())[1];
    int dRel = (dRelI == null) ? -1 : dRelI.intValue();
    if (dRel < major) return true;
    if (dRel > major) return false;
    if (spec == null) return false;
    String dSpec = d.getVersion();
    if (dSpec == null) return true;
    assert d.getComparison() == Dependency.COMPARE_SPEC : d.getComparison();
    return new SpecificationVersion(dSpec).compareTo(spec) < 0;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:AutomaticDependencies.java

示例8: applies

import org.openide.modules.Dependency; //导入依赖的package包/类
public Dependency applies(Map<String, Dependency> modDeps,
Map<String, Dependency> tokDeps, Map<String, Dependency> pkgDeps,
Set<Dependency> dependencies, String type) {
          Dependency d = pkgDeps.get(bname);
          if (d == null) {
              return null;
          }
          if (type.equals("cancel")) {
              // That's enough.
              return d;
          } else if (type.equals("older")) {
              if (spec == null) throw new IllegalStateException();
              // Compare. Check that d < this
              return older(d) ? d : null;
          } else {
              throw new IllegalStateException(type);
          }
      }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AutomaticDependencies.java

示例9: refineDependencies

import org.openide.modules.Dependency; //导入依赖的package包/类
/** Overridden to perform automatic API upgrades.
 * That is, should do nothing on new modules, but for older ones will
 * automatically make them depend on things they need.
 * This is now all handled from declarative configuration files:
 * in the system filesystem, ModuleAutoDeps/*.xml may be added
 * according to the DTD "-//NetBeans//DTD Module Automatic Dependencies 1.0//EN".
 */
public @Override void refineDependencies(Module m, Set<Dependency> dependencies) {
    /* JST-PENDING just tring to comment this out
    // All modules implicitly depend on the APIs somehow.
    if (!m.getCodeNameBase().equals("org.openide") &&
            Util.getModuleDep(dependencies, "org.openide") == null) {
        dependencies.addAll(Dependency.create(Dependency.TYPE_MODULE, "org.openide/1 > 0")); // NOI18N
    }
     */
    if (Boolean.getBoolean("org.netbeans.core.modules.NbInstaller.noAutoDeps")) {
        // Skip them all - useful for unit tests.
        return;
    }
    AutomaticDependencies.Report rep = AutomaticDependencies.getDefault().refineDependenciesAndReport(m.getCodeNameBase(), dependencies);
    if (rep.isModified()) {
        Util.err.warning(rep.toString());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NbInstaller.java

示例10: testSimpleDepOnJava

import org.openide.modules.Dependency; //导入依赖的package包/类
public void testSimpleDepOnJava() throws Exception {
    StringBuilder writeTo = new StringBuilder();
    Set<ProblemModule> modules = new HashSet<ProblemModule>();

    {
        Manifest mf = new Manifest();
        mf.getMainAttributes().putValue("OpenIDE-Module", "root.module");
        ProblemModule pm = new ProblemModule(mf);
        pm.addProblem(Dependency.create(Dependency.TYPE_JAVA, "Java > 1.30"));
        pm.addAttr("OpenIDE-Module-Name", "RootModule");
        modules.add(pm);
    }
    
    NbProblemDisplayer.problemMessagesForModules(writeTo, modules, true);

    String msg = writeTo.toString();
    if (msg.indexOf("RootModule") == -1) {
        fail("There should be noted the root module: " + msg);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:NbProblemDisplayerTest.java

示例11: testExcludes

import org.openide.modules.Dependency; //导入依赖的package包/类
public void testExcludes() throws Exception {
    Set<Dependency> deps = new HashSet<Dependency>();
    deps.addAll(Dependency.create(Dependency.TYPE_MODULE, "orig > 1.0"));
    Set<Dependency> _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("a", _deps);
    assertEquals("orig > 1.0", normal(_deps));
    _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("a.x", _deps);
    assertEquals("Nue, nue > 1.0, orig > 1.0", normal(_deps));
    _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("b", _deps);
    assertEquals("orig > 1.0", normal(_deps));
    _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("b.x", _deps);
    assertEquals("orig > 1.0", normal(_deps));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AutomaticDependenciesTest.java

示例12: module

import org.openide.modules.Dependency; //导入依赖的package包/类
/**
 * Include an extra module in the runtime beyond the minimum.
 * Transitive declared dependencies are included too.
 * Will also be present in compile classpath for {@link #sourceFile}.
 */
public OSGiProcess module(String cnb) throws IOException {
    if (modules.add(cnb)) {
        JarFile jar = new JarFile(new File(platformDir, "modules/" + cnb.replace('.', '-') + ".jar"));
        try {
            String deps = jar.getManifest().getMainAttributes().getValue("OpenIDE-Module-Module-Dependencies");
            if (deps != null) {
                for (Dependency dep : Dependency.create(Dependency.TYPE_MODULE, deps)) {
                    String cnb2 = dep.getName().replaceFirst("/\\d+$", "");
                    if (new File(platformDir, "modules/" + cnb2.replace('.', '-') + ".jar").isFile()) {
                        module(cnb2);
                    }
                }
            }
        } finally {
            jar.close();
        }
    }
    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:OSGiProcess.java

示例13: testMerges

import org.openide.modules.Dependency; //导入依赖的package包/类
public void testMerges() throws Exception {
    Set<Dependency> deps = new HashSet<Dependency>();
    deps.addAll(Dependency.create(Dependency.TYPE_PACKAGE, "javax.death[AbstractCoffin] > 1.0"));
    deps.addAll(Dependency.create(Dependency.TYPE_MODULE, "javax.death/1 > 1.0"));
    Set<Dependency> _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("random", _deps);
    assertEquals("javax.death/1 > 1.0", normal(_deps));
    deps = new HashSet<Dependency>();
    deps.addAll(Dependency.create(Dependency.TYPE_PACKAGE, "javax.death[AbstractCoffin] > 1.0"));
    deps.addAll(Dependency.create(Dependency.TYPE_MODULE, "javax.death/1 > 0.3"));
    _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("random", _deps);
    assertEquals("javax.death/1 > 1.0", normal(_deps));
    deps = new HashSet<Dependency>(); // Set<Dependency>
    deps.addAll(Dependency.create(Dependency.TYPE_PACKAGE, "[javax.death.AbstractCoffin]"));
    deps.addAll(Dependency.create(Dependency.TYPE_MODULE, "javax.death/1 > 0.3"));
    _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("random", _deps);
    assertEquals("javax.death/1 > 1.0", normal(_deps));
    deps = new HashSet<Dependency>(); // Set<Dependency>
    deps.addAll(Dependency.create(Dependency.TYPE_PACKAGE, "javax.death[AbstractCoffin] > 1.0"));
    deps.addAll(Dependency.create(Dependency.TYPE_MODULE, "javax.death/1 > 1.3"));
    _deps = new HashSet<Dependency>(deps);
    ad.refineDependencies("random", _deps);
    assertEquals("javax.death/1 > 1.3", normal(_deps));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AutomaticDependenciesTest.java

示例14: normal

import org.openide.modules.Dependency; //导入依赖的package包/类
private static String normal(Set<Dependency> deps) {
    SortedSet<String> s = new TreeSet<String>(); // Set<String>
    Iterator<Dependency> it = deps.iterator();
    while (it.hasNext()) {
        Dependency d = it.next();
        s.add(dep2String(d));
    }
    StringBuilder b = new StringBuilder();
    Iterator<String> it2 = s.iterator();
    while (it2.hasNext()) {
        b.append(it2.next());
        if (it2.hasNext()) {
            b.append(", ");
        }
    }
    return b.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:AutomaticDependenciesTest.java

示例15: dep2String

import org.openide.modules.Dependency; //导入依赖的package包/类
private static String dep2String(Dependency d) {
    StringBuilder b = new StringBuilder();
    b.append(d.getName());
    switch (d.getComparison()) {
    case Dependency.COMPARE_ANY:
        break;
    case Dependency.COMPARE_IMPL:
        b.append(" = ");
        b.append(d.getVersion());
        break;
    case Dependency.COMPARE_SPEC:
        b.append(" > ");
        b.append(d.getVersion());
        break;
    default:
        throw new IllegalStateException();
    }
    return b.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:AutomaticDependenciesTest.java


注:本文中的org.openide.modules.Dependency类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。