use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.
the class RemoteCLICommand method getManHabitat.
/**
* Return a ServiceLocator used just for reading man pages from the modules
* in the modules directory.
*/
private static synchronized ServiceLocator getManHabitat() {
if (manServiceLocator != null)
return manServiceLocator;
ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader());
manServiceLocator = registry.createServiceLocator("default");
return manServiceLocator;
}
use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.
the class RemoteCommand method getManHabitat.
/**
* Return a ServiceLocator used just for reading man pages from the
* modules in the modules directory.
*/
private static synchronized ServiceLocator getManHabitat() {
if (manServiceLocator != null)
return manServiceLocator;
ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader());
ServiceLocator serviceLocator = registry.createServiceLocator("default");
manServiceLocator = serviceLocator;
return manServiceLocator;
}
use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.
the class VerifyDomainXmlCommand method executeCommand.
/**
*/
@Override
protected int executeCommand() throws CommandException, CommandValidationException {
File domainXMLFile = getDomainXml();
logger.log(Level.FINER, "Domain XML file = {0}", domainXMLFile);
try {
// get the list of JAR files from the modules directory
ArrayList<URL> urls = new ArrayList<URL>();
File idir = new File(System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
File mdir = new File(idir, "modules");
for (File f : mdir.listFiles()) {
if (f.toString().endsWith(".jar")) {
urls.add(f.toURI().toURL());
}
}
final URL[] urlsA = urls.toArray(new URL[urls.size()]);
ClassLoader cl = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Object run() {
return new URLClassLoader(urlsA, Globals.class.getClassLoader());
}
});
ModulesRegistry registry = new StaticModulesRegistry(cl);
ServiceLocator serviceLocator = registry.createServiceLocator("default");
ConfigParser parser = new ConfigParser(serviceLocator);
URL domainURL = domainXMLFile.toURI().toURL();
DomDocument doc = parser.parse(domainURL);
Dom domDomain = doc.getRoot();
Domain domain = domDomain.createProxy(Domain.class);
DomainXmlVerifier validator = new DomainXmlVerifier(domain);
if (validator.invokeConfigValidator())
return 1;
} catch (Exception e) {
throw new CommandException(e);
}
return 0;
}
use of com.sun.enterprise.module.single.StaticModulesRegistry in project Payara by payara.
the class Globals method getStaticHabitat.
/**
* Returns the default service locator. If it does not exist, one will be created.
* @return
*/
public static ServiceLocator getStaticHabitat() {
if (defaultHabitat == null) {
synchronized (staticLock) {
if (defaultHabitat == null) {
ModulesRegistry modulesRegistry = new StaticModulesRegistry(Globals.class.getClassLoader());
defaultHabitat = modulesRegistry.createServiceLocator("default");
}
}
}
return defaultHabitat;
}
Aggregations