use of com.sun.enterprise.module.Repository in project glassfish-hk2 by eclipse-ee4j.
the class AbstractModulesRegistryImpl method getModules.
/**
* Returns the list of shared Modules registered in this instance.
*
* <p>
* The returned list will not include the modules defined in the ancestor
* {@link AbstractModulesRegistryImpl}s.
*
* @return an umodifiable list of loaded modules
*/
public Collection<HK2Module> getModules() {
// make a copy to avoid synchronizing since this API can be called while
// modules are added or removed by other threads.
Map<Integer, Repository> repos = new TreeMap<Integer, Repository>();
repos.putAll(repositories);
// force repository extraction
Set<Integer> keys = repos.keySet();
TreeSet<Integer> sortedKeys = new TreeSet<Integer>();
sortedKeys.addAll(keys);
for (Integer key : sortedKeys) {
Repository repo = repos.get(key);
for (ModuleDefinition moduleDef : repo.findAll()) {
if (modules.get(AbstractFactory.getInstance().createModuleId(moduleDef)) == null) {
HK2Module newModule = newModule(moduleDef);
if (newModule != null) {
// When some module can't get installed,
// don't halt proceeding, instead continue
add(newModule);
// don't resolve such modules, we just want to know about them
}
}
}
}
return modules.values();
}
use of com.sun.enterprise.module.Repository in project glassfish-hk2 by eclipse-ee4j.
the class AbstractModulesRegistryImpl method dumpState.
public void dumpState(PrintStream writer) {
StringBuilder sb = new StringBuilder("Registry Info:: Total repositories: " + repositories.size() + ", Total modules = " + modules.size() + "\n");
for (Repository repo : repositories.values()) {
sb.append("Attached repository: [" + repo + "]\n");
}
for (HK2Module module : getModules()) {
sb.append("Registered Module: [" + module + "]\n");
}
writer.println(sb);
}
use of com.sun.enterprise.module.Repository in project glassfish-hk2 by eclipse-ee4j.
the class AbstractModulesRegistryImpl method loadFromRepository.
protected HK2Module loadFromRepository(String name, String version) {
Set<Integer> keys = repositories.keySet();
TreeSet<Integer> sortedKeys = new TreeSet<Integer>();
sortedKeys.addAll(keys);
for (Integer key : sortedKeys) {
Repository repo = repositories.get(key);
ModuleDefinition moduleDef = repo.find(name, version);
if (moduleDef != null) {
return newModule(moduleDef);
}
}
return null;
}
Aggregations