本文整理汇总了Java中org.openide.modules.ModuleInfo.getCodeNameBase方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleInfo.getCodeNameBase方法的具体用法?Java ModuleInfo.getCodeNameBase怎么用?Java ModuleInfo.getCodeNameBase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.modules.ModuleInfo
的用法示例。
在下文中一共展示了ModuleInfo.getCodeNameBase方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCustomDefClassLoaders
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
/**
* Get a map from enabled module code name bases to class loaders containing
* JARs from ant/nblib/*.jar.
*/
private static Map<String,ClassLoader> createCustomDefClassLoaders(ClassLoader main) throws IOException {
Map<String,ClassLoader> m = new HashMap<String,ClassLoader>();
ModuleInfo[] modules = miscListener.getEnabledModules();
InstalledFileLocator ifl = InstalledFileLocator.getDefault();
for (ModuleInfo module : modules) {
String cnb = module.getCodeNameBase();
String cnbDashes = cnb.replace('.', '-');
File lib = ifl.locate("ant/nblib/" + cnbDashes + ".jar", cnb, false); // NOI18N
if (lib == null) {
if (main.getResource(cnb.replace('.', '/') + "/antlib.xml") != null) { // NOI18N
// Run-in-classpath mode.
m.put(cnb, main);
}
continue;
}
ClassLoader l = createAuxClassLoader(lib, main, module.getClassLoader());
m.put(cnb, l);
}
return m;
}
示例2: findProperty
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
final String findProperty(ModuleInfo m, String name, boolean localized) {
final String fullName = m.getCodeNameBase() + '.' + name;
final String nullValue = "\u0000"; // NOI18N
if (modulePropertiesCached) {
String val = moduleProperties.getProperty(fullName);
if (nullValue.equals(val)) {
return null;
}
if (val != null) {
return val;
}
LOG.log(Level.FINE, "not cached value: {0} for {1}", new Object[]{name, m});
}
Object p = localized ? m.getLocalizedAttribute(name) : m.getAttribute(name);
if (p == null) {
moduleProperties.setProperty(fullName, nullValue);
Stamps.getModulesJARs().scheduleSave(this, CACHE, false);
return null;
}
String prop = p instanceof String ? (String)p : null;
if (prop != null) {
moduleProperties.setProperty(fullName, prop);
Stamps.getModulesJARs().scheduleSave(this, CACHE, false);
}
return prop;
}
示例3: getUpdateItems
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
@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;
}
示例4: isPack
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
private boolean isPack( ModuleInfo mi ) {
String moduleName = mi.getCodeNameBase();
for( String pn : packNames ) {
if( moduleName.startsWith(pn) )
return true;
}
return false;
}
示例5: findCNBForClass
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
public static String findCNBForClass(@NonNull Class<?> cls) {
String absolutePath;
ModuleInfo owner = Modules.getDefault().ownerOf(cls);
if (owner != null) {
absolutePath = owner.getCodeNameBase();
} else {
absolutePath = cls.getName().replaceFirst("(^|\\.)[^.]+$", "");//NOI18N
}
return absolutePath.replace('.', '-');
}
示例6: isErgonomicsPack
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
private boolean isErgonomicsPack( ModuleInfo mi ) {
String moduleName = mi.getCodeNameBase();
return moduleName.startsWith(ergonomicsPackName) && mi.isEnabled();
}
示例7: getUpdateItems
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
@Override
public Map<String, UpdateItem> getUpdateItems() throws IOException {
Map<String, UpdateItem> items = InstalledModuleProvider.getDefault().getUpdateItems();
assertNotNull("Installed modules must found.", items);
int size = items.size();
assertTrue("Count of installed modules are more then once.", size > 1);
String pilotName = items.keySet().iterator().next();
assertNotNull(pilotName + "must found", items.get(pilotName));
UpdateItem pilotItem = items.get(pilotName);
assertNotNull("Impl of " + pilotItem + " available", Trampoline.SPI.impl(pilotItem));
UpdateItemImpl pilotItemImpl = Trampoline.SPI.impl(pilotItem);
assertTrue("Impl of " + pilotItem + "is ModuleItem", pilotItemImpl instanceof ModuleItem);
ModuleItem pilotModuleItem = (ModuleItem) pilotItemImpl;
SpecificationVersion pilotSV = new SpecificationVersion(pilotModuleItem.getSpecificationVersion());
assertTrue("a dot is present in " + pilotSV, pilotSV.toString().indexOf('.') != -1);
int dot = pilotSV.toString().indexOf('.');
String postSpec = pilotSV.toString().substring(dot + 1);
String preSpec = pilotSV.toString().substring(0, dot);
Integer digit = 0;
try {
digit = Integer.parseInt(preSpec) + 1;
} catch (NumberFormatException nfe) {
fail(nfe.getLocalizedMessage());
}
SpecificationVersion higherSV = new SpecificationVersion(digit + "." + postSpec);
assertTrue(higherSV + " is more then " + pilotSV, higherSV.compareTo(pilotSV) > 0);
String higherDep = pilotModuleItem.getModuleInfo().getCodeNameBase() + " > " + higherSV;
Set<String> deps = new HashSet<String>(items.size());
for (String id : items.keySet()) {
String dep = null;
if (!pilotName.equals(id)) {
UpdateItem item = items.get(id);
assertNotNull("Impl of " + item + " available", Trampoline.SPI.impl(item));
UpdateItemImpl itemImpl = Trampoline.SPI.impl(item);
assertTrue("Impl of " + item + "is ModuleItem", itemImpl instanceof ModuleItem);
ModuleItem moduleItem = (ModuleItem) itemImpl;
Module m = Utilities.toModule(moduleItem.getModuleInfo());
if (m != null && m.getProblems().isEmpty()) {
dep = moduleItem.getModuleInfo().getCodeNameBase() + " > " + moduleItem.getSpecificationVersion();
}
} else {
dep = higherDep;
}
if (dep != null) {
deps.add(dep);
}
}
Map<String, UpdateItem> res = InstalledModuleProvider.getDefault().getUpdateItems();
ModuleInfo info = pilotModuleItem.getModuleInfo();
UpdateItemImpl higherItemImpl = new InstalledModuleItem(
info.getCodeNameBase(),
higherSV.toString(),
new HackedModuleInfo(info, higherSV),
null, // XXX author
null, // installed cluster
null);
UpdateItem higherModuleItem = Utilities.createUpdateItem(higherItemImpl);
res.put("testFeatureDependsOnModules",
UpdateItem.createFeature(
"testFeatureDependsOnModules",
"1.0",
deps,
null,
null,
null));
res.put(pilotName, higherModuleItem);
res.put("testDependsOnFeature", UpdateItem.createFeature(
"testDependsOnFeature", "1.3",
Collections.singleton("testFeatureDependsOnModules"),
null, null, null));
return res;
}
示例8: getUpdateItems
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
public Map<String, UpdateItem> getUpdateItems () throws IOException {
Map<String, UpdateItem> items = InstalledModuleProvider.getDefault().getUpdateItems ();
assertNotNull ("Installed modules must found.", items);
int size = items.size ();
assertTrue ("Count of installed modules are more then once.", size > 1);
String pilotName = items.keySet ().iterator ().next ();
assertNotNull (pilotName + "must found", items.get (pilotName));
UpdateItem pilotItem = items.get (pilotName);
assertNotNull ("Impl of " + pilotItem + " available", Trampoline.SPI.impl (pilotItem));
UpdateItemImpl pilotItemImpl = Trampoline.SPI.impl (pilotItem);
assertTrue ("Impl of " + pilotItem + "is ModuleItem", pilotItemImpl instanceof ModuleItem);
ModuleItem pilotModuleItem = (ModuleItem) pilotItemImpl;
SpecificationVersion pilotSV = new SpecificationVersion (pilotModuleItem.getSpecificationVersion ());
assertTrue ("a dot is present in " + pilotSV, pilotSV.toString ().indexOf ('.') != -1);
int dot = pilotSV.toString ().indexOf ('.');
String postSpec = pilotSV.toString ().substring (dot + 1);
String preSpec = pilotSV.toString ().substring (0, dot);
Integer digit = 0;
try {
digit = Integer.parseInt (preSpec) + 1;
} catch (NumberFormatException nfe) {
fail (nfe.getLocalizedMessage ());
}
SpecificationVersion higherSV = new SpecificationVersion (digit + "." + postSpec);
assertTrue (higherSV + " is more then " + pilotSV, higherSV.compareTo (pilotSV) > 0);
String higherDep = pilotModuleItem.getModuleInfo ().getCodeNameBase () + " > " + higherSV;
Set<String> deps = new HashSet<String> (items.size ());
for (String id : items.keySet ()) {
String dep;
if (! pilotName.equals (id)) {
UpdateItem item = items.get (id);
assertNotNull ("Impl of " + item + " available", Trampoline.SPI.impl (item));
UpdateItemImpl itemImpl = Trampoline.SPI.impl (item);
assertTrue ("Impl of " + item + "is ModuleItem", itemImpl instanceof ModuleItem);
ModuleItem moduleItem = (ModuleItem) itemImpl;
dep = moduleItem.getModuleInfo ().getCodeNameBase () + " > " + moduleItem.getSpecificationVersion ();
} else {
dep = higherDep;
}
deps.add (dep);
}
Map<String, UpdateItem> res = InstalledModuleProvider.getDefault().getUpdateItems ();
ModuleInfo info = pilotModuleItem.getModuleInfo ();
UpdateItemImpl higherItemImpl = new InstalledModuleItem (
info.getCodeNameBase (),
higherSV.toString (),
new HackedModuleInfo (info, higherSV),
null, // XXX author
null, // installed cluster
null);
UpdateItem higherModuleItem = Utilities.createUpdateItem (higherItemImpl);
res.put ("testFeatureVsStandaloneModules",
UpdateItem.createFeature (
"testFeatureVsStandaloneModules",
"1.0",
deps,
null,
null,
null));
res.put (pilotName, higherModuleItem);
return res;
}