Java Code Examples for org.openide.modules.ModuleInfo#getSpecificationVersion()

The following examples show how to use org.openide.modules.ModuleInfo#getSpecificationVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstalledUpdateProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, UpdateItem> getUpdateItems () throws IOException {
    Map<String, UpdateItem> res = new HashMap<String, UpdateItem> ();
    for (ModuleInfo info : defaultProvider().getModuleInfos (true).values ()) {
        Date time = null; // XXX: it's too expensive, should be extracted lazy - Utilities.readInstallTimeFromUpdateTracking (info);
        String installTime = null;
        if (time != null) {
            installTime = Utilities.formatDate(time);
        }
        UpdateItemImpl impl = new InstalledModuleItem (
                info.getCodeNameBase (),
                info.getSpecificationVersion () == null ? null : info.getSpecificationVersion ().toString (),
                info,
                null, // XXX author
                null, // installed cluster
                installTime

                );

        UpdateItem updateItem = Utilities.createUpdateItem (impl);
        res.put (info.getCodeName () + '_' + info.getSpecificationVersion (), updateItem);
    }
    return res;
}
 
Example 2
Source File: XMLSettingsSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static void storeModule(ModuleInfo mi, PrintWriter pw)
throws IOException {
    if (mi == null) return;
    
    String modulName = mi.getCodeName();
    SpecificationVersion spec = mi.getSpecificationVersion();
    StringBuffer sb = new StringBuffer (80);
    sb.append("    <module"); // NOI18N
    if (modulName != null && modulName.length() != 0) {
        sb.append(" name=\"").append(modulName).append('"');// NOI18N
    }
    if (spec != null) {
        sb.append(" spec=\"").append(spec.toString()).append('"');// NOI18N
    }
    sb.append("/>"); // NOI18N
    pw.println(sb.toString());
}
 
Example 3
Source File: NetigsoBundleFile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static InputStream fakeManifest(ModuleInfo m) throws IOException {
    String exp = (String) m.getAttribute("OpenIDE-Module-Public-Packages"); // NOI18N
    if ("-".equals(exp)) { // NOI18N
        return null;
    }
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    Manifest man = new Manifest();
    man.getMainAttributes().putValue("Manifest-Version", "1.0"); // workaround for JDK bug
    man.getMainAttributes().putValue("Bundle-ManifestVersion", "2"); // NOI18N
    man.getMainAttributes().putValue("Bundle-SymbolicName", m.getCodeNameBase()); // NOI18N

    if (m.getSpecificationVersion() != null) {
        String spec = threeDotsWithMajor(m.getSpecificationVersion().toString(), m.getCodeName());
        man.getMainAttributes().putValue("Bundle-Version", spec.toString()); // NOI18N
    }
    if (exp != null) {
        man.getMainAttributes().putValue("Export-Package", exp.replaceAll("\\.\\*", "")); // NOI18N
    } else {
        man.getMainAttributes().putValue("Export-Package", m.getCodeNameBase()); // NOI18N
    }
    man.write(os);
    return new ByteArrayInputStream(os.toByteArray());
}
 
Example 4
Source File: EnabledModulesCollector.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static String[] getModuleNames(List<ModuleInfo> modules) {
    String[] names = new String[modules.size()];
    int i = 0;
    for (ModuleInfo m : modules) {
        SpecificationVersion specVersion = m.getSpecificationVersion();
        if (specVersion != null) {
            names[i++]   = m.getCodeName() + " [" + specVersion.toString() + "]";
        } else {
            names[i++] = m.getCodeName();
        }
    }
    return names;
}
 
Example 5
Source File: ArtificialFeaturesProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static String createVersion (Collection<ModuleInfo> modules) {
    String version = "";
    for (ModuleInfo info : modules) {
        SpecificationVersion spec = info.getSpecificationVersion ();
        version = addVersion (version, spec);
    }
    return version;
}