org.netbeans.bootstrap/1 2.52

org.netbeans
Class Util

java.lang.Object
  extended by org.netbeans.Util

public final class Util
extends Object

Static utility methods for use within this package.


Nested Class Summary
static interface Util.ModuleProvider
          Interface for a classloader to declare that it comes from a module.
 
Field Summary
static Logger err
          Log everything happening in the module system.
 
Method Summary
static boolean checkPackageDependency(Dependency dep, ClassLoader cl)
          Check whether a package dependency is met.
static String createPackageName(String name)
          Convert a class file name to a resource name suitable for Beans.instantiate.
static String[] getLocalizingSuffixesFast()
          Similar to NbBundle.getLocalizingSuffixes() but optimized.
static SpecificationVersion getModuleDep(Set<Dependency> dependencies, String cnb)
          Get API module dependency, if any, for a module.
static Map<Module,List<Module>> moduleDependencies(Collection<Module> modules, Map<String,Module> modulesByName, Map<String,Set<Module>> _providersOf)
          Enumerate (direct) interdependencies among a set of modules.
static Object[] parseCodeName(String cn)
          Find the code name base and major release version from a code name.
static void transitiveClosureModuleDependencies(ModuleManager mgr, Set<Module> modules)
          Transitively fill out a set of modules with all of its module dependencies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

err

public static final Logger err
Log everything happening in the module system.

Method Detail

getLocalizingSuffixesFast

public static String[] getLocalizingSuffixesFast()
Similar to NbBundle.getLocalizingSuffixes() but optimized.

Since:
JST-PENDING: Called from InstalledFileLocatorImpl

checkPackageDependency

public static boolean checkPackageDependency(Dependency dep,
                                             ClassLoader cl)
                                      throws IllegalArgumentException
Check whether a package dependency is met. A classloader must be supplied to check in.

Parameters:
dep - a module dependency
cl - a package-accessible classloader
Returns:
true if a package dependency is met
Throws:
IllegalArgumentException
Since:
2.14

moduleDependencies

public static Map<Module,List<Module>> moduleDependencies(Collection<Module> modules,
                                                          Map<String,Module> modulesByName,
                                                          Map<String,Set<Module>> _providersOf)
Enumerate (direct) interdependencies among a set of modules. If used in a topological sort, the result will be a reverse-order list of modules (suitable for disabling; reverse for enabling).

Parameters:
modules - some modules
modulesByName - map from module cnbs to modules (may contain unrelated modules)
providersOf - map from tokens to sets of modules providing them (may mention unrelated modules)
Returns:
a map from modules to lists of modules they depend on
See Also:
JST-PENDING needed from tests

createPackageName

public static String createPackageName(String name)
                                throws IllegalArgumentException
Convert a class file name to a resource name suitable for Beans.instantiate.

Parameters:
name - resource name of class file
Returns:
class name without the .class/.ser extension, and using dots as package separator
Throws:
IllegalArgumentException - if the name did not have a valid extension, or originally contained dots outside the extension, etc.
Since:
JST-PENDING: used from NbInstaller

parseCodeName

public static Object[] parseCodeName(String cn)
                              throws NumberFormatException
Find the code name base and major release version from a code name. Caches these parses. Thread-safe (i.e. OK from read mutex).

Returns:
an array consisting of the code name base (String) followed by the release version (Integer or null) followed by another end-range version (Integer or null)
Throws:
NumberFormatException - if the release version is mangled
Since:
JST-PENDING: used from NbInstaller

getModuleDep

public static SpecificationVersion getModuleDep(Set<Dependency> dependencies,
                                                String cnb)
Get API module dependency, if any, for a module.

Parameters:
dependencies - module dependencies
cnb - code name base of API module
Returns:
a fake spec version (0.x.y if x.y w/ no major release, else r.x.y); or null if no dep
Since:
JST-PENDING: used from NbInstaller

transitiveClosureModuleDependencies

public static void transitiveClosureModuleDependencies(ModuleManager mgr,
                                                       Set<Module> modules)
Transitively fill out a set of modules with all of its module dependencies. Dependencies on missing modules are silently ignored, but dependencies on present but uninstallable (problematic) modules are included.

Parameters:
mgr - the manager
modules - a mutable set of modules
Since:
JST-PENDING: used from NbInstaller

org.netbeans.bootstrap/1 2.52

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.